From 89fa822ca5c4b46c8514c337b66bd66d589258ef Mon Sep 17 00:00:00 2001 From: "liang.chao" <1360241448@qq.com> Date: Wed, 27 Nov 2024 17:44:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E4=B8=8A=E4=B8=8B=E6=9E=B6?= =?UTF-8?q?=E5=92=8C=E5=88=A0=E9=99=A4bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/http/api/usercenter/goodsmang.ts | 2 +- src/views/user/goodsManagement/index.vue | 341 ++++++++++++----------- 2 files changed, 172 insertions(+), 171 deletions(-) diff --git a/src/http/api/usercenter/goodsmang.ts b/src/http/api/usercenter/goodsmang.ts index 9cb1be3..11b80f5 100644 --- a/src/http/api/usercenter/goodsmang.ts +++ b/src/http/api/usercenter/goodsmang.ts @@ -32,7 +32,7 @@ export const getCompanyListApi = () => { // 删除接口 export const removeDeviceApi = (data: any) => { - return post('/zlpt-equip/dev/remove', data) + return post('/material-mall/dev/remove', data) } // 上下架(批量) diff --git a/src/views/user/goodsManagement/index.vue b/src/views/user/goodsManagement/index.vue index 3776ce0..5346403 100644 --- a/src/views/user/goodsManagement/index.vue +++ b/src/views/user/goodsManagement/index.vue @@ -4,12 +4,12 @@ import PagingComponent from 'components/PagingComponent/index.vue' import uploadComponent from 'components/uploadComponent/index.vue' import previewImg from './previewImg/index.vue' - import { ElMessage,ElMessageBox } from 'element-plus' + import { ElMessage,ElMessageBox } from 'element-plus' import type { FormInstance } from 'element-plus' - import { ref } from 'vue' + import { ref } from 'vue' import { useStore } from 'store/user' - const store = useStore() - import { mainStore } from 'store/main' + const store = useStore() + import { mainStore } from 'store/main' const store2 = mainStore() import { getEquipmentTypeApi,//装备类型 @@ -17,7 +17,7 @@ getEquipmentListApi,//列表 getDetailApi,//详情 equipmentAddApi,//新增 - insertDraftApi,//草稿(编辑) + insertDraftApi,//草稿(编辑) removeDeviceApi,//删除 updateUpDownApi//上下架 } from 'http/api/usercenter/goodsmang' @@ -43,24 +43,24 @@ label: "name", multiple: false, value: "id" - }) + }) // 获取装备树 - const getTypeTreeData = async () => { + const getTypeTreeData = async () => { const res: any = await getEquipmentTypeApi(); console.log("treeData==========", res); - deviceTypeTree.value = res.data; + deviceTypeTree.value = res.data; } //装备类目-change - const deviceTypeChange = (val: any) => { - console.log(val) + const deviceTypeChange = (val: any) => { + console.log(val) if(val.length > 0) { queryParams.value.typeId = val[3] } else { queryParams.value.typeId = "" - } + } } //反显 树结构数据获取父 - const getSelectId = (list: any,id: any) => { + const getSelectId = (list: any,id: any) => { for (let i in list) { if (list[i].id == id) { //查询到就返回该数组对象的value @@ -76,29 +76,29 @@ } } } - + /* 装备树选中数组 */ - const deviceTypeList: any = ref([]) + const deviceTypeList: any = ref([]) //日期周期 const dateRange: any = ref([]) /* 查询参数 */ const queryParams: any = ref({ deviceName: '', code: '', - maStatus: '', - typeId: '', + maStatus: '', + typeId: '', pageSize: 10, pageNum: 1 }) const queryFormRef = ref() - const total: any = ref(0) - const tableData: any = ref([]) + const total: any = ref(0) + const tableData: any = ref([]) /* 查询按钮 */ const queryTableList = () => { queryParams.value.pageNum=1 getList() } - // 重置 + // 重置 const resetTableList = (formEl: FormInstance | undefined) => { if (!formEl) return formEl.resetFields() @@ -112,7 +112,6 @@ console.log(queryParams.value.pageNum, '***9999', queryParams.value.pageSize) const res: any = await getEquipmentListApi(queryParams.value) console.log(res, '列表数据**--**') - total.value = res.total tableData.value = res.rows.filter((item: any) => item !== null) } @@ -127,11 +126,11 @@ isEditDisabled.value = true equipmentDeploymentParams.value = { deviceName: '', - deviceTypeList: [], + deviceTypeList: [], deviceCount: 1, - unitName: '', - code: '', - brand: '', + unitName: '', + code: '', + brand: '', typeId: '', companyId: '', productionDate: '', @@ -147,11 +146,11 @@ // 打开入驻弹框 dialogFormVisibleSettlein.value = true } - + const maId: any = ref('') // 编辑按钮 const editRowInfo = (row: any) => { - settleinTitle.value = '装备编辑' + settleinTitle.value = '装备编辑' getDetailData(row) disabledForm.value = false isEditDisabled.value = true @@ -164,22 +163,23 @@ isEditDisabled.value = false } // 删除按钮 - const deleteRowInfo = async (row: any) => { + const deleteRowInfo = async (row: any) => { ElMessageBox.confirm('是否确定删除?', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', - }).then(() => { - const res: any = removeDeviceApi([row.maId]) - if (res.code === 200) { - ElMessage({ - type: 'success', - message: '删除成功' - }) - getList() - } - }).catch(() => {}) - } + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + }).then(() => { + return removeDeviceApi([row.maId]) + }).then((res) => { + if (res.code === 200) { + ElMessage({ + type: 'success', + message: '删除成功' + }) + getList() + } + }).catch(() => {}) + } //获取详情接口 const getDetailData = async(row: any) => { console.log(row,"----row----") @@ -202,9 +202,9 @@ // ) // equipmentDeploymentParams.value.leaseScope = String( // equipmentDeploymentParams.value.leaseScope - // ) + // ) // equipmentDeploymentParams.value.groupId = Number(equipmentDeploymentParams.value.groupId) - // equipmentDeploymentParams.value.typeId = Number(equipmentDeploymentParams.value.typeId) + // equipmentDeploymentParams.value.typeId = Number(equipmentDeploymentParams.value.typeId) // store.getprovinceList() // store.getmarketList(row.provinceId) // store.getareaList(row.cityId) @@ -214,8 +214,8 @@ } - - const ids: any = ref([]) + + const ids: any = ref([]) const handleSelectionChange = (selection:any) =>{ ids.value = selection.map((item:any) => item.maId) } @@ -233,18 +233,19 @@ maIds.push(row.maId) } if (maIds.length == 0){ - ElMessage({type: 'error',message: '请选择要操作的数据'}) + ElMessage({type: 'error',message: '请选择要操作的数据'}) return - } - const res: any = updateUpDownApi({maIds,maStatus}) - if (res.code === 200) { + } + return updateUpDownApi({maIds,maStatus}) + }).then((res) => { + if (res.code == 200) { ElMessage({ type: 'success', message: '操作成功' }) - queryTableList() - } - }).catch(() => {}) + getList() + } + }).catch(() => {}) } // // 省级数据源 @@ -276,14 +277,14 @@ // 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]) @@ -292,7 +293,7 @@ // // 区级下拉框获取区级数据 // const opeChangeArea = (val: any) => { // // AssemblyRegisterAddress[2] = val.split(',')[1] - // } + // } // // 设备类型大类 // const changeDeviceType = (val: any) => { // store.getDeviceTypeSonList(val) @@ -306,13 +307,13 @@ // // 设备类型小类 // const changeDeviceTypeSun = (val: any) => { // // deviceType[2] = val.split(',')[1] - // } - - /* - ----装备弹窗----- - */ + // } + + /* + ----装备弹窗----- + */ /* 查看 */ - const disabledForm = ref(false) + const disabledForm = ref(false) /* 编辑 */ const isEditDisabled = ref(false) /* 入驻框的标题 */ @@ -322,13 +323,13 @@ /* * 商品入驻弹框参数 */ - const equipmentDeploymentParams: any = ref({ + const equipmentDeploymentParams: any = ref({ deviceName: '', - deviceTypeList: [], + deviceTypeList: [], deviceCount: 1, - unitName: '', - code: '', - brand: '', + unitName: '', + code: '', + brand: '', typeId: '', companyId: '', productionDate: '', @@ -336,34 +337,34 @@ person: '', personPhone: '', deviceWeight: '', - }) + }) //编码类型禁止修改数目 - const countDisabled = ref(false) + const countDisabled = ref(false) //装备类目-change const dialogTypeCascader = ref() //装备类目-change - const dialogTypeChange = () => { + 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'){//数量 + if(manageType=='1'){//数量 equipmentDeploymentParams.value.deviceCount=1 countDisabled.value=false - }else if(manageType=='0'){//编码 + }else if(manageType=='0'){//编码 equipmentDeploymentParams.value.deviceCount=1 countDisabled.value=true - } + } } - //获取所属公司下拉数据 - const getCompanyList = async () => { + //获取所属公司下拉数据 + const getCompanyList = async () => { const res: any = await getCompanyListApi() - console.log(res, '列表数据**--**') - companyDataList.value = res.data - } + console.log(res, '列表数据**--**') + companyDataList.value = res.data + } // 装备弹框显示隐藏 const dialogFormVisibleSettlein: any = ref(false) - const ruleFormRef: any = ref(null) + const ruleFormRef: any = ref(null) //表单校验规则 const equipRules = ref({ deviceName: [ @@ -424,7 +425,7 @@ ], person: [ { required: true, message: "联系人不能为空", trigger: "blur" } - ], + ], personPhone: [ { required: true, message: "联系电话不能为空", trigger: "blur" }, { @@ -433,9 +434,9 @@ trigger: "blur" } ], - deviceWeight: [// + deviceWeight: [// { required: true, message: "整机重量不能为空", trigger: "blur" } - ], + ], }) // 弹框保存提交 const submitBtn = () => { @@ -445,12 +446,12 @@ 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){ + if(detailsFileList.value.length==0||detailsFileList.value.length>6){ ElMessage({type: 'error',message: '详情展示图不得少于1张,不得多于6张'}) return } @@ -470,7 +471,7 @@ dialogFormVisibleSettlein.value = false ruleFormRef.value.resetField() getList() - } + } } }) } @@ -480,12 +481,12 @@ 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){ + // if(detailsFileList.value.length==0||detailsFileList.value.length>6){ // ElMessage({type: 'error',message: '详情展示图不得少于1张,不得多于6张'}) // return // } @@ -505,7 +506,7 @@ dialogFormVisibleSettlein.value = false ruleFormRef.value.resetField() getList() - } + } } /* 关闭按钮 */ const closeDialogBtn = () => { @@ -549,20 +550,20 @@ fileUrl: val.msg }) } - + const mainFileList: any = ref([])//主展示 const detailsFileList: any = ref([])//详情展示 const insurancePdf: any = ref([])//合格证 - const examinationPdf: any = ref([])//检测证明 + const examinationPdf: any = ref([])//检测证明 //图片查看弹窗 - const dialogVisible: any = ref(false) + const dialogVisible: any = ref(false) const dialogImageUrl = ref('') //上传地址+header const imgUploadUrl = import.meta.env.VITE_API_URL + '/file/upload' const actionUrl = ref(imgUploadUrl) const headerInfo = reactive({ Authorization: "Bearer " + store2.token - }) + }) // 文件上传前处理-上传大小 const beforeUpload = (file: any) => { if (file.size / 1024 / 1024 > 2) { @@ -580,7 +581,7 @@ type: 'error', message: '上传文件失败!' }) - // this.$message.error({message: `上传文件失败!`}); + // this.$message.error({message: `上传文件失败!`}); } // 文件上传成功处理 const handleFileSuccess = (response: any) => { @@ -590,7 +591,7 @@ fileName: response.data.name.split("/")[4], fileUrl: response.data.url }; - console.log(obj); + console.log(obj); mainFileList.value.push(obj) ElMessage({ type: 'success', @@ -598,7 +599,7 @@ }) console.log(mainFileList.value) } - } + } // 文件上传成功处理 const handleFileSuccess2 = (response: any) => { if (response.code == 200) { @@ -607,7 +608,7 @@ fileName: response.data.name.split("/")[4], fileUrl: response.data.url }; - console.log(obj); + console.log(obj); detailsFileList.value.push(obj) ElMessage({ type: 'success', @@ -615,7 +616,7 @@ }) console.log(detailsFileList.value) } - } + } // 文件上传成功处理 const handleFileSuccess3 = (response: any) => { if (response.code == 200) { @@ -624,13 +625,13 @@ fileName: response.data.name.split("/")[4], fileUrl: response.data.url }; - console.log(obj); + console.log(obj); insurancePdf.value.push(obj) ElMessage({ type: 'success', message: '上传成功!' }) - console.log(insurancePdf.value) + console.log(insurancePdf.value) } } // 文件上传成功处理 @@ -641,7 +642,7 @@ fileName: response.data.name.split("/")[4], fileUrl: response.data.url }; - console.log(obj); + console.log(obj); examinationPdf.value.push(obj) ElMessage({ type: 'success', @@ -654,7 +655,7 @@ const handleDownload = (file: any) => { const windowName = file.name; window.open(file.fileUrl, windowName); - } + } //文件查看 const picturePreview = (file: any) => { dialogImageUrl.value = file.fileUrl; @@ -663,9 +664,9 @@ //文件查看 const handleRemove = (list: any,index: Number) => { list.splice(index,1) - } - - + } + + @@ -785,15 +786,15 @@ 提 交 - - + +
基本信息 -
+ + :rules="equipRules" :disabled="disabledForm"> - + - + /> + @@ -870,46 +871,46 @@ value-format="yyyy-MM-dd" type="date" style="width: 350px;"> - + - + /> + - + /> + - + /> + - + - - + /> + +
装备图片 -
+
* 主展示图: -
+
上传文件 - +
支持格式:.jpg .png,单个文件大小不能超过2M
-
+
@@ -1033,20 +1034,20 @@ -
+

{{ item.fileName }}

*注:图片排序为平台展示顺序,不得少于1张,不得多于6张
- +
* 详情页展示图: -
+
上传文件 - +
支持格式:.jpg .png,单个文件大小不能超过2M
@@ -1071,24 +1072,24 @@ - +

{{ item.fileName }}

*注:图片排序为平台展示顺序,不得少于1张,不得多于6张
- +
装备证书 -
+
* 合格证: -
+
上传文件 - +
支持格式:.jpg .png,单个文件大小不能超过2M
@@ -1113,17 +1114,17 @@ - +

{{ item.fileName }}

- +
* 检测证明: -
+
上传文件 - +
支持格式:.jpg .png,单个文件大小不能超过2M
@@ -1148,12 +1149,12 @@ - +

{{ item.fileName }}

- + - +