backlog.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  1. <!-- 2无缓存,只展示代办数据 -->
  2. <template>
  3. <div class="pageIndexClass">
  4. <!-- <Banner /> -->
  5. <div class="content">
  6. <byTable :source="sourceList.data" :pagination="sourceList.pagination" :config="config" :loading="loading" highlight-current-row
  7. :selectConfig="selectConfig" :table-events="{
  8. //element talbe事件都能传
  9. select: select,
  10. }" @get-list="getList">
  11. <template #slotName="{ item }">
  12. {{ item.createTime }}
  13. </template>
  14. <template #nodeType="{item}">
  15. <div style="width:100%">
  16. <span :class="{csNode:item.nodeHandleType=='30'}"> {{dictValueLabel(item.nodeHandleType,nodeTypeData)}}</span>
  17. </div>
  18. </template>
  19. </byTable>
  20. </div>
  21. <el-dialog :title="modalType == 'add' ? '新增' : '编辑'" v-model="dialogVisible" width="400" v-loading="loading">
  22. <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="byform">
  23. </byForm>
  24. <template #footer>
  25. <el-button @click="dialogVisible = false" size="default">取 消</el-button>
  26. <el-button type="primary" @click="submitForm('byform')" size="default" :loading="submitLoading">
  27. 确 定
  28. </el-button>
  29. </template>
  30. </el-dialog>
  31. </div>
  32. </template>
  33. <script setup name="Backlog">
  34. /* eslint-disable vue/no-unused-components */
  35. import { ElMessage, ElMessageBox } from "element-plus";
  36. import byTable from "@/components/byTable/index";
  37. import byForm from "@/components/byForm/index";
  38. import { computed, defineComponent, ref } from "vue";
  39. const loading = ref(false);
  40. const submitLoading = ref(false);
  41. const dictCommonModal = ref(false);
  42. const sourceList = ref({
  43. data: [],
  44. pagination: {
  45. total: 3,
  46. pageNum: 1,
  47. pageSize: 10,
  48. status: 1,
  49. },
  50. });
  51. let dialogVisible = ref(false);
  52. let roomDialogVisible = ref(false);
  53. let modalType = ref("add");
  54. let rules = ref({
  55. classifyName: [
  56. { required: true, message: "请输入功能模块", trigger: "blur" },
  57. ],
  58. flowKey: [{ required: true, message: "请输入流程标识", trigger: "blur" }],
  59. flowName: [{ required: true, message: "请输入流程名称", trigger: "blur" }],
  60. });
  61. const { proxy } = getCurrentInstance();
  62. const nodeTypeData = ref([
  63. {
  64. label: "常规",
  65. value: "10",
  66. },
  67. {
  68. label: "聚合",
  69. value: "20",
  70. },
  71. {
  72. label: "抄送",
  73. value: "30",
  74. },
  75. ]);
  76. const selectConfig = computed(() => {
  77. return [
  78. {
  79. label: "流程类型",
  80. prop: "flowInfoId",
  81. data: [],
  82. },
  83. ];
  84. });
  85. const config = computed(() => {
  86. return [
  87. {
  88. attrs: {
  89. label: "流程类型",
  90. prop: "flowName",
  91. width: 200,
  92. },
  93. },
  94. {
  95. attrs: {
  96. label: "流程标题",
  97. prop: "title",
  98. },
  99. },
  100. {
  101. attrs: {
  102. label: "当前处理节点",
  103. prop: "nodeName",
  104. width: 160,
  105. },
  106. },
  107. {
  108. attrs: {
  109. label: "节点类型",
  110. prop: "nodeType",
  111. slot: "nodeType",
  112. width: 100,
  113. },
  114. },
  115. {
  116. attrs: {
  117. label: "流程状态",
  118. width: 100,
  119. prop: "status",
  120. },
  121. render(status) {
  122. return status == 0 || status == 1
  123. ? "待处理"
  124. : status == 2
  125. ? "已通过"
  126. : "已驳回";
  127. },
  128. },
  129. {
  130. attrs: {
  131. label: "发起人",
  132. prop: "createUserName",
  133. width: 160,
  134. },
  135. },
  136. {
  137. attrs: {
  138. label: "发起时间",
  139. prop: "createTime",
  140. width: 160,
  141. },
  142. },
  143. {
  144. attrs: {
  145. label: "操作",
  146. width: "100",
  147. align: "center",
  148. },
  149. // 渲染 el-button,一般用在最后一列。
  150. renderHTML(row) {
  151. return [
  152. {
  153. attrs: {
  154. label: row.status == 0 || row.status == 1 ? "办理" : "查看",
  155. type: "primary",
  156. text: true,
  157. bg: true,
  158. disabled: false,
  159. },
  160. el: "button",
  161. click() {
  162. if (row.nodeHandleType == "30") {
  163. proxy.$router.push({
  164. path: "/platform_manage/process/processApproval",
  165. query: {
  166. flowKey: row.flowKey,
  167. id: row.id,
  168. processType: 10,
  169. version: row.version,
  170. businessId: row.businessId,
  171. submitType: "10",
  172. },
  173. });
  174. return;
  175. }
  176. if (row.status != 1 && row.status != 0) {
  177. proxy.$router.push({
  178. path: "/platform_manage/process/processApproval",
  179. query: {
  180. flowKey: row.flowKey,
  181. id: row.id,
  182. processType: 20,
  183. version: row.version,
  184. businessId: row.businessId,
  185. submitType: "10",
  186. },
  187. });
  188. return;
  189. }
  190. proxy
  191. .post("flowExample/getApprovalRecord", { id: row.id })
  192. .then((res) => {
  193. if (res.recordList.length > 0) {
  194. let data = res.recordList.filter(
  195. (item) => item.status === 2
  196. );
  197. let nodeType = 0;
  198. if (data && data.length > 0) {
  199. nodeType = data[0].nodeType;
  200. }
  201. proxy.$router.push({
  202. path: "/platform_manage/process/processApproval",
  203. query: {
  204. flowKey: row.flowKey,
  205. id: row.id,
  206. processType: nodeType == 1 ? 30 : 10,
  207. businessId: row.businessId,
  208. version: row.version,
  209. submitType: "10",
  210. },
  211. });
  212. }
  213. });
  214. },
  215. },
  216. ];
  217. },
  218. },
  219. ];
  220. });
  221. let dtlData = reactive({
  222. data: {},
  223. });
  224. let formData = reactive({
  225. data: {},
  226. treeData: [],
  227. });
  228. const formOption = reactive({
  229. inline: true,
  230. labelWidth: 100,
  231. itemWidth: 100,
  232. rules: [],
  233. });
  234. const byform = ref(null);
  235. const treeData = ref([]);
  236. const formConfig = computed(() => {
  237. return [
  238. {
  239. type: "input",
  240. prop: "classifyName",
  241. label: "功能模块",
  242. },
  243. {
  244. type: "input",
  245. prop: "flowKey",
  246. label: "流程标识",
  247. isHide: modalType.value == "edit",
  248. },
  249. {
  250. type: "input",
  251. prop: "flowName",
  252. label: "流程名称",
  253. },
  254. ];
  255. });
  256. const flowJump = (row, type) => {
  257. proxy
  258. .post("/flowProcess/jump", {
  259. flowId: row.id,
  260. handleType: type,
  261. version: row.version,
  262. data: {},
  263. })
  264. .then((message) => {
  265. console.log(message);
  266. if (message) {
  267. ElMessage.success("操作成功");
  268. getList();
  269. }
  270. });
  271. };
  272. const getFlowType = () => {
  273. proxy.post("/flowExample/getFlowType").then((message) => {
  274. console.log(message);
  275. selectConfig.value[0].data = message.map((item) => {
  276. return {
  277. label: item.flowName,
  278. value: item.id,
  279. };
  280. });
  281. });
  282. };
  283. getFlowType();
  284. const getUrlObj = {
  285. 1: "/flowExample/getToBeProcessedPage",
  286. 2: "/flowExample/getHaveInitiatedPage",
  287. 3: "/flowExample/getProcessedPage",
  288. };
  289. const getList = async (req) => {
  290. sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
  291. loading.value = true;
  292. proxy
  293. .post(
  294. getUrlObj[sourceList.value.pagination.status],
  295. sourceList.value.pagination
  296. )
  297. .then((message) => {
  298. console.log(message);
  299. sourceList.value.data = message.rows;
  300. sourceList.value.pagination.total = message.total;
  301. setTimeout(() => {
  302. loading.value = false;
  303. }, 200);
  304. });
  305. };
  306. const openModal = () => {
  307. dialogVisible.value = true;
  308. modalType.value = "add";
  309. formData.data = {};
  310. };
  311. const selection = ref({
  312. data: [],
  313. });
  314. const select = (_selection, row) => {
  315. selection.value.data = _selection;
  316. console.log(_selection.length);
  317. };
  318. const tree = ref(null);
  319. const submitTree = () => {
  320. proxy
  321. .post("/tenantInfo/bindingMenu", {
  322. tenantId: selection.value.data[0].tenantId,
  323. menuIdList: tree.value.getCheckedKeys(),
  324. })
  325. .then((res) => {
  326. ElMessage({
  327. message: "保存成功",
  328. type: "success",
  329. });
  330. roomDialogVisible.value = false;
  331. });
  332. };
  333. const submitForm = () => {
  334. byform.value.handleSubmit((valid) => {
  335. submitLoading.value = true;
  336. proxy.post("/flowInfo/" + modalType.value, formData.data).then((res) => {
  337. ElMessage({
  338. message: modalType.value == "add" ? "添加成功" : "编辑成功",
  339. type: "success",
  340. });
  341. dialogVisible.value = false;
  342. submitLoading.value = false;
  343. getList();
  344. });
  345. });
  346. };
  347. const getDtl = (row) => {
  348. formData.data = { ...row };
  349. modalType.value = "edit";
  350. dialogVisible.value = true;
  351. };
  352. const changeStatus = (row) => {
  353. modalType.value = "edit";
  354. proxy
  355. .post("/flowInfo/edit", { ...row, status: row.status === 0 ? 1 : 0 })
  356. .then((res) => {
  357. ElMessage({
  358. message: "操作成功",
  359. type: "success",
  360. });
  361. getList();
  362. });
  363. };
  364. onMounted(() => {
  365. const route = useRoute();
  366. sourceList.value.pagination.status = route.query.type ? route.query.type : 1;
  367. getList();
  368. });
  369. </script>
  370. <style lang="scss" scoped>
  371. .tenant {
  372. padding: 20px;
  373. }
  374. .csNode {
  375. background: #39c55a;
  376. color: #fff;
  377. border-radius: 2px;
  378. padding: 4px;
  379. }
  380. </style>