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.
 
 
 
 

1067 lines
40 KiB

<template>
<div class="app-container">
<sticky v-if="formState !== 'finish'" style="margin-bottom: 10px;">
<div v-show="hasPerm('manufactInspection:update')" class="sub-navbar">
<el-button v-if="formState === 'newBuild'" type="success" icon="el-icon-edit" size="medium" @click="bjdSave(false)">
保存并核价
</el-button>
<div v-else>
<el-button type="success" icon="el-icon-edit" size="medium" @click="bjdSave(false)">
更新数据
</el-button>
<el-button v-if="examine || hasRole('GLQYD')" type="warning" icon="el-icon-circle-check-outline" size="medium" @click="bjdSave(true)">
审核通过
</el-button>
<el-button v-show="sbzldm === '1000'" type="warning" icon="el-icon-circle-check-outline" size="medium" @click="viewSfbz">
查看收费标准
</el-button>
</div>
</div>
</sticky>
<el-tabs v-model="checkedTab" type="border-card">
<el-tab-pane label="检验项目申请表" name="first">
<el-form ref="bjd" :model="bjd" label-position="right" label-width="120px">
<fieldset>
<legend>设备种类</legend>
<el-row :gutter="20">
<el-col :span="9">
<el-form-item label="检验类别:" prop="jianyanleibie">
<el-input v-model="jianyanliebie" type="text" disabled />
</el-form-item>
</el-col>
<el-col :span="9">
<el-form-item label="设备种类:" prop="shebeizhonglei">
<el-input v-model="bjd.shebeizhonglei" disabled />
</el-form-item>
</el-col>
</el-row>
</fieldset>
<fieldset>
<legend>基本信息</legend>
<el-row v-if="isChaoqi" :gutter="20" style="margin: 10px auto;">
<el-col :span="19">
<el-alert title="当前单位证书有效日期已超期!" type="warning" :closable="false" />
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="20">
<el-form-item label="制造单位:" prop="zzdwId">
<el-input v-if="bjd.shebeizhongleidaima === '7000'" v-model="bjd.zhizaodanwei" :rules="[{ required: true, message: '请选择制造单位', trigger: 'change' }]" />
<el-select v-else v-model="bjd.zzdwId" :rules="[{ required: true, message: '请选择制造单位', trigger: 'change' }]" placeholder="请选择" filterable style="width: 623px" @change="zzdwChange">
<el-option v-for="item in zzdwList" :key="item.zhizaodanwei" :label="item.zhizaodanwei" :value="item.id" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="9">
<el-form-item label="联系人:" prop="zhizaodanweiLianxiren">
<el-input v-model="bjd.zhizaodanweiLianxiren" type="text" />
</el-form-item>
</el-col>
<el-col :span="9">
<el-form-item label="联系电话:" prop="zhizaodanweiDianhua">
<el-input v-model="bjd.zhizaodanweiDianhua" type="text" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="9">
<el-form-item :rules="[{ required: true, message: '受理日期不能为空', trigger: 'change'}]" label="受理日期:" prop="shouliriqi">
<el-date-picker v-model="bjd.shouliriqi" type="date" value-format="yyyy-MM-dd" placeholder="选择日期" style="width: 95%;" />
</el-form-item>
</el-col>
</el-row>
</fieldset>
</el-form>
</el-tab-pane>
<el-tab-pane label="申请检验设备明细表" name="second">
<template v-if="formState !== 'finish'">
<el-button type="success" size="mini" icon="el-icon-edit" @click="openDialogParam()">
批量修改
</el-button>
<el-button type="success" size="mini" icon="el-icon-circle-plus-outline" @click="addRow">
添加
</el-button>
<el-button type="danger" size="mini" icon="el-icon-remove-outline" @click="delRow()">
删除
</el-button>
<!-- <template v-if="sbzldm === '1000' || sbzldm === '2000'">
<el-button type="success" icon="el-icon-download" size="mini" @click="common.downloadTemplate(templateName)">
下载导入模板
</el-button>
<el-upload
:show-file-list="false"
:http-request="uploadExcel"
style="display: inline-flex"
action=""
>
<el-button type="primary" size="mini" icon="el-icon-upload">
导入数据
</el-button>
</el-upload>
</template>-->
<span style="margin-left: 20px;color: red;font-size: 13px;">如若【设备类别】相同,只编辑填写第一条即可!</span>
</template>
<el-switch v-model="fixedFlag" active-color="#13ce66" inactive-color="#ff4949" @change="editFixedHidden()" />
<el-table
ref="bjBaseList"
:data="tableData"
:row-class-name="tableRowClassName"
fit
highlight-current-row
border
stripe
style="width:100%;margin-top: 5px;"
@row-click="onRowClick"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="40" />
<el-table-column align="center" type="index" width="50" label="序号" />
<template v-if="sbzldm === '1000'">
<el-table-column align="center" prop="shebeileibiedaima" width="220" label="设备类别">
<template slot-scope="scope">
<el-select v-model="scope.row.shebeileibiedaima" filterable allow-create default-first-option @change="changeSblb(scope.$index)">
<el-option v-for="item in sblbList" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</template>
</el-table-column>
<el-table-column align="center" prop="guigexinghao" width="220" label="锅炉型号">
<template slot-scope="scope">
<el-select v-model="scope.row.guigexinghao" filterable allow-create default-first-option>
<el-option v-for="item in xinghaoList" :key="item.id" :label="item.xinghao" :value="item.xinghao" />
</el-select>
</template>
</el-table-column>
<el-table-column align="center" prop="shebeidaima" width="220" label="设备代码">
<template slot-scope="scope">
<el-input v-model="scope.row.shebeidaima" />
</template>
</el-table-column>
<el-table-column align="center" prop="chanpinbianhao" width="220" label="产品编号">
<template slot-scope="scope">
<el-input v-model="scope.row.chanpinbianhao" />
</template>
</el-table-column>
<el-table-column align="center" prop="hetongbianhao" width="220" label="合同编号">
<template slot-scope="scope">
<el-input v-model="scope.row.s86" />
</template>
</el-table-column>
<el-table-column align="center" prop="caizhihuozhongliang" width="220" label="材质或重量">
<template slot-scope="scope">
<el-input v-model="scope.row.s87" />
</template>
</el-table-column>
</template>
<template v-else-if="sbzldm === '2000'">
<el-table-column align="center" prop="neibuleibie" width="130" label="检验类别(项目)">
<template slot-scope="scope">
<el-select v-model="scope.row.neibuleibie" placeholder="请选择">
<el-option v-for="item in jylbs" :key="item.code" :label="item.name" :value="item.code" />
</el-select>
</template>
</el-table-column>
<el-table-column align="center" prop="sblbpz" width="300" label="设备类别/品种">
<template slot-scope="scope">
<el-cascader
:ref="'cascader'+scope.$index"
v-model="scope.row.sblbpz"
:options="sblbList"
style="width: 100%"
@change="sblbpzChange(scope.$index)"
/>
</template>
</el-table-column>
<el-table-column align="center" prop="shebeimingcheng" width="220" label="产品名称">
<template slot-scope="scope">
<el-input v-model="scope.row.shebeimingcheng" />
</template>
</el-table-column>
<el-table-column align="center" prop="guigexinghao" width="220" label="产品型号">
<template slot-scope="scope">
<el-input v-model="scope.row.guigexinghao" />
</template>
</el-table-column>
<el-table-column align="center" prop="chanpinbianhao" width="220" label="产品编号">
<template slot-scope="scope">
<el-input v-model="scope.row.chanpinbianhao" />
</template>
</el-table-column>
<el-table-column align="center" prop="s108" width="220" label="合同编号">
<template slot-scope="scope">
<el-input v-model="scope.row.s108" />
</template>
</el-table-column>
<el-table-column align="center" prop="s29" width="220" label="设计图号">
<template slot-scope="scope">
<el-input v-model="scope.row.s29" />
</template>
</el-table-column>
<el-table-column align="center" prop="s109" width="220" label="材质或重量">
<template slot-scope="scope">
<el-input v-model="scope.row.s109" />
</template>
</el-table-column>
<el-table-column align="center" prop="s27" width="220" label="容器类别">
<template slot-scope="scope">
<el-select v-model="scope.row.s27" clearable>
<el-option label="Ⅰ类" value="Ⅰ类" />
<el-option label="Ⅱ类" value="Ⅱ类" />
<el-option label="Ⅲ类" value="Ⅲ类" />
<el-option label="B类" value="B类" />
</el-select>
</template>
</el-table-column>
</template>
<template v-else-if="sbzldm === '7000'">
<el-table-column align="center" prop="sblbpz" min-width="280" label="设备类别/品种">
<template slot-scope="scope">
<el-cascader
:ref="'cascader'+scope.$index"
v-model="scope.row.sblbpz"
:options="sblbList"
style="width: 100%"
@change="sblbpzChange(scope.$index)"
/>
</template>
</el-table-column>
<el-table-column align="center" prop="shebeimingcheng" min-width="180" label="产品名称">
<template slot-scope="scope">
<el-input v-model="scope.row.shebeimingcheng" placeholder="请输入内容" />
</template>
</el-table-column>
<el-table-column align="center" prop="s15" min-width="160" label="材料牌号">
<template slot-scope="scope">
<el-input v-model="scope.row.s15" placeholder="请输入内容" />
</template>
</el-table-column>
<el-table-column align="center" prop="s90" min-width="205" label="产品标准">
<template slot-scope="scope">
<el-input v-model="scope.row.s90" placeholder="请输入内容" />
</template>
</el-table-column>
<el-table-column align="center" prop="s91" min-width="175" label="产品批号">
<template slot-scope="scope">
<el-input v-model="scope.row.s91" placeholder="请输入内容" />
</template>
</el-table-column>
<el-table-column align="center" prop="chanpibianhao" min-width="175" label="产品编号">
<template slot-scope="scope">
<el-input v-model="scope.row.chanpinbianhao" placeholder="请输入内容" />
</template>
</el-table-column>
<el-table-column align="center" prop="guigexinghao" min-width="155" label="产品规格">
<template slot-scope="scope">
<el-input v-model="scope.row.guigexinghao" placeholder="请输入内容" />
</template>
</el-table-column>
<el-table-column align="center" prop="s37" min-width="155" label="管道元件编号或埋弧焊管管号">
<template slot-scope="scope">
<el-input v-model="scope.row.s37" placeholder="请输入内容" />
</template>
</el-table-column>
<el-table-column align="center" prop="s55" min-width="155" label="数量(根/台)">
<template slot-scope="scope">
<el-input v-model="scope.row.s55" placeholder="请输入内容" />
</template>
</el-table-column>
</template>
<template v-if="formState !== 'newBuild' && sbzldm !== '7000'">
<template v-if="sbzldm === '2000'">
<el-table-column align="center" prop="s54" width="120" label="只数或台数" fixed="right">
<template slot-scope="scope">
<el-input v-model="scope.row.s54" clearable type="number" @input="beforeChengben(scope.row)" />
</template>
</el-table-column>
<el-table-column align="center" prop="ss7" width="127" label="单价" fixed="right">
<template slot-scope="scope">
<el-input v-model="scope.row.ss7" clearable type="number" @input="beforeChengben(scope.row)" />
</template>
</el-table-column>
</template>
<el-table-column align="center" prop="ss1" width="140" label="造价(合同金额)" fixed="right">
<template slot-scope="scope">
<el-input v-model="scope.row.ss1" clearable type="number" @input="beforeHejia(scope.row)" />
</template>
</el-table-column>
<el-table-column align="center" prop="ss2" width="120" label="比例(%)" fixed="right">
<template slot-scope="scope">
<el-select v-model="scope.row.ss2" allow-create clearable filterable default-first-option @change="beforeHejia(scope.row)">
<el-option v-for="item in biliOptions" :key="item" :label="item" :value="item" />
</el-select>
</template>
</el-table-column>
<el-table-column align="center" prop="xitongheding" width="140" label="标准费用" fixed="right">
<template slot-scope="scope">
<el-input v-model="scope.row.xitongheding" type="number" placeholder="待录入" disabled />
</template>
</el-table-column>
<el-table-column v-if="sbzldm === '2000'" align="center" prop="datingheding" width="110" label="费用更正" fixed="right">
<template slot-scope="scope">
<el-input v-model="scope.row.datingheding" placeholder="请输入" />
</template>
</el-table-column>
<el-table-column align="center" width="100" label="附件" fixed="right">
<template slot-scope="scope">
<el-button type="info" size="small" circle icon="el-icon-info" title="编辑相关鉴证" @click="showVerification(scope.row.id)" />
</template>
</el-table-column>
</template>
</el-table>
</el-tab-pane>
<el-dialog title="查看相关鉴证" :modal-append-to-body="false" :visible.sync="dialogEnclosureVisible">
<enclosure :relation-id.sync="currentRenwuId" :if-liaison.sync="ifLiaison" :view-button.sync="viewButton" :is-show-hetong="examine || formState !== 'finish'" />
</el-dialog>
<!-- 修改检验类别/设备类别/设备品种方法 -->
<el-dialog title="批量修改设备信息" :visible.sync="dialogFormParam" @close="dialogFormParam = false">
<el-form ref="param" :model="param" class="small-space" label-position="right" label-width="120px">
<el-row :gutter="20">
<el-col :span="18">
<el-form-item label="设备类别:" prop="sblb">
<el-select v-model="param.sblb" value-key="value" @change="sblbChange">
<el-option v-for="item in sblbList" :key="item.value" :label="item.label" :value="item" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="18">
<el-form-item label="设备品种:" prop="sbpz">
<el-select
v-model="param.sbpz"
value-key="value"
>
<el-option v-for="item in sbpzList" :key="item.value" :label="item.label" :value="item" />
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div>
根据选中的条数进行修改,否则全部修改!
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormParam = false">
取 消
</el-button>
<el-button type="primary" @click="editRow">
确 定
</el-button>
</div>
</el-dialog>
<el-dialog title="收费标准" :visible.sync="dialogSfbz" @close="dialogSfbz = false">
<el-image :src="sfbz" />
</el-dialog>
</el-tabs>
</div>
</template>
<script>
import Sticky from '@/components/Sticky'
import Enclosure from '@/views/common/Enclosure'
import Utils from '../../utils/contact.js'
import XLSX from 'xlsx'
import { deleteRenwuFn } from '@/api/common'
export default {
name: 'AddProjectZJ',
components: { Sticky, Enclosure },
data() {
let templateName = ''
switch (this.$route.params.sbzl) {
case '1000':
templateName = '锅炉制造监检报检导入模板.xlsx'
break
case '2000':
templateName = '压力容器制造监检报检导入模板.xlsx'
break
default:
break
}
return {
bjd: {
id: '',
departmentId: '',
jianyanleibie: 'ZJ',
shebeizhonglei: '',
shebeizhongleidaima: '',
zzdwId: '',
zhizaodanwei: '',
zhizaodanweiLianxiren: '',
zhizaodanweiDianhua: '',
shouliriqi: new Date(),
baojianriqi: new Date()
},
param: {
shebeileibiedaima: ''
},
tableData: [], // 参数列表
sblbList: [], // 设备类别
jylbs: [], // 检验类别
depts: [], // 检验科室
productions: [], // 生产形式
productionsOnly3: [], // 生产形势-厂内制造
typeCode: 'PRODUCTION_FORM', // 生产形式代码
checkedTab: 'first',
formState: this.$route.params.formState, // 验证是创建/修改/完成
examine: this.$store.getters.clientType === 'System', // 判断是否为系统用户
delRowIndex: [],
selection: [],
dialogFormParam: false,
dialogFormVisible: false,
sbpzList: [],
baseList: [],
fileList: [],
jianyanliebie: '制造监检',
zzdwList: [],
multipleProveSelection: [],
sbzldm: this.$route.params.sbzl,
biliOptions: ['0.2', '0.3', '0.4', '0.5', '0.6', '0.7', '0.8', '0.9', '1', '1.1', '1.2'],
currentRenwuId: 0,
dialogEnclosureVisible: false,
viewButton: true,
ifLiaison: false,
xinghaoList: [],
sfbz: process.env.VUE_APP_PREVIEW_API + '/SJJY/static/image/shoufeibiaozhun.jpg',
dialogSfbz: false,
categoryTemplate: [],
templateName: templateName,
fixedFlag: true,
fixedWidth: '',
userList: [],
zzxkzbh: '',
isChaoqi: false
}
},
created() {
this.getZzdwList()
this.getJylb()
this.getProductions()
},
mounted() {
if (this.formState === 'newBuild') {
this.tableData = []
if (this.sbzldm === '1000') {
this.bjd.shebeizhonglei = '锅炉'
this.bjd.shebeizhongleidaima = '1000'
} else if (this.sbzldm === '2000') {
this.bjd.shebeizhonglei = '压力容器'
this.bjd.shebeizhongleidaima = '2000'
} else if (this.sbzldm === '7000') {
this.bjd.shebeizhonglei = '压力管道元件'
this.bjd.shebeizhongleidaima = '7000'
}
this.bjd.shouliriqi = new Date()
this.bjd.baojianriqi = new Date()
this.getSblb()
this.getByDepartmentId()
} else {
// 查询报检信息
this.getBjdInfo()
this.getBjdParam()
}
if (this.formState === 'finish') {
this.viewButton = false
}
if (this.sbzldm === '1000') {
this.biliOptions = ['0.4', '0.5', '0.6', '0.7', '0.8', '0.9', '1']
this.userList = this.$store.getters.allUser.filter(user => user.departmentId === 74 && user.clientType === 'System')
}
},
methods: {
/**
* 导入报检设备明细
*/
uploadExcel(item) {
let importField = []
if (this.sbzldm === '1000') {
importField = [
[{ label: '设备类别', value: 'shebeileibie' }, { label: '锅炉型号', value: 'guigexinghao' },
{ label: '设备代码', value: 'shebeidaima' }, { label: '产品编号', value: 'chanpinbianhao' }, { label: '合同编号', value: 's86' }, { label: '材质或重量', value: 's87' },
{ label: '造价(合同金额)', value: 'ss1' }, { label: '比例(%)', value: 'ss2' }]
]
} else if (this.sbzldm === '2000') {
importField = [
[{ label: '设备类别代码', value: 'shebeileibiedaima' }, { label: '设备品种代码', value: 'shebeipinzhongdaima' }, { label: '设备名称', value: 'shebeimingcheng' },
{ label: '产品型号', value: 'guigexinghao' }, { label: '产品编号', value: 'chanpinbianhao' }, { label: '合同编号', value: 's108' }, { label: '设计图号', value: 's29' },
{ label: '材质或重量', value: 's109' }, { label: '容器类别', value: 's27' }, { label: '生产形式', value: 's107' }, { label: '只数或台数', value: 's54' }, { label: '单价', value: 'ss7' },
{ label: '比例(%)', value: 'ss2' }]
]
}
this.bjdService.beforeUpload(this, item.file, importField, this.sbzldm, 'ZJ')
},
/**
* 获得下载上传所需数据模板的设备类别
*/
focusGetCategory(item) {
if (item) {
this.categoryTemplate = item
}
},
/**
* 下载上传所需数据模板
*/
downloadTemplate(row, item) {
if (row.sblbpz && this.categoryTemplate[0] && this.categoryTemplate[1] && row.sblbpz.length > 0) {
this.preview({
url: '/download/downloadYlrqTemplateZJ',
method: 'post',
params: {
neibuleibie: row.neibuleibie,
categoryCode: this.categoryTemplate[0],
varietyCategory: this.categoryTemplate[1],
productionType: item
}
}).then(data => {
if (data) {
window.open(data)
}
})
} else {
this.$message({ type: 'error', message: '请选择完整的设备类别和品种!' })
return false
}
},
/**
* 获取科室id
*/
getByDepartmentId() {
if (this.examine) {
this.bjd.departmentId = this.$store.getters.departmentId
} else {
this.api({
url: '/user/getById',
method: 'get',
params: {
id: this.$store.getters.userId
}
}).then(data => {
this.bjd.departmentId = data.departmentId
})
}
},
getBjdInfo() {
this.apibjd({
url: '/bjd',
method: 'get',
params: {
bjdId: this.$route.params.id
}
}).then(data => {
this.bjd = data
this.getSblb()
this.getXinghao()
})
},
getBjdParam() {
// 查询报检参数信息
this.apibjd({
url: '/renwu/getParamByBjdId',
method: 'get',
params: {
bjdId: this.$route.params.id
}
}).then(data => {
this.tableData = data
if (this.sbzldm !== '1000') {
this.tableData.forEach(tableObj => this.$set(tableObj, 'sblbpz', [tableObj.shebeileibiedaima, tableObj.shebeipinzhongdaima]))
}
this.$nextTick(() => {
this.$refs.bjBaseList.doLayout()
})
})
},
getXinghao() {
if (this.bjd.zzdwId && this.sbzldm === '1000') {
this.api({
url: 'dicXinghao/getAll',
method: 'get',
params: {
zzdwId: this.bjd.zzdwId
}
}).then(data => {
this.xinghaoList = data
})
}
},
getJylb() {
// 检验类别
this.api({
url: '/category/getCategoryList',
method: 'get',
params: {
parentCode: 'ZJ',
species: this.sbzldm
}
}).then(data => {
this.jylbs = data
})
},
getZzdwList() {
const queryZzdw = {
creatingState: true,
inspectorIfEmpty: false,
shebeizhongleidaima: this.sbzldm,
zfState: false
}
const username = this.$store.getters.username
if (username && username !== 'admin') {
if (this.$store.getters.clientType === 'Enterprise') {
queryZzdw.userId = this.$store.getters.userId
} else if (this.sbzldm === '2000') {
queryZzdw.zhuchangjianyanrenyuan = this.$store.getters.userId
}
}
this.api({
url: '/dwxx/getAll',
method: 'get',
params: queryZzdw
}).then(data => {
this.zzdwList = data
if (this.zzdwList && this.formState === 'newBuild') {
this.bjd.zzdwId = this.zzdwList[0].id
this.zzdwChange(this.bjd.zzdwId)
}
})
},
getSblb() {
this.getSblbList('2', this.bjd.shebeizhongleidaima, undefined)
},
getProductions() {
this.api({
url: '/dicData/getDicDataByTypeCode',
method: 'get',
params: {
typeCode: this.typeCode
}
}).then(data => {
if (data) {
this.productions = data
this.productions.forEach(item => {
item.value = item.value + ''
if (item.value === '3') {
this.productionsOnly3.push(item)
}
})
}
})
},
getSblbList(level, sbzl, sblb) { // 设备类别下拉菜单
this.api({
url: '/sedirectory/getList',
method: 'get',
params: {
level: level,
sbzl: sbzl,
sblb: sblb
}
}).then(data => {
switch (level) {
case '2':
this.sblbList = data
break
case '3':
this.sbpzList = data
break
}
})
},
sblbpzChange(index) {
const sblbpz = this.tableData[index].sblbpz
if (sblbpz) {
this.tableData[index].shebeileibiedaima = sblbpz[0]
this.tableData[index].shebeipinzhongdaima = sblbpz[1]
this.$nextTick(() => {
const cascaderRefs = this.$refs['cascader' + index]
if (cascaderRefs) {
const sblbpzmc = cascaderRefs.getCheckedNodes()[0].pathLabels
this.tableData[index].shebeileibie = sblbpzmc[0]
this.tableData[index].shebeipinzhong = sblbpzmc[1]
}
this.beforeHejia(this.tableData[index])
})
}
},
sblbChange(sblb) {
this.getSblbList('3', this.bjd.shebeizhongleidaima, sblb.value)
},
tableRowClassName({ row, rowIndex }) {
row.index = rowIndex
},
handleSelectionChange(val) {
this.selection = val
this.delRowIndex = []
for (let i = 0; i < val.length; i++) {
this.delRowIndex.push(val[i].index)
}
},
// 表格单击选中行
onRowClick(row) {
this.$refs.bjBaseList.toggleRowSelection(row)
},
changeSblb($index) {
if (this.tableData[$index].shebeileibiedaima === '1400') {
this.tableData[$index].shebeidaima = '/'
} else {
this.tableData[$index].shebeidaima = this.getSbdm(this.tableData[$index].shebeileibiedaima)
}
},
getSbdm(sblbdm) {
return sblbdm + this.zzxkzbh + new Date().getFullYear()
},
addRow: function() { // 添加行数据
let d
if (this.sbzldm === '1000') {
d = {
shebeileibiedaima: '1100',
neibuleibie: 'ZZ',
shebeidaima: this.getSbdm('1100'),
shebeimingcheng: '',
baseId: '',
chanpinbianhao: '',
hetongbianhao: '',
generateType: true,
xitongheding: '',
s29: '',
s27: '',
s87: '',
s107: '',
s108: ''
}
} else if (this.sbzldm === '2000') {
d = {
shebeileibiedaima: '',
neibuleibie: 'ZZ',
shebeimingcheng: '',
baseId: '',
chanpinbianhao: '/',
hetongbianhao: '',
generateType: true,
xitongheding: '',
s29: '',
s27: '',
s107: '',
s108: ''
}
} else if (this.sbzldm === '7000') {
d = {
shebeileibie: '',
shebeileibiedaima: '7100',
shebeipinzhong: '',
shebeipinzhongdaima: '7110',
sblbpz: ['7100', '7110'],
shebeimingcheng: '',
chanpinbianhao: '/',
generateType: true,
neibuleibie: 'ZZ',
guigexinghao: 'Ø × mm',
s15: '/',
s90: '/',
s54: '/',
s55: '/'
}
}
this.tableData.push(d)
setTimeout(() => {
this.$refs.bjBaseList.setCurrentRow(d)
}, 10) // 用于延时渲染后选中这行
},
editRow: function() { // 修改行数据
if (this.param.sblb === null || this.param.sbpz === null) {
this.$message({
type: 'error',
message: '请选择完整的设备类别和品种!'
})
return false
}
this.batchAssignment(this.delRowIndex.length === 0 ? this.tableData : this.selection)
this.tableData.push()
this.dialogFormParam = false
},
batchAssignment(data) {
if (data) {
data.forEach(item => {
item.shebeileibiedaima = this.param.sblb.value
item.shebeileibie = this.param.sblb.label
item.shebeipinzhongdaima = this.param.sbpz.value
item.shebeipinzhong = this.param.sbpz.label
if (this.sbzldm === '2000') {
item.sblbpz = []
item.sblbpz.push(item.shebeileibiedaima)
item.sblbpz.push(item.shebeipinzhongdaima)
}
})
}
},
delRow: function() { // 删除行数据
if (this.delRowIndex.length === 0) {
this.$message({
type: 'error',
message: '请选中需要删除的数据!'
})
return false
} else {
this.$confirm('该条数据删除后无法恢复,是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
// 对delRowIndex进行排序,因为删除一个元素后index值会变
this.delRowIndex.sort(function(x, y) {
if (x < y) {
return 1
}
if (x > y) {
return -1
}
return 0
})
for (let i = 0; i < this.delRowIndex.length; i++) {
// 在实际数据中进行删除
if (this.formState !== 'newBuild') {
// 前提条件要满足非新建报检
const delid = this.tableData[this.delRowIndex[i]].id
if (delid != null) {
deleteRenwuFn({ id: delid }).then((data) => {
// 不做处理
})
}
}
this.tableData.splice(this.delRowIndex[i], 1)
}
this.$refs.bjBaseList.clearSelection()
this.delRowIndex = []
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
}
},
judgeNull(str) {
if (!str || str.toString().replace(/(^s*)|(s*$)/g, '').length === 0) {
return true
} else {
return false
}
},
openDialogParam() {
this.dialogFormParam = true
},
zzdwChange(item) {
const zzdw = this.zzdwList.filter(zzdw => zzdw.id === item)[0]
this.bjd.zhizaodanwei = zzdw.zhizaodanwei
this.bjd.zhizaodanweiLianxiren = zzdw.zhizaodanweiLianxiren
this.bjd.zhizaodanweiDianhua = zzdw.zhizaodanweiDianhua
this.isChaoqi = new Date() > new Date(zzdw.zhizaoxukezhengyouxiaoqi)
if (this.bjd.shebeizhongleidaima === '1000') {
this.getXinghao()
if (zzdw.zhizaoxukezhengbianhao) {
let zzxkzbh = zzdw.zhizaoxukezhengbianhao.toString()
zzxkzbh = zzxkzbh.substring(0, zzxkzbh.indexOf('-'))
this.zzxkzbh = zzxkzbh.substr(zzxkzbh.length - 5)
}
}
},
// 报检单保存
bjdSave(audit) {
this.$refs['bjd'].validate(valid => {
if (valid) {
if (this.isChaoqi && this.bjd.shebeizhongleidaima === '2000') {
this.$message.warning('当前单位证书有效日期已超期!')
return false
}
if (this.tableData === null || this.tableData.length === 0) {
this.$message({
type: 'error',
message: '报检设备不能为空!'
})
return false
} else {
for (let i = 0; i < this.tableData.length; i++) {
if (this.judgeNull(this.tableData[0].shebeileibiedaima)) {
this.$message({
type: 'error',
message: '请选择第一条设备的设备类别!'
})
return false
}
this.sblbpzChange(i)
if (this.judgeNull(this.tableData[i].shebeileibiedaima)) {
if (this.sbzl === 'AQF') {
this.tableData[i].shebeileibiedaima = '7300'
this.tableData[i].shebeileibie = '压力管道阀门'
} else {
this.tableData[i].shebeileibiedaima = this.tableData[0].shebeileibiedaima
this.tableData[i].shebeileibie = this.tableData[0].shebeileibie
}
}
if (!this.tableData[i].s107) {
this.tableData[i].s107 = this.productions[0].value
}
if (audit && this.bjd.shebeizhongleidaima === '2000' && this.tableData[0].xitongheding === 0 && this.tableData[0].datingheding === 0) {
this.$message({
type: 'error',
message: '存在未填写费用设备,无法审核!'
})
return false
}
}
}
this.bjd.totalNum = this.tableData.length
let type = ''
if (this.formState === 'newBuild') {
type = 'post'
} else {
type = 'put'
}
this.apibjd({
url: '/bjd',
method: type,
data: {
bjd: this.bjd,
paramList: this.tableData,
audit: audit
}
}).then(data => {
Utils.$emit('bjd-list')
if (audit) {
this.$store.dispatch('delCurrentViews', {
view: this.$route,
$router: this.$router
})
this.$message({ message: '审核成功', type: 'success' })
} else {
if (this.formState === 'newBuild') {
this.$message({ message: '保存成功', type: 'success' })
this.bjd = data.bjd
this.formState = 'update'
this.common.reloadViewToUpdateBjd(this.bjd)
} else {
this.$message({ message: '修改成功', type: 'success' })
}
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)
}
}
})
} else {
this.$message({ type: 'error', message: '保存失败,请核对信息' })
}
})
},
beforeUpload(file) {
if (!this.isExcel(file)) {
this.$message({
message: '请上传xls或xlsx文件.',
type: 'warning'
})
return false
}
const isLt1M = file.size / 1024 / 1024 < 1
if (isLt1M) {
this.readerData(file)
return true
}
this.$message({
message: '文件大小不能超过1M.',
type: 'warning'
})
return false
},
readerData(rawFile) {
return new Promise((resolve, reject) => {
const reader = new FileReader()
reader.onload = e => {
const data = e.target.result
const workbook = XLSX.read(data, { type: 'array' })
const firstSheetName = workbook.SheetNames[0]
const worksheet = workbook.Sheets[firstSheetName]
const importData = XLSX.utils.sheet_to_json(worksheet)
importData.shift()
this.tableData = this.tableData.concat(importData)
resolve()
}
reader.readAsArrayBuffer(rawFile)
})
},
isExcel(file) {
return /\.(xlsx|xls|csv)$/.test(file.name)
},
/**
* 核价
* @param row 操作的行
*/
beforeHejia: function(row) {
if (this.formState === 'finish') {
this.$message.warning('只允许更新核定费用,已审核的参数修改无效!!!')
return false
} else {
const heding = (!row.ss1 || !row.ss2) ? 0 : this.common.accMul(row.ss1, row.ss2 / 100)
if (this.bjd.shebeizhongleidaima === '2000' && row.shebeileibiedaima === '2100') {
if (row.s107 === '5') {
const danjia = (!row.ss7 || !row.ss2) ? 0 : this.common.accMul(row.ss7, row.ss2 / 100)
const gzdanjia = danjia < 50 ? 50 : danjia
row.xitongheding = !row.s54 ? 0 : this.common.accMul(row.s54, gzdanjia)
} else {
row.xitongheding = (heding < 50 && heding !== 0) ? 50 : heding
}
} else {
row.xitongheding = heding
}
// 锅炉制造费用四舍五入到个位
if (this.bjd.shebeizhongleidaima === '1000') {
row.xitongheding = Math.round(row.xitongheding)
}
}
},
/**
* 计算成本
*/
beforeChengben(row) {
if (this.formState === 'finish') {
this.$message.warning('只允许更新核定费用,已审核的参数修改无效!!!')
return false
}
if (row.s54 && row.ss7) {
row.ss1 = this.common.accMul(row.s54, row.ss7)
this.beforeHejia(row)
}
},
/**
* 显示相关鉴证文件上传窗口
* @param renwuId
*/
showVerification(renwuId) {
this.dialogEnclosureVisible = true
this.currentRenwuId = renwuId
},
viewSfbz() {
this.dialogSfbz = true
},
editFixedHidden() {
const els = document.getElementsByClassName('el-table__fixed-right')
if (!this.fixedFlag) {
this.fixedWidth = els[0].style.width
}
if (this.fixedFlag) {
els[0].style.width = this.fixedWidth
} else {
els[0].style.width = '300px'
}
}
}
}
</script>
<style>
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
-webkit-appearance: none !important;
margin: 0;
}
</style>