fangyuan
2022-12-16 9ff66017debadfc89bc0c1b796684a4d1dbe2bc3
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;
        }