You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

701 lines
27 KiB

4 years ago
<!--工业锅炉内部检验-->
<template>
<div class="app-container">
<sticky style="margin-bottom: 10px;">
<div class="sub-navbar">
<el-button v-if="state === 'create'" type="success" icon="el-icon-edit" size="medium" @click="saveYsjl('add')">
保存
</el-button>
<el-button v-if="state === 'update'" type="primary" icon="el-icon-edit" size="medium" @click="saveYsjl('upd')">
更新
</el-button>
<el-button v-if="state === 'update'" type="success" icon="el-icon-upload2" size="medium" @click="saveYsjl('build')">
生成报告
</el-button>
<el-button v-if="state !== 'create'" type="warning" icon="el-icon-view" size="medium" @click="common.viewYsjl(ysjl.id, 'YSJL', false)">
预览
</el-button>
</div>
</sticky>
<el-tabs v-model="checkedTab" type="card">
<el-tab-pane label="基本信息" name="first">
<el-form ref="ysjl" :model="ysjl" class="el-form" label-position="right" label-width="130px">
<fieldset>
<legend>基本信息</legend>
<el-row :gutter="25">
<el-col v-if="state === 'create' || ysjl.jilubianhao === null || ysjl.jilubianhao === ''" :span="14">
<el-form-item label="记录编号">
<el-input v-model="jlbh1" style="width:80px" disabled />
<el-input v-model="jlbh2" style="width:80px" disabled />
<el-input v-model="jlbh3" style="width:80px" disabled />-
<el-input v-model="jlbh4" style="width:85px" @blur="judgeRepeat(jlbh1 + jlbh2 + jlbh3 + '-' + jlbh4 , ysjl.id)" />
</el-form-item>
</el-col>
<el-col v-else :span="9">
<el-form-item label="记录编号" prop="jilubianhao">
<el-input v-if="state !== 'create'" v-model="ysjl.jilubianhao" :disabled="edit" />
</el-form-item>
</el-col>
<el-col v-if="isRepeat" :span="2" style="vertical-align: middle;padding-top: 3px;font-size: 15px;">
<span style="color:red">编号重复</span>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="18">
<el-form-item label="使用单位(产权单位)" prop="shiyongdanwei" label-width="160px">
<el-input v-model="ysjl.shiyongdanwei" :disabled="edit" type="text" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="18">
<el-form-item label="设备使用地点" prop="anzhuangdidian">
<el-input v-model="ysjl.anzhuangdidian" :disabled="edit" type="text" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="9">
<el-form-item label="设备代码" prop="shebeidaima">
<el-input v-model="ysjl.shebeidaima" :disabled="edit" />
</el-form-item>
</el-col>
<el-col :span="9">
<el-form-item label="注册代码" prop="zhucedaima">
<el-input v-model="ysjl.zhucedaima" :disabled="edit" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="9">
<el-form-item label="使用登记证编号" prop="shiyongdengjibianhao">
<el-input v-model="ysjl.shiyongdengjibianhao" :disabled="edit" />
</el-form-item>
</el-col>
<el-col :span="9">
<el-form-item label="单位邮编" prop="shiyongdanweiYoubian">
<el-input v-model="ysjl.shiyongdanweiYoubian" :disabled="edit" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="9">
<el-form-item label="联系人" prop="shiyongdanweiLianxiren">
<el-input v-model="ysjl.shiyongdanweiLianxiren" :disabled="edit" />
</el-form-item>
</el-col>
<el-col :span="9">
<el-form-item label="电话" prop="shiyongdanweiDianhua">
<el-input v-model="ysjl.shiyongdanweiDianhua" :disabled="edit" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="9">
<el-form-item label="使用编号" prop="danweineibubianhao">
<el-input v-model="ysjl.danweineibubianhao" :disabled="edit" />
</el-form-item>
</el-col>
<el-col :span="9">
<el-form-item label="锅炉型号" prop="guigexinghao">
<el-input v-model="ysjl.guigexinghao" :disabled="edit" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="18">
<el-form-item label="制造单位" prop="zhizaodanwei">
<el-input v-model="ysjl.zhizaodanwei" :disabled="edit" type="text" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="9">
<el-form-item label="制造日期" prop="zhizaoriqi">
<el-date-picker v-model="ysjl.zhizaoriqi" type="date" value-format="yyyy-MM-dd" placeholder="选择日期" style="width: 100%;" />
</el-form-item>
</el-col>
<el-col :span="9">
<el-form-item label="投用日期" prop="touyongriqi">
<el-date-picker v-model="ysjl.touyongriqi" type="date" value-format="yyyy-MM-dd" placeholder="选择日期" style="width: 100%;" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="9">
<el-form-item label="产品编号" prop="chanpinbianhao">
<el-input v-model="ysjl.chanpinbianhao" :disabled="edit" />
</el-form-item>
</el-col>
<el-col :span="9">
<el-form-item label="上次检验日期" prop="shangcijianyanriqi">
<el-date-picker v-model="param.shangcijianyanriqi" type="date" value-format="yyyy-MM-dd" placeholder="选择日期" style="width: 100%;" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="18">
<el-form-item label="安装单位" prop="shigongdanwei">
<el-input v-model="ysjl.shigongdanwei" :disabled="edit" />
</el-form-item>
</el-col>
</el-row>
</fieldset>
<fieldset>
<legend>性能参数</legend>
<el-row :gutter="20">
<el-col :span="9">
<el-form-item label="额定蒸发量(热功率)" prop="edingzhengfaliang">
<el-input v-model="param.edingzhengfaliang" />
4 years ago
</el-form-item>
</el-col>
<el-col :span="9">
<el-form-item label="额定压力" prop="edingyali">
<el-input v-model="param.edingyali">
<template slot="append">
MPa
</template>
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="9">
<el-form-item label="出口温度" prop="chukouwendu">
<el-input v-model="param.chukouwendu">
<template slot="append">
</template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="9">
<el-form-item label="使用压力" prop="gongzuoyali">
<el-input v-model="param.gongzuoyali">
<template slot="append">
MPa
</template>
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="9">
<el-form-item label="额定温度" prop="edingwendu">
<el-input v-model="param.edingwendu">
<template slot="append">
</template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="9">
<el-form-item label="回流温度" prop="huiliuwendu">
<el-input v-model="param.huiliuwendu">
<template slot="append">
</template>
</el-input>
</el-form-item>
</el-col>
</el-row>
</fieldset>
<fieldset>
<legend>允许使用参数</legend>
<el-row :gutter="20">
<el-col :span="9">
<el-form-item label="压力" prop="yali">
<el-input v-model="param.yali">
<template slot="append">
MPa
</template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="9">
<el-form-item label="温度" prop="wendu">
<el-input v-model="param.wendu">
<template slot="append">
</template>
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="9">
<el-form-item label="介质" prop="jiezhi">
<el-select v-model="param.jiezhi" filterable allow-create default-first-option placeholder="请选择" style="width:232px">
<el-option label="水" value="水" />
<el-option label="有机热载体" value="有机热载体" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="9">
<el-form-item label="其他" prop="qita">
<el-input v-model="param.qita" />
</el-form-item>
</el-col>
</el-row>
</fieldset>
<fieldset>
<legend>检查与校验</legend>
<el-row :gutter="20">
<el-col :span="18">
<el-form-item label="检验依据" prop="jianyanyiju">
<el-input v-model="ysjl.jianyanyiju" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" style="height: 110px;">
<el-col :span="18">
<el-form-item label="缺陷及其处理:" prop="wentijizai">
<el-input v-model="param.wentijizai" :rows="4" :disabled="edit" type="textarea" palceholder="检验发现的缺陷位置、性质、程度及处理意见(必要时附图)" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="10">
<el-col :span="9">
<el-form-item label="检验人员" prop="jianyanrenyuan">
<el-input v-model="jianyanrenyuan" disabled />
<el-input v-show="false" v-model="ysjl.jianyanrenyuan" />
</el-form-item>
</el-col>
<el-col :span="9">
<sign-name :jianyanrenyuan="jianyanrenyuan" :ysjl="ysjl" @setSignValue="singNameValue" />
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="9">
<el-form-item label="检验日期" prop="jianyanjieshuriqi">
<el-date-picker v-model="ysjl.jianyanjieshuriqi" type="date" value-format="yyyy-MM-dd" placeholder="选择日期" style="width: 100%;" @change="getXcjyrq" />
</el-form-item>
</el-col>
<el-col :span="9">
<el-form-item label="检验结论" prop="jianyanjielun">
<el-select v-model="ysjl.jianyanjielun" :disabled="edit" type="text" placeholder="请选择" style="width:232px">
<el-option label="符合要求" value="符合要求" />
<el-option label="基本符合要求" value="基本符合要求" />
<el-option label="不符合要求" value="不符合要求" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="9">
<el-form-item label="下次检验日期" prop="xiacijianyanriqi">
<el-input v-if="ysjl.jianyanjielun === '不符合要求'" v-model="ysjl.xiacijianyanriqishuoming" type="text" disabled="true" />
<el-date-picker v-else v-model="ysjl.xiacijianyanriqi" type="date" placeholder="选择日期" editable style="width: 100%;" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" style="height: 110px;">
<el-col :span="18">
<el-form-item label="其它缺陷情况或说明:" prop="beizhu">
4 years ago
<el-input v-model="ysjl.beizhu" :rows="4" :disabled="edit" type="textarea" />
</el-form-item>
</el-col>
</el-row>
</fieldset>
</el-form>
</el-tab-pane>
<el-tab-pane label="检查项目" name="second">
<el-table ref="sybjSData" :data="sybjSData" :span-method="tableJs.mergeColRows" border stripe style="width:90%">
<el-table-column align="center" label="检验项目">
<el-table-column align="center" prop="jianyanxiang" width="100" />
<el-table-column align="center" prop="jianyanmu" width="100" />
<el-table-column align="left" prop="jianyanneirong" />
4 years ago
</el-table-column>
<el-table-column align="center" prop="D1" label="检验结果">
4 years ago
<template slot-scope="scope">
<el-select v-model="scope.row.D1" :disabled="edit" type="text" placeholder="请选择" style="width: 100%;" filterable allow-create default-first-option>
4 years ago
<el-option label="√" value="√" />
<el-option label="○" value="○" />
<el-option label="×" value="×" />
<el-option label="/" value="/" />
</el-select>
</template>
</el-table-column>
</el-table>
<br>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
import Sticky from '@/components/Sticky'
import SignName from '@/views/common/SignName'
import Utils from '@/utils/contact'
import merge from 'webpack-merge'
export default {
name: 'GlGywbYsjl',
components: { SignName, Sticky },
4 years ago
data() {
return {
jlbh1: 'GW(',
jlbh2: new Date().getFullYear(),
jlbh3: ')',
jlbh4: '',
ysjl: (this.$route.query.ysjl === null || this.$route.query.ysjl === undefined) ? {} : this.$route.query.ysjl,
defaultParam: {},
param: (this.$route.query.param === null || this.$route.query.param === undefined) ? Object.assign({}, this.defaultParam) : this.$route.query.param,
state: this.$route.query.state,
jianyanrenyuan: '',
departmentId: this.$store.getters.departmentId,
isRepeat: false,
edit: false,
sybjSData: [],
tableData: [],
users: [],
checkedTab: 'first',
ysjlId: this.$route.query.id,
// 表格合并相关
// 参与列合并的字段,在这里增加即可
cols: [
{
name: 'jianyanxiang', // 参与计算的列名,必须和el-table-column prop=''值一致
getValue(row) { // 该列用于比较的值的获取方法
return row.jianyanxiang
}
},
{
name: 'jianyanmu', // 参与计算的列名,必须和el-table-column prop=''值一致
getValue(row) { // 该列用于比较的值的获取方法
return row.jianyanmu
}
}
],
rows: [
{
name: 'jianyanxiang', // 参与计算的列名,必须和el-table-column prop=''值一致
getValue(row) { // 该列用于比较的值的获取方法
return row.jianyanxiang
}
},
{
name: 'jianyanmu', // 参与计算的列名,必须和el-table-column prop=''值一致
getValue(row) { // 该列用于比较的值的获取方法
return row.jianyanmu
}
}
]
4 years ago
}
},
computed: {
jilubianhao: function() {
let bianhao
if (this.ysjl.jilubianhao === null || this.ysjl.jilubianhao === undefined || this.ysjl.jilubianhao === '') {
return this.jlbh1 + this.jlbh2 + this.jlbh3 + '-' + this.jlbh4
} else {
bianhao = this.ysjl.jilubianhao
}
return this.judgeRepeat(bianhao, this.ysjl.id)
}
},
watch: {
jlbh4: function(val) {
this.ysjl.jilubianhao = this.jlbh1 + this.jlbh2 + this.jlbh3 + '-' + val
this.judgeRepeat(this.ysjl.jilubianhao, this.ysjl.id)
},
jilubianhao: function(newValue) {
this.judgeRepeat(newValue, this.ysjl.id)
}
},
// 添加F5刷新监听事件
mounted() {
window.addEventListener('beforeunload', this.beforeunloadHandler, false)
},
created() {
if (this.state === 'create') {
this.initYsjl()
this.getMaxBh()
this.getJyxm(1)
} else {
this.getYsjl(this.$route.query.id)
this.getJyxm(1)
4 years ago
}
this.getUserList()
},
beforeDestroy() {
window.removeEventListener('beforeunload', this.beforeunloadHandler, false)
},
methods: {
// 签名方法
singNameValue(data) {
this.jianyanrenyuan = data.name
this.ysjl.jianyanrenyuan = data.id
if (this.state !== 'create') {
this.common.signName(this.ysjl.id, this.ysjl.jianyanrenyuan)
Utils.$emit('ysjl-list')
}
},
initYsjl() {
this.api({
url: '/ysjl/initYsjl',
method: 'post',
data: {
templateId: this.$route.query.templateId,
4 years ago
renwuId: this.$route.query.renwuId,
neibuleibie: this.$route.query.neibuleibie,
sblbdm: this.$route.query.sblbdm,
sblbmc: this.$route.query.sblbmc,
sbpzdm: this.$route.query.sbpzdm,
sbpzmc: this.$route.query.sbpzmc
}
}).then(data => {
this.ysjl = data.ysjl
this.param = (data.param !== null && data.param !== undefined) ? data.param : {}
this.getXcjyrq()
this.ysjl.jilubianhao = this.jilubianhao
this.ysjl.baogaobianhao = null // 避免从设备中取值导致信息错误
this.ysjl.jianyanjielun = '符合要求'
this.ysjl.jigouhezhunzhenghao = process.env.VUE_APP_HZZBH
this.ysjl.beizhu = '/'
this.ysjl.xiacijianyanriqishuoming = '/'
this.ysjl.anzhuangdidian = this.ysjl.shiyongdanweiDizhi
this.$set(this.param, 'qita', '/')
if (this.$route.query.sblbdm === '1100') {
this.$set(this.param, 'edinggonglv', 't/h')
} else {
this.$set(this.param, 'edinggonglv', 'MW')
}
// 制造日期、投用日期、上次检验日期设置成正确的日期格式
this.ysjl.zhizaoriqi = this.common.checkDateFormat(this.ysjl.zhizaoriqi)
this.ysjl.touyongriqi = this.common.checkDateFormat(this.ysjl.touyongriqi)
this.param.shangcijianyanriqi = this.common.checkDateFormat(this.param.shangcijianyanriqi)
})
},
getYsjl(id) {
this.api({
url: '/ysjl/getYsjlById',
method: 'get',
params: {
ysjlId: id
}
}).then(data => {
this.ysjl = data.ysjl
if (this.ysjl.jianyanrenyuan !== null && this.ysjl.jianyanrenyuan.length > 0) {
this.jianyanrenyuan = this.common.convertCnName(this.ysjl.jianyanrenyuan)
}
// 查询最大记录编号
if (this.ysjl.jilubianhao === null || this.ysjl.jilubianhao === undefined || this.ysjl.jilubianhao === '') {
this.getMaxBh()
}
this.getParam(this.ysjl.id, this.ysjl.shebeizhongleidaima)
})
},
getParam(ysjlId, sbzldm) {
this.api({
url: '/ysjl/getParamByYsjlId',
method: 'get',
params: {
ysjlId: ysjlId,
sbzldm: sbzldm
}
}).then(data => {
this.param = data
})
},
// 查询最大记录编号
getMaxBh() {
const aheadPart = this.jlbh1 + '' + this.jlbh2 + '' + this.jlbh3
this.api({
url: '/ysjl/gainCurrentBh',
method: 'get',
params: {
aheadPart: aheadPart + '-',
hinderPart: ''
}
}).then(data => {
this.jlbh4 = data
})
},
// 查询检验项目
getJyxm(sort) {
let url = ''
let data = {}
if (this.state === 'create') {
url = '/jyxm/getCyJyxm'
data = {
templateId: this.$route.query.templateId,
order: sort
}
} else {
url = '/jyxm/getCyJyxmByYsjl'
data = {
ysjlId: this.ysjlId,
isReport: false,
templateId: this.$route.query.templateId,
4 years ago
order: sort
}
}
this.api({
url: url,
method: 'get',
params: data
}).then(data => {
if (this.state === 'create') {
data.forEach(row => {
this.sybjSData.push({
id: row.id,
jianyanxiang: row.jianyanxiang,
jianyanmu: row.jianyanmu,
jianyanneirong: row.jianyanneirong,
D1: row.jianyanjieguo
})
})
} else {
data.forEach(row => {
this.sybjSData.push({
id: row.id,
jianyanxiang: row.jianyanxiang,
jianyanmu: row.jianyanmu,
jianyanneirong: row.jianyanneirong,
D1: row.d1
})
})
4 years ago
}
this.tableJs.getData(this.cols, this.rows, this.sybjSData)
4 years ago
})
},
getUserList() {
this.api({
4 years ago
url: '/user/all',
4 years ago
method: 'get'
}).then(data => {
this.users = data
})
},
saveYsjl: function(operation) {
if (operation === 'add') {
if (this.jlbh4.trim() === '') {
this.$message({ message: '请先确认记录编号是否完整!', type: 'warning' })
return false
}
}
// 把第一个检验项目表中的检验结果单独放到字段中
this.tableData = []
this.tableData.push(this.sybjSData.map(row => {
return {
id: row.id,
D1: row.D1
}
}))
4 years ago
let type = ''
4 years ago
this.ysjl.bglx = 1
this.ysjl.cjState = 'ysjl'
this.ysjl.zfState = '0'
this.ysjl.jianyanxiangmu = 'gywb'
this.ysjl.jlprintState = 0
if (this.ysjl.jianyanjielun === '不符合要求') {
this.ysjl.xiacijianyanriqi = null
}
if (operation === 'add') {
this.ysjl.jilubianhao = this.jlbh1 + this.jlbh2 + this.jlbh3 + '-' + this.jlbh4
4 years ago
type = 'post'
4 years ago
} else if (operation === 'build') {
if (this.ysjl.jianyanrenyuan === null || this.ysjl.jianyanrenyuan === '') {
this.$message({
type: 'error',
message: '请先签名再生成报告!'
})
return false
}
if (this.ysjl.sfdId === null || this.ysjl.sfdId === '') {
this.$message({
type: 'error',
message: '请先追加或者创建收费单后在尝试!'
})
return false
}
4 years ago
url = 'put'
4 years ago
} else if (operation === 'upd') {
4 years ago
url = 'put'
4 years ago
}
if (this.isRepeat) {
this.$message({ message: '记录编号重复,请先修改记录编号再保存', type: 'error' })
return false
} else {
this.$refs['ysjl'].validate(valid => {
if (valid) {
const jyxm = JSON.stringify(this.tableData)
this.api({
4 years ago
url: '/ysjl',
method: type,
4 years ago
data: {
ysjl: this.ysjl,
param: this.param,
jyxm: jyxm,
bgjyxm: jyxm,
flag: operation
}
}).then(data => {
Utils.$emit('task-list')
Utils.$emit('ysjl-list')
if (operation === 'add' && data !== '') {
this.$message({ message: '保存成功, 请前往待办记录中查看。', type: 'success' })
this.ysjl.id = data
this.param.ysjlId = data
// 修改16版任务状态
this.common.updStateByNew(this.ysjl.renwuId, '2', false)
// 刷新路由网址
this.$store.dispatch('delCurrentViews', {
view: this.$route,
$router: this.$router
})
// this.$router.push({
// path: '/ysjl/1000/wb/gywb' + '/' + this.ysjl.id,
// query: { state: 'update', id: this.ysjl.id, departmentId: this.ysjl.departmentId, jianyanrenyuan: this.ysjl.jianyanrenyuan }
// })
} else if (operation === 'upd') {
this.$message({ message: '更新成功', type: 'success' })
// 替换路由中的参数
this.$router.push({
query: merge(this.$route.query, { 'jianyanrenyuan': this.ysjl.jianyanrenyuan })
})
// this.$refs.bill.updateChargeBill()
} else {
Utils.$emit('ysjl-list')
Utils.$emit('ysjl-yb-list')
Utils.$emit('bggl-daiban-list')
this.$message({ message: '生成报告成功', type: 'success' })
this.$store.dispatch('delCurrentViews', {
view: this.$route,
$router: this.$router
})
}
this.state = 'update'
})
}
})
}
},
judgeRepeat(bianhao, id) {
this.api({
url: '/ysjl/judgeRepeat',
method: 'get',
params: {
ysjlId: id,
bianhao: bianhao
}
}).then(data => {
if (data > 0) {
this.isRepeat = true
} else {
this.isRepeat = false
}
})
},
getXcjyrq() {
var dateTemp = this.ysjl.jianyanjieshuriqi.split('-')
const xcjyrq = new Date((Number(dateTemp[0]) + 1) + '-' + dateTemp[1] + '-' + dateTemp[2])
this.ysjl.xiacijianyanriqi = xcjyrq.setDate(xcjyrq.getDate() - 1)
},
// F5刷新监听
beforeunloadHandler(e) {
e.returnValue = ''
}
}
}
</script>