From 14f8b7b32ed9133152780eb072adbc32df2eb242 Mon Sep 17 00:00:00 2001 From: zhanghua <314079846@qq.com> Date: 星期一, 07 十一月 2022 17:42:16 +0800 Subject: [PATCH] 音柱、手持设备修改 --- src/views/systemSetting/device/handheldTerminal/components/dialogForm.vue | 38 +++++++++++++++++++++++--------------- 1 files changed, 23 insertions(+), 15 deletions(-) diff --git a/src/views/systemSetting/device/handheldTerminal/components/dialogForm.vue b/src/views/systemSetting/device/handheldTerminal/components/dialogForm.vue index fa3c400..511b162 100644 --- a/src/views/systemSetting/device/handheldTerminal/components/dialogForm.vue +++ b/src/views/systemSetting/device/handheldTerminal/components/dialogForm.vue @@ -73,6 +73,10 @@ </template> <script> import { validatePhone, validateName } from "@/utils/validate"; + +import { createNamespacedHelpers } from "vuex"; +const { mapActions } = createNamespacedHelpers("handheldTerminal"); + export default { data() { const checkName = (rule, value, callback) => { @@ -189,37 +193,41 @@ // 鍒濆鍖栭儴闂ㄦ爲 getDepartTree(); // 鍒濆鍖栨暟鎹� - this.form = JSON.parse(JSON.stringify(this.info)); + this.form = this.info; if (!this.form.departName) { this.form.departName = this.form.pdepartName; } }, + + watch: { + info(newVal) { + this.form = newVal; //瀵圭埗缁勪欢浼犺繃鏉ョ殑鍊艰繘琛岀洃鍚紝濡傛灉鏀瑰彉涔熷瀛愮粍浠跺唴閮ㄧ殑鍊艰繘琛屾敼鍙� + }, + }, methods: { + ...mapActions(["saveHandheldTerminal", "updateHandheldTerminal"]), // 淇敼鎵ф硶杞� handleUpdateLawCar() { this.$refs.formRef.validate((valid) => { if (valid) { const { form } = this; - this.$axios({ - method: "put", - url: "sccg/car_Manage/modification_enforce", - data: { - ...form, - }, - }).then((res) => { - if (res.code === 200) { + if (form.id > 0) { + this.updateHandheldTerminal(form).then((res) => { this.$message({ type: "success", - message: "淇敼杞﹁締鎴愬姛", + message: "淇敼鎵嬫寔璁惧鎴愬姛", }); this.$emit("closeDialog", { flag: false, index: 1 }); - } else { + }); + } else { + this.saveHandheldTerminal(form).then((res) => { this.$message({ - type: "error", - message: res.message, + type: "success", + message: "淇濆瓨鎵嬫寔璁惧鎴愬姛", }); - } - }); + this.$emit("closeDialog", { flag: false, index: 1 }); + }); + } } else { return false; } -- Gitblit v1.8.0