index.vue 7.0 KB

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