调解系统PC端服务

addNodeprocess.vue 10KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  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="请选择">
  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. this.fileName = '',
  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. this.imageUrl = process.env.VUE_APP_BASE_API + this.ruleForm.fileName;
  106. this.fileName = this.ruleForm.fileName
  107. } else {
  108. this.imgSvgUrl = ''
  109. this.imageUrl = ''
  110. }
  111. }
  112. },
  113. fileName: {
  114. handler(val) {
  115. if (val) {
  116. this.imgSvgUrl = this.imageUrl
  117. }
  118. },
  119. deep: true
  120. }
  121. },
  122. created() {
  123. },
  124. methods: {
  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. this.imageUrl = URL.createObjectURL(file.raw);
  163. this.fileName = file.response.fileName
  164. },
  165. beforeAvatarUpload(file) {
  166. const isSvg = file.type === 'image/svg+xml';
  167. if (!isSvg) {
  168. this.$message.error('上传图片只能是 SVG 格式!');
  169. }
  170. return isSvg;
  171. },
  172. // 提交
  173. submitForm() {
  174. this.$refs['ruleForm'].validate((valid) => {
  175. if (valid) {
  176. let params = {};
  177. if (this.ruleForm.id) {
  178. let nodevalue = this.dict.type.case_flow_node;
  179. this.dealvalue = nodevalue.filter((item) => {
  180. if (item.value == this.ruleForm.nodeId) {
  181. return item
  182. }
  183. }
  184. );
  185. // 编辑
  186. params = {
  187. id: this.ruleForm.id,
  188. nodeId: this.dealvalue[0].value,
  189. nodeName: this.dealvalue[0].label,
  190. caseStatusName: this.ruleForm.caseStatusName,
  191. backFlowId: this.ruleForm.backFlowId,
  192. roleIds: this.ruleForm.roleIds,
  193. sort: this.ruleForm.sort,
  194. buttonAuthFlag: this.ruleForm.buttonAuthFlag,
  195. fileName: this.fileName
  196. }
  197. } else {
  198. let nodevalue = this.dict.type.case_flow_node;
  199. this.dealvalue = nodevalue.filter((item) => {
  200. if (item.value == this.ruleForm.nodeName) {
  201. return item
  202. }
  203. }
  204. );
  205. // 新增
  206. params = {
  207. nodeId: this.dealvalue[0].value,
  208. nodeName: this.dealvalue[0].label,
  209. caseStatusName: this.ruleForm.caseStatusName,
  210. backFlowId: this.ruleForm.backFlowId,
  211. roleIds: this.ruleForm.roleIds,
  212. buttonAuthFlag: this.ruleForm.buttonAuthFlag,
  213. fileName: this.fileName
  214. }
  215. }
  216. if (params.backFlowId == undefined) {
  217. delete params.backFlowId
  218. }
  219. saveCaseFlow(params).then((res) => {
  220. this.$modal.msgSuccess("成功!");
  221. this.$emit("getList", this.queryParams)
  222. this.$emit("cancelAdd");
  223. })
  224. }
  225. });
  226. },
  227. },
  228. };
  229. </script>
  230. <style lang="scss" scoped>
  231. ::v-deep .el-select {
  232. width: 100%;
  233. }
  234. .avatar-uploader .el-upload {
  235. border: 1px dashed #d9d9d9;
  236. border-radius: 6px;
  237. cursor: pointer;
  238. position: relative;
  239. overflow: hidden;
  240. }
  241. // .avatar-uploader .el-upload:hover {
  242. // border-color: #409EFF;
  243. // }
  244. .avatar-uploader-icon {
  245. border: 1px dashed #d9d9d9;
  246. font-size: 28px;
  247. color: #8c939d;
  248. width: 100px;
  249. height: 100px;
  250. line-height: 100px;
  251. text-align: center;
  252. }
  253. .avatar-uploader-icon:hover {
  254. border-color: #409EFF;
  255. }
  256. .avatar {
  257. width: 100px;
  258. height: 100px;
  259. display: block;
  260. }
  261. </style>