From 5ad085bf271bbc6c2d57862932435128366b2cfd Mon Sep 17 00:00:00 2001 From: Cc Date: Fri, 21 Feb 2025 15:02:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=A0=E6=84=9F=E5=99=A8=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/ywry.js | 7 ++ src/views/iot/product/groupEdit.vue | 56 ++++++++++++- src/views/iot/product/index.vue | 10 ++- src/views/iot/sensor/add.vue | 8 +- src/views/iot/sensor/index.vue | 6 ++ src/views/iot/ywry/index.vue | 83 +++++++++---------- src/views/iot/ywry/qcode.vue | 6 +- src/views/server/siteDetails/energy.vue | 4 +- src/views/server/siteDetails/only.vue | 4 +- src/views/server/siteDetails/readable.vue | 2 +- src/views/set/manage.vue | 2 +- src/views/set/set.vue | 2 +- .../set/components/applets/appletsIndex.vue | 6 +- src/views/set/set/components/menuIndex.vue | 6 +- 14 files changed, 138 insertions(+), 64 deletions(-) diff --git a/src/api/ywry.js b/src/api/ywry.js index 3fd9444..5c94dd3 100644 --- a/src/api/ywry.js +++ b/src/api/ywry.js @@ -30,3 +30,10 @@ export function productAttribute(materialCode) { method: 'get', }); } + +export function getNameplate(code) { + return request({ + url: '/productCategory/getNameplate/' + code, + method: 'get', + }); +} diff --git a/src/views/iot/product/groupEdit.vue b/src/views/iot/product/groupEdit.vue index 95f2414..ee00fa5 100644 --- a/src/views/iot/product/groupEdit.vue +++ b/src/views/iot/product/groupEdit.vue @@ -26,6 +26,24 @@ autocomplete="off" > + + + + + + + + import { addData, updateData } from '@/api/product'; +import { baseURL } from '@/config'; +import store from '@/store'; export default { name: 'GroupEdit', data() { return { + updateAction: '', + fileList: [], form: { id: '', name: '', @@ -56,27 +78,59 @@ export default { materialCode: [ { required: true, trigger: 'blur', message: '请输入物料编码' }, ], + nameplate: [ + { required: true, trigger: 'blur', message: '请上传铭片模板' }, + ], }, roleData: [], clearable: true, roleId: '', parentData: [], title: '', + dialogVisible: false, dialogFormVisible: false, }; }, - created() {}, + created() { + this.setUpdateData(); + }, methods: { + setUpdateData() { + this.updateAction = baseURL + '/file/uploadImg'; + this.headerData = { token: store.getters['user/token'] }; + }, + fileSuccess(response, file, fileList) { + var img = this.form.nameplate; + + this.form.nameplate = response.data; + + console.log(this.form); + }, + handleRemove(file, fileList) { + console.log(file, fileList); + this.form.nameplate = ''; + }, + handlePictureCardPreview(file) { + console.log(file); + this.dialogImageUrl = file.url; + this.dialogVisible = true; + }, showEdit(row) { if (!row) { this.title = '添加产品'; } else { this.title = '编辑产品'; + row.nameplate && + this.fileList.push({ + url: row.nameplate, + }); this.form = Object.assign({}, row); } + this.dialogFormVisible = true; }, close() { + this.fileList = []; this.$refs['form'].resetFields(); this.form = this.$options.data().form; this.dialogFormVisible = false; diff --git a/src/views/iot/product/index.vue b/src/views/iot/product/index.vue index c68eb48..996dc55 100644 --- a/src/views/iot/product/index.vue +++ b/src/views/iot/product/index.vue @@ -91,6 +91,8 @@ import { } from '@/api/product'; import groupEdit from './groupEdit'; import attributeEdit from './attributeEdit'; +import { baseURL } from '@/config'; +import { imgReplacePath } from '@/utils/img'; export default { name: 'Index', components: { groupEdit, attributeEdit }, @@ -123,7 +125,13 @@ export default { async fetchData() { this.listLoading = true; const { data } = await getList(this.queryForm); - this.groupData = data.items; + + this.groupData = data.items.map(item => { + item.nameplate && + (item.nameplate = baseURL + '/static/img/' + item.nameplate); + return item; + }); + console.log(this.groupData); this.total = data.total; setTimeout(() => { this.listLoading = false; diff --git a/src/views/iot/sensor/add.vue b/src/views/iot/sensor/add.vue index 29b3904..bf85c62 100644 --- a/src/views/iot/sensor/add.vue +++ b/src/views/iot/sensor/add.vue @@ -71,7 +71,7 @@ - + + + diff --git a/src/views/iot/ywry/index.vue b/src/views/iot/ywry/index.vue index 6fcf610..ca4d3c0 100644 --- a/src/views/iot/ywry/index.vue +++ b/src/views/iot/ywry/index.vue @@ -123,7 +123,12 @@ width="50%" @close="close" > - +