Blame view

src/views/djbworkflow/djbBook/components/blxxtabs/dataprocessing.js 8.59 KB
xiaomiao committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22

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;
    },
  },
23
  data () {
xiaomiao committed
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
    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,

    };
  },
81
  created () {
xiaomiao committed
82 83
    this.loadData();
  },
84
  mounted () {
xiaomiao committed
85 86 87 88 89 90 91 92
    this.ableOperation = this.$parent.ableOperation;
  },
  methods: {
    /**
     * @description: ztQlxxchange
     * @param {*} val
     * @author: renchao
     */
93
    ztQlxxchange (val) {
xiaomiao committed
94 95 96 97 98 99 100
      this.ruleForm.ztQlxx = val;
    },
    /**
     * @description: ssQlxxchange
     * @param {*} val
     * @author: renchao
     */
101
    ssQlxxchange (val) {
xiaomiao committed
102 103 104 105 106
      this.ruleForm.ssQlxx = val;
      this.ruleForm.qlxx.ssywh = val.ywh;
      this.ssQlxxchangediolog(val);
    },
    // 弹框事件
107
    ssQlxxchangediolog (val) {
xiaomiao committed
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168
      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
     */
169
    djlxchange (val) {
xiaomiao committed
170 171 172 173 174 175 176 177 178 179
      if (val == null || val == 100) {
        this.ssqlxxshow = false;
      } else {
        this.ssqlxxshow = true;
      }
    },
    /**
     * @description: loadData
     * @author: renchao
     */
180 181
    loadData () {
      this.loading = true
xiaomiao committed
182 183
      this.propsParam.isEdit = this.$parent.isEdit;
      init(this.propsParam).then((res) => {
184
        this.loading = false
xiaomiao committed
185 186
        if (res.code == 200) {
          this.ruleForm = res.result;
187 188
          if (this.ruleForm.diyaq) {
            this.ruleForm.diyaq.dyfs = "1"
xiaomiao committed
189
          }
190 191 192 193 194
          if (this.ruleForm.ygdj) {
            this.ruleForm.ygdj.jedw = "1"
            this.ruleForm.ygdj.mjdw = "1"
            if (this.ruleForm.ygdj.sfczjzhxz == null) {
              this.ruleForm.ygdj.sfczjzhxz = "1"
xiaomiao committed
195
            }
xiaomiao committed
196
          }
197 198
          if (this.ruleForm.diyaq) {
            this.ruleForm.diyaq.mjdw = "1"
xiaomiao committed
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224
          }
          let djlx = this.ruleForm.qlxx.djlx;
          if (djlx == null || djlx == 100) {
            this.ssqlxxshow = false;
          }
          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;
            }
          });
        }
225 226 227
      }).catch(() => {
        this.loading = false
      })
xiaomiao committed
228 229 230 231 232 233
    },
    /**
     * @description: 更新土地用途信息
     * @param {*} val
     * @author: renchao
     */
234
    upDateTdytxxList (val) {
xiaomiao committed
235 236 237 238 239 240 241 242
      this.ruleForm.tdytqxList && (this.ruleForm.tdytqxList = _.cloneDeep(val));
      this.key++;
    },
    /**
     * @description: 更新权利人信息
     * @param {*} val
     * @author: renchao
     */
243
    upDateQlrxxList (val) {
xiaomiao committed
244 245 246 247 248 249 250 251 252
      this.ruleForm.qlrData && (this.ruleForm.qlrData = _.cloneDeep(val));
      this.czrOptions = this.ruleForm.qlrData;
      this.key++;
    },
    /**
     * @description: 更新义务人信息
     * @param {*} val
     * @author: renchao
     */
253
    upDateYwrxxList (val) {
xiaomiao committed
254 255 256 257 258 259 260
      this.ruleForm.ywrData && (this.ruleForm.ywrData = _.cloneDeep(val));
      this.key++;
    },
    /**
     * @description: onSubmit
     * @author: renchao
     */
261
    onSubmit () {
xiaomiao committed
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290
      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 {
291 292 293 294 295 296 297 298 299
            if (this.ruleForm.qlrData.length <= 1) {
              this.$message({
                showClose: true,
                message: "共有方式:共同所有,按份所有,其他所有,权利人必须是两个以上",
                type: "error",
              });
              return false;
            }
          }
300
          this.$store.dispatch("user/refreshPage", false);
xiaomiao committed
301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324
          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;
        }
      });
    },
  },
};