123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- <template>
- <hc-new-card>
- <template #header>
- <el-button hc-btn type="primary" @click="addFlowData">新建流程</el-button>
- </template>
- <template #extra>
- <el-alert :closable="false" title="同一合同段内,只需要设置重复岗位的流程即可,其他任务岗位,系统将自动推送,无需创建更多任务流" type="error" />
- </template>
- <hc-table :column="tableColumn" :datas="tableData" :loading="tableLoading" is-new :index-style="{ width: 60 }">
- <template #action="{ row }">
- <el-link type="success" @click="handleTableEdit(row)">修改</el-link>
- <el-link type="danger">删除</el-link>
- </template>
- </hc-table>
- <template #action>
- <hc-pages :pages="searchForm" @change="pageChange" />
- </template>
- <!-- 新增/编辑流程 弹框 -->
- <hc-new-dialog v-model="showEditModal" :title="`${flowFormData.id ? '编辑' : '新增'}流程`" widths="40rem">
- <el-form ref="formFlowRef" class="p-4" :model="flowFormData" :rules="formFlowRules" label-width="auto" size="large">
- <el-form-item label="流程名称" prop="fixedFlowName">
- <el-input v-model="flowFormData.fixedFlowName" placeholder="请输入流程名称" />
- </el-form-item>
- <el-form-item label="任务人" prop="linkUserJoinString">
- <hc-tasks-user :contract-id="contractId" :project-id="projectId" :users="flowFormData.linkUserJoinString" ui="w-full" @change="tasksUserChange" />
- </el-form-item>
- </el-form>
- <template #footer>
- <div class="dialog-footer">
- <el-button size="large" @click="showEditModal = false">取消</el-button>
- <el-button :loading="sevaLoading" hc-btn type="primary" @click="saveFormClick">保存</el-button>
- </div>
- </template>
- </hc-new-dialog>
- </hc-new-card>
- </template>
- <script setup>
- import { onMounted, ref } from 'vue'
- import { useAppStore } from '~src/store'
- //变量
- const store = useAppStore()
- const projectId = ref(store.getProjectId)
- const contractId = ref(store.getContractId)
- //渲染完成
- onMounted(() => {
- })
- //搜索表单
- const searchForm = ref({
- key1: null, current: 1, size: 10, total: 0,
- })
- //分页
- const pageChange = ({ current, size }) => {
- searchForm.value.current = current
- searchForm.value.size = size
- }
- //表格数据
- const tableLoading = ref(false)
- const tableColumn = ref([
- { key: 'fixedFlowName', name: '流程名称' },
- { key: 'linkUserJoinString', name: '流程详情' },
- { key: 'action', name: '操作', width: 94 },
- ])
- const tableData = ref([
- { fixedFlowName: '1111' },
- ])
- //新建流程
- const addFlowData = () => {
- flowFormData.value = { id: '', fixedFlowName: '', linkUserJoinString: '' }
- showEditModal.value = true
- }
- //编辑流程
- const handleTableEdit = async (row) => {
- flowFormData.value = { id: '', fixedFlowName: '', linkUserJoinString: '' }
- showEditModal.value = true
- }
- //新增编辑数据
- const showEditModal = ref(false)
- const formFlowRef = ref(null)
- const flowFormData = ref({ id: '', fixedFlowName: '', linkUserJoinString: '' })
- const formFlowRules = {
- fixedFlowName: {
- required: true,
- trigger: 'blur',
- message: '请输入流程名称',
- },
- linkUserJoinString: {
- required: true,
- trigger: 'blur',
- message: '请选择任务人',
- },
- }
- //任务人选择改变
- const tasksUserChange = (a, b, users) => {
- flowFormData.value.linkUserJoinString = users
- }
- //提交保存
- const sevaLoading = ref(false)
- const saveFormClick = async () => {
- const form = flowFormData.value
- console.log(form)
- }
- </script>
|