Browse Source

提交

master
xiaobai 3 years ago
parent
commit
b02b155551
  1. 531
      src/views/ysjl/3000/common/index.vue

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

@ -483,8 +483,12 @@
prop="xianchangjianyantiaojian"
>
<el-radio-group v-model="ysjl.xianchangjianyantiaojian">
<el-radio label="符合"> 符合 </el-radio>
<el-radio label="不符合"> 不符合 </el-radio>
<el-radio label="符合">
符合
</el-radio>
<el-radio label="不符合">
不符合
</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
@ -663,10 +667,18 @@
<el-col :span="18">
<el-form-item label="检验结论" prop="jianyanjielun">
<el-radio-group v-model="ysjl.jianyanjielun">
<el-radio label="合格"> 合格 </el-radio>
<el-radio label="不合格"> 不合格 </el-radio>
<el-radio label="复检合格"> 复检合格 </el-radio>
<el-radio label="复检不合格"> 复检不合格 </el-radio>
<el-radio label="合格">
合格
</el-radio>
<el-radio label="不合格">
不合格
</el-radio>
<el-radio label="复检合格">
复检合格
</el-radio>
<el-radio label="复检不合格">
复检不合格
</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
@ -803,23 +815,23 @@
</div>
</template>
<script>
import Sticky from "@/components/Sticky";
import SignName from "@/views/common/SignName";
import Utils from "@/utils/contact";
import merge from "webpack-merge";
import Inspection from "@/views/ysjl/3000/common/inspection-items";
import Table from "@/views/ysjl/3000/dj/common/table";
import Phxsb from "@/views/ysjl/3000/dj/common/phxsb";
import ZdftFb from "@/views/ysjl/3000/dj/common/zdftFb";
import { getDepartmentTreeList } from "@/api/common.js";
import Sticky from '@/components/Sticky'
import SignName from '@/views/common/SignName'
import Utils from '@/utils/contact'
import merge from 'webpack-merge'
import Inspection from '@/views/ysjl/3000/common/inspection-items'
import Table from '@/views/ysjl/3000/dj/common/table'
import Phxsb from '@/views/ysjl/3000/dj/common/phxsb'
import ZdftFb from '@/views/ysjl/3000/dj/common/zdftFb'
import { getDepartmentTreeList } from '@/api/common.js'
export default {
name: "BaseInfo",
name: 'BaseInfo',
components: { SignName, Sticky, Inspection, Table, Phxsb, ZdftFb },
props: {
arrayGroup: {
required: true,
type: Array,
type: Array
},
// /**
// * [{ index: 0, relationIds: [1, 2] }]
@ -830,31 +842,31 @@ export default {
// },
fromType: {
required: true,
type: Number,
type: Number
},
jlbh1: {
type: String,
default: "DT",
},
default: 'DT'
}
},
data() {
return {
ysjl: {},
param: {},
jlbh2: new Date().getFullYear(),
jlbh3: "",
jlbh4: "",
jlbh3: '',
jlbh4: '',
isRepeat: false,
jianyanrenyuan: "",
jianyanrenyuan: '',
departmentId: this.$route.query.departmentId,
edit: false,
state: this.$route.query.state,
bgfyData: [],
ysjlId: this.$route.query.id,
checkedTab: "first",
xmlbListAB: ["A", "B"],
xmlbListAC: ["A", "C"],
xmlbListBC: ["B", "C"],
checkedTab: 'first',
xmlbListAB: ['A', 'B'],
xmlbListAC: ['A', 'C'],
xmlbListBC: ['B', 'C'],
jyxmrqShow: false,
querenriqi: null,
signShow: false,
@ -867,255 +879,255 @@ export default {
jybgData: [],
cols: [
{
name: "jianyanxiang", // el-table-column prop=''
name: 'jianyanxiang', // el-table-column prop=''
getValue(row) {
//
return row.jianyanxiang;
},
return row.jianyanxiang
}
},
{
name: "jianyanmu",
name: 'jianyanmu',
getValue(row) {
return row.jianyanmu;
},
},
return row.jianyanmu
}
}
],
rows: [
{
name: "jianyanxiang",
name: 'jianyanxiang',
getValue(row) {
return row.jianyanxiang;
},
return row.jianyanxiang
}
},
{
name: "jianyanneirong",
name: 'jianyanneirong',
getValue(row) {
return row.jianyanneirong;
},
},
return row.jianyanneirong
}
}
],
pickerOptions: {
disabledDate(time) {
return time.getTime() > Date.now();
},
return time.getTime() > Date.now()
}
},
pic: "",
pic: '',
fubiao1: [],
fubiao2: [],
fubiao3: [],
tree: [],
jybgTemplateId: "",
};
jybgTemplateId: ''
}
},
created() {
if (this.state === "create") {
this.initYsjl();
this.getMaxBh();
if (this.state === 'create') {
this.initYsjl()
this.getMaxBh()
if (this.fromType === 5 || this.fromType === 6) {
this.fubiao1 = [
{
D2: "第一次",
D1: "",
D2: '第一次',
D1: ''
},
{
D2: "第二次",
D1: "",
D2: '第二次',
D1: ''
},
{
D2: "第三次",
D1: "",
},
];
D2: '第三次',
D1: ''
}
]
}
} else {
this.getYsjl();
this.getParam();
this.getJyxm(1);
this.getJyxmInfoByYsjl();
this.getYsjl()
this.getParam()
this.getJyxm(1)
this.getJyxmInfoByYsjl()
}
this.getDepartment();
this.getDepartment()
// this.getDicJyxm(1)
this.userList = this.$store.getters.allUser.filter(
(user) => user.departmentId === 74 && user.clientType === "System"
);
(user) => user.departmentId === 74 && user.clientType === 'System'
)
},
methods: {
getDepartment() {
getDepartmentTreeList().then((res) => {
this.tree = res;
});
this.tree = res
})
},
handleChange(v) {
this.ysjl.departmentId = v[1];
this.ysjl.departmentId = v[1]
},
initYsjl() {
this.ysjlService.init(this.$route.query).then((data) => {
this.ysjl = data.ysjl;
this.param = data.param ? data.param : {};
this.ysjl.jianyanjieshuriqi = this.formatter.dateFormat("YYYY-MM-dd");
this.ysjl.bglx = 1;
this.ysjl.cjState = "ysjl";
this.ysjl.xianchangjianyantiaojian = "符合";
this.departmentId = this.ysjl.departmentId;
if (data.ysjl.shebeileibiedaima === "3300") {
this.jlbh4 = "(F)";
} else if (data.ysjl.shebeileibiedaima === "3200") {
this.jlbh4 = "(Y)";
} else if (data.ysjl.shebeileibiedaima === "3400") {
if (data.ysjl.shebeipinzhongdaima === "3420") {
this.jlbh4 = "(X)";
} else if (data.ysjl.shebeipinzhongdaima === "3430") {
this.jlbh4 = "(Z)";
this.ysjl = data.ysjl
this.param = data.param ? data.param : {}
this.ysjl.jianyanjieshuriqi = this.formatter.dateFormat('YYYY-MM-dd')
this.ysjl.bglx = 1
this.ysjl.cjState = 'ysjl'
this.ysjl.xianchangjianyantiaojian = '符合'
this.departmentId = this.ysjl.departmentId
if (data.ysjl.shebeileibiedaima === '3300') {
this.jlbh4 = '(F)'
} else if (data.ysjl.shebeileibiedaima === '3200') {
this.jlbh4 = '(Y)'
} else if (data.ysjl.shebeileibiedaima === '3400') {
if (data.ysjl.shebeipinzhongdaima === '3420') {
this.jlbh4 = '(X)'
} else if (data.ysjl.shebeipinzhongdaima === '3430') {
this.jlbh4 = '(Z)'
}
} else {
this.jlbh4 = "(C)";
this.jlbh4 = '(C)'
}
this.getJyxm(1);
this.getSbList();
this.jybgTemplateId = this.ysjl.jybgTemplateId;
console.log(this.ysjl.jybgTemplateId);
});
this.getJyxm(1)
this.getSbList()
this.jybgTemplateId = this.ysjl.jybgTemplateId
console.log(this.ysjl.jybgTemplateId)
})
},
getSbList() {
this.api({
url: "/sedirectory/getList",
method: "get",
url: '/sedirectory/getList',
method: 'get',
params: {
sbzl: this.$route.query.sbzldm,
sblb: this.$route.query.sblbdm,
level: 2,
},
level: 2
}
}).then((data) => {
this.xinghaoList = data;
});
this.xinghaoList = data
})
},
getJyxmInfoByYsjl() {
this.ysjlService.getJyxmInfoByYsjl(this.ysjlId).then((data) => {
if (!data.fbjyxm) {
return;
return
}
const fubiao = JSON.parse(data.fbjyxm);
const fubiao = JSON.parse(data.fbjyxm)
if (!fubiao.length) {
return;
return
}
if (fubiao[0]) {
this.fubiao1 = fubiao[0];
this.fubiao1 = fubiao[0]
}
if (fubiao[1]) {
this.fubiao2 = fubiao[1];
this.fubiao2 = fubiao[1]
}
if (fubiao[2]) {
this.fubiao3 = fubiao[2];
this.fubiao3 = fubiao[2]
}
console.log(this.fubiao1);
});
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 = "";
this.ysjl = data
this.departmentId = this.ysjl.departmentId
this.jybgTemplateId = this.ysjl.jybgTemplateId
this.ysjl.imagePath = ''
if (
this.ysjl.jianyanrenyuan !== null &&
this.ysjl.jianyanrenyuan.length > 0
) {
this.jianyanrenyuan = this.common.convertCnName(
this.ysjl.jianyanrenyuan
);
)
}
this.ysjlService
.judgeRepeat(this.ysjl.jilubianhao, this.ysjl.id)
.then((data) => {
this.isRepeat = data;
});
});
this.isRepeat = data
})
})
},
getParam() {
const id = this.ysjlId || this.$route.query.templateId;
const id = this.ysjlId || this.$route.query.templateId
this.ysjlService.getParam(id, this.$route.query.sbzldm).then((data) => {
this.param = data;
});
this.param = data
})
},
judgeRepeat(bianhao, id) {
this.api({
url: "/ysjl/judgeRepeat",
method: "get",
url: '/ysjl/judgeRepeat',
method: 'get',
params: {
ysjlId: id,
bianhao: bianhao,
},
bianhao: bianhao
}
}).then((data) => {
if (data > 0) {
this.isRepeat = true;
this.isRepeat = true
} else {
this.isRepeat = false;
this.isRepeat = false
}
});
})
},
getJyxm(sort) {
console.log(this.jybgTemplateId, this.ysjl.jybgTemplateId);
if (this.$route.query.state === "update") {
console.log(this.jybgTemplateId, this.ysjl.jybgTemplateId)
if (this.$route.query.state === 'update') {
this.jyxmService
.getJdCyJyxm(this.ysjlId, this.$route.query.templateId, sort, 0)
.then((data) => {
this.bgfyData = data;
this.tableJs.getData(this.cols, this.rows, this.bgfyData);
});
this.bgfyData = data
this.tableJs.getData(this.cols, this.rows, this.bgfyData)
})
this.jyxmService
.getJdCyJyxm(this.ysjlId, this.ysjl.jybgTemplateId, sort, 1)
.then((data) => {
this.jybgData = data;
});
this.jybgData = data
})
} else {
this.jyxmService
.getCyJyxm(this.$route.query.templateId, sort)
.then((data) => {
data.forEach((row) => {
row.dicJyxmId = row.id;
});
this.bgfyData = data;
this.tableJs.getData(this.cols, this.rows, this.bgfyData);
});
row.dicJyxmId = row.id
})
this.bgfyData = data
this.tableJs.getData(this.cols, this.rows, this.bgfyData)
})
this.jyxmService
.getCyJyxm(this.ysjl.jybgTemplateId, sort)
.then((data) => {
data.forEach((row) => {
row.dicJyxmId = row.id;
});
this.jybgData = data;
});
row.dicJyxmId = row.id
})
this.jybgData = data
})
}
},
/**
* 查询最大记录编号
*/
getMaxBh() {
const aheadPart = this.jlbh1 + this.jlbh2 + "-";
const aheadPart = this.jlbh1 + this.jlbh2 + '-'
this.api({
url: "/ysjl/gainCurrentBh",
method: "get",
url: '/ysjl/gainCurrentBh',
method: 'get',
params: {
aheadPart: aheadPart,
hinderPart: "",
},
hinderPart: ''
}
}).then((data) => {
this.jlbh3 = data;
this.jlbh3 = data
this.ysjlService
.judgeRepeat(this.ysjl.jilubianhao, this.ysjl.id)
.then((data) => {
this.isRepeat = data;
});
});
this.isRepeat = data
})
})
},
/**
* 签名方法
* @param data
*/
signNameValue(data) {
this.ysjl.jianyanrenyuan = String(data.id);
this.jianyanrenyuan = data.name;
this.common.signName(this.ysjl.id, this.ysjl.jianyanrenyuan);
this.ysjl.jianyanrenyuan = String(data.id)
this.jianyanrenyuan = data.name
this.common.signName(this.ysjl.id, this.ysjl.jianyanrenyuan)
},
customClearSign(fieldName) {
const data = {
@ -1123,192 +1135,191 @@ export default {
this.ysjl.jianyanrenyuan &&
this.common
.deleteElement(
this.ysjl.jianyanrenyuan.split(","),
this.ysjl.jianyanrenyuan.split(','),
String(this.$store.getters.userId)
)
.join(","),
.join(','),
name:
this.jianyanrenyuan &&
this.common
.deleteElement(
this.jianyanrenyuan.split(","),
this.jianyanrenyuan.split(','),
this.$store.getters.nickname
)
.join(","),
fieldName: fieldName,
};
this.signNameValue(data);
.join(','),
fieldName: fieldName
}
this.signNameValue(data)
},
saveYsjl(operation) {
if (operation !== "add" && this.pic) {
this.uploadPhxsBase64File(operation);
if (operation !== 'add' && this.pic) {
this.uploadPhxsBase64File(operation)
} else {
this.buildSaveData(operation);
this.buildSaveData(operation)
}
},
sortClass(sortData) {
const groupBy = (array, f) => {
const groups = {};
const groups = {}
array.forEach((o) => {
const group = JSON.stringify(f(o));
groups[group] = groups[group] || [];
groups[group].push(o);
});
const group = JSON.stringify(f(o))
groups[group] = groups[group] || []
groups[group].push(o)
})
return Object.keys(groups).map((group) => {
return groups[group];
});
};
return groups[group]
})
}
const sorted = groupBy(sortData, (item) => {
return item.jybgJyjlIndex; //
});
return sorted;
return item.jybgJyjlIndex //
})
return sorted
},
buildSaveData(operation) {
const tableData = [];
const _this = this;
let fubiao;
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];
console.log(this.$refs.table4.tableData, 5555)
fubiao = [this.$refs.table4.tableData]
} else {
fubiao = [this.fubiao1, this.fubiao2, this.fubiao3];
fubiao = [this.fubiao1, this.fubiao2, this.fubiao3]
}
let arr = [];
const subArr = this.sortClass(this.jybgData);
let arr = []
const subArr = this.sortClass(this.jybgData)
subArr.map((item) => {
if (
item.some(
(k) => k.jianyanjieguo === "不符合" || k.jianyanjieguo === "X"
(k) => k.jianyanjieguo === '不符合' || k.jianyanjieguo === 'X'
)
) {
_this.jybgData[item[0].jybgJyjlIndex - 1].jianyanjielun = "不合格";
_this.jybgData[item[0].jybgJyjlIndex - 1].jianyanjielun = '不合格'
} else if (
item.every(
(k) => k.jianyanjieguo === "符合" || k.jianyanjieguo === "√"
(k) => k.jianyanjieguo === '符合' || k.jianyanjieguo === '√'
)
) {
_this.jybgData[item[0].jybgJyjlIndex - 1].jianyanjielun = "合格";
_this.jybgData[item[0].jybgJyjlIndex - 1].jianyanjielun = '合格'
} else if (
item.every(
(k) => k.jianyanjieguo === "无此项" || k.jianyanjieguo === "/"
(k) => k.jianyanjieguo === '无此项' || k.jianyanjieguo === '/'
)
) {
_this.jybgData[item[0].jybgJyjlIndex - 1].jianyanjielun = "无此项";
_this.jybgData[item[0].jybgJyjlIndex - 1].jianyanjielun = '无此项'
}
});
arr = arr.concat(this.bgfyData, this.jybgData);
})
arr = arr.concat(this.bgfyData, this.jybgData)
arr.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 ? row.jianyanjieguo : '',
jianyanjielun: row.jianyanjielun ? row.jianyanjielun : '',
jyxmMode: 0,
sort: row.sort,
orders: row.orders,
cjState: 0,
});
});
if (operation === "add") {
this.ysjl.jilubianhao = this.jlbh1 + this.jlbh2 + "-" + this.jlbh3;
this.save(operation, "post", tableData, fubiao);
} else if (operation === "build") {
this.ysjl.baogaobianhao = this.ysjl.jilubianhao;
cjState: 0
})
})
if (operation === 'add') {
this.ysjl.jilubianhao = this.jlbh1 + this.jlbh2 + '-' + this.jlbh3
this.save(operation, 'post', tableData, fubiao)
} else if (operation === 'build') {
this.ysjl.baogaobianhao = this.ysjl.jilubianhao
if (
this.ysjl.jilubianhao &&
this.ysjl.jilubianhao.indexOf("COPY") > -1
this.ysjl.jilubianhao.indexOf('COPY') > -1
) {
this.$message({
type: "error",
message: "请先修改报告编号,不允许携带COPY标志生成报告!",
});
return false;
type: 'error',
message: '请先修改报告编号,不允许携带COPY标志生成报告!'
})
return false
}
if (
this.ysjl.jianyanrenyuan === null ||
this.ysjl.jianyanrenyuan === ""
this.ysjl.jianyanrenyuan === ''
) {
this.$message({
type: "error",
message: "请先签名再生成报告!",
});
return false;
type: 'error',
message: '请先签名再生成报告!'
})
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;
'请将检验项目中的监检人员及监检日期填写完毕,再生成报告!'
)
return false
}
}
this.save(operation, "put", tableData, fubiao);
} else if (operation === "upd") {
this.save(operation, "put", tableData, fubiao);
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;
console.log(this.jybgData, 2222)
if (this.fromType !== 5 && this.fromType !== 6) { this.ysjl.imagePath = this.$refs.table1.imgPath }
//
if (this.isRepeat) {
this.$message({
message: "记录编号重复,请先修改记录编号再保存",
type: "error",
});
return false;
message: '记录编号重复,请先修改记录编号再保存',
type: 'error'
})
return false
} else {
this.$refs["ysjl"].validate((valid) => {
this.$refs['ysjl'].validate((valid) => {
if (valid) {
this.api({
url: "/ysjl",
url: '/ysjl',
method: type,
data: {
ysjl: this.ysjl,
param: this.param,
cyJyxm: {
ysjlId: this.ysjl.id,
fbjyxm: JSON.stringify(fubiao),
fbjyxm: JSON.stringify(fubiao)
},
jdJyxm: jyxm,
flag: operation,
},
flag: operation
}
}).then((data) => {
Utils.$emit("ysjl-db-list");
Utils.$emit('ysjl-db-list')
//
if (operation === "add") {
Utils.$emit("task-list");
this.ysjl.id = data;
this.param.ysjlId = data;
this.$message({ message: "保存成功", type: "success" });
this.uploadPhxsBase64File();
if (operation === 'add') {
Utils.$emit('task-list')
this.ysjl.id = data
this.param.ysjlId = data
this.$message({ message: '保存成功', type: 'success' })
this.uploadPhxsBase64File()
//
this.common.reloadViewToUpdateYsjl(this.ysjl);
} else if (operation === "upd") {
this.dialogRoleVisible = false;
this.$message({ message: "更新成功", type: "success" });
this.common.reloadViewToUpdateYsjl(this.ysjl)
} else if (operation === 'upd') {
this.dialogRoleVisible = false
this.$message({ message: '更新成功', type: 'success' })
//
this.$router.push({
query: merge(this.$route.query, {
jianyanrenyuan: this.ysjl.jianyanrenyuan,
}),
});
jianyanrenyuan: this.ysjl.jianyanrenyuan
})
})
} else {
// pdf
this.common.viewYsjlNoOpen(this.ysjl.id, "YSJL");
Utils.$emit("ysjl-list");
Utils.$emit("ysjl-yb-list");
Utils.$emit("bggl-daiban-list");
this.$message({ message: "生成报告成功", type: "success" });
this.common.delCurrentViews();
this.common.viewYsjlNoOpen(this.ysjl.id, 'YSJL')
Utils.$emit('ysjl-list')
Utils.$emit('ysjl-yb-list')
Utils.$emit('bggl-daiban-list')
this.$message({ message: '生成报告成功', type: 'success' })
this.common.delCurrentViews()
}
this.state = "update";
});
this.state = 'update'
})
}
});
})
}
},
@ -1317,33 +1328,33 @@ export default {
*/
uploadPhxsBase64File(operation) {
if (!this.pic) {
return false;
return false
}
this.uploadService
.uploadPhxsBase64File({
ysjlId: this.ysjl.id,
base64File: this.pic,
shebeizhongleidaima: this.ysjl.shebeizhongleidaima,
shebeizhongleidaima: this.ysjl.shebeizhongleidaima
})
.then(() => {
if (operation !== "add") {
this.buildSaveData(operation);
if (operation !== 'add') {
this.buildSaveData(operation)
}
});
})
},
changXh: function(val) {
const xinghao = this.xinghaoList.filter((xh) => xh.xinghao === val)[0];
const xinghao = this.xinghaoList.filter((xh) => xh.xinghao === val)[0]
this.$set(
this.param,
"jiandingbaogaobianhao",
(xinghao && xinghao.jiandingbaogaobianhao) || ""
);
'jiandingbaogaobianhao',
(xinghao && xinghao.jiandingbaogaobianhao) || ''
)
},
loadPhxsImage(data) {
this.pic = data;
},
},
};
this.pic = data
}
}
}
</script>
<style scoped>
.el-tag {

Loading…
Cancel
Save