newQualityContentTabs.vue 59 KB

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