dataprocessing.js 8.42 KB

import {
  init,
  getSsQlxx,
  getZtQlxx,
  getQlxxByQlxxBsm,
  save,
} from "@/api/djbRepair.js";
import { log } from "bpmn-js-token-simulation";
import { mapGetters } from "vuex";
export default {
  computed: {
    ...mapGetters(["dictData", "flag"]),
    // 根据流程判断表单是否为只读
    editDisabled () {
      if (!this.ableOperation) {
        //只读状态
        return true;
      }
      return false;
    },
  },
  data() {
    return {
      ssqlxxshow: true,
      //表单是否可操作
      propsParam: this.$attrs,
      key: 0,
      isShow: false,
      disabled: true,
      czrOptions: [],
      ssQlxxList: [],
      ztQlxxList: [],
      ruleForm: {},
      props: {
        label: "bdcqzh",
        value: "bdcdyid",
      },
      djlxlist: [
        {
          dcode: "100",
          dname: "首次登记",
        },
        {
          dcode: "200",
          dname: "转移登记",
        },
        {
          dcode: "300",
          dname: "变更登记",
        },
        {
          dcode: "500",
          dname: "更正登记",
        },

        {
          dcode: "901",
          dname: "补证",
        },
        {
          dcode: "902",
          dname: "换证",
        },
      ],
      // 权属状态
      qsztlist: [
        {
          dcode: "1",
          dname: "现势",
        },
        {
          dcode: "2",
          dname: "历史",
        },
      ],
      ableOperation: false,

    };
  },
  created() {
    this.loadData();
  },
  mounted() {
    this.ableOperation = this.$parent.ableOperation;
  },
  methods: {
    /**
     * @description: ztQlxxchange
     * @param {*} val
     * @author: renchao
     */
    ztQlxxchange(val) {
      this.ruleForm.ztQlxx = val;
    },
    /**
     * @description: ssQlxxchange
     * @param {*} val
     * @author: renchao
     */
    ssQlxxchange(val) {
      this.ruleForm.ssQlxx = val;
      this.ruleForm.qlxx.ssywh = val.ywh;
      this.ssQlxxchangediolog(val);
    },
    // 弹框事件
    ssQlxxchangediolog(val) {
      this.$confirm("是否将上手权利信息同步到表单", "提示", {
        iconClass: "el-icon-question", //自定义图标样式
        confirmButtonText: "确认", //确认按钮文字更换
        cancelButtonText: "取消", //取消按钮文字更换
        showClose: true, //是否显示右上角关闭按钮
        type: "warning",
      })
        .then(() => {
          getQlxxByQlxxBsm({ qlxxBsm: val.bsmQlxx }).then((res) => {
            if (res.code == 200) {
              this.nowlist = res.result;
              for (var key in this.ruleForm.yydj) {
                if (
                  this.ruleForm.yydj[key] == "" ||
                  this.ruleForm.yydj[key] == null
                ) {
                  this.ruleForm.yydj[key] = this.nowlist.yydj[key];
                }
              }
              for (var key in this.ruleForm.qlxx) {
                if (
                  this.ruleForm.qlxx[key] == "" ||
                  (this.ruleForm.qlxx[key] == null &&
                    key != "ywh" &&
                    key != "dbr" &&
                    key != "djsj" &&
                    key != "ssywh" &&
                    key != "ssywh" &&
                    key != "bdcqzh")
                ) {
                  this.ruleForm.qlxx[key] = this.nowlist.qlxx[key];
                }
              }
              if (!this.ruleForm.tdytqxList.length) {
                this.ruleForm.tdytqxList = this.nowlist.tdytqxList;
              }
              if (!this.ruleForm.qlrData.length) {
                this.ruleForm.qlrData = this.nowlist.qlrData;
              }
              if (!this.ruleForm.ywrData.length) {
                this.ruleForm.ywrData = this.nowlist.ywrData;
              }
              this.$message({
                type: "success",
                message: "同步成功!",
              });
            }
          });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消同步",
          });
        });
    },
    /**
     * @description: djlxchange
     * @param {*} val
     * @author: renchao
     */
    djlxchange(val) {
      if (val == null || val == 100) {
        this.ssqlxxshow = false;
      } else {
        this.ssqlxxshow = true;
      }
    },
    /**
     * @description: loadData
     * @author: renchao
     */
    loadData() {
      this.$startLoading();
      this.propsParam.isEdit = this.$parent.isEdit;
      init(this.propsParam).then((res) => {
        if (res.code == 200) {
          this.ruleForm = res.result;
          if(this.ruleForm.diyaq){
            this.ruleForm.diyaq.dyfs="1"
          }
          if(this.ruleForm.ygdj){
            this.ruleForm.ygdj.jedw="1"
            this.ruleForm.ygdj.mjdw="1"
          }
          if(this.ruleForm.diyaq){
            this.ruleForm.diyaq.mjdw="1"
          }
          let djlx = this.ruleForm.qlxx.djlx;
          if (djlx == null || djlx == 100) {
            this.ssqlxxshow = false;
          }
          this.$endLoading();
          this.isShow = true;
          //获取主体信息
          getSsQlxx({
            bdcdyid: this.propsParam.bdcdyid,
            qllx: this.propsParam.qllx,
            bsmQlxx: this.ruleForm.qlxx.bsmQlxx,
          }).then((res) => {
            if (res.code == 200) {
              this.ssQlxxList = res.result;
            }
          });
          //获取上手信息
          getZtQlxx({
            bdcdyid: this.propsParam.bdcdyid,
            bsmQlxx: this.ruleForm.qlxx.bsmQlxx,
          }).then((res) => {
            if (res.code == 200) {
              this.ztQlxxList = res.result;
            }
          });
        }
      });
    },
    // 更新土地用途信息
    /**
     * @description: 更新土地用途信息
     * @param {*} val
     * @author: renchao
     */
    upDateTdytxxList(val) {
      this.ruleForm.tdytqxList && (this.ruleForm.tdytqxList = _.cloneDeep(val));
      this.key++;
    },
    /**
     * @description: 更新权利人信息
     * @param {*} val
     * @author: renchao
     */
    upDateQlrxxList(val) {
      this.ruleForm.qlrData && (this.ruleForm.qlrData = _.cloneDeep(val));
      this.czrOptions = this.ruleForm.qlrData;
      this.key++;
    },
    // 更新义务人信息
    /**
     * @description: 更新义务人信息
     * @param {*} val
     * @author: renchao
     */
    upDateYwrxxList(val) {
      this.ruleForm.ywrData && (this.ruleForm.ywrData = _.cloneDeep(val));
      this.key++;
    },
    /**
     * @description: onSubmit
     * @author: renchao
     */
    onSubmit() {
      this.$refs.ruleForm.validate((valid) => {
        if (valid) {
          if (this.ruleForm.qlrData.length == 0) {
            this.$message({
              showClose: true,
              message: "请确认权利人信息",
              type: "error",
            });
            return false;
          }
          if (this.ruleForm.ywrData.length == 0) {
            this.$message({
              showClose: true,
              message: "请确认义务人信息",
              type: "error",
            });
            return false;
          }
          if (this.ruleForm.qlxx.gyfs == "0") {
            if (this.ruleForm.qlrData.length > 1) {
              this.$message({
                showClose: true,
                message: "共有方式:单独所有,权利人只能是一个人",
                type: "error",
              });
              return false;
            }
            this.ruleForm.qlrData[0].sfczr = "1";
          } else {
              if (this.ruleForm.qlrData.length <= 1) {
                this.$message({
                  showClose: true,
                  message: "共有方式:共同所有,按份所有,其他所有,权利人必须是两个以上",
                  type: "error",
                });
                return false;
              }
              }

          save(this.ruleForm).then((res) => {
            if (res.code === 200) {
              this.$message({
                showClose: true,
                message: "保存成功!",
                type: "success",
              });
              this.$parent.changeywh();
              this.$store.dispatch("user/refreshPage", true);
            } else {
              this.$message({
                showClose: true,
                message: res.message,
                type: "error",
              });
            }
          });
        } else {
          return false;
        }
      });
    },
  },
};