|
@@ -122,7 +122,7 @@
|
|
|
v-if="
|
|
v-if="
|
|
|
(!row.reportApprovalStatus || row.reportApprovalStatus == 0) &&
|
|
(!row.reportApprovalStatus || row.reportApprovalStatus == 0) &&
|
|
|
row.status == 2 &&
|
|
row.status == 2 &&
|
|
|
- isEmptyObject(row.reportTemplateJson) &&
|
|
|
|
|
|
|
+ !hasTemplateReportData(row) &&
|
|
|
[2].includes(row.approvalStatus) &&
|
|
[2].includes(row.approvalStatus) &&
|
|
|
pageName == 'inspectionProjectEntrusted' &&
|
|
pageName == 'inspectionProjectEntrusted' &&
|
|
|
$hasPermission('qms:quality_work_order:generateReport')
|
|
$hasPermission('qms:quality_work_order:generateReport')
|
|
@@ -147,24 +147,26 @@
|
|
|
</el-dropdown-menu>
|
|
</el-dropdown-menu>
|
|
|
</el-dropdown>
|
|
</el-dropdown>
|
|
|
<el-link
|
|
<el-link
|
|
|
- v-if="
|
|
|
|
|
- row.reportApprovalStatus &&
|
|
|
|
|
- row.reportApprovalStatus != 3 &&
|
|
|
|
|
- !isEmptyObject(row.reportTemplateJson) &&
|
|
|
|
|
- row.status == 2 &&
|
|
|
|
|
- [2].includes(row.approvalStatus) &&
|
|
|
|
|
- pageName == 'inspectionProjectEntrusted' &&
|
|
|
|
|
- $hasPermission('qms:quality_work_order:generateReport')
|
|
|
|
|
- "
|
|
|
|
|
|
|
+ v-if="canViewTemplateReport(row)"
|
|
|
type="primary"
|
|
type="primary"
|
|
|
:underline="false"
|
|
:underline="false"
|
|
|
@click="openReport(row)"
|
|
@click="openReport(row)"
|
|
|
>查看检测报告</el-link
|
|
>查看检测报告</el-link
|
|
|
>
|
|
>
|
|
|
|
|
+ <!-- 外部(江南)回传的检验报告:整份文件。单据本身有模板报告时以模板为准,不再重复露出 -->
|
|
|
|
|
+ <el-link
|
|
|
|
|
+ v-if="canViewReportFile(row)"
|
|
|
|
|
+ type="primary"
|
|
|
|
|
+ :underline="false"
|
|
|
|
|
+ @click="openReportFiles(row)"
|
|
|
|
|
+ >检验报告</el-link
|
|
|
|
|
+ >
|
|
|
|
|
|
|
|
|
|
+ <!-- 检测报告审批只针对我方模板报告;没有模板数据(走江南回传文件)的单据不出现该入口 -->
|
|
|
<el-link
|
|
<el-link
|
|
|
v-if="
|
|
v-if="
|
|
|
(!row.reportApprovalStatus || row.reportApprovalStatus == 3) &&
|
|
(!row.reportApprovalStatus || row.reportApprovalStatus == 3) &&
|
|
|
|
|
+ hasTemplateReportData(row) &&
|
|
|
row.status == 2 &&
|
|
row.status == 2 &&
|
|
|
[2].includes(row.approvalStatus) &&
|
|
[2].includes(row.approvalStatus) &&
|
|
|
pageName == 'inspectionProjectEntrusted' &&
|
|
pageName == 'inspectionProjectEntrusted' &&
|
|
@@ -213,6 +215,7 @@
|
|
|
@reload="reload"
|
|
@reload="reload"
|
|
|
></ReportTemplateWrapper>
|
|
></ReportTemplateWrapper>
|
|
|
<sampleReport ref="sampleReportRef" @reload="reload"></sampleReport>
|
|
<sampleReport ref="sampleReportRef" @reload="reload"></sampleReport>
|
|
|
|
|
+ <reportFileDialog ref="reportFileDialogRef"></reportFileDialog>
|
|
|
|
|
|
|
|
<Transfer
|
|
<Transfer
|
|
|
v-if="transferVisible"
|
|
v-if="transferVisible"
|
|
@@ -245,6 +248,7 @@
|
|
|
import Transfer from './transfer.vue';
|
|
import Transfer from './transfer.vue';
|
|
|
import sampleReport from '@/views/inspectionWork/components/sampleReport.vue';
|
|
import sampleReport from '@/views/inspectionWork/components/sampleReport.vue';
|
|
|
import ReportTemplateWrapper from '@/views/inspectionReport/components/reportTemplateWrapper.vue';
|
|
import ReportTemplateWrapper from '@/views/inspectionReport/components/reportTemplateWrapper.vue';
|
|
|
|
|
+ import reportFileDialog from './reportFileDialog.vue';
|
|
|
import { queryTodo } from '@/api/bpm/task';
|
|
import { queryTodo } from '@/api/bpm/task';
|
|
|
|
|
|
|
|
import tabMixins from '@/mixins/tableColumnsMixin';
|
|
import tabMixins from '@/mixins/tableColumnsMixin';
|
|
@@ -276,7 +280,8 @@
|
|
|
Transfer,
|
|
Transfer,
|
|
|
bpmDetail,
|
|
bpmDetail,
|
|
|
sampleReport,
|
|
sampleReport,
|
|
|
- ReportTemplateWrapper
|
|
|
|
|
|
|
+ ReportTemplateWrapper,
|
|
|
|
|
+ reportFileDialog
|
|
|
},
|
|
},
|
|
|
mixins: [dictMixins, tabMixins],
|
|
mixins: [dictMixins, tabMixins],
|
|
|
props: {
|
|
props: {
|
|
@@ -703,8 +708,71 @@
|
|
|
async openReport(row) {
|
|
async openReport(row) {
|
|
|
const data = await getById(row.id);
|
|
const data = await getById(row.id);
|
|
|
row.reportApprovalTaskVos = data.reportApprovalTaskVos || {};
|
|
row.reportApprovalTaskVos = data.reportApprovalTaskVos || {};
|
|
|
|
|
+ // 列表接口只回「有没有模板报告」的标记(JSON 列在联表查询里拿不到),正文用详情数据覆盖
|
|
|
|
|
+ row.reportTemplateJson = data.reportTemplateJson || row.reportTemplateJson;
|
|
|
|
|
+ row.reportTemplateCode = data.reportTemplateCode || row.reportTemplateCode;
|
|
|
this.$refs.targetComponentRef.open({ row, item: {} }, true);
|
|
this.$refs.targetComponentRef.open({ row, item: {} }, true);
|
|
|
},
|
|
},
|
|
|
|
|
+ /* 外部回传的检验报告(江南理化委托),整份文件 */
|
|
|
|
|
+ openReportFiles(row) {
|
|
|
|
|
+ this.$refs.reportFileDialogRef.open({
|
|
|
|
|
+ id: row.id,
|
|
|
|
|
+ code: row.code,
|
|
|
|
|
+ files: row.reportFiles
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 单据是否已有我方模板检测报告数据。
|
|
|
|
|
+ *
|
|
|
|
|
+ * 江南回传报文里没有模板信息,模板报告来自正常走系统内部请托生成的那一份,
|
|
|
|
|
+ * 因此一张单可能「既有模板报告、又有江南文件」,展示时以模板报告为准。
|
|
|
|
|
+ * 优先用后端回填的 hasTemplateReport 标记:分页联表查询拿不到 JSON 列,
|
|
|
|
|
+ * 列表里的 reportTemplateJson 恒为空,不能用来判断。
|
|
|
|
|
+ */
|
|
|
|
|
+ hasTemplateReportData(row) {
|
|
|
|
|
+ if (!row) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (typeof row.hasTemplateReport === 'boolean') {
|
|
|
|
|
+ return row.hasTemplateReport;
|
|
|
|
|
+ }
|
|
|
|
|
+ const json = row.reportTemplateJson;
|
|
|
|
|
+ if (!json) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (Array.isArray(json)) {
|
|
|
|
|
+ return json.length > 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (typeof json !== 'object') {
|
|
|
|
|
+ return String(json).trim().length > 0 && String(json).trim() !== '{}';
|
|
|
|
|
+ }
|
|
|
|
|
+ return Object.keys(json).length > 0;
|
|
|
|
|
+ },
|
|
|
|
|
+ /* 模板检测报告入口:有模板数据 + 已报工 + 请托审批通过 + 受托页 + 报告查看权限 */
|
|
|
|
|
+ canViewTemplateReport(row) {
|
|
|
|
|
+ return (
|
|
|
|
|
+ !!row &&
|
|
|
|
|
+ !!row.reportApprovalStatus &&
|
|
|
|
|
+ row.reportApprovalStatus != 3 &&
|
|
|
|
|
+ this.hasTemplateReportData(row) &&
|
|
|
|
|
+ row.status == 2 &&
|
|
|
|
|
+ [2].includes(row.approvalStatus) &&
|
|
|
|
|
+ this.pageName == 'inspectionProjectEntrusted' &&
|
|
|
|
|
+ this.$hasPermission('qms:quality_work_order:generateReport')
|
|
|
|
|
+ );
|
|
|
|
|
+ },
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 江南文件报告入口:有回传文件,且当前单据看不到模板报告。
|
|
|
|
|
+ *
|
|
|
|
|
+ * 模板入口不可见的两种情形都要露出文件入口,避免两边都看不到:
|
|
|
|
|
+ * 单据本身没有模板报告数据;或者当前用户/当前页面没有模板报告入口(如检测请托页)。
|
|
|
|
|
+ */
|
|
|
|
|
+ canViewReportFile(row) {
|
|
|
|
|
+ if (!row || !row.reportFiles || !row.reportFiles.length) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ return !this.canViewTemplateReport(row);
|
|
|
|
|
+ },
|
|
|
|
|
|
|
|
isEmptyObject(obj = {}) {
|
|
isEmptyObject(obj = {}) {
|
|
|
return Object.keys(obj).length === 0;
|
|
return Object.keys(obj).length === 0;
|