From 48fc5c4139aec46e7b31551092ab398d18f7972a Mon Sep 17 00:00:00 2001 From: gaoluyang <2820782392@qq.com> Date: 星期三, 16 四月 2025 15:22:33 +0800 Subject: [PATCH] 管理岗权限添加原始记录查看权限 --- src/views/business/inspectionView/index.vue | 3155 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/views/business/inspectionTask/inspection.vue | 4 src/views/business/productOrder/index.vue | 38 src/views/business/materialOrder/index.vue | 67 4 files changed, 3,234 insertions(+), 30 deletions(-) diff --git a/src/views/business/inspectionTask/inspection.vue b/src/views/business/inspectionTask/inspection.vue index 479f069..b8e35ca 100644 --- a/src/views/business/inspectionTask/inspection.vue +++ b/src/views/business/inspectionTask/inspection.vue @@ -501,13 +501,17 @@ <el-button :loading="reviewLoading" type="primary" @click="upInsReview(1)">纭� 瀹�</el-button> </span> </el-dialog> + <!-- 娣诲姞涓嶅悎鏍煎娴嬪脊妗�--> <add-un-pass v-if="addUnPassDialog" ref="addUnPassDialog" :addUnPassDialog="addUnPassDialog" @resetAddUnPass="resetAddUnPass"></add-un-pass> + <!-- 涓嶅悎鏍煎鐞嗗脊妗�--> <UnPassDialog v-if="unPassDialog" ref="unPassDialog" :orderId="orderId" :unPassDialog="unPassDialog" @resetForm="resetForm"></UnPassDialog> + <!-- 涓嶅悎鏍煎娴嬪脊妗�--> <InspectionWord v-if="unPassCheck" :inspectorList="inspectorList" :orderId="orderId" :rawMaterialTag="rawMaterialTag" :sonLaboratory="sonLaboratory" :state="state" :typeSource="typeSource" :unPassCheck="unPassCheck" @closeUnPassCheckDialog="closeUnPassCheckDialog" @refreshView="refreshView" /> + <!-- 杩涜揣楠岃瘉寮规--> <purchase-verification v-if="purchaseDialog" ref="purchaseDialog" :orderId="orderId" :purchaseDialog="purchaseDialog" @resetPurchaseDialog="resetPurchaseDialog"></purchase-verification> <!--鏌ョ湅宸ユ椂寮规--> diff --git a/src/views/business/inspectionView/index.vue b/src/views/business/inspectionView/index.vue new file mode 100644 index 0000000..f160492 --- /dev/null +++ b/src/views/business/inspectionView/index.vue @@ -0,0 +1,3155 @@ +<template> + <div v-loading="loading" class="inspection" style="background-color: rgb(245, 247, 251);"> + <el-row class="title"> + <el-col :span="8" style="text-align: left"> + <el-form :inline="true" :model="otherForm" class="form-inline" label-width="50px" + style="text-align: right; padding-top: 0; display: inline"> + <el-form-item label="娓╁害:" style="margin-bottom: 0"> + <el-input v-model="otherForm.temperature" :disabled="state > 1" placeholder="" size="small" + style="width: 90px; line-height: 60px" @change="(m) => subOtherForm(m, 'temperature')"></el-input> + <span style="margin-left: 4px">鈩�</span> + </el-form-item> + <el-form-item label="婀垮害:" style="margin-bottom: 0"> + <el-input v-model="otherForm.humidity" :disabled="state > 1" placeholder="" size="small" + style="width: 90px; line-height: 60px" @change="(m) => subOtherForm(m, 'humidity')"></el-input> + <span style="margin-left: 4px">%</span> + </el-form-item> + </el-form> + </el-col> + <el-col :span="16" style="text-align: right"> + <el-button size="small" type="primary" @click="refreshView">鍒锋柊</el-button> + <el-button v-if="typeSource == 1" size="small" type="primary" @click="openPurchase">杩涜揣楠岃瘉</el-button> + <el-button v-if="state == 1 && typeSource == 1" size="small" type="primary" + @click="openUnPassDialog('add')">涓嶅悎鏍煎鐞�</el-button> + <el-button size="small" type="primary" @click="sampleVisible = true; uploadSample();">鏍峰搧鍒囨崲</el-button> + <!-- <el-button v-if="state == 1" size="small" type="primary" @click="taskVisible = true">浠诲姟鍒囨崲</el-button>--> + <el-button v-if="state == 1" size="small" type="primary" @click="addVerifyDia = true">鎻愪氦</el-button> + <!-- 澶嶆牳 --> + <el-button v-if="state == 2" size="medium" type="primary" @click="openAddCheck">閫氳繃</el-button> + <el-button v-if="state == 2" size="medium" @click="upInsReview(0)">涓嶉�氳繃</el-button> + <el-button type="primary" size="small" @click="exportTable('myTable')">涓嬭浇鍘熷璁板綍</el-button> + <el-button size="small" @click="goback">杩斿洖</el-button> + </el-col> + </el-row> + <div class="search"> + <el-form :inline="true" :model="searchForm" class="form-inline" label-position="right" label-width="100px"> + <el-form-item label="濮旀墭缂栧彿:"> + <el-input v-model="insOrder.entrustCode" clearable disabled placeholder="璇疯緭鍏�" size="small"></el-input> + </el-form-item> + <el-form-item label="鏍峰搧缂栧彿:"> + <el-tooltip :content="currentSample.sampleCode" :disabled="!currentSample.sampleCode"> + <el-input v-model="currentSample.sampleCode" clearable disabled placeholder="璇疯緭鍏�" size="small"></el-input> + </el-tooltip> + </el-form-item> + <el-form-item label="鏍峰搧鍚嶇О:"> + <el-input v-model="currentSample.sample" clearable disabled placeholder="璇疯緭鍏�" size="small"></el-input> + </el-form-item> + <el-form-item label="鏍峰搧鏁伴噺:"> + <el-input v-model="sampleProduct.length" clearable disabled placeholder="璇疯緭鍏�" size="small"></el-input> + </el-form-item> + <el-form-item label="鏍峰搧鍨嬪彿:"> + <el-input v-model="currentSample.model" clearable disabled placeholder="璇疯緭鍏�" size="small"></el-input> + </el-form-item> + <el-form-item label="涓嬪彂鏃堕棿:"> + <el-input v-model="insOrder.sendTime" clearable disabled placeholder="璇疯緭鍏�" size="small"></el-input> + </el-form-item> + <el-form-item label="绱ф�ョ▼搴�:"> + <el-input v-model="insOrder.typeName" clearable disabled placeholder="璇疯緭鍏�" size="small"></el-input> + </el-form-item> + <el-form-item label="绾﹀畾鏃堕棿:"> + <el-input v-model="insOrder.appointed" clearable disabled placeholder="璇疯緭鍏�" size="small"></el-input> + </el-form-item> + <el-form-item v-if="typeSource === 1" label="鎶芥鏁伴噺:"> + <el-input v-model="insOrder.testQuantity" clearable disabled placeholder="璇疯緭鍏�" size="small"></el-input> + </el-form-item> + <el-form-item v-if="typeSource === 1" label="鍘傚瀵嗗害:"> + <el-input v-model="supplierDensity" clearable disabled placeholder="璇疯緭鍏�" size="small"></el-input> + </el-form-item> + <el-form-item label="褰撳墠鏍峰搧浣嶆暟:" label-width="120px"> + <el-tag v-if="currentKey">{{ `NO.${currentKey}` }}</el-tag> + </el-form-item> + <el-form-item label="澶囨敞:"> + <!-- <span style="color:red">{{ insOrder.remark?insOrder.remark:'-' }}</span>--> + <el-input v-model="insOrder.remark" :disabled="state != 1" clearable placeholder="璇疯緭鍏�" size="small" + @blur="subOtherForm(insOrder.remark, 'remark')"></el-input> + <!-- <el-tag v-if="currentKey">{{ insOrder.remark }}</el-tag> --> + </el-form-item> + </el-form> + </div> + <div class="center"> + <div class="search" style=" + text-align: left; + display: flex; + align-items: center; + justify-content: space-between; + "> + <div style="display: flex; align-items: center"> + <span v-if="tableList.length > 0">妫�楠屾ā鏉匡細</span> + <el-radio-group v-model="currentTable" size="small"> + <el-radio-button v-for="(item, index) in tableLists" :key="index" :label="item.templateId" size="small">{{ + item.templateName }}</el-radio-button> + </el-radio-group> + </div> + <div style="display: flex; align-items: center"> + <el-button v-if="state == 1" size="small" type="primary" @click="openAddUnpass">鏂板涓嶅悎鏍煎娴�</el-button> + <el-button v-if="state == 1" size="small" type="primary" @click="unpassCheck">涓嶅悎鏍煎娴�</el-button> + <el-button v-if="state > 1" size="small" type="primary" @click="viewUnpassCheck">鏌ョ湅涓嶅悎鏍煎娴�</el-button> + <span v-if="cableTagList.length > 0"> 鐢电紗閰嶇疆锛�</span> + <el-select v-if="cableTagList.length > 0" v-model="currentTab" clearable placeholder="璇烽�夋嫨" size="small" + @change="(m) => handleChangeCableTag(currentSample.id, 0, 'cableTag', m) + " @focus="getCableTag(currentSample.id)"> + <el-option v-for="item in cableTagList" :key="item.cableTag" :label="item.cableTag" :value="item.cableTag"> + <span style="float: left">{{ item.cableTag }}</span> + <el-tag v-if="item.status == 0" size="small" style="float: right; margin-top: 5px" + type="danger">鏈</el-tag> + <el-tag v-if="item.status == 1" size="small" style="float: right; margin-top: 5px" + type="warning">妫�楠屼腑</el-tag> + <el-tag v-if="item.status == 2" size="small" style="float: right; margin-top: 5px" + type="success">宸叉</el-tag> + </el-option> + </el-select> + <span v-if="repetitionTagList.length > 0"> 閲嶅妫�楠岄」锛�</span> + <el-select v-if="repetitionTagList.length > 0" v-model="repetitionTag" clearable placeholder="璇烽�夋嫨" + size="small" @change="(m) => + handleChangeCableTag(currentSample.id, 0, 'repetitionTag', m) + " @focus="getRepetitionTag(currentSample.id)"> + <el-option v-for="item in repetitionTagList" :key="item.repetitionTag" :label="item.radius" + :value="item.repetitionTag"> + <span style="float: left">{{ item.radius }}</span> + <el-tag v-if="item.status == 0" size="small" style="float: right; margin-top: 5px" + type="danger">鏈</el-tag> + <el-tag v-if="item.status == 1" size="small" style="float: right; margin-top: 5px" + type="warning">妫�楠屼腑</el-tag> + <el-tag v-if="item.status == 2" size="small" style="float: right; margin-top: 5px" + type="success">宸叉</el-tag> + </el-option> + </el-select> + <span v-if="typeSource == '1'"> 寰呮楠屾暟閲忥細</span> + <el-select v-if="typeSource == '1'" v-model="rawMaterialTag" placeholder="璇烽�夋嫨" size="small" @change="(m) => handleChangeCableTag(currentSample.id, 4, 'cableTag', m) + " @focus="getRawMaterialTag(currentSample.id)"> + <el-option v-for="item in rawMaterialTagList" :key="item.rawMaterialTag" :label="item.rawMaterialTag" + :value="item.rawMaterialTag"> + <span style="float: left">{{ item.rawMaterialTag }}</span> + <el-tag v-if="item.status == 0" size="small" style="float: right; margin-top: 5px" + type="danger">鏈</el-tag> + <el-tag v-if="item.status == 1" size="small" style="float: right; margin-top: 5px" + type="warning">妫�楠屼腑</el-tag> + <el-tag v-if="item.status == 2" size="small" style="float: right; margin-top: 5px" + type="success">宸叉</el-tag> + </el-option> + </el-select> + <el-button :loading="dataAcquisitionLoading" v-if="state == 1" size="small" type="primary" + @click="getDataAcquisitionDevice">鏁版嵁閲囬泦</el-button> + <el-button :type="dataAcquisitionEidtAble ? '' : 'primary'" v-if="state == 1" size="small" + @click="dataAcquisitionEidtAble = !dataAcquisitionEidtAble">{{ dataAcquisitionEidtAble ? "鍏抽棴缂栬緫" : "缂栬緫鏁伴噰" + }}</el-button> + </div> + </div> + <!-- 甯歌妫�楠屽師濮嬭褰� --> + <div id="nav" v-loading="tableLoading" class="center-box"> + <template v-if=" + tableLists.find((m) => m.templateId == currentTable)"> + <table v-for="(item, index) in tableList" :key="index + currentTable + currentSample.id" border="1" + cellpadding="10" class="tables" id="myTable"> + <tbody> + <tr style="white-space: nowrap"> + 濮旀墭缂栧彿锛歿{ + insOrder.entrustCode + }} + </tr> + <tr v-for="(m, i) in item.arr" :key="i"> + <td v-for="(n, j) in m" v-if="n.v.mc == undefined || Object.keys(n.v.mc).length === 4" + :id="item.templateId + '-' + n.i + '-' + n.r + '-' + n.c" :key="j" + :colspan="n.v.mc && n.v.mc.cs ? n.v.mc.cs : 1" :rowspan="n.v.mc && n.v.mc.rs ? n.v.mc.rs : 1" :style="`background:${n.v.bg ? n.v.bg : ''};color:${n.v.fc + };font-size:${n.v.fs}px;width:${handleWidth( + n + )}px !important;height:${item.style.rowlen[n.r]}px;font-wight:${n.v.bl ? 'bold' : '' + };`"> + <div :class="`content-h-${n.v.ht} content-v-${n.v.vt}`" :style="`width:${handleWidth(n)}px !important;min-height:${item.style.rowlen[n.r] + }px;`" class="content"> + <template v-if=" + n.v.ps != undefined && + typeof n.v.ps.value === 'string' && + n.v.ps.value.includes('妫�楠屽��') && + state == 1 + "> + <el-input v-if="getInspectionValueType(n.i) == 1" + :key="'abc-' + '000' + index + '000' + i + '000' + j" v-model="n.v.v" :disabled="(getInspectionItemType(n.i) == 1 && + !dataAcquisitionEidtAble) || + (n.u != userId && n.u != undefined && n.u != '') + " class="table_input" @change="(m) => + changeInput( + m, + `${item.templateId}-${n.r}-${n.c}-${n.i}`, + n, + 'getDataType' + ) + " @input="handleInput(n)" @mousewheel.native.prevent @keydown.enter=" + changeInput( + '', + `${item.templateId}-${n.r}-${n.c}-${n.i}`, + n, + 'getDataType' + ) + "> + </el-input> + <el-input v-else-if="getInspectionValueType(n.i) == 2" v-model="n.v.v" :disabled="getInspectionItemType(n.i) == 1 || + (n.u != userId && n.u != undefined && n.u != '') + " class="table_input" type="textarea" @change="(m) => + changeInput( + m, + `${item.templateId}-${n.r}-${n.c}-${n.i}`, + n, + 'getDataType' + ) + " /> + <!-- <el-select v-else-if="getInspectionValueType(n.i) == 5" v-model="n.v.v" :disabled="state > 1 || + getInspectionItemType(n.i) == 1 || + (n.u != userId && n.u != undefined && n.u != '') + " class="table_input" @change="(m) => + changeInput( + m, + `${item.templateId}-${n.r}-${n.c}-${n.i}`, + n, + 'getDataType' + ) + " @visible-change="(e) => getDic(e, n.i)"> + <el-option v-for="(e, i) in enumList" :key="i" :label="e.label" :value="e.value"></el-option> + </el-select> --> + <span v-else-if="getInspectionValueType(n.i) == 4" + :style="`font-family:${n.v.ff} !important;`">/</span> + </template> + <template v-else-if="n.v.ps != undefined && n.v.ps.value === '缁撹'"> + <el-select v-if=" + (getInspectionValueType(n.i) == 2 || + getInspectionValueType(n.i) == 5) && + state == 1 + " v-model="n.v.v" class="table_input" @change="(m) => + changeInput( + m, + `${item.templateId}-${n.r}-${n.c}-${n.i}`, + n, + 'getDataType', + 'changeSelect' + ) + "> + <el-option :value="1" label="鍚堟牸"></el-option> + <el-option :value="0" label="涓嶅悎鏍�"></el-option> + <el-option :value="3" label="涓嶅垽瀹�"></el-option> + <el-option :value="2" label="寰呭畾"></el-option> + </el-select> + <template v-if="state > 1"> + <span v-if="n.v.v === 1" :style="`font-family:${n.v.ff} !important;color: green;`">鍚堟牸</span> + <span v-else-if="n.v.v === 0" :style="`font-family:${n.v.ff} !important;color: red;`">涓嶅悎鏍�</span> + <span v-else-if="n.v.v === 3" + :style="`font-family:${n.v.ff} !important;color: #3A7BFA;`">涓嶅垽瀹�</span> + <span v-else :style="`font-family:${n.v.ff} !important;`">寰呭畾</span> + </template> + <template v-if="getInspectionValueType(n.i) != 2 && + state == 1"> + <span v-if="n.v.v === 1" :style="`font-family:${n.v.ff} !important;color: green;`">鍚堟牸</span> + <span v-else-if="n.v.v === 0" :style="`font-family:${n.v.ff} !important;color: red;`">涓嶅悎鏍�</span> + <span v-else-if="n.v.v === 3" + :style="`font-family:${n.v.ff} !important;color: #3A7BFA;`">涓嶅垽瀹�</span> + <span v-else :style="`font-family:${n.v.ff} !important;`">寰呭畾</span> + </template> + </template> + <template v-else-if=" + n.v.ps != undefined && + n.v.ps.value === '璁惧缂栫爜' && + state == 1 + "> + <span>{{ n.v.v }}</span> + </template> + <template v-else-if=" + n.v.ps != undefined && n.v.ps.value === '璁惧鍚嶇О' + "> + <el-select v-model="n.v.v" :disabled="state > 1" class="table_input" filterable multiple + placeholder="璁惧" remote @change="(val) => changeEquip(val, n)" + @visible-change="(e) => getEquipOptions(e, n.i)"> + <el-option v-for="item in equipOptions" :key="item.value" :label="item.label" + :value="item.value"> + {{ item.label + "--" + item.value }} + </el-option> + </el-select> + </template> + <template v-else-if=" + n.v.ps != undefined && + n.v.ps.value === '瑕佹眰鍊�' && + state == 1 + "> + <span :style="`font-family:${n.v.ff} !important;`">{{ + getTell(n.i) + }}</span> + </template> + <template v-else-if=" + n.v.ps != undefined && + n.v.ps.value === '璁$畻鍊�' && + state == 1 + "><span :style="`font-family:${n.v.ff} !important;`">{{ + toFixed(n.v.v, n.v.ct) + }}</span></template> + <template v-else-if=" + n.v.ps != undefined && + n.v.ps.value === '鏈�缁堝��' && + state == 1 + "> + <span :style="`font-family:${n.v.ff} !important;`">{{ + toFixed(n.v.v, n.v.ct) + }}</span> + </template> + <template v-else-if=" + n.v.ps != undefined && n.v.ps.value === '鏍峰搧缂栧彿' + "> + <div :title="currentSample.sampleCode" style=" + display: flex; + flex-wrap: nowrap; + align-items: center; + width: 100%; + "> + <i class="el-icon-caret-left table_caret" style="width: 16px" @click="caretSample(-1)"></i> + <div + :style="`font-family:${n.v.ff} !important;overflow: hidden;white-space: nowrap;width: calc(100% - 32px);`"> + {{ currentSample.sampleCode }} + </div> + <i class="el-icon-caret-right table_caret" style="width: 16px" @click="caretSample(1)"></i> + </div> + </template> + <template v-else-if=" + n.v.ps != undefined && n.v.ps.value === '鏍峰搧鍨嬪彿' + "> + <div v-if=" + currentSample.model !== undefined && + currentSample.model !== null + " :style="`font-family:${n.v.ff} !important;`"> + {{ currentSample.model }} + </div> + </template> + <span v-else :style="`font-family:${n.v.ff} !important;`" v-html="getValue(n.v)"></span> + </div> + </td> + </tr> + </tbody> + </table> + </template> + </div> + <el-upload v-if="state == 1" ref="upload" :action="action" :before-upload="beforeUpload" :data="{ + orderId: id, + }" :headers="uploadHeader" :on-error="onError" :on-success="handleSuccessUp" :show-file-list="false" + accept=".jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip,.rar" + style="width: 80px !important;margin-top: 10px;"> + <el-button v-if="state == 1" size="small" type="primary">闄勪欢涓婁紶</el-button></el-upload> + <lims-table :tableData="tableData" :column="column" :page="page" :tableLoading="tableLoading" + :height="'calc(100vh - 290px)'" @pagination="pagination" style="height: 100%; margin-top: 16px"></lims-table> + </div> + <el-drawer :size="550" :visible.sync="sampleVisible" title="鏍峰搧鍒囨崲"> + <el-table v-if="sampleVisible" ref="productTable" :current-row-key="currentKey" :data="sampleProduct" + :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" border + :row-class-name="tableRowClassName" :row-key="(record) => record.index" border class="el-table" height="100%" + highlight-current-row tooltip-effect="dark" @row-click="handleChangeSample"> + <el-table-column :key="Math.random()" align="center" label="搴忓彿" type="index" width="70px"> + </el-table-column> + <el-table-column label="鏍峰搧缂栧彿" min-width="100px" prop="sampleCode" show-overflow-tooltip></el-table-column> + <el-table-column label="鏍峰搧鍨嬪彿" min-width="100px" prop="model" show-overflow-tooltip></el-table-column> + <el-table-column label="妫�娴嬬姸鎬�" prop="insState" show-overflow-tooltip width="100px"> + <template slot-scope="scope"> + <el-tag v-for="(item, i) in typeList" v-if="item.value == scope.row.insState" :key="i" :type="item.type" + size="medium" style="margin-right: 5px">{{ item.label }}</el-tag> + </template> + </el-table-column> + <el-table-column align="center" label="鏄惁鐣欐牱" prop="isLeave" show-overflow-tooltip width="95px"> + <template slot-scope="scope"> + <span>{{ scope.row.isLeave == 0 ? "鍚�" : "鏄�" }}</span> + </template> + </el-table-column> + <!-- 妫�楠屽崟浼氭湁涓�涓槸鍚︽湁閰嶅鏍峰搧瀛楁鎺у埗鏄剧ず --> + <el-table-column v-if="insOrder.mating > 0" label="閰嶅鏍峰搧鍨嬪彿" min-width="130px" prop="joinModel" + show-overflow-tooltip></el-table-column> + <el-table-column v-if="insOrder.mating > 0" label="閰嶅鏍峰搧鍚嶇О" min-width="130px" prop="joinName" + show-overflow-tooltip></el-table-column> + <el-table-column v-if="insOrder.mating > 0" label="閰嶅鏍峰搧鏁伴噺" min-width="130px" prop="joinNum" + show-overflow-tooltip></el-table-column> + </el-table> + </el-drawer> + <el-drawer :size="500" :visible.sync="taskVisible" title="浠诲姟鍒囨崲"> + <lims-table :tableData="tableData0" :column="column0" :page="page0" :tableLoading="tableLoading0" + :height="'calc(100vh - 90px)'" :currentChange="handleChangeTask"></lims-table> + </el-drawer> + <el-dialog :visible.sync="reviewDia" title="妫�楠屽鏍�" width="500px"> + <div v-if="reviewDia" class="body" style="display: flex; padding: 10px"> + <div class="search_label" style="width: 150px"> + <span class="required-span">* </span>涓嶉�氳繃鐨勭悊鐢憋細 + </div> + <div class="search_input" style="width: 100%"> + <el-input v-model="noReason" :autosize="{ minRows: 4 }" clearable size="small" type="textarea"></el-input> + </div> + </div> + <span slot="footer" class="dialog-footer"> + <el-button @click="reviewDia = false">鍙� 娑�</el-button> + <el-button :loading="reviewLoading" type="primary" @click="handleReviewDia">纭� 瀹�</el-button> + </span> + </el-dialog> + <el-dialog :visible.sync="addVerifyDia" title="鎸囧畾澶嶆牳浜哄憳" width="400px"> + <div class="body" style="display: flex; padding: 10px; align-items: center"> + <div class="search_label" style="width: 150px"> + <span class="required-span">*</span>澶嶆牳浜� + </div> + <div class="search_input" style="width: 100%"> + <el-select v-model="verifyUser" clearable filterable placeholder="璇烽�夋嫨" size="small" style="width: 100%"> + <el-option v-for="(item, i) in personList" :key="i" :label="item.label" :value="item.value"> + </el-option> + </el-select> + </div> + </div> + <span slot="footer" class="dialog-footer"> + <el-button @click="addVerifyDia = false">鍙� 娑�</el-button> + <el-button :loading="submitLoading" type="primary" @click="submit()">纭� 瀹�</el-button> + </span> + </el-dialog> + <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :show-close="false" + :visible.sync="dataGetDia" title="鏁版嵁閲囬泦" width="80%"> + <div> + <table border="1" cellpadding="10" class="thermal-table"> + <tr> + <td style="width: 120px">妫�楠岄」鍒嗙被</td> + <td style="width: 120px">妫�楠岄」</td> + <td style="width: 120px">妫�楠屽瓙椤�</td> + <td>鏁伴噰鏁版嵁</td> + </tr> + <template v-for="(item, index) in getData"> + <tr> + <td :rowspan="item.child.length">{{ item.sortName }}</td> + <td :rowspan="item.child.length">{{ item.faName }}</td> + <td>{{ item.child[0].name }}</td> + <td style="text-align: left"> + <el-select v-if="item.child[0].isShowSelect" v-model="item.child[0].getDataIndex1" + :multiple-limit="item.child[0].maxNum" clearable filterable multiple placeholder="璇烽�夋嫨" + @change="setData(item)"> + <el-option v-for="(item, index) in item.child[0].arr" :key="index" :filter-method="filterMethod" + :label="index + 1 + '^' + item.result" :value="index + '^' + item.result"> + <span>{{ + "搴忓彿锛�" + + (index + 1) + + "锛�" + + "缁撴灉锛�" + + item.result + + "锛�" + + "鍘氬害锛�" + + item.thickness + + "锛�" + + "鏃堕棿锛�" + + item.mergedDateTime + }}</span> + </el-option> + </el-select> + <el-checkbox-group v-if="!item.child[0].isShowSelect" v-model="item.child[0].getDataIndex1" + :max="item.child[0].maxNum"> + <el-checkbox v-for="(n, j) in item.child[0].arr" :key="j" :label="j + '^' + n">{{ n }}</el-checkbox> + </el-checkbox-group> + </td> + </tr> + <tr v-for="(m, i) in item.child" v-show="i > 0" :key="i + 'bbbbbbbbbbbbbb'"> + <td>{{ m.name }}</td> + <td style="text-align: left"> + <el-select v-if="m.isShowSelect" v-model="m.getDataIndex1" :multiple-limit="m.maxNum" clearable + filterable multiple placeholder="璇烽�夋嫨"> + <el-option v-for="(item, index1) in m.arr" :key="index1" :label="index + 1 + '^' + item.result" + :value="index1 + '^' + item.result"> + <span>{{ + "搴忓彿锛�" + + (index1 + 1) + + "锛�" + + "缁撴灉锛�" + + item.result + + "锛�" + + "鍘氬害锛�" + + item.thickness + + "锛�" + + "鏃堕棿锛�" + + item.mergedDateTime + }}</span> + </el-option> + </el-select> + <el-checkbox-group v-if="!m.isShowSelect" v-model="m.getDataIndex1" :max="m.maxNum"> + <el-checkbox v-for="(n, j) in m.arr" :key="j" :label="j + '^' + n">{{ n }}</el-checkbox> + </el-checkbox-group> + </td> + </tr> + </template> + </table> + </div> + <span slot="footer" class="dialog-footer"> + <el-button @click="dataGetDia = false">鍙� 娑�</el-button> + <el-button :loading="getDataIndexLoading" type="primary" @click="submitDataGet()">纭� 瀹�</el-button> + </span> + </el-dialog> + <el-dialog :close-on-click-modal="false" :visible.sync="addCheck" title="鎸囧畾鎶ュ憡瀹℃牳浜哄憳" width="400px" + @close="closeAddVerifyDia"> + <div class="body" style="display: flex; padding: 10px; align-items: center"> + <div class="search_label" style="width: 150px"> + <span class="required-span">*</span>瀹℃牳浜猴細 + </div> + <div class="search_input" style="width: 100%"> + <el-select v-model="checkUser" clearable filterable placeholder="璇烽�夋嫨" size="small" style="width: 100%"> + <el-option v-for="(item, i) in personList" :key="i" :label="item.label" :value="item.value"> + </el-option> + </el-select> + </div> + </div> + <span slot="footer" class="dialog-footer"> + <el-button @click="closeAddVerifyDia">鍙� 娑�</el-button> + <el-button :loading="reviewLoading" type="primary" @click="upInsReview(1)">纭� 瀹�</el-button> + </span> + </el-dialog> + <!-- 娣诲姞涓嶅悎鏍煎娴嬪脊妗�--> + <add-un-pass v-if="addUnPassDialog" ref="addUnPassDialog" :addUnPassDialog="addUnPassDialog" + @resetAddUnPass="resetAddUnPass"></add-un-pass> + <!-- 涓嶅悎鏍煎鐞嗗脊妗�--> + <UnPassDialog v-if="unPassDialog" ref="unPassDialog" :orderId="orderId" :unPassDialog="unPassDialog" + @resetForm="resetForm"></UnPassDialog> + <!-- 涓嶅悎鏍煎娴嬪脊妗�--> + <InspectionWord v-if="unPassCheck" :inspectorList="inspectorList" :orderId="orderId" + :rawMaterialTag="rawMaterialTag" :sonLaboratory="sonLaboratory" :state="state" :typeSource="typeSource" + :unPassCheck="unPassCheck" @closeUnPassCheckDialog="closeUnPassCheckDialog" @refreshView="refreshView" /> + <!-- 杩涜揣楠岃瘉寮规--> + <purchase-verification v-if="purchaseDialog" ref="purchaseDialog" :orderId="orderId" + :purchaseDialog="purchaseDialog" @resetPurchaseDialog="resetPurchaseDialog"></purchase-verification> + <!--鏌ョ湅宸ユ椂寮规--> + <viewManHourDia ref="viewManHourDia" @submit="openAddVerifyDia"></viewManHourDia> + </div> +</template> + +<script> +import excelFunction from "@/utils/excelFountion"; +import limsTable from "@/components/Table/lims-table.vue"; +import UnPassDialog from "../unpass/components/unPassDialog.vue"; +import AddUnPass from "../unpass/components/addUnPass.vue"; +import InspectionWord from "../inspectionTask/components/InspectionWord.vue"; +import PurchaseVerification from "../unpass/components/PurchaseVerification.vue"; +import { + doInsOrder, + getCableTag, + getRepetitionTag, + getRawMaterialTag, + dataCollection, + write, + getInsProduct, + search, + verifyPlan, + checkSubmitPlan, + submitPlan, + saveInsContext, + selectUserCondition, + downFile, + getFileList, + delfile, + inspectionOrderDetailsTaskSwitching +} from "@/api/business/inspectionTask.js"; +import InspectionWorker from '@/workers/InspectionWorker.worker'; +import DataWorker from '../../../workers/DataWorker.worker'; +import html2canvas from "html2canvas"; +import { mapGetters } from "vuex"; +import viewManHourDia from "@/views/business/inspectionTask/components/viewManHourDia.vue"; +export default { + name: 'InspectionView', + components: { + viewManHourDia, + PurchaseVerification, + AddUnPass, + limsTable, + UnPassDialog, + InspectionWord, + }, + data() { + return { + sonLaboratory: null, + orderId: null, + state: null, + inspectorList: null, + typeSource: null, + sagData: [], + sagForm: { + sampleCode: null, + model: null, + inspection: null, + methodName: null, + tensileForce: null, + spanLength: null, + load: null, + }, + dataGetDia: false, + fileAdd: false, + sampleVisible: false, + taskVisible: false, + submitLoading: false, + searchForm: { + sampleName: null, + state: null, + }, + id: null, + changeType: null, + insOrder: {}, + sampleProduct: [], + supplierDensity: "", // 鍘傚瀵嗗害 + typeList: [], + urgentList: [], + currentSample: {}, //褰撳墠鏍峰搧淇℃伅 + tableList: [], + loading: false, + ps: {}, + param: {}, + currentKey: 1, + currentKey0: 1, + currentKey1: 1, + currentKey2: 1, + comparisonList: [], + excelMethodList: [], + equipOptions: [], + reviewLoading: false, + reviewDia: false, + noReason: "", + tableWidth: 1000, + currentTable: null, + tableLists: [], + widthList: [], + addVerifyDia: false, + verifyUser: null, + personList: [], + enumList: [], + tableLoading: false, + upLoading: false, + temptList: null, + currentTab: null, + wareForm: { + inspectionItem: 1, + inspectionItemSubclass: "20(甯告俯)", + }, + otherForm: { + humidity: null, + temperature: null, + }, + equipForm: { + value0: null, + code0: null, + value1: null, + code1: null, + }, + result: null, + worker: null, + worker0: null, + wareLength: [], + dataAcquisitionInfo: {}, + dataAcquisitionInfoNew: {}, + dataAcquisitionEidtAble: false, + dataAcquisitionLoading: false, + collected: false, + temDataAcquisition: false, + getData: [ + { + faName: "娉㈤暱闄勫姞琛板噺", + child: [ + { + name: "1285nm~1330nm", + arr: [12, 13, 14, 15], + }, + { + name: "1525nm~1575nm", + arr: [12, 13, 14, 15], + }, + ], + }, + { + faName: "鎴嚦娉㈤暱", + child: [ + { + name: "鎴嚦娉㈤暱", + arr: [12, 13, 14, 15], + }, + ], + }, + ], + getDataIndex: [], + getDataIndexLoading: false, + getDataTypeId: "", + getDataType: null, + unPassDialog: false, // 涓嶅悎鏍煎鐞嗗脊妗� + cableTagList: [], + rawMaterialTag: "", // 鎵规 + rawMaterialTagList: [], // 鎵规閫夐」 + addCheck: false, // 鎸囧畾瀹℃牳浜哄憳寮规 + checkUser: "", + addUnPassDialog: false, + type: "", + retestTag: "", + unPassCheck: false, + unPassTableList: [], + unPassTableLoading: false, + purchaseDialog: false, // 杩涜揣楠岃瘉鍘熷璁板綍寮规 + temCableTag: "", + repetitionTagList: [], + repetitionTag: "", + // 鏂囦欢鍒楄〃鐩稿叧--寮�濮� + tableData: [], + column: [ + { + label: "绫诲瀷", prop: "type", dataType: "tag", + formatData: (params) => { + if (params == 1) { + return '鍥剧墖' + } else { + return '鏂囦欢' + } + } + }, + { label: "闄勪欢鍚嶇О", prop: "fileName" }, + { label: "涓婁紶浜�", prop: "name" }, + { label: "涓婁紶鏃堕棿", prop: "createTime" }, + { + dataType: "action", + fixed: "right", + label: "鎿嶄綔", + operation: [ + { + name: "涓嬭浇", + type: "text", + clickFun: (row) => { + this.handleDown(row); + }, + }, + { + name: "鍒犻櫎", + type: "text", + clickFun: (row) => { + this.handleDelete(row); + }, + disabled: (row) => { + return this.state != 1; + }, + }, + ], + }, + ], + page: { + total: 0, + size: 10, + current: 0, + }, + tableLoading: false, + // 鏂囦欢鍒楄〃鐩稿叧--缁撴潫 + // 浠诲姟鍒囨崲鍒楄〃--寮�濮� + tableData0: [], + column0: [ + { label: "濮旀墭缂栧彿", prop: "entrustCode", width: '160px' }, + { label: "妫�楠屽璞�", prop: "sampleType", width: '140px' }, + { + label: "绱ф�ョ▼搴�", prop: "type", dataType: "tag", + formatData: (params) => { + return this.urgentList.find(m => m.value == params).label + }, + formatType: (params) => { + return this.urgentList.find(m => m.value == params).type + } + }, + { + label: "鐘舵��", prop: "insState", dataType: "tag", + formatData: (params) => { + return this.typeList.find(m => m.value == params).label + }, + formatType: (params) => { + return this.typeList.find(m => m.value == params).type + } + }, + { label: "绾﹀畾鏃堕棿", prop: "appointed", width: '140px' }, + { label: "涓嬪彂鏃堕棿", prop: "sendTime", width: '140px' }, + ], + page0: { + total: 0, + size: -1, + current: -1, + }, + tableLoading0: false, + // 浠诲姟鍒囨崲鍒楄〃--缁撴潫 + }; + }, + // 鐢ㄤ簬涓婁紶鏂囦欢鐨勪俊鎭� + computed: { + ...mapGetters(["userId"]), + action() { + return this.javaApi + "/insOrderPlan/uploadFile"; + }, + }, + created() { + let { sonLaboratory, orderId, state, inspectorList, typeSource } = + this.$route.query; + this.sonLaboratory = sonLaboratory; + this.orderId = orderId; + this.id = this.orderId; + this.state = state; + this.inspectorList = inspectorList; + this.typeSource = typeSource; + }, + mounted() { + this.getTypeDicts(); // 鑾峰彇绱ф�ョ▼搴︿笅鎷夋閫夐」 + this.getInsStateDicts(); + this.getComparisonList(); + this.getAuthorizedPerson(); + this.startWorker(); + // this.getList0() // 浠诲姟鍒囨崲 + this.scrollInit(); + }, + activated() { + this.getTypeDicts(); // 鑾峰彇绱ф�ョ▼搴︿笅鎷夋閫夐」 + this.getInsStateDicts(); + this.getComparisonList(); + this.getAuthorizedPerson(); + this.startWorker(); + // this.getList0() // 浠诲姟鍒囨崲 + this.scrollInit(); + }, + watch: { + // 鐩戝惉浠诲姟id锛岃幏鍙栦换鍔′俊鎭� + id(val) { + this.refreshView() + }, + // 鐩戝惉褰撳墠妯℃澘鍙樺寲 + currentTable(val1, val0) { + if (val0 != null && val1 != val0) { + if (this.changeType && this.changeType > 0) { + // 濡傛灉鏄厜绾ゃ�佸厜绾ゅ甫锛屽垯涓嶆墽琛屼笅闈㈡搷浣� + return; + } + this.tableLists.forEach(async (m, i) => { + if (m.templateId == val1) { + let list = await this.getCurrentProduct(this.currentSample.id, 0); + this.currentSample.insProduct = this.HaveJson(list); //璧嬪�煎綋鍓嶆牱鍝佺殑妫�楠岄」 + this.param = {}; //鍒濆鍖栦紶鍒板悗绔殑鍙傛暟 + this.currentSample.insProduct.forEach((a, j) => { + this.param[a.id] = { + insValue: [], + comValue: [], + resValue: null, + equipValue: [], + equipName: [], + insResult: null, + }; + }); + // 鍘婚噸妯℃澘锛岃繑鍥炴湁鍑犱釜妯℃澘 + const mySet1 = new Set(); + this.tableLists = this.currentSample.insProduct.filter((m) => { + let num0 = mySet1.size; + if (m.templateId != null && m.template != null) { + try { + mySet1.add( + JSON.stringify({ + template: m.template, + templateId: m.templateId, + }) + ); + } catch (error) { + console.log(222, error); + } + } + let num1 = mySet1.size; + if (num1 > num0) { + return m; + } + }); + if (this.tableLists && this.tableLists.length > 0) { + this.tableList = null; + this.tableList = this.tableLists.filter( + (m) => m.templateId == val1 + ); + // 瀵规ā鏉胯繘琛屽鐞� + this.handleTableData(); + } + } + }); + } + }, + // 鐗规畩妫�楠岄」--鐩戝惉璁惧淇℃伅鏀瑰彉 + equipForm: { + deep: true, + handler(val) { }, + }, + }, + beforeDestroy() { + // 鍦ㄧ粍浠堕攢姣佸墠纭繚鍋滄 Worker锛岄伩鍏嶅唴瀛樻硠婕� + this.stopWorker(); + }, + methods: { + // 鏂囦欢绠$悊--寮�濮� + getList() { + this.tableLoading = true; + let param = { ...this.page }; + delete param.total; + getFileList({ insOrderId: this.id, ...param }) + .then((res) => { + this.tableLoading = false; + if (res.code === 200) { + this.tableData = res.data.records; + this.page.total = res.data.total; + } + }) + .catch((err) => { + this.tableLoading = false; + }); + }, + pagination({ page, limit }) { + this.page.current = page; + this.page.size = limit; + this.getList(); + }, + handleDelete(row) { + this.$confirm("鏄惁鍒犻櫎璇ユ潯鏁版嵁?", "鎻愮ず", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning", + }).then(() => { + delfile({ id: row.id }).then((res) => { + this.$message.success("鍒犻櫎鎴愬姛"); + this.getList(); + }); + }).catch(() => { }); + }, + // 鏂囦欢绠$悊--缁撴潫 + + // 浠诲姟鍒囨崲--寮�濮� + getList0() { + this.tableLoading0 = true; + let param = { userId: this.userId, sonLaboratory: this.sonLaboratory, ...this.page0 }; + delete param.total; + inspectionOrderDetailsTaskSwitching({ ...param }) + .then((res) => { + this.tableLoading0 = false; + if (res.code === 200) { + this.tableData0 = res.data.records; + } + }) + .catch((err) => { + this.tableLoading0 = false; + }); + }, + // 浠诲姟鍒囨崲--缁撴潫 + + closeAddVerifyDia() { + this.addCheck = false; + this.checkUser = ""; + }, + // 鍒锋柊椤甸潰 + refreshView() { + this.loading = true; + doInsOrder({ + id: this.id, + laboratory: this.sonLaboratory, + }).then(async (res) => { + this.insOrder = res.data.insOrder; + this.supplierDensity = res.data.supplierDensity; + this.getList() + this.urgentList.forEach((m) => { + if (m.value == this.insOrder.type) { + this.insOrder.typeName = m.label; + } + }); + this.loading = false; + if (!res.data.sampleProduct || res.data.sampleProduct.length == 0) { + this.goback(); + return this.$message.error("璇ヤ换鍔℃病鏈夋牱鍝佷俊鎭�"); + } + // 璧嬪�煎綋鍓嶆牱鍝佸垪琛� + this.sampleProduct = res.data.sampleProduct; + this.currentSample = this.HaveJson(this.sampleProduct[0]); + let insProduct = this.HaveJson(this.currentSample.insProduct); + // 娓╁害銆佹箍搴﹁祴鍊� + this.otherForm = { + temperature: this.insOrder.temperature + ? this.insOrder.temperature + : null, + humidity: this.insOrder.humidity ? this.insOrder.humidity : null, + }; + if (this.typeSource == "1") { + this.getRawMaterialTag(this.currentSample.id); // 鍘熸潗鏂欑殑妫�楠屼换鍔℃煡璇㈡壒鏁� + this.rawMaterialTag = "1"; + } + this.getEquipOptions(1); + // 鑾峰彇褰撳墠鏍峰搧鐨勬楠岄」 + let list = await this.getCurrentProduct(this.currentSample.id, 0); + this.currentSample.insProduct = this.HaveJson(list); + // 鍒濆鍖栦紶閫掑埌鍚庣鐨勫弬鏁� + this.param = {}; + this.changeType = 0; + this.currentSample.insProduct.forEach((a) => { + this.param[a.id] = { + insValue: [], + comValue: [], + resValue: null, + equipValue: [], + equipName: [], + insResult: null, + }; + }); + if (this.currentSample.index == undefined) + this.currentSample["index"] = 1; + let bushing = this.currentSample.bushing; + this.getTableLists(); //澶勭悊妯℃澘鍒楄〃淇℃伅 + + this.currentKey = 1; + this.getCableTag(this.currentSample.id); // 鏌ヨ鏄惁鏈夎澶氭妫�楠岀殑鐢电紗閰嶇疆 + this.getRepetitionTag(this.currentSample.id); // 鏌ヨ鏄惁鏈夎閲嶅妫�楠岄」 + }); + }, + closeUnPassCheckDialog() { + this.unPassCheck = false; + }, + // 鏌ヨ鏄惁鏈夎澶氭妫�楠岀殑鐢电紗閰嶇疆 + getCableTag() { + getCableTag({ + id: this.currentSample.id, + laboratory: this.sonLaboratory, + }).then((res) => { + if (res.code === 200 && res.data.length > 0) { + this.cableTagList = res.data; + } + }); + }, + // 鏌ヨ鏄惁鏈夎閲嶅妫�楠岄」 + getRepetitionTag() { + getRepetitionTag({ + id: this.currentSample.id, + laboratory: this.sonLaboratory, + cableTag: this.temCableTag, + }).then((res) => { + if (res.code === 200) { + this.repetitionTagList = res.data; + } + }); + }, + getRawMaterialTag() { + getRawMaterialTag({ + id: this.currentSample.id, + laboratory: this.sonLaboratory, + }).then((res) => { + if (res.code === 200) { + res.data.forEach((item) => { + this.rawMaterialTagList = res.data; + }); + } + }); + }, + // 娣诲姞闇�瑕佸娴嬬殑涓嶅悎鏍兼楠岄」 + openAddUnpass() { + this.addUnPassDialog = true; + const info = { + id: this.currentSample.id, + type: this.type, + laboratory: this.sonLaboratory, + cableTag: "", + rawMaterialTag: this.rawMaterialTag, + }; + this.$nextTick(() => { + this.$refs.addUnPassDialog.getInsOrder(info); + }); + }, + resetAddUnPass() { + this.addUnPassDialog = false; + }, + // 杩涜涓嶅悎鏍煎娴� + unpassCheck() { + this.unPassCheck = true; + this.retestTag = "1"; + }, + viewUnpassCheck() { + this.unPassCheck = true; + this.retestTag = "1"; + }, + // 鎵撳紑涓嶅悎鏍煎鐞嗗脊妗� + openUnPassDialog(type) { + this.unPassDialog = true; + this.$nextTick(() => { + this.$refs.unPassDialog.getInsOrder(type); + }); + }, + // 鍏抽棴涓嶅悎鏍煎鐞嗗脊妗� + resetForm() { + this.$refs.unPassDialog.$refs["unPassForm"].resetFields(); + this.unPassDialog = false; + }, + // 鎵撳紑杩涜揣楠岃瘉寮规 + openPurchase() { + const operationType = this.state == 1 ? "add" : "view"; + this.purchaseDialog = true; + const item = { + id: this.currentSample.id, + sonLaboratory: this.sonLaboratory, + cableTag: this.temCableTag, + rawMaterialTag: this.rawMaterialTag, + typeSource: this.typeSource, + }; + this.$nextTick(() => { + this.$refs.purchaseDialog.getInsOrder(operationType, item); + }); + }, + resetPurchaseDialog() { + this.$refs.purchaseDialog.$refs["purchaseForm"].resetFields(); + this.purchaseDialog = false; + }, + // 鏁版嵁閲囬泦 + getDataAcquisitionDevice() { + let itemIds = []; + this.currentSample.insProduct.forEach((item) => { + if (item.inspectionItemType === "1") { + itemIds.push(item.id); + } + }); + const params = { + entrustCode: this.insOrder.entrustCode, + sampleCode: this.currentSample.sampleCode, + id: this.currentSample.id, + itemIds: itemIds, + }; + this.dataAcquisitionLoading = true; + dataCollection(params).then((res) => { + this.dataAcquisitionLoading = false; + if (res.code != 200) { + return; + } + this.dataAcquisitionInfoNew = this.HaveJson(res.data); + // 瀵规暟閲囧洖鏉ョ殑鍊艰繘琛屽鐞� + this.handleDataAcquisition(res.data); + }).catch(err => { + this.dataAcquisitionLoading = false; + }); + }, + objectOrder(obj) { + let newkey = Object.keys(obj).sort(); + let newObj = {}; + for (let i = 0; i < newkey.length; i++) { + newObj[newkey[i]] = obj[newkey[i]]; + } + return newObj; + }, + handleDataAcquisition(data, noDialog) { + // 鏄惁鍙互缂栬緫鏁伴噰鏁版嵁 + if (this.dataAcquisitionEidtAble) { + this.getDataType = 1; + } else { + this.getDataType = 2; + } + this.dataAcquisitionInfo = {}; + this.getData = []; + for (let i in this.objectOrder(data)) { + let obj = {}; + if (i.includes("@")) { + obj = { + faName: i.split("@")[0], + sortName: i.split("@")[1], + child: [], + }; + } else { + obj = { + faName: i, + child: [], + }; + } + // 寰幆鏁伴噰鏁版嵁 + for (let j in data[i]) { + // 鎷兼帴瀛楃涓� 妫�楠岄」鍒嗙被+妫�楠岄」+妫�楠屽瓙椤� + let str0 = ""; + if (i.includes("@")) { + if (i.split("@")[0] == j) { + str0 = i.split("@")[0] + ","; + } else { + str0 = i.split("@")[1] + "," + i.split("@")[0] + "," + j; + } + } else { + if (i == j) { + str0 = i + ","; + } else { + str0 = i + "," + j; + } + } + if ( + j != "frequency" && + data[i][j] && + (!data[i][j].result || typeof data[i][j].result == "string") + ) { + // 澶勭悊鏁伴噰淇℃伅鏍煎紡 + if (data[i][j].result) { + this.dataAcquisitionInfo[str0] = { + value: data[i][j].result, + frequency: data[i].frequency, + }; + } + let list = this.tableList[0].arr; + // 寰幆椤甸潰鍒楄〃淇℃伅锛屽垽鏂暟閲囨暟鎹搴旈〉闈㈠垪琛ㄤ俊鎭殑妫�楠岄」鏄摢涓紝骞剁粰褰撳墠妫�楠岄」缁戝畾璁惧淇℃伅 + list.forEach((item, index) => { + let num0 = 0; + let str = ""; + item.forEach((m) => { + if ( + m.v.ps && + (m.v.ps.value == "妫�楠屽瓙椤�" || + m.v.ps.value == "妫�楠岄」" || + m.v.ps.value == "妫�楠岄」鍒嗙被") + ) { + if (m.v.ps && m.v.ps.value == "妫�楠岄」鍒嗙被") { + if (num0 == 0) { + num0++; + str = m.v.v + ","; + } + } + if (m.v.ps && m.v.ps.value == "妫�楠岄」") { + if (num0 == 1) { + str = str + m.v.v + ","; + num0++; + } else { + str = m.v.v + ","; + num0++; + } + } + if (m.v.ps && m.v.ps.value == "妫�楠屽瓙椤�") { + str = str + m.v.v; + } + } + // 缁戝畾璁惧淇℃伅 + if ( + data[i][j].equipName && + data[i][j].equipValue && + m.v && + m.v.ps && + m.v.ps.value == "璁惧鍚嶇О" && + str0 == str + ) { + if (!m.v.v) { + // this.changeEquip(data[i][j].equipValue,m,data[i][j].equipName) + } + } + }); + }); + } else if ( + j != "frequency" && + data[i][j] && + Array.isArray(data[i][j].result) + ) { + // 濡傛灉杩斿洖鐨勬暟閲囨暟鎹槸鏁扮粍锛屽垯澶勭悊鏁扮粍 + // 浠ヤ笅閫昏緫涓鸿幏鍙栨瘡涓楠岄」鍙緭鍏ョ殑妫�楠屽�肩殑鏈�澶т釜鏁� + let str0 = ""; + if (i.includes("@")) { + if (i.split("@")[0] == j) { + str0 = i.split("@")[0] + ","; + } else { + str0 = i.split("@")[1] + "," + i.split("@")[0] + "," + j; + } + } else { + if (i == j) { + str0 = i + ","; + } else { + str0 = i + "," + j; + } + } + let list = this.tableList[0].arr; + let maxNum = 0; + list.forEach((item, index) => { + let num0 = 0; + let str = ""; + item.forEach((m) => { + if ( + m.v.ps && + (m.v.ps.value == "妫�楠屽瓙椤�" || + m.v.ps.value == "妫�楠岄」" || + m.v.ps.value == "妫�楠岄」鍒嗙被") + ) { + if (m.v.ps && m.v.ps.value == "妫�楠岄」鍒嗙被") { + if (num0 == 0) { + num0++; + str = m.v.v + ","; + } + } + if (m.v.ps && m.v.ps.value == "妫�楠岄」") { + if (num0 == 1) { + str = str + m.v.v + ","; + num0++; + } else { + str = m.v.v + ","; + num0++; + } + } + if (m.v.ps && m.v.ps.value == "妫�楠屽瓙椤�") { + str = str + m.v.v; + } + let num = 0; + list[index].forEach((n) => { + if ( + n.v.ps && + n.v.ps.value && + typeof n.v.ps.value == "string" && + n.v.ps.value.includes("妫�楠屽��") + ) { + num++; + if (str0 == str) { + maxNum = num; + } + } + }); + } + // 缁戝畾璁惧 + if ( + data[i][j].equipName && + data[i][j].equipValue && + m.v && + m.v.ps && + m.v.ps.value == "璁惧鍚嶇О" && + str0 == str + ) { + if (!m.v.v) { + // this.changeEquip(data[i][j].equipValue,m,data[i][j].equipName) + } + } + }); + }); + // 鑾峰彇鍒版渶澶ф楠屽�艰緭鍏ヤ釜鏁板悗閲嶇粍鏁版嵁 + let obj0 = { + name: j, + arr: data[i][j].result, + maxNum: maxNum, + equipValue: data[i][j].equipValue, + value: [], + }; + // 濡傛灉鏁伴噰杩斿洖鐨勬暟缁勯暱搴﹀ぇ浜庢渶澶ц緭鍏ヤ釜鏁帮紝鍒欏皢鏁伴噰鏁版嵁鍦ㄥ脊妗嗕腑灞曠ず锛岀敤鎴烽�夋嫨闇�瑕佹墜鍔ㄩ�夋嫨鏁伴噰鐨勪俊鎭� + if ( + (data[i][j].result && + Array.isArray(data[i][j].result) && + data[i][j].result.length > maxNum && + noDialog !== "noDialog") || + (obj0.equipValue === "JCZX-ZB-FF01014" && noDialog !== "noDialog") + ) { + obj.child.push(obj0); + } else { + this.dataAcquisitionInfo[str0] = { + value: data[i][j].result, + }; + } + } + } + // 寰幆鏁伴噰鏁版嵁 + if (obj.child.length > 0) { + obj.child.forEach((m) => { + this.$set(m, "getDataIndex1", []); + // 璁惧閫夋嫨涓烘媺鍔涙満锛屽氨鏄剧ず澶氶�変笅鎷夋 + if (m.equipValue === "JCZX-ZB-FF01014") { + this.$set(m, "isShowSelect", true); + } else { + this.$set(m, "isShowSelect", false); + } + }); + this.getData.push(obj); + } + } + // 濡傛灉瀛樺湪鏁伴噰杩斿洖鐨勬暟缁勯暱搴﹀ぇ浜庢渶澶ц緭鍏ヤ釜鏁帮紝鍒欏脊鍑哄脊妗嗛�夋嫨 + if (this.getData.length > 0) { + this.dataGetDia = true; + } else { + // 濡傛灉閮戒笉瀛樺湪锛屽垯锛岃繘鍏ュ鐞嗘暟閲囩嚎绋嬮噷鍘诲鐞嗘暟鎹� + try { + // 鍚� Worker 鍙戦�佹秷鎭紝寮�濮嬪鐞嗛�昏緫 + this.getDataIndexLoading = false; + this.dataGetDia = false; + this.getDataTypeId = ""; + this.worker0.postMessage( + JSON.stringify({ + dataAcquisitionInfo: this.dataAcquisitionInfo, + list: this.tableList[0].arr, + }) + ); + } catch (error) { + console.log(1111, error); + } + } + // 鐩戝惉 Worker 杩斿洖鐨勭粨鏋� + this.worker0.onmessage = (event) => { + let result = JSON.parse(event.data); + if (result.method == "changeInput") { + // 閲囬泦鍚庣殑鏁版嵁锛岄渶瑕佽繘琛岃绠楃殑绾跨▼杩涜璁$畻 + let { list, n } = result.value; + this.$set(this.tableList[0], "arr", list); + this.changeInput( + "", + `${this.currentSample.insProduct[0].templateId}-${n.r}-${n.c}-${n.i}`, + n + ); + } else if (result.getDataTypeId) { + // 鑾峰彇鍒版暟閲囨渶鍚庝竴椤癸紝妫�楠岄」鐨処D + this.getDataTypeId = result.getDataTypeId; + } + }; + this.dataAcquisitionLoading = false; + }, + setData(item) { + if (item.child.length > 1) { + let arr1 = []; + // 澶氫釜妫�楠屽瓙椤圭殑璇濓紝绗竴涓楠屽瓙椤归�夌殑绗嚑涓笅闈㈢殑灏辫祴鍊肩鍑犱釜 + for (let j = 0; j < item.child.length; j++) { + let arr = []; + if (j === 0) { + for (let k = 0; k < item.child[j].getDataIndex1.length; k++) { + let val1 = item.child[j].getDataIndex1[k]; + const index = val1.indexOf("^"); + if (index > -1) { + val1 = val1.substring(0, index); + arr.push(val1); + } + } + arr1 = arr; + } else { + this.$set(item.child[j], "getDataIndex1", []); + arr1.map((a) => { + const value1 = a + "^" + item.child[j].arr[Number(a)].result; + item.child[j].getDataIndex1.push(value1); + }); + } + } + } + }, + // 鎷夊姏鏈烘暟閲� + filterMethod(val) { + console.log("val---", val); + }, + // 濡傛灉瀛樺湪鏁伴噰杩斿洖鐨勬暟缁勯暱搴﹀ぇ浜庢渶澶ц緭鍏ヤ釜鏁帮紝鍒欏脊鍑哄脊妗嗛�夋嫨锛岃繖閲屾槸寮规鐨勬彁浜� + submitDataGet() { + for (let i = 0; i < this.getData.length; i++) { + for (let j = 0; j < this.getData[i].child.length; j++) { + // 瀵圭敤鎴烽�夋嫨鐨勬暟閲囦俊鎭繘琛屽鐞嗭紝璧嬪�� + let arr = []; + for ( + let k = 0; + k < this.getData[i].child[j].getDataIndex1.length; + k++ + ) { + if (this.getData[i].child[j].getDataIndex1[k].includes("^")) { + const index = + this.getData[i].child[j].getDataIndex1[k].indexOf("^"); + if (index > -1) { + this.getData[i].child[j].getDataIndex1[k] = this.getData[ + i + ].child[j].getDataIndex1[k].slice( + index + 1, + this.getData[i].child[j].getDataIndex1[k].length + ); + } + } + arr.push(this.getData[i].child[j].getDataIndex1[k]); + } + if (this.getData[i].sortName) { + this.dataAcquisitionInfoNew[ + this.getData[i].faName + "@" + this.getData[i].sortName + ][this.getData[i].child[j].name].result = arr; + } else { + this.dataAcquisitionInfoNew[this.getData[i].faName][ + this.getData[i].child[j].name + ].result = arr; + } + } + } + this.getDataIndexLoading = true; + // 璧嬪�煎畬鎴愬悗闇�瑕佸啀娆¤繘鍏ュ鐞嗘暟閲囩嚎绋嬮噷鍘诲鐞嗘暟鎹� + this.handleDataAcquisition(this.dataAcquisitionInfoNew, "noDialog"); + }, + // 澶氱嚎绋� + startWorker() { + if (this.worker) { + this.stopWorker(); // 纭繚涔嬪墠鐨� Worker 宸插仠姝� + } + // 鍒涘缓 Worker 瀹炰緥 + this.worker = new InspectionWorker(); + if (this.worker0) { + this.stopWorker(); // 纭繚涔嬪墠鐨� Worker 宸插仠姝� + } + // 鍒涘缓 Worker 瀹炰緥 + this.worker0 = new DataWorker(); + }, + // 鍋滄澶氱嚎绋� + stopWorker() { + if (this.worker) { + this.worker.terminate(); + this.worker = null; + } + if (this.worker0) { + this.worker0.terminate(); + this.worker0 = null; + } + }, + // 淇濆瓨婀垮害銆佹俯搴︽暟鎹� + subOtherForm(m, type) { + write({ + [type]: type === "remark" ? m : Number(m), + id: this.insOrder.id, + }).then((res) => { + this.$message.success("淇濆瓨鎴愬姛"); + }); + }, + exportTable(tableId) { + // 鑾峰彇table鍏冪礌 + var table = document.getElementById(tableId); + + // 浣跨敤html2canvas搴撶敓鎴恈anvas + html2canvas(table).then(function (canvas) { + // 鍒涘缓涓�涓浘鐗囧厓绱� + var img = canvas.toDataURL("image/png"); + + // 鍒涘缓涓�涓猘鏍囩妯℃嫙鐐瑰嚮杩涜涓嬭浇 + var a = document.createElement("a"); + a.href = img; + a.download = "table.png"; + a.click(); + }); + }, + uploadSample() { + doInsOrder({ + id: this.id, + laboratory: this.sonLaboratory, + }).then(async (res) => { + this.sampleProduct = res.data.sampleProduct; + }); + }, + // 鏍规嵁绫诲瀷銆佷换鍔d銆佸疄楠屽鏉ヨ幏鍙栨牱鍝佺殑妫�楠岄」淇℃伅 + async getCurrentProduct(id, type, cableTag) { + if (cableTag === undefined) { + cableTag = ""; + } + this.tableLoading = true; + type = this.typeSource == "1" ? 5 : type; + this.type = type; + let res = await getInsProduct({ + id: id, + type: type, + laboratory: this.sonLaboratory, + cableTag: (cableTag ? cableTag : this.temCableTag), + rawMaterialTag: this.rawMaterialTag, + repetitionTag: this.repetitionTag + }); + this.tableLoading = false; + if (res.data.length > 0) { + return res.data; + } + }, + // 鍒囨崲鏍峰搧 + async handleChangeSample(row, column, event) { + // 鍒濆鍖栨暟鎹� + this.param = {}; + this.sampleVisible = false; + // 璧嬪�兼牱鍝� + this.currentSample = this.HaveJson(row); + let list = await this.getCurrentProduct(row.id, 0); + // 璧嬪�兼牱鍝佹楠岄」 + this.currentSample.insProduct = this.HaveJson(list); + // 鍒濆鍖栧悗绔紶鍙� + this.param = {}; + this.changeType = 0; + this.currentSample.insProduct.forEach((a, j) => { + this.param[a.id] = { + insValue: [], + comValue: [], + resValue: null, + equipValue: [], + equipName: [], + insResult: null, + }; + }); + // 澶勭悊椤甸潰鍒楄〃鏁版嵁 + this.getTableLists(); + this.currentKey = row.index; + this.currentTab = null; + // 鍚戝绾跨▼鍘讳繚瀛橀〉闈㈠垪琛ㄦ暟鎹�,鍚庣浼犲弬,褰撳墠妯℃澘淇℃伅 + this.worker.postMessage( + JSON.stringify({ + modelType: this.sampleProduct[0].model, + type: "saveData", + tableList: this.tableList, + param: this.param, + currentTable: this.currentTable, + }) + ); + }, + async handleChangeCableTag(m, type, num, m2) { + let cableTag = ""; + let repetitionTag = ""; + if (num === "cableTag") { + cableTag = m2; + this.temCableTag = cableTag; + this.getRepetitionTag(); + } + if (num === "repetitionTag") { + repetitionTag = m2; + this.repetitionTag = repetitionTag; + } + if (!m2) { + type = 0; + } + this.changeType = type; + if (m) { + let list = await this.getCurrentProduct(m, type, cableTag); + if (list && list.length > 0) { + this.param = {}; + list.forEach((a) => { + this.param[a.id] = { + insValue: [], + comValue: [], + resValue: null, + equipValue: [], + equipName: [], + insResult: null, + }; + }); + this.getTableLists0(list); + this.worker.postMessage( + JSON.stringify({ + type: "saveData", + tableList: this.tableList, + param: this.param, + currentTable: this.currentTable, + bushing: m, + }) + ); + } else { + this.tableLists = []; + this.tableList = []; + this.$message.error("妫�楠岄」涓虹┖"); + } + } + }, + // 鏀瑰彉浠诲姟 + handleChangeTask(row) { + if (row) this.id = row.id; + this.taskVisible = false; + }, + // 瀛楀吀鑾峰彇淇℃伅 + getTypeDicts() { + this.getDicts("urgency_level").then((response) => { + this.urgentList = this.dictToValue(response.data); + }); + }, + // 瀛楀吀鑾峰彇淇℃伅 + getInsStateDicts() { + this.getDicts("inspection_task_state").then((response) => { + this.typeList = this.dictToValue(response.data); + }); + }, + // 瀛楀吀鑾峰彇淇℃伅 + getComparisonList() { + this.getDicts("coordinate_transformation").then((response) => { + this.comparisonList = this.dictToValue(response.data); + }); + }, + // 鑾峰彇妫�楠屽�间负涓嬫媺鏃剁殑涓嬫媺鍒楄〃 + // selectEnumByCategoryOfSelect(val) { + // this.enumList = []; + // if (val === undefined || val === null) { + // return; + // } + // this.$axios + // .post(this.$api.enums.selectEnumByCategory, { + // category: val, + // }) + // .then((res) => { + // this.enumList = res.data; + // }); + // }, + tableRowClassName({ row, rowIndex }) { + row.index = rowIndex + 1; + }, + // 澶勭悊椤甸潰鍒楄〃鏁版嵁--鍘婚噸,鐢熸垚妫�楠屾ā鏉垮垏鎹㈠垪琛� + getTableLists() { + const mySet1 = new Set(); + this.tableLists = this.currentSample.insProduct.filter((m) => { + let num0 = mySet1.size; + if (m.templateId != null && m.template != null) { + try { + mySet1.add( + JSON.stringify({ + template: m.template, + templateId: m.templateId, + }) + ); + } catch (error) { + console.log(222, error); + } + } + let num1 = mySet1.size; + if (num1 > num0) { + return m; + } + }); + if (this.tableLists && this.tableLists.length > 0) { + this.tableList = null; + this.tableList = [this.tableLists[0]]; + this.currentTable = this.tableLists[0].templateId; + // 澶勭悊椤甸潰鍒楄〃鏁版嵁 + this.handleTableData(); + } + }, + // 鍏夌氦閰嶇疆鐩稿叧妯℃澘table鍒楄〃 + getTableLists0(list) { + const mySet1 = new Set(); + this.tableLists = list.filter((m) => { + let num0 = mySet1.size; + if (m.templateId != null && m.template != null) { + try { + mySet1.add( + JSON.stringify({ + template: m.template, + templateId: m.templateId, + }) + ); + } catch (error) { + console.log(333, error); + } + } + let num1 = mySet1.size; + if (num1 > num0) { + return m; + } + }); + if (this.tableLists && this.tableLists.length > 0) { + this.tableList = null; + this.tableList = [this.tableLists[0]]; + this.currentTable = this.tableLists[0].templateId; + this.currentSample.insProduct = this.HaveJson(list); + // 澶勭悊椤甸潰鍒楄〃鏁版嵁 + this.handleTableData(); + } + }, + // 澶勭悊椤甸潰鍒楄〃鏁版嵁 + handleTableData() { + this.excelMethodList = []; //excel鍑芥暟鍒楄〃 + this.widthList = this.tableList[0].style.columnlen; //椤甸潰瀹藉害--鏍规嵁妯℃澘鏉ョ殑 + // 鏈寰幆涓昏鍋氶〉闈㈡覆鏌撳眰闈㈢殑澶勭悊--鍗曞厓鏍煎悎骞堕澶勭悊 + this.tableList.forEach((a) => { + let mcList = a.template.filter( + (b) => + b.v.mc != undefined && + b.v.mc.cs != undefined && + b.v.mc.rs != undefined + ); + let count = 0; + // 灏� a.template 杞崲涓� Map 浠ュ姞閫熸煡鎵� + let templateMap = new Map(); + a.template.forEach((item) => { + templateMap.set(`${item.c}-${item.r}`, item); + }); + mcList.forEach((b) => { + let cs = b.v.mc.cs; + let rs = b.v.mc.rs; + for (let i = 0; i < cs; i++) { + for (let i2 = 0; i2 < rs; i2++) { + let key = `${b.c + i}-${b.r + i2}`; + let item = templateMap.get(key); + if (item) { + let bb = this.HaveJson(b); + item.v.v = bb.v.v; + item.v.ps = bb.v.ps; + item.v.fc = bb.v.fc; + item.v.fs = bb.v.fs; + item.v.ht = bb.v.ht; + item.mc = count; + } + } + } + count++; + }); + }); + // 鏈寰幆涓昏鏄帶鍒跺悎骞�,浠ュ強鎺у埗妫�楠岄」淇℃伅鏄惁灞曠ず鍑烘潵,浠ヤ究鍚庣画妫�楠� + this.tableList.forEach((a) => { + let dels = new Set(); //闇�瑕佸垹闄ょ殑琛� + let ids = []; //鎵�鏈夋楠岄」鐨刬d + let set3 = new Set(); + a.template.forEach((b) => { + let size1 = set3.size; + let size2 = set3.add(b.r).size; + if (size1 < size2) { + let str = ""; + let str2 = ""; + let unit2 = ""; + let count4 = 0; + let isThree = 0; + a.template.forEach((c) => { + // 鑾峰彇鍒� 妫�楠岄」鍒嗙被+妫�楠岄」+妫�楠屽瓙椤圭殑鎷兼帴,濡傛灉妯℃澘閲岀殑淇℃伅璺熸帴鍙h繑鍥炵殑妫�楠岄」淇℃伅鑳藉鍖归厤鍒欏睍绀哄嚭鏉� + if (b.r === c.r) { + if ( + c.v.ps != undefined && + c.v.ps.value === "妫�楠岄」鍒嗙被" && + count4 === 0 + ) { + // 涓夌骇鍒嗙被 + isThree = 1; + } else if ( + c.v.ps != undefined && + c.v.ps.value === "妫�楠岄」" && + count4 === 0 + ) { + // 浜岀骇鍒嗙被 + isThree = 0; + } + if (isThree == 0) { + if (c.v.ps != undefined && c.v.ps.value === "妫�楠岄」") { + if (count4 === 0) { + if (c.v.v) { + c.v.v = c.v.v.replace(/\s*/g, ""); + } + str += c.v.v; + count4 += 1; + } + } else if ( + c.v.ps != undefined && + c.v.ps.value === "妫�楠屽瓙椤�" + ) { + if (count4 === 1) { + if (c.v.v) { + c.v.v = c.v.v.replace(/\s*/g, ""); + } + str += c.v.v; + count4 += 1; + } + } + } else if (isThree == 1) { + if (c.v.ps != undefined && c.v.ps.value === "妫�楠岄」鍒嗙被") { + if (count4 === 0) { + if (c.v.v) { + c.v.v = c.v.v.replace(/\s*/g, ""); + } + str += c.v.v; + count4 += 1; + } + } else if (c.v.ps != undefined && c.v.ps.value === "妫�楠岄」") { + if (count4 === 1) { + if (c.v.v) { + c.v.v = c.v.v.replace(/\s*/g, ""); + } + str += c.v.v; + count4 += 1; + } + } else if ( + c.v.ps != undefined && + c.v.ps.value === "妫�楠屽瓙椤�" + ) { + if (count4 === 2) { + if (c.v.v) { + c.v.v = c.v.v.replace(/\s*/g, ""); + } + str += c.v.v; + count4 += 1; + } + } + } + if (str === "鏈烘鎬ц兘骞叉�佹媺浼稿己搴�(绾靛悜)") { + if (c.v.ps != undefined && c.v.ps.value === "鍗曚綅") { + if (c.v.v) { + c.v.v = c.v.v.replace(/\s*/g, ""); + } + str2 = str + c.v.v; + unit2 = c.v.v; + } + } + } + }); + if (str != "") { + let count2 = 0; + for (let i in this.currentSample.insProduct) { + let inspectionItemClass = + this.currentSample.insProduct[i].inspectionItemClass == + null || + this.currentSample.insProduct[i].inspectionItemClass == + undefined + ? "" + : this.currentSample.insProduct[i].inspectionItemClass; + inspectionItemClass = inspectionItemClass.replace(/\s*/g, ""); + let inspectionItem = + this.currentSample.insProduct[i].inspectionItem == null || + this.currentSample.insProduct[i].inspectionItem == undefined + ? "" + : this.currentSample.insProduct[i].inspectionItem; + inspectionItem = inspectionItem.replace(/\s*/g, ""); + let inspectionItemSubclass = + this.currentSample.insProduct[i].inspectionItemSubclass == + null || + this.currentSample.insProduct[i].inspectionItemSubclass == + undefined + ? "" + : this.currentSample.insProduct[i].inspectionItemSubclass; + inspectionItemSubclass = inspectionItemSubclass.replace( + /\s*/g, + "" + ); + if (inspectionItemSubclass === "骞叉�佹媺浼稿己搴�(绾靛悜)") { + // 妫�楠屽瓙椤逛负'骞叉�佹媺浼稿己搴�(绾靛悜)'鏃讹紝妯$増閲屾槸涓や釜璁$畻鍊煎搴旂浉鍚岀殑妫�楠屽�煎苟涓旇绠楁柟寮忎笉鍚岋紝瑕佹牴鎹浉鍚岀殑'鍗曚綅'鍋氱壒娈婄殑娓叉煋 + const unit = this.currentSample.insProduct[i].unit; + if ( + (this.currentSample.insProduct[i].templateId === + a.templateId && + inspectionItemClass + + inspectionItem + + inspectionItemSubclass + + unit === + str2) || + (this.currentSample.insProduct[i].templateId === + a.templateId && + !unit2.includes("/") && + inspectionItemClass + + inspectionItem + + inspectionItemSubclass === + str) + ) { + ids.push({ + r: b.r, + id: this.currentSample.insProduct[i].id, + product: this.currentSample.insProduct[i], + }); + break; + } + } else { + // 濡傛灉鐩哥瓑,閭d箞璇存槑鎵惧埌浜�,骞朵笖鎶奿d瀛樿捣鏉�,鍚庣画妫�楠岄」涔熶細鍦ㄩ〉闈腑鏄剧ず鍑烘潵 + if ( + this.currentSample.insProduct[i].templateId === + a.templateId && + inspectionItemClass + + inspectionItem + + inspectionItemSubclass === + str + ) { + ids.push({ + r: b.r, + id: this.currentSample.insProduct[i].id, + product: this.currentSample.insProduct[i], + }); + break; + } + } + count2++; + } + if (count2 == this.currentSample.insProduct.length) { + dels.add(b.r); + } + } + } + }); + // 鎿嶄綔鍒犻櫎 + dels.forEach((del) => { + for (let b = 0; b < a.template.length; b++) { + if (a.template[b].r === del) { + a.template.splice(b, 1); + b -= 1; + } + } + }); + // 鎿嶄綔璧嬪��--涓昏璧嬪�煎崟浣�,璇曢獙鏂规硶绛変俊鎭� + ids.forEach((id) => { + for (let b = 0; b < a.template.length; b++) { + if (a.template[b].r === id.r) { + a.template[b].i = id.id; + if ( + a.template[b].v.ps != undefined && + a.template[b].v.ps.value === "鍗曚綅" + ) { + a.template[b].v.v = id.product.unit; + } + if ( + a.template[b].v.ps != undefined && + (a.template[b].v.ps.value === "璇曢獙鏂规硶" || + a.template[b].v.ps.value === "妫�娴嬫柟娉�") + ) { + a.template[b].v.v = id.product.methodS; + } + } + } + }); + let set2 = new Set(); + // 鍚堝苟鐨勬暟鎹鐞�,cs rs 浠h〃鍚堝苟鐨勬暟閲� + a.template.forEach((b) => { + let size1 = set2.size; + let size2 = set2.add(b.mc).size; + if (b.mc != undefined && size1 < size2) { + b.v.mc.rs = 0; + b.v.mc.cs = 0; + a.template.forEach((c) => { + if (b.mc === c.mc) { + if (b.r === c.r) { + b.v.mc.cs += 1; + } + if (b.c === c.c) { + b.v.mc.rs += 1; + } + } + }); + } + }); + }); + // 鏈寰幆涓昏鏄鍚庣浼犲弬杩涜鍒濆鍖�,鏍峰紡閫昏緫淇敼 + this.tableList.forEach((a) => { + let arrs = []; + let set = new Set(); + let count1 = 0; + let conclusionList = []; //缁撹鍒楄〃 + let finalList = []; //鏈�缁堝�煎垪琛� + // 缁撹涓庢渶缁堝�煎湪杩欓噷涓�涓�瀵瑰簲,浠ヤ笅涓や釜鍒楄〃闀垮害鑲畾鏄竴鏍风殑,濡傛灉鏈変笉涓�鏍�,閭d箞澶氬崐鏄ā鏉块厤缃緱闂 + conclusionList = a.template.filter( + (n) => n.v.ps != undefined && n.v.ps.value === "缁撹" + ); //缁撹鍒楄〃 + finalList = a.template.filter( + (n) => n.v.ps != undefined && n.v.ps.value === "鏈�缁堝��" + ); //鏈�缁堝�煎垪琛� + a.template.forEach((b) => { + if ( + b.v.ps != undefined && + b.v.ps.value === "搴忓彿" && + (b.v.mc == undefined || Object.keys(b.v.mc).length === 4) + ) { + // 瀵瑰簭鍙疯繘琛岃祴鍊� + count1++; + b.v.v = count1; + } + if (b.v.ps != undefined && b.v.ps.value === "瑕佹眰鍊�") { + // 瀵硅姹傚�艰繘琛岃祴鍊� + b.v.v = this.getAsk(b.i); + } + // 瀵归〉闈㈢殑鍜岀粰鍚庣浼犲弬鐨勬楠屽��,璁$畻鍊�,璁惧缂栫爜,璁惧鍚嶇О,鏈�缁堝��,缁撹杩涜鍒濆鍖� + if ( + b.v.ps != undefined && + typeof b.v.ps.value === "string" && + b.v.ps.value.includes("妫�楠屽��") + ) { + this.$set(b.v, "v", ""); + // b.v.v = '' + b.u = ""; + b.i && this.param[b.i] && this.param[b.i].insValue.push(b); + } + if (b.v.ps != undefined && b.v.ps.value === "璁$畻鍊�") { + this.$set(b.v, "v", ""); + // b.v.v = '' + b.i && this.param[b.i] && this.param[b.i].comValue.push(b); + } + if (b.v.ps != undefined && b.v.ps.value === "璁惧缂栫爜") { + // b.v.v = '' + this.$set(b.v, "v", ""); + b.i && this.param[b.i] && this.param[b.i].equipValue.push(b); + } + if (b.v.ps != undefined && b.v.ps.value === "璁惧鍚嶇О") { + this.$set(b.v, "v", ""); + // b.v.v = '' + b.i && this.param[b.i] && this.param[b.i].equipName.push(b); + } + if (b.v.ps != undefined && b.v.ps.value === "鏈�缁堝��") { + // b.v.v = '' + this.$set(b.v, "v", ""); + if ( + b.i !== undefined && + this.param[b.i] && + !this.param[b.i].resValue + ) { + this.param[b.i].resValue = b; + } + } + if (b.v.ps != undefined && b.v.ps.value === "缁撹") { + if ( + b.i !== undefined && + this.param[b.i] && + !this.param[b.i].insResult + ) { + this.param[b.i].insResult = b; + conclusionList.forEach((n, i) => { + if (n.r == b.r && n.c == b.c) { + b.v.f = `(${this.comparisonList.find((j) => j.value == finalList[i].c) + .label + }${finalList[i].r + 1})`; + } + }); + } + } + set.add(b.r); + // 濡傛灉妯℃澘鍒楄〃鐨勫嚱鏁板瓨鍦�,閭d箞鍔犲叆鍒癳xcel鍑芥暟鍒楄〃閲岄潰 + if (b.v.f) { + this.excelMethodList.push(b); + } + }); + // 浠ヤ笅鏄牱寮忓鐞嗛�昏緫 + set = [...set] + // set = set.sort(); + set.forEach((b) => { + let arr = []; + a.template.forEach((c) => { + if (c.r === b) { + arr.push(c); + } + }); + arrs.push(arr); + }); + a.arr = arrs; + this.tableWidth = 0; + for (let i = 0; i < arrs[0].length; i++) { + this.tableWidth += + a.style.columnlen[i] === undefined ? 100 : a.style.columnlen[i]; + } + }); + // 鏈寰幆涓昏鏄椤甸潰鍙婂悗绔紶鍙傝繘琛屽垵濮嬪寲璧嬪�� + this.currentSample.insProduct.forEach(async (a) => { + try { + // 璁$畻鍊艰祴鍊� + let comValue = JSON.parse(a.insProductResult.comValue); + for (var i = 0; i < comValue.length; i++) { + if ( + this.param[a.id].comValue.find( + (m) => m.c == comValue[i].c && m.r == comValue[i].r + ) + ) { + this.param[a.id].comValue.find( + (m) => m.c == comValue[i].c && m.r == comValue[i].r + ).v.v = this.toFixed( + comValue[i].v, + this.param[a.id].comValue.find( + (m) => m.c == comValue[i].c && m.r == comValue[i].r + ).v.ct + ); + } else if (!comValue[i].c || !comValue[i].r) { + this.param[a.id].comValue[i].v.v = this.toFixed( + comValue[i].v, + this.param[a.id].comValue[i].v.ct + ); + } + } + } catch (e) { } + try { + // 妫�楠屽�艰祴鍊� + let insValue = JSON.parse(a.insProductResult.insValue); + for (let i = 0; i < insValue.length; i++) { + if ( + this.param[a.id].insValue.find( + (m) => m.c == insValue[i].c && m.r == insValue[i].r + ) + ) { + this.param[a.id].insValue.find( + (m) => m.c == insValue[i].c && m.r == insValue[i].r + ).v.v = this.toFixed( + insValue[i].v, + this.param[a.id].insValue.find( + (m) => m.c == insValue[i].c && m.r == insValue[i].r + ).v.ct + ); + this.param[a.id].insValue.find( + (m) => m.c == insValue[i].c && m.r == insValue[i].r + ).u = insValue[i].u; + // this.param[a.id].insValue[i].v.v = insValue[i].v + // this.param[a.id].insValue[i].u = insValue[i].u + } + } + } catch (e) { } + try { + // 璁惧缂栧彿璧嬪�� + let equipValue = JSON.parse(a.insProductResult.equipValue); + for (let i = 0; i < equipValue.length; i++) { + // 鏅�氳澶囪祴鍊� + this.param[a.id].equipValue[i].v.v = equipValue[i].v; + } + } catch (e) { } + try { + // 璁惧鍚嶇О璧嬪�� + let equipName = JSON.parse(a.insProductResult.equipName); + for (let i = 0; i < equipName.length; i++) { + equipName[i].v !== "" && + equipName[i].v.map((val) => { + const index = this.equipOptions.findIndex( + (item) => item.value === val + ); + if (index > -1) { + // 鏍规嵁璁惧缂栫爜杞崲涓虹浉搴旂殑璁惧鍚嶇О + val = this.equipOptions[index].deviceName; + } + }); + } + for (let i = 0; i < equipName.length; i++) { + // 鏅�氳澶囧悕绉拌祴鍊� + this.param[a.id].equipName[i].v.v = equipName[i].v; + } + } catch (e) { + console.log("璁惧鍚嶇О璧嬪��----", e); + } + try { + // 鏈�缁堝�艰祴鍊� + this.param[a.id].resValue.v.v = this.toFixed( + a.lastValue, + this.param[a.id].resValue.v.ct + ); + // 缁撹璧嬪�� + this.param[a.id].insResult.v.v = a.insResult; + } catch (e) { } + }); + // 瀵筫xcel鍑芥暟杩涜澶勭悊 + this.handleExcelMethod(); + }, + // 妫�楠屽�艰緭鍏ュ悗瑙﹀彂鐨勫嚱鏁� + changeInput(m, code, n, getDataType, changeSelect) { + // 涓烘暟閲囧畾涔変竴涓�昏緫鍙傛暟 + if (getDataType == "getDataType") { + this.getDataType = 2; + } + let currentInsItemId = null; //褰撳墠妫�楠岄」id + if (n) { + currentInsItemId = JSON.parse(JSON.stringify(n.i)); + // 瀹氫箟涓�涓嚱鏁版潵楠岃瘉鍒嗘暟鏄惁鏈夋晥 + if (typeof n.v.v == "string") { + function isValidFraction(fraction) { + const [numerator, denominator] = fraction.split("/"); // 鍒嗗瓙鍜屽垎姣� + return !(!denominator || !numerator); + } + const isTrue = isValidFraction(n.v.v); + if (!isTrue) { + n.v.v = n.v.v.replace("/", ""); + } + } + } + try { + // 鍚� Worker 鍙戦�佹秷鎭紝寮�濮嬪鐞嗛�昏緫 + this.worker.postMessage( + JSON.stringify({ + code: code, + tableList: this.tableList, + excelMethodList: this.excelMethodList, + comparisonList: this.comparisonList, + currentSample: this.currentSample, + PROJECT: this.PROJECT, + param: this.param, + currentTable: this.currentTable, + getDataTypeId: this.getDataTypeId, + modelType: this.sampleProduct[0].model, + currentInsItem: n, + }) + ); + } catch (error) { + console.log(444, error); + } + + // 鐩戝惉 Worker 杩斿洖鐨勭粨鏋� + this.worker.onmessage = (event) => { + this.result = JSON.parse(event.data); + switch (this.result.method) { + case "saveInsContext": + this.$nextTick(() => { + // this.$delete(this.tableList[0],'arr') + this.$set( + this.tableList[0], + "arr", + this.result.value.tableList[0].arr + ); + this.param = this.result.value.param; + if (this.result.value.currentInsItemId) { + currentInsItemId = this.result.value.currentInsItemId; + } + // 鐗规畩澶勭悊涓�涓嬬粨璁�,浼氭湁杩欑鐗规畩鎯呭喌 + for (var i in this.param) { + if ( + this.param[i].insResult && + this.param[i].insResult.v && + this.param[i].insResult.v.v + ) { + if (this.param[i].insResult.v.v == "鍚堟牸") { + this.$set(this.param[i].insResult.v, "v", 1); + } else if (this.param[i].insResult.v.v == "涓嶅悎鏍�") { + this.$set(this.param[i].insResult.v, "v", 0); + } + } + } + this.saveInsContext(currentInsItemId); + }); + break; + case "tableList": + this.$nextTick(() => { + // 鏇存柊鏁版嵁 + this.$delete(this.tableList[0], "arr"); + this.$set(this.tableList[0], "arr", this.result.value[0].arr); + // this.param = this.result.value.param + if (this.result.value.currentInsItem) { + currentInsItemId = this.result.value.currentInsItem.i; + } + }); + break; + case "getCurrentInsProduct": + // 鏇存柊椤甸潰鏁版嵁 + this.getCurrentInsProduct(this.result.value); + break; + } + }; + // 淇濆瓨鏁版嵁 + setTimeout(() => { + if (changeSelect) { + this.saveInsContext(currentInsItemId); + } + }, 200); + }, + // 鏍规嵁鍚庣浼犲弬鏇存柊椤甸潰鏁版嵁 param => this.tableList[0].insProductResult + getCurrentInsProduct(pId) { + if (!this.tableList[0].insProductResult) { + this.tableList[0].insProductResult = {}; + } + for (let m in this.param[pId]) { + let value = this.param[pId][m]; + switch (m) { + case "comValue": + // 璧嬪�艰绠楀�� + if (value && value.length > 0) { + this.tableList[0].insProductResult[m] = []; + value.forEach((a, i) => { + let obj = { + v: a.v.v, + }; + this.tableList[0].insProductResult[m].push(obj); + }); + try { + this.tableList[0].insProductResult[m] = JSON.stringify( + this.tableList[0].insProductResult[m] + ); + } catch (error) { + console.log(555, error); + } + } + break; + // 璧嬪�兼楠屽�� + case "insValue": + if (value && value.length > 0) { + this.tableList[0].insProductResult[m] = []; + value.forEach((a, i) => { + let obj = { + v: a.v.v, + u: a.u, + }; + this.tableList[0].insProductResult[m].push(obj); + }); + try { + this.tableList[0].insProductResult[m] = JSON.stringify( + this.tableList[0].insProductResult[m] + ); + } catch (error) { + console.log(666, error); + } + } + break; + // 璧嬪�艰澶囩紪鍙� + case "equipValue": + if (value && value.length > 0) { + this.tableList[0].insProductResult[m] = []; + value.forEach((a, i) => { + let obj = { + v: a.v.v, + }; + this.tableList[0].insProductResult[m].push(obj); + }); + try { + this.tableList[0].insProductResult[m] = JSON.stringify( + this.tableList[0].insProductResult[m] + ); + } catch (error) { + console.log(777, error); + } + } + break; + // 璧嬪�艰澶囧悕绉� + case "equipName": + if (value && value.length > 0) { + this.tableList[0].insProductResult[m] = []; + value.forEach((a, i) => { + let obj = { + v: a.v.v, + }; + this.tableList[0].insProductResult[m].push(obj); + }); + try { + this.tableList[0].insProductResult[m] = JSON.stringify( + this.tableList[0].insProductResult[m] + ); + } catch (error) { + console.log(888, error); + } + } + break; + // 璧嬪�兼渶缁堝�� + case "resValue": + this.tableList[0].lastValue = value ? value.v.v : ""; + break; + // 璧嬪�肩粨璁� + case "insResult": + this.tableList[0].insResult = value ? value.v.v : ""; + break; + } + } + }, + // 瀵笶XCEL鍑芥暟杩涜澶勭悊 + handleExcelMethod() { + if (this.excelMethodList.length > 0) { + this.excelMethodList.map((item) => { + // 寰楀埌姣忎釜鍑芥暟鐨勫弬鏁板垪琛� + item.valueList = excelFunction.changeParameter(item.v.f); + return item; + }); + } + }, + getValue(v) { + // 瀵归〉闈㈠睍绀烘暟鎹繘琛屽鐞�,@,浠h〃鎹㈣ + let str = v.v + ? v.v + : v.v === 0 + ? v.v + : v.ct && v.ct.s + ? v.ct.s.length > 0 && + v.ct.s[0].v + .replace(new RegExp("\n", "g"), "<br/>") + .replace(new RegExp("@", "g"), "<br/>") + : ""; + // 瀵规暟鎹繚鐣欏皬鏁扮偣杩涜澶勭悊 + if (v.ct && v.ct.fa && v.ct.fa.includes(".") && str) { + let num = 0; + let str0 = v.ct.fa.split(".")[1]; + num = str0.length; + str = Number(str).toFixed(num); + } + if (v.v && typeof v.v == "string" && v.v.includes("@")) { + str = v.v.replace(new RegExp("@", "g"), "<br/>"); + } + return str; + }, + // 鑾峰彇褰撳墠杈撳叆妗嗙被鍨� + getInspectionValueType(id) { + for (var a in this.currentSample.insProduct) { + if (this.currentSample.insProduct[a].id == id) { + return this.currentSample.insProduct[a].inspectionValueType; + } + } + }, + // 鑾峰彇瑕佹眰鎻忚堪 + getTell(id) { + for (var a in this.currentSample.insProduct) { + if (this.currentSample.insProduct[a].id == id) { + return this.currentSample.insProduct[a].tell; + } + } + }, + // 鍔ㄦ�佽幏鍙栧崟鍏冩牸瀹藉害 + handleWidth(n) { + let sum = 0; + if (n.v.mc && n.v.mc.cs && n.v.mc.c != undefined) { + for (let i = 0; i < n.v.mc.cs; i++) { + let num = this.widthList[i + n.v.mc.c] + ? this.widthList[i + n.v.mc.c] + : 100; + sum += num; + } + } else { + sum = this.widthList[n.c] ? this.widthList[n.c] : 100; + } + return sum; + }, + // 瀵硅緭鍏ュ�艰繘琛屾牸寮忔牎楠� + handleInput(n) { + try { + n.v.v = n.v.v.replace(/[^\d.^e>锛炩墺鈮�<锛滄柇瑁傝剢鍖朶-/+]/g, ""); + n.v.v = n.v.v.replace(/\.{2,}/g, "."); //鍙繚鐣欑涓�涓�. 娓呴櫎澶氫綑鐨� + n.v.v = n.v.v + .replace(".", "$#$") + .replace(/\./g, "") + .replace("$#$", "."); + n.v.v = n.v.v.replace(/\/{2,}/g, "/"); //鍙繚鐣欑涓�涓�/娓呴櫎澶氫綑鐨� + n.v.v = n.v.v + .replace("/", "$#$") + .replace(/\//g, "") + .replace("$#$", "/"); + } catch (error) { + console.log(error); + } + }, + getInspectionItemType(id) { + for (var a in this.currentSample.insProduct) { + if (this.currentSample.insProduct[a].id == id) { + return this.currentSample.insProduct[a].inspectionItemType; + } + } + }, + // 鑾峰彇瑕佹眰鍊� + getAsk(id) { + for (var a in this.currentSample.insProduct) { + if (this.currentSample.insProduct[a].id == id) { + return this.currentSample.insProduct[a].ask; + } + } + }, + // 鑾峰彇鎵�鏈夎澶� + getEquipOptions(e, id) { + if (e) { + this.equipOptions = []; + search({ status: 0 }).then((res) => { + if (res.code === 200 && res.data) { + this.equipOptions = res.data.map((m) => { + m.value = m.managementNumber; + m.label = m.deviceName; + return m; + }); + } + }) + .catch((error) => { + console.error(error); + }); + } + }, + // getDic(e, id) { + // if (e) { + // for (var a in this.currentSample.insProduct) { + // if (this.currentSample.insProduct[a].id == id) { + // let str = this.currentSample.insProduct[a].dic; + // this.selectEnumByCategoryOfSelect(str); + // return str; + // } + // } + // } + // }, + openAddCheck() { + this.addCheck = true; + }, + // 澶嶆牳 + upInsReview(e) { + if (e == 1) { + // 閫氳繃 + this.reviewLoading = true; + verifyPlan({ + orderId: this.orderId, + type: 1, + laboratory: this.sonLaboratory, + tell: null, + userId: this.checkUser, + }).then((res) => { + if (res.code === 200) { + this.$message.success("鎿嶄綔鎴愬姛"); + this.goback(); + this.addCheck = false; + } + this.reviewLoading = false; + }) + .catch((error) => { + console.error(error); + this.reviewLoading = false; + }); + } else { + // 涓嶉�氳繃 + this.reviewDia = true; + } + }, + handleReviewDia() { + if (this.noReason) { + this.reviewLoading = true; + verifyPlan({ + orderId: this.orderId, + type: 0, + laboratory: this.sonLaboratory, + tell: this.noReason, + }).then((res) => { + if (res.code === 200) { + this.$message.success("鎿嶄綔鎴愬姛"); + this.goback(); + } + this.reviewLoading = false; + }) + .catch((error) => { + console.error(error); + this.reviewLoading = false; + }); + } else { + this.$message.error("鏈緭鍏ヤ笉閫氳繃鍘熷洜"); + } + }, + // 鏌ョ湅宸ユ椂 + viewManHour() { + this.$refs.viewManHourDia.showDialog(this.id, 99); + }, + openAddVerifyDia() { + this.addVerifyDia = true; + }, + submit() { + if (this.verifyUser === null || this.verifyUser === "") { + this.$message.error("璇锋寚瀹氬鏍镐汉鍛�"); + return; + } + if (!this.otherForm.humidity) { + this.$message.error("璇疯緭鍏ユ箍搴�"); + return; + } + if (!this.otherForm.temperature) { + this.$message.error("璇疯緭鍏ユ俯搴�"); + return; + } + this.submitLoading = true; + checkSubmitPlan({ + orderId: this.orderId, + laboratory: this.sonLaboratory, + }).then((res) => { + if (res.code === 200) { + if (!res.data || res.data.length == 0) { + this.submitLoading = true; + submitPlan({ + orderId: this.orderId, + laboratory: this.sonLaboratory, + verifyUser: this.verifyUser, + entrustCode: this.insOrder.entrustCode, + }).then((res) => { + if (res.code === 200) { + this.$message.success("鎿嶄綔鎴愬姛"); + this.goback(); + this.submitLoading = false; + this.addVerifyDia = false; + } + }) + .catch((error) => { + console.error(error); + this.submitLoading = false; + }); + } else { + let newData = []; + const h = this.$createElement; + for (let i in res.data) { + const lastChar = res.data[i].slice(-1); + if (lastChar == "-") { + res.data[i] = res.data[i].slice(0, -1); + } + newData.push( + h( + "p", + { style: "font-size: 14px;color: red;" }, + Number(i) + 1 + "銆�" + res.data[i] + ) + ); + } + newData.push( + h( + "p", + { + style: + "font-size: 16px;color:#000;margin-top:12px;overflow-y: auto;max-height:80vh", + }, + "浠ヤ笂椤圭洰涓嶅悎鏍硷紝纭畾鎻愪氦锛�" + ) + ); + this.$confirm("鎻愮ず", { + title: "鎻愮ず", + message: h("div", null, newData), + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "", + }) + .then(() => { + this.submitLoading = true; + submitPlan({ + orderId: this.orderId, + laboratory: this.sonLaboratory, + verifyUser: this.verifyUser, + }).then((res) => { + if (res.code === 200) { + this.$message.success("鎿嶄綔鎴愬姛"); + this.addVerifyDia = false; + this.goback(); + } + this.submitLoading = false; + }) + .catch((error) => { + console.error(error); + this.submitLoading = false; + }); + }) + .catch(() => { }); + } + } + }) + .catch((error) => { + console.error(error); + this.submitLoading = false; + }); + return; + }, + // 缁熶竴鍦ㄨ繖閲屼繚瀛樻暟鎹� + saveInsContext(currentInsItemId) { + try { + if (this.param) { + let param = null; + if (currentInsItemId) { + param = { [currentInsItemId]: this.param[currentInsItemId] }; + } else { + param = this.param; + } + saveInsContext({ + param: JSON.stringify(param), + currentTable: this.currentTable, + sampleId: this.currentSample.id, + orderId: this.orderId, + sonLaboratory: this.sonLaboratory + }).then((res) => { + this.$message.success("宸蹭繚瀛�"); + }); + // 鍚� Worker 鍙戦�佹秷鎭紝寮�濮嬪鐞嗛�昏緫 + this.worker.postMessage( + JSON.stringify({ + modelType: this.sampleProduct[0].model, + type: "saveData", + tableList: this.tableList, + param: this.param, + currentTable: this.currentTable, + }) + ); + } + } catch (error) { + console.log(999, error); + } + }, + // 璁惧鏀瑰彉 + changeEquip(val, n, v) { + try { + // this.$set(n.v,'v',val) + this.tableList[0].arr.forEach((item, index) => { + item.forEach((m, i) => { + if (this.param[m.i]) { + this.param[m.i].state = 1; + } + // if(m.i==n.i&&m.v.ps&&m.v.ps.value=='璁惧鍚嶇О'&&v){ + // this.$set(m.v,'v',v) + // } + }); + }); + for (let i in this.param) { + if (this.param[i].state != 1) { + delete this.param[i]; + } + } + // this.equipOptions涓鸿澶囧悕绉颁笅鎷夋閫夐」鏁版嵁 + for (let i1 in this.param[n.i].equipName) { + if ( + this.param[n.i].equipName[i1].i === n.i && + this.param[n.i].equipName[i1].r === n.r + ) { + this.$delete(this.param[n.i].equipValue[i1].v, "v"); + // 灏嗘暟缁勮祴鍊肩粰璁惧缂栫爜 + this.$set(this.param[n.i].equipValue[i1].v, "v", val.join("锛�")); + this.$delete(this.param[n.i].equipName[i1].v, "v"); + // 灏嗘暟缁勮祴鍊肩粰璁惧缂栫爜 + this.$set(this.param[n.i].equipName[i1].v, "v", val); + this.tableList[0].arr.forEach((item, index) => { + item.forEach((m) => { + if (m.i == n.i && m.v.ps && m.v.ps.value == "璁惧缂栫爜") { + this.$set(m.v, "v", val.join("锛�")); + } + if (m.i == n.i && m.v.ps && m.v.ps.value == "璁惧鍚嶇О") { + this.$set(m.v, "v", val); + } + }); + }); + } + } + // 淇濆瓨鏁版嵁 + this.saveInsContext(n.i); + } catch (e) { + console.log("changeEquip----", e); + } + }, + getAuthorizedPerson() { + selectUserCondition({ type: 1 }).then((res) => { + let data = []; + res.data.forEach((a) => { + data.push({ + label: a.name, + value: a.id, + }); + }); + this.personList = data; + }); + }, + scrollInit() { + // 鑾峰彇瑕佺粦瀹氫簨浠剁殑鍏冪礌 + const nav = document.getElementById("nav"); + var flag; // 榧犳爣鎸変笅 + var downX; // 榧犳爣鐐瑰嚮鐨剎涓嬫爣 + var scrollLeft; // 褰撳墠鍏冪礌婊氬姩鏉$殑鍋忕Щ閲� + nav.addEventListener("mousedown", function (event) { + flag = true; + downX = event.clientX; // 鑾峰彇鍒扮偣鍑荤殑x涓嬫爣 + scrollLeft = this.scrollLeft; // 鑾峰彇褰撳墠鍏冪礌婊氬姩鏉$殑鍋忕Щ閲� + }); + nav.addEventListener("mousemove", function (event) { + if (flag) { + // 鍒ゆ柇鏄惁鏄紶鏍囨寜涓嬫粴鍔ㄥ厓绱犲尯鍩� + var moveX = event.clientX; // 鑾峰彇绉诲姩鐨剎杞� + var scrollX = moveX - downX; // 褰撳墠绉诲姩鐨剎杞翠笅鏍囧噺鍘诲垰鐐瑰嚮涓嬪幓鐨剎杞翠笅鏍囧緱鍒伴紶鏍囨粦鍔ㄨ窛绂� + this.scrollLeft = scrollLeft - scrollX; // 榧犳爣鎸変笅鐨勬粴鍔ㄦ潯鍋忕Щ閲忓噺鍘诲綋鍓嶉紶鏍囩殑婊戝姩璺濈 + } + }); + // 榧犳爣鎶捣鍋滄鎷栧姩 + nav.addEventListener("mouseup", function () { + flag = false; + }); + // 榧犳爣绂诲紑鍏冪礌鍋滄鎷栧姩 + nav.addEventListener("mouseleave", function (event) { + flag = false; + }); + }, + // 椤甸潰閲岄潰鍒囨崲鏍峰搧 + async caretSample(num) { + let index = this.currentKey + num; + if (index < 1) { + this.$message.error("褰撳墠鏄涓�涓牱鍝�"); + return; + } else if (index > this.sampleProduct.length) { + this.$message.error("褰撳墠鏄渶鍚庝竴涓牱鍝�"); + return; + } + this.currentKey = index; + this.currentSample = this.HaveJson(this.sampleProduct[index - 1]); + // 鑾峰彇妫�楠岄」 + let list = await this.getCurrentProduct(this.currentSample.id, 0); + this.currentSample.insProduct = this.HaveJson(list); + // 鍒濆鍖栧悗绔紶鍙� + this.param = {}; + this.changeType = 0; + this.currentSample.insProduct.forEach((a, j) => { + this.param[a.id] = { + insValue: [], + comValue: [], + resValue: null, + equipValue: [], + equipName: [], + insResult: null, + }; + }); + // 椤甸潰鏁版嵁澶勭悊 + this.getTableLists(); + // 鏇存柊鍒板绾跨▼ + this.worker.postMessage( + JSON.stringify({ + modelType: this.sampleProduct[0].model, + type: "saveData", + tableList: this.tableList, + param: this.param, + currentTable: this.currentTable, + }) + ); + }, + handleSuccessUp(response) { + this.upLoading = false; + if (response.code == 200) { + this.$message.success("涓婁紶鎴愬姛"); + this.getList(); + } + }, + beforeUpload(file) { + if (file.size > 1024 * 1024 * 10) { + this.$message.error("涓婁紶鏂囦欢涓嶈秴杩�10M"); + this.$refs.upload.clearFiles(); + return false; + } else { + this.upLoading = true; + return true; + } + }, + onError(err, file, fileList) { + this.$message.error("涓婁紶澶辫触"); + this.$refs.upload.clearFiles(); + }, + handleDown(row) { + downFile({ id: row.id }).then((res) => { + this.$download.saveAs(res.data.fileUrl, row.fileName) + }) + .catch((error) => { }); + }, + /** + * 灏嗘暟鍊紇淇濈暀ct.fa涓�'##'鍚庣殑鎸囧畾灏忔暟浣嶆暟锛屽苟杩斿洖鏍煎紡鍖栧悗鐨勫瓧绗︿覆銆� + * + * @param v 瑕佹牸寮忓寲鐨勬暟鍊� + * @param ct 鍖呭惈鏍煎紡鍖栭厤缃殑瀵硅薄 + * @param ct.fa 鏍煎紡鍖栭厤缃瓧绗︿覆锛岃嫢鍖呭惈'##'鍒欐寜鐓у叾鍚庣殑鍐呭纭畾灏忔暟浣嶆暟 + * @returns 鏍煎紡鍖栧悗鐨勫瓧绗︿覆鎴栧師濮嬫暟鍊硷紙鑻ラ厤缃笉绗﹀悎瑕佹眰锛� + */ + toFixed(v, ct) { + if (v && ct && ct.fa) { + if (ct.fa.includes(".")) { + let num = ct.fa.slice(4).length; + return Number(v).toFixed(num); + } else { + return v; + } + } else { + return v; + } + }, + goback() { + this.$router.go(-1) + } + }, +}; +</script> +<style scoped> +.custom-table .el-table__header-wrapper th { + background-color: #87ceeb; + /* 鍙甯︽湁my-custom-table绫荤殑琛ㄦ牸鐢熸晥 */ + color: #fff; +} + +.container { + overflow: auto; + /* 纭繚瀹瑰櫒鑳藉寘瑁规诞鍔ㄥ厓绱� */ + margin-bottom: 10px; +} + +.right-button { + float: right; +} + +.inspection { + height: 100%; + overflow-y: auto; +} + +.inspection::-webkit-scrollbar { + width: 0; +} + +.title { + height: 60px; + line-height: 60px; + padding: 0 16px; +} + +.search { + width: 100%; + background-color: #fff; + border-radius: 3px; + margin-bottom: 10px; +} + +.search .form-inline { + padding-top: 20px; + padding-left: 0px; + text-align: left; +} + +.center { + width: 100%; + /* max-height: 580px; */ + background-color: #fff; + border-radius: 3px; + padding: 20px; + overflow: auto; +} + +.center-box { + display: flex; + align-items: center; + justify-content: center; + flex-direction: column; + flex-wrap: wrap; + width: 100%; + overflow-x: auto; + /* overflow-x: scroll; */ + cursor: grab; +} + +.center-box:active { + cursor: grabbing; +} + +.tables { + table-layout: fixed; + margin: 5px 5px 16px; + border-collapse: collapse; +} + +.tables td { + height: 40px; + width: 100px; + text-align: center; + font-size: 14px; + word-wrap: break-word; + white-space: normal; +} + +.thermal-table { + min-width: calc(100% - 10px); + margin: 5px 5px 0; + table-layout: fixed; +} + +.thermal-table td { + min-width: 70px; + text-align: center; + font-size: 14px; + word-wrap: break-word; + white-space: normal; + padding: 5px; +} + +.table-container { + overflow-x: auto; + /* 浣垮鍣ㄦ敮鎸佹í鍚戞粴鍔� */ + max-width: 100%; + /* 闄愬埗瀹瑰櫒鐨勬渶澶у搴� */ + margin-bottom: 16px; +} + +.content { + display: flex; + height: 100%; + align-items: center; + justify-content: left; + padding: 5px; + box-sizing: border-box; + overflow: hidden; + user-select: none; +} + +.content * { + user-select: none; +} + +.content-h-0 { + justify-content: center; +} + +.content-h-1 { + justify-content: start; +} + +.content-h-2 { + justify-content: flex-end; +} + +.content-v-0 { + align-items: center; +} + +.content-v-1 { + align-items: start; +} + +.content-v-2 { + align-items: end; +} + +.table_input { + width: 100%; + height: 100%; +} + +.table_input>>>.el-input__inner { + border-color: rgba(0, 0, 0, 0.5) !important; +} + +.collection { + width: 50px; + height: 100%; + margin-left: 5px; + border-color: transparent; + background-color: #409eff; + color: #fff; + border-radius: 4px; + font-size: 12px; +} + +.collection:active { + opacity: 0.7; +} + +.table_caret { + font-size: 16px; + margin: 0 5px; + color: rgba(0, 0, 0, 0.5); +} + +.table_caret:hover { + color: #409eff; + cursor: pointer; +} + +.table_caret:active { + opacity: 0.8; +} + +>>>input::-webkit-inner-spin-button { + -webkit-appearance: none !important; + /* 闅愯棌寰皟鎸夐挳 */ + margin: 0 !important; + /* 绉婚櫎寰皟鎸夐挳鐨勮竟璺� */ +} + +>>>input[type="number"] { + -moz-appearance: textfield !important; + /* 閽堝 Firefox */ +} + +>>>.el-form-item__content { + display: inline-flex; + align-items: center; +} +</style> +<style scoped> +/* .inspection .el-form-item__label { + color: #000; +} */ + +.inspection .el-drawer__header::before { + content: ""; + display: inline-block; + width: 4px; + height: 30.24px; + background: #3a7bfa; + border-radius: 10px; + margin-left: 32px; + margin-right: 8.5px; +} + +.inspection .el-drawer__header { + color: #303133; + text-align: left; +} + +.inspection .el-input-group__append { + padding: 0 14px; + color: #3a7bfa; + background-color: #fff; + height: 100%; + display: flex; + align-items: center; +} + +.inspection .center-box .el-input__inner { + font-size: 12px; + padding: 0 6px; + text-align: center; +} + +.inspection .el-textarea__inner { + padding: 2px; +} + +.inspection .el-textarea__inner::-webkit-scrollbar { + width: 0; +} + +.inspection .el-select { + display: flex; + align-items: center; +} + +.inspection .el-textarea__inner { + min-height: 100% !important; +} + +.inspection .tables .el-input { + display: flex; + align-items: center; +} + +.thermal-table .el-input { + display: flex; + align-items: center; +} + +.custom-dialog .el-dialog__body { + max-width: 1000px; + /* 璁剧疆鏈�澶у搴� */ +} +</style> diff --git a/src/views/business/materialOrder/index.vue b/src/views/business/materialOrder/index.vue index 7cb87e6..bf66e82 100644 --- a/src/views/business/materialOrder/index.vue +++ b/src/views/business/materialOrder/index.vue @@ -1108,31 +1108,58 @@ let inspectorList = [] inspectorList.push(this.nickName) this.InspectInfoDialog = false - this.$router.push({ - name: "Inspection", - query: { - sonLaboratory: '鍘熸潗鏂�', - state: 3, - typeSource: this.insInfo.typeSource, - orderId: this.insInfo.enterOrderId, - inspectorList: inspectorList, - }, - }) + console.log('this.checkPermi([\'business:inspectionView\'])---', this.checkPermi(['business:inspectionView'])) + if (this.checkPermi(['business:inspectionView'])) { + this.$router.push({ + name: "InspectionView", + query: { + sonLaboratory: '鍘熸潗鏂�', + state: 3, + typeSource: this.insInfo.typeSource, + orderId: this.insInfo.enterOrderId, + inspectorList: inspectorList, + }, + }) + } else { + this.$router.push({ + name: "Inspection", + query: { + sonLaboratory: '鍘熸潗鏂�', + state: 3, + typeSource: this.insInfo.typeSource, + orderId: this.insInfo.enterOrderId, + inspectorList: inspectorList, + }, + }) + } }, viewInsInfo1() { let inspectorList = [] inspectorList.push(this.nickName) this.InspectInfoDialog = false - this.$router.push({ - name: "Inspection", - query: { - sonLaboratory: '鍘熸潗鏂�', - state: 3, - typeSource: this.insInfo.typeSource, - orderId: this.insInfo.quarterOrderId, - inspectorList: inspectorList, - }, - }) + if (this.checkPermi(['business:inspectionView'])) { + this.$router.push({ + name: "InspectionView", + query: { + sonLaboratory: '鍘熸潗鏂�', + state: 3, + typeSource: this.insInfo.typeSource, + orderId: this.insInfo.quarterOrderId, + inspectorList: inspectorList, + }, + }) + } else { + this.$router.push({ + name: "Inspection", + query: { + sonLaboratory: '鍘熸潗鏂�', + state: 3, + typeSource: this.insInfo.typeSource, + orderId: this.insInfo.quarterOrderId, + inspectorList: inspectorList, + }, + }) + } }, goback() { this.state = 0 diff --git a/src/views/business/productOrder/index.vue b/src/views/business/productOrder/index.vue index 09bb69e..44f96ec 100644 --- a/src/views/business/productOrder/index.vue +++ b/src/views/business/productOrder/index.vue @@ -784,6 +784,11 @@ ...mapGetters(["nickName"]), }, mounted() { + if (this.checkPermi(['get:raw:await'])) { + this.tabIndex = 0 + } else { + this.tabIndex = 2 + } this.refreshTable() this.getAuthorizedPerson() }, @@ -1265,16 +1270,29 @@ inspectorList = row.userName.split(',') } inspectorList.push(this.nickName) - this.$router.push({ - path: "/inspectionTask/inspection", - query: { - sonLaboratory: row.sonLaboratory, - state: 3, - typeSource: row.typeSource, - orderId: row.id, - inspectorList: inspectorList, - }, - }) + if (this.checkPermi(['business:inspectionView'])) { + this.$router.push({ + name: "InspectionView", + query: { + sonLaboratory: row.sonLaboratory, + state: 3, + typeSource: row.typeSource, + orderId: row.id, + inspectorList: inspectorList, + }, + }) + } else { + this.$router.push({ + path: "/inspectionTask/inspection", + query: { + sonLaboratory: row.sonLaboratory, + state: 3, + typeSource: row.typeSource, + orderId: row.id, + inspectorList: inspectorList, + }, + }) + } }, goback() { this.state = 0 -- Gitblit v1.9.3