Browse Source

优化平衡系数表调整中

master
李磊 3 years ago
parent
commit
0e0216cbe4
  1. 16
      src/api/upload.js
  2. 12
      src/service/uploadService.js
  3. 45
      src/views/ysjl/3000/common/index.vue
  4. 15
      src/views/ysjl/3000/dj/common/phxsb.vue

16
src/api/upload.js

@ -0,0 +1,16 @@
import preview from '@/utils/preview'
export default {
/**
* 上传平衡系数Base64图片
* @param data
* @return {AxiosPromise}
*/
uploadPhxsBase64File(data) {
return preview({
url: '/upload/uploadPhxsBase64File',
method: 'post',
data
})
}
}

12
src/service/uploadService.js

@ -0,0 +1,12 @@
import upload from '@/api/upload'
export default {
/**
* 上传平衡系数Base64图片
* @param data
* @return {AxiosPromise}
*/
uploadPhxsBase64File(data) {
return upload.uploadPhxsBase64File(data)
}
}

45
src/views/ysjl/3000/common/index.vue

@ -666,7 +666,7 @@
<Table ref="table2" :tabel-header="arrayGroup[1].header" :table-data.sync="fubiao2" /> <Table ref="table2" :tabel-header="arrayGroup[1].header" :table-data.sync="fubiao2" />
</el-tab-pane> </el-tab-pane>
<el-tab-pane v-if="fromType === 1 || fromType === 3" label="附表3" name="six"> <el-tab-pane v-if="fromType === 1 || fromType === 3" label="附表3" name="six">
<phxsb ref="table3" :table-data.sync="fubiao3" :pic="pic" :ysjl-param.sync="param" /> <phxsb ref="table3" :table-data.sync="fubiao3" :ysjl-param.sync="param" @loadPhxsImage="loadPhxsImage" />
</el-tab-pane> </el-tab-pane>
</template> </template>
</el-tabs> </el-tabs>
@ -950,6 +950,13 @@ export default {
this.signNameValue(data) this.signNameValue(data)
}, },
saveYsjl(operation) { saveYsjl(operation) {
if (operation !== 'add' && this.pic) {
this.uploadPhxsBase64File(operation)
} else {
this.buildSaveData(operation)
}
},
buildSaveData(operation) {
const tableData = [] const tableData = []
let fubiao let fubiao
if (this.fromType === 5) { if (this.fromType === 5) {
@ -975,20 +982,14 @@ export default {
this.save(operation, 'post', tableData, fubiao) this.save(operation, 'post', tableData, fubiao)
} else if (operation === 'build') { } else if (operation === 'build') {
this.ysjl.baogaobianhao = this.ysjl.jilubianhao this.ysjl.baogaobianhao = this.ysjl.jilubianhao
if ( if (this.ysjl.jilubianhao && this.ysjl.jilubianhao.indexOf('COPY') > -1) {
this.ysjl.jilubianhao &&
this.ysjl.jilubianhao.indexOf('COPY') > -1
) {
this.$message({ this.$message({
type: 'error', type: 'error',
message: '请先修改报告编号,不允许携带COPY标志生成报告!' message: '请先修改报告编号,不允许携带COPY标志生成报告!'
}) })
return false return false
} }
if ( if (this.ysjl.jianyanrenyuan === null || this.ysjl.jianyanrenyuan === '') {
this.ysjl.jianyanrenyuan === null ||
this.ysjl.jianyanrenyuan === ''
) {
this.$message({ this.$message({
type: 'error', type: 'error',
message: '请先签名再生成报告!' message: '请先签名再生成报告!'
@ -997,9 +998,7 @@ export default {
} }
for (let i = 0; i < this.bgfyData.length; i++) { for (let i = 0; i < this.bgfyData.length; i++) {
if (!this.bgfyData[i].jianjianyuan || !this.bgfyData[i].querenriqi) { if (!this.bgfyData[i].jianjianyuan || !this.bgfyData[i].querenriqi) {
this.$message.error( this.$message.error('请将检验项目中的监检人员及监检日期填写完毕,再生成报告!')
'请将检验项目中的监检人员及监检日期填写完毕,再生成报告!'
)
return false return false
} }
} }
@ -1008,7 +1007,6 @@ export default {
this.save(operation, 'put', tableData, fubiao) this.save(operation, 'put', tableData, fubiao)
} }
}, },
save(operation, type, jyxm, fubiao) { save(operation, type, jyxm, fubiao) {
if (this.fromType !== 5) this.ysjl.imagePath = this.$refs.table1.imgPath if (this.fromType !== 5) this.ysjl.imagePath = this.$refs.table1.imgPath
@ -1043,6 +1041,7 @@ export default {
this.ysjl.id = data this.ysjl.id = data
this.param.ysjlId = data this.param.ysjlId = data
this.$message({ message: '保存成功', type: 'success' }) this.$message({ message: '保存成功', type: 'success' })
this.uploadPhxsBase64File()
// //
this.common.reloadViewToUpdateYsjl(this.ysjl) this.common.reloadViewToUpdateYsjl(this.ysjl)
} else if (operation === 'upd') { } else if (operation === 'upd') {
@ -1070,6 +1069,23 @@ export default {
} }
}, },
/**
* 上传平衡系数表
*/
uploadPhxsBase64File(operation) {
if (!this.pic) {
return false
}
this.uploadService.uploadPhxsBase64File({
ysjlId: this.ysjl.id,
base64File: this.pic
}).then(() => {
if (operation !== 'add') {
this.buildSaveData(operation)
}
})
},
/** /**
* 格式化监检员 * 格式化监检员
*/ */
@ -1175,6 +1191,9 @@ export default {
}, },
querySearchGzjz: function(queryString, cb, $index) { querySearchGzjz: function(queryString, cb, $index) {
cb([this.dicGzjz[$index]]) cb([this.dicGzjz[$index]])
},
loadPhxsImage(data) {
this.pic = data
} }
} }
} }

15
src/views/ysjl/3000/dj/common/phxsb.vue

@ -56,10 +56,6 @@ export default {
type: Array, type: Array,
required: true required: true
}, },
pic: {
type: String,
required: true
},
ysjlParam: { ysjlParam: {
type: Object, type: Object,
required: true required: true
@ -86,7 +82,6 @@ export default {
chart: undefined, chart: undefined,
phxsX: [], phxsX: [],
phxsY: [], phxsY: [],
imgPath: '',
xAxis: ['30', '40', '45', '50', '60'], xAxis: ['30', '40', '45', '50', '60'],
chartDataX: [], chartDataX: [],
chartDataY: [] chartDataY: []
@ -216,10 +211,12 @@ export default {
] ]
} }
this.chart.setOption(option) this.chart.setOption(option)
this.imgPath = this.chart.getDataURL({ this.chart.on('finished', () => {
type: 'png', this.$emit('loadPhxsImage', this.chart.getDataURL({
pixelRatio: 1, type: 'png',
backgroundColor: '#fff' pixelRatio: 1,
backgroundColor: '#fff'
}))
}) })
} }
} }

Loading…
Cancel
Save