odc.xiaohui
2023-01-11 d942877495ceea1575e64fb6d4e2972f6da10cac
src/views/systemSetting/device/handheldTerminal/components/dialogForm.vue
@@ -40,7 +40,7 @@
          </el-form-item>
          <!-- 部门 -->
          <el-form-item class="optionItems" label="所属部门:" prop="departId">
            <el-select v-model="form.departId" placeholder="请输入所属部门">
            <el-select v-model="form.departName" placeholder="请输入所属部门">
              <el-option :value="mylabel">
                <el-tree
                  ref="tree"
@@ -73,15 +73,15 @@
</template>
  <script>
import { validatePhone, validateName } from "@/utils/validate";
import { createNamespacedHelpers } from "vuex";
const { mapActions } = createNamespacedHelpers("handheldTerminal");
export default {
  data() {
    const checkName = (rule, value, callback) => {
      if (value) {
        if (validateName(value)) {
          callback();
        } else {
          callback(new Error("请正确输入单兵名称"));
        }
        callback();
      } else {
        callback(new Error("单兵名称不能为空"));
      }
@@ -102,11 +102,7 @@
    };
    const checkUser = (rule, value, callback) => {
      if (value) {
        if (validateName(value)) {
          callback();
        } else {
          callback(new Error("请正确输入使用人员"));
        }
        callback();
      } else {
        callback(new Error("使用人员不能为空"));
      }
@@ -124,11 +120,10 @@
    };
    return {
      form: {
        carNumber: "",
        contact: "",
        ownerName: "",
        trajectory: "",
        vehicleUser: "",
        name: "",
        code: "",
        user: "",
        phone: "",
        departName: "",
        departId: 0,
      },
@@ -198,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;
        }
@@ -277,13 +276,13 @@
  <style lang="scss" scoped>
.create {
  border-radius: 1px;
  background-color: #09152f;
  // background-color: #09152f;
  main {
    // border: 1px solid #fff;
    text-align: left;
    padding: 0 55px;
    background-color: #09152f;
    // background-color: #09152f;
    padding-bottom: 50px;
    .mainContent {
@@ -323,18 +322,18 @@
    }
  }
  &::v-deep .el-textarea__inner {
    background-color: #09152f;
    border: 1px solid #17324c;
  }
  // &::v-deep .el-textarea__inner {
  //   background-color: #09152f;
  //   border: 1px solid #17324c;
  // }
  ::v-deep .el-form-item__label {
    color: #4b9bb7;
  }
  // ::v-deep .el-form-item__label {
  //   color: #4b9bb7;
  // }
  ::v-deep .el-input__inner {
    background-color: #09152f;
    border: 1px solid #17324c;
  }
  // ::v-deep .el-input__inner {
  //   background-color: #09152f;
  //   border: 1px solid #17324c;
  // }
}
</style>