diff --git a/package.json b/package.json index 515ab0c..bda3b2f 100644 --- a/package.json +++ b/package.json @@ -29,9 +29,11 @@ "lodash-es": "^4.17.21", "nprogress": "0.2.0", "pinia": "2.0.22", + "uuid": "^9.0.0", "vue": "3.2.45", "vue-cropper": "1.0.3", - "vue-router": "4.1.4" + "vue-router": "4.1.4", + "vue3-json-viewer": "^2.2.2" }, "devDependencies": { "@vitejs/plugin-vue": "3.1.0", diff --git a/src/api/product/product.js b/src/api/product/product.js index 3398132..7c24ca8 100644 --- a/src/api/product/product.js +++ b/src/api/product/product.js @@ -5,7 +5,7 @@ export function listProduct(query) { return request({ url: "/product/product/list", method: "get", - params: query + params: query, }); } @@ -13,7 +13,7 @@ export function listProduct(query) { export function getProduct(productId) { return request({ url: "/product/product/" + productId, - method: "get" + method: "get", }); } @@ -22,7 +22,7 @@ export function addProduct(data) { return request({ url: "/product/product", method: "post", - data: data + data: data, }); } @@ -31,7 +31,7 @@ export function updateProduct(data) { return request({ url: "/product/product", method: "put", - data: data + data: data, }); } @@ -39,7 +39,7 @@ export function updateProduct(data) { export function delProduct(productId) { return request({ url: "/product/product/" + productId, - method: "delete" + method: "delete", }); } @@ -50,7 +50,7 @@ export function delProduct(productId) { */ export function checkProductSn(productSn) { return request({ - url: `/product/product/check/${productSn}` - , method: "get" + url: `/product/product/check/${productSn}`, + method: "get", }); -} \ No newline at end of file +} diff --git a/src/constant/dict.js b/src/constant/dict.js index 73e7646..06f9245 100644 --- a/src/constant/dict.js +++ b/src/constant/dict.js @@ -1,34 +1,34 @@ export const statusMap = new Map([ ["0", "正常"], - ["1", "禁用"] + ["1", "禁用"], ]); export const deviceTypeMap = new Map([ [1, "直连设备"], [2, "网关子设备"], - [3, "网关子设备"] + [3, "网关子设备"], ]); export const vertificateMethodOptions = [ { label: "简单认证", - value: 1 - }, { + value: 1, + }, + { label: "加密认证", - value: 2 - }, { + value: 2, + }, + { label: "简单+加密", - value: 3 - } + value: 3, + }, ]; export const isTopMap = new Map([ [0, "是"], - [1, "否"] + [1, "否"], ]); export const isMonitor = new Map([ [0, "是"], - [1, "否"] + [1, "否"], ]); - - diff --git a/src/views/login.vue b/src/views/login.vue index cadf3d6..17e2280 100644 --- a/src/views/login.vue +++ b/src/views/login.vue @@ -12,7 +12,7 @@ -
+
-
+
diff --git a/src/views/product/product/components/edit.vue b/src/views/product/product/components/edit.vue index bc50f6f..a632425 100644 --- a/src/views/product/product/components/edit.vue +++ b/src/views/product/product/components/edit.vue @@ -32,11 +32,18 @@ - - + + - @@ -126,7 +149,12 @@ import { onMounted, reactive, ref, toRefs } from "vue"; import Model from "@/views/product/product/components/model.vue"; import { useRoute } from "vue-router"; -import { addProduct, checkProductSn, getProduct, updateProduct } from "@/api/product/product"; +import { + addProduct, + checkProductSn, + getProduct, + updateProduct, +} from "@/api/product/product"; import { listCategory } from "@/api/product/category"; import { listTenant } from "@/api/system/tenant"; import ImageUpload from "@/components/ImageUpload/index.vue"; @@ -140,26 +168,24 @@ const data = reactive({ form: {}, rules: { productName: [ - { required: true, message: "产品名称不能为空", trigger: "blur" } + { required: true, message: "产品名称不能为空", trigger: "blur" }, ], categoryId: [ - { required: true, message: "产品分类ID不能为空", trigger: "blur" } + { required: true, message: "产品分类ID不能为空", trigger: "blur" }, ], - tenantId: [{ required: true, message: "租户ID不能为空", trigger: "blur" }] - } + tenantId: [{ required: true, message: "租户ID不能为空", trigger: "blur" }], + }, }); const { form, rules } = toRefs(data); const productRef = ref(); -const categoryOptions = ref([]); // 产品分类树形选择 +const categoryOptions = ref([]); // 产品分类树形选择 const tenantOptions = ref([]); const isProductSnUnique = ref(); - - const checkProductSnUnique = debounce((sn) => { console.log(sn); - checkProductSn(sn).then(response => { + checkProductSn(sn).then((response) => { console.log(response); isProductSnUnique.value = response.empty; }); @@ -183,7 +209,7 @@ function reset() { imgUrl: null, createBy: null, createTime: null, - remark: null + remark: null, }; // proxy.resetForm("productRef"); if (productRef.value) { @@ -213,7 +239,9 @@ const getCategoryList = async () => { const getTenantList = async (keyword) => { const response = await listTenant({ - pageNum: 1, pageSize: 20, tenantName: keyword + pageNum: 1, + pageSize: 20, + tenantName: keyword, }); tenantOptions.value = response.rows; }; @@ -229,8 +257,10 @@ const submitForm = () => { addProduct(form.value).then((response) => { ElMessage.success("新增成功"); form.value = response.data; - const tabObj = Object.assign({}, route, { title: "修改产品" }); - tab.updatePage(tabObj); + // const tabObj = Object.assign({}, route, { title: "修改产品" }); + // tab.updatePage(tabObj); + const tabObj = { path: "/produc/product" }; + tab.closeOpenPage(tabObj); }); } } diff --git a/src/views/product/product/components/model.vue b/src/views/product/product/components/model.vue index 4769457..7b7f0f4 100644 --- a/src/views/product/product/components/model.vue +++ b/src/views/product/product/components/model.vue @@ -3,93 +3,299 @@ 新增 + @click="handleAdd" + >新增 + + + + 导入 新增 - - - - 新增 + @click="emits('model-updated')" + >刷新 新增 + @click="openJsonViewer = true" + >预览 - + - -