| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883 |
- <!-- 质检内容 -->
- <template>
- <el-row>
- <!-- 选择质检方案 -->
- <inspectionTemplateDialog
- ref="inspectionTemplateRef"
- @choose="inspectionTemplateSuccess"
- ></inspectionTemplateDialog>
- <header-title title="检测内容">
- <el-button
- type="primary"
- :loading="loading"
- v-if="type != 'detail'"
- @click="$emit('batch-quality')"
- >批量检测</el-button
- >
- <!-- <el-button
- type="primary"
- :loading="loading"
- v-if="type != 'detail'"
- @click="$emit('batch-dispose')"
- >批量处置</el-button
- > -->
- </header-title>
- <el-tabs v-model="activeNameKK" @tab-click="handleClick">
- <!-- -->
- <el-tab-pane label="来源清单" name="1">
- <ele-pro-table
- ref="sourceTable"
- :columns="tableColumns1"
- :datasource="datasource"
- @selection-change="handleSelectionChange"
- :initLoad="false"
- :needPage="false"
- height="500px"
- >
- <!-- :pagination="true" -->
- <!-- <template
- v-slot:toolbar
- v-if="form.qualityMode == 2 && type != 'detail'"
- >
- <el-dropdown trigger="click" @command="handleSampleNumber">
- <el-link type="primary" icon="el-icon-plus">取样</el-link>
- <el-dropdown-menu slot="dropdown">
- <el-dropdown-item command="1">取整样</el-dropdown-item>
- <el-dropdown-item command="2">取小样</el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown>
- </template> -->
- <template v-slot:toolkit v-if="form.qualityMode == 2">
- <el-row>
- <el-form
- ref="ruleForm"
- :model="formData"
- label-width="60px"
- size="mini"
- :rules="rules"
- class="flex"
- :show-message="false"
- >
- <el-col :span="6" v-if="conditionType == 2">
- <el-form-item
- prop="number"
- label-width="0"
- style="margin-bottom: 0"
- >
- <el-input
- v-model="formData.number"
- placeholder="请输入"
- size="mini"
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="6" v-if="conditionType == 2">
- <el-form-item
- prop="sampleUnit"
- label-width="0"
- style="margin: 0"
- >
- <DictSelection
- dictName="计量单位"
- clearable
- v-model="formData.sampleUnit"
- size="mini"
- filter-placeholder="请输入计量单位搜索"
- @change="changeSamUnit"
- ></DictSelection>
- </el-form-item>
- </el-col>
- <el-col :span="8" v-if="conditionType == 2">
- <el-form-item prop="portion" label="数量" style="margin: 0">
- <el-input
- v-model="formData.portion"
- placeholder="请输入"
- size="mini"
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="10" v-if="conditionType == 1">
- <el-form-item prop="portion" label="数量" style="margin: 0">
- <el-input
- v-model="formData.portion"
- placeholder="请输入"
- size="mini"
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="10" v-if="conditionType == 1">
- <el-form-item
- prop="packingUnit"
- label="单位"
- style="margin: 0"
- >
- <el-select
- v-model="formData.packingUnit"
- placeholder="请选择"
- >
- <el-option
- v-for="item in packingSpecificationOption"
- :key="item.id"
- :label="item.conversionUnit"
- :value="item.id"
- >
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col
- :span="4"
- style="text-align: right"
- v-if="conditionType == 2"
- >
- <el-button
- type="primary"
- size="mini"
- @click="handleSampleSubmit"
- style="margin-right: 12px"
- >确认</el-button
- >
- </el-col>
- <el-col
- :span="4"
- style="text-align: right"
- v-if="conditionType == 1"
- >
- <el-button
- type="primary"
- size="mini"
- @click="handleSampleSubmit"
- style="margin-right: 12px"
- >确认</el-button
- >
- </el-col>
- </el-form>
- </el-row>
- </template>
- <template v-slot:materielDesignation="{ row }">
- <el-input
- v-model="row.materielDesignation"
- placeholder="请输入"
- ></el-input>
- </template>
- <template v-slot:clientCode="{ row }">
- <el-input v-model="row.clientCode" placeholder="请输入"></el-input>
- </template>
- <template v-slot:engrave="{ row }">
- <el-input v-model="row.engrave" placeholder="请输入"></el-input>
- </template>
- <template v-slot:weight="{ row }">
- <el-input v-model="row.weight" placeholder="请输入"></el-input>
- </template>
- </ele-pro-table>
- </el-tab-pane>
- <!-- -->
- <el-tab-pane label="样品清单" name="2">
- <el-table
- v-if="sampleList.length > 0"
- ref="showSampleListTable"
- :data="paginatedSampleList"
- tooltip-effect="dark"
- height="500"
- border
- row-key="id"
- >
- <el-table-column
- label="序号"
- type="index"
- width="50"
- align="center"
- fixed="left"
- ></el-table-column>
- <template v-for="(column, index) in tableColumns">
- <el-table-column
- :key="index"
- :label="column.label"
- :prop="column.prop"
- :fixed="column.fixed"
- :show-overflow-tooltip="true"
- :width="column.width"
- :align="column.align"
- >
- <template slot-scope="scope">
- <template v-if="column.prop === 'categoryCode'">
- <el-link
- type="primary"
- :underline="false"
- @click="handleDetail(scope.$index, scope.row, 'detail')"
- >
- {{ scope.row.categoryCode }}
- </el-link>
- </template>
- <template v-else-if="column.prop === 'materielDesignation'">
- <el-input
- :disabled="status"
- v-model="scope.row.materielDesignation"
- size="mini"
- v-direction="{ x: 0, y: scope.$index }"
- ></el-input>
- </template>
- <template v-else-if="column.prop === 'clientCode'">
- <el-input
- :disabled="status"
- v-model="scope.row.clientCode"
- size="mini"
- v-direction="{ x: 1, y: scope.$index }"
- ></el-input>
- </template>
- <template v-else-if="column.prop === 'engrave'">
- <el-input
- :disabled="status"
- v-model="scope.row.engrave"
- size="mini"
- v-direction="{ x: 2, y: scope.$index }"
- ></el-input>
- </template>
- <template v-else-if="column.prop === 'weight'">
- <el-input
- v-model="scope.row.weight"
- :disabled="status"
- oninput="value = value.replace(/[^\d.]/g, '')"
- :min="0"
- @input="inputWeight(scope.row, scope.$index)"
- size="mini"
- v-direction="{ x: 3, y: scope.$index }"
- ></el-input>
- </template>
- <template v-else>
- {{ scope.row[column.prop] }}
- </template>
- </template>
- </el-table-column>
- </template>
- <el-table-column
- label="图片"
- prop="imgUrl"
- align="center"
- :show-overflow-tooltip="true"
- >
- <template slot-scope="scope">
- <span
- ><fileMain v-model="scope.row.imgUrl" type="view"></fileMain
- ></span>
- </template>
- </el-table-column>
- <!-- *** fixed="right" -->
- <el-table-column
- label="处置状态"
- prop="disposeType"
- align="center"
- :show-overflow-tooltip="true"
- >
- <template slot-scope="scope">
- <span>{{ disposeTypeList[scope.row.disposeType] }}</span>
- </template>
- </el-table-column>
- <!-- *** fixed="right" -->
- <el-table-column
- label="处置时间"
- prop="disposeTime"
- align="center"
- :show-overflow-tooltip="true"
- >
- </el-table-column>
- <!-- *** fixed="right" -->
- <el-table-column
- label="状态"
- prop="status"
- align="center"
- fixed="right"
- :show-overflow-tooltip="true"
- v-if="form.recordingMethod != 1"
- >
- <template slot-scope="scope">
- {{
- inspectionProjectStatus.find(
- (item) => item.value == scope.row.status
- )?.label
- }}
- </template>
- </el-table-column>
- <!-- <el-table-column
- label="质检状态"
- prop="qualityStatus"
- align="center"
- fixed="right"
- :show-overflow-tooltip="true"
- v-if="form.recordingMethod != 1"
- >
- <template slot-scope="scope">
- <span v-if="scope.row.qualityStatus == 0">未检</span>
- <span v-if="scope.row.qualityStatus == 1">已检</span>
- <span v-if="scope.row.qualityStatus == 2">待检</span>
- </template>
- </el-table-column> -->
- <el-table-column
- label="检测结果"
- prop="qualityResults"
- align="center"
- width="180"
- fixed="right"
- :show-overflow-tooltip="true"
- v-if="form.recordingMethod != 1"
- >
- <template slot-scope="scope">
- <el-select
- @change="selectQualityResultsChange"
- v-model="scope.row.qualityResults"
- placeholder="请选择"
- style="width: 100%"
- :disabled="type == 'detail' || scope.row.correlationId"
- size="mini"
- >
- <el-option
- v-for="item in qualityResultsList"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </template>
- </el-table-column>
- <el-table-column
- label="不良类型"
- align="center"
- v-if="form.recordingMethod != 1"
- prop="badTypeId"
- width="180"
- >
- <template v-slot="{ row, $index }">
- <el-select
- v-model="row.badTypeId"
- placeholder="请选择不良类型"
- size="small"
- style="width: 100%"
- remote
- filterable
- clearable
- @change="badTypeChange(row)"
- :disabled="type == 'detail' || row.correlationId"
- >
- <el-option
- v-for="item in badTypeList"
- :key="item.id"
- :label="item.name"
- :value="item.id"
- >
- </el-option>
- </el-select>
- </template>
- </el-table-column>
- <el-table-column
- label="不良名称"
- align="center"
- prop="badNameId"
- width="180"
- v-if="form.recordingMethod != 1"
- >
- <template v-slot="{ row, $index }">
- <el-select
- v-model="row.badNameId"
- placeholder="请选择不良名称"
- size="small"
- style="width: 100%"
- remote
- filterable
- clearable
- @change="badNameChange(row)"
- :disabled="type == 'detail' || row.correlationId"
- >
- <el-option
- v-for="item in badNameList"
- :key="item.id"
- :label="item.name"
- :value="item.id"
- >
- </el-option>
- </el-select>
- </template>
- </el-table-column>
- <el-table-column
- label="操作"
- align="center"
- width="120"
- fixed="right"
- v-if="type != 'detail' && form.recordingMethod != 1"
- >
- <template slot-scope="scope">
- <el-link
- :type="scope.row.isValid ? 'primary' : 'danger'"
- :underline="false"
- v-if="!scope.row.correlationId"
- @click="handleDetail(scope.$index, scope.row, 'report')"
- >
- 检测
- </el-link>
- <!-- <el-link
- type="primary"
- :underline="false"
- @click="handleDispose(scope.$index, scope.row, 'dispose')"
- >处置
- </el-link> -->
- </template>
- </el-table-column>
- </el-table>
- <!-- <el-pagination
- @size-change="handleSampleSizeChange"
- @current-change="handleSampleCurrentChange"
- :current-page="samplePagination.currentPage"
- :page-sizes="[10, 20, 50, 100]"
- :page-size="samplePagination.pageSize"
- layout="total, sizes, prev, pager, next, jumper"
- :total="sampleList.length"
- /> -->
- </el-tab-pane>
- <!-- -->
- <el-tab-pane label="检测方案" name="3">
- <el-button
- v-if="type !== 'detail'"
- @click="addInspectionTemplate"
- type="primary"
- style="margin-top: 5px"
- >选择检测方案</el-button
- >
- <el-button
- v-if="type !== 'detail'"
- @click="delAll"
- type="danger"
- style="margin-top: 5px"
- >批量删除</el-button
- >
- <el-table
- :data="paginatedSchemeList"
- tooltip-effect="dark"
- height="500"
- border
- row-key="id"
- @selection-change="handleSelectionChange1"
- >
- <el-table-column
- type="selection"
- width="55"
- align="center"
- :selectable="
- (row) => {
- return type == 'detail' || ![1, 2, 3, 4].includes(row.status);
- }
- "
- >
- </el-table-column>
- <el-table-column
- label="序号"
- type="index"
- width="50"
- align="center"
- ></el-table-column>
- <el-table-column
- label="检测方案编码"
- prop="qualitySchemeTemplateCode"
- align="center"
- >
- </el-table-column>
- <el-table-column
- label="检测方案名称"
- prop="qualitySchemeTemplateName"
- align="center"
- ></el-table-column>
- <el-table-column
- label="检测类型"
- prop="categoryLevelClassName"
- align="center"
- ></el-table-column>
- <el-table-column
- label="检测项编码"
- prop="inspectionCode"
- align="center"
- ></el-table-column>
- <el-table-column
- label="检测项名称"
- prop="inspectionName"
- align="center"
- ></el-table-column>
- <el-table-column label="附件" prop="imgUrl" align="center">
- <template slot-scope="scope">
- <fileMain v-model="scope.row.imgUrl" type="view"></fileMain>
- </template>
- </el-table-column>
- <el-table-column
- label="工艺参数"
- show-overflow-tooltip
- prop="defaultValue"
- align="center"
- min-width="220px"
- >
- <template slot-scope="scope">
- <div style="display: flex; justify-content: center">
- <span v-if="scope.row.textType != 8">{{
- scope.row.symbol
- }}</span>
- <span v-if="scope.row.textType == 3">
- {{ scope.row.minValue }}-{{ scope.row.maxValue }}
- </span>
- <span v-else-if="scope.row.textType == 8">
- 标准值:{{ scope.row.defaultValue
- }}{{ scope.row.unitName || '' }} 下限:{{
- scope.row.minValue || 0
- }}{{ scope.row.unitName || '' }} 上限:{{
- scope.row.maxValue || 0
- }}{{ scope.row.unitName || '' }}
- </span>
- <span v-else>
- <span>{{ scope.row.defaultValue }}</span>
- </span>
- <span v-if="scope.row.textType != 8">
- {{ scope.row.unitName }}
- </span>
- </div>
- </template>
- </el-table-column>
- <el-table-column
- label="执行方法"
- prop="executionMethod"
- align="center"
- :show-overflow-tooltip="true"
- v-if="form.recordingMethod == 1"
- >
- <template slot-scope="scope">
- {{ scope.row.executionMethod == 1 ? '常规' : '实验' }}
- </template></el-table-column
- >
- <el-table-column
- label="检测状态"
- prop="status"
- align="center"
- :show-overflow-tooltip="true"
- v-if="form.recordingMethod == 1"
- >
- <template slot-scope="scope">
- {{
- inspectionProjectStatus.find(
- (item) => item.value == scope.row.status
- )?.label
- }}
- </template>
- </el-table-column>
- <el-table-column
- label="检测结果"
- prop="qualityResults"
- align="center"
- width="180"
- :show-overflow-tooltip="true"
- v-if="form.recordingMethod == 1"
- >
- <template slot-scope="scope">
- <el-select
- @change="selectQualityResultsChange"
- v-model="scope.row.qualityResults"
- placeholder="请选择"
- style="width: 100%"
- :disabled="
- type == 'detail' || [2, 3, 4].includes(scope.row.status)
- "
- size="mini"
- >
- <el-option
- v-for="item in qualityResultsList"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </template>
- </el-table-column>
- <el-table-column label="操作" width="150" v-if="type !== 'detail'">
- <template slot-scope="scope">
- <!-- <el-link
- v-if="form.recordingMethod == 1"
- :type="scope.row.isValid ? 'primary' : 'danger'"
- :underline="false"
- @click="inspectionProjectReport(scope.$index, scope.row)"
- >
- 质检
- </el-link> -->
- <el-popconfirm
- class="ele-action"
- title="确定要删除当前方案吗?"
- @confirm="handDel(scope.$index)"
- v-if="![1, 2, 3, 4].includes(scope.row.status)"
- >
- <template v-slot:reference>
- <el-link
- type="danger"
- :underline="false"
- icon="el-icon-delete"
- >
- 删除
- </el-link>
- </template>
- </el-popconfirm>
- </template>
- </el-table-column>
- </el-table>
- <!-- <el-pagination
- @size-change="handleSchemeSizeChange"
- @current-change="handleSchemeCurrentChange"
- :current-page="schemePagination.currentPage"
- :page-sizes="[10, 20, 50, 100]"
- :page-size="schemePagination.pageSize"
- layout="total, sizes, prev, pager, next, jumper"
- :total="schemeList.length"
- /> -->
- </el-tab-pane>
- <el-tab-pane label="检测任务单" name="4">
- <ele-pro-table
- ref="table"
- :columns="taskColumns"
- :datasource="form.taskMonadList"
- :needPage="false"
- >
- </ele-pro-table>
- </el-tab-pane>
- <el-tab-pane label="检测请托单" name="5">
- <ele-pro-table
- ref="table"
- :columns="entrustColumns"
- :datasource="form.requestEntrustList"
- :needPage="false"
- >
- </ele-pro-table>
- </el-tab-pane>
- <el-tab-pane label="工艺文件" name="6">
- <wokePopupList ref="wokePopupListRef"></wokePopupList>
- </el-tab-pane>
- </el-tabs>
- </el-row>
- </template>
- <script>
- import inspectionTemplateDialog from '@/views/inspectionTemplate/components/inspectionTemplateDialog.vue';
- import wokePopupList from '@/components/workList/wokePopupList.vue';
- import { parameterGetByCode } from '@/api/main/index';
- import {
- getDetails,
- getCategoryPackageDisposition
- } from '@/api/classifyManage/itemInformation';
- import {
- save,
- update,
- getById,
- exeReportWork,
- queryQualitySamplContent,
- queryQualityTempleContent,
- queryQualityInventory,
- newFilePageAPI
- } from '@/api/inspectionWork';
- import { getQualityTemplateByIds } from '@/api/inspectionTemplate';
- import { getCodeList } from '@/api/login';
- import { inspectionProjectStatus } from '@/enum/dict.js';
- import dictMixins from '@/mixins/dictMixins';
- import { getList as getBadNameList } from '@/api/unacceptedProduct/unqualifiedName';
- import { getList as getBadTypeList } from '@/api/unacceptedProduct/unqualifiedType';
- export default {
- mixins: [dictMixins],
- components: {
- inspectionTemplateDialog,
- wokePopupList
- },
- watch: {
- schemeList: {
- handler(newVal, oldVal) {
- this.templateList = newVal;
- // console.log(newVal, 'schemeList');
- },
- deep: true,
- immediate: true
- },
- activeName: {
- handler(newVal) {
- this.activeNameKK = newVal;
- // console.log(newVal);
- }
- }
- },
- props: {
- type: String,
- packingList: Array,
- sampleList: Array,
- schemeList: Array,
- fileParam: Array,
- loading: Boolean,
- form: Object,
- ids: String,
- activeName: String,
- status: Boolean,
- productId: {
- type: String,
- default: ''
- }
- },
- data() {
- return {
- // 不良品类型列表
- fileTableList: [],
- selection1: [],
- badTypeList: [],
- // 不良名称列表
- badNameList: [],
- inspectionProjectStatus,
- disposeTypeList: {
- 1: '返工',
- 2: '返修',
- 3: '报废',
- 4: '降级使用',
- 5: '让步接收',
- 6: '留样',
- 7: '消耗',
- 8: '回用/归批',
- 9: '转试销',
- 10: '退货'
- },
- templateList: [],
- planTemplateList: [],
- activeNameKK: '',
- samplePagination: { currentPage: 1, pageSize: 10 },
- schemePagination: { currentPage: 1, pageSize: 10 },
- qualityResultsList: [
- {
- value: 1,
- label: '合格'
- },
- {
- value: 2,
- label: '不合格'
- },
- {
- value: 3,
- label: '让步接收'
- }
- ],
- tableColumns: [
- {
- label: '样品编码',
- prop: 'sampleCode',
- width: '200',
- align: 'center',
- fixed: 'left'
- },
- {
- label: '编码',
- prop: 'categoryCode',
- align: 'center',
- fixed: 'left'
- },
- {
- label: '名称',
- prop: 'categoryName',
- align: 'center'
- },
- { label: '批次号', prop: 'batchNo', align: 'center' },
- { label: '发货条码', prop: 'barcodes', align: 'center' },
- { label: '包装编码', prop: 'packageNo', align: 'center' },
- { label: '包装数量', prop: 'packingQuantity', align: 'center' },
- { label: '包装单位', prop: 'packingUnit', align: 'center' },
- { label: '计量数量', prop: 'measureQuantity', align: 'center' },
- { label: '计量单位', prop: 'measureUnit', align: 'center' },
- {
- label: '供应商名称',
- prop: 'supplierName',
- align: 'center',
- width: '120'
- },
- {
- label: '供应商代号',
- prop: 'supplierCode',
- align: 'center',
- width: '120'
- },
- {
- label: '物料代号',
- prop: 'materielDesignation',
- align: 'center',
- slot: 'materielDesignation',
- width: '120'
- },
- {
- label: '客户代号',
- prop: 'clientCode',
- align: 'center',
- slot: 'clientCode',
- width: '120'
- },
- {
- label: '刻码',
- prop: 'engrave',
- align: 'center',
- slot: 'engrave',
- width: '120'
- },
- {
- label: '机型',
- prop: 'modelKey',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- label: '颜色',
- prop: 'colorKey',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- label: '型号',
- prop: 'modelType',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- label: '规格',
- prop: 'specification',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- label: '电压等级',
- prop: 'voltage',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- label: '重量',
- prop: 'weight',
- align: 'center',
- slot: 'weight',
- width: '120'
- },
- {
- label: '重量单位',
- prop: 'weightUnit',
- align: 'center',
- width: 100
- },
- { label: '仓库', prop: 'warehouseName', align: 'center', width: 100 },
- { label: '货区', prop: 'areaName', align: 'center' },
- { label: '货架', prop: 'goodsShelfName', align: 'center' },
- { label: '货位', prop: 'goodsAllocationName', align: 'center' },
- { label: '生产日期', prop: 'productionDate', align: 'center' },
- { label: '采购日期', prop: 'purchaseDate', align: 'center' }
- ],
- entrustColumns: [
- {
- columnKey: 'index',
- label: '序号',
- type: 'index',
- width: 55,
- align: 'center',
- showOverflowTooltip: true,
- fixed: 'left'
- },
- {
- prop: 'code',
- label: '请托单号',
- showOverflowTooltip: true,
- align: 'center',
- minWidth: 130
- },
- {
- prop: 'name',
- label: '任务名称',
- showOverflowTooltip: true,
- align: 'center',
- minWidth: 110
- },
- {
- prop: 'sampleQuantity',
- label: '样品数',
- showOverflowTooltip: true,
- align: 'center',
- formatter: (row) => {
- if (row.sampleQuantity) {
- return (
- row.sampleQuantity + this.sampleList[0]?.measureUnit || ''
- );
- }
- },
- minWidth: 110
- },
- {
- prop: 'sampleQualifiedNumber',
- label: '样品合格数',
- showOverflowTooltip: true,
- align: 'center',
- formatter: (row) => {
- if (row.sampleQualifiedNumber) {
- return (
- row.sampleQualifiedNumber + this.sampleList[0]?.measureUnit ||
- ''
- );
- }
- },
- minWidth: 110
- },
- {
- prop: 'sampleNoQualifiedNumber',
- label: '样品不合格数',
- showOverflowTooltip: true,
- align: 'center',
- formatter: (row) => {
- if (row.sampleNoQualifiedNumber) {
- return (
- row.sampleNoQualifiedNumber +
- this.sampleList[0]?.measureUnit || ''
- );
- }
- },
- minWidth: 110
- },
- {
- prop: 'lossNumber',
- label: '损耗数(合格品)',
- showOverflowTooltip: true,
- align: 'center',
- formatter: (row) => {
- if (row.lossNumber) {
- return row.lossNumber + this.sampleList[0]?.measureUnit || '';
- }
- },
- minWidth: 110
- },
- {
- prop: 'lossNumberUnqualified',
- label: '损耗数(不合格品)',
- showOverflowTooltip: true,
- align: 'center',
- formatter: (row) => {
- if (row.lossNumberUnqualified) {
- return (
- row.lossNumberUnqualified + this.sampleList[0]?.measureUnit ||
- ''
- );
- }
- },
- minWidth: 110
- },
- {
- prop: 'retainedSampleQuantity',
- label: '留样数(合格品)',
- showOverflowTooltip: true,
- align: 'center',
- formatter: (row) => {
- if (row.retainedSampleQuantity) {
- return (
- row.retainedSampleQuantity +
- this.sampleList[0]?.measureUnit || ''
- );
- }
- },
- minWidth: 110
- },
- {
- prop: 'retainedSampleUnqualified',
- label: '留样数(不合格品)',
- formatter: (row) => {
- if (row.retainedSampleUnqualified) {
- return (
- row.retainedSampleUnqualified +
- this.sampleList[0]?.measureUnit || ''
- );
- }
- },
- showOverflowTooltip: true,
- align: 'center',
- minWidth: 110
- },
- {
- prop: 'status',
- minWidth: 110,
- label: '状态',
- align: 'center',
- formatter: (row) => {
- return row.status == 0
- ? '待收样'
- : row.status == 1
- ? '未报工'
- : '已报工';
- },
- showOverflowTooltip: true
- }
- ],
- taskColumns: [
- {
- columnKey: 'index',
- label: '序号',
- type: 'index',
- width: 55,
- align: 'center',
- showOverflowTooltip: true,
- fixed: 'left'
- },
- {
- prop: 'code',
- label: '检测任务单号',
- showOverflowTooltip: true,
- align: 'center',
- minWidth: 130
- },
- {
- prop: 'name',
- label: '任务名称',
- showOverflowTooltip: true,
- align: 'center',
- minWidth: 110
- },
- {
- prop: 'sampleQuantity',
- label: '样品数',
- showOverflowTooltip: true,
- align: 'center',
- formatter: (row) => {
- if (row.sampleQuantity) {
- return (
- row.sampleQuantity + this.sampleList[0]?.measureUnit || ''
- );
- }
- },
- minWidth: 110
- },
- {
- prop: 'sampleQualifiedNumber',
- label: '样品合格数',
- showOverflowTooltip: true,
- align: 'center',
- formatter: (row) => {
- if (row.sampleQualifiedNumber) {
- return (
- row.sampleQualifiedNumber + this.sampleList[0]?.measureUnit ||
- ''
- );
- }
- },
- minWidth: 110
- },
- {
- prop: 'sampleNoQualifiedNumber',
- label: '样品不合格数',
- showOverflowTooltip: true,
- align: 'center',
- formatter: (row) => {
- if (row.sampleNoQualifiedNumber) {
- return (
- row.sampleNoQualifiedNumber +
- this.sampleList[0]?.measureUnit || ''
- );
- }
- },
- minWidth: 110
- },
- {
- prop: 'lossNumber',
- label: '损耗数(合格品)',
- showOverflowTooltip: true,
- align: 'center',
- formatter: (row) => {
- if (row.lossNumber) {
- return row.lossNumber + this.sampleList[0]?.measureUnit || '';
- }
- },
- minWidth: 110
- },
- {
- prop: 'lossNumberUnqualified',
- label: '损耗数(不合格品)',
- showOverflowTooltip: true,
- align: 'center',
- formatter: (row) => {
- if (row.lossNumberUnqualified) {
- return (
- row.lossNumberUnqualified + this.sampleList[0]?.measureUnit ||
- ''
- );
- }
- },
- minWidth: 110
- },
- {
- prop: 'retainedSampleQuantity',
- label: '留样数(合格品)',
- showOverflowTooltip: true,
- align: 'center',
- formatter: (row) => {
- if (row.retainedSampleQuantity) {
- return (
- row.retainedSampleQuantity +
- this.sampleList[0]?.measureUnit || ''
- );
- }
- },
- minWidth: 110
- },
- {
- prop: 'retainedSampleUnqualified',
- label: '留样数(不合格品)',
- formatter: (row) => {
- if (row.retainedSampleUnqualified) {
- return (
- row.retainedSampleUnqualified +
- this.sampleList[0]?.measureUnit || ''
- );
- }
- },
- showOverflowTooltip: true,
- align: 'center',
- minWidth: 110
- },
- {
- prop: 'status',
- minWidth: 110,
- label: '状态',
- align: 'center',
- formatter: (row) => {
- return row.status == 0
- ? '待收样'
- : row.status == 1
- ? '未报工'
- : '已报工';
- },
- showOverflowTooltip: true
- }
- ],
- // 表格选中数据
- jobColumns1: [
- {
- label: '编码',
- prop: 'code',
- width: 180,
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'name',
- label: '文档名称',
- align: 'center',
- slot: 'name',
- showOverflowTooltip: true,
- minWidth: 200
- },
- {
- prop: 'storagePath',
- label: '文件名称',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 200,
- formatter: (_row, _column, cellValue) => {
- return cellValue[0]?.name;
- }
- },
- {
- prop: 'version',
- label: '版本',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 100
- },
- {
- prop: 'createTime',
- label: '创建时间',
- showOverflowTooltip: true,
- align: 'center',
- minWidth: 110
- },
- {
- columnKey: 'action',
- label: '操作',
- width: 100,
- align: 'center',
- resizable: false,
- slot: 'action',
- showOverflowTooltip: true
- }
- ],
- conditionType: null,
- formData: {
- number: 1,
- sampleUnit: '',
- portion: null,
- packingUnit: ''
- },
- rules: {
- number: [
- {
- required: true,
- message: '请输入',
- trigger: 'blur'
- }
- ],
- sampleUnit: [
- {
- required: true,
- message: '请选择样品单位',
- trigger: 'change'
- }
- ],
- portion: [
- {
- required: true,
- message: '请输入',
- trigger: 'blur'
- }
- ],
- packingUnit: [
- {
- required: true,
- message: '请选择',
- trigger: 'change'
- }
- ]
- },
- packingSpecificationOption: [] // 包装规格下拉
- };
- },
- computed: {
- showBtn() {
- return this.$route.query.qualityType == 2;
- },
- tableColumns1() {
- let arr = [
- // (this.btnType !== 'issued' || this.baseForm.qualityMode === 2)
- // ? {
- // columnKey: 'selection',
- // type: 'selection',
- // width: 45,
- // align: 'center'
- // }
- // : null,
- {
- columnKey: 'selection',
- type: 'selection',
- width: 45,
- align: 'center'
- },
- {
- columnKey: 'index',
- label: '序号',
- type: 'index',
- width: 55,
- align: 'center',
- fixed: 'left'
- },
- {
- label: '编码',
- prop: 'categoryCode',
- width: 150,
- align: 'center',
- showOverflowTooltip: true
- },
- {
- label: '名称',
- prop: 'categoryName',
- width: '150',
- align: 'center',
- width: 120,
- showOverflowTooltip: true
- },
- {
- label: '批次号',
- prop: 'batchNo',
- align: 'center',
- width: 120,
- showOverflowTooltip: true
- },
- {
- label: '发货条码',
- prop: 'barcodes',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- label: '包装编码',
- prop: 'packageNo',
- align: 'center',
- width: 120,
- showOverflowTooltip: true
- },
- { label: '包装数量', prop: 'packingQuantity', align: 'center' },
- { label: '包装单位', prop: 'packingUnit', align: 'center' },
- // {
- // label: '包装规格',
- // prop: 'packingSpecification',
- // align: 'center',
- // width: 180
- // },
- { label: '计量数量', prop: 'measureQuantity', align: 'center' },
- { label: '计量单位', prop: 'measureUnit', align: 'center' },
- { label: '物料代号', prop: 'materielDesignation', align: 'center' },
- { label: '客户代号', prop: 'clientCode', align: 'center' },
- {
- label: '供应商名称',
- prop: 'supplierName',
- align: 'center',
- width: 120,
- showOverflowTooltip: true
- },
- {
- label: '供应商代号',
- prop: 'supplierCode',
- align: 'center',
- width: '120',
- showOverflowTooltip: true
- },
- { label: '刻码', prop: 'engrave', align: 'center' },
- {
- label: '机型',
- prop: 'modelKey',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- label: '颜色',
- prop: 'colorKey',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- label: '型号',
- prop: 'modelType',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- label: '规格',
- prop: 'specification',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- label: '电压等级',
- prop: 'voltage',
- align: 'center',
- showOverflowTooltip: true
- },
- { label: '重量', prop: 'weight', align: 'center' },
- { label: '重量单位', prop: 'weightUnit', align: 'center' },
- {
- label: '仓库',
- prop: 'warehouseName',
- align: 'center',
- width: 120,
- showOverflowTooltip: true
- },
- { label: '货区', prop: 'areaName', align: 'center' },
- { label: '货架', prop: 'goodsShelfName', align: 'center' },
- { label: '货位', prop: 'goodsAllocationName', align: 'center' },
- {
- label: '生产日期',
- prop: 'productionDate',
- align: 'center',
- width: 120,
- showOverflowTooltip: true
- },
- {
- label: '采购日期',
- prop: 'purchaseDate',
- align: 'center',
- width: 120,
- showOverflowTooltip: true
- }
- ];
- return arr;
- },
- // 分页后的样品列表
- paginatedSampleList() {
- // const { currentPage, pageSize } = this.samplePagination;
- // const start = (currentPage - 1) * pageSize;
- // const end = start + pageSize;
- // return this.sampleList?.slice(start, end);
- return this.sampleList;
- },
- // 分页后的质检方案列表
- paginatedSchemeList() {
- // const { currentPage, pageSize } = this.schemePagination;
- // const start = (currentPage - 1) * pageSize;
- // const end = start + pageSize;
- // console.log(this.templateList,'全部数据')
- // return this.templateList?.slice(start, end);
- return this.templateList;
- }
- },
- created() {
- this.activeNameKK = this.activeName;
- this.reload({ qualityWorkerId: this.ids });
- let direction = this.$getDirection();
- this.getBadTypeList();
- this.getBadNameList();
- direction.on('keyup', function (e, val) {
- if (e.keyCode == 39) {
- direction.next();
- }
- if (e.keyCode == 37) {
- direction.previous();
- }
- if (e.keyCode == 38) {
- direction.previousLine();
- }
- if (e.keyCode == 40) {
- direction.nextLine();
- }
- });
- },
- mounted() {
- this.getFileParam();
- },
- methods: {
- async getFileParam() {
- const res = await parameterGetByCode({
- code: 'mes_craft_file_by_category_code'
- });
- const byCategory = res?.value === '1';
- if (byCategory) {
- this.$refs.wokePopupListRef.openTwo(this.form);
- } else {
- this.$refs.wokePopupListRef.open(
- this.fileParam.map((item) => item.id)
- );
- }
- },
- // 不良类型改变
- badTypeChange(row) {
- row.badTypeName = null;
- // 赋值badTypeName
- const badType = this.badTypeList.find(
- (item) => item.id === row.badTypeId
- );
- if (badType) {
- row.badTypeName = badType.name;
- }
- this.getBadNameList(row.badTypeId);
- },
- // 不良名称改变
- badNameChange(row) {
- // 赋值badNameName
- const badItem = this.badNameList.find(
- (item) => item.id === row.badNameId
- );
- if (badItem) {
- row.badNameName = badItem.name;
- }
- },
- // 查询不良类型
- async getBadTypeList() {
- const res = await getBadTypeList({
- pageNum: 1,
- size: 999
- });
- this.badTypeList = res.list;
- },
- // 查询不良名称
- async getBadNameList() {
- const res = await getBadNameList({
- pageNum: 1,
- size: 999
- });
- this.badNameList = res.list;
- },
- //合格数量变化设置样品清单 全减并且不拆包才执行
- async setSampleList(val, total) {
- this.$set(this.sampleList[0], 'measureQuantity', val);
- let weight = this.form.totalWeight / total;
- let arr = [];
- for (let i = 0; i < total - val; i++) {
- let data = JSON.parse(JSON.stringify(this.sampleList[0]));
- data['measureQuantity'] = 1;
- data['qualityResults'] = 2;
- data['qualityStatus'] = 1;
- data['qualitySampleTemplateList'] = [];
- data['id'] = '';
- data['weight'] = parseFloat(weight).toFixed(2);
- let code = await getCodeList('sample_code', { count: 1 });
- data['sampleCode'] = code[0];
- arr.push(data);
- }
- this.$set(
- this.sampleList[0],
- 'weight',
- parseFloat(val * weight).toFixed(2)
- );
- this.sampleList = [this.sampleList[0], ...arr];
- this.$emit('sampleListChange', this.sampleList);
- },
- async datasource({ page, limit, where }) {
- console.log('执行33');
- const res = await queryQualityInventory({
- ...where,
- pageNum: page,
- // size: limit
- size: -1
- });
- if (res.list.length == 0) {
- return res;
- }
- // 包装数量的字段
- // if (!this.productId) {
- // return res;
- // }
- // const result = await getCategoryPackageDisposition({
- // categoryIds: [this.productId]
- // });
- // let str = '';
- // if (result.length) {
- let o = res.list[0];
- let listArr = [];
- if (o.measureUnit) {
- listArr.push({
- packageCellTotal: 1,
- conversionUnit: o.measureUnit,
- id: '111'
- });
- }
- if (o.packingUnit) {
- listArr.push({
- packageCellTotal: o.measureQuantity - 0,
- conversionUnit: o.packingUnit,
- id: '222'
- });
- }
- // result.map((el, index) => {
- // // let Unit = el.conversionUnit.trim();
- // // if (Unit == o.packingUnit.trim() || Unit == o.measureUnit.trim()) {
- // // listArr.push(el);
- // // }
- // if (index == 0) {
- // // el.packageCellTotal = el.packageCell - 0;
- // return;
- // }
- // if (index === result.length - 1) {
- // str = `${str}${el.packageCell}${el.packageUnit}/${el.conversionUnit}`;
- // } else {
- // str = `${str}${el.packageCell}${el.packageUnit}/${el.conversionUnit},`;
- // }
- // // if (index == 1) {
- // // el.packageCellTotal = el.packageCell - 0;
- // // return;
- // // }
- // // 计算乘法的规则
- // // el.packageCellTotal =
- // // el.packageCell * result[index - 1].packageCellTotal;
- // });
- res.list.map((el) => {
- el.weightProportion = el.weight
- ? (el.weight / el.measureQuantity).toFixed(4)
- : 0;
- el.weightProportion = el.weightProportion - 0;
- });
- this.packingSpecificationOption = listArr;
- return res;
- },
- reload(where) {
- this.$nextTick(() => {
- if (this.$refs.sourceTable && this.$refs.sourceTable.reload)
- this.$refs.sourceTable.reload({ page: 1, where: where });
- });
- },
- tableSelClear() {
- this.$refs.sourceTable.clearSelection();
- },
- handleSelectionChange(selection) {
- if (this.form.conditionType == 2) {
- if (this.form.isUnpack == 2) {
- this.$set(this.form, 'sampleNumber', this.formData.portion);
- } else {
- this.formData.portion = selection.length;
- this.$set(this.form, 'sampleNumber', selection.length);
- }
- this.formData.sampleUnit = selection[0]?.measureUnit;
- this.$set(this.form, 'sampleMeasureUnit', selection[0]?.measureUnit);
- } else if (this.form.conditionType == 1) {
- this.$set(this.form, 'sampleNumber', this.formData.portion);
- }
- // this.formData.portion = selection.length;
- // this.formData.sampleUnit = selection[0]?.measureUnit;
- //
- // this.$set(this.form, 'sampleNumber', selection.length);
- // this.$set(this.form, 'sampleMeasureUnit', selection[0]?.measureUnit);
- this.$emit('handleSelectionChange', selection);
- },
- handleSelectionChange1(selection) {
- this.selection1 = selection;
- },
- delAll() {
- if (!this.selection1.length) {
- this.$message.error('请至少选择一条数据!');
- return;
- }
- this.selection1.forEach((item) => {
- this.handDel(
- this.templateList.findIndex((temp) => temp.id == item.id)
- );
- });
- console.log(this.selection1, 'this.selection1');
- },
- handleSampleNumber(val) {
- this.conditionType = val;
- this.form.sampleUnit = '';
- this.$emit('getConditionType', val);
- //取整样
- // let data = this.$refs.sourceTable.getData()
- // this.$emit('getSelectedList')
- // if (this.selectedList.length == 0) {
- // this.$message.warning('请先选择样品!');
- // }
- // if (val == 1) {
- // // this.activeName = '2'
- // this.$emit('handleSample1', val, data)
- // } else if (val == 2) {
- // this.tableSelClear();
- // this.$emit('handleSample1', val, data)
- // }
- },
- handleInputNumber(val) {
- let packingList = this.$refs.sourceTable.getData();
- const maxValue =
- packingList.length > 1
- ? packingList.length
- : packingList[0].measureQuantity;
- if (val > maxValue) {
- this.$message.warning('数量不能大于计量数量!');
- this.formData.number = maxValue;
- return;
- }
- },
- handleInput(val) {
- if (val == 0 || val == '' || val == null) {
- this.$refs.sourceTable.clearSelection();
- return;
- }
- let packingList = this.$refs.sourceTable.getData();
- if (!packingList || packingList.length === 0) {
- return;
- }
- // 计算 packingList 中 measureQuantity 字段的总和
- const measureQuantitySum = packingList.reduce((sum, item) => {
- const quantity = Number(item.measureQuantity) || 0;
- return sum + quantity;
- }, 0);
- const portion = Number(this.formData.portion);
- // 清空当前选中
- this.$refs.sourceTable.clearSelection();
- if (this.form.conditionType == 2) {
- // 确保 portion 不超过数据列表长度
- const safePortion = Math.min(portion, packingList.length);
- if (this.form.isUnpack == 2) {
- const maxQuantity = Number(packingList[0].measureQuantity);
- if (portion > maxQuantity) {
- this.$message.warning('取样数量不能大于计量数量!');
- this.formData.portion = maxQuantity;
- }
- } else if (this.form.isUnpack == 1) {
- if (portion > packingList.length) {
- this.$message.warning('取样数量不能大于来源清单数量!');
- this.formData.portion = packingList.length;
- }
- }
- packingList.slice(0, safePortion).forEach((row) => {
- this.$refs.sourceTable.toggleRowSelection(row);
- });
- } else if (this.form.conditionType == 1) {
- // 确保 portion 不超过数据列表长度
- const safePortion = Math.min(portion, measureQuantitySum);
- if (portion > measureQuantitySum) {
- this.$message.warning('取样数量不能大于计量数量!');
- this.formData.portion = measureQuantitySum;
- }
- // 选中前 safePortion 行
- packingList.slice(0, safePortion).forEach((row) => {
- this.$refs.sourceTable.toggleRowSelection(row, true);
- });
- }
- // if (packingList.length > 1) {
- // if (portion > packingList.length) {
- // this.$message.warning('取样数量不能大于来源清单数量!');
- // this.formData.portion = packingList.length;
- // return;
- // }
- // packingList.slice(0, this.formData.portion).forEach(row => {
- // this.$refs.table12.toggleRowSelection(row);
- // });
- // } else {
- // const maxQuantity = Number(packingList[0].measureQuantity);
- // if (portion > maxQuantity) {
- // this.$message.warning('取样数量不能大于计量数量!');
- // this.formData.portion = maxQuantity;
- // return;
- // }
- // }
- },
- changeSamUnit(val) {
- this.$emit('changeSamUnit', val);
- },
- handleSampleSubmit() {
- this.$refs.ruleForm.validate((valid) => {
- if (valid) {
- //取小样 赋值右上角单位
- this.changeSamUnit(this.formData.sampleUnit);
- let params = {
- conditionType: this.conditionType,
- measureQ: this.formData.number,
- sampleUnit: this.formData.sampleUnit,
- portion: this.formData.portion
- };
- let specifications = this.packingSpecificationOption.find(
- (el) => el.id == this.formData.packingUnit
- );
- console.log('执行这里没', params, '---');
- this.$emit('handleSampleSubmit', params, specifications);
- }
- });
- },
- handleClick(tab) {
- this.activeNameKK = tab.name;
- },
- tabsChange(val) {
- this.activeNameKK = val;
- },
- tabsConditionType(val) {
- this.conditionType = val;
- },
- checkSelectable(row, index) {
- // 只有当质检方式为抽检(qualityMode=2)时 类型不是生产检验 才可选
- return this.form.qualityType != 2 && this.form.qualityMode === 2;
- },
- handleDetail(index, row, type) {
- this.$emit('handleDetail', index, row, type);
- },
- inputWeight(row, index) {
- this.$emit('inputWeight', row, index);
- },
- handleDispose(index, row, type) {
- this.$emit('handleDispose', { row, index });
- },
- handleSampleSizeChange(val) {
- this.samplePagination.pageSize = val;
- this.samplePagination.currentPage = 1;
- },
- handleSampleCurrentChange(val) {
- this.samplePagination.currentPage = val;
- },
- handleSchemeSizeChange(val) {
- this.schemePagination.pageSize = val;
- this.schemePagination.currentPage = 1;
- },
- handleSchemeCurrentChange(val) {
- this.schemePagination.currentPage = val;
- },
- //质检项报工
- inspectionProjectReport(index, row) {
- this.$emit('inspectionProjectReport', { index, list: [row] });
- },
- selectQualityResultsChange() {
- this.$emit('countQualityResults');
- },
- addInspectionTemplate() {
- let type = this.form.qualityType || 1;
- this.$refs.inspectionTemplateRef.open(type);
- },
- async inspectionTemplateSuccess(select) {
- let data = await getQualityTemplateByIds({
- templateIds: select.map((item) => item.id)
- });
- data.forEach((item) => {
- item.id = null;
- });
- // 这里是选择方案后,数据新加,要改为覆盖
- // this.templateList.push(...data);
- // const strings = this.templateList.map((item) => JSON.stringify(item));
- // const removeDupList = [...new Set(strings)];
- // const result = removeDupList.map((item) => JSON.parse(item));
- if (this.form.recordingMethod != 1) {
- this.templateList = [];
- } else {
- this.templateList = this.templateList.filter((item) => item.status);
- }
- data.forEach((item) => {
- item['qualityResults'] = 1;
- item['status'] = 0;
- });
- this.templateList.push(...data);
- // this.templateList = result.map((item) => {
- // item['qualityResults'] = 1;
- // return item;
- // });
- this.sampleList.forEach((item, index) => {
- this.$set(
- this.sampleList[index],
- 'qualitySampleTemplateList',
- this.templateList
- );
- });
- this.$set(this.form, 'templateList', this.templateList);
- this.$emit('setSchemeList', this.templateList);
- // this.schemeList = this.templateList;
- this.schemePagination.total = this.templateList.length;
- if (this.form.recordingMethod == 1) {
- this.$emit('setSchemeListChange');
- }
- },
- handDel(index) {
- this.templateList.splice(index, 1);
- this.sampleList.forEach((item, index) => {
- this.$set(
- this.sampleList[index],
- 'qualitySampleTemplateList',
- this.templateList.map((item) => {
- item['qualityResults'] = 1;
- return item;
- })
- );
- });
- }
- }
- };
- </script>
|