Blame view

src/views/zsgl/zsff/components/addDialog.vue 8.64 KB
蔡俊立 committed
1
<template>
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
  <el-form ref="ruleForm" :model="ruleForm" label-width="100px" :rules="rules">
    <el-row>
      <el-col :span="12">
        <el-form-item label="发放编号:" prop="batchno">
          <el-input v-model="ruleForm.batchno" :disabled="true"></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="领取时间:" prop="operationtime">
          <el-date-picker v-model="ruleForm.operationtime" class="width100" type="datetime" placeholder="选择日期时间"
            :disabled="!readOnly" value-format="yyyy-MM-dd HH:mm:ss">
          </el-date-picker>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="12">
        <el-form-item label="入库人员:">
          <el-input v-model="ruleForm.operator" :disabled="true"></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="领取人:" prop="receiver">
          <el-select v-model="ruleForm.receiver" class="width100" placeholder="请选择" :disabled="!readOnly">
            <el-option v-for="item in usernames" :key="item" :label="item" :value="item"></el-option>
          </el-select>
任超 committed
28
        </el-form-item>
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
      </el-col>
    </el-row>
    <div>
      <el-table :data="tableForm" border :header-cell-style="{ 'text-align': 'center', background: 'rgb(236, 245, 255)' }"
        :cell-style="{ 'text-align': 'center' }">
        <el-table-column prop="name" label="纸质证书类型" width="200"></el-table-column>
        <el-table-column prop="ksysxlh" label="开始印刷序列号" width="200"></el-table-column>
        <el-table-column prop="bs" label="本数">
          <template slot-scope="scope">
            <el-input v-model="scope.row.bs" @blur="ysxlhDeal(scope.row)" oninput="value=value.replace(/[^\d.]/g,'')"
              maxlength="6" :disabled="!readOnly"></el-input>
          </template>
        </el-table-column>
        <el-table-column prop="jsysxlh" label="结束印刷序列号" width="200">
          <template slot-scope="scope">
            <span v-if="scope.row.jsysxlh == ''" class="font-red">系统计算</span>
            <span v-else>{{ scope.row.jsysxlh }}</span>
          </template>
        </el-table-column>
      </el-table>
蔡俊立 committed
49
    </div>
50 51 52 53 54 55 56 57 58
    <el-form-item label="备注" class="middle-margin-bottom">
      <el-input type="textarea" v-model="ruleForm.bz" :rows="4" :disabled="!readOnly"></el-input>
    </el-form-item>

    <el-form-item v-if="readOnly">
      <el-button type="primary" @click="submitForm">保存</el-button>
      <el-button @click="closeDialog">取消</el-button>
    </el-form-item>
  </el-form>
蔡俊立 committed
59 60 61
</template>

<script>
62 63
import { getZsStartNo, getZsEndNo, zsff, getZsglInfo } from "@/api/zsgl.js"
import { getSysSerialSingle } from "@/api/sysSerial.js"
xiaomiao committed
64
import axios from "axios";
蔡俊立 committed
65 66
export default {
  props: {
67 68 69 70
    formData: {
      type: Object,
      default: () => { }
    }
蔡俊立 committed
71 72 73
  },
  data () {
    return {
蔡俊立 committed
74
      readOnly: false,
蔡俊立 committed
75
      //表单提交数据
蔡俊立 committed
76
      ruleForm: {
任超 committed
77 78
        batchno: '',
        receiver: '',
蔡俊立 committed
79 80
        operator: '超级管理员',
        operationtime: '',
任超 committed
81 82 83 84 85 86 87 88
        bz: '',
        zsstarno: '',
        zsendno: '',
        zsnum: '',
        zmstarno: '',
        zmendno: '',
        zmnum: ''
      },
蔡俊立 committed
89
      //表格数据
蔡俊立 committed
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
      tableForm: [
        {
          name: '不动产权证书',
          ksysxlh: '',
          jsysxlh: '',
          bs: '',
          zslx: 'zs'
        },
        {
          name: '不动产权登记证明',
          ksysxlh: '',
          jsysxlh: '',
          bs: '',
          zslx: 'zm'
        }
任超 committed
105
      ],
蔡俊立 committed
106
      //证书分发业务号固定参数
蔡俊立 committed
107 108 109 110 111 112
      ywhQueryForm: {
        serialtype: 'zsffbh',
        serialname: '证书分发编号',
        serialcode: 'zsff',
        digit: '5'
      },
蔡俊立 committed
113
      //用户列表
xiaomiao committed
114
      usernames: [],
蔡俊立 committed
115
      rules: {
任超 committed
116 117 118 119 120 121 122 123 124 125 126 127
        batchNo: [
          { required: true, message: '入库编号不能为空', trigger: 'blur' }
        ],
        lqr: [
          { required: true, message: '请选择领取人', trigger: 'change' }
        ],
        rksj: [
          { required: true, message: '请选择入库时间', trigger: 'change' }
        ],
      },
    }
  },
128 129
  mounted () {
    if (this.formData.bsmBatch) {
130 131
      this.tableForm[0].jsysxlh = null;
      this.tableForm[1].jsysxlh = null;
132 133 134 135
      this.getDetailInfo(this.formData.bsmBatch);
    } else {
      this.ywhSerial();
      this.initStartNo();
蔡俊立 committed
136
    }
xiaomiao committed
137
    this.getreceiver()
蔡俊立 committed
138 139
  },
  methods: {
xiaomiao committed
140 141 142 143 144 145 146 147 148 149 150 151 152
        //领取人列表
    /**
     * @description: 领取人列表
     * @author: renchao
     */
    getreceiver(){
      let url=window._config.services.management+"/management/rest/users?organizationId="+this.formData.organizationId
    axios.get(url).then(res => {
      res.data.content.forEach((item) => {
        this.usernames.push(item.name)
      })
        })
    },
蔡俊立 committed
153
    //表单提交
yuanbo committed
154 155 156 157
    /**
     * @description: 表单提交
     * @author: renchao
     */
蔡俊立 committed
158
    submitForm () {
蔡俊立 committed
159
      zsff(this.ruleForm).then(res => {
任超 committed
160
        if (res.code == 200) {
蔡俊立 committed
161 162
          this.$message.success('保存成功')
          this.$emit("input", false);
任超 committed
163
          this.$refs['ruleForm'].resetFields();
蔡俊立 committed
164
          this.resetTableFields();
165
          this.$parent.queryClick();
任超 committed
166
        } else {
蔡俊立 committed
167 168 169
          this.$message.error(res.message)
        }
      })
蔡俊立 committed
170 171
    },
    //序列号获取
yuanbo committed
172 173 174 175
    /**
     * @description: 序列号获取
     * @author: renchao
     */
任超 committed
176
    ywhSerial () {
蔡俊立 committed
177
      getSysSerialSingle(this.ywhQueryForm).then(res => {
任超 committed
178 179
        if (res.code == 200) {
          this.ruleForm.batchno = res.message;
蔡俊立 committed
180
          this.readOnly = true;
蔡俊立 committed
181 182
        }
      })
蔡俊立 committed
183
    },
蔡俊立 committed
184
    //获取详情信息
yuanbo committed
185 186 187 188 189
    /**
     * @description: 获取详情信息
     * @param {*} bsmBatch
     * @author: renchao
     */
190 191 192 193 194 195 196 197 198 199 200 201 202
    getDetailInfo (bsmBatch) {
      getZsglInfo({ "bsmBatch": bsmBatch }).then(res => {
        if (res.code == 200) {
          this.ruleForm = res.result;
          this.readOnly = false;
          this.tableForm[0].ksysxlh = res.result.zsstarno;
          this.tableForm[0].jsysxlh = res.result.zsendno;
          this.tableForm[0].bs = res.result.zsnum;
          this.tableForm[1].ksysxlh = res.result.zmstarno;
          this.tableForm[1].jsysxlh = res.result.zmendno;
          this.tableForm[1].bs = res.result.zmnum;
        }
      })
蔡俊立 committed
203 204
    },
    //初始化开始序列号
yuanbo committed
205 206 207 208
    /**
     * @description: 初始化开始序列号
     * @author: renchao
     */
任超 committed
209 210 211 212 213 214 215
    initStartNo () {
      getZsStartNo().then(res => {
        if (res.code == 200) {
          this.tableForm[0].ksysxlh = res.result.zsstarno
          this.tableForm[1].ksysxlh = res.result.zmstarno
        }
      })
蔡俊立 committed
216 217
    },
    //印刷序列号处理
yuanbo committed
218 219 220 221 222
    /**
     * @description: 印刷序列号处理
     * @param {*} item
     * @author: renchao
     */
任超 committed
223 224
    ysxlhDeal (item) {
      if (item.bs) {
蔡俊立 committed
225
        //存在本数
任超 committed
226 227
        getZsEndNo({ "bookNumber": item.bs, "zslx": item.zslx }).then(res => {
          if (res.code == 200) {
蔡俊立 committed
228 229
            item.jsysxlh = res.result.endno
            item.bs = res.result.bookNumber
任超 committed
230 231
            this.updateRuleForm(res.result.endno, res.result.bookNumber, item);
          } else {
蔡俊立 committed
232
            this.$message.error(res.message)
任超 committed
233
          }
蔡俊立 committed
234
        })
任超 committed
235
      } else {
蔡俊立 committed
236 237 238
        //不存在本数
        item.bs = 0;
        item.jsysxlh = '';
任超 committed
239 240
        this.updateRuleForm('', 0, item);
      }
蔡俊立 committed
241 242
    },
    //更新表单数据
yuanbo committed
243 244 245 246 247 248 249
    /**
     * @description: 更新表单数据
     * @param {*} endno
     * @param {*} bookNumber
     * @param {*} item
     * @author: renchao
     */
任超 committed
250 251
    updateRuleForm (endno, bookNumber, item) {
      if (item.zslx == 'zs') {
蔡俊立 committed
252 253 254
        this.ruleForm.zsstarno = item.ksysxlh;
        this.ruleForm.zsendno = endno;
        this.ruleForm.zsnum = bookNumber;
任超 committed
255
      } else if (item.zslx == 'zm') {
蔡俊立 committed
256 257 258 259
        this.ruleForm.zmstarno = item.ksysxlh;
        this.ruleForm.zmendno = endno;
        this.ruleForm.zmnum = bookNumber;
      }
蔡俊立 committed
260
    },
yuanbo committed
261 262 263 264
    /**
     * @description: resetTableFields
     * @author: renchao
     */
任超 committed
265
    resetTableFields () {
蔡俊立 committed
266 267 268 269 270 271
      this.tableForm = [
        {
          name: '不动产权证书',
          ksysxlh: '',
          jsysxlh: '',
          bs: 0,
蔡俊立 committed
272
          zslx: 'zs'
蔡俊立 committed
273 274 275 276 277 278
        },
        {
          name: '不动产权登记证明',
          ksysxlh: '',
          jsysxlh: '',
          bs: 0,
蔡俊立 committed
279
          zslx: 'zm'
蔡俊立 committed
280 281 282
        }
      ]
    },
yuanbo committed
283 284 285 286
    /**
     * @description: closeDialog
     * @author: renchao
     */
蔡俊立 committed
287
    closeDialog () {
288
      this.$popupCacel()
任超 committed
289
      this.$refs['ruleForm'].resetFields();
蔡俊立 committed
290
      this.resetTableFields();
任超 committed
291
    }
蔡俊立 committed
292 293 294 295 296
  }
}
</script>
<style scoped lang="scss">
@import "~@/styles/mixin.scss";
xiaomiao committed
297
@import "~@/styles/dialogBoxheader.scss";
298

任超 committed
299
.font-red {
蔡俊立 committed
300 301
  color: red
}
任超 committed
302 303 304

.middle-margin-bottom {
  margin-top: 20px
蔡俊立 committed
305
}
蔡俊立 committed
306
</style>