<!-- 选择合同执行变更登记表 --> <script lang="ts" setup name="selectCustomerContratList"> import { ElMessage } from 'element-plus' import type { Ref } from 'vue' import { ref } from 'vue' import dayjs from 'dayjs' import type { DateModelType } from 'element-plus' import type { deptType } from '@/global' import type { TableColumn } from '@/components/NormalTable/table_interface' import { getCustomerContractList } from '@/api/resource/contract' import { SCHEDULE } from '@/utils/scheduleDict' import { getCustomerInfoList } from '@/api/resource/customer' import { getDictByCode } from '@/api/system/dict' import { getExamineList } from '@/api/resource/examine' const props = defineProps({ isMulti: { type: Boolean, default: true, }, }) const emits = defineEmits(['confirm']) const dialogFormVisible = ref(false) // 控制对话框显隐 // 查询条件 const listQuery = ref({ approvalStatus: '0', // 审批状态类型code,导出接口不用传 createTimeEnd: '', // 创建时间结束 createTimeStart: '', // 创建时间开始 createUserName: '', // 创建人 customerAdvice: '', // 委托方意见(同意/拒绝) customerAdviceTimeEnd: '', // 委托方意见时间结束 customerAdviceTimeStart: '', // 委托方意见时间开始 customerId: '', // 委托方id customerName: '', // 委托方名字 examineName: '', // 合同评审表名称 examineNo: '', // 合同评审表编号 formNo: '', // 文件编号 groupCode: '', // 组别代码 labCode: '', // 实验室代码 sendStatus: '', // 通知发送状态(1/2) formId: SCHEDULE.CONTRACT_EXECUTE_CHANGE, // 表单id(流程定义对应的表单id,等价于业务id),此处为固定值 offset: 1, limit: 20, }) const dateRange = ref<[DateModelType, DateModelType]>(['', ''])// 筛选时间段数据 const timeRange = ref<[DateModelType, DateModelType]>(['', ''])// 筛选时间段数据 const checkoutList = ref([]) // 多选选中的内容 const loadingTable = ref(false) // 表格loading const list = ref([]) as any // 表格数据 const total = ref(0) // 数组总数 const columns = ref<TableColumn[]>([ { text: '实验室', value: 'labCodeName', align: 'center', width: '120' }, { text: '部门', value: 'groupCodeName', align: 'center', width: '120' }, { text: '文件编号', value: 'formNo', align: 'center' }, { text: '文件名称', value: 'formName', align: 'center' }, { text: '合同名称及编号', value: 'contractNameAndNo_hide', align: 'center', followLink: true, width: '380' }, { text: '委托方', value: 'customerName', align: 'center' }, { text: '创建人', value: 'createUserName', align: 'center' }, { text: '创建时间', value: 'createTime', align: 'center', width: '180' }, { text: '通知发送状态', value: 'sendStatusName', align: 'center', width: '90', styleFilter: (row: { sendStatusName: string }) => { return row.sendStatusName == '未发送' ? 'color: red' : 'color: #1aa034' } }, { text: '委托方意见', value: 'customerAdvice', align: 'center', width: '90', styleFilter: (row: { customerAdvice: string }) => { return row.customerAdvice == '拒绝' ? 'color: red' : 'color: #1aa034' } }, { text: '委托方意见时间', value: 'customerAdviceTime', align: 'center', width: '180' }, ]) // -----------------------------------------字典-------------------------------------------------------------- const groupCodeList = ref<deptType[]>([]) // 部门 const groupCodeDict = ref({}) as any// 部门 const labCodeList = ref<deptType[]>([]) // 实验室 const labCodeDict = ref({}) as any// 实验室 // 查询字典 const getDictFun = async () => { // 实验室 const resLabCode = await getDictByCode('bizLabCode') labCodeList.value = resLabCode.data resLabCode.data.forEach((item: { value: string;name: string }) => { labCodeDict.value[`${item.value}`] = item.name }) // 部门 const resGroupCode = await getDictByCode('bizGroupCode') groupCodeList.value = resGroupCode.data resGroupCode.data.forEach((item: { value: string;name: string }) => { groupCodeDict.value[`${item.value}`] = item.name }) } getDictFun() // -------------------------------------------------------------------------------------------- // 数据查询 function fetchData(isNowPage = false) { loadingTable.value = true if (!isNowPage) { // 是否显示当前页,否则跳转第一页 listQuery.value.offset = 1 } getCustomerContractList(listQuery.value).then((response) => { list.value = response.data.rows.map((item: any) => { return { ...item, sendStatusName: `${item.sendStatus}` === '1' ? '已发送' : `${item.sendStatus}` === '2' ? '未发送' : item.sendStatus, labCodeName: item.labCode ? labCodeDict.value[item.labCode] : item.labCode, // 实验室 groupCodeName: item.groupCode ? groupCodeDict.value[item.groupCode] : item.groupCode, // 部门 examineNameAndNo: item.examineName + item.examineNo, followLinkArr: [item.examineName + item.examineNo], } }) total.value = parseInt(response.data.total) loadingTable.value = false }) } // 重置 const clearList = () => { listQuery.value = { approvalStatus: '0', // 审批状态类型code,导出接口不用传 createTimeEnd: '', // 创建时间结束 createTimeStart: '', // 创建时间开始 createUserName: '', // 创建人 customerAdvice: '', // 委托方意见(同意/拒绝) customerAdviceTimeEnd: '', // 委托方意见时间结束 customerAdviceTimeStart: '', // 委托方意见时间开始 customerId: '', // 委托方id customerName: '', // 委托方名字 examineName: '', // 合同评审表名称 examineNo: '', // 合同评审表编号 formNo: '', // 文件编号 groupCode: '', // 组别代码 labCode: '', // 实验室代码 sendStatus: '', // 通知发送状态(1/2) formId: SCHEDULE.CONTRACT_EXECUTE_CHANGE, // 表单id(流程定义对应的表单id,等价于业务id),此处为固定值 offset: 1, limit: 20, } fetchData() } // 搜索 const search = () => { fetchData(true) } // 多选选中 const handleSelectionChange = (val: any) => { checkoutList.value = val } // 页数发生变化后的操作,可能是页码变化,可能是每页容量变化,此函数必写 const changePage = (val: { size?: number; page?: number }) => { if (val && val.size) { listQuery.value.limit = val.size } if (val && val.page) { listQuery.value.offset = val.page } search() } // 点击确定 const confirmSelect = () => { if (!checkoutList.value.length) { ElMessage.warning('请选中') } else { emits('confirm', checkoutList.value) dialogFormVisible.value = false } } // 取消 const resetForm = () => { dialogFormVisible.value = false clearList() } /** * 初始化 * @param isMultiParam 是否多选 */ const initDialog = () => { dialogFormVisible.value = true fetchData() } // ----------------------------------------------钩子------------------------------------------------------ watch(dateRange, (val) => { if (val) { listQuery.value.createTimeStart = `${val[0]}` listQuery.value.createTimeEnd = `${val[1]}` } else { listQuery.value.createTimeStart = '' listQuery.value.createTimeEnd = '' } }) defineExpose({ initDialog }) </script> <template> <el-dialog v-if="dialogFormVisible" v-model="dialogFormVisible" title="选择要求、委托书及合同评审表" width="65%"> <!-- 筛选条件 --> <search-area :need-clear="true" @search="search" @clear="clearList"> <search-item> <el-input v-model="listQuery.formNo" placeholder="文件编号" clearable /> </search-item> <!-- <search-item> <el-select v-model="listQuery.labCode" style="width: 140px;" placeholder="实验室" clearable> <el-option v-for="dict in labDeptList" :key="dict.id" :value="dict.value" :label="dict.name" /> </el-select> </search-item> <search-item> <el-select v-model="listQuery.groupCode" style="width: 140px;" placeholder="部门" clearable> <el-option v-for="dict in useDeptList" :key="dict.id" :value="dict.value" :label="dict.name" /> </el-select> </search-item> --> </search-area> <!-- 查询结果Table显示 --> <div style="padding: 12px;"> <normal-table :data="list" :total="total" :columns="columns" :query="listQuery" is-showmulti-select :is-multi="props.isMulti" :list-loading="loadingTable" :height="520" @change="changePage" @multi-select="handleSelectionChange" > <!-- 序号 --> <template #preColumns> <el-table-column label="#" width="55" align="center" fixed> <template #default="scope"> {{ (listQuery.offset - 1) * listQuery.limit + scope.$index + 1 }} </template> </el-table-column> </template> </normal-table> </div> <template #footer> <span class="dialog-footer"> <el-button type="primary" @click="confirmSelect">确认</el-button> <el-button @click="resetForm"> 取消 </el-button> </span> </template> </el-dialog> </template> <style lang="scss" scoped> :deep(.el-radio__label) { display: none; } </style>