diff --git a/src/views/bjd/dj_input.vue b/src/views/bjd/dj_input.vue index 1627a98..f6ab2e9 100644 --- a/src/views/bjd/dj_input.vue +++ b/src/views/bjd/dj_input.vue @@ -239,9 +239,10 @@ > @@ -288,8 +289,8 @@ > @@ -309,16 +310,16 @@ > - + -
- + + + + + + + + + + + + + + + + + + @@ -1541,7 +1592,8 @@ export default { fixedWidth: '', isShengju: true, form: this.$route.params.form, - areaList: [] + areaList: [], + quhuadaimas: [] } }, watch: { @@ -1556,19 +1608,21 @@ export default { if (this.formState === 'newBuild') { this.isShengju = false this.tableData = [] - this.$set(this.bjd, 'shouliriqi', new Date()) - this.$set(this.bjd, 'baojianriqi', new Date()) - this.getSblb() + const date = this.formatter.dateFormat('YYYY-MM-dd') + this.$set(this.bjd, 'shouliriqi', date) + this.$set(this.bjd, 'baojianriqi', date) } else if (this.formState === 'update' || this.formState === 'finish') { // 查询报检信息 this.getBjdInfo() + // 查询报检参数信息 + this.getParamById() } else if (this.formState === 'create') { // 直接起草过来的数据 - this.getSblb() // 先加载当前的数据 // this.tableData = this.$route.query.params this.getParamList(this.$route.query.params, true) } + this.getSblb() if (this.sbzldm === 'F000') { this.templateName = '安全阀报检导入模板.xlsx' } @@ -1583,7 +1637,7 @@ export default { methods: { getArea() { this.api({ - url: '/area/getAll', + url: '/area/all', method: 'get', params: {} }).then(res => { @@ -1605,10 +1659,12 @@ export default { // ***第一次起草 if (init) { this.bjd = this.tableData[0] // 将第一条数据给报检单基本信息赋值 - this.$set(this.bjd, 'shouliriqi', new Date()) - this.$set(this.bjd, 'baojianriqi', new Date()) + const date = this.formatter.dateFormat('YYYY-MM-dd') + this.$set(this.bjd, 'shouliriqi', date) + this.$set(this.bjd, 'baojianriqi', date) this.bjd.lingqufangshi = '自取' } + this.loadQuhua() if (this.bjd.shebeizhongleidaima === '3000') { this.$set(this.bjd, 'baojiandianhua', this.bjd.weibaodanweiDianhua) } @@ -1622,33 +1678,38 @@ export default { }, getBjdInfo() { this.apibjd({ - url: '/bjd/getBjdById', + url: '/bjd', method: 'get', params: { bjdId: this.$route.params.id } }).then((data) => { this.bjd = data - if ( - this.bjd.baojiandianhua === undefined || - this.bjd.baojiandianhua === null - ) { + if (!this.bjd.baojiandianhua) { this.bjd.baojiandianhua = this.bjd.weibaodanweiDianhua } - this.getSblb() - // 查询报检参数信息 - this.getParamById() + this.loadQuhua() }) }, + loadQuhua() { + if (!this.bjd || !this.bjd.quhuadaima) { + return + } + + const qhdm = this.bjd.quhuadaima + this.quhuadaimas = [qhdm.substr(0, 2).padEnd(6, '0'), qhdm.substr(0, 4).padEnd(6, '0'), qhdm] + console.log(this.quhuadaimas) + }, getParamById() { this.apibjd({ url: '/renwu/getParamByBjdId', method: 'get', params: { - bjdId: this.bjd.id + bjdId: this.$route.params.id } }).then((data) => { this.tableData = data + this.$refs.bjBaseList.doLayout() for (const tableObj of this.tableData) { const sblbpz = [] // 如果设备类别代码不存在,或者设备类别代码是设备种类代码时 @@ -1842,8 +1903,9 @@ export default { } }, quhuaChange(val) { - const arr = this.$refs['editCascader'].getCheckedNodes()[0].pathLabels - this.bjd.quhuamingcheng = arr.toString() + const data = this.$refs.editCascader.getCheckedNodes()[0].data + this.bjd.quhuamingcheng = data.label + this.bjd.quhuadaima = data.value }, tableRowClassName({ row, rowIndex }) { row.index = rowIndex @@ -2126,7 +2188,6 @@ export default { this.selection[i].sblbpz = sblbpz } } - this.tableData.push() this.dialogFormParam = false }, delRow: function() { @@ -2202,26 +2263,8 @@ export default { } }) }, - formTime(v) { - const date = new Date(v) - const y = date.getFullYear() - let m = date.getMonth() + 1 - m = m < 10 ? '0' + m : m - let d = date.getDate() - d = d < 10 ? '0' + d : d - const h = date.getHours() - let minute = date.getMinutes() - minute = minute < 10 ? '0' + minute : minute - const seconds = - date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds() - const time = - y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + seconds - return time - }, // 报检单保存 bjdSave(audit) { - this.bjd.baojianriqi = this.formTime(this.bjd.baojianriqi) - this.bjd.shouliriqi = this.formTime(this.bjd.shouliriqi) this.$refs['bjd'].validate((valid) => { if (valid) { if (this.judgeNull(this.bjd.quhuadaima)) { @@ -2231,7 +2274,7 @@ export default { }) return false } - if (this.tableData === null || this.tableData.length === 0) { + if (this.tableData.length === 0) { this.$message({ type: 'error', message: '报检设备不能为空!' @@ -2350,12 +2393,15 @@ export default { } }) } else { - this.tableData = data.tableData - for (const tableObj of this.tableData) { - const sblbpz = [] - sblbpz.push(tableObj.shebeileibiedaima) - sblbpz.push(tableObj.shebeipinzhongdaima) - this.$set(tableObj, 'sblbpz', sblbpz) + if (data && data.renwus.length) { + this.tableData = data.renwus + this.$refs.bjBaseList.doLayout() + for (const tableObj of this.tableData) { + const sblbpz = [] + sblbpz.push(tableObj.shebeileibiedaima) + sblbpz.push(tableObj.shebeipinzhongdaima) + this.$set(tableObj, 'sblbpz', sblbpz) + } } if ( this.formState === 'create' || diff --git a/src/views/bjd/dj_list.vue b/src/views/bjd/dj_list.vue index acd40ce..b2cf9a2 100644 --- a/src/views/bjd/dj_list.vue +++ b/src/views/bjd/dj_list.vue @@ -86,7 +86,7 @@        受理科室: - + 本科室 @@ -96,7 +96,7 @@        受理人员: - + 只看自己 @@ -116,7 +116,6 @@ border fit highlight-current-row - :row-class-name="laiwuRowClass" stripe @row-click="onRowClick" @selection-change="handleSelectionChange" @@ -157,7 +156,7 @@ - +