diff --git a/.gitignore b/.gitignore index 74776a4..576fea8 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,8 @@ node_modules/ *.ntvs* *.njsproj *.sln +.gitnexus +.claude/ +package-lock.json +AGENTS.md +CLAUDE.md diff --git a/src/api/abnormal.js b/src/api/abnormal.js index 8f276ec..469b8d1 100644 --- a/src/api/abnormal.js +++ b/src/api/abnormal.js @@ -1,4 +1,5 @@ import { createAPI } from "@/utils/httpRequest.js"; +import http from "@/utils/httpRequest.js"; export const getAbnormalCodeList = data => createAPI(`abnormal/getAbnormalCodeList`,'post',data) export const getShopOrderData = data => createAPI(`abnormal/getShopOrderData`,'post',data) @@ -11,3 +12,11 @@ export const saveAbnormalDetail= data => createAPI(`abnormal/saveAbnormalDetail` export const closeFeedBack= data => createAPI(`abnormal/closeFeedBack`,'post',data) export const openFeedBack= data => createAPI(`abnormal/openFeedBack`,'post',data) + +// 下载责任认定书(docx)- rqrq +export const printResponsibilityBook = data => http({ + url: http.adornUrl('/abnormal/printResponsibilityBook'), + method: 'post', + responseType: 'blob', + data: http.adornData(data, false) +}) diff --git a/src/views/modules/Abnormal/AbnormalFeedBack.vue b/src/views/modules/Abnormal/AbnormalFeedBack.vue index 0e91c29..0695594 100644 --- a/src/views/modules/Abnormal/AbnormalFeedBack.vue +++ b/src/views/modules/Abnormal/AbnormalFeedBack.vue @@ -193,13 +193,14 @@ fixed="right" header-align="center" align="center" - width="340" + width="400" label="操作"> @@ -512,6 +524,7 @@ saveAbnormalDetail, openFeedBack, closeFeedBack, + printResponsibilityBook as printResponsibilityBookApi, } from "@/api/abnormal.js" import { getSOScheduleRoutingDataForShiyanshi, @@ -522,8 +535,12 @@ printABLabel, } from "@/views/modules/print/print_Abnormal_label.js" import {ossListForOther} from '@/api/ftp/oss.js' + import Chooselist from '@/views/modules/common/Chooselist' export default { name: 'AbnormalFeedBack', + components: { + Chooselist, + }, data () { return { upLoadModalFlag:false, @@ -638,6 +655,8 @@ disableFlag1:false, disableFlag2:false, disableFlag3:false, + tagNo: '', + chooseOperatorType: '', abnormalList:[], abnormalFeedBackData:{ @@ -722,6 +741,37 @@ this.abnormalList = data.rows; }) }, + // 责任人快捷查询(符号26)- rqrq + getBaseList (val, type) { + this.tagNo = val + this.chooseOperatorType = type + this.$nextTick(() => { + let strVal = '' + if (val === 26) { + strVal = type === 'main' ? this.abnormalFeedBackData.mainResponsibleDesc : this.abnormalFeedBackData.secondaryResponsibleDesc + } + this.$refs.baseList.init(val, strVal) + }) + }, + /* 快捷查询回调(通过 type 区分主/次责任人)- rqrq */ + getBaseData (val) { + if (this.tagNo === 26) { + if (this.chooseOperatorType === 'main') { + this.abnormalFeedBackData.mainResponsible = val.OperatorID + this.abnormalFeedBackData.mainResponsibleDesc = val.OperatorName + } else if (this.chooseOperatorType === 'secondary') { + this.abnormalFeedBackData.secondaryResponsible = val.OperatorID + this.abnormalFeedBackData.secondaryResponsibleDesc = val.OperatorName + } + } + }, + openResponsibleChooseList (type) { + // 仅在紧急/长久处理编辑模式允许选择责任人 - rqrq + if (!this.disableFlag4) { + return + } + this.getBaseList(26, type) + }, search(){ getAbnormalFeedBackList(this.searchData).then(({data}) => { this.tableData = data.rows; @@ -872,6 +922,12 @@ if(this.abnormalFeedBackData.status=='已录入'){ this.abnormalFeedBackData.status='已填写紧急处理' } + // 打开弹窗时若未指定主要责任人,默认取主记录操作员 - rqrq + if((this.abnormalFeedBackData.mainResponsible==null||this.abnormalFeedBackData.mainResponsible==='') && + this.abnormalFeedBackData.operatorId!=null&&this.abnormalFeedBackData.operatorId!==''){ + this.abnormalFeedBackData.mainResponsible=this.abnormalFeedBackData.operatorId + this.abnormalFeedBackData.mainResponsibleDesc=this.abnormalFeedBackData.operatorDesc + } this.disableFlag1=true; this.disableFlag2=false; this.disableFlag3=true; @@ -883,6 +939,12 @@ if(this.abnormalFeedBackData.status=='已录入'||this.abnormalFeedBackData.status=='已填写紧急处理'){ this.abnormalFeedBackData.status='已填写长久处理' } + // 打开弹窗时若未指定主要责任人,默认取主记录操作员 - rqrq + if((this.abnormalFeedBackData.mainResponsible==null||this.abnormalFeedBackData.mainResponsible==='') && + this.abnormalFeedBackData.operatorId!=null&&this.abnormalFeedBackData.operatorId!==''){ + this.abnormalFeedBackData.mainResponsible=this.abnormalFeedBackData.operatorId + this.abnormalFeedBackData.mainResponsibleDesc=this.abnormalFeedBackData.operatorDesc + } this.disableFlag1=true; this.disableFlag2=true; this.disableFlag3=false; @@ -1028,6 +1090,30 @@ printABLabel(data.rows); }) }, + printResponsibilityBook(row){ + if(row.treatment==null||row.treatment.trim()==''){ + this.$alert("请先填写长久处理方式,才能打印责任书", '错误', { + confirmButtonText: '确定' + }) + return false + } + printResponsibilityBookApi({id:row.id}).then(({data}) => { + const blob = new Blob([data], {type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'}) + const fileName = "生产异常_批量报废责任认定书_" + (row.seqNo||row.id) + ".docx" + const linkNode = document.createElement('a') + linkNode.download = fileName + linkNode.style.display = 'none' + linkNode.href = URL.createObjectURL(blob) + document.body.appendChild(linkNode) + linkNode.click() + URL.revokeObjectURL(linkNode.href) + document.body.removeChild(linkNode) + }).catch(() => { + this.$alert("打印责任书失败,请稍后重试", '错误', { + confirmButtonText: '确定' + }) + }) + }, downloadFile(row){ downLoadProjectFile(row) diff --git a/src/views/modules/common/Chooselist.vue b/src/views/modules/common/Chooselist.vue index aabfe35..a745394 100644 --- a/src/views/modules/common/Chooselist.vue +++ b/src/views/modules/common/Chooselist.vue @@ -98,11 +98,22 @@ export default { } }, methods: { + // 快捷查询入参归一化:null/undefined/null字符串转空,避免首查命中 "null" - rqrq + normalizeQuickParam (val) { + if (val === null || val === undefined) { + return '' + } + const str = String(val).trim() + if (str.toLowerCase() === 'null' || str.toLowerCase() === 'undefined') { + return '' + } + return str + }, // 获取 用户的配置 init(tagNo,param) { this.visible = true; - this.param = param + this.param = this.normalizeQuickParam(param) // 根据 tagNo 获取列表 getChooselist({"tagNo": tagNo}).then(({data}) => { this.columnList = [] diff --git a/src/views/modules/common/Chooselist_eam.vue b/src/views/modules/common/Chooselist_eam.vue index 4da01b3..e524637 100644 --- a/src/views/modules/common/Chooselist_eam.vue +++ b/src/views/modules/common/Chooselist_eam.vue @@ -130,13 +130,35 @@ export default { } }, methods: { + // 快捷查询入参归一化:null/undefined/null字符串转空,避免首查命中 "null" - rqrq + normalizeQuickParam (val) { + if (val === null || val === undefined) { + return '' + } + const str = String(val).trim() + if (str.toLowerCase() === 'null' || str.toLowerCase() === 'undefined') { + return '' + } + return str + }, + // 仅兜底空值,保留SQL条件原格式(含前导空格)- rqrq + normalizeConSql (val) { + if (val === null || val === undefined) { + return '' + } + const str = String(val) + if (str.trim().toLowerCase() === 'null' || str.trim().toLowerCase() === 'undefined') { + return '' + } + return str + }, // 获取 用户的配置 init (tagNo, param, conSql) { this.tagNo = tagNo this.visible = true - this.param = param - this.conSql = conSql ? conSql : '' + this.param = this.normalizeQuickParam(param) + this.conSql = this.normalizeConSql(conSql) // 根据 tagNo 获取列表 getChooselistEam({"tagNo": tagNo}).then(({data}) => { this.columnList = []