From 1750b25e3bbf098e6d0e3085988f1c382259f3e1 Mon Sep 17 00:00:00 2001 From: hh <292475944@qq.com> Date: Wed, 18 Nov 2020 13:44:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=A7=E5=8C=BA=E6=A0=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/hardware/area.js | 18 ++++++++ src/components/Region/index.vue | 61 +++++++++++++++++++++++-- src/views/hardware/deviceList/index.vue | 58 ++++++++++++++++++++++- 3 files changed, 130 insertions(+), 7 deletions(-) diff --git a/src/api/hardware/area.js b/src/api/hardware/area.js index e614dad..fd93260 100644 --- a/src/api/hardware/area.js +++ b/src/api/hardware/area.js @@ -7,4 +7,22 @@ export function list() { method: 'get', }) } +export function areaSelect() { + return request({ + url: '/system/area/select', + method: 'get', + }) +} +export function getProvinceByArea(id) { + return request({ + url: '/system/province/getProvinceByArea?areaId=' + id, + method: 'get', + }) +} +export function getProvinceByParent(id) { + return request({ + url: '/system/province/getProvinceByParent?parent=' + id, + method: 'get', + }) +} diff --git a/src/components/Region/index.vue b/src/components/Region/index.vue index 6cb3f07..bb2655c 100644 --- a/src/components/Region/index.vue +++ b/src/components/Region/index.vue @@ -1,20 +1,21 @@ diff --git a/src/views/hardware/deviceList/index.vue b/src/views/hardware/deviceList/index.vue index afc7fa8..6f49fde 100644 --- a/src/views/hardware/deviceList/index.vue +++ b/src/views/hardware/deviceList/index.vue @@ -2,7 +2,7 @@
- + @@ -92,6 +92,18 @@ + + + + + + + + + + + + @@ -120,6 +132,8 @@ import { del, } from "@/api/hardware/device"; import { select as productSelect } from "@/api/hardware/product"; +import { select as projectSelect } from "@/api/hardware/project"; +import { userSelect } from "@/api/system/user"; export default { name: "DeviceList", components: { @@ -129,6 +143,8 @@ export default { return { // 产品下拉列表 productSelectList: [], + userSelectList: [], + projectSelectList: [], // 选中数组 ids: [], // 非单个禁用 @@ -165,6 +181,12 @@ export default { productId: [ { required: true, message: "产品不能为空", trigger: "blur" }, ], + userId: [ + { required: true, message: "客户不能为空", trigger: "blur" }, + ], + projectId: [ + { required: true, message: "项目不能为空", trigger: "blur" }, + ], }, }; }, @@ -176,9 +198,33 @@ export default { this.$message.error(msg); } }) + userSelect().then(({ code, msg, select }) => { + if (code == 200) { + this.queryUserSelectList = select; + this.userSelectList = select; + } else { + this.$message.error(msg); + } + }) this.getList(); }, methods: { + selectdRegionCode({ code }) { + this.queryParams.provinceCode = code; + this.handleQuery(); + }, + userIdChange (userId) { + delete this.form.projectId; + this.projectSelectList = []; + if (!userId) return; + projectSelect({ userId }).then(({ code, msg, select }) => { + if (code == 200) { + this.projectSelectList = select; + } else { + this.$message.error(msg); + } + }) + }, /** 搜索按钮操作 */ handleQuery () { this.queryParams.pageNum = 1; @@ -186,7 +232,7 @@ export default { }, /** 重置按钮操作 */ resetQuery () { - this.dateRange = []; + this.queryParams = {}; this.resetForm("queryForm"); this.handleQuery(); }, @@ -232,6 +278,14 @@ export default { /** 修改按钮操作 */ handleUpdate (row) { this.reset(); + info(row.id).then(({ code, info, msg }) => { + if ( 200 == code ) { + this.form = info; + } else { + this.msgError(msg); + } + }) + return this.form = row; this.open = true; this.title = "修改设备";