newQualityContentTabs.vue 59 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883
  1. <!-- 质检内容 -->
  2. <template>
  3. <el-row>
  4. <!-- 选择质检方案 -->
  5. <inspectionTemplateDialog
  6. ref="inspectionTemplateRef"
  7. @choose="inspectionTemplateSuccess"
  8. ></inspectionTemplateDialog>
  9. <header-title title="检测内容">
  10. <el-button
  11. type="primary"
  12. :loading="loading"
  13. v-if="type != 'detail'"
  14. @click="$emit('batch-quality')"
  15. >批量检测</el-button
  16. >
  17. <!-- <el-button
  18. type="primary"
  19. :loading="loading"
  20. v-if="type != 'detail'"
  21. @click="$emit('batch-dispose')"
  22. >批量处置</el-button
  23. > -->
  24. </header-title>
  25. <el-tabs v-model="activeNameKK" @tab-click="handleClick">
  26. <!-- -->
  27. <el-tab-pane label="来源清单" name="1">
  28. <ele-pro-table
  29. ref="sourceTable"
  30. :columns="tableColumns1"
  31. :datasource="datasource"
  32. @selection-change="handleSelectionChange"
  33. :initLoad="false"
  34. :needPage="false"
  35. height="500px"
  36. >
  37. <!-- :pagination="true" -->
  38. <!-- <template
  39. v-slot:toolbar
  40. v-if="form.qualityMode == 2 && type != 'detail'"
  41. >
  42. <el-dropdown trigger="click" @command="handleSampleNumber">
  43. <el-link type="primary" icon="el-icon-plus">取样</el-link>
  44. <el-dropdown-menu slot="dropdown">
  45. <el-dropdown-item command="1">取整样</el-dropdown-item>
  46. <el-dropdown-item command="2">取小样</el-dropdown-item>
  47. </el-dropdown-menu>
  48. </el-dropdown>
  49. </template> -->
  50. <template v-slot:toolkit v-if="form.qualityMode == 2">
  51. <el-row>
  52. <el-form
  53. ref="ruleForm"
  54. :model="formData"
  55. label-width="60px"
  56. size="mini"
  57. :rules="rules"
  58. class="flex"
  59. :show-message="false"
  60. >
  61. <el-col :span="6" v-if="conditionType == 2">
  62. <el-form-item
  63. prop="number"
  64. label-width="0"
  65. style="margin-bottom: 0"
  66. >
  67. <el-input
  68. v-model="formData.number"
  69. placeholder="请输入"
  70. size="mini"
  71. ></el-input>
  72. </el-form-item>
  73. </el-col>
  74. <el-col :span="6" v-if="conditionType == 2">
  75. <el-form-item
  76. prop="sampleUnit"
  77. label-width="0"
  78. style="margin: 0"
  79. >
  80. <DictSelection
  81. dictName="计量单位"
  82. clearable
  83. v-model="formData.sampleUnit"
  84. size="mini"
  85. filter-placeholder="请输入计量单位搜索"
  86. @change="changeSamUnit"
  87. ></DictSelection>
  88. </el-form-item>
  89. </el-col>
  90. <el-col :span="8" v-if="conditionType == 2">
  91. <el-form-item prop="portion" label="数量" style="margin: 0">
  92. <el-input
  93. v-model="formData.portion"
  94. placeholder="请输入"
  95. size="mini"
  96. ></el-input>
  97. </el-form-item>
  98. </el-col>
  99. <el-col :span="10" v-if="conditionType == 1">
  100. <el-form-item prop="portion" label="数量" style="margin: 0">
  101. <el-input
  102. v-model="formData.portion"
  103. placeholder="请输入"
  104. size="mini"
  105. ></el-input>
  106. </el-form-item>
  107. </el-col>
  108. <el-col :span="10" v-if="conditionType == 1">
  109. <el-form-item
  110. prop="packingUnit"
  111. label="单位"
  112. style="margin: 0"
  113. >
  114. <el-select
  115. v-model="formData.packingUnit"
  116. placeholder="请选择"
  117. >
  118. <el-option
  119. v-for="item in packingSpecificationOption"
  120. :key="item.id"
  121. :label="item.conversionUnit"
  122. :value="item.id"
  123. >
  124. </el-option>
  125. </el-select>
  126. </el-form-item>
  127. </el-col>
  128. <el-col
  129. :span="4"
  130. style="text-align: right"
  131. v-if="conditionType == 2"
  132. >
  133. <el-button
  134. type="primary"
  135. size="mini"
  136. @click="handleSampleSubmit"
  137. style="margin-right: 12px"
  138. >确认</el-button
  139. >
  140. </el-col>
  141. <el-col
  142. :span="4"
  143. style="text-align: right"
  144. v-if="conditionType == 1"
  145. >
  146. <el-button
  147. type="primary"
  148. size="mini"
  149. @click="handleSampleSubmit"
  150. style="margin-right: 12px"
  151. >确认</el-button
  152. >
  153. </el-col>
  154. </el-form>
  155. </el-row>
  156. </template>
  157. <template v-slot:materielDesignation="{ row }">
  158. <el-input
  159. v-model="row.materielDesignation"
  160. placeholder="请输入"
  161. ></el-input>
  162. </template>
  163. <template v-slot:clientCode="{ row }">
  164. <el-input v-model="row.clientCode" placeholder="请输入"></el-input>
  165. </template>
  166. <template v-slot:engrave="{ row }">
  167. <el-input v-model="row.engrave" placeholder="请输入"></el-input>
  168. </template>
  169. <template v-slot:weight="{ row }">
  170. <el-input v-model="row.weight" placeholder="请输入"></el-input>
  171. </template>
  172. </ele-pro-table>
  173. </el-tab-pane>
  174. <!-- -->
  175. <el-tab-pane label="样品清单" name="2">
  176. <el-table
  177. v-if="sampleList.length > 0"
  178. ref="showSampleListTable"
  179. :data="paginatedSampleList"
  180. tooltip-effect="dark"
  181. height="500"
  182. border
  183. row-key="id"
  184. >
  185. <el-table-column
  186. label="序号"
  187. type="index"
  188. width="50"
  189. align="center"
  190. fixed="left"
  191. ></el-table-column>
  192. <template v-for="(column, index) in tableColumns">
  193. <el-table-column
  194. :key="index"
  195. :label="column.label"
  196. :prop="column.prop"
  197. :fixed="column.fixed"
  198. :show-overflow-tooltip="true"
  199. :width="column.width"
  200. :align="column.align"
  201. >
  202. <template slot-scope="scope">
  203. <template v-if="column.prop === 'categoryCode'">
  204. <el-link
  205. type="primary"
  206. :underline="false"
  207. @click="handleDetail(scope.$index, scope.row, 'detail')"
  208. >
  209. {{ scope.row.categoryCode }}
  210. </el-link>
  211. </template>
  212. <template v-else-if="column.prop === 'materielDesignation'">
  213. <el-input
  214. :disabled="status"
  215. v-model="scope.row.materielDesignation"
  216. size="mini"
  217. v-direction="{ x: 0, y: scope.$index }"
  218. ></el-input>
  219. </template>
  220. <template v-else-if="column.prop === 'clientCode'">
  221. <el-input
  222. :disabled="status"
  223. v-model="scope.row.clientCode"
  224. size="mini"
  225. v-direction="{ x: 1, y: scope.$index }"
  226. ></el-input>
  227. </template>
  228. <template v-else-if="column.prop === 'engrave'">
  229. <el-input
  230. :disabled="status"
  231. v-model="scope.row.engrave"
  232. size="mini"
  233. v-direction="{ x: 2, y: scope.$index }"
  234. ></el-input>
  235. </template>
  236. <template v-else-if="column.prop === 'weight'">
  237. <el-input
  238. v-model="scope.row.weight"
  239. :disabled="status"
  240. oninput="value = value.replace(/[^\d.]/g, '')"
  241. :min="0"
  242. @input="inputWeight(scope.row, scope.$index)"
  243. size="mini"
  244. v-direction="{ x: 3, y: scope.$index }"
  245. ></el-input>
  246. </template>
  247. <template v-else>
  248. {{ scope.row[column.prop] }}
  249. </template>
  250. </template>
  251. </el-table-column>
  252. </template>
  253. <el-table-column
  254. label="图片"
  255. prop="imgUrl"
  256. align="center"
  257. :show-overflow-tooltip="true"
  258. >
  259. <template slot-scope="scope">
  260. <span
  261. ><fileMain v-model="scope.row.imgUrl" type="view"></fileMain
  262. ></span>
  263. </template>
  264. </el-table-column>
  265. <!-- *** fixed="right" -->
  266. <el-table-column
  267. label="处置状态"
  268. prop="disposeType"
  269. align="center"
  270. :show-overflow-tooltip="true"
  271. >
  272. <template slot-scope="scope">
  273. <span>{{ disposeTypeList[scope.row.disposeType] }}</span>
  274. </template>
  275. </el-table-column>
  276. <!-- *** fixed="right" -->
  277. <el-table-column
  278. label="处置时间"
  279. prop="disposeTime"
  280. align="center"
  281. :show-overflow-tooltip="true"
  282. >
  283. </el-table-column>
  284. <!-- *** fixed="right" -->
  285. <el-table-column
  286. label="状态"
  287. prop="status"
  288. align="center"
  289. fixed="right"
  290. :show-overflow-tooltip="true"
  291. v-if="form.recordingMethod != 1"
  292. >
  293. <template slot-scope="scope">
  294. {{
  295. inspectionProjectStatus.find(
  296. (item) => item.value == scope.row.status
  297. )?.label
  298. }}
  299. </template>
  300. </el-table-column>
  301. <!-- <el-table-column
  302. label="质检状态"
  303. prop="qualityStatus"
  304. align="center"
  305. fixed="right"
  306. :show-overflow-tooltip="true"
  307. v-if="form.recordingMethod != 1"
  308. >
  309. <template slot-scope="scope">
  310. <span v-if="scope.row.qualityStatus == 0">未检</span>
  311. <span v-if="scope.row.qualityStatus == 1">已检</span>
  312. <span v-if="scope.row.qualityStatus == 2">待检</span>
  313. </template>
  314. </el-table-column> -->
  315. <el-table-column
  316. label="检测结果"
  317. prop="qualityResults"
  318. align="center"
  319. width="180"
  320. fixed="right"
  321. :show-overflow-tooltip="true"
  322. v-if="form.recordingMethod != 1"
  323. >
  324. <template slot-scope="scope">
  325. <el-select
  326. @change="selectQualityResultsChange"
  327. v-model="scope.row.qualityResults"
  328. placeholder="请选择"
  329. style="width: 100%"
  330. :disabled="type == 'detail' || scope.row.correlationId"
  331. size="mini"
  332. >
  333. <el-option
  334. v-for="item in qualityResultsList"
  335. :key="item.value"
  336. :label="item.label"
  337. :value="item.value"
  338. >
  339. </el-option>
  340. </el-select>
  341. </template>
  342. </el-table-column>
  343. <el-table-column
  344. label="不良类型"
  345. align="center"
  346. v-if="form.recordingMethod != 1"
  347. prop="badTypeId"
  348. width="180"
  349. >
  350. <template v-slot="{ row, $index }">
  351. <el-select
  352. v-model="row.badTypeId"
  353. placeholder="请选择不良类型"
  354. size="small"
  355. style="width: 100%"
  356. remote
  357. filterable
  358. clearable
  359. @change="badTypeChange(row)"
  360. :disabled="type == 'detail' || row.correlationId"
  361. >
  362. <el-option
  363. v-for="item in badTypeList"
  364. :key="item.id"
  365. :label="item.name"
  366. :value="item.id"
  367. >
  368. </el-option>
  369. </el-select>
  370. </template>
  371. </el-table-column>
  372. <el-table-column
  373. label="不良名称"
  374. align="center"
  375. prop="badNameId"
  376. width="180"
  377. v-if="form.recordingMethod != 1"
  378. >
  379. <template v-slot="{ row, $index }">
  380. <el-select
  381. v-model="row.badNameId"
  382. placeholder="请选择不良名称"
  383. size="small"
  384. style="width: 100%"
  385. remote
  386. filterable
  387. clearable
  388. @change="badNameChange(row)"
  389. :disabled="type == 'detail' || row.correlationId"
  390. >
  391. <el-option
  392. v-for="item in badNameList"
  393. :key="item.id"
  394. :label="item.name"
  395. :value="item.id"
  396. >
  397. </el-option>
  398. </el-select>
  399. </template>
  400. </el-table-column>
  401. <el-table-column
  402. label="操作"
  403. align="center"
  404. width="120"
  405. fixed="right"
  406. v-if="type != 'detail' && form.recordingMethod != 1"
  407. >
  408. <template slot-scope="scope">
  409. <el-link
  410. :type="scope.row.isValid ? 'primary' : 'danger'"
  411. :underline="false"
  412. v-if="!scope.row.correlationId"
  413. @click="handleDetail(scope.$index, scope.row, 'report')"
  414. >
  415. 检测
  416. </el-link>
  417. <!-- <el-link
  418. type="primary"
  419. :underline="false"
  420. @click="handleDispose(scope.$index, scope.row, 'dispose')"
  421. >处置
  422. </el-link> -->
  423. </template>
  424. </el-table-column>
  425. </el-table>
  426. <!-- <el-pagination
  427. @size-change="handleSampleSizeChange"
  428. @current-change="handleSampleCurrentChange"
  429. :current-page="samplePagination.currentPage"
  430. :page-sizes="[10, 20, 50, 100]"
  431. :page-size="samplePagination.pageSize"
  432. layout="total, sizes, prev, pager, next, jumper"
  433. :total="sampleList.length"
  434. /> -->
  435. </el-tab-pane>
  436. <!-- -->
  437. <el-tab-pane label="检测方案" name="3">
  438. <el-button
  439. v-if="type !== 'detail'"
  440. @click="addInspectionTemplate"
  441. type="primary"
  442. style="margin-top: 5px"
  443. >选择检测方案</el-button
  444. >
  445. <el-button
  446. v-if="type !== 'detail'"
  447. @click="delAll"
  448. type="danger"
  449. style="margin-top: 5px"
  450. >批量删除</el-button
  451. >
  452. <el-table
  453. :data="paginatedSchemeList"
  454. tooltip-effect="dark"
  455. height="500"
  456. border
  457. row-key="id"
  458. @selection-change="handleSelectionChange1"
  459. >
  460. <el-table-column
  461. type="selection"
  462. width="55"
  463. align="center"
  464. :selectable="
  465. (row) => {
  466. return type == 'detail' || ![1, 2, 3, 4].includes(row.status);
  467. }
  468. "
  469. >
  470. </el-table-column>
  471. <el-table-column
  472. label="序号"
  473. type="index"
  474. width="50"
  475. align="center"
  476. ></el-table-column>
  477. <el-table-column
  478. label="检测方案编码"
  479. prop="qualitySchemeTemplateCode"
  480. align="center"
  481. >
  482. </el-table-column>
  483. <el-table-column
  484. label="检测方案名称"
  485. prop="qualitySchemeTemplateName"
  486. align="center"
  487. ></el-table-column>
  488. <el-table-column
  489. label="检测类型"
  490. prop="categoryLevelClassName"
  491. align="center"
  492. ></el-table-column>
  493. <el-table-column
  494. label="检测项编码"
  495. prop="inspectionCode"
  496. align="center"
  497. ></el-table-column>
  498. <el-table-column
  499. label="检测项名称"
  500. prop="inspectionName"
  501. align="center"
  502. ></el-table-column>
  503. <el-table-column label="附件" prop="imgUrl" align="center">
  504. <template slot-scope="scope">
  505. <fileMain v-model="scope.row.imgUrl" type="view"></fileMain>
  506. </template>
  507. </el-table-column>
  508. <el-table-column
  509. label="工艺参数"
  510. show-overflow-tooltip
  511. prop="defaultValue"
  512. align="center"
  513. min-width="220px"
  514. >
  515. <template slot-scope="scope">
  516. <div style="display: flex; justify-content: center">
  517. <span v-if="scope.row.textType != 8">{{
  518. scope.row.symbol
  519. }}</span>
  520. <span v-if="scope.row.textType == 3">
  521. {{ scope.row.minValue }}-{{ scope.row.maxValue }}
  522. </span>
  523. <span v-else-if="scope.row.textType == 8">
  524. 标准值:{{ scope.row.defaultValue
  525. }}{{ scope.row.unitName || '' }} 下限:{{
  526. scope.row.minValue || 0
  527. }}{{ scope.row.unitName || '' }} 上限:{{
  528. scope.row.maxValue || 0
  529. }}{{ scope.row.unitName || '' }}
  530. </span>
  531. <span v-else>
  532. <span>{{ scope.row.defaultValue }}</span>
  533. </span>
  534. <span v-if="scope.row.textType != 8">
  535. {{ scope.row.unitName }}
  536. </span>
  537. </div>
  538. </template>
  539. </el-table-column>
  540. <el-table-column
  541. label="执行方法"
  542. prop="executionMethod"
  543. align="center"
  544. :show-overflow-tooltip="true"
  545. v-if="form.recordingMethod == 1"
  546. >
  547. <template slot-scope="scope">
  548. {{ scope.row.executionMethod == 1 ? '常规' : '实验' }}
  549. </template></el-table-column
  550. >
  551. <el-table-column
  552. label="检测状态"
  553. prop="status"
  554. align="center"
  555. :show-overflow-tooltip="true"
  556. v-if="form.recordingMethod == 1"
  557. >
  558. <template slot-scope="scope">
  559. {{
  560. inspectionProjectStatus.find(
  561. (item) => item.value == scope.row.status
  562. )?.label
  563. }}
  564. </template>
  565. </el-table-column>
  566. <el-table-column
  567. label="检测结果"
  568. prop="qualityResults"
  569. align="center"
  570. width="180"
  571. :show-overflow-tooltip="true"
  572. v-if="form.recordingMethod == 1"
  573. >
  574. <template slot-scope="scope">
  575. <el-select
  576. @change="selectQualityResultsChange"
  577. v-model="scope.row.qualityResults"
  578. placeholder="请选择"
  579. style="width: 100%"
  580. :disabled="
  581. type == 'detail' || [2, 3, 4].includes(scope.row.status)
  582. "
  583. size="mini"
  584. >
  585. <el-option
  586. v-for="item in qualityResultsList"
  587. :key="item.value"
  588. :label="item.label"
  589. :value="item.value"
  590. >
  591. </el-option>
  592. </el-select>
  593. </template>
  594. </el-table-column>
  595. <el-table-column label="操作" width="150" v-if="type !== 'detail'">
  596. <template slot-scope="scope">
  597. <!-- <el-link
  598. v-if="form.recordingMethod == 1"
  599. :type="scope.row.isValid ? 'primary' : 'danger'"
  600. :underline="false"
  601. @click="inspectionProjectReport(scope.$index, scope.row)"
  602. >
  603. 质检
  604. </el-link> -->
  605. <el-popconfirm
  606. class="ele-action"
  607. title="确定要删除当前方案吗?"
  608. @confirm="handDel(scope.$index)"
  609. v-if="![1, 2, 3, 4].includes(scope.row.status)"
  610. >
  611. <template v-slot:reference>
  612. <el-link
  613. type="danger"
  614. :underline="false"
  615. icon="el-icon-delete"
  616. >
  617. 删除
  618. </el-link>
  619. </template>
  620. </el-popconfirm>
  621. </template>
  622. </el-table-column>
  623. </el-table>
  624. <!-- <el-pagination
  625. @size-change="handleSchemeSizeChange"
  626. @current-change="handleSchemeCurrentChange"
  627. :current-page="schemePagination.currentPage"
  628. :page-sizes="[10, 20, 50, 100]"
  629. :page-size="schemePagination.pageSize"
  630. layout="total, sizes, prev, pager, next, jumper"
  631. :total="schemeList.length"
  632. /> -->
  633. </el-tab-pane>
  634. <el-tab-pane label="检测任务单" name="4">
  635. <ele-pro-table
  636. ref="table"
  637. :columns="taskColumns"
  638. :datasource="form.taskMonadList"
  639. :needPage="false"
  640. >
  641. </ele-pro-table>
  642. </el-tab-pane>
  643. <el-tab-pane label="检测请托单" name="5">
  644. <ele-pro-table
  645. ref="table"
  646. :columns="entrustColumns"
  647. :datasource="form.requestEntrustList"
  648. :needPage="false"
  649. >
  650. </ele-pro-table>
  651. </el-tab-pane>
  652. <el-tab-pane label="工艺文件" name="6">
  653. <wokePopupList ref="wokePopupListRef"></wokePopupList>
  654. </el-tab-pane>
  655. </el-tabs>
  656. </el-row>
  657. </template>
  658. <script>
  659. import inspectionTemplateDialog from '@/views/inspectionTemplate/components/inspectionTemplateDialog.vue';
  660. import wokePopupList from '@/components/workList/wokePopupList.vue';
  661. import { parameterGetByCode } from '@/api/main/index';
  662. import {
  663. getDetails,
  664. getCategoryPackageDisposition
  665. } from '@/api/classifyManage/itemInformation';
  666. import {
  667. save,
  668. update,
  669. getById,
  670. exeReportWork,
  671. queryQualitySamplContent,
  672. queryQualityTempleContent,
  673. queryQualityInventory,
  674. newFilePageAPI
  675. } from '@/api/inspectionWork';
  676. import { getQualityTemplateByIds } from '@/api/inspectionTemplate';
  677. import { getCodeList } from '@/api/login';
  678. import { inspectionProjectStatus } from '@/enum/dict.js';
  679. import dictMixins from '@/mixins/dictMixins';
  680. import { getList as getBadNameList } from '@/api/unacceptedProduct/unqualifiedName';
  681. import { getList as getBadTypeList } from '@/api/unacceptedProduct/unqualifiedType';
  682. export default {
  683. mixins: [dictMixins],
  684. components: {
  685. inspectionTemplateDialog,
  686. wokePopupList
  687. },
  688. watch: {
  689. schemeList: {
  690. handler(newVal, oldVal) {
  691. this.templateList = newVal;
  692. // console.log(newVal, 'schemeList');
  693. },
  694. deep: true,
  695. immediate: true
  696. },
  697. activeName: {
  698. handler(newVal) {
  699. this.activeNameKK = newVal;
  700. // console.log(newVal);
  701. }
  702. }
  703. },
  704. props: {
  705. type: String,
  706. packingList: Array,
  707. sampleList: Array,
  708. schemeList: Array,
  709. fileParam: Array,
  710. loading: Boolean,
  711. form: Object,
  712. ids: String,
  713. activeName: String,
  714. status: Boolean,
  715. productId: {
  716. type: String,
  717. default: ''
  718. }
  719. },
  720. data() {
  721. return {
  722. // 不良品类型列表
  723. fileTableList: [],
  724. selection1: [],
  725. badTypeList: [],
  726. // 不良名称列表
  727. badNameList: [],
  728. inspectionProjectStatus,
  729. disposeTypeList: {
  730. 1: '返工',
  731. 2: '返修',
  732. 3: '报废',
  733. 4: '降级使用',
  734. 5: '让步接收',
  735. 6: '留样',
  736. 7: '消耗',
  737. 8: '回用/归批',
  738. 9: '转试销',
  739. 10: '退货'
  740. },
  741. templateList: [],
  742. planTemplateList: [],
  743. activeNameKK: '',
  744. samplePagination: { currentPage: 1, pageSize: 10 },
  745. schemePagination: { currentPage: 1, pageSize: 10 },
  746. qualityResultsList: [
  747. {
  748. value: 1,
  749. label: '合格'
  750. },
  751. {
  752. value: 2,
  753. label: '不合格'
  754. },
  755. {
  756. value: 3,
  757. label: '让步接收'
  758. }
  759. ],
  760. tableColumns: [
  761. {
  762. label: '样品编码',
  763. prop: 'sampleCode',
  764. width: '200',
  765. align: 'center',
  766. fixed: 'left'
  767. },
  768. {
  769. label: '编码',
  770. prop: 'categoryCode',
  771. align: 'center',
  772. fixed: 'left'
  773. },
  774. {
  775. label: '名称',
  776. prop: 'categoryName',
  777. align: 'center'
  778. },
  779. { label: '批次号', prop: 'batchNo', align: 'center' },
  780. { label: '发货条码', prop: 'barcodes', align: 'center' },
  781. { label: '包装编码', prop: 'packageNo', align: 'center' },
  782. { label: '包装数量', prop: 'packingQuantity', align: 'center' },
  783. { label: '包装单位', prop: 'packingUnit', align: 'center' },
  784. { label: '计量数量', prop: 'measureQuantity', align: 'center' },
  785. { label: '计量单位', prop: 'measureUnit', align: 'center' },
  786. {
  787. label: '供应商名称',
  788. prop: 'supplierName',
  789. align: 'center',
  790. width: '120'
  791. },
  792. {
  793. label: '供应商代号',
  794. prop: 'supplierCode',
  795. align: 'center',
  796. width: '120'
  797. },
  798. {
  799. label: '物料代号',
  800. prop: 'materielDesignation',
  801. align: 'center',
  802. slot: 'materielDesignation',
  803. width: '120'
  804. },
  805. {
  806. label: '客户代号',
  807. prop: 'clientCode',
  808. align: 'center',
  809. slot: 'clientCode',
  810. width: '120'
  811. },
  812. {
  813. label: '刻码',
  814. prop: 'engrave',
  815. align: 'center',
  816. slot: 'engrave',
  817. width: '120'
  818. },
  819. {
  820. label: '机型',
  821. prop: 'modelKey',
  822. align: 'center',
  823. showOverflowTooltip: true
  824. },
  825. {
  826. label: '颜色',
  827. prop: 'colorKey',
  828. align: 'center',
  829. showOverflowTooltip: true
  830. },
  831. {
  832. label: '型号',
  833. prop: 'modelType',
  834. align: 'center',
  835. showOverflowTooltip: true
  836. },
  837. {
  838. label: '规格',
  839. prop: 'specification',
  840. align: 'center',
  841. showOverflowTooltip: true
  842. },
  843. {
  844. label: '电压等级',
  845. prop: 'voltage',
  846. align: 'center',
  847. showOverflowTooltip: true
  848. },
  849. {
  850. label: '重量',
  851. prop: 'weight',
  852. align: 'center',
  853. slot: 'weight',
  854. width: '120'
  855. },
  856. {
  857. label: '重量单位',
  858. prop: 'weightUnit',
  859. align: 'center',
  860. width: 100
  861. },
  862. { label: '仓库', prop: 'warehouseName', align: 'center', width: 100 },
  863. { label: '货区', prop: 'areaName', align: 'center' },
  864. { label: '货架', prop: 'goodsShelfName', align: 'center' },
  865. { label: '货位', prop: 'goodsAllocationName', align: 'center' },
  866. { label: '生产日期', prop: 'productionDate', align: 'center' },
  867. { label: '采购日期', prop: 'purchaseDate', align: 'center' }
  868. ],
  869. entrustColumns: [
  870. {
  871. columnKey: 'index',
  872. label: '序号',
  873. type: 'index',
  874. width: 55,
  875. align: 'center',
  876. showOverflowTooltip: true,
  877. fixed: 'left'
  878. },
  879. {
  880. prop: 'code',
  881. label: '请托单号',
  882. showOverflowTooltip: true,
  883. align: 'center',
  884. minWidth: 130
  885. },
  886. {
  887. prop: 'name',
  888. label: '任务名称',
  889. showOverflowTooltip: true,
  890. align: 'center',
  891. minWidth: 110
  892. },
  893. {
  894. prop: 'sampleQuantity',
  895. label: '样品数',
  896. showOverflowTooltip: true,
  897. align: 'center',
  898. formatter: (row) => {
  899. if (row.sampleQuantity) {
  900. return (
  901. row.sampleQuantity + this.sampleList[0]?.measureUnit || ''
  902. );
  903. }
  904. },
  905. minWidth: 110
  906. },
  907. {
  908. prop: 'sampleQualifiedNumber',
  909. label: '样品合格数',
  910. showOverflowTooltip: true,
  911. align: 'center',
  912. formatter: (row) => {
  913. if (row.sampleQualifiedNumber) {
  914. return (
  915. row.sampleQualifiedNumber + this.sampleList[0]?.measureUnit ||
  916. ''
  917. );
  918. }
  919. },
  920. minWidth: 110
  921. },
  922. {
  923. prop: 'sampleNoQualifiedNumber',
  924. label: '样品不合格数',
  925. showOverflowTooltip: true,
  926. align: 'center',
  927. formatter: (row) => {
  928. if (row.sampleNoQualifiedNumber) {
  929. return (
  930. row.sampleNoQualifiedNumber +
  931. this.sampleList[0]?.measureUnit || ''
  932. );
  933. }
  934. },
  935. minWidth: 110
  936. },
  937. {
  938. prop: 'lossNumber',
  939. label: '损耗数(合格品)',
  940. showOverflowTooltip: true,
  941. align: 'center',
  942. formatter: (row) => {
  943. if (row.lossNumber) {
  944. return row.lossNumber + this.sampleList[0]?.measureUnit || '';
  945. }
  946. },
  947. minWidth: 110
  948. },
  949. {
  950. prop: 'lossNumberUnqualified',
  951. label: '损耗数(不合格品)',
  952. showOverflowTooltip: true,
  953. align: 'center',
  954. formatter: (row) => {
  955. if (row.lossNumberUnqualified) {
  956. return (
  957. row.lossNumberUnqualified + this.sampleList[0]?.measureUnit ||
  958. ''
  959. );
  960. }
  961. },
  962. minWidth: 110
  963. },
  964. {
  965. prop: 'retainedSampleQuantity',
  966. label: '留样数(合格品)',
  967. showOverflowTooltip: true,
  968. align: 'center',
  969. formatter: (row) => {
  970. if (row.retainedSampleQuantity) {
  971. return (
  972. row.retainedSampleQuantity +
  973. this.sampleList[0]?.measureUnit || ''
  974. );
  975. }
  976. },
  977. minWidth: 110
  978. },
  979. {
  980. prop: 'retainedSampleUnqualified',
  981. label: '留样数(不合格品)',
  982. formatter: (row) => {
  983. if (row.retainedSampleUnqualified) {
  984. return (
  985. row.retainedSampleUnqualified +
  986. this.sampleList[0]?.measureUnit || ''
  987. );
  988. }
  989. },
  990. showOverflowTooltip: true,
  991. align: 'center',
  992. minWidth: 110
  993. },
  994. {
  995. prop: 'status',
  996. minWidth: 110,
  997. label: '状态',
  998. align: 'center',
  999. formatter: (row) => {
  1000. return row.status == 0
  1001. ? '待收样'
  1002. : row.status == 1
  1003. ? '未报工'
  1004. : '已报工';
  1005. },
  1006. showOverflowTooltip: true
  1007. }
  1008. ],
  1009. taskColumns: [
  1010. {
  1011. columnKey: 'index',
  1012. label: '序号',
  1013. type: 'index',
  1014. width: 55,
  1015. align: 'center',
  1016. showOverflowTooltip: true,
  1017. fixed: 'left'
  1018. },
  1019. {
  1020. prop: 'code',
  1021. label: '检测任务单号',
  1022. showOverflowTooltip: true,
  1023. align: 'center',
  1024. minWidth: 130
  1025. },
  1026. {
  1027. prop: 'name',
  1028. label: '任务名称',
  1029. showOverflowTooltip: true,
  1030. align: 'center',
  1031. minWidth: 110
  1032. },
  1033. {
  1034. prop: 'sampleQuantity',
  1035. label: '样品数',
  1036. showOverflowTooltip: true,
  1037. align: 'center',
  1038. formatter: (row) => {
  1039. if (row.sampleQuantity) {
  1040. return (
  1041. row.sampleQuantity + this.sampleList[0]?.measureUnit || ''
  1042. );
  1043. }
  1044. },
  1045. minWidth: 110
  1046. },
  1047. {
  1048. prop: 'sampleQualifiedNumber',
  1049. label: '样品合格数',
  1050. showOverflowTooltip: true,
  1051. align: 'center',
  1052. formatter: (row) => {
  1053. if (row.sampleQualifiedNumber) {
  1054. return (
  1055. row.sampleQualifiedNumber + this.sampleList[0]?.measureUnit ||
  1056. ''
  1057. );
  1058. }
  1059. },
  1060. minWidth: 110
  1061. },
  1062. {
  1063. prop: 'sampleNoQualifiedNumber',
  1064. label: '样品不合格数',
  1065. showOverflowTooltip: true,
  1066. align: 'center',
  1067. formatter: (row) => {
  1068. if (row.sampleNoQualifiedNumber) {
  1069. return (
  1070. row.sampleNoQualifiedNumber +
  1071. this.sampleList[0]?.measureUnit || ''
  1072. );
  1073. }
  1074. },
  1075. minWidth: 110
  1076. },
  1077. {
  1078. prop: 'lossNumber',
  1079. label: '损耗数(合格品)',
  1080. showOverflowTooltip: true,
  1081. align: 'center',
  1082. formatter: (row) => {
  1083. if (row.lossNumber) {
  1084. return row.lossNumber + this.sampleList[0]?.measureUnit || '';
  1085. }
  1086. },
  1087. minWidth: 110
  1088. },
  1089. {
  1090. prop: 'lossNumberUnqualified',
  1091. label: '损耗数(不合格品)',
  1092. showOverflowTooltip: true,
  1093. align: 'center',
  1094. formatter: (row) => {
  1095. if (row.lossNumberUnqualified) {
  1096. return (
  1097. row.lossNumberUnqualified + this.sampleList[0]?.measureUnit ||
  1098. ''
  1099. );
  1100. }
  1101. },
  1102. minWidth: 110
  1103. },
  1104. {
  1105. prop: 'retainedSampleQuantity',
  1106. label: '留样数(合格品)',
  1107. showOverflowTooltip: true,
  1108. align: 'center',
  1109. formatter: (row) => {
  1110. if (row.retainedSampleQuantity) {
  1111. return (
  1112. row.retainedSampleQuantity +
  1113. this.sampleList[0]?.measureUnit || ''
  1114. );
  1115. }
  1116. },
  1117. minWidth: 110
  1118. },
  1119. {
  1120. prop: 'retainedSampleUnqualified',
  1121. label: '留样数(不合格品)',
  1122. formatter: (row) => {
  1123. if (row.retainedSampleUnqualified) {
  1124. return (
  1125. row.retainedSampleUnqualified +
  1126. this.sampleList[0]?.measureUnit || ''
  1127. );
  1128. }
  1129. },
  1130. showOverflowTooltip: true,
  1131. align: 'center',
  1132. minWidth: 110
  1133. },
  1134. {
  1135. prop: 'status',
  1136. minWidth: 110,
  1137. label: '状态',
  1138. align: 'center',
  1139. formatter: (row) => {
  1140. return row.status == 0
  1141. ? '待收样'
  1142. : row.status == 1
  1143. ? '未报工'
  1144. : '已报工';
  1145. },
  1146. showOverflowTooltip: true
  1147. }
  1148. ],
  1149. // 表格选中数据
  1150. jobColumns1: [
  1151. {
  1152. label: '编码',
  1153. prop: 'code',
  1154. width: 180,
  1155. align: 'center',
  1156. showOverflowTooltip: true
  1157. },
  1158. {
  1159. prop: 'name',
  1160. label: '文档名称',
  1161. align: 'center',
  1162. slot: 'name',
  1163. showOverflowTooltip: true,
  1164. minWidth: 200
  1165. },
  1166. {
  1167. prop: 'storagePath',
  1168. label: '文件名称',
  1169. align: 'center',
  1170. showOverflowTooltip: true,
  1171. minWidth: 200,
  1172. formatter: (_row, _column, cellValue) => {
  1173. return cellValue[0]?.name;
  1174. }
  1175. },
  1176. {
  1177. prop: 'version',
  1178. label: '版本',
  1179. align: 'center',
  1180. showOverflowTooltip: true,
  1181. minWidth: 100
  1182. },
  1183. {
  1184. prop: 'createTime',
  1185. label: '创建时间',
  1186. showOverflowTooltip: true,
  1187. align: 'center',
  1188. minWidth: 110
  1189. },
  1190. {
  1191. columnKey: 'action',
  1192. label: '操作',
  1193. width: 100,
  1194. align: 'center',
  1195. resizable: false,
  1196. slot: 'action',
  1197. showOverflowTooltip: true
  1198. }
  1199. ],
  1200. conditionType: null,
  1201. formData: {
  1202. number: 1,
  1203. sampleUnit: '',
  1204. portion: null,
  1205. packingUnit: ''
  1206. },
  1207. rules: {
  1208. number: [
  1209. {
  1210. required: true,
  1211. message: '请输入',
  1212. trigger: 'blur'
  1213. }
  1214. ],
  1215. sampleUnit: [
  1216. {
  1217. required: true,
  1218. message: '请选择样品单位',
  1219. trigger: 'change'
  1220. }
  1221. ],
  1222. portion: [
  1223. {
  1224. required: true,
  1225. message: '请输入',
  1226. trigger: 'blur'
  1227. }
  1228. ],
  1229. packingUnit: [
  1230. {
  1231. required: true,
  1232. message: '请选择',
  1233. trigger: 'change'
  1234. }
  1235. ]
  1236. },
  1237. packingSpecificationOption: [] // 包装规格下拉
  1238. };
  1239. },
  1240. computed: {
  1241. showBtn() {
  1242. return this.$route.query.qualityType == 2;
  1243. },
  1244. tableColumns1() {
  1245. let arr = [
  1246. // (this.btnType !== 'issued' || this.baseForm.qualityMode === 2)
  1247. // ? {
  1248. // columnKey: 'selection',
  1249. // type: 'selection',
  1250. // width: 45,
  1251. // align: 'center'
  1252. // }
  1253. // : null,
  1254. {
  1255. columnKey: 'selection',
  1256. type: 'selection',
  1257. width: 45,
  1258. align: 'center'
  1259. },
  1260. {
  1261. columnKey: 'index',
  1262. label: '序号',
  1263. type: 'index',
  1264. width: 55,
  1265. align: 'center',
  1266. fixed: 'left'
  1267. },
  1268. {
  1269. label: '编码',
  1270. prop: 'categoryCode',
  1271. width: 150,
  1272. align: 'center',
  1273. showOverflowTooltip: true
  1274. },
  1275. {
  1276. label: '名称',
  1277. prop: 'categoryName',
  1278. width: '150',
  1279. align: 'center',
  1280. width: 120,
  1281. showOverflowTooltip: true
  1282. },
  1283. {
  1284. label: '批次号',
  1285. prop: 'batchNo',
  1286. align: 'center',
  1287. width: 120,
  1288. showOverflowTooltip: true
  1289. },
  1290. {
  1291. label: '发货条码',
  1292. prop: 'barcodes',
  1293. align: 'center',
  1294. showOverflowTooltip: true
  1295. },
  1296. {
  1297. label: '包装编码',
  1298. prop: 'packageNo',
  1299. align: 'center',
  1300. width: 120,
  1301. showOverflowTooltip: true
  1302. },
  1303. { label: '包装数量', prop: 'packingQuantity', align: 'center' },
  1304. { label: '包装单位', prop: 'packingUnit', align: 'center' },
  1305. // {
  1306. // label: '包装规格',
  1307. // prop: 'packingSpecification',
  1308. // align: 'center',
  1309. // width: 180
  1310. // },
  1311. { label: '计量数量', prop: 'measureQuantity', align: 'center' },
  1312. { label: '计量单位', prop: 'measureUnit', align: 'center' },
  1313. { label: '物料代号', prop: 'materielDesignation', align: 'center' },
  1314. { label: '客户代号', prop: 'clientCode', align: 'center' },
  1315. {
  1316. label: '供应商名称',
  1317. prop: 'supplierName',
  1318. align: 'center',
  1319. width: 120,
  1320. showOverflowTooltip: true
  1321. },
  1322. {
  1323. label: '供应商代号',
  1324. prop: 'supplierCode',
  1325. align: 'center',
  1326. width: '120',
  1327. showOverflowTooltip: true
  1328. },
  1329. { label: '刻码', prop: 'engrave', align: 'center' },
  1330. {
  1331. label: '机型',
  1332. prop: 'modelKey',
  1333. align: 'center',
  1334. showOverflowTooltip: true
  1335. },
  1336. {
  1337. label: '颜色',
  1338. prop: 'colorKey',
  1339. align: 'center',
  1340. showOverflowTooltip: true
  1341. },
  1342. {
  1343. label: '型号',
  1344. prop: 'modelType',
  1345. align: 'center',
  1346. showOverflowTooltip: true
  1347. },
  1348. {
  1349. label: '规格',
  1350. prop: 'specification',
  1351. align: 'center',
  1352. showOverflowTooltip: true
  1353. },
  1354. {
  1355. label: '电压等级',
  1356. prop: 'voltage',
  1357. align: 'center',
  1358. showOverflowTooltip: true
  1359. },
  1360. { label: '重量', prop: 'weight', align: 'center' },
  1361. { label: '重量单位', prop: 'weightUnit', align: 'center' },
  1362. {
  1363. label: '仓库',
  1364. prop: 'warehouseName',
  1365. align: 'center',
  1366. width: 120,
  1367. showOverflowTooltip: true
  1368. },
  1369. { label: '货区', prop: 'areaName', align: 'center' },
  1370. { label: '货架', prop: 'goodsShelfName', align: 'center' },
  1371. { label: '货位', prop: 'goodsAllocationName', align: 'center' },
  1372. {
  1373. label: '生产日期',
  1374. prop: 'productionDate',
  1375. align: 'center',
  1376. width: 120,
  1377. showOverflowTooltip: true
  1378. },
  1379. {
  1380. label: '采购日期',
  1381. prop: 'purchaseDate',
  1382. align: 'center',
  1383. width: 120,
  1384. showOverflowTooltip: true
  1385. }
  1386. ];
  1387. return arr;
  1388. },
  1389. // 分页后的样品列表
  1390. paginatedSampleList() {
  1391. // const { currentPage, pageSize } = this.samplePagination;
  1392. // const start = (currentPage - 1) * pageSize;
  1393. // const end = start + pageSize;
  1394. // return this.sampleList?.slice(start, end);
  1395. return this.sampleList;
  1396. },
  1397. // 分页后的质检方案列表
  1398. paginatedSchemeList() {
  1399. // const { currentPage, pageSize } = this.schemePagination;
  1400. // const start = (currentPage - 1) * pageSize;
  1401. // const end = start + pageSize;
  1402. // console.log(this.templateList,'全部数据')
  1403. // return this.templateList?.slice(start, end);
  1404. return this.templateList;
  1405. }
  1406. },
  1407. created() {
  1408. this.activeNameKK = this.activeName;
  1409. this.reload({ qualityWorkerId: this.ids });
  1410. let direction = this.$getDirection();
  1411. this.getBadTypeList();
  1412. this.getBadNameList();
  1413. direction.on('keyup', function (e, val) {
  1414. if (e.keyCode == 39) {
  1415. direction.next();
  1416. }
  1417. if (e.keyCode == 37) {
  1418. direction.previous();
  1419. }
  1420. if (e.keyCode == 38) {
  1421. direction.previousLine();
  1422. }
  1423. if (e.keyCode == 40) {
  1424. direction.nextLine();
  1425. }
  1426. });
  1427. },
  1428. mounted() {
  1429. this.getFileParam();
  1430. },
  1431. methods: {
  1432. async getFileParam() {
  1433. const res = await parameterGetByCode({
  1434. code: 'mes_craft_file_by_category_code'
  1435. });
  1436. const byCategory = res?.value === '1';
  1437. if (byCategory) {
  1438. this.$refs.wokePopupListRef.openTwo(this.form);
  1439. } else {
  1440. this.$refs.wokePopupListRef.open(
  1441. this.fileParam.map((item) => item.id)
  1442. );
  1443. }
  1444. },
  1445. // 不良类型改变
  1446. badTypeChange(row) {
  1447. row.badTypeName = null;
  1448. // 赋值badTypeName
  1449. const badType = this.badTypeList.find(
  1450. (item) => item.id === row.badTypeId
  1451. );
  1452. if (badType) {
  1453. row.badTypeName = badType.name;
  1454. }
  1455. this.getBadNameList(row.badTypeId);
  1456. },
  1457. // 不良名称改变
  1458. badNameChange(row) {
  1459. // 赋值badNameName
  1460. const badItem = this.badNameList.find(
  1461. (item) => item.id === row.badNameId
  1462. );
  1463. if (badItem) {
  1464. row.badNameName = badItem.name;
  1465. }
  1466. },
  1467. // 查询不良类型
  1468. async getBadTypeList() {
  1469. const res = await getBadTypeList({
  1470. pageNum: 1,
  1471. size: 999
  1472. });
  1473. this.badTypeList = res.list;
  1474. },
  1475. // 查询不良名称
  1476. async getBadNameList() {
  1477. const res = await getBadNameList({
  1478. pageNum: 1,
  1479. size: 999
  1480. });
  1481. this.badNameList = res.list;
  1482. },
  1483. //合格数量变化设置样品清单 全减并且不拆包才执行
  1484. async setSampleList(val, total) {
  1485. this.$set(this.sampleList[0], 'measureQuantity', val);
  1486. let weight = this.form.totalWeight / total;
  1487. let arr = [];
  1488. for (let i = 0; i < total - val; i++) {
  1489. let data = JSON.parse(JSON.stringify(this.sampleList[0]));
  1490. data['measureQuantity'] = 1;
  1491. data['qualityResults'] = 2;
  1492. data['qualityStatus'] = 1;
  1493. data['qualitySampleTemplateList'] = [];
  1494. data['id'] = '';
  1495. data['weight'] = parseFloat(weight).toFixed(2);
  1496. let code = await getCodeList('sample_code', { count: 1 });
  1497. data['sampleCode'] = code[0];
  1498. arr.push(data);
  1499. }
  1500. this.$set(
  1501. this.sampleList[0],
  1502. 'weight',
  1503. parseFloat(val * weight).toFixed(2)
  1504. );
  1505. this.sampleList = [this.sampleList[0], ...arr];
  1506. this.$emit('sampleListChange', this.sampleList);
  1507. },
  1508. async datasource({ page, limit, where }) {
  1509. console.log('执行33');
  1510. const res = await queryQualityInventory({
  1511. ...where,
  1512. pageNum: page,
  1513. // size: limit
  1514. size: -1
  1515. });
  1516. if (res.list.length == 0) {
  1517. return res;
  1518. }
  1519. // 包装数量的字段
  1520. // if (!this.productId) {
  1521. // return res;
  1522. // }
  1523. // const result = await getCategoryPackageDisposition({
  1524. // categoryIds: [this.productId]
  1525. // });
  1526. // let str = '';
  1527. // if (result.length) {
  1528. let o = res.list[0];
  1529. let listArr = [];
  1530. if (o.measureUnit) {
  1531. listArr.push({
  1532. packageCellTotal: 1,
  1533. conversionUnit: o.measureUnit,
  1534. id: '111'
  1535. });
  1536. }
  1537. if (o.packingUnit) {
  1538. listArr.push({
  1539. packageCellTotal: o.measureQuantity - 0,
  1540. conversionUnit: o.packingUnit,
  1541. id: '222'
  1542. });
  1543. }
  1544. // result.map((el, index) => {
  1545. // // let Unit = el.conversionUnit.trim();
  1546. // // if (Unit == o.packingUnit.trim() || Unit == o.measureUnit.trim()) {
  1547. // // listArr.push(el);
  1548. // // }
  1549. // if (index == 0) {
  1550. // // el.packageCellTotal = el.packageCell - 0;
  1551. // return;
  1552. // }
  1553. // if (index === result.length - 1) {
  1554. // str = `${str}${el.packageCell}${el.packageUnit}/${el.conversionUnit}`;
  1555. // } else {
  1556. // str = `${str}${el.packageCell}${el.packageUnit}/${el.conversionUnit},`;
  1557. // }
  1558. // // if (index == 1) {
  1559. // // el.packageCellTotal = el.packageCell - 0;
  1560. // // return;
  1561. // // }
  1562. // // 计算乘法的规则
  1563. // // el.packageCellTotal =
  1564. // // el.packageCell * result[index - 1].packageCellTotal;
  1565. // });
  1566. res.list.map((el) => {
  1567. el.weightProportion = el.weight
  1568. ? (el.weight / el.measureQuantity).toFixed(4)
  1569. : 0;
  1570. el.weightProportion = el.weightProportion - 0;
  1571. });
  1572. this.packingSpecificationOption = listArr;
  1573. return res;
  1574. },
  1575. reload(where) {
  1576. this.$nextTick(() => {
  1577. if (this.$refs.sourceTable && this.$refs.sourceTable.reload)
  1578. this.$refs.sourceTable.reload({ page: 1, where: where });
  1579. });
  1580. },
  1581. tableSelClear() {
  1582. this.$refs.sourceTable.clearSelection();
  1583. },
  1584. handleSelectionChange(selection) {
  1585. if (this.form.conditionType == 2) {
  1586. if (this.form.isUnpack == 2) {
  1587. this.$set(this.form, 'sampleNumber', this.formData.portion);
  1588. } else {
  1589. this.formData.portion = selection.length;
  1590. this.$set(this.form, 'sampleNumber', selection.length);
  1591. }
  1592. this.formData.sampleUnit = selection[0]?.measureUnit;
  1593. this.$set(this.form, 'sampleMeasureUnit', selection[0]?.measureUnit);
  1594. } else if (this.form.conditionType == 1) {
  1595. this.$set(this.form, 'sampleNumber', this.formData.portion);
  1596. }
  1597. // this.formData.portion = selection.length;
  1598. // this.formData.sampleUnit = selection[0]?.measureUnit;
  1599. //
  1600. // this.$set(this.form, 'sampleNumber', selection.length);
  1601. // this.$set(this.form, 'sampleMeasureUnit', selection[0]?.measureUnit);
  1602. this.$emit('handleSelectionChange', selection);
  1603. },
  1604. handleSelectionChange1(selection) {
  1605. this.selection1 = selection;
  1606. },
  1607. delAll() {
  1608. if (!this.selection1.length) {
  1609. this.$message.error('请至少选择一条数据!');
  1610. return;
  1611. }
  1612. this.selection1.forEach((item) => {
  1613. this.handDel(
  1614. this.templateList.findIndex((temp) => temp.id == item.id)
  1615. );
  1616. });
  1617. console.log(this.selection1, 'this.selection1');
  1618. },
  1619. handleSampleNumber(val) {
  1620. this.conditionType = val;
  1621. this.form.sampleUnit = '';
  1622. this.$emit('getConditionType', val);
  1623. //取整样
  1624. // let data = this.$refs.sourceTable.getData()
  1625. // this.$emit('getSelectedList')
  1626. // if (this.selectedList.length == 0) {
  1627. // this.$message.warning('请先选择样品!');
  1628. // }
  1629. // if (val == 1) {
  1630. // // this.activeName = '2'
  1631. // this.$emit('handleSample1', val, data)
  1632. // } else if (val == 2) {
  1633. // this.tableSelClear();
  1634. // this.$emit('handleSample1', val, data)
  1635. // }
  1636. },
  1637. handleInputNumber(val) {
  1638. let packingList = this.$refs.sourceTable.getData();
  1639. const maxValue =
  1640. packingList.length > 1
  1641. ? packingList.length
  1642. : packingList[0].measureQuantity;
  1643. if (val > maxValue) {
  1644. this.$message.warning('数量不能大于计量数量!');
  1645. this.formData.number = maxValue;
  1646. return;
  1647. }
  1648. },
  1649. handleInput(val) {
  1650. if (val == 0 || val == '' || val == null) {
  1651. this.$refs.sourceTable.clearSelection();
  1652. return;
  1653. }
  1654. let packingList = this.$refs.sourceTable.getData();
  1655. if (!packingList || packingList.length === 0) {
  1656. return;
  1657. }
  1658. // 计算 packingList 中 measureQuantity 字段的总和
  1659. const measureQuantitySum = packingList.reduce((sum, item) => {
  1660. const quantity = Number(item.measureQuantity) || 0;
  1661. return sum + quantity;
  1662. }, 0);
  1663. const portion = Number(this.formData.portion);
  1664. // 清空当前选中
  1665. this.$refs.sourceTable.clearSelection();
  1666. if (this.form.conditionType == 2) {
  1667. // 确保 portion 不超过数据列表长度
  1668. const safePortion = Math.min(portion, packingList.length);
  1669. if (this.form.isUnpack == 2) {
  1670. const maxQuantity = Number(packingList[0].measureQuantity);
  1671. if (portion > maxQuantity) {
  1672. this.$message.warning('取样数量不能大于计量数量!');
  1673. this.formData.portion = maxQuantity;
  1674. }
  1675. } else if (this.form.isUnpack == 1) {
  1676. if (portion > packingList.length) {
  1677. this.$message.warning('取样数量不能大于来源清单数量!');
  1678. this.formData.portion = packingList.length;
  1679. }
  1680. }
  1681. packingList.slice(0, safePortion).forEach((row) => {
  1682. this.$refs.sourceTable.toggleRowSelection(row);
  1683. });
  1684. } else if (this.form.conditionType == 1) {
  1685. // 确保 portion 不超过数据列表长度
  1686. const safePortion = Math.min(portion, measureQuantitySum);
  1687. if (portion > measureQuantitySum) {
  1688. this.$message.warning('取样数量不能大于计量数量!');
  1689. this.formData.portion = measureQuantitySum;
  1690. }
  1691. // 选中前 safePortion 行
  1692. packingList.slice(0, safePortion).forEach((row) => {
  1693. this.$refs.sourceTable.toggleRowSelection(row, true);
  1694. });
  1695. }
  1696. // if (packingList.length > 1) {
  1697. // if (portion > packingList.length) {
  1698. // this.$message.warning('取样数量不能大于来源清单数量!');
  1699. // this.formData.portion = packingList.length;
  1700. // return;
  1701. // }
  1702. // packingList.slice(0, this.formData.portion).forEach(row => {
  1703. // this.$refs.table12.toggleRowSelection(row);
  1704. // });
  1705. // } else {
  1706. // const maxQuantity = Number(packingList[0].measureQuantity);
  1707. // if (portion > maxQuantity) {
  1708. // this.$message.warning('取样数量不能大于计量数量!');
  1709. // this.formData.portion = maxQuantity;
  1710. // return;
  1711. // }
  1712. // }
  1713. },
  1714. changeSamUnit(val) {
  1715. this.$emit('changeSamUnit', val);
  1716. },
  1717. handleSampleSubmit() {
  1718. this.$refs.ruleForm.validate((valid) => {
  1719. if (valid) {
  1720. //取小样 赋值右上角单位
  1721. this.changeSamUnit(this.formData.sampleUnit);
  1722. let params = {
  1723. conditionType: this.conditionType,
  1724. measureQ: this.formData.number,
  1725. sampleUnit: this.formData.sampleUnit,
  1726. portion: this.formData.portion
  1727. };
  1728. let specifications = this.packingSpecificationOption.find(
  1729. (el) => el.id == this.formData.packingUnit
  1730. );
  1731. console.log('执行这里没', params, '---');
  1732. this.$emit('handleSampleSubmit', params, specifications);
  1733. }
  1734. });
  1735. },
  1736. handleClick(tab) {
  1737. this.activeNameKK = tab.name;
  1738. },
  1739. tabsChange(val) {
  1740. this.activeNameKK = val;
  1741. },
  1742. tabsConditionType(val) {
  1743. this.conditionType = val;
  1744. },
  1745. checkSelectable(row, index) {
  1746. // 只有当质检方式为抽检(qualityMode=2)时 类型不是生产检验 才可选
  1747. return this.form.qualityType != 2 && this.form.qualityMode === 2;
  1748. },
  1749. handleDetail(index, row, type) {
  1750. this.$emit('handleDetail', index, row, type);
  1751. },
  1752. inputWeight(row, index) {
  1753. this.$emit('inputWeight', row, index);
  1754. },
  1755. handleDispose(index, row, type) {
  1756. this.$emit('handleDispose', { row, index });
  1757. },
  1758. handleSampleSizeChange(val) {
  1759. this.samplePagination.pageSize = val;
  1760. this.samplePagination.currentPage = 1;
  1761. },
  1762. handleSampleCurrentChange(val) {
  1763. this.samplePagination.currentPage = val;
  1764. },
  1765. handleSchemeSizeChange(val) {
  1766. this.schemePagination.pageSize = val;
  1767. this.schemePagination.currentPage = 1;
  1768. },
  1769. handleSchemeCurrentChange(val) {
  1770. this.schemePagination.currentPage = val;
  1771. },
  1772. //质检项报工
  1773. inspectionProjectReport(index, row) {
  1774. this.$emit('inspectionProjectReport', { index, list: [row] });
  1775. },
  1776. selectQualityResultsChange() {
  1777. this.$emit('countQualityResults');
  1778. },
  1779. addInspectionTemplate() {
  1780. let type = this.form.qualityType || 1;
  1781. this.$refs.inspectionTemplateRef.open(type);
  1782. },
  1783. async inspectionTemplateSuccess(select) {
  1784. let data = await getQualityTemplateByIds({
  1785. templateIds: select.map((item) => item.id)
  1786. });
  1787. data.forEach((item) => {
  1788. item.id = null;
  1789. });
  1790. // 这里是选择方案后,数据新加,要改为覆盖
  1791. // this.templateList.push(...data);
  1792. // const strings = this.templateList.map((item) => JSON.stringify(item));
  1793. // const removeDupList = [...new Set(strings)];
  1794. // const result = removeDupList.map((item) => JSON.parse(item));
  1795. if (this.form.recordingMethod != 1) {
  1796. this.templateList = [];
  1797. } else {
  1798. this.templateList = this.templateList.filter((item) => item.status);
  1799. }
  1800. data.forEach((item) => {
  1801. item['qualityResults'] = 1;
  1802. item['status'] = 0;
  1803. });
  1804. this.templateList.push(...data);
  1805. // this.templateList = result.map((item) => {
  1806. // item['qualityResults'] = 1;
  1807. // return item;
  1808. // });
  1809. this.sampleList.forEach((item, index) => {
  1810. this.$set(
  1811. this.sampleList[index],
  1812. 'qualitySampleTemplateList',
  1813. this.templateList
  1814. );
  1815. });
  1816. this.$set(this.form, 'templateList', this.templateList);
  1817. this.$emit('setSchemeList', this.templateList);
  1818. // this.schemeList = this.templateList;
  1819. this.schemePagination.total = this.templateList.length;
  1820. if (this.form.recordingMethod == 1) {
  1821. this.$emit('setSchemeListChange');
  1822. }
  1823. },
  1824. handDel(index) {
  1825. this.templateList.splice(index, 1);
  1826. this.sampleList.forEach((item, index) => {
  1827. this.$set(
  1828. this.sampleList[index],
  1829. 'qualitySampleTemplateList',
  1830. this.templateList.map((item) => {
  1831. item['qualityResults'] = 1;
  1832. return item;
  1833. })
  1834. );
  1835. });
  1836. }
  1837. }
  1838. };
  1839. </script>