backlog.vue 7.6 KB

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