Browse Source

优化原始记录编辑

master
李磊 3 years ago
parent
commit
c7e279fe1e
  1. 2
      src/views/common/SignName/index.vue
  2. 133
      src/views/ysjl/3000/common/index.vue
  3. 145
      src/views/ysjl/3000/common/inspection-items.vue

2
src/views/common/SignName/index.vue

@ -15,7 +15,7 @@
<el-option v-for="dept in depts" :key="dept.id" :label="dept.name" :value="dept.id" />
</el-select>
<el-select v-model="userId" placeholder="请选择人员" style="width: 240px; padding-top: 20px" @change="signToPwd">
<el-option v-for="user in users" v-show="user.clientType === 'System'" :key="user.id" :label="user.nickname" :value="user.id" />
<el-option v-for="user in users" :key="user.id" :label="user.nickname" :value="user.id" />
</el-select>
</el-dialog>
</div>

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

@ -52,22 +52,12 @@
<fieldset>
<legend>基本信息</legend>
<el-row :gutter="25">
<el-col
v-if="
state === 'create' ||
ysjl.jilubianhao === null ||
ysjl.jilubianhao === ''
"
:span="14"
>
<el-col v-if="state === 'create' || !ysjl.jilubianhao" :span="14">
<el-form-item label="记录编号">
<el-input v-model="jlbh1" style="width: 80px" disabled />
<el-input v-model="jlbh4" style="width: 80px" disabled />
<el-input v-model="jlbh2" style="width: 80px" disabled />-
<el-input
v-model="jlbh3"
style="width: 85px"
/>
<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" />
</el-form-item>
</el-col>
<el-col v-else :span="9">
@ -750,7 +740,7 @@
<el-row :gutter="10">
<el-col :span="9">
<el-form-item label="检验人员" prop="jianyanrenyuan">
<el-input v-model="ysjl.jianyanrenyuan" disabled />
<el-input v-model="jianyanrenyuan" disabled />
</el-form-item>
</el-col>
<el-col :span="9">
@ -832,13 +822,6 @@ export default {
required: true,
type: Array
},
// /**
// * [{ index: 0, relationIds: [1, 2] }]
// */
// jyxmRelations: {
// required: true,
// type: Array
// },
fromType: {
required: true,
type: Number
@ -852,8 +835,8 @@ export default {
return {
ysjl: {},
param: {},
jlbh2: new Date().getFullYear(),
jlbh3: '',
jlbh2: '',
jlbh3: new Date().getFullYear(),
jlbh4: '',
isRepeat: false,
jianyanrenyuan: '',
@ -863,17 +846,7 @@ export default {
bgfyData: [],
ysjlId: this.$route.query.id,
checkedTab: 'first',
xmlbListAB: ['A', 'B'],
xmlbListAC: ['A', 'C'],
xmlbListBC: ['B', 'C'],
jyxmrqShow: false,
querenriqi: null,
signShow: false,
dialogEnclosureVisible: false,
dialogRoleVisible: false,
userList: [],
defaultRlr: [],
renlingren: [],
xinghaoList: [],
jybgData: [],
cols: [
@ -914,14 +887,12 @@ export default {
fubiao1: [],
fubiao2: [],
fubiao3: [],
tree: [],
jybgTemplateId: ''
tree: []
}
},
created() {
if (this.state === 'create') {
this.initYsjl()
this.getMaxBh()
if (this.fromType === 5 || this.fromType === 6) {
this.fubiao1 = [
{
@ -968,22 +939,21 @@ export default {
this.ysjl.xianchangjianyantiaojian = '符合'
this.departmentId = this.ysjl.departmentId
if (data.ysjl.shebeileibiedaima === '3300') {
this.jlbh4 = '(F)'
this.jlbh2 = '(F)'
} else if (data.ysjl.shebeileibiedaima === '3200') {
this.jlbh4 = '(Y)'
this.jlbh2 = '(Y)'
} else if (data.ysjl.shebeileibiedaima === '3400') {
if (data.ysjl.shebeipinzhongdaima === '3420') {
this.jlbh4 = '(X)'
this.jlbh2 = '(X)'
} else if (data.ysjl.shebeipinzhongdaima === '3430') {
this.jlbh4 = '(Z)'
this.jlbh2 = '(Z)'
}
} else {
this.jlbh4 = '(C)'
this.jlbh2 = '(C)'
}
this.getJyxm(1)
this.getSbList()
this.jybgTemplateId = this.ysjl.jybgTemplateId
console.log(this.ysjl.jybgTemplateId)
this.getMaxBh()
})
},
getSbList() {
@ -1017,14 +987,12 @@ export default {
if (fubiao[2]) {
this.fubiao3 = fubiao[2]
}
console.log(this.fubiao1)
})
},
getYsjl() {
this.ysjlService.getYsjl(this.ysjlId).then((data) => {
this.ysjl = data
this.departmentId = this.ysjl.departmentId
this.jybgTemplateId = this.ysjl.jybgTemplateId
this.ysjl.imagePath = ''
if (
this.ysjl.jianyanrenyuan !== null &&
@ -1101,7 +1069,7 @@ export default {
* 查询最大记录编号
*/
getMaxBh() {
const aheadPart = this.jlbh1 + this.jlbh2 + '-'
const aheadPart = this.jlbh1 + this.jlbh2 + this.jlbh3 + '-'
this.api({
url: '/ysjl/gainCurrentBh',
method: 'get',
@ -1110,7 +1078,7 @@ export default {
hinderPart: ''
}
}).then((data) => {
this.jlbh3 = data
this.jlbh4 = data
this.ysjlService
.judgeRepeat(this.ysjl.jilubianhao, this.ysjl.id)
.then((data) => {
@ -1174,54 +1142,52 @@ export default {
return sorted
},
buildSaveData(operation) {
const tableData = []
const _this = this
let fubiao
if (this.fromType === 5 || this.fromType === 6) {
console.log(this.$refs.table4.tableData, 5555)
fubiao = [this.$refs.table4.tableData]
} else {
fubiao = [this.fubiao1, this.fubiao2, this.fubiao3]
}
let arr = []
const subArr = this.sortClass(this.jybgData)
subArr.map((item) => {
if (
item.some(
(k) => k.jianyanjieguo === '不符合' || k.jianyanjieguo === 'X'
)
) {
_this.jybgData[item[0].jybgJyjlIndex - 1].jianyanjielun = '不合格'
} else if (
item.every(
(k) => k.jianyanjieguo === '符合' || k.jianyanjieguo === '√'
)
) {
_this.jybgData[item[0].jybgJyjlIndex - 1].jianyanjielun = '合格'
} else if (
item.every(
(k) => k.jianyanjieguo === '无此项' || k.jianyanjieguo === '/'
)
) {
_this.jybgData[item[0].jybgJyjlIndex - 1].jianyanjielun = '无此项'
if (item.some((k) => k.jianyanjieguo === '不符合')) {
this.jybgData[item[0].jybgJyjlIndex - 1].jianyanjielun = '不合格'
} else if (item.every((k) => k.jianyanjieguo === '符合')) {
this.jybgData[item[0].jybgJyjlIndex - 1].jianyanjielun = '合格'
} else if (item.every((k) => k.jianyanjieguo === '无此项')) {
this.jybgData[item[0].jybgJyjlIndex - 1].jianyanjielun = '无此项'
}
})
arr = arr.concat(this.bgfyData, this.jybgData)
arr.forEach((row) => {
const tableData = []
this.bgfyData.forEach((row) => {
tableData.push({
ysjlId: this.ysjlId,
beizhu: row.beizhu,
dicJyxmId: row.dicJyxmId,
jianyanjieguo: row.jianyanjieguo ? row.jianyanjieguo : '',
jianyanjielun: row.jianyanjielun ? row.jianyanjielun : '',
jianyanjieguo: row.jianyanjieguo || '',
jianyanjielun: row.jianyanjielun || '',
jyxmMode: 0,
sort: row.sort,
orders: row.orders,
cjState: 0
})
})
this.jybgData.forEach((row) => {
tableData.push({
ysjlId: this.ysjlId,
beizhu: row.beizhu,
dicJyxmId: row.dicJyxmId,
jianyanjieguo: row.jianyanjieguo || '',
jianyanjielun: row.jianyanjielun || '',
jyxmMode: 0,
sort: row.sort,
orders: row.orders,
cjState: 1
})
})
if (operation === 'add') {
this.ysjl.jilubianhao = this.jlbh1 + this.jlbh4 + this.jlbh2 + '-' + this.jlbh3
this.ysjl.jilubianhao = this.jlbh1 + this.jlbh2 + this.jlbh3 + '-' + this.jlbh4
this.save(operation, 'post', tableData, fubiao)
} else if (operation === 'build') {
this.ysjl.baogaobianhao = this.ysjl.jilubianhao
@ -1245,21 +1211,12 @@ export default {
})
return false
}
// for (let i = 0; i < this.bgfyData.length; i++) {
// if (!this.bgfyData[i].jianjianyuan || !this.bgfyData[i].querenriqi) {
// this.$message.error(
// ''
// )
// return false
// }
// }
this.save(operation, 'put', tableData, fubiao)
} else if (operation === 'upd') {
this.save(operation, 'put', tableData, fubiao)
}
},
save(operation, type, jyxm, fubiao) {
console.log(this.jybgData, 2222)
if (this.fromType !== 5 && this.fromType !== 6) { this.ysjl.imagePath = this.$refs.table1.imgPath }
//
@ -1297,7 +1254,6 @@ export default {
//
this.common.reloadViewToUpdateYsjl(this.ysjl)
} else if (operation === 'upd') {
this.dialogRoleVisible = false
this.$message({ message: '更新成功', type: 'success' })
//
this.$router.push({
@ -1341,12 +1297,7 @@ export default {
})
},
changXh: function(val) {
const xinghao = this.xinghaoList.filter((xh) => xh.xinghao === val)[0]
this.$set(
this.param,
'jiandingbaogaobianhao',
(xinghao && xinghao.jiandingbaogaobianhao) || ''
)
// TODO
},
loadPhxsImage(data) {
this.pic = data

145
src/views/ysjl/3000/common/inspection-items.vue

@ -35,17 +35,13 @@
label="检查结果"
>
<template slot-scope="scope">
<el-select
<el-autocomplete
v-model="scope.row.jianyanjieguo"
@change="v=>changeFn(v,scope.row)"
>
<el-option
v-for="item in jyjgList"
:key="item"
:label="item"
:value="item"
class="inline-input"
style="width: 100%"
:fetch-suggestions="querySearchJyjg"
@select="(val) => changeFn(val.value, scope.row)"
/>
</el-select>
</template>
</el-table-column>
<!-- <el-table-column
@ -90,7 +86,7 @@ export default {
},
data() {
return {
jyjgList: ['√', 'X', '/']
jyjgList: [{ value: '√' }, { value: 'X' }, { value: '/' }]
}
},
created() {
@ -98,127 +94,26 @@ export default {
},
mounted() {},
methods: {
/**
* 是否可编辑
* @param $index
* @returns {number}
*/
showXmlb($index) {
return this.showXmlbIndexListSg.filter((xl) => {
return xl.index === $index
}).length
},
/**
* 根据索引找到对应的项目类别选项列表
* @param $index
*/
getXmlbList($index) {
for (let i = 0; i < this.showXmlbIndexListSg.length; i++) {
const xl = this.showXmlbIndexListSg[i]
if (xl.index === $index) {
return xl.xmlb === 'AB'
? this.xmlbListAB
: xl.xmlb === 'AC'
? this.xmlbListAC
: this.xmlbListBC
}
}
},
/**
* 修改检验项目关联的检验结果及确认日期为监检日期
* @param $index 检验项目索引
*/
changeJyjg($index) {
//
const isWcx = this.bgfyData[$index].jianyanjieguo === '无此项'
const isWx = this.bgfyData[$index].jianyanjieguo === '外协'
if (isWcx) {
this.bgfyData[$index].gongzuojianzheng = '—'
}
if (isWx) {
this.bgfyData[$index].gongzuojianzheng = '外协部件监检证书'
}
if (isWcx || isWx) {
this.bgfyData[$index].querenriqi =
this.formatter.dateFormat('YYYY-MM-dd')
} else {
this.bgfyData[$index].gongzuojianzheng = this.dicGzjz[$index].value
this.bgfyData[$index].querenriqi = this.ysjl.jianyanjieshuriqi
}
//
const jyxm = this.jyxmRelations.filter(
(jyxm) => jyxm.index === $index
)[0]
//
if (!jyxm) {
return
}
//
//
jyxm.relationIds.forEach((index) => {
this.bgfyData[index].jianyanjieguo =
this.bgfyData[$index].jianyanjieguo
if (isWcx || isWx) {
this.bgfyData[index].gongzuojianzheng =
this.bgfyData[$index].gongzuojianzheng
this.bgfyData[index].querenriqi = this.bgfyData[$index].querenriqi
} else {
this.bgfyData[index].gongzuojianzheng = this.dicGzjz[index].value
this.bgfyData[index].querenriqi = this.ysjl.jianyanjieshuriqi
}
})
},
onRowClick(row) {
this.$refs.bgfyData.toggleRowSelection(row)
},
/**
* 修改检验项目关联的确认日期
* @param $index 检验项目索引
*/
changeQrrq: function($index) {
//
if (!this.bgfyData[$index].querenriqi) {
return
}
//
const jyxm = this.jyxmRelations.filter(
(jyxm) => jyxm.index === $index
)[0]
//
if (!jyxm) {
return
}
//
jyxm.relationIds.forEach((index) => {
//
if (!this.bgfyData[index].querenriqi) {
this.bgfyData[index].querenriqi = this.bgfyData[$index].querenriqi
}
})
querySearchJyjg: function(queryString, cb, $index) {
cb(this.jyjgList)
},
querySearchGzjz: function(queryString, cb, $index) {
cb([this.dicGzjz[$index]])
},
changeFn(val, row) {
console.log(row, val)
if (row.xiangmuleibie === 'A' || row.xiangmuleibie === 'B') {
if (val === 'X') {
this.jybgData[row.jybgJyjgIndex].jianyanjieguo = '不符合'
} else if (val === '√') {
this.jybgData[row.jybgJyjgIndex].jianyanjieguo = '符合'
} else {
this.jybgData[row.jybgJyjgIndex].jianyanjieguo = '无此项'
}
} else {
if (val === 'X') {
this.jybgData[row.jybgJyjgIndex].jianyanjieguo = '资料确认不符合'
} else if (val === '√') {
this.jybgData[row.jybgJyjgIndex].jianyanjieguo = '资料确认符合'
const jybgJyjgJyxm = this.jybgData[row.jybgJyjgIndex - 1]
if (val.indexOf('X') === 0) {
jybgJyjgJyxm.jianyanjieguo = '不符合'
} else if (val.indexOf('√') === 0) {
let jyjg = '符合'
if (row.xiangmuleibie === 'C') {
jyjg = '资料确认符合'
}
jybgJyjgJyxm.jianyanjieguo = jyjg
} else if (val.indexOf('/') === 0) {
jybgJyjgJyxm.jianyanjieguo = '无此项'
} else {
this.jybgData[row.jybgJyjgIndex].jianyanjieguo = '无此项'
}
jybgJyjgJyxm.jianyanjieguo = ''
}
}
}

Loading…
Cancel
Save