调解系统PC端服务

addNodeprocess.vue 10KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. <template>
  2. <div>
  3. <el-dialog title="新增流程节点" :visible="addvisiable" v-if="addvisiable" @close="cancel" width="600px" center>
  4. <el-form :model="ruleForm" label-position="left" :rules="rules" ref="ruleForm" label-width="90px"
  5. class="demo-ruleForm">
  6. <el-form-item label="节点名称" prop="nodeName">
  7. <el-select v-model="ruleForm.nodeName" placeholder="请选择" @change="changenodeName">
  8. <el-option v-for="dict in dict.type.case_flow_node" :key="dict.value" :label="dict.label"
  9. :value="dict.value"></el-option>
  10. </el-select>
  11. </el-form-item>
  12. <el-form-item label="案件状态" prop="caseStatusName">
  13. <el-input v-model="ruleForm.caseStatusName" placeholder="请输入"></el-input>
  14. </el-form-item>
  15. <el-form-item label="驳回节点" prop="backFlowName">
  16. <el-select v-model="ruleForm.backFlowId" placeholder="请选择" clearable>
  17. <el-option v-for="item in backflowArr" :key="item.backFlowId" :value="item.backFlowId"
  18. :label="item.backFlowName">
  19. </el-option>
  20. </el-select>
  21. </el-form-item>
  22. <el-form-item label="关联角色" prop="roleIds">
  23. <el-select v-model="ruleForm.roleIds" multiple placeholder="请选择">
  24. <el-option v-for="item in roleArr" :key="item.roleId" :label="item.roleName" :value="item.roleId">
  25. </el-option>
  26. </el-select>
  27. </el-form-item>
  28. <el-form-item label="权限字符" prop="buttonAuthFlag">
  29. <el-input v-model="ruleForm.buttonAuthFlag" placeholder="请输入"></el-input>
  30. </el-form-item>
  31. <el-form-item label="节点图标" prop="nodeIcon">
  32. <el-upload
  33. class="avatar-uploader"
  34. :action="uploadImgUrl"
  35. :show-file-list="false"
  36. :headers="headers"
  37. :data="filedata"
  38. :on-success="handleAvatarSuccess"
  39. :before-upload="beforeAvatarUpload">
  40. <img v-if="imageUrl" :src="imgSvgUrl" class="avatar">
  41. <i v-else class="el-icon-plus avatar-uploader-icon"></i>
  42. <div slot="tip" class="el-upload__tip">只能上传SVG图片</div>
  43. </el-upload>
  44. </el-form-item>
  45. </el-form>
  46. <div slot="footer" class="dialog-footer">
  47. <el-button @click="cancel" class="endbutton"><span>取 消</span></el-button>
  48. <el-button type="primary" @click="submitForm" class="endbutton"><span>确认</span></el-button>
  49. </div>
  50. </el-dialog>
  51. </div>
  52. </template>
  53. <script>
  54. import { queryCaseFlowInfo, saveCaseFlow } from "@/api/caseprocessManagement/caseprocessManagement.js";
  55. import { listRole } from "@/api/system/role";
  56. import { getToken } from "@/utils/auth";
  57. export default {
  58. props: ["addvisiable", "editData", "queryParams"],
  59. dicts: ["case_flow_node"],
  60. data() {
  61. return {
  62. fileList: [],
  63. data: [],
  64. backflowArr: [],//驳回节点
  65. roleArr: [],//关联角色
  66. isImg: false,
  67. filedata: {
  68. annexType: 11,
  69. },
  70. flagBtn: false,
  71. ruleForm: {},
  72. rules: {
  73. nodeName: [
  74. { required: true, message: '请选择模版名称', trigger: 'blur' },
  75. ],
  76. caseStatusName: [
  77. { required: true, message: '请输入案件状态', trigger: 'blur' },
  78. ],
  79. roleIds: [
  80. { required: true, message: '请选择关联角色', trigger: 'blur' },
  81. ],
  82. buttonAuthFlag: [
  83. { required: true, message: '请输入权限字符', trigger: 'blur' },
  84. ]
  85. },
  86. dealvalue: [],
  87. imageUrl: '',
  88. uploadImgUrl: process.env.VUE_APP_BASE_API + "/common/upload", // 上传的图片服务器地址
  89. headers: {
  90. Authorization: "Bearer " + getToken(),
  91. },
  92. fileName: '',
  93. imgSvgUrl: ''
  94. };
  95. },
  96. watch: {
  97. addvisiable(val) {
  98. if (val) {
  99. this.ruleForm = this.editData;
  100. console.log(this.ruleForm,'this.ruleForm');
  101. this.getRoles();
  102. this.getbackflowArr();
  103. if (this.ruleForm && this.ruleForm.fileName) {
  104. this.imgSvgUrl = process.env.VUE_APP_BASE_API + this.ruleForm.fileName;
  105. } else {
  106. this.imgSvgUrl = ''
  107. }
  108. }
  109. },
  110. fileName: {
  111. handler(val) {
  112. if (val) {
  113. this.imgSvgUrl = this.imageUrl
  114. }
  115. },
  116. deep: true
  117. }
  118. },
  119. created() {
  120. },
  121. methods: {
  122. changenodeName(val) {
  123. console.log(val, 'changeval');
  124. },
  125. // 获取驳回节点数据
  126. getbackflowArr() {
  127. let queryParams2 = {
  128. pageNum: 1,
  129. pageSize: 999,
  130. };
  131. queryCaseFlowInfo(queryParams2).then((res) => {
  132. this.backflowArr = [];
  133. res.rows.forEach(item => {
  134. this.backflowArr.push({
  135. backFlowName: item.nodeName,
  136. backFlowId: item.id
  137. })
  138. });
  139. if (this.editData.id) {
  140. let arr = this.backflowArr;
  141. let result = arr.filter(obj => obj.backFlowId !== this.editData.id);
  142. this.backflowArr = result
  143. }
  144. })
  145. },
  146. // 获取关联角色
  147. getRoles() {
  148. let queryParams1 = {
  149. pageNum: 1,
  150. pageSize: 100000000000000000,
  151. };
  152. listRole(queryParams1).then((res) => {
  153. this.roleArr = res.rows
  154. })
  155. },
  156. cancel() {
  157. this.$emit("cancelAdd");
  158. },
  159. // 图标上传
  160. handleAvatarSuccess(res, file) {
  161. this.fileName = ''
  162. console.log(file.response.fileName,'上传成功的file');
  163. this.imageUrl = URL.createObjectURL(file.raw);
  164. this.fileName = file.response.fileName
  165. console.log(this.imageUrl,'上传成功的this.imageUrl');
  166. },
  167. beforeAvatarUpload(file) {
  168. console.log(file,'file');
  169. const isSvg = file.type === 'image/svg+xml';
  170. if (!isSvg) {
  171. this.$message.error('上传图片只能是 SVG 格式!');
  172. }
  173. return isSvg;
  174. },
  175. // 提交
  176. submitForm() {
  177. this.$refs['ruleForm'].validate((valid) => {
  178. if (valid) {
  179. let params = {};
  180. if (this.ruleForm.id) {
  181. let nodevalue = this.dict.type.case_flow_node;
  182. this.dealvalue = nodevalue.filter((item) => {
  183. if (item.value == this.ruleForm.nodeId) {
  184. return item
  185. }
  186. }
  187. );
  188. // 编辑
  189. params = {
  190. id: this.ruleForm.id,
  191. nodeId: this.dealvalue[0].value,
  192. nodeName: this.dealvalue[0].label,
  193. caseStatusName: this.ruleForm.caseStatusName,
  194. backFlowId: this.ruleForm.backFlowId,
  195. roleIds: this.ruleForm.roleIds,
  196. sort: this.ruleForm.sort,
  197. buttonAuthFlag: this.ruleForm.buttonAuthFlag,
  198. fileName: this.fileName
  199. }
  200. } else {
  201. let nodevalue = this.dict.type.case_flow_node;
  202. this.dealvalue = nodevalue.filter((item) => {
  203. if (item.value == this.ruleForm.nodeName) {
  204. return item
  205. }
  206. }
  207. );
  208. // 新增
  209. params = {
  210. nodeId: this.dealvalue[0].value,
  211. nodeName: this.dealvalue[0].label,
  212. caseStatusName: this.ruleForm.caseStatusName,
  213. backFlowId: this.ruleForm.backFlowId,
  214. roleIds: this.ruleForm.roleIds,
  215. buttonAuthFlag: this.ruleForm.buttonAuthFlag,
  216. fileName: this.fileName
  217. }
  218. }
  219. if (params.backFlowId == undefined) {
  220. delete params.backFlowId
  221. }
  222. saveCaseFlow(params).then((res) => {
  223. this.$modal.msgSuccess("成功!");
  224. this.$emit("getList", this.queryParams)
  225. this.$emit("cancelAdd");
  226. })
  227. }
  228. });
  229. },
  230. },
  231. };
  232. </script>
  233. <style lang="scss" scoped>
  234. ::v-deep .el-select {
  235. width: 100%;
  236. }
  237. .avatar-uploader .el-upload {
  238. border: 1px dashed #d9d9d9;
  239. border-radius: 6px;
  240. cursor: pointer;
  241. position: relative;
  242. overflow: hidden;
  243. }
  244. // .avatar-uploader .el-upload:hover {
  245. // border-color: #409EFF;
  246. // }
  247. .avatar-uploader-icon {
  248. border: 1px dashed #d9d9d9;
  249. font-size: 28px;
  250. color: #8c939d;
  251. width: 100px;
  252. height: 100px;
  253. line-height: 100px;
  254. text-align: center;
  255. }
  256. .avatar-uploader-icon:hover {
  257. border-color: #409EFF;
  258. }
  259. .avatar {
  260. width: 100px;
  261. height: 100px;
  262. display: block;
  263. }
  264. </style>