Blame view

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

任超 committed
284
.font-red {
蔡俊立 committed
285 286
  color: red
}
任超 committed
287 288 289

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