edit.vue 67 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994
  1. <template>
  2. <ele-modal
  3. :visible.sync="visible"
  4. v-if="visible"
  5. :before-close="handleClose"
  6. :close-on-click-modal="true"
  7. :close-on-press-escape="false"
  8. :maxable="true"
  9. append-to-body
  10. width="90%"
  11. >
  12. <div class="ele-body">
  13. <div class="switch">
  14. <div class="switch_left">
  15. <ul>
  16. <li
  17. v-for="item in tabOptions"
  18. :key="item.key"
  19. :class="{ active: activeComp == item.key }"
  20. @click="activeComp = item.key"
  21. >
  22. {{ item.name }}
  23. </li>
  24. </ul>
  25. </div>
  26. </div>
  27. <el-card shadow="never" v-show="activeComp == 'main'">
  28. <header-title title="基本信息">
  29. <el-button @click="cancel">返回</el-button>
  30. <el-button
  31. type="primary"
  32. @click="save"
  33. :loading="loading"
  34. v-if="type != 'detail'"
  35. >保存</el-button
  36. >
  37. <el-button
  38. type="primary"
  39. @click="handleReporting"
  40. :loading="loading"
  41. v-if="type != 'detail'"
  42. >报工完成</el-button
  43. >
  44. </header-title>
  45. <base-info
  46. ref="baseInfoRefs"
  47. v-if="form"
  48. :form="form"
  49. :btnType="type"
  50. :qualityType1="qualityType"
  51. @changeModel="changeModel"
  52. @changeNumber="changeNumber"
  53. @quantityAssignment="quantityAssignment"
  54. @changeInspectionStandardsModel="changeInspectionStandardsModel"
  55. @quantityCalculation="quantityCalculation"
  56. ></base-info>
  57. <header-title title="样品信息"></header-title>
  58. <el-form label-width="110px">
  59. <el-row>
  60. <el-col :span="6">
  61. <el-form-item label="样品合格数:" prop="sampleQualifiedNumber">
  62. <el-input
  63. type="number"
  64. :min="0"
  65. disabled
  66. v-model="form.sampleQualifiedNumber"
  67. placeholder=""
  68. ></el-input>
  69. </el-form-item>
  70. </el-col>
  71. <el-col :span="6">
  72. <el-form-item
  73. label="样品不合格数:"
  74. prop="sampleNoQualifiedNumber"
  75. >
  76. <el-input
  77. type="number"
  78. :min="0"
  79. disabled
  80. v-model="form.sampleNoQualifiedNumber"
  81. placeholder=""
  82. ></el-input>
  83. </el-form-item>
  84. </el-col>
  85. <el-col :span="6">
  86. <el-form-item label="样品合格率:" prop="sampleQualificationRate">
  87. <el-input v-model="form.sampleQualificationRate" disabled />
  88. </el-form-item>
  89. </el-col>
  90. <el-col :span="6">
  91. <el-form-item
  92. label="样品不合格率:"
  93. prop="sampleNoQualificationRate"
  94. >
  95. <el-input v-model="form.sampleNoQualificationRate" disabled />
  96. </el-form-item>
  97. </el-col>
  98. </el-row>
  99. <el-row>
  100. <el-col :span="6">
  101. <el-form-item label="样品类型:" prop="samplesType">
  102. <el-input disabled :value="sampletypeVal(form.conditionType)" />
  103. </el-form-item>
  104. </el-col>
  105. <el-col :span="6">
  106. <el-form-item label="样品数量:" prop="sampleQuantity">
  107. <el-input
  108. type="number"
  109. disabled
  110. v-model="form.sampleQuantity"
  111. />
  112. </el-form-item>
  113. </el-col>
  114. <el-col :span="6">
  115. <el-form-item label="样品重量:" prop="sampleWeight">
  116. <el-input type="number" disabled v-model="form.sampleWeight" />
  117. </el-form-item>
  118. </el-col>
  119. </el-row>
  120. </el-form>
  121. <quality-content-tabs
  122. v-if="form.id"
  123. ref="tabsRef"
  124. :type="type"
  125. :ids="dataWork.id"
  126. :sample-list="sampleList"
  127. :activeName="activeName"
  128. :scheme-list="schemeList"
  129. :loading="loading"
  130. :form="form"
  131. :productId="productId"
  132. :status="statusType"
  133. @handleSelectionChange="handleSelectionChange1"
  134. @batch-quality="batchQuality"
  135. @batch-dispose="batchDispose"
  136. @handleDetail="handleDetail"
  137. @inputWeight="inputWeight"
  138. @handleDispose="handleDispose"
  139. @changeSamUnit="changeSamUnit"
  140. @handleSample1="handleSample1"
  141. @handleSampleSubmit="handleSampleSubmit"
  142. @getConditionType="getConditionType"
  143. @countQualityResults="countQualityResults"
  144. @setSchemeList="setSchemeList"
  145. @sampleListChange="sampleListChange"
  146. />
  147. </el-card>
  148. <pickOrderList
  149. :list="form.orderInfoList"
  150. v-show="activeComp == 'pickOrderListShow'"
  151. ></pickOrderList>
  152. <sampleListDialog
  153. ref="detailRef"
  154. @handleConfirm="handleConfirm"
  155. @handleDispose="handleDispose"
  156. ></sampleListDialog>
  157. <sampleDisposeDialog
  158. v-if="sampleDisposeVisble"
  159. :sampleDisposeVisble.sync="sampleDisposeVisble"
  160. ref="disposeRef"
  161. @handleDisposeConfirm="handleDisposeConfirm"
  162. :rowData="rowData"
  163. @close="closeDispose"
  164. @handleDispose="handleDispose"
  165. ></sampleDisposeDialog>
  166. </div>
  167. </ele-modal>
  168. </template>
  169. <script>
  170. import baseInfo from './components/baseInfo.vue';
  171. // import QualityContentTabs from './components/QualityContentTabs.vue';
  172. import QualityContentTabs from './components/newQualityContentTabs.vue';
  173. import pickOrderList from './components/pickOrderList/index.vue'; //领料记录
  174. import { getCode, getCodeList } from '@/api/login';
  175. import {
  176. save,
  177. update,
  178. getById,
  179. exeReportWork,
  180. queryQualitySamplContent,
  181. queryQualityTempleContent,
  182. queryQualityInventory
  183. } from '@/api/inspectionWork';
  184. import dictMixins from '@/mixins/dictMixins';
  185. // import term from './term';
  186. import sampleListDialog from './components/sampleListDialog.vue';
  187. import sampleDisposeDialog from './components/sampleDisposeDialog.vue';
  188. import { finishPageTab } from '@/utils/page-tab-util';
  189. export default {
  190. components: {
  191. baseInfo,
  192. QualityContentTabs,
  193. sampleListDialog,
  194. sampleDisposeDialog,
  195. pickOrderList
  196. },
  197. mixins: [dictMixins],
  198. computed: {
  199. sampletypeVal() {
  200. return (row) => {
  201. if (row == 1) {
  202. return '整样';
  203. }
  204. return '小样';
  205. };
  206. }
  207. },
  208. // p:{
  209. // sampletypeVal()=>{
  210. // return
  211. // }
  212. // },
  213. data() {
  214. const defaultForm = function () {
  215. return {
  216. code: '',
  217. qualityType: null,
  218. qualityModeproduceRoutingId: '',
  219. produceRoutingName: '',
  220. produceTaskId: '',
  221. produceTaskName: '',
  222. productName: '',
  223. productCode: '',
  224. batchNo: '',
  225. specification: '',
  226. modelType: '',
  227. brandNo: '',
  228. total: '',
  229. qualifiedNumber: '',
  230. noQualifiedNumber: '',
  231. groupId: '',
  232. groupName: '',
  233. qualityId: '',
  234. qualityName: '',
  235. qualityTime: '',
  236. hours: '',
  237. qualificationRate: '',
  238. noQualificationRate: '',
  239. totalWeight: '',
  240. sampleNumber: '',
  241. imgUrl: [],
  242. qualityTimeStart: '',
  243. qualityTimeEnd: '',
  244. templateList: [],
  245. qualityIdList: [],
  246. sampleMeasureUnit: '',
  247. conditionType: null
  248. };
  249. };
  250. return {
  251. activeComp: 'main',
  252. tabOptions: [
  253. { key: 'main', name: '报工' },
  254. { key: 'pickOrderListShow', name: '领料记录' }
  255. ],
  256. rowData: null,
  257. defaultForm,
  258. sampleDisposeVisble: false,
  259. // 表单数据
  260. form: { ...defaultForm() },
  261. voList: [],
  262. // 表单验证规则
  263. categoryParamList: [],
  264. type: '',
  265. title: '',
  266. loading: false,
  267. tabTaskId: null,
  268. // activeName: '2',
  269. packingList: [],
  270. // 样品清单,处置,批量处置,批量质检,质检的操作
  271. sampleList: [],
  272. schemeList: [],
  273. inventoryList: [],
  274. activeName: '1',
  275. isValid: true,
  276. isStatus: true,
  277. SampleListbyReportList: [],
  278. qualityTimeStart: '',
  279. isReportProcessProduce: false,
  280. addStatus: [],
  281. statusType: false,
  282. visible: false,
  283. dataWork: {}
  284. };
  285. },
  286. watch: {
  287. '$route.query.id': {
  288. handler(id) {
  289. if (id) {
  290. this.getDetail();
  291. } else {
  292. this.form = { ...defaultForm() };
  293. }
  294. }
  295. },
  296. // 样品清单
  297. sampleList: {
  298. handler(newVal) {
  299. if (!newVal || newVal.length == 0) {
  300. return;
  301. }
  302. console.log(newVal, 'newVal 12');
  303. // 默认赋值质检结果
  304. this.setInspectionResults(newVal);
  305. },
  306. deep: true,
  307. immediate: true
  308. },
  309. form: {
  310. handler(newVal) {
  311. console.log(newVal, 'newVal 新的form');
  312. },
  313. deep: true,
  314. immediate: true
  315. },
  316. 'form.qualityResults': {
  317. handler(newVal, oldVal) {
  318. if (!newVal && oldVal) {
  319. this.form.qualityResults = oldVal;
  320. }
  321. }
  322. }
  323. },
  324. created() {
  325. // this.open();
  326. // if (this.$route.query.id) {
  327. // this.getDetail();
  328. // }
  329. },
  330. methods: {
  331. //合格与不合格数变化处理逻辑
  332. quantityCalculation(val) {
  333. this.$refs.tabsRef.setSampleList(val, this.form.total);
  334. },
  335. setInspectionResults(list) {
  336. console.log('设置质检结果');
  337. this.$nextTick(() => {
  338. let qualityResults = this.form.qualityResults;
  339. let showArrange = this.$refs.baseInfoRefs.showArrange;
  340. if (showArrange == '1') return;
  341. if (qualityResults == null || qualityResults == undefined) {
  342. for (let i = 0; i < list.length; i++) {
  343. let el = list[i];
  344. if (el.qualityResults == 2) {
  345. this.$set(this.form, 'qualityResults', 2);
  346. return;
  347. }
  348. }
  349. this.$set(this.form, 'qualityResults', 1);
  350. console.log(list, 'list');
  351. console.log(this.form.qualityResults, '质检结果');
  352. }
  353. });
  354. },
  355. //
  356. calculate(list) {
  357. if (list.length == 0) {
  358. this.form.sampleQuantity = 0;
  359. this.form.sampleWeight = 0;
  360. }
  361. let sampleQuantity = 0; // 样品数量
  362. let sampleWeight = 0; // 样品重量
  363. let sampleQualifiedNumber = 0; // 样品合格数
  364. let sampleNoQualifiedNumber = 0; // 样品不合格数
  365. list.forEach((el) => {
  366. sampleQuantity += el.measureQuantity - 0;
  367. sampleWeight += el.weight - 0;
  368. if (el.qualityResults != 2) {
  369. sampleQualifiedNumber += el.measureQuantity - 0;
  370. } else {
  371. sampleNoQualifiedNumber += el.measureQuantity - 0;
  372. }
  373. });
  374. // 计算合格率和不合格率(百分比形式)
  375. let sampleQualificationRate = '';
  376. let sampleNoQualificationRate = '';
  377. if (
  378. (sampleQualifiedNumber || sampleQualifiedNumber == 0) &&
  379. sampleQuantity !== 0
  380. ) {
  381. sampleQualificationRate =
  382. ((sampleQualifiedNumber / sampleQuantity) * 100).toFixed(2) || '';
  383. sampleNoQualificationRate =
  384. ((sampleNoQualifiedNumber / sampleQuantity) * 100).toFixed(2) || '';
  385. }
  386. if (sampleQualificationRate || sampleQualificationRate == '0.00') {
  387. if (isNaN(sampleQualificationRate)) {
  388. sampleQualificationRate = '0%';
  389. } else {
  390. sampleQualificationRate = sampleQualificationRate + '%';
  391. }
  392. }
  393. if (sampleNoQualificationRate || sampleNoQualificationRate == '0.00') {
  394. if (isNaN(sampleNoQualificationRate)) {
  395. sampleNoQualificationRate = '0%';
  396. } else {
  397. sampleNoQualificationRate = sampleNoQualificationRate + '%';
  398. }
  399. }
  400. // let resultsTotal = this.form.total - sampleQuantity;
  401. // if (sampleQuantity == sampleQualifiedNumber) {
  402. // // this.$set(this.form, 'qualifiedNumber', resultsTotal);
  403. // // this.$set(this.form, 'noQualifiedNumber', 0);
  404. // this.$set(this.form, 'qualificationRate', '100%');
  405. // this.$set(this.form, 'noQualificationRate', '0');
  406. // this.$set(this.form, 'qualityResults', 1);
  407. // } else {
  408. // // this.$set(this.form, 'noQualifiedNumber', resultsTotal);
  409. // // this.$set(this.form, 'qualifiedNumber', 0);
  410. // this.$set(this.form, 'qualificationRate', '0');
  411. // this.$set(this.form, 'noQualificationRate', '100%');
  412. // this.$set(this.form, 'qualityResults', 2);
  413. let showArrange = this.$refs.baseInfoRefs?.showArrange;
  414. if (showArrange != '1') {
  415. if (sampleQuantity == sampleQualifiedNumber) {
  416. this.$set(this.form, 'qualificationRate', '100%');
  417. this.$set(this.form, 'noQualificationRate', '0');
  418. this.$set(this.form, 'qualityResults', 1);
  419. //样品数量和样品合格数相等 默认合格率100% 不合格率0% 质检结果合格
  420. this.$set(this.form, 'qualifiedNumber', this.form.total);
  421. this.$set(this.form, 'noQualifiedNumber', 0);
  422. } else {
  423. this.$set(this.form, 'qualificationRate', '0');
  424. this.$set(this.form, 'noQualificationRate', '100%');
  425. this.$set(this.form, 'qualityResults', 2);
  426. }
  427. }
  428. // this.$set(this.form, 'resultsTotal', resultsTotal);
  429. this.$set(
  430. this.form,
  431. 'sampleQualificationRate',
  432. sampleQualificationRate
  433. );
  434. this.$set(
  435. this.form,
  436. 'sampleNoQualificationRate',
  437. sampleNoQualificationRate
  438. );
  439. this.$set(this.form, 'sampleQuantity', sampleQuantity);
  440. this.$set(this.form, 'sampleWeight', sampleWeight);
  441. this.$set(this.form, 'sampleQualifiedNumber', sampleQualifiedNumber);
  442. this.$set(
  443. this.form,
  444. 'sampleNoQualifiedNumber',
  445. sampleNoQualifiedNumber
  446. );
  447. // 数量赋值
  448. this.quantityAssignment();
  449. },
  450. // 计算合格数不合格数
  451. quantityAssignment() {
  452. let showArrange = this.$refs.baseInfoRefs?.showArrange;
  453. let noQualifiedNumber = 0;
  454. let qualifiedNumber = 0;
  455. let data = this.form;
  456. let total = data.total - 0;
  457. if (this.form.qualityResults == 2) {
  458. noQualifiedNumber = total - (data.sampleQualifiedNumber - 0);
  459. qualifiedNumber = total - noQualifiedNumber;
  460. } else {
  461. qualifiedNumber = total - (data.sampleNoQualifiedNumber - 0);
  462. noQualifiedNumber = total - qualifiedNumber;
  463. }
  464. this.$set(this.form, 'qualifiedNumber', qualifiedNumber);
  465. this.$set(this.form, 'noQualifiedNumber', noQualifiedNumber);
  466. if (showArrange != '1') {
  467. return;
  468. }
  469. this.$set(
  470. this.form,
  471. 'qualificationRate',
  472. ((qualifiedNumber / total) * 100).toFixed(2) + '%'
  473. );
  474. this.$set(
  475. this.form,
  476. 'noQualificationRate',
  477. ((noQualifiedNumber / total) * 100).toFixed(2) + '%'
  478. );
  479. },
  480. //切换检验方式
  481. changeModel(val, flag) {
  482. this.$refs.tabsRef.tableSelClear();
  483. this.sampleList = [];
  484. this.$refs.tabsRef.tabsChange('1');
  485. this.$refs.tabsRef.tabsConditionType(null);
  486. this.form.qualityMode = val;
  487. //检验方式 全检
  488. if (this.form.qualityMode == 1) {
  489. this.activeName = '2';
  490. this.form.sampleNumber = '';
  491. this.changeGetSampleList(this.inventoryList);
  492. } else {
  493. this.activeName = '1';
  494. if (!flag) {
  495. this.sampleList = [];
  496. }
  497. }
  498. this.calculate([]);
  499. },
  500. //根据类型判断样品清单现实列表数据
  501. async getProSamList(list) {
  502. //生产检验
  503. if (this.qualityType == 2) {
  504. if (this.form.qualityMode != null) {
  505. const ProductSampleList = [];
  506. for (const oldItem of list) {
  507. const count = oldItem.measureQuantity;
  508. const newMeasureQuantity = oldItem.measureQuantity / count;
  509. const newWeight = parseFloat((oldItem.weight / count).toFixed(2));
  510. // 遍历新数组设置 qualityResults 默认值
  511. this.schemeList.forEach((item) => {
  512. if (typeof item === 'object' && item !== null) {
  513. item.qualityResults = 1; // 设置默认值
  514. }
  515. delete item.id;
  516. });
  517. delete oldItem.id;
  518. if (
  519. oldItem.qualitySampleTemplateList == undefined ||
  520. oldItem.qualitySampleTemplateList == null ||
  521. oldItem.qualitySampleTemplateList.length == 0
  522. ) {
  523. oldItem.qualitySampleTemplateList = JSON.parse(
  524. JSON.stringify(this.schemeList)
  525. );
  526. for (let i = 0; i < count; i++) {
  527. ProductSampleList.push({
  528. ...oldItem,
  529. measureQuantity: newMeasureQuantity,
  530. weight: newWeight,
  531. sampleCode: await this.getSampleCode(),
  532. qualitySampleTemplateList: JSON.parse(
  533. JSON.stringify(this.schemeList)
  534. )
  535. });
  536. }
  537. this.sampleList = ProductSampleList;
  538. this.calculate(this.sampleList);
  539. const pNum = ProductSampleList.reduce((sum, item) => {
  540. return sum + Number(item.weight || 0);
  541. }, 0);
  542. this.form.totalWeight = parseFloat(pNum.toFixed(2));
  543. } else {
  544. for (let i = 0; i < count; i++) {
  545. ProductSampleList.push({
  546. ...oldItem,
  547. measureQuantity: newMeasureQuantity,
  548. weight: newWeight,
  549. sampleCode: await this.getSampleCode(),
  550. qualitySampleTemplateList: JSON.parse(
  551. JSON.stringify(oldItem.qualitySampleTemplateList)
  552. )
  553. });
  554. }
  555. this.sampleList = ProductSampleList;
  556. this.calculate(this.sampleList);
  557. const pNum = ProductSampleList.reduce((sum, item) => {
  558. return sum + Number(item.weight || 0);
  559. }, 0);
  560. this.form.totalWeight = parseFloat(pNum.toFixed(2));
  561. }
  562. }
  563. }
  564. } else {
  565. // this.sampleList = list;
  566. this.sampleList = this.addStatus;
  567. }
  568. },
  569. // 创建计量数量为1的样品清单函数,用于计数类型的
  570. async createSampleList(list) {
  571. if (this.form.qualityMode != null) {
  572. this.$message.closeAll();
  573. this.$message('正在生成样品清单');
  574. const ProductSampleList = [];
  575. for (const oldItem of list) {
  576. const count = oldItem.measureQuantity ? oldItem.measureQuantity : 1;
  577. const newMeasureQuantity = oldItem.measureQuantity / count;
  578. const newWeight = parseFloat((oldItem.weight / count).toFixed(2));
  579. // 遍历新数组设置 qualityResults 默认值
  580. this.schemeList.forEach((item) => {
  581. if (typeof item === 'object' && item !== null) {
  582. item.qualityResults = 1; // 设置默认值
  583. }
  584. delete item.id;
  585. });
  586. delete oldItem.id;
  587. if (
  588. oldItem.qualitySampleTemplateList == undefined ||
  589. oldItem.qualitySampleTemplateList == null ||
  590. oldItem.qualitySampleTemplateList.length == 0
  591. ) {
  592. oldItem.qualitySampleTemplateList = JSON.parse(
  593. JSON.stringify(this.schemeList)
  594. );
  595. for (let i = 0; i < count; i++) {
  596. ProductSampleList.push({
  597. ...oldItem,
  598. measureQuantity: newMeasureQuantity,
  599. weight: newWeight,
  600. sampleCode: await this.getSampleCode(),
  601. qualitySampleTemplateList: JSON.parse(
  602. JSON.stringify(this.schemeList)
  603. )
  604. });
  605. }
  606. this.sampleList = ProductSampleList;
  607. this.calculate(this.sampleList);
  608. const pNum = ProductSampleList.reduce((sum, item) => {
  609. return sum + Number(item.weight || 0);
  610. }, 0);
  611. this.form.totalWeight = parseFloat(pNum.toFixed(2));
  612. } else {
  613. for (let i = 0; i < count; i++) {
  614. ProductSampleList.push({
  615. ...oldItem,
  616. measureQuantity: newMeasureQuantity,
  617. weight: newWeight,
  618. sampleCode: await this.getSampleCode(),
  619. qualitySampleTemplateList: JSON.parse(
  620. JSON.stringify(oldItem.qualitySampleTemplateList)
  621. )
  622. });
  623. }
  624. this.sampleList = ProductSampleList;
  625. this.calculate(this.sampleList);
  626. const pNum = ProductSampleList.reduce((sum, item) => {
  627. return sum + Number(item.weight || 0);
  628. }, 0);
  629. this.form.totalWeight = parseFloat(pNum.toFixed(2));
  630. }
  631. }
  632. }
  633. },
  634. // 全检计量计重的样品清单函数
  635. async updatePackingList(list, sampleCount) {
  636. // for (let i = 0; i < list.length; i++) {
  637. // list[i].sampleCode = await this.getSampleCode();
  638. // }
  639. const dataList = [];
  640. let currentNum = sampleCount - list.length;
  641. let currentNum1 = sampleCount;
  642. // console.log(this.selectedList);
  643. let count = list ? list.length : 0;
  644. const codeList = await this.batchCodes(count);
  645. for (const [index, item] of list.entries()) {
  646. const qualitySampleTemplateList = item.qualitySampleTemplateList
  647. ?.length
  648. ? JSON.parse(JSON.stringify(item.qualitySampleTemplateList))
  649. : JSON.parse(
  650. JSON.stringify(
  651. this.schemeList.map((item) => {
  652. item['qualityResults'] = 1;
  653. return item;
  654. })
  655. )
  656. );
  657. if (sampleCount >= list.length) {
  658. dataList.push({
  659. ...item,
  660. measureQuantity: item.measureQuantity, //作为计量数量
  661. // sampleCode: await this.getSampleCode(),
  662. sampleCode: codeList[index],
  663. qualitySampleTemplateList
  664. });
  665. }
  666. }
  667. this.sampleList = dataList;
  668. this.calculate(this.sampleList);
  669. this.sampleNumber = this.sampleList.length;
  670. },
  671. // 切换检验方式为全检后生成样品
  672. changeGetSampleList(list) {
  673. this.$message.closeAll();
  674. this.$message('正在生成样品清单');
  675. // // 计量类型1是数量,2是重量
  676. // if (this.form.inspectionStandards == 1) {
  677. // this.createSampleList(list);
  678. // }
  679. // if (this.form.inspectionStandards == 2) {
  680. // this.updatePackingList(list, this.form.total);
  681. // // this.handleWeightFullSample(this.form.total);
  682. // }
  683. this.updatePackingList(list, this.form.total);
  684. },
  685. //输入取样数量
  686. changeNumber(val) {
  687. if (this.form.qualityMode !== 2) {
  688. return;
  689. }
  690. if (val <= 0) {
  691. this.$refs.showPackingListTable.clearSelection();
  692. return;
  693. }
  694. if (this.qualityType == 2) {
  695. //生产检验的抽检逻辑
  696. if (val > this.packingList[0].measureQuantity) {
  697. this.$message.warning('取样数量不能大于来源清单的计量数量!');
  698. return;
  699. }
  700. const ProductSampleList = [];
  701. this.packingList.forEach((oldItem) => {
  702. const count = oldItem.measureQuantity;
  703. const newMeasureQuantity = oldItem.measureQuantity / count;
  704. const newWeight = parseFloat((oldItem.weight / count).toFixed(2));
  705. delete oldItem.id;
  706. // 遍历新数组设置 qualityResults 默认值
  707. this.schemeList.forEach((item) => {
  708. if (typeof item === 'object' && item !== null) {
  709. item.qualityResults = 1; // 设置默认值
  710. }
  711. delete item.id;
  712. });
  713. for (let i = 0; i < val; i++) {
  714. ProductSampleList.push({
  715. ...oldItem,
  716. measureQuantity: newMeasureQuantity,
  717. weight: newWeight,
  718. qualitySampleTemplateList: JSON.parse(
  719. JSON.stringify(this.schemeList)
  720. )
  721. });
  722. }
  723. });
  724. this.sampleList = ProductSampleList;
  725. this.calculate(this.sampleList);
  726. const pNum = ProductSampleList.reduce((sum, item) => {
  727. return sum + Number(item.weight || 0);
  728. }, 0);
  729. this.form.totalWeight = parseFloat(pNum.toFixed(2));
  730. } else {
  731. if (val > this.packingList.length) {
  732. this.$message.warning('取样数量不能大于物料明细总数!');
  733. return;
  734. }
  735. const rows = this.packingList.slice(0, val);
  736. rows.forEach((row) => {
  737. this.$refs.showPackingListTable.toggleRowSelection(row);
  738. });
  739. }
  740. },
  741. getNowDate() {
  742. let date = new Date(),
  743. obj = {
  744. year: date.getFullYear(), //获取当前月份(0-11,0代表1月)
  745. month: date.getMonth() + 1, //获取当前月份(0-11,0代表1月)
  746. strDate: date.getDate(), // 获取当前日(1-31)
  747. hour: date.getHours(), //获取当前小时(0 ~ 23)
  748. minute: date.getMinutes(), //获取当前分钟(0 ~ 59)
  749. second: date.getSeconds() //获取当前秒数(0 ~ 59)
  750. };
  751. Object.keys(obj).forEach((key) => {
  752. if (obj[key] < 10) obj[key] = `0${obj[key]}`;
  753. });
  754. return obj;
  755. },
  756. //来源清单勾选事件
  757. handleSelectionChange1(selection) {
  758. if (this.form.qualityMode === 2) {
  759. this.selectedList = selection;
  760. this.activeName = '1';
  761. if (this.schemeList.length == 0) {
  762. for (let i = 0; i < selection.length; i++) {
  763. this.$set(selection[i], 'qualityStatus', 2);
  764. // 遍历新数组设置 qualityResults 默认值
  765. this.schemeList.forEach((item) => {
  766. if (typeof item === 'object' && item !== null) {
  767. item.qualityResults = 1; // 设置默认值
  768. }
  769. delete item.id;
  770. });
  771. this.$set(
  772. selection[i],
  773. 'qualitySampleTemplateList',
  774. JSON.parse(JSON.stringify(this.schemeList))
  775. );
  776. }
  777. }
  778. // this.sampleList = selection;
  779. //赋值取样数量
  780. this.form.sampleNumber = selection.length;
  781. }
  782. },
  783. async open(req) {
  784. this.visible = true;
  785. this.dataWork = req.data;
  786. this.getDetail(req.workOrderId);
  787. this.type = req.data.type ? req.data.type : req.type;
  788. this.qualityType = req.data.qualityType ? req.data.qualityType : '';
  789. this.title =
  790. this.type == 'add' ? '新增' : this.type == 'edit' ? '报工' : '详情';
  791. if (this.type == 'add') {
  792. const code = await getCode('quality_work_order_code');
  793. this.form.code = code;
  794. } else {
  795. if (
  796. req.data.qualityTimeStart != '' ||
  797. req.data.qualityTimeStart != null ||
  798. req.data.qualityTimeStart != undefined
  799. ) {
  800. this.qualityTimeStart = this.getNowTime();
  801. }
  802. }
  803. },
  804. getNowTime() {
  805. const nowDate = this.getNowDate();
  806. return (
  807. nowDate.year +
  808. '-' +
  809. nowDate.month +
  810. '-' +
  811. nowDate.strDate +
  812. ' ' +
  813. nowDate.hour +
  814. ':' +
  815. nowDate.minute +
  816. ':' +
  817. nowDate.second
  818. );
  819. },
  820. getNowTimes() {
  821. const nowDate = this.getNowDate();
  822. return nowDate.year + '-' + nowDate.month + '-' + nowDate.strDate;
  823. },
  824. async getDetail(id) {
  825. getById(id).then((res) => {
  826. this.form = res.data;
  827. console.log(this.form, 'this.form');
  828. this.form.qualityIdList = this.form.qualityId
  829. ? this.form.qualityId.split(',')
  830. : [];
  831. this.productId = res.data.productId || '';
  832. this.statusType = this.form.status == 1 ? true : false;
  833. this.isReportProcessProduce =
  834. this.form.isReportProcessProduce == 1 ? true : false;
  835. this.tabTaskId =
  836. this.categoryParamList[0] && this.categoryParamList[0].id;
  837. if (this.form.groupId) {
  838. this.$nextTick(() => {
  839. this.$refs.baseInfoRefs?.getUserList({
  840. groupId: this.form.groupId
  841. });
  842. });
  843. }
  844. if (this.form.produceRoutingId) {
  845. this.$nextTick(() => {
  846. this.$refs.baseInfoRefs?.getTaskList();
  847. });
  848. }
  849. });
  850. // await this.queryQualityInventory()
  851. // 质检方案
  852. await this.queryQualityTempleContent();
  853. // 样品清单
  854. await this.queryQualitySamplContent();
  855. // 来源清单
  856. await this.getQueryQualityInventory();
  857. },
  858. // getNewData(val) {
  859. // console.log(val, '清单列表')
  860. // this.packingList = val
  861. // },
  862. // async queryQualityInventory() {
  863. // let res = await queryQualityInventory({ qualityWorkerId: this.$route.query.id });
  864. // console.log(res, '清单列表');
  865. // this.packingList = res;
  866. // },
  867. changeSamUnit(val) {
  868. this.$set(this.form, 'sampleMeasureUnit', val);
  869. },
  870. async handleSample1(val, data) {
  871. this.sampleList = [];
  872. if (this.selectedList == undefined || this.selectedList.length == 0) {
  873. this.activeName = '1';
  874. this.$message.warning('请先选择样品!');
  875. return;
  876. }
  877. if (val == 1) {
  878. this.activeName = '2';
  879. if (this.form.isUnpack == 1) {
  880. for (let i = 0; i < this.selectedList.length; i++) {
  881. for (let j = 0; j < this.selectedList[i].measureQuantity; j++) {
  882. // 不拆计算每个重量
  883. let newWeight = parseFloat(
  884. (
  885. this.selectedList[i].weight /
  886. this.selectedList[i].measureQuantity
  887. ).toFixed(4)
  888. );
  889. if (
  890. this.selectedList[i].qualitySampleTemplateList == undefined ||
  891. this.selectedList[i].qualitySampleTemplateList == null ||
  892. this.selectedList[i].qualitySampleTemplateList.length == 0
  893. ) {
  894. this.sampleList.push({
  895. ...this.selectedList[i],
  896. sampleCode: await this.getSampleCode(),
  897. measureQuantity: 1,
  898. qualitySampleTemplateList: JSON.parse(
  899. JSON.stringify(this.schemeList)
  900. ),
  901. weight: newWeight || 0
  902. });
  903. } else {
  904. this.sampleList.push({
  905. ...this.selectedList[i],
  906. sampleCode: await this.getSampleCode(),
  907. measureQuantity: 1,
  908. qualitySampleTemplateList: JSON.parse(
  909. JSON.stringify(
  910. this.selectedList[i].qualitySampleTemplateList
  911. )
  912. ),
  913. weight: newWeight || 0
  914. });
  915. }
  916. }
  917. }
  918. } else if (this.form.isUnpack == 2) {
  919. // 不拆计算每个重量
  920. let newWeight = parseFloat(
  921. (
  922. this.selectedList[0].weight /
  923. this.selectedList[0].measureQuantity
  924. ).toFixed(4)
  925. );
  926. for (let i = 0; i < this.selectedList[0].measureQuantity; i++) {
  927. if (
  928. this.selectedList[0].qualitySampleTemplateList == undefined ||
  929. this.selectedList[0].qualitySampleTemplateList == null ||
  930. this.selectedList[0].qualitySampleTemplateList.length == 0
  931. ) {
  932. this.sampleList.push({
  933. ...this.selectedList[0],
  934. sampleCode: await this.getSampleCode(),
  935. measureQuantity: 1,
  936. qualitySampleTemplateList: JSON.parse(
  937. JSON.stringify(this.schemeList)
  938. ),
  939. weight: newWeight || 0
  940. });
  941. } else {
  942. this.sampleList.push({
  943. ...this.selectedList[0],
  944. sampleCode: await this.getSampleCode(),
  945. measureQuantity: 1,
  946. qualitySampleTemplateList: JSON.parse(
  947. JSON.stringify(
  948. this.selectedList[0].qualitySampleTemplateList
  949. )
  950. ),
  951. weight: newWeight || 0
  952. });
  953. }
  954. }
  955. }
  956. //取整样=勾选数据
  957. // this.sampleList = this.selectedList;
  958. this.$message.success('取样成功!');
  959. } else if (val == 2) {
  960. console.log(data, 'datadatadatadataxiaoyang');
  961. }
  962. this.calculate(this.sampleList);
  963. },
  964. async handleSampleSubmit(data, specifications) {
  965. this.sampleList = [];
  966. if (!this.selectedList || this.selectedList.length == 0) {
  967. this.$message.warning('请先选择样品!');
  968. return;
  969. }
  970. const measureQ = data.measureQ || 1;
  971. const unit = data.sampleUnit;
  972. const sampleCount = Number(data.portion);
  973. try {
  974. if (this.isStandard1OrWeightSample()) {
  975. // 新增校验 数量 取整样 ***
  976. if (this.form.conditionType == 1) {
  977. let isFlag = this.validateSampleQuantity(
  978. sampleCount,
  979. specifications
  980. );
  981. if (!isFlag) return;
  982. }
  983. // ***
  984. //抽检计量整样小样或者抽检计重小样
  985. if (!this.validateMeasureQuantity(measureQ, unit, sampleCount))
  986. return; //取样数量验证
  987. if (unit === 'KG' && !this.validateWeight(measureQ, sampleCount))
  988. return; // 若计量单位为重量,还需验证总重量是否足够
  989. await this.getNewFullSampleList(
  990. Math.ceil(sampleCount),
  991. // sampleCount,
  992. measureQ,
  993. unit,
  994. specifications
  995. );
  996. // 这里是取整样 非数量
  997. } else if (this.isWeightStandardFullSample()) {
  998. console.log('这里是取整样 吗');
  999. //抽检取计重取整样
  1000. if (!this.validateSampleCount(sampleCount, specifications)) return;
  1001. await this.handleWeightFullSample(sampleCount, specifications);
  1002. }
  1003. this.activeName = '2';
  1004. this.$refs.tabsRef.tabsChange('2');
  1005. } catch (error) {
  1006. console.error('取样处理失败:', error);
  1007. this.$message.error('取样处理失败');
  1008. }
  1009. this.calculate(this.sampleList);
  1010. },
  1011. // 当计量类型 是数量的时候 取整样 校验
  1012. validateSampleQuantity(sampleCount, specifications) {
  1013. let packingUnit = this.selectedList[0].packingUnit?.trim() || '';
  1014. let totalS = 0;
  1015. let labelKey =
  1016. packingUnit == specifications.conversionUnit.trim()
  1017. ? 'packingQuantity'
  1018. : 'measureQuantity';
  1019. let labelName = labelKey == 'packingQuantity' ? '包装数量' : '计量数量';
  1020. totalS = this.selectedList.reduce(
  1021. (total, el) => total + el[labelKey],
  1022. 0
  1023. );
  1024. if (sampleCount > totalS) {
  1025. this.$message.info(
  1026. `所填的条目数量不能超过所选${labelName}总和${totalS}`
  1027. );
  1028. return false;
  1029. }
  1030. return true;
  1031. },
  1032. //获取样品编码
  1033. async getSampleCode() {
  1034. return await getCode('sample_code');
  1035. },
  1036. async getNewSampleList(measureQ, unit, nums) {
  1037. this.sampleList = [];
  1038. if (!this.selectedList || this.selectedList.length == 0) {
  1039. this.$message.warning('请先选择来源清单!');
  1040. return;
  1041. }
  1042. this.activeName = '2';
  1043. this.$refs.tabsRef.tabsChange('2');
  1044. if (this.form.isUnpack == 1) {
  1045. // 1 拆包 2 不拆
  1046. let measureQuantity = 1;
  1047. if (this.form.conditionType == 2) {
  1048. measureQuantity = measureQ;
  1049. }
  1050. for (let i = 0; i < this.selectedList.length; i++) {
  1051. if (
  1052. this.selectedList[i].qualitySampleTemplateList == undefined ||
  1053. this.selectedList[i].qualitySampleTemplateList == null ||
  1054. this.selectedList[i].qualitySampleTemplateList.length == 0
  1055. ) {
  1056. this.sampleList.push({
  1057. ...this.selectedList[i],
  1058. sampleCode: await this.getSampleCode(),
  1059. measureQuantity: measureQuantity,
  1060. qualitySampleTemplateList: JSON.parse(
  1061. JSON.stringify(this.schemeList)
  1062. ),
  1063. measureUnit: unit
  1064. });
  1065. } else {
  1066. this.sampleList.push({
  1067. ...this.selectedList[i],
  1068. sampleCode: await this.getSampleCode(),
  1069. measureQuantity: measureQuantity,
  1070. qualitySampleTemplateList: JSON.parse(
  1071. JSON.stringify(this.selectedList[i].qualitySampleTemplateList)
  1072. ),
  1073. measureUnit: unit
  1074. });
  1075. }
  1076. }
  1077. } else if (this.form.isUnpack == 2) {
  1078. if (this.form.conditionType == 1) {
  1079. measureQ = 1;
  1080. }
  1081. // 不拆计算每个重量
  1082. let newWeight = parseFloat(
  1083. (
  1084. this.selectedList[0].weight / this.selectedList[0].measureQuantity
  1085. ).toFixed(4)
  1086. );
  1087. for (let i = 0; i < nums; i++) {
  1088. if (
  1089. this.selectedList[0].qualitySampleTemplateList == undefined ||
  1090. this.selectedList[0].qualitySampleTemplateList == null ||
  1091. this.selectedList[0].qualitySampleTemplateList.length == 0
  1092. ) {
  1093. this.sampleList.push({
  1094. ...this.selectedList[0],
  1095. sampleCode: await this.getSampleCode(),
  1096. measureQuantity: measureQ,
  1097. qualitySampleTemplateList: JSON.parse(
  1098. JSON.stringify(this.schemeList)
  1099. ),
  1100. measureUnit: unit,
  1101. weight: newWeight || 0
  1102. });
  1103. } else {
  1104. this.sampleList.push({
  1105. ...this.selectedList[0],
  1106. sampleCode: await this.getSampleCode(),
  1107. measureQuantity: measureQ,
  1108. qualitySampleTemplateList: JSON.parse(
  1109. JSON.stringify(this.selectedList[0].qualitySampleTemplateList)
  1110. ),
  1111. measureUnit: unit,
  1112. weight: newWeight || 0
  1113. });
  1114. // this.sampleList.push({
  1115. // ...this.selectedList[0],
  1116. // sampleCode: await this.getSampleCode(),
  1117. // measureQuantity: measureQ,
  1118. // measureUnit: unit,
  1119. // weight: newWeight || 0,
  1120. // });
  1121. }
  1122. }
  1123. }
  1124. // this.sampleList = this.selectedList.map(oldItem => {
  1125. // const newItem = JSON.parse(JSON.stringify(oldItem));
  1126. // newItem.measureQuantity = measureQ;
  1127. // newItem.measureUnit = unit;
  1128. // return newItem;
  1129. // });
  1130. this.calculate(this.sampleList);
  1131. this.$refs.tabsRef.tabsChange('2');
  1132. },
  1133. async getQueryQualityInventory() {
  1134. const res = await queryQualityInventory({
  1135. qualityWorkerId: this.dataWork.id,
  1136. size: -1
  1137. });
  1138. if (res.list.length > 0) {
  1139. this.inventoryList = res.list;
  1140. }
  1141. },
  1142. async queryQualitySamplContent() {
  1143. const res = await queryQualitySamplContent({
  1144. qualityWorkerId: this.dataWork.id,
  1145. size: 1000
  1146. });
  1147. let addStatus = res.list.map((item) => {
  1148. item.isValid = true;
  1149. // item.disposeTime = item.disposeTime
  1150. // ? item.disposeTime.split(' ')[0]
  1151. // : null;
  1152. item.sampleDate = item.sampleDate
  1153. ? item.sampleDate.split(' ')[0]
  1154. : null;
  1155. return {
  1156. ...item
  1157. };
  1158. });
  1159. if (addStatus.length > 0) {
  1160. this.sampleList = addStatus;
  1161. // this.calculate(this.sampleList);
  1162. this.addStatus = addStatus;
  1163. } else {
  1164. this.getProSamList(this.packingList);
  1165. }
  1166. },
  1167. async queryQualityTempleContent() {
  1168. const res = await queryQualityTempleContent({
  1169. qualityWorkerId: this.dataWork.id,
  1170. page: 1,
  1171. size: 10000
  1172. });
  1173. this.schemeList = res.list;
  1174. },
  1175. // 取样
  1176. getConditionType(val) {
  1177. this.form.conditionType = val;
  1178. },
  1179. /* 保存编辑 */
  1180. save() {
  1181. // *** 新增判断
  1182. // let flag = this.$refs.baseInfoRefs.quantityCalculation();
  1183. // if (!flag) return;
  1184. // ***
  1185. if (this.form.qualityIdList.length == 0) {
  1186. this.$message.error('请选择质检人');
  1187. return;
  1188. }
  1189. this.$refs.baseInfoRefs.$refs.form1.validate((valid) => {
  1190. if (!valid) {
  1191. return false;
  1192. }
  1193. // this.loading = true;
  1194. let URL =
  1195. this.type == 'add' ? save : this.type == 'edit' ? update : '';
  1196. this.form.qualityTimeStart = this.qualityTimeStart;
  1197. this.form.qualityId = this.form.qualityIdList.join(',');
  1198. delete this.form['qualityTimeEnd'];
  1199. let params = {
  1200. ...this.form,
  1201. sampleList: this.sampleList,
  1202. planTemplateList: this.schemeList,
  1203. templateList: this.schemeList,
  1204. // qualityInventoryList: this.$refs.tabsRef.$refs.sourceTable.getData()
  1205. qualityInventoryList: this.inventoryList
  1206. };
  1207. URL(params)
  1208. .then((msg) => {
  1209. this.loading = false;
  1210. this.$message.success(msg);
  1211. this.visible = false;
  1212. // this.cancel();
  1213. this.$emit('done');
  1214. })
  1215. .catch((e) => {
  1216. this.loading = false;
  1217. });
  1218. });
  1219. },
  1220. update() {
  1221. this.loading = true;
  1222. this.form['status'] = 1;
  1223. update({ ...this.form })
  1224. .then((msg) => {
  1225. this.loading = false;
  1226. this.$message.success(msg);
  1227. this.$emit('done');
  1228. })
  1229. .catch((e) => {
  1230. this.loading = false;
  1231. });
  1232. },
  1233. restForm() {
  1234. this.form = { ...this.defaultForm() };
  1235. this.$nextTick(() => {
  1236. this.$refs.baseInfoRefs.$refs.form1.clearValidate();
  1237. });
  1238. },
  1239. cancel() {
  1240. finishPageTab();
  1241. this.$router.go(-1);
  1242. },
  1243. setSchemeList(list) {
  1244. this.schemeList = list;
  1245. },
  1246. handleDetail(index, row, type) {
  1247. if (!this.sampleList[index] || !this.schemeList) {
  1248. return;
  1249. }
  1250. const selectedData = [];
  1251. selectedData.push(this.sampleList[index]);
  1252. if (this.schemeList.length != 0) {
  1253. this.sampleList.forEach((item) => {
  1254. if (item.qualitySampleTemplateList.length == 0) {
  1255. item.qualitySampleTemplateList.push(...this.schemeList);
  1256. }
  1257. });
  1258. }
  1259. console.log(selectedData, 'selectedData');
  1260. this.$refs.detailRef.openDia(
  1261. index,
  1262. row,
  1263. type,
  1264. selectedData,
  1265. null,
  1266. this.schemeList.toolList
  1267. );
  1268. },
  1269. sampleListChange(sampleList) {
  1270. console.log('777');
  1271. this.$set(this, 'sampleList', sampleList);
  1272. // this.sampleList = sampleList;
  1273. },
  1274. inputWeight(row, index) {
  1275. // 计算所有样本的总重量
  1276. console.log(this.sampleList);
  1277. const pNum = this.sampleList.reduce((sum, item) => {
  1278. return sum + Number(item.weight || 0);
  1279. }, 0);
  1280. this.form.totalWeight = parseFloat(pNum.toFixed(2));
  1281. },
  1282. handleDispose(data) {
  1283. // return
  1284. this.rowData = data;
  1285. this.sampleDisposeVisble = true;
  1286. // if (!this.sampleList[index]) {
  1287. // return;
  1288. // }
  1289. // this.sampleList[index].sampleDate = this.getNowTimes();
  1290. // this.sampleList[index].disposeTime = this.getNowTimes();
  1291. // console.log(index, row, type, this.qualityType);
  1292. // this.$refs.disposeRef.openDispose(index, row, type, this.qualityType);
  1293. },
  1294. // 报工
  1295. handleReporting(index, row) {
  1296. if (this.form.qualityIdList.length == 0) {
  1297. this.$message.error('请选择质检人');
  1298. return;
  1299. }
  1300. if (this.form.qualityMode == 2 && !this.form.qualityResults) {
  1301. this.$refs.baseInfoRefs.toggleExpand2();
  1302. this.$message.error('请选择质检结果');
  1303. return;
  1304. }
  1305. this.$refs.baseInfoRefs.$refs.form1.validate((valid) => {
  1306. if (!valid) return false;
  1307. this.loading = true;
  1308. if (this.qualityType == 2 && this.isReportProcessProduce) {
  1309. for (let i = 0; i < this.sampleList.length; i++) {
  1310. const disposalStatus = this.sampleList[i].disposalStatus;
  1311. if (disposalStatus == null) {
  1312. this.loading = false;
  1313. this.$refs.tabsRef.tabsChange('2');
  1314. this.$message.error('请完成以下样品处置!');
  1315. return;
  1316. }
  1317. }
  1318. }
  1319. for (let i = 0; i < this.sampleList.length; i++) {
  1320. const qualityStatus = this.sampleList[i].qualityStatus;
  1321. if (qualityStatus == '2') {
  1322. this.loading = false;
  1323. this.$refs.tabsRef.tabsChange('2');
  1324. this.$message.error('请完成以下样品质检!');
  1325. return;
  1326. }
  1327. }
  1328. // this.form.qualityTimeEnd = new Date(this.getNowTime());
  1329. // this.form.qualityTimeStart = new Date(this.qualityTimeStart);
  1330. this.form.qualityTimeEnd = this.getNowTime();
  1331. this.form.qualityTimeStart = this.qualityTimeStart;
  1332. this.form.qualityId = this.form.qualityIdList.join(',');
  1333. // if (this.form.qualityMode == 1) {
  1334. // this.form.qualityResults = '';
  1335. // }
  1336. let params = {
  1337. ...this.form,
  1338. sampleList: this.sampleList,
  1339. planTemplateList: this.schemeList,
  1340. // qualityInventoryList: this.$refs.tabsRef.$refs.sourceTable.getData()
  1341. qualityInventoryList: this.inventoryList
  1342. };
  1343. exeReportWork(params)
  1344. .then((msg) => {
  1345. this.loading = false;
  1346. this.$message.success(msg);
  1347. this.visible = false;
  1348. // this.cancel();
  1349. this.$emit('done');
  1350. })
  1351. .catch((e) => {
  1352. this.loading = false;
  1353. });
  1354. });
  1355. },
  1356. // 处理确认事件
  1357. handleDisposeConfirm(data, index) {
  1358. if (index == undefined) {
  1359. this.sampleList.forEach((obj) => {
  1360. obj.disposeType = data.disposeType;
  1361. obj.sampleDate = data.sampleDate;
  1362. obj.sampleCondition = data.sampleCondition;
  1363. obj.producerManufacturer = data.producerManufacturer;
  1364. obj.samplePlace = data.samplePlace;
  1365. obj.sampleRemark = data.sampleRemark;
  1366. obj.depotId = data.depotId;
  1367. obj.depotName = data.depotName;
  1368. });
  1369. } else {
  1370. this.$set(this.sampleList, index, data);
  1371. }
  1372. },
  1373. //确认质检
  1374. handleConfirm(list, index) {
  1375. // 检查有效性
  1376. // for (const item of list) {
  1377. // for (const child of item.qualitySampleTemplateList) {
  1378. //
  1379. // console.log(child, 'child')
  1380. // if (!child.qualityResultContent || !child.qualityResults) {
  1381. // this.$message.error('请完善报工内容!');
  1382. // return;
  1383. // }
  1384. // }
  1385. // }
  1386. list.forEach((item) => {
  1387. if (item.qualitySampleTemplateList.length == 1) {
  1388. if (
  1389. item.qualitySampleTemplateList.some(
  1390. (child) => child.qualityResults === 3
  1391. )
  1392. ) {
  1393. // 如果质检项只有一条而且结果为让步接收那么整个就是让步接收
  1394. item.isValid = false;
  1395. item.qualityResults = 3;
  1396. } else if (
  1397. item.qualitySampleTemplateList.some(
  1398. (child) => child.qualityResults === 2
  1399. )
  1400. ) {
  1401. item.isValid = false;
  1402. item.qualityResults = 2;
  1403. } else {
  1404. item.isValid = true;
  1405. item.qualityResults = 1;
  1406. }
  1407. } else {
  1408. if (
  1409. item.qualitySampleTemplateList.some(
  1410. (child) => child.qualityResults === 2
  1411. )
  1412. ) {
  1413. item.isValid = false;
  1414. item.qualityResults = 2;
  1415. } else {
  1416. item.isValid = true;
  1417. item.qualityResults = 1;
  1418. }
  1419. }
  1420. item.qualityStatus = 1;
  1421. });
  1422. if (index != null) {
  1423. this.$set(this.sampleList, index, list[0]);
  1424. // this.$set(this.sampleList, index, list[0]);
  1425. // if (this.form.qualityMode == 1 && this.form.isUnpack == 2) {
  1426. // this.activeName = '2';
  1427. // this.countQualityResults();
  1428. // return;
  1429. // }
  1430. this.countQualityResults();
  1431. } else {
  1432. this.$set(this, 'sampleList', list);
  1433. // console.log(this.sampleList, 'this.sampleList');
  1434. // return
  1435. // this.sampleList = list;
  1436. this.calculate(this.sampleList);
  1437. console.log(this.sampleList, 'this.sampleList');
  1438. }
  1439. this.activeName = '2';
  1440. // *** 选完批量质检调用
  1441. // this.countQualityResults();
  1442. // this.$refs.baseInfoRefs.quantityCalculation(
  1443. // 'noQualifiedNumber',
  1444. // 'noSetSampleList'
  1445. // );
  1446. console.log('质检没有 2');
  1447. },
  1448. // 批量质检
  1449. batchQuality(index, row, type) {
  1450. // if (this.form.sampleList.qualitySampleTemplateList.length == 0) {
  1451. // this.form.sampleList.forEach((item, index) => {
  1452. // this.$set(
  1453. // this.form.sampleList[index],
  1454. // 'qualitySampleTemplateList',
  1455. // this.form.templateList
  1456. // );
  1457. // });
  1458. // }
  1459. if (this.sampleList.length == 0) {
  1460. this.$message.error('样品清单不能为空');
  1461. return;
  1462. }
  1463. if (this.schemeList.length != 0) {
  1464. this.sampleList.forEach((item, index) => {
  1465. if (item.qualitySampleTemplateList.length == 0) {
  1466. let arr = JSON.parse(JSON.stringify(this.schemeList));
  1467. arr.forEach((el) => {
  1468. el.qualityResults = item.qualityResults;
  1469. });
  1470. this.$set(
  1471. this.sampleList[index],
  1472. 'qualitySampleTemplateList',
  1473. arr
  1474. );
  1475. }
  1476. });
  1477. }
  1478. console.log(this.sampleList, 'dsds');
  1479. this.$refs.detailRef.openDia(
  1480. null,
  1481. null,
  1482. 'report',
  1483. this.sampleList,
  1484. null,
  1485. this.schemeList.toolList
  1486. );
  1487. },
  1488. // 批量处置
  1489. batchDispose() {
  1490. if (this.sampleList && this.sampleList.length) {
  1491. this.sampleDisposeVisble = true;
  1492. return;
  1493. }
  1494. this.$message('当前没有样品清单可以处置');
  1495. // this.$refs.disposeRef.openDispose(
  1496. // null,
  1497. // null,
  1498. // 'dispose',
  1499. // this.qualityType
  1500. // );
  1501. },
  1502. //全检,检验标准改变时,重新获取样品列表
  1503. async changeInspectionStandardsModel(val) {
  1504. const sData = this.$refs.tabsRef.$refs.sourceTable.getData();
  1505. if (sData.length > 0) {
  1506. for (let i = 0; i < sData.length; i++) {
  1507. this.$set(sData[i], 'qualityStatus', 2);
  1508. }
  1509. }
  1510. this.form.inspectionStandards = val;
  1511. this.form.sampleNumber = '';
  1512. this.$refs.tabsRef.tableSelClear();
  1513. this.sampleList = [];
  1514. this.$refs.tabsRef.tabsChange('1');
  1515. //检验标准 2计重 1计量
  1516. if (
  1517. [2, 3, 4, 5].includes(this.form.inspectionStandards) &&
  1518. this.form.qualityMode == 1
  1519. ) {
  1520. for (let i = 0; i < sData.length; i++) {
  1521. let qualitySampleTemplateList = [];
  1522. if (
  1523. sData[i].qualitySampleTemplateList == undefined ||
  1524. sData[i].qualitySampleTemplateList == null ||
  1525. sData[i].qualitySampleTemplateList.length == 0
  1526. ) {
  1527. qualitySampleTemplateList = JSON.parse(
  1528. JSON.stringify(this.schemeList)
  1529. );
  1530. } else {
  1531. qualitySampleTemplateList = sData[i].qualitySampleTemplateList;
  1532. }
  1533. this.sampleList.push({
  1534. ...sData[i],
  1535. sampleCode: await this.getSampleCode(),
  1536. qualitySampleTemplateList
  1537. });
  1538. }
  1539. } else if (
  1540. this.form.inspectionStandards == 1 &&
  1541. this.form.qualityMode == 1
  1542. ) {
  1543. this.getProSamList(sData);
  1544. }
  1545. this.calculate(this.sampleList);
  1546. },
  1547. //从来源数组取样到目标数组
  1548. async getNewFullSampleList(
  1549. sampleCount,
  1550. sampleQuantity,
  1551. sampleUnit,
  1552. specifications
  1553. ) {
  1554. const sourceArray = this.selectedList;
  1555. // 检查单位是否匹配
  1556. const isUnitMismatch =
  1557. sourceArray.length > 0 && sourceArray[0].measureUnit !== sampleUnit;
  1558. // 创建副本并计算初始可取样数量
  1559. const items = sourceArray.map((item) => ({
  1560. ...item,
  1561. remainingQuantity: isUnitMismatch
  1562. ? Infinity
  1563. : item['measureQuantity'], // 剩余可取样数量
  1564. maxPossible: item['measureQuantity'] / sampleQuantity // 最大取样次数
  1565. }));
  1566. const result = [];
  1567. let remainingCount = sampleCount;
  1568. let count = Math.ceil(remainingCount);
  1569. const codeList = await this.batchCodes(count);
  1570. let codeIdx = 0;
  1571. // 尽可能均匀地从各条目取样
  1572. while (remainingCount > 0) {
  1573. // 按剩余可取样比例排序
  1574. items.sort(
  1575. (a, b) =>
  1576. b.remainingQuantity / b['measureQuantity'] -
  1577. a.remainingQuantity / a['measureQuantity']
  1578. );
  1579. let distributed = false;
  1580. for (const item of items) {
  1581. // let values = remainingCount > 1 ? 1 : remainingCount;
  1582. if (
  1583. !isUnitMismatch ||
  1584. (item.remainingQuantity >= sampleQuantity && remainingCount > 0)
  1585. ) {
  1586. let qualitySampleTemplateList = [];
  1587. if (
  1588. item.qualitySampleTemplateList == undefined ||
  1589. item.qualitySampleTemplateList == null ||
  1590. item.qualitySampleTemplateList.length == 0
  1591. ) {
  1592. qualitySampleTemplateList = JSON.parse(
  1593. JSON.stringify(this.schemeList)
  1594. );
  1595. } else {
  1596. qualitySampleTemplateList = item.qualitySampleTemplateList;
  1597. }
  1598. // 添加到结果数组
  1599. // let sampleCode = await this.getSampleCode();
  1600. let sampleCode = codeList[codeIdx];
  1601. if (
  1602. this.form.conditionType == 1 &&
  1603. this.form.inspectionStandards == 1
  1604. ) {
  1605. result.push({
  1606. ...item,
  1607. // measureQuantity: values,
  1608. measureQuantity: 1,
  1609. sampleCode,
  1610. qualitySampleTemplateList
  1611. });
  1612. } else if (this.form.conditionType == 2) {
  1613. let weight = (item.weight / item.maxPossible).toFixed(2);
  1614. result.push({
  1615. ...item,
  1616. measureQuantity: sampleQuantity,
  1617. measureUnit: sampleUnit,
  1618. sampleCode,
  1619. weight,
  1620. qualitySampleTemplateList
  1621. });
  1622. }
  1623. // 更新剩余数量
  1624. if (!isUnitMismatch) {
  1625. item.remainingQuantity -= sampleQuantity;
  1626. }
  1627. remainingCount = (remainingCount - 1).toFixed(2);
  1628. codeIdx++;
  1629. distributed = true;
  1630. }
  1631. }
  1632. // 如果没有分配任何取样
  1633. if (!distributed) {
  1634. break;
  1635. }
  1636. }
  1637. // 判断是不是取整样
  1638. if (
  1639. this.form.conditionType == 1 &&
  1640. specifications &&
  1641. specifications.id
  1642. ) {
  1643. result.map((el) => {
  1644. el.measureQuantity =
  1645. el.measureQuantity * specifications.packageCellTotal;
  1646. el.weight = this.formatNumber(
  1647. el.measureQuantity,
  1648. el.weightProportion
  1649. );
  1650. });
  1651. }
  1652. this.sampleList = result;
  1653. if (this.sampleList.length > sampleCount) {
  1654. this.sampleList = this.sampleList.splice(0, sampleCount);
  1655. }
  1656. this.form.sampleNumber = this.sampleList.length;
  1657. this.calculate(this.sampleList);
  1658. },
  1659. // 小数点数据判断
  1660. formatNumber(a, b, maxDecimals = 4) {
  1661. if (a == 0 || b == 0 || !a || !b) {
  1662. return 0;
  1663. }
  1664. // 计算乘积
  1665. const product = a * b;
  1666. // 转换为固定小数位数,然后转换为数字以去除末尾零
  1667. const rounded = Number(product.toFixed(maxDecimals));
  1668. // 转换为字符串检查是否需要显示小数部分
  1669. const str = rounded.toString();
  1670. // 如果包含小数点
  1671. if (str.indexOf('.') !== -1) {
  1672. // 移除末尾的零和小数点(如果后面没有数字了)
  1673. return str.replace(/\.?0+$/, '');
  1674. }
  1675. return str;
  1676. },
  1677. validateWeight(measureQ, sampleCount) {
  1678. let totalMaxPossible = 0;
  1679. this.selectedList.forEach((item) => {
  1680. totalMaxPossible += item.measureQuantity / measureQ;
  1681. });
  1682. if (totalMaxPossible < sampleCount) {
  1683. // this.formData.portion = totalMaxPossible;
  1684. this.$message.info(`最大取样条数为${totalMaxPossible}`);
  1685. return false;
  1686. }
  1687. let totalWeight = this.selectedList.reduce(
  1688. (sum, item) => sum + item.weight,
  1689. 0
  1690. );
  1691. const weightUnit = this.selectedList[0].weightUnit;
  1692. if (weightUnit === 'G') totalWeight /= 1000;
  1693. if (measureQ * sampleCount > totalWeight) {
  1694. this.$message.info('取样计量重量不能大于总计量重量');
  1695. return false;
  1696. }
  1697. const invalidItem = this.selectedList.find((item) => {
  1698. const weight =
  1699. item.weightUnit === 'G' ? item.weight / 1000 : item.weight;
  1700. return weight < measureQ;
  1701. });
  1702. if (invalidItem) {
  1703. this.$message.info('勾选条目重量小于取样重量');
  1704. return false;
  1705. }
  1706. return true;
  1707. },
  1708. isStandard1OrWeightSample() {
  1709. return (
  1710. this.form.inspectionStandards === 1 ||
  1711. ([2, 3, 4, 5].includes(this.form.inspectionStandards) &&
  1712. this.form.conditionType == 2)
  1713. );
  1714. },
  1715. validateMeasureQuantity(measureQ, unit, sampleCount) {
  1716. if (this.form.conditionType == 2 && measureQ <= 0) {
  1717. this.$message.info('取样计量数量必须大于0');
  1718. return false;
  1719. }
  1720. const totalQuantity = this.selectedList.reduce(
  1721. (sum, item) => sum + item.measureQuantity,
  1722. 0
  1723. );
  1724. if (
  1725. (this.selectedList[0].measureUnit === unit ||
  1726. this.form.conditionType == 1) &&
  1727. measureQ * sampleCount > totalQuantity
  1728. ) {
  1729. this.$message.info('取样计量数量不能大于总计量数量');
  1730. return false;
  1731. }
  1732. const invalidItem = this.selectedList.find(
  1733. (item) => item.measureQuantity < measureQ
  1734. );
  1735. if (invalidItem) {
  1736. this.$message.info('条目计量数量小于取样计量数量');
  1737. return false;
  1738. }
  1739. return true;
  1740. },
  1741. isWeightStandardFullSample() {
  1742. return (
  1743. [2, 3, 4, 5].includes(this.form.inspectionStandards) &&
  1744. this.form.conditionType == 1
  1745. );
  1746. },
  1747. // 抽检取整样 校验
  1748. validateSampleCount(sampleCount, specifications) {
  1749. // 新增校验 ***
  1750. let isFlag = this.validateSampleQuantity(sampleCount, specifications);
  1751. if (!isFlag) {
  1752. return false;
  1753. }
  1754. // ***
  1755. const chooseNumber = this.selectedList.reduce((acc, pro) => {
  1756. return pro.measureQuantity ? acc + Number(pro.measureQuantity) : acc;
  1757. }, 0);
  1758. const invalidItem = chooseNumber < sampleCount;
  1759. // console.log(this.selectedList, 'this.selectedList');
  1760. // const invalidItem = this.selectedList.find(
  1761. // (item) => item.measureQuantity < sampleCount
  1762. // );
  1763. if (invalidItem) {
  1764. this.$message.info('所选的条目计量数量小于取样计量数量');
  1765. return false;
  1766. }
  1767. // ***
  1768. return true;
  1769. },
  1770. async handleWeightFullSample(sampleCount, specifications) {
  1771. const dataList = [];
  1772. let currentNum = sampleCount - this.selectedList.length;
  1773. let currentNum1 = sampleCount;
  1774. for (const item of this.selectedList) {
  1775. const qualitySampleTemplateList = item.qualitySampleTemplateList
  1776. ?.length
  1777. ? JSON.parse(JSON.stringify(item.qualitySampleTemplateList))
  1778. : JSON.parse(
  1779. JSON.stringify(
  1780. this.schemeList.map((item) => {
  1781. item['qualityResults'] = 1;
  1782. return item;
  1783. })
  1784. )
  1785. );
  1786. if (sampleCount >= this.selectedList.length) {
  1787. dataList.push({
  1788. ...item,
  1789. measureQuantity: 1, //作为计量数量
  1790. sampleCode: await this.getSampleCode(),
  1791. qualitySampleTemplateList
  1792. });
  1793. } else {
  1794. if (dataList.length < sampleCount) {
  1795. dataList.push({
  1796. ...item,
  1797. measureQuantity: currentNum1 > 1 ? 1 : currentNum1, //作为计量数量
  1798. sampleCode: await this.getSampleCode(),
  1799. qualitySampleTemplateList
  1800. });
  1801. currentNum1 -= 1;
  1802. }
  1803. }
  1804. }
  1805. if (sampleCount > this.selectedList.length) {
  1806. dataList.forEach((item) => {
  1807. if (currentNum > 0) {
  1808. let data = this.selectedList.find((val) => val.id == item.id);
  1809. item['measureQuantity'] =
  1810. data.measureQuantity - 1 - currentNum > 0
  1811. ? currentNum + 1
  1812. : data.measureQuantity;
  1813. currentNum = currentNum - (data.measureQuantity - 1);
  1814. }
  1815. });
  1816. }
  1817. // 更改 从新计算 样品清单 取整样 数据
  1818. if (specifications && specifications.id) {
  1819. // let proportion = (obj.weight / obj.measureQuantity).toFixed(2);
  1820. dataList.map((el) => {
  1821. el.measureQuantity =
  1822. el.measureQuantity * specifications.packageCellTotal;
  1823. el.weight = this.formatNumber(
  1824. el.measureQuantity,
  1825. el.weightProportion
  1826. );
  1827. });
  1828. }
  1829. // 更改
  1830. this.sampleList = dataList;
  1831. this.calculate(this.sampleList);
  1832. this.sampleNumber = this.sampleList.length;
  1833. },
  1834. // 批量生成编码 4444444 getCodeList
  1835. async batchCodes(count) {
  1836. if (count <= 0) return;
  1837. let params = { count };
  1838. const res = await getCodeList('sample_code', params);
  1839. return res;
  1840. },
  1841. //计算合格率
  1842. countQualityResults() {
  1843. console.log(321);
  1844. let sampleList = this.sampleList; //样品清单
  1845. let sampleNumber = this.form.total; //样品总数
  1846. // let qualifiedNumber = sampleList.filter(item => item.qualityResults == 1 || item.qualityResults == 3).length;
  1847. // let noQualifiedNumber = sampleList.filter(
  1848. // (item) => item.qualityResults == 2
  1849. // ).length;
  1850. let noQualifiedNumber = sampleList.reduce((acc, pro) => {
  1851. // console.log(acc, pro);
  1852. // if (pro.qualityResults == 2) {
  1853. // return acc + Number(pro.measureQuantity);
  1854. // }
  1855. return pro.qualityResults == 2
  1856. ? acc + Number(pro.measureQuantity)
  1857. : acc;
  1858. }, 0);
  1859. let qualifiedNumber = sampleNumber - noQualifiedNumber; //不合格数
  1860. let qualificationRate = (
  1861. (qualifiedNumber / sampleNumber) *
  1862. 100
  1863. ).toFixed(2); //合格率
  1864. let noQualificationRate = (
  1865. (noQualifiedNumber / sampleNumber) *
  1866. 100
  1867. ).toFixed(2); //不合格率
  1868. this.$refs.baseInfoRefs.updateQualificationRate(
  1869. qualifiedNumber,
  1870. noQualifiedNumber,
  1871. qualificationRate,
  1872. noQualificationRate
  1873. );
  1874. this.calculate(this.sampleList);
  1875. },
  1876. closeDispose() {
  1877. this.rowData = null;
  1878. this.sampleDisposeVisble = false;
  1879. // this.rowData = null;
  1880. },
  1881. handleClose() {
  1882. this.visible = false;
  1883. this.$emit('done');
  1884. }
  1885. }
  1886. };
  1887. </script>
  1888. <style lang="scss" scoped></style>