diff --git a/public/config/config.json b/public/config/config.json index be2c8e1..36e461e 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,6 +1,6 @@ { "title":"计量业务系统", - "versionByEqpt":"1.3.4.0", + "versionByEqpt":"1.3.5.0", "baseUrl": "http://111.198.10.15:21611", "baseUrlBusiness": "http://111.198.10.15:21606", "baseUrlLaboratory": "http://111.198.10.15:21610", diff --git a/public/config/config.json b/public/config/config.json index be2c8e1..36e461e 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,6 +1,6 @@ { "title":"计量业务系统", - "versionByEqpt":"1.3.4.0", + "versionByEqpt":"1.3.5.0", "baseUrl": "http://111.198.10.15:21611", "baseUrlBusiness": "http://111.198.10.15:21606", "baseUrlLaboratory": "http://111.198.10.15:21610", diff --git a/src/views/tested/MeasurementPlan/early/components/edit.vue b/src/views/tested/MeasurementPlan/early/components/edit.vue index 63b6ba0..5233de4 100644 --- a/src/views/tested/MeasurementPlan/early/components/edit.vue +++ b/src/views/tested/MeasurementPlan/early/components/edit.vue @@ -10,6 +10,7 @@ import { SCHEDULE } from '@/utils/scheduleDict' import { delTextBtn, editBtn, submitBtn } from '@/utils/applyBtns' import { cancelApply, delApply, detailApply, editApply, submitApply, valiatePlan } from '@/api/eqpt/measurementPlan/early' +import { getCustomerList } from '@/api/eqpt/measurementPlan/task' import { getAdminDept, getUserDept } from '@/api/system/user' import { getDeptTreeList } from '@/api/system/dept' import { toTreeList } from '@/utils/structure' @@ -42,7 +43,7 @@ isUrgent: '1', // 是否加急 measureCompany: '', // 检定(校准)单位 deliverer: '', // 送检人 - isOnSiteCheck: '1', // 现场检定 111 + isOnSiteCheck: '0', // 现场检定 111 planDeliverTime: '', // 预计送达时间 requireOverTime: '', // 要求检完时间 onSiteCheckTime: '', // 现场检定时间 111 @@ -50,6 +51,7 @@ customerName: '', // 单位 createDeptId: '', // 部门 createDeptName: '', // 部门 + customerAddress: '', }) // 表单 const rules = ref({ reason: [{ required: true, message: '送检原因必填', trigger: ['blur', 'change'] }], @@ -69,7 +71,24 @@ const flag = ref(false) // 创建单位 const companyList = ref<{ id: string; value: string; name: string }[]>([]) +// 委托方名录 +const customerList = ref([]) +// 获取是否加急下拉列表 +const isUrgentList = ref<{ id: string; value: string; name: string }[]>() +// 检定单位 +const measureCompanyList = ref<{ id: string; value: string; name: string }[]>() +const fetchListData = async () => { + const res = await getCustomerList() + customerList.value = res.data.rows + getDictByCode('eqptisUrgent').then((res) => { + isUrgentList.value = res.data + }) + getDictByCode('eqptmeasureCompany').then((res) => { + measureCompanyList.value = res.data + }) +} const deptList = ref([]) +const isFirst = ref(true) const initDialog = () => { dialogStatus.value = $route.params.type as string ruleFormRef.value?.resetFields() @@ -80,14 +99,21 @@ isAdmin.value = true getAdminDept({}).then((res) => { companyList.value = res.data.map((item: any) => ({ id: item.id, value: item.id, name: item.fullName })) + setTimeout(() => { + isFirst.value = false + }) }) } else { isAdmin.value = false + isFirst.value = false ruleForm.value.customerId = res.data.id ruleForm.value.customerName = res.data.fullName ruleForm.value.createDeptId = userStore.deptId ruleForm.value.createDeptName = userStore.deptName + setTimeout(() => { + isFirst.value = false + }) } setTimeout(() => { flag.value = false @@ -128,16 +154,47 @@ } watch(() => ruleForm.value.customerId, (newVal) => { if (newVal) { + deptList.value = [] getDeptTreeList({ pid: newVal }).then((res) => { deptList.value = toTreeList(res.data.map((item: any) => ({ ...item, label: item.name, value: item.id }))) }) } - if ($route.path.includes('detail') || !isAdmin.value || flag.value) { return } + if ($route.path.includes('detail') || !isAdmin.value || flag.value || isFirst.value) { return } ruleForm.value.createDeptId = '' }) -onMounted(() => { +onMounted(async () => { + await fetchListData() initDialog() }) +// 自动填充委托方地址 +watch(() => ruleForm.value.customerId, (newVal) => { + if (isFirst.value) { + return + } + if (newVal) { + if (isAdmin.value) { + console.log('管理员') + // 委托方名称 + const name = companyList.value.filter(item => item.id === newVal)[0]?.name + // 寻找委托方地址 + if (customerList.value.filter((item: any) => item.customerName === name).length) { + ruleForm.value.customerAddress = customerList.value.filter((item: any) => item.customerName === name)[0].address + } + else { + ruleForm.value.customerAddress = '/' + } + } + else { + console.log('非管理员') + if (customerList.value.filter((item: any) => item.customerName === ruleForm.value.customerName).length) { + ruleForm.value.customerAddress = customerList.value.filter((item: any) => item.customerName === ruleForm.value.customerName)[0].address + } + else { + ruleForm.value.customerAddress = '/' + } + } + } +}) // 关闭弹窗 const close = () => { // $router.back() @@ -304,19 +361,6 @@ }) } const activeName = ref('基本信息') -// 获取是否加急下拉列表 -const isUrgentList = ref<{ id: string; value: string; name: string }[]>() -// 检定单位 -const measureCompanyList = ref<{ id: string; value: string; name: string }[]>() -const fetchListData = () => { - getDictByCode('eqptisUrgent').then((res) => { - isUrgentList.value = res.data - }) - getDictByCode('eqptmeasureCompany').then((res) => { - measureCompanyList.value = res.data - }) -} -fetchListData() + + + - - @@ -480,8 +526,6 @@ - - diff --git a/public/config/config.json b/public/config/config.json index be2c8e1..36e461e 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,6 +1,6 @@ { "title":"计量业务系统", - "versionByEqpt":"1.3.4.0", + "versionByEqpt":"1.3.5.0", "baseUrl": "http://111.198.10.15:21611", "baseUrlBusiness": "http://111.198.10.15:21606", "baseUrlLaboratory": "http://111.198.10.15:21610", diff --git a/src/views/tested/MeasurementPlan/early/components/edit.vue b/src/views/tested/MeasurementPlan/early/components/edit.vue index 63b6ba0..5233de4 100644 --- a/src/views/tested/MeasurementPlan/early/components/edit.vue +++ b/src/views/tested/MeasurementPlan/early/components/edit.vue @@ -10,6 +10,7 @@ import { SCHEDULE } from '@/utils/scheduleDict' import { delTextBtn, editBtn, submitBtn } from '@/utils/applyBtns' import { cancelApply, delApply, detailApply, editApply, submitApply, valiatePlan } from '@/api/eqpt/measurementPlan/early' +import { getCustomerList } from '@/api/eqpt/measurementPlan/task' import { getAdminDept, getUserDept } from '@/api/system/user' import { getDeptTreeList } from '@/api/system/dept' import { toTreeList } from '@/utils/structure' @@ -42,7 +43,7 @@ isUrgent: '1', // 是否加急 measureCompany: '', // 检定(校准)单位 deliverer: '', // 送检人 - isOnSiteCheck: '1', // 现场检定 111 + isOnSiteCheck: '0', // 现场检定 111 planDeliverTime: '', // 预计送达时间 requireOverTime: '', // 要求检完时间 onSiteCheckTime: '', // 现场检定时间 111 @@ -50,6 +51,7 @@ customerName: '', // 单位 createDeptId: '', // 部门 createDeptName: '', // 部门 + customerAddress: '', }) // 表单 const rules = ref({ reason: [{ required: true, message: '送检原因必填', trigger: ['blur', 'change'] }], @@ -69,7 +71,24 @@ const flag = ref(false) // 创建单位 const companyList = ref<{ id: string; value: string; name: string }[]>([]) +// 委托方名录 +const customerList = ref([]) +// 获取是否加急下拉列表 +const isUrgentList = ref<{ id: string; value: string; name: string }[]>() +// 检定单位 +const measureCompanyList = ref<{ id: string; value: string; name: string }[]>() +const fetchListData = async () => { + const res = await getCustomerList() + customerList.value = res.data.rows + getDictByCode('eqptisUrgent').then((res) => { + isUrgentList.value = res.data + }) + getDictByCode('eqptmeasureCompany').then((res) => { + measureCompanyList.value = res.data + }) +} const deptList = ref([]) +const isFirst = ref(true) const initDialog = () => { dialogStatus.value = $route.params.type as string ruleFormRef.value?.resetFields() @@ -80,14 +99,21 @@ isAdmin.value = true getAdminDept({}).then((res) => { companyList.value = res.data.map((item: any) => ({ id: item.id, value: item.id, name: item.fullName })) + setTimeout(() => { + isFirst.value = false + }) }) } else { isAdmin.value = false + isFirst.value = false ruleForm.value.customerId = res.data.id ruleForm.value.customerName = res.data.fullName ruleForm.value.createDeptId = userStore.deptId ruleForm.value.createDeptName = userStore.deptName + setTimeout(() => { + isFirst.value = false + }) } setTimeout(() => { flag.value = false @@ -128,16 +154,47 @@ } watch(() => ruleForm.value.customerId, (newVal) => { if (newVal) { + deptList.value = [] getDeptTreeList({ pid: newVal }).then((res) => { deptList.value = toTreeList(res.data.map((item: any) => ({ ...item, label: item.name, value: item.id }))) }) } - if ($route.path.includes('detail') || !isAdmin.value || flag.value) { return } + if ($route.path.includes('detail') || !isAdmin.value || flag.value || isFirst.value) { return } ruleForm.value.createDeptId = '' }) -onMounted(() => { +onMounted(async () => { + await fetchListData() initDialog() }) +// 自动填充委托方地址 +watch(() => ruleForm.value.customerId, (newVal) => { + if (isFirst.value) { + return + } + if (newVal) { + if (isAdmin.value) { + console.log('管理员') + // 委托方名称 + const name = companyList.value.filter(item => item.id === newVal)[0]?.name + // 寻找委托方地址 + if (customerList.value.filter((item: any) => item.customerName === name).length) { + ruleForm.value.customerAddress = customerList.value.filter((item: any) => item.customerName === name)[0].address + } + else { + ruleForm.value.customerAddress = '/' + } + } + else { + console.log('非管理员') + if (customerList.value.filter((item: any) => item.customerName === ruleForm.value.customerName).length) { + ruleForm.value.customerAddress = customerList.value.filter((item: any) => item.customerName === ruleForm.value.customerName)[0].address + } + else { + ruleForm.value.customerAddress = '/' + } + } + } +}) // 关闭弹窗 const close = () => { // $router.back() @@ -304,19 +361,6 @@ }) } const activeName = ref('基本信息') -// 获取是否加急下拉列表 -const isUrgentList = ref<{ id: string; value: string; name: string }[]>() -// 检定单位 -const measureCompanyList = ref<{ id: string; value: string; name: string }[]>() -const fetchListData = () => { - getDictByCode('eqptisUrgent').then((res) => { - isUrgentList.value = res.data - }) - getDictByCode('eqptmeasureCompany').then((res) => { - measureCompanyList.value = res.data - }) -} -fetchListData() + + + - - @@ -480,8 +526,6 @@ - - diff --git a/src/views/tested/MeasurementPlan/task/components/edit.vue b/src/views/tested/MeasurementPlan/task/components/edit.vue index 1c5f041..4b161ce 100644 --- a/src/views/tested/MeasurementPlan/task/components/edit.vue +++ b/src/views/tested/MeasurementPlan/task/components/edit.vue @@ -11,6 +11,8 @@ import useUserStore from '@/store/modules/user' import { delTextBtn, editBtn, submitBtn } from '@/utils/applyBtns' import { SCHEDULE } from '@/utils/scheduleDict' +import { getDeptTreeList } from '@/api/system/dept' +import { toTreeList } from '@/utils/structure' const $route = useRoute() const $router = useRouter() const userStore = useUserStore() @@ -32,6 +34,8 @@ customerAddress: '', customerId: '', customerName: '', + deptId: '', + deptName: '', customerPhone: '', customerSampleInfoList: [], deliverer: '', @@ -53,7 +57,7 @@ updateTime: '', isOnSiteCheck: '0', onSiteCheckTime: '', - deptId: '', + // deptId: '', orderStatusName: '', }) // 表单 const checkPhone = (rule: any, value: any, callback: any) => { @@ -80,6 +84,7 @@ undertakeTime: [{ required: true, message: '承接时间必选', trigger: ['blur', 'change'] }], customerId: [{ required: true, message: '委托方必选', trigger: ['blur', 'change'] }], onSiteCheckTime: [{ required: true, message: '现场检定时间必选', trigger: ['blur', 'change'] }], + deptId: [{ required: true, message: '部门必选', trigger: ['blur', 'change'] }], }) // 表单验证规则 // 弹窗初始化 const processId = ref() @@ -89,31 +94,35 @@ const initDialog = () => { dialogStatus.value = $route.params.type as string ruleFormRef.value?.resetFields() + // 获取当前用户所在单位 + getUserDept().then((res) => { + console.log(res.data, '用户所在单位') + // fullName + if (res.data.fullName === '顶级' || res.data.version === '1' || res.data.version === 1) { + isAdmin.value = true + getAdminDept({}).then((res) => { + companyList.value = res.data.map((item: any) => ({ id: item.id, value: item.id, name: item.fullName })) + setTimeout(() => { + isFirst.value = false + }) + }) + } + else { + isAdmin.value = false + setTimeout(() => { + ruleForm.value.customerId = res.data.id + ruleForm.value.customerName = res.data.fullName + ruleForm.value.deptId = userStore.deptId + ruleForm.value.deptName = userStore.deptName + isFirst.value = false + }) + } + }) if ($route.params.type === 'create') { ruleForm.value.createTime = dayjs().format('YYYY-MM-DD HH:mm:ss') // 创建时间 ruleForm.value.createUserId = userStore.id ruleForm.value.createUserName = userStore.name - ruleForm.value.deptId = userStore.deptId - // 获取当前用户所在单位 - getUserDept().then((res) => { - console.log(res.data, '用户所在单位') - // fullName - if (res.data.fullName === '顶级' || res.data.version === '1' || res.data.version === 1) { - isAdmin.value = true - getAdminDept({}).then((res) => { - companyList.value = res.data.map((item: any) => ({ id: item.id, value: item.id, name: item.fullName })) - }) - isFirst.value = false - } - else { - isAdmin.value = false - isFirst.value = false - setTimeout(() => { - ruleForm.value.customerId = res.data.id - ruleForm.value.customerName = res.data.fullName - }) - } - }) + // ruleForm.value.deptId = userStore.deptId } else { ruleForm.value = JSON.parse($route.query.row as string) @@ -144,7 +153,9 @@ const measureCompanyList = ref<{ id: string; value: string; name: string }[]>() // 委托方名录 const customerList = ref([]) -const fetchListData = () => { +const fetchListData = async () => { + const res = await getCustomerList() + customerList.value = res.data.rows getDictByCode('isUrgent').then((res) => { isUrgentList.value = res.data }) @@ -156,15 +167,25 @@ getDictByCode('eqptmeasureCompany').then((res) => { measureCompanyList.value = res.data }) - getCustomerList().then((res) => { - customerList.value = res.data.rows - }) } onMounted(async () => { await fetchListData() initDialog() }) +const deptList = ref([]) +const deptAllList = ref([]) +watch(() => ruleForm.value.customerId, (newVal) => { + if (newVal) { + deptList.value = [] + getDeptTreeList({ pid: newVal }).then((res) => { + deptAllList.value = res.data.map((item: any) => ({ ...item, label: item.name, value: item.id })) + deptList.value = toTreeList(res.data.map((item: any) => ({ ...item, label: item.name, value: item.id }))) + }) + } + if ($route.path.includes('detail') || !isAdmin.value || isFirst.value) { return } + ruleForm.value.deptId = '' +}) // 自动填充委托方地址 watch(() => ruleForm.value.customerId, (newVal) => { if (isFirst.value) { @@ -317,6 +338,7 @@ ruleForm.value.customerSampleInfoList = tableRef.value.list if (isAdmin.value) { ruleForm.value.customerName = companyList.value.filter(item => item.id === ruleForm.value.customerId)[0]?.name + ruleForm.value.deptName = deptAllList.value.filter((item: any) => item.value === ruleForm.value.deptId)[0]?.label } const data = { ...JSON.parse(JSON.stringify(ruleForm.value)) } if (ruleForm.value.isOnSiteCheck === '1') { @@ -512,6 +534,20 @@ + + + + + + @@ -557,7 +593,7 @@ - - - - +