From 141a763be1522bc4fda06ef5f0ce7021068ec054 Mon Sep 17 00:00:00 2001 From: BianLzhaoMin <11485688+bianliangzhaomin123@user.noreply.gitee.com> Date: Fri, 6 Dec 2024 17:48:56 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A3=85=E5=A4=87=E6=96=B0=E5=A2=9E=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- env/.env.dev | 4 +- src/components/Navmenu/index.vue | 11 +- src/components/header/index.vue | 3 +- src/components/uploadComponent/index.vue | 421 +++-- src/components/uploadComponentNew/index.vue | 2 +- src/http/index.ts | 12 +- src/views/demand-details/index.vue | 26 +- src/views/home/index.vue | 4 +- src/views/parity/index.vue | 14 +- src/views/user/goodsManagement/index.vue | 1483 +++++++++------- .../components/order-details.vue | 665 +++++++ .../orderManagement/components/order-home.vue | 1520 ++++++++++++++++ src/views/user/orderManagement/index.vue | 1537 +---------------- src/views/user/sourcingNeed/index.vue | 114 +- 14 files changed, 3383 insertions(+), 2433 deletions(-) create mode 100644 src/views/user/orderManagement/components/order-details.vue create mode 100644 src/views/user/orderManagement/components/order-home.vue diff --git a/env/.env.dev b/env/.env.dev index 8c14d12..e796421 100644 --- a/env/.env.dev +++ b/env/.env.dev @@ -7,8 +7,8 @@ VITE_API_URL = '/proxyApi' # 开发环境接口地址 # VITE_proxyTarget = 'http://10.40.92.74:8080' #盛旭 -VITE_proxyTarget = 'http://192.168.2.246:28080' # 马帅 -# VITE_proxyTarget = 'http://192.168.2.123:28080' # 梁超 +# VITE_proxyTarget = 'http://192.168.2.246:28080' # 马帅 +VITE_proxyTarget = 'http://192.168.2.127:28080' # 梁超 # VITE_proxyTarget = 'http://192.168.0.244:28580' # 测试服务 # VITE_proxyTarget = 'http://192.168.2.129:18080' # 马帅 diff --git a/src/components/Navmenu/index.vue b/src/components/Navmenu/index.vue index ee6f1e6..f32c5e9 100644 --- a/src/components/Navmenu/index.vue +++ b/src/components/Navmenu/index.vue @@ -24,6 +24,7 @@ const navMenuList = computed(() => { { name: '租赁需求大厅', routerName: 'parity' }, { name: '装备管理', routerName: 'goodsManagement' }, { name: '订单管理', routerName: 'orderManagementCz' }, + { name: '接单管理', routerName: 'accept-orders' }, { name: '消息通知', routerName: 'enterpriseZone' }, ] if (isType == 2) @@ -32,12 +33,20 @@ const navMenuList = computed(() => { { name: '装备共享大厅', routerName: 'equipList' }, { name: '租赁需求大厅', routerName: 'parity' }, { name: '订单管理', routerName: 'orderManagement' }, + { name: '需求管理', routerName: 'sourcingNeed' }, { name: '消息通知', routerName: 'enterpriseZone' }, ] }) const navMenuClick = (name: any) => { - if (name == 'goodsManagement' || name == 'orderManagementCz' || name == 'orderManagement') { + const includeList = [ + 'goodsManagement', + 'orderManagementCz', + 'orderManagement', + 'sourcingNeed', + 'accept-orders', + ] + if (includeList.includes(name)) { store.editcurrentMenuItem(name) setTimeout(() => { router.push({ diff --git a/src/components/header/index.vue b/src/components/header/index.vue index ba0a930..a63cd78 100644 --- a/src/components/header/index.vue +++ b/src/components/header/index.vue @@ -36,6 +36,7 @@ const handlerLogout = () => { ElMessage({ type: 'success', message: '已退出登录', + duration: 1000, }) }) .catch(() => { @@ -150,7 +151,7 @@ const isMyInfoPage = () => { /> --> + :list-type="props.listType" + >
@@ -31,250 +32,222 @@ diff --git a/src/components/uploadComponentNew/index.vue b/src/components/uploadComponentNew/index.vue index 3e790f5..3c500b7 100644 --- a/src/components/uploadComponentNew/index.vue +++ b/src/components/uploadComponentNew/index.vue @@ -219,7 +219,7 @@ const beforeUpload = (file: any) => { return false } - if (fileListNew.value.length + props.minLimit >= 4) { + if (fileListNew.value.length + props.minLimit >= props.maxLimit) { ElMessage({ type: 'warning', message: `最多只能上传${props.maxLimit}个文件`, diff --git a/src/http/index.ts b/src/http/index.ts index 553e253..bb01ebb 100644 --- a/src/http/index.ts +++ b/src/http/index.ts @@ -31,7 +31,6 @@ service.interceptors.request.use( ) // 响应拦截 service.interceptors.response.use( - (res) => { ElMessage.closeAll() const { data } = res @@ -44,16 +43,19 @@ service.interceptors.response.use( ElMessage.error(data.msg) router.push('/login') } else if (data.code == '500') { - ElMessage.error(data.msg) + ElMessage({ + type: 'error', + message: data.msg, + duration: 1000, + }) } else { return data } }, (error) => { - ElMessage.closeAll() - ElMessage.error('请求失败') - console.log('error-异常', error) + // ElMessage.error('请求失败') + // console.log('error-异常', error) } ) diff --git a/src/views/demand-details/index.vue b/src/views/demand-details/index.vue index 8e10e7b..36ac402 100644 --- a/src/views/demand-details/index.vue +++ b/src/views/demand-details/index.vue @@ -51,21 +51,21 @@ --> -
需求清单:
+ + - + -->
装备需求信息: @@ -89,6 +89,14 @@ {{ item.leaseNum }} + + + 装备描述: + + + {{ item.description }} + +
参考图片/样式:
@@ -200,9 +208,17 @@ const equipBaseInfoList = reactive([ // label: '预估数量', // key: 'leaseNum', // }, + // { + // label: '预估租赁天数', + // key: 'leaseDay', + // }, { - label: '预估租赁天数', - key: 'leaseDay', + label: '租赁开始日期', + key: 'leaseStartTime', + }, + { + label: '租赁结束日期', + key: 'leaseEndTime', }, { label: '发布时间', diff --git a/src/views/home/index.vue b/src/views/home/index.vue index 175b4a5..0847198 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -22,10 +22,10 @@ const selectOptions = ref(false) // 分类 const selectOptionsValue = ref('分类筛选') const loopList = ref([ - 'https://zlpt-1259760603.cos.ap-nanjing.myqcloud.com/488bab245180ebf9f1f3d7db5301be4.png', + // 'https://zlpt-1259760603.cos.ap-nanjing.myqcloud.com/488bab245180ebf9f1f3d7db5301be4.png', // 'https://jmy-pic.baidu.com/0/pic/-1857035387_-1067811148_-1621691324.png', imgSrc, - swiper_1, + // swiper_1, swiper_2, ]) // 获取商品分类 diff --git a/src/views/parity/index.vue b/src/views/parity/index.vue index 57b62e6..373d44e 100644 --- a/src/views/parity/index.vue +++ b/src/views/parity/index.vue @@ -106,6 +106,12 @@
{{ item.companyName }}
+ +
预估数量
+
+ +
{{ item.leaseTotalNum }}
+
@@ -123,16 +129,16 @@ -
预估数量
+
租赁开始日期
-
{{ item.leaseTotalNum }}
+
{{ item.leaseStartTime }}
-
预估租期(天)
+
租赁结束日期
-
{{ item.leaseDay }}
+
{{ item.leaseEndTime }}
diff --git a/src/views/user/goodsManagement/index.vue b/src/views/user/goodsManagement/index.vue index 400c838..2daa11c 100644 --- a/src/views/user/goodsManagement/index.vue +++ b/src/views/user/goodsManagement/index.vue @@ -2,6 +2,8 @@ import TableComponent from 'components/TableComponent/index.vue' import FormComponent from 'components/FormComponent/index.vue' import PagingComponent from 'components/PagingComponent/index.vue' +import UploadComponentNew from 'components/uploadComponentNew/index.vue' +import TitleTip from 'components/TitleTip/index.vue' import uploadComponent from 'components/uploadComponent/index.vue' import previewImg from './previewImg/index.vue' import { ElMessage, ElMessageBox } from 'element-plus' @@ -11,6 +13,9 @@ import { useStore } from 'store/user' const store = useStore() import { mainStore } from 'store/main' const store2 = mainStore() +const isViewForm = ref(false) + +const isDisabled = ref(false) import { getEquipmentTypeApi, //装备类型 getCompanyListApi, //所属公司 @@ -124,6 +129,8 @@ getList() // 装备新增按钮 const equipmentDeployment = () => { settleinTitle.value = '新增装备' + isViewForm.value = false + Object.assign(addAndEditForm, addAndEditFormTemp) disabledForm.value = false isEditDisabled.value = true equipmentDeploymentParams.value = { @@ -158,6 +165,7 @@ const editRowInfo = (row: any) => { getDetailData(row) disabledForm.value = false isEditDisabled.value = true + isViewForm.value = false } /* 查看按钮 */ const previewRowInfo = (row: any) => { @@ -165,6 +173,7 @@ const previewRowInfo = (row: any) => { getDetailData(row) disabledForm.value = true isEditDisabled.value = false + isViewForm.value = true } // 删除按钮 const deleteRowInfo = async (row: any) => { @@ -189,22 +198,73 @@ const deleteRowInfo = async (row: any) => { } //获取详情接口 const getDetailData = async (row: any) => { - console.log(row, '----row----') - maId.value = row.maId - const res: any = await getDetailApi(row.maId) - console.log(res, '----detail----') - equipmentDeploymentParams.value = res.data - equipmentDeploymentParams.value.companyId = Number(res.data.companyId) - mainFileList.value = res.data.mainFileList - detailsFileList.value = res.data.detailsFileList - insurancePdf.value = res.data.insurancePdf - examinationPdf.value = res.data.examinationPdf - //反显 装备树 - equipmentDeploymentParams.value.deviceTypeList = getSelectId( - deviceTypeTree.value, - equipmentDeploymentParams.value.typeId, - ) + const { data: res }: any = await getDetailApi(row.maId) + const { + deviceName, + // deviceTypeList, + deviceCount, + unitName, + code, + brand, + typeId, + companyId, + productionDate, + dayLeasePrice, + person, + personPhone, + deviceWeight, + checkDate, + checkCycle, + mainFileList, + detailsFileList, + insurancePdf, + examinationPdf, + } = res + + Object.assign(addAndEditForm, { + deviceName, + deviceCount, + unitName, + code, + brand, + typeId, + companyId, + productionDate, + dayLeasePrice, + person, + personPhone, + deviceWeight, + checkDate, + checkCycle, + mainFileList, + detailsFileList, + insurancePdf, + examinationPdf, + }) + + descriptionFormList.value[0].insurancePdfs = insurancePdf + descriptionFormList.value[0].examinationPdfs = examinationPdf + addAndEditForm.deviceTypeList = getSelectId(deviceTypeTree.value, addAndEditForm.typeId) dialogFormVisibleSettlein.value = true + + console.log(res, '详情接口') + + // console.log(row, '----row----') + // maId.value = row.maId + // const res: any = await getDetailApi(row.maId) + // console.log(res, '----detail----') + // equipmentDeploymentParams.value = res.data + // equipmentDeploymentParams.value.companyId = Number(res.data.companyId) + // mainFileList.value = res.data.mainFileList + // detailsFileList.value = res.data.detailsFileList + // insurancePdf.value = res.data.insurancePdf + // examinationPdf.value = res.data.examinationPdf + // //反显 装备树 + // equipmentDeploymentParams.value.deviceTypeList = getSelectId( + // deviceTypeTree.value, + // equipmentDeploymentParams.value.typeId, + // ) + // dialogFormVisibleSettlein.value = true // equipmentDeploymentParams.value.cityId = String(equipmentDeploymentParams.value.cityId) // equipmentDeploymentParams.value.areaId = String(equipmentDeploymentParams.value.areaId) // equipmentDeploymentParams.value.provinceId = String( @@ -259,67 +319,6 @@ const handleUpdateUpDown = (row: any, maStatus: any) => { .catch(() => {}) } -// // 省级数据源 -// const selProvinceList: any = computed(() => { -// return store.provinceList -// }) - -// // 获取市级数据源 -// const selMarketList: any = computed(() => { -// return store.marketList -// }) - -// // 获取区级数据源 -// const selAreaList: any = computed(() => { -// return store.areaList -// }) - -// // 设备类型大类 -// const selDeviceTypeList: any = computed(() => { -// return store.deviceTypeList -// }) - -// // 设备类型子类 -// const selDeviceTypeSonList: any = computed(() => { -// return store.deviceTypeSonList -// }) - -// // 设备类型小类 -// const selDeviceTypeSunList: any = computed(() => { -// return store.deviceTypeSunList -// }) - -// // 省级下拉框选中时获取市级 -// const changeProvince = (val: any) => { -// // console.log(val, '省选择**') -// store.getmarketList(val.split(',')[0]) - -// // AssemblyRegisterAddress[0] = val.split(',')[1] -// } -// // 市级下拉框选中获取区级数据 -// const changeMarket = (val: any) => { -// store.getareaList(val.split(',')[0]) -// // AssemblyRegisterAddress[1] = val.split(',')[1] -// } -// // 区级下拉框获取区级数据 -// const opeChangeArea = (val: any) => { -// // AssemblyRegisterAddress[2] = val.split(',')[1] -// } -// // 设备类型大类 -// const changeDeviceType = (val: any) => { -// store.getDeviceTypeSonList(val) -// // deviceType[0] = val.split(',')[1] -// } -// // 设备类型子类 -// const changeDeviceTypeSon = (val: any) => { -// store.getDeviceTypeSunList(val) -// // deviceType[1] = val.split(',')[1] -// } -// // 设备类型小类 -// const changeDeviceTypeSun = (val: any) => { -// // deviceType[2] = val.split(',')[1] -// } - /* ----装备弹窗----- */ @@ -358,18 +357,23 @@ const dialogTypeCascader = ref() //装备类目-change const dialogTypeChange = () => { const deviceTypeList = dialogTypeCascader.value.getCheckedNodes() - console.log(deviceTypeList) - equipmentDeploymentParams.value.unitName = deviceTypeList[0].data.unitName - let manageType = deviceTypeList[0].data.manageType - if (manageType == '1') { - //数量 - equipmentDeploymentParams.value.deviceCount = 1 - countDisabled.value = false - } else if (manageType == '0') { - //编码 - equipmentDeploymentParams.value.deviceCount = 1 - countDisabled.value = true - } + // console.log(deviceTypeList) + // equipmentDeploymentParams.value.unitName = deviceTypeList[0].data.unitName + // equipmentDeploymentParams.value.dayLeasePrice = deviceTypeList[0].data.leasePrice + // isDisabled.value = true + // let manageType = deviceTypeList[0].data.manageType + // if (manageType == '1') { + // //数量 + // equipmentDeploymentParams.value.deviceCount = 1 + // countDisabled.value = false + // } else if (manageType == '0') { + // //编码 + // equipmentDeploymentParams.value.deviceCount = 1 + // countDisabled.value = true + // } + isDisabled.value = true + addAndEditForm.unitName = deviceTypeList[0].data.unitName + addAndEditForm.dayLeasePrice = deviceTypeList[0].data.leasePrice } //获取所属公司下拉数据 const getCompanyList = async () => { @@ -403,6 +407,13 @@ const equipRules = ref({ trigger: 'blur', }, ], + unitName: [ + { + required: true, + message: '装备单位不可为空', + trigger: 'blur', + }, + ], brand: [ { required: true, @@ -449,118 +460,152 @@ const equipRules = ref({ trigger: 'blur', }, ], + mainFileList: [{ required: true, message: '请上传主展示图', trigger: 'change' }], + detailsFileList: [{ required: true, message: '请上传详情展示图', trigger: 'change' }], + // deviceWeight: [ // // // { required: true, message: '整机重量不能为空', trigger: 'blur' }, // ], }) + +const descriptionRules = ref({ + insurancePdfs: [{ required: true, message: '请上传合格证', trigger: 'change' }], + examinationPdfs: [{ required: true, message: '请上传检测证明', trigger: 'change' }], +}) // 弹框保存提交 -const submitBtn = () => { - ruleFormRef.value.validate(async (valid: any) => { +const submitBtn = async () => { + submitFun(1) + // ruleFormRef.value.validate(async (valid: any) => { + // if (valid) { + // if ( + // equipmentDeploymentParams.value.deviceTypeList && + // equipmentDeploymentParams.value.deviceTypeList.length > 0 + // ) { + // equipmentDeploymentParams.value.typeId = + // equipmentDeploymentParams.value.deviceTypeList[3] + // } else { + // equipmentDeploymentParams.value.typeId = '' + // } + // if (mainFileList.value.length == 0 || mainFileList.value.length > 6) { + // ElMessage({ type: 'error', message: '主展示图不得少于1张,不得多于6张' }) + // return + // } + // if (detailsFileList.value.length == 0 || detailsFileList.value.length > 6) { + // ElMessage({ type: 'error', message: '详情展示图不得少于1张,不得多于6张' }) + // return + // } + // let param = { + // ...equipmentDeploymentParams.value, + // mainFileList: mainFileList.value, //主展示 + // detailsFileList: detailsFileList.value, //详情展示 + // insurancePdf: insurancePdf.value, //合格证 + // examinationPdf: examinationPdf.value, //检测证明 + // } + // param.maStatus == 0 ? (param.maStatus = 1) : param.maStatus + // if ( + // equipmentDeploymentParams.value.maId && + // equipmentDeploymentParams.value.maId != '' + // ) { + // const res: any = await equipmentEditApi(param) + // if (res.code === 200) { + // ElMessage({ + // type: 'success', + // message: '保存成功', + // }) + // dialogFormVisibleSettlein.value = false + // getList() + // } + // } else { + // const res: any = await equipmentAddApi(param) + // if (res.code === 200) { + // ElMessage({ + // type: 'success', + // message: '保存成功', + // }) + // dialogFormVisibleSettlein.value = false + // getList() + // } + // } + // } + // }) +} +const submitFun = (type: any) => { + console.log(9999) + // type 1 提交 2 存草稿 + addAndEditForm.mainFileList = [ + ...addAndEditForm.mainFileList, + ...addAndEditForm.mainFileTempList, + ] + addAndEditForm.detailsFileList = [ + ...addAndEditForm.detailsFileList, + ...addAndEditForm.detailsFileTempList, + ] + + addAndEditFormRef.value.validate(async (valid: any) => { if (valid) { - if ( - equipmentDeploymentParams.value.deviceTypeList && - equipmentDeploymentParams.value.deviceTypeList.length > 0 - ) { - equipmentDeploymentParams.value.typeId = - equipmentDeploymentParams.value.deviceTypeList[3] - } else { - equipmentDeploymentParams.value.typeId = '' - } - if (mainFileList.value.length == 0 || mainFileList.value.length > 6) { - ElMessage({ type: 'error', message: '主展示图不得少于1张,不得多于6张' }) - return - } - if (detailsFileList.value.length == 0 || detailsFileList.value.length > 6) { - ElMessage({ type: 'error', message: '详情展示图不得少于1张,不得多于6张' }) - return - } - let param = { - ...equipmentDeploymentParams.value, - mainFileList: mainFileList.value, //主展示 - detailsFileList: detailsFileList.value, //详情展示 - insurancePdf: insurancePdf.value, //合格证 - examinationPdf: examinationPdf.value, //检测证明 - } - param.maStatus == 0 ? (param.maStatus = 1) : param.maStatus - if ( - equipmentDeploymentParams.value.maId && - equipmentDeploymentParams.value.maId != '' - ) { - const res: any = await equipmentEditApi(param) - if (res.code === 200) { - ElMessage({ - type: 'success', - message: '保存成功', + let isDescription = false + descriptionFormList.value.forEach((e: any, index: number) => { + e.insurancePdfs = [...e.insurancePdfs, ...e.insuranceATempPdf] + e.examinationPdfs = [...e.examinationPdfs, ...e.examinationTempPdf] + addAndEditForm.insurancePdfs[index] = e.insurancePdfs + addAndEditForm.examinationPdfs[index] = e.examinationPdfs + }) + + for (let index = 0; index < descriptionFormList.value.length; index++) { + try { + const result = await new Promise((resolve) => { + descriptionFormRefList.value[index].validate((res: any) => { + resolve(res) + }) }) - dialogFormVisibleSettlein.value = false - getList() - } - } else { - const res: any = await equipmentAddApi(param) - if (res.code === 200) { - ElMessage({ - type: 'success', - message: '保存成功', - }) - dialogFormVisibleSettlein.value = false - getList() - } + + if (!result) { + isDescription = true + throw new Error('表单校验失败') + } + } catch (error) {} } + + if (isDescription) return + + addAndEditForm.typeId = + addAndEditForm.deviceTypeList[addAndEditForm.deviceTypeList.length - 1] + + const SEND_FUN_API = type == 1 ? equipmentAddApi : insertDraftApi + const res: any = await SEND_FUN_API(addAndEditForm) + console.log(res, '提交结果---') + if (res.code === 200) { + ElMessage({ + type: 'success', + message: '保存成功', + duration: 1000, + }) + dialogFormVisibleSettlein.value = false + getList() + } + + // 组装参数 + } else { + console.log('校验失败') } }) } //草稿 const saveTemp = async () => { - if ( - equipmentDeploymentParams.value.deviceTypeList && - equipmentDeploymentParams.value.deviceTypeList.length > 0 - ) { - equipmentDeploymentParams.value.typeId = equipmentDeploymentParams.value.deviceTypeList[3] - } else { - equipmentDeploymentParams.value.typeId = '' - } - if ( - equipmentDeploymentParams.value.deviceName == '' || - equipmentDeploymentParams.value.companyId == '' - ) { - ElMessage({ type: 'error', message: '保存草稿请至少填写装备名称及所属公司!' }) - return - } - // if(mainFileList.value.length==0||mainFileList.value.length>6){ - // ElMessage({type: 'error',message: '主展示图不得少于1张,不得多于6张'}) - // return - // } - // if(detailsFileList.value.length==0||detailsFileList.value.length>6){ - // ElMessage({type: 'error',message: '详情展示图不得少于1张,不得多于6张'}) - // return - // } - let param = { - ...equipmentDeploymentParams.value, - mainFileList: mainFileList.value, //主展示 - detailsFileList: detailsFileList.value, //详情展示 - insurancePdf: insurancePdf.value, //合格证 - examinationPdf: examinationPdf.value, //检测证明 - } - const res: any = await insertDraftApi(param) - if (res.code === 200) { - ElMessage({ - type: 'success', - message: '保存成功', - }) - dialogFormVisibleSettlein.value = false - // ruleFormRef.value.resetField() - getList() - } + submitFun(2) + + if (true) return } + /* 关闭按钮 */ const closeDialogBtn = () => { - ruleFormRef.value.resetFields() + // ruleFormRef.value.resetFields() dialogFormVisibleSettlein.value = false } /* 关闭对话框 */ const handleClose = (done: () => void) => { - ruleFormRef.value.resetFields() + // ruleFormRef.value.resetFields() done() dialogFormVisibleSettlein.value = false } @@ -711,7 +756,7 @@ const handleRemove = (list: any, index: Number) => { list.splice(index, 1) } -const onTempDownLoad = ()=>{ +const onTempDownLoad = () => { ElMessageBox.confirm('是否确定下载', { confirmButtonText: '确定', cancelButtonText: '取消', @@ -722,9 +767,158 @@ const onTempDownLoad = ()=>{ }) .catch(() => {}) } -const onBatchUpload = ()=>{ +const onBatchUpload = () => { console.log('下载') } + +const onAddDescription = () => { + const newId = Date.now() + descriptionFormList.value.push({ + newId, + insurancePdf: [], + insurancePdfs: [], + insuranceATempPdf: [], + examinationPdf: [], + examinationPdfs: [], + examinationTempPdf: [], + }) +} + +const addAndEditForm = reactive({ + deviceName: '', + deviceTypeList: [], + deviceCount: 1, + unitName: '', + code: '', + brand: '', + typeId: '', + companyId: '', + productionDate: '', + dayLeasePrice: '', + person: '', + personPhone: '', + deviceWeight: '', + checkDate: '', + checkCycle: '', + mainFileList: [], + detailsFileList: [], + mainFileTempList: [], + detailsFileTempList: [], + insurancePdf: [], + examinationPdf: [], + insurancePdfs: [], + examinationPdfs: [], +}) +const addAndEditFormTemp = reactive({ + deviceName: '', + deviceTypeList: [], + deviceCount: 1, + unitName: '', + code: '', + brand: '', + typeId: '', + companyId: '', + productionDate: '', + dayLeasePrice: '', + person: '', + personPhone: '', + deviceWeight: '', + checkDate: '', + checkCycle: '', + mainFileList: [], + detailsFileList: [], + mainFileTempList: [], + detailsFileTempList: [], + insurancePdf: [], + examinationPdf: [], + insurancePdfs: [], + examinationPdfs: [], +}) +const uploadUrl = import.meta.env.VITE_API_URL + '/file/upload' +const addAndEditFormRef = ref() +// 装备描述表单 +const descriptionFormList = ref([ + { + newId: Date.now(), + insurancePdf: [], + insurancePdfs: [], + insuranceATempPdf: [], + examinationPdf: [], + examinationPdfs: [], + examinationTempPdf: [], + }, +]) +const descriptionFormRefList = ref([]) +// 移除 +const onDeleteDescription = (index: number) => { + descriptionFormList.value.splice(index, 1) + descriptionFormRefList.value.splice(index, 1) +} + +const onMainFileChange = (fileList: any) => { + addAndEditForm.mainFileTempList = [] + const fileListTemp = fileList.map((e: any) => { + return { + fileName: e.name, + fileUrl: e.url, + } + }) + addAndEditFormRef.value.clearValidate('mainFileList') + addAndEditForm.mainFileTempList.push(...fileListTemp) +} +const onDetailsFileChange = (fileList: any) => { + addAndEditForm.detailsFileTempList = [] + const fileListTemp = fileList.map((e: any) => { + return { + fileName: e.name, + fileUrl: e.url, + } + }) + addAndEditFormRef.value.clearValidate('detailsFileList') + addAndEditForm.detailsFileTempList.push(...fileListTemp) +} + +const onInsurancePdfChange = (fileList: any, index: number) => { + descriptionFormList.value[index].insuranceATempPdf = [] + const fileListTemp = fileList.map((e: any) => { + return { + fileName: e.name, + fileUrl: e.url, + } + }) + descriptionFormRefList.value[index].clearValidate('insurancePdf') + descriptionFormList.value[index].insuranceATempPdf.push(...fileListTemp) +} +const onExaminationPdfChange = (fileList: any, index: number) => { + descriptionFormList.value[index].examinationTempPdf = [] + const fileListTemp = fileList.map((e: any) => { + return { + fileName: e.name, + fileUrl: e.url, + } + }) + descriptionFormRefList.value[index].clearValidate('examinationPdf') + descriptionFormList.value[index].examinationTempPdf.push(...fileListTemp) +} + +// const onDeleteImgInDetails = () => {} + +const onDeleteImgInMain = (index: any) => { + addAndEditForm.mainFileList.splice(index, 1) +} +const onDeleteImgInDetails = (index: any) => { + addAndEditForm.detailsFileList.splice(index, 1) +} +const onDeleteImgInsurancePdf = (j: any, index: any) => { + descriptionFormList.value[j].insurancePdfs.splice(index, 1) +} +const onDeleteImgExaminationPdf = (j: any, index: any) => { + descriptionFormList.value[j].examinationPdfs.splice(index, 1) +} + +const onDialogClose = () => { + addAndEditFormRef.value.resetFields() +}