flow.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <hc-new-card>
  3. <template #header>
  4. <el-button hc-btn type="primary" @click="addFlowData">新建流程</el-button>
  5. </template>
  6. <template #extra>
  7. <el-alert :closable="false" title="同一合同段内,只需要设置重复岗位的流程即可,其他任务岗位,系统将自动推送,无需创建更多任务流" type="error" />
  8. </template>
  9. <hc-table :column="tableColumn" :datas="tableData" :loading="tableLoading" is-new :index-style="{ width: 60 }">
  10. <template #action="{ row }">
  11. <el-link type="success" @click="handleTableEdit(row)">修改</el-link>
  12. <el-link type="danger">删除</el-link>
  13. </template>
  14. </hc-table>
  15. <template #action>
  16. <hc-pages :pages="searchForm" @change="pageChange" />
  17. </template>
  18. <!-- 新增/编辑流程 弹框 -->
  19. <hc-new-dialog v-model="showEditModal" :title="`${flowFormData.id ? '编辑' : '新增'}流程`" widths="40rem">
  20. <el-form ref="formFlowRef" class="p-4" :model="flowFormData" :rules="formFlowRules" label-width="auto" size="large">
  21. <el-form-item label="流程名称" prop="fixedFlowName">
  22. <el-input v-model="flowFormData.fixedFlowName" placeholder="请输入流程名称" />
  23. </el-form-item>
  24. <el-form-item label="任务人" prop="linkUserJoinString">
  25. <hc-tasks-user :contract-id="contractId" :project-id="projectId" :users="flowFormData.linkUserJoinString" ui="w-full" @change="tasksUserChange" />
  26. </el-form-item>
  27. </el-form>
  28. <template #footer>
  29. <div class="dialog-footer">
  30. <el-button size="large" @click="showEditModal = false">取消</el-button>
  31. <el-button :loading="sevaLoading" hc-btn type="primary" @click="saveFormClick">保存</el-button>
  32. </div>
  33. </template>
  34. </hc-new-dialog>
  35. </hc-new-card>
  36. </template>
  37. <script setup>
  38. import { onMounted, ref } from 'vue'
  39. import { useAppStore } from '~src/store'
  40. //变量
  41. const store = useAppStore()
  42. const projectId = ref(store.getProjectId)
  43. const contractId = ref(store.getContractId)
  44. //渲染完成
  45. onMounted(() => {
  46. })
  47. //搜索表单
  48. const searchForm = ref({
  49. key1: null, current: 1, size: 10, total: 0,
  50. })
  51. //分页
  52. const pageChange = ({ current, size }) => {
  53. searchForm.value.current = current
  54. searchForm.value.size = size
  55. }
  56. //表格数据
  57. const tableLoading = ref(false)
  58. const tableColumn = ref([
  59. { key: 'fixedFlowName', name: '流程名称' },
  60. { key: 'linkUserJoinString', name: '流程详情' },
  61. { key: 'action', name: '操作', width: 94 },
  62. ])
  63. const tableData = ref([
  64. { fixedFlowName: '1111' },
  65. ])
  66. //新建流程
  67. const addFlowData = () => {
  68. flowFormData.value = { id: '', fixedFlowName: '', linkUserJoinString: '' }
  69. showEditModal.value = true
  70. }
  71. //编辑流程
  72. const handleTableEdit = async (row) => {
  73. flowFormData.value = { id: '', fixedFlowName: '', linkUserJoinString: '' }
  74. showEditModal.value = true
  75. }
  76. //新增编辑数据
  77. const showEditModal = ref(false)
  78. const formFlowRef = ref(null)
  79. const flowFormData = ref({ id: '', fixedFlowName: '', linkUserJoinString: '' })
  80. const formFlowRules = {
  81. fixedFlowName: {
  82. required: true,
  83. trigger: 'blur',
  84. message: '请输入流程名称',
  85. },
  86. linkUserJoinString: {
  87. required: true,
  88. trigger: 'blur',
  89. message: '请选择任务人',
  90. },
  91. }
  92. //任务人选择改变
  93. const tasksUserChange = (a, b, users) => {
  94. flowFormData.value.linkUserJoinString = users
  95. }
  96. //提交保存
  97. const sevaLoading = ref(false)
  98. const saveFormClick = async () => {
  99. const form = flowFormData.value
  100. console.log(form)
  101. }
  102. </script>