edit.vue 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never">
  4. <header-title title="基本信息">
  5. <el-button @click="cancel">返回</el-button>
  6. <el-button
  7. type="primary"
  8. @click="save"
  9. :loading="loading"
  10. v-if="type != 'detail'"
  11. >保存</el-button
  12. >
  13. <el-button
  14. type="primary"
  15. @click="handleReporting"
  16. :loading="loading"
  17. v-if="type != 'detail'"
  18. >报工完成</el-button
  19. >
  20. </header-title>
  21. <base-info
  22. ref="baseInfoRefs"
  23. v-if="form"
  24. :form="form"
  25. :btnType="type"
  26. :qualityType1="qualityType"
  27. @changeModel="changeModel"
  28. @changeNumber="changeNumber"
  29. @changeInspectionStandardsModel="changeInspectionStandardsModel"
  30. ></base-info>
  31. <quality-content-tabs
  32. ref="tabsRef"
  33. :type="type"
  34. :ids="this.$route.query.id"
  35. :sample-list="sampleList"
  36. :activeName="activeName"
  37. :scheme-list="schemeList"
  38. :loading="loading"
  39. :form="form"
  40. :status="statusType"
  41. @handleSelectionChange="handleSelectionChange1"
  42. @batch-quality="batchQuality"
  43. @batch-dispose="batchDispose"
  44. @handleDetail="handleDetail"
  45. @inputWeight="inputWeight"
  46. @handleDispose="handleDispose"
  47. @changeSamUnit="changeSamUnit"
  48. @handleSample1="handleSample1"
  49. @handleSampleSubmit="handleSampleSubmit"
  50. @getConditionType="getConditionType"
  51. @countQualityResults="countQualityResults"
  52. />
  53. </el-card>
  54. <sampleListDialog
  55. ref="detailRef"
  56. @handleConfirm="handleConfirm"
  57. @handleDispose="handleDispose"
  58. ></sampleListDialog>
  59. <sampleDisposeDialog
  60. v-if="sampleDisposeVisble"
  61. :sampleDisposeVisble.sync="sampleDisposeVisble"
  62. ref="disposeRef"
  63. @handleDisposeConfirm="handleDisposeConfirm"
  64. :rowData="rowData"
  65. @close="closeDispose"
  66. @handleDispose="handleDispose"
  67. ></sampleDisposeDialog>
  68. </div>
  69. </template>
  70. <script>
  71. import baseInfo from './components/baseInfo.vue';
  72. // import QualityContentTabs from './components/QualityContentTabs.vue';
  73. import QualityContentTabs from './components/newQualityContentTabs.vue';
  74. import { getCode } from '@/api/login';
  75. import {
  76. save,
  77. update,
  78. getById,
  79. exeReportWork,
  80. queryQualitySamplContent,
  81. queryQualityTempleContent,
  82. queryQualityInventory
  83. } from '@/api/inspectionWork';
  84. import dictMixins from '@/mixins/dictMixins';
  85. // import term from './term';
  86. import sampleListDialog from './components/sampleListDialog.vue';
  87. import sampleDisposeDialog from './components/sampleDisposeDialog.vue';
  88. import { finishPageTab } from '@/utils/page-tab-util';
  89. export default {
  90. components: {
  91. baseInfo,
  92. QualityContentTabs,
  93. sampleListDialog,
  94. sampleDisposeDialog
  95. },
  96. mixins: [dictMixins],
  97. data() {
  98. const defaultForm = function () {
  99. return {
  100. code: '',
  101. qualityType: null,
  102. qualityModeproduceRoutingId: '',
  103. produceRoutingName: '',
  104. produceTaskId: '',
  105. produceTaskName: '',
  106. productName: '',
  107. productCode: '',
  108. batchNo: '',
  109. specification: '',
  110. modelType: '',
  111. brandNo: '',
  112. total: '',
  113. qualifiedNumber: '',
  114. noQualifiedNumber: '',
  115. groupId: '',
  116. groupName: '',
  117. qualityId: '',
  118. qualityName: '',
  119. qualityTime: '',
  120. hours: '',
  121. qualificationRate: '',
  122. noQualificationRate: '',
  123. totalWeight: '',
  124. sampleNumber: '',
  125. imgUrl: [],
  126. qualityTimeStart: '',
  127. qualityTimeEnd: '',
  128. sampleMeasureUnit: '',
  129. conditionType: null
  130. };
  131. };
  132. return {
  133. rowData: null,
  134. defaultForm,
  135. sampleDisposeVisble: false,
  136. // 表单数据
  137. form: { ...defaultForm() },
  138. voList: [],
  139. // 表单验证规则
  140. categoryParamList: [],
  141. type: '',
  142. title: '',
  143. loading: false,
  144. tabTaskId: null,
  145. // activeName: '2',
  146. packingList: [],
  147. // 样品清单,处置,批量处置,批量质检,质检的操作
  148. sampleList: [],
  149. schemeList: [],
  150. inventoryList: [],
  151. activeName: '1',
  152. isValid: true,
  153. isStatus: true,
  154. SampleListbyReportList: [],
  155. qualityTimeStart: '',
  156. isReportProcessProduce: false,
  157. addStatus: [],
  158. statusType: false
  159. };
  160. },
  161. watch: {
  162. '$route.query.id': {
  163. handler(id) {
  164. if (id) {
  165. this.getDetail();
  166. } else {
  167. this.form = { ...defaultForm() };
  168. }
  169. }
  170. }
  171. },
  172. created() {
  173. this.open();
  174. if (this.$route.query.id) {
  175. this.getDetail();
  176. }
  177. },
  178. methods: {
  179. //切换检验方式
  180. changeModel(val, flag) {
  181. console.log('切换检验方式');
  182. this.$refs.tabsRef.tableSelClear();
  183. this.sampleList = [];
  184. this.$refs.tabsRef.tabsChange('1');
  185. this.$refs.tabsRef.tabsConditionType(null);
  186. this.form.qualityMode = val;
  187. //检验方式 全检
  188. if (this.form.qualityMode == 1) {
  189. this.activeName = '2';
  190. this.form.sampleNumber = '';
  191. const sData = this.$refs.tabsRef.$refs.sourceTable.getData();
  192. if (sData.length == 0) {
  193. for (let i = 0; i < sData.length; i++) {
  194. this.$set(sData[i], 'qualityStatus', 2);
  195. }
  196. }
  197. console.log(
  198. this.$refs.tabsRef.$refs.sourceTable.getData(),
  199. 'packingList'
  200. );
  201. this.getProSamList(sData);
  202. } else {
  203. this.activeName = '1';
  204. if (!flag) {
  205. this.sampleList = [];
  206. }
  207. }
  208. },
  209. //根据类型判断样品清单现实列表数据
  210. async getProSamList(list) {
  211. //生产检验
  212. if (this.qualityType == 2) {
  213. if (this.form.qualityMode != null) {
  214. const ProductSampleList = [];
  215. console.log(list, 'list');
  216. for (const oldItem of list) {
  217. const count = oldItem.measureQuantity;
  218. const newMeasureQuantity = oldItem.measureQuantity / count;
  219. const newWeight = parseFloat((oldItem.weight / count).toFixed(2));
  220. console.log(typeof oldItem.qualitySampleTemplateList, 'ssssss');
  221. // 遍历新数组设置 qualityResults 默认值
  222. this.schemeList.forEach((item) => {
  223. if (typeof item === 'object' && item !== null) {
  224. item.qualityResults = 1; // 设置默认值
  225. }
  226. delete item.id;
  227. });
  228. console.log(oldItem, 'oldItem');
  229. console.log(count, newMeasureQuantity, newWeight);
  230. delete oldItem.id;
  231. if (
  232. oldItem.qualitySampleTemplateList == undefined ||
  233. oldItem.qualitySampleTemplateList == null ||
  234. oldItem.qualitySampleTemplateList.length == 0
  235. ) {
  236. oldItem.qualitySampleTemplateList = JSON.parse(
  237. JSON.stringify(this.schemeList)
  238. );
  239. for (let i = 0; i < count; i++) {
  240. ProductSampleList.push({
  241. ...oldItem,
  242. measureQuantity: newMeasureQuantity,
  243. weight: newWeight,
  244. sampleCode: await this.getSampleCode(),
  245. qualitySampleTemplateList: JSON.parse(
  246. JSON.stringify(this.schemeList)
  247. )
  248. });
  249. }
  250. console.log(ProductSampleList, 'ProductSampleList');
  251. this.sampleList = ProductSampleList;
  252. const pNum = ProductSampleList.reduce((sum, item) => {
  253. return sum + Number(item.weight || 0);
  254. }, 0);
  255. this.form.totalWeight = parseFloat(pNum.toFixed(2));
  256. } else {
  257. for (let i = 0; i < count; i++) {
  258. ProductSampleList.push({
  259. ...oldItem,
  260. measureQuantity: newMeasureQuantity,
  261. weight: newWeight,
  262. sampleCode: await this.getSampleCode(),
  263. qualitySampleTemplateList: JSON.parse(
  264. JSON.stringify(oldItem.qualitySampleTemplateList)
  265. )
  266. });
  267. }
  268. console.log(ProductSampleList, 'ProductSampleList');
  269. this.sampleList = ProductSampleList;
  270. const pNum = ProductSampleList.reduce((sum, item) => {
  271. return sum + Number(item.weight || 0);
  272. }, 0);
  273. this.form.totalWeight = parseFloat(pNum.toFixed(2));
  274. }
  275. }
  276. }
  277. } else {
  278. // this.sampleList = list;
  279. this.sampleList = this.addStatus;
  280. }
  281. },
  282. //输入取样数量
  283. changeNumber(val) {
  284. if (this.form.qualityMode !== 2) {
  285. return;
  286. }
  287. if (val <= 0) {
  288. this.$refs.showPackingListTable.clearSelection();
  289. return;
  290. }
  291. if (this.qualityType == 2) {
  292. //生产检验的抽检逻辑
  293. if (val > this.packingList[0].measureQuantity) {
  294. this.$message.warning('取样数量不能大于来源清单的计量数量!');
  295. return;
  296. }
  297. const ProductSampleList = [];
  298. this.packingList.forEach((oldItem) => {
  299. const count = oldItem.measureQuantity;
  300. const newMeasureQuantity = oldItem.measureQuantity / count;
  301. const newWeight = parseFloat((oldItem.weight / count).toFixed(2));
  302. console.log(count, newMeasureQuantity, newWeight);
  303. delete oldItem.id;
  304. // 遍历新数组设置 qualityResults 默认值
  305. this.schemeList.forEach((item) => {
  306. if (typeof item === 'object' && item !== null) {
  307. item.qualityResults = 1; // 设置默认值
  308. }
  309. delete item.id;
  310. });
  311. for (let i = 0; i < val; i++) {
  312. ProductSampleList.push({
  313. ...oldItem,
  314. measureQuantity: newMeasureQuantity,
  315. weight: newWeight,
  316. qualitySampleTemplateList: JSON.parse(
  317. JSON.stringify(this.schemeList)
  318. )
  319. });
  320. }
  321. });
  322. this.sampleList = ProductSampleList;
  323. const pNum = ProductSampleList.reduce((sum, item) => {
  324. return sum + Number(item.weight || 0);
  325. }, 0);
  326. this.form.totalWeight = parseFloat(pNum.toFixed(2));
  327. } else {
  328. if (val > this.packingList.length) {
  329. this.$message.warning('取样数量不能大于物料明细总数!');
  330. return;
  331. }
  332. const rows = this.packingList.slice(0, val);
  333. rows.forEach((row) => {
  334. this.$refs.showPackingListTable.toggleRowSelection(row);
  335. });
  336. }
  337. },
  338. getNowDate() {
  339. let date = new Date(),
  340. obj = {
  341. year: date.getFullYear(), //获取当前月份(0-11,0代表1月)
  342. month: date.getMonth() + 1, //获取当前月份(0-11,0代表1月)
  343. strDate: date.getDate(), // 获取当前日(1-31)
  344. hour: date.getHours(), //获取当前小时(0 ~ 23)
  345. minute: date.getMinutes(), //获取当前分钟(0 ~ 59)
  346. second: date.getSeconds() //获取当前秒数(0 ~ 59)
  347. };
  348. Object.keys(obj).forEach((key) => {
  349. if (obj[key] < 10) obj[key] = `0${obj[key]}`;
  350. });
  351. return obj;
  352. },
  353. //来源清单勾选事件
  354. handleSelectionChange1(selection) {
  355. if (this.form.qualityMode === 2) {
  356. this.selectedList = selection;
  357. this.activeName = '1';
  358. if (this.schemeList.length == 0) {
  359. for (let i = 0; i < selection.length; i++) {
  360. this.$set(selection[i], 'qualityStatus', 2);
  361. // 遍历新数组设置 qualityResults 默认值
  362. this.schemeList.forEach((item) => {
  363. if (typeof item === 'object' && item !== null) {
  364. item.qualityResults = 1; // 设置默认值
  365. }
  366. delete item.id;
  367. });
  368. this.$set(
  369. selection[i],
  370. 'qualitySampleTemplateList',
  371. JSON.parse(JSON.stringify(this.schemeList))
  372. );
  373. }
  374. }
  375. // this.sampleList = selection;
  376. //赋值取样数量
  377. this.form.sampleNumber = selection.length;
  378. }
  379. },
  380. async open() {
  381. this.type = this.$route.query.type;
  382. this.qualityType = this.$route.query.qualityType;
  383. this.title =
  384. this.type == 'add' ? '新增' : this.type == 'edit' ? '报工' : '详情';
  385. if (this.type == 'add') {
  386. const code = await getCode('quality_work_order_code');
  387. this.form.code = code;
  388. } else {
  389. if (
  390. this.$route.query.qualityTimeStart != '' ||
  391. this.$route.query.qualityTimeStart != null ||
  392. this.$route.query.qualityTimeStart != undefined
  393. ) {
  394. this.qualityTimeStart = this.getNowTime();
  395. }
  396. }
  397. },
  398. getNowTime() {
  399. const nowDate = this.getNowDate();
  400. return (
  401. nowDate.year +
  402. '-' +
  403. nowDate.month +
  404. '-' +
  405. nowDate.strDate +
  406. ' ' +
  407. nowDate.hour +
  408. ':' +
  409. nowDate.minute +
  410. ':' +
  411. nowDate.second
  412. );
  413. },
  414. getNowTimes() {
  415. const nowDate = this.getNowDate();
  416. return nowDate.year + '-' + nowDate.month + '-' + nowDate.strDate;
  417. },
  418. async getDetail() {
  419. getById(this.$route.query.id).then((res) => {
  420. this.form = res.data;
  421. this.statusType = this.form.status == 1 ? true : false;
  422. this.isReportProcessProduce =
  423. this.form.isReportProcessProduce == 1 ? true : false;
  424. this.tabTaskId =
  425. this.categoryParamList[0] && this.categoryParamList[0].id;
  426. if (this.form.groupId) {
  427. this.$nextTick(() => {
  428. this.$refs.baseInfoRefs?.getUserList({
  429. groupId: this.form.groupId
  430. });
  431. });
  432. }
  433. if (this.form.produceRoutingId) {
  434. this.$nextTick(() => {
  435. this.$refs.baseInfoRefs?.getTaskList();
  436. });
  437. }
  438. });
  439. // await this.queryQualityInventory()
  440. // 质检方案
  441. await this.queryQualityTempleContent();
  442. await this.queryQualitySamplContent();
  443. // 来源清单
  444. await this.getQueryQualityInventory();
  445. },
  446. // getNewData(val) {
  447. // console.log(val, '清单列表')
  448. // this.packingList = val
  449. // },
  450. // async queryQualityInventory() {
  451. // let res = await queryQualityInventory({ qualityWorkerId: this.$route.query.id });
  452. // console.log(res, '清单列表');
  453. // this.packingList = res;
  454. // },
  455. changeSamUnit(val) {
  456. this.$set(this.form, 'sampleMeasureUnit', val);
  457. },
  458. async handleSample1(val, data) {
  459. this.sampleList = [];
  460. if (this.selectedList == undefined || this.selectedList.length == 0) {
  461. this.activeName = '1';
  462. this.$message.warning('请先选择样品!');
  463. return;
  464. }
  465. if (val == 1) {
  466. this.activeName = '2';
  467. if (this.form.isUnpack == 1) {
  468. for (let i = 0; i < this.selectedList.length; i++) {
  469. for (let j = 0; j < this.selectedList[i].measureQuantity; j++) {
  470. // 不拆计算每个重量
  471. let newWeight = parseFloat(
  472. (
  473. this.selectedList[i].weight /
  474. this.selectedList[i].measureQuantity
  475. ).toFixed(4)
  476. );
  477. if (
  478. this.selectedList[i].qualitySampleTemplateList == undefined ||
  479. this.selectedList[i].qualitySampleTemplateList == null ||
  480. this.selectedList[i].qualitySampleTemplateList.length == 0
  481. ) {
  482. this.sampleList.push({
  483. ...this.selectedList[i],
  484. sampleCode: await this.getSampleCode(),
  485. measureQuantity: 1,
  486. qualitySampleTemplateList: JSON.parse(
  487. JSON.stringify(this.schemeList)
  488. ),
  489. weight: newWeight || 0
  490. });
  491. } else {
  492. this.sampleList.push({
  493. ...this.selectedList[i],
  494. sampleCode: await this.getSampleCode(),
  495. measureQuantity: 1,
  496. qualitySampleTemplateList: JSON.parse(
  497. JSON.stringify(
  498. this.selectedList[i].qualitySampleTemplateList
  499. )
  500. ),
  501. weight: newWeight || 0
  502. });
  503. }
  504. }
  505. }
  506. } else if (this.form.isUnpack == 2) {
  507. // 不拆计算每个重量
  508. let newWeight = parseFloat(
  509. (
  510. this.selectedList[0].weight /
  511. this.selectedList[0].measureQuantity
  512. ).toFixed(4)
  513. );
  514. for (let i = 0; i < this.selectedList[0].measureQuantity; i++) {
  515. if (
  516. this.selectedList[0].qualitySampleTemplateList == undefined ||
  517. this.selectedList[0].qualitySampleTemplateList == null ||
  518. this.selectedList[0].qualitySampleTemplateList.length == 0
  519. ) {
  520. this.sampleList.push({
  521. ...this.selectedList[0],
  522. sampleCode: await this.getSampleCode(),
  523. measureQuantity: 1,
  524. qualitySampleTemplateList: JSON.parse(
  525. JSON.stringify(this.schemeList)
  526. ),
  527. weight: newWeight || 0
  528. });
  529. } else {
  530. this.sampleList.push({
  531. ...this.selectedList[0],
  532. sampleCode: await this.getSampleCode(),
  533. measureQuantity: 1,
  534. qualitySampleTemplateList: JSON.parse(
  535. JSON.stringify(
  536. this.selectedList[0].qualitySampleTemplateList
  537. )
  538. ),
  539. weight: newWeight || 0
  540. });
  541. }
  542. }
  543. }
  544. //取整样=勾选数据
  545. // this.sampleList = this.selectedList;
  546. this.$message.success('取样成功!');
  547. } else if (val == 2) {
  548. console.log(data, 'datadatadatadataxiaoyang');
  549. }
  550. },
  551. async handleSampleSubmit(data) {
  552. console.log(data, 'data123确认');
  553. this.sampleList = [];
  554. if (!this.selectedList || this.selectedList.length == 0) {
  555. this.$message.warning('请先选择样品!');
  556. return;
  557. }
  558. const measureQ = data.measureQ || 1;
  559. const unit = data.sampleUnit;
  560. const sampleCount = Number(data.portion);
  561. console.log(measureQ, '计量数量');
  562. console.log(unit, '所选单位');
  563. console.log(sampleCount, '数量');
  564. try {
  565. if (this.isStandard1OrWeightSample()) {
  566. //抽检计量整样小样或者抽检计重小样
  567. if (!this.validateMeasureQuantity(measureQ, unit, sampleCount))
  568. return; //取样数量验证
  569. if (unit === 'KG' && !this.validateWeight(measureQ, sampleCount))
  570. return; // 若计量单位为重量,还需验证总重量是否足够
  571. console.log(1111111111111);
  572. await this.getNewFullSampleList(
  573. Math.ceil(sampleCount),
  574. measureQ,
  575. unit
  576. );
  577. } else if (this.isWeightStandardFullSample()) {
  578. //抽检取计重取整样
  579. if (!this.validateSampleCount(sampleCount)) return;
  580. console.log(222222222222222222);
  581. await this.handleWeightFullSample(sampleCount);
  582. }
  583. this.activeName = '2';
  584. this.$refs.tabsRef.tabsChange('2');
  585. } catch (error) {
  586. console.error('取样处理失败:', error);
  587. this.$message.error('取样处理失败');
  588. }
  589. },
  590. //获取样品编码
  591. async getSampleCode() {
  592. return await getCode('sample_code');
  593. },
  594. async getNewSampleList(measureQ, unit, nums) {
  595. this.sampleList = [];
  596. console.log(this.selectedList, 'this.selectedList');
  597. if (!this.selectedList || this.selectedList.length == 0) {
  598. this.$message.warning('请先选择来源清单!');
  599. return;
  600. }
  601. this.activeName = '2';
  602. this.$refs.tabsRef.tabsChange('2');
  603. if (this.form.isUnpack == 1) {
  604. // 1 拆包 2 不拆
  605. let measureQuantity = 1;
  606. if (this.form.conditionType == 2) {
  607. measureQuantity = measureQ;
  608. }
  609. for (let i = 0; i < this.selectedList.length; i++) {
  610. if (
  611. this.selectedList[i].qualitySampleTemplateList == undefined ||
  612. this.selectedList[i].qualitySampleTemplateList == null ||
  613. this.selectedList[i].qualitySampleTemplateList.length == 0
  614. ) {
  615. this.sampleList.push({
  616. ...this.selectedList[i],
  617. sampleCode: await this.getSampleCode(),
  618. measureQuantity: measureQuantity,
  619. qualitySampleTemplateList: JSON.parse(
  620. JSON.stringify(this.schemeList)
  621. ),
  622. measureUnit: unit
  623. });
  624. } else {
  625. this.sampleList.push({
  626. ...this.selectedList[i],
  627. sampleCode: await this.getSampleCode(),
  628. measureQuantity: measureQuantity,
  629. qualitySampleTemplateList: JSON.parse(
  630. JSON.stringify(this.selectedList[i].qualitySampleTemplateList)
  631. ),
  632. measureUnit: unit
  633. });
  634. }
  635. }
  636. } else if (this.form.isUnpack == 2) {
  637. if (this.form.conditionType == 1) {
  638. measureQ = 1;
  639. }
  640. // 不拆计算每个重量
  641. let newWeight = parseFloat(
  642. (
  643. this.selectedList[0].weight / this.selectedList[0].measureQuantity
  644. ).toFixed(4)
  645. );
  646. for (let i = 0; i < nums; i++) {
  647. if (
  648. this.selectedList[0].qualitySampleTemplateList == undefined ||
  649. this.selectedList[0].qualitySampleTemplateList == null ||
  650. this.selectedList[0].qualitySampleTemplateList.length == 0
  651. ) {
  652. this.sampleList.push({
  653. ...this.selectedList[0],
  654. sampleCode: await this.getSampleCode(),
  655. measureQuantity: measureQ,
  656. qualitySampleTemplateList: JSON.parse(
  657. JSON.stringify(this.schemeList)
  658. ),
  659. measureUnit: unit,
  660. weight: newWeight || 0
  661. });
  662. } else {
  663. this.sampleList.push({
  664. ...this.selectedList[0],
  665. sampleCode: await this.getSampleCode(),
  666. measureQuantity: measureQ,
  667. qualitySampleTemplateList: JSON.parse(
  668. JSON.stringify(this.selectedList[0].qualitySampleTemplateList)
  669. ),
  670. measureUnit: unit,
  671. weight: newWeight || 0
  672. });
  673. // this.sampleList.push({
  674. // ...this.selectedList[0],
  675. // sampleCode: await this.getSampleCode(),
  676. // measureQuantity: measureQ,
  677. // measureUnit: unit,
  678. // weight: newWeight || 0,
  679. // });
  680. }
  681. }
  682. }
  683. // this.sampleList = this.selectedList.map(oldItem => {
  684. // const newItem = JSON.parse(JSON.stringify(oldItem));
  685. // newItem.measureQuantity = measureQ;
  686. // newItem.measureUnit = unit;
  687. // return newItem;
  688. // });
  689. this.$refs.tabsRef.tabsChange('2');
  690. },
  691. async getQueryQualityInventory() {
  692. const res = await queryQualityInventory({
  693. qualityWorkerId: this.$route.query.id,
  694. size: -1
  695. });
  696. if (res.list.length > 0) {
  697. this.inventoryList = res.list;
  698. }
  699. },
  700. async queryQualitySamplContent() {
  701. const res = await queryQualitySamplContent({
  702. qualityWorkerId: this.$route.query.id,
  703. size: 1000
  704. });
  705. let addStatus = res.list.map((item) => {
  706. item.isValid = true;
  707. // item.disposeTime = item.disposeTime
  708. // ? item.disposeTime.split(' ')[0]
  709. // : null;
  710. item.sampleDate = item.sampleDate
  711. ? item.sampleDate.split(' ')[0]
  712. : null;
  713. return {
  714. ...item
  715. };
  716. });
  717. console.log(addStatus, '样品清单12123123');
  718. if (addStatus.length > 0) {
  719. this.sampleList = addStatus;
  720. this.addStatus = addStatus;
  721. } else {
  722. this.getProSamList(this.packingList);
  723. }
  724. },
  725. async queryQualityTempleContent() {
  726. const res = await queryQualityTempleContent({
  727. qualityWorkerId: this.$route.query.id
  728. });
  729. console.log(res, '质检方案');
  730. this.schemeList = res.list;
  731. },
  732. // 取样
  733. getConditionType(val) {
  734. console.log(val, '------取样的回调');
  735. this.form.conditionType = val;
  736. },
  737. /* 保存编辑 */
  738. save() {
  739. // *** 新增判断
  740. let flag = this.$refs.baseInfoRefs.quantityCalculation();
  741. if (!flag) return;
  742. // ***
  743. this.$refs.baseInfoRefs.$refs.form1.validate((valid) => {
  744. if (!valid) {
  745. return false;
  746. }
  747. // this.loading = true;
  748. let URL =
  749. this.type == 'add' ? save : this.type == 'edit' ? update : '';
  750. this.form.qualityTimeStart = this.qualityTimeStart;
  751. delete this.form['qualityTimeEnd'];
  752. console.log(this.sampleList);
  753. // return
  754. let params = {
  755. ...this.form,
  756. sampleList: this.sampleList,
  757. planTemplateList: this.schemeList,
  758. templateList: this.schemeList,
  759. // qualityInventoryList: this.$refs.tabsRef.$refs.sourceTable.getData()
  760. qualityInventoryList: this.inventoryList
  761. };
  762. console.log(params, 'params ----');
  763. URL(params)
  764. .then((msg) => {
  765. this.loading = false;
  766. this.$message.success(msg);
  767. this.cancel();
  768. this.$emit('done');
  769. })
  770. .catch((e) => {
  771. this.loading = false;
  772. });
  773. });
  774. },
  775. update() {
  776. this.loading = true;
  777. this.form['status'] = 1;
  778. update({ ...this.form })
  779. .then((msg) => {
  780. this.loading = false;
  781. this.$message.success(msg);
  782. this.$emit('done');
  783. })
  784. .catch((e) => {
  785. this.loading = false;
  786. });
  787. },
  788. restForm() {
  789. this.form = { ...this.defaultForm() };
  790. this.$nextTick(() => {
  791. this.$refs.baseInfoRefs.$refs.form1.clearValidate();
  792. });
  793. },
  794. cancel() {
  795. finishPageTab();
  796. this.$router.go(-1);
  797. },
  798. handleDetail(index, row, type) {
  799. if (!this.sampleList[index] || !this.schemeList) {
  800. return;
  801. }
  802. const selectedData = [];
  803. selectedData.push(this.sampleList[index]);
  804. this.$refs.detailRef.openDia(
  805. index,
  806. row,
  807. type,
  808. selectedData,
  809. null,
  810. this.schemeList.toolList
  811. );
  812. },
  813. inputWeight(row, index) {
  814. console.log(row, index, '输入重量');
  815. // 计算所有样本的总重量
  816. const pNum = this.sampleList.reduce((sum, item) => {
  817. return sum + Number(item.weight || 0);
  818. }, 0);
  819. this.form.totalWeight = parseFloat(pNum.toFixed(2));
  820. },
  821. handleDispose(data) {
  822. console.log(data);
  823. // return
  824. this.rowData = data;
  825. this.sampleDisposeVisble = true;
  826. // if (!this.sampleList[index]) {
  827. // return;
  828. // }
  829. // this.sampleList[index].sampleDate = this.getNowTimes();
  830. // this.sampleList[index].disposeTime = this.getNowTimes();
  831. // console.log(index, row, type, this.qualityType);
  832. // this.$refs.disposeRef.openDispose(index, row, type, this.qualityType);
  833. },
  834. // 报工
  835. handleReporting(index, row) {
  836. if (this.form.qualityMode == 2 && !this.form.qualityResults) {
  837. this.$refs.baseInfoRefs.toggleExpand2();
  838. this.$message.error('请选择质检结果');
  839. return;
  840. }
  841. this.$refs.baseInfoRefs.$refs.form1.validate((valid) => {
  842. if (!valid) return false;
  843. this.loading = true;
  844. if (this.qualityType == 2 && this.isReportProcessProduce) {
  845. for (let i = 0; i < this.sampleList.length; i++) {
  846. const disposalStatus = this.sampleList[i].disposalStatus;
  847. if (disposalStatus == null) {
  848. this.loading = false;
  849. this.$refs.tabsRef.tabsChange('2');
  850. this.$message.error('请完成以下样品处置!');
  851. return;
  852. }
  853. }
  854. }
  855. for (let i = 0; i < this.sampleList.length; i++) {
  856. const qualityStatus = this.sampleList[i].qualityStatus;
  857. if (qualityStatus == '2') {
  858. this.loading = false;
  859. this.$refs.tabsRef.tabsChange('2');
  860. this.$message.error('请完成以下样品质检!');
  861. return;
  862. }
  863. }
  864. // this.form.qualityTimeEnd = new Date(this.getNowTime());
  865. // this.form.qualityTimeStart = new Date(this.qualityTimeStart);
  866. this.form.qualityTimeEnd = this.getNowTime();
  867. this.form.qualityTimeStart = this.qualityTimeStart;
  868. console.log(this.form.qualityTimeStart, this.form.qualityTimeEnd);
  869. // if (this.form.qualityMode == 1) {
  870. // this.form.qualityResults = '';
  871. // }
  872. let params = {
  873. ...this.form,
  874. sampleList: this.sampleList,
  875. planTemplateList: this.schemeList,
  876. // qualityInventoryList: this.$refs.tabsRef.$refs.sourceTable.getData()
  877. qualityInventoryList: this.inventoryList
  878. };
  879. console.log(params, 'params');
  880. exeReportWork(params)
  881. .then((msg) => {
  882. this.loading = false;
  883. this.$message.success(msg);
  884. this.cancel();
  885. this.$emit('done');
  886. })
  887. .catch((e) => {
  888. this.loading = false;
  889. });
  890. });
  891. },
  892. // 处理确认事件
  893. handleDisposeConfirm(data, index) {
  894. console.log(data, index, '确认处置事件');
  895. console.log(this.sampleList);
  896. if (index == undefined) {
  897. this.sampleList.forEach((obj) => {
  898. obj.disposeType = data.disposeType;
  899. obj.sampleDate = data.sampleDate;
  900. obj.sampleCondition = data.sampleCondition;
  901. obj.producerManufacturer = data.producerManufacturer;
  902. obj.samplePlace = data.samplePlace;
  903. obj.sampleRemark = data.sampleRemark;
  904. obj.depotId = data.depotId;
  905. obj.depotName = data.depotName;
  906. });
  907. } else {
  908. this.$set(this.sampleList, index, data);
  909. }
  910. console.log(this.sampleList);
  911. },
  912. //确认质检
  913. handleConfirm(list, index) {
  914. console.log(list);
  915. // 检查有效性
  916. // for (const item of list) {
  917. // for (const child of item.qualitySampleTemplateList) {
  918. //
  919. // console.log(child, 'child')
  920. // if (!child.qualityResultContent || !child.qualityResults) {
  921. // this.$message.error('请完善报工内容!');
  922. // return;
  923. // }
  924. // }
  925. // }
  926. console.log(list, 'listlistlistlist');
  927. list.forEach((item) => {
  928. if (item.qualitySampleTemplateList.length == 1) {
  929. if (
  930. item.qualitySampleTemplateList.some(
  931. (child) => child.qualityResults === 3
  932. )
  933. ) {
  934. // 如果质检项只有一条而且结果为让步接收那么整个就是让步接收
  935. item.isValid = false;
  936. item.qualityResults = 3;
  937. } else if (
  938. item.qualitySampleTemplateList.some(
  939. (child) => child.qualityResults === 2
  940. )
  941. ) {
  942. item.isValid = false;
  943. item.qualityResults = 2;
  944. } else {
  945. item.isValid = true;
  946. item.qualityResults = 1;
  947. }
  948. } else {
  949. if (
  950. item.qualitySampleTemplateList.some(
  951. (child) => child.qualityResults === 2
  952. )
  953. ) {
  954. item.isValid = false;
  955. item.qualityResults = 2;
  956. } else {
  957. item.isValid = true;
  958. item.qualityResults = 1;
  959. }
  960. }
  961. item.qualityStatus = 1;
  962. });
  963. if (index != null) {
  964. this.$set(this.sampleList, index, list[0]);
  965. } else {
  966. this.$set(this.sampleList, null, list);
  967. }
  968. this.activeName = '2';
  969. console.log(this.sampleList, '222表');
  970. // *** 选完批量质检调用
  971. this.countQualityResults();
  972. },
  973. // 批量质检
  974. batchQuality(index, row, type) {
  975. this.$refs.detailRef.openDia(
  976. null,
  977. null,
  978. 'report',
  979. this.sampleList,
  980. null,
  981. this.schemeList.toolList
  982. );
  983. },
  984. // 批量处置
  985. batchDispose() {
  986. if (this.sampleList && this.sampleList.length) {
  987. this.sampleDisposeVisble = true;
  988. return;
  989. }
  990. this.$message('当前没有样品清单可以处置');
  991. // this.$refs.disposeRef.openDispose(
  992. // null,
  993. // null,
  994. // 'dispose',
  995. // this.qualityType
  996. // );
  997. },
  998. //全检,检验标准改变时,重新获取样品列表
  999. async changeInspectionStandardsModel(val) {
  1000. const sData = this.$refs.tabsRef.$refs.sourceTable.getData();
  1001. if (sData.length > 0) {
  1002. for (let i = 0; i < sData.length; i++) {
  1003. this.$set(sData[i], 'qualityStatus', 2);
  1004. }
  1005. }
  1006. this.form.inspectionStandards = val;
  1007. this.form.sampleNumber = '';
  1008. this.$refs.tabsRef.tableSelClear();
  1009. this.sampleList = [];
  1010. this.$refs.tabsRef.tabsChange('1');
  1011. //检验标准 2计重 1计量
  1012. if (this.form.inspectionStandards == 2 && this.form.qualityMode == 1) {
  1013. for (let i = 0; i < sData.length; i++) {
  1014. let qualitySampleTemplateList = [];
  1015. if (
  1016. sData[i].qualitySampleTemplateList == undefined ||
  1017. sData[i].qualitySampleTemplateList == null ||
  1018. sData[i].qualitySampleTemplateList.length == 0
  1019. ) {
  1020. qualitySampleTemplateList = JSON.parse(
  1021. JSON.stringify(this.schemeList)
  1022. );
  1023. } else {
  1024. qualitySampleTemplateList = sData[i].qualitySampleTemplateList;
  1025. }
  1026. this.sampleList.push({
  1027. ...sData[i],
  1028. sampleCode: await this.getSampleCode(),
  1029. qualitySampleTemplateList
  1030. });
  1031. }
  1032. } else if (
  1033. this.form.inspectionStandards == 1 &&
  1034. this.form.qualityMode == 1
  1035. ) {
  1036. this.getProSamList(sData);
  1037. }
  1038. },
  1039. //从来源数组取样到目标数组
  1040. async getNewFullSampleList(sampleCount, sampleQuantity, sampleUnit) {
  1041. const sourceArray = this.selectedList;
  1042. // 检查单位是否匹配
  1043. const isUnitMismatch =
  1044. sourceArray.length > 0 && sourceArray[0].measureUnit !== sampleUnit;
  1045. // 创建副本并计算初始可取样数量
  1046. const items = sourceArray.map((item) => ({
  1047. ...item,
  1048. remainingQuantity: isUnitMismatch
  1049. ? Infinity
  1050. : item['measureQuantity'], // 剩余可取样数量
  1051. maxPossible: item['measureQuantity'] / sampleQuantity // 最大取样次数
  1052. }));
  1053. const result = [];
  1054. let remainingCount = sampleCount;
  1055. // 尽可能均匀地从各条目取样
  1056. while (remainingCount > 0) {
  1057. // 按剩余可取样比例排序
  1058. items.sort(
  1059. (a, b) =>
  1060. b.remainingQuantity / b['measureQuantity'] -
  1061. a.remainingQuantity / a['measureQuantity']
  1062. );
  1063. let distributed = false;
  1064. for (const item of items) {
  1065. if (
  1066. !isUnitMismatch ||
  1067. (item.remainingQuantity >= sampleQuantity && remainingCount > 0)
  1068. ) {
  1069. let qualitySampleTemplateList = [];
  1070. if (
  1071. item.qualitySampleTemplateList == undefined ||
  1072. item.qualitySampleTemplateList == null ||
  1073. item.qualitySampleTemplateList.length == 0
  1074. ) {
  1075. qualitySampleTemplateList = JSON.parse(
  1076. JSON.stringify(this.schemeList)
  1077. );
  1078. } else {
  1079. qualitySampleTemplateList = item.qualitySampleTemplateList;
  1080. }
  1081. // 添加到结果数组
  1082. let sampleCode = await this.getSampleCode();
  1083. if (
  1084. this.form.conditionType == 1 &&
  1085. this.form.inspectionStandards == 1
  1086. ) {
  1087. result.push({
  1088. ...item,
  1089. measureQuantity: 1,
  1090. sampleCode,
  1091. qualitySampleTemplateList
  1092. });
  1093. } else if (
  1094. this.form.conditionType == 2 &&
  1095. (this.form.inspectionStandards == 1 ||
  1096. this.form.inspectionStandards == 2)
  1097. ) {
  1098. let weight = (item.weight / item.maxPossible).toFixed(2);
  1099. result.push({
  1100. ...item,
  1101. measureQuantity: sampleQuantity,
  1102. measureUnit: sampleUnit,
  1103. sampleCode,
  1104. weight,
  1105. qualitySampleTemplateList
  1106. });
  1107. }
  1108. // 更新剩余数量
  1109. if (!isUnitMismatch) {
  1110. item.remainingQuantity -= sampleQuantity;
  1111. }
  1112. remainingCount--;
  1113. distributed = true;
  1114. }
  1115. }
  1116. // 如果没有分配任何取样
  1117. if (!distributed) {
  1118. break;
  1119. }
  1120. }
  1121. this.sampleList = result;
  1122. if (this.sampleList.length > sampleCount) {
  1123. this.sampleList = this.sampleList.splice(0, sampleCount);
  1124. }
  1125. this.form.sampleNumber = this.sampleList.length;
  1126. },
  1127. validateWeight(measureQ, sampleCount) {
  1128. let totalMaxPossible = 0;
  1129. this.selectedList.forEach((item) => {
  1130. totalMaxPossible += item.measureQuantity / measureQ;
  1131. });
  1132. if (totalMaxPossible < sampleCount) {
  1133. // this.formData.portion = totalMaxPossible;
  1134. this.$message.info(`最大取样条数为${totalMaxPossible}`);
  1135. return false;
  1136. }
  1137. let totalWeight = this.selectedList.reduce(
  1138. (sum, item) => sum + item.weight,
  1139. 0
  1140. );
  1141. const weightUnit = this.selectedList[0].weightUnit;
  1142. if (weightUnit === 'G') totalWeight /= 1000;
  1143. if (measureQ * sampleCount > totalWeight) {
  1144. this.$message.info('取样计量重量不能大于总计量重量');
  1145. return false;
  1146. }
  1147. const invalidItem = this.selectedList.find((item) => {
  1148. const weight =
  1149. item.weightUnit === 'G' ? item.weight / 1000 : item.weight;
  1150. return weight < measureQ;
  1151. });
  1152. if (invalidItem) {
  1153. this.$message.info('勾选条目重量小于取样重量');
  1154. return false;
  1155. }
  1156. return true;
  1157. },
  1158. isStandard1OrWeightSample() {
  1159. return (
  1160. this.form.inspectionStandards === 1 ||
  1161. (this.form.inspectionStandards === 2 && this.form.conditionType == 2)
  1162. );
  1163. },
  1164. validateMeasureQuantity(measureQ, unit, sampleCount) {
  1165. if (this.form.conditionType == 2 && measureQ <= 0) {
  1166. this.$message.info('取样计量数量必须大于0');
  1167. return false;
  1168. }
  1169. const totalQuantity = this.selectedList.reduce(
  1170. (sum, item) => sum + item.measureQuantity,
  1171. 0
  1172. );
  1173. if (
  1174. (this.selectedList[0].measureUnit === unit ||
  1175. this.form.conditionType == 1) &&
  1176. measureQ * sampleCount > totalQuantity
  1177. ) {
  1178. this.$message.info('取样计量数量不能大于总计量数量');
  1179. return false;
  1180. }
  1181. const invalidItem = this.selectedList.find(
  1182. (item) => item.measureQuantity < measureQ
  1183. );
  1184. if (invalidItem) {
  1185. this.$message.info('条目计量数量小于取样计量数量');
  1186. return false;
  1187. }
  1188. return true;
  1189. },
  1190. isWeightStandardFullSample() {
  1191. return (
  1192. this.form.inspectionStandards === 2 && this.form.conditionType == 1
  1193. );
  1194. },
  1195. validateSampleCount(sampleCount) {
  1196. const chooseNumber = this.selectedList.reduce((acc, pro) => {
  1197. return pro.measureQuantity ? acc + Number(pro.measureQuantity) : acc;
  1198. }, 0);
  1199. const invalidItem = chooseNumber < sampleCount;
  1200. // console.log(this.selectedList, 'this.selectedList');
  1201. // const invalidItem = this.selectedList.find(
  1202. // (item) => item.measureQuantity < sampleCount
  1203. // );
  1204. if (invalidItem) {
  1205. this.$message.info('所选的条目计量数量小于取样计量数量');
  1206. return false;
  1207. }
  1208. return true;
  1209. },
  1210. async handleWeightFullSample(sampleCount) {
  1211. const dataList = [];
  1212. let currentNum = sampleCount - this.selectedList.length;
  1213. let currentNum1 = sampleCount;
  1214. for (const item of this.selectedList) {
  1215. const qualitySampleTemplateList = item.qualitySampleTemplateList
  1216. ?.length
  1217. ? JSON.parse(JSON.stringify(item.qualitySampleTemplateList))
  1218. : JSON.parse(
  1219. JSON.stringify(
  1220. this.schemeList.map((item) => {
  1221. item['qualityResults'] = 1;
  1222. return item;
  1223. })
  1224. )
  1225. );
  1226. if (sampleCount >= this.selectedList.length) {
  1227. dataList.push({
  1228. ...item,
  1229. measureQuantity: 1, //作为计量数量
  1230. sampleCode: await this.getSampleCode(),
  1231. qualitySampleTemplateList
  1232. });
  1233. } else {
  1234. if (dataList.length < sampleCount) {
  1235. dataList.push({
  1236. ...item,
  1237. measureQuantity: currentNum1 > 1 ? 1 : currentNum1, //作为计量数量
  1238. sampleCode: await this.getSampleCode(),
  1239. qualitySampleTemplateList
  1240. });
  1241. currentNum1 -= 1;
  1242. }
  1243. }
  1244. }
  1245. if (sampleCount > this.selectedList.length) {
  1246. dataList.forEach((item) => {
  1247. if (currentNum > 0) {
  1248. let data = this.selectedList.find((val) => val.id == item.id);
  1249. item['measureQuantity'] =
  1250. data.measureQuantity - 1 - currentNum > 0
  1251. ? currentNum + 1
  1252. : data.measureQuantity;
  1253. currentNum = currentNum - (data.measureQuantity - 1);
  1254. }
  1255. });
  1256. }
  1257. this.sampleList = dataList;
  1258. this.sampleNumber = this.sampleList.length;
  1259. },
  1260. //计算合格率
  1261. countQualityResults() {
  1262. let sampleList = this.sampleList; //样品清单
  1263. let sampleNumber = this.form.total; //样品总数
  1264. console.log(sampleList, sampleNumber, '=====');
  1265. // let qualifiedNumber = sampleList.filter(item => item.qualityResults == 1 || item.qualityResults == 3).length;
  1266. // let noQualifiedNumber = sampleList.filter(
  1267. // (item) => item.qualityResults == 2
  1268. // ).length;
  1269. let noQualifiedNumber = sampleList.reduce((acc, pro) => {
  1270. // console.log(acc, pro);
  1271. // if (pro.qualityResults == 2) {
  1272. // return acc + Number(pro.measureQuantity);
  1273. // }
  1274. return pro.qualityResults == 2
  1275. ? acc + Number(pro.measureQuantity)
  1276. : acc;
  1277. }, 0);
  1278. console.log(noQualifiedNumber, 'noQualifiedNumber');
  1279. let qualifiedNumber = sampleNumber - noQualifiedNumber; //不合格数
  1280. let qualificationRate = (
  1281. (qualifiedNumber / sampleNumber) *
  1282. 100
  1283. ).toFixed(2); //合格率
  1284. let noQualificationRate = (
  1285. (noQualifiedNumber / sampleNumber) *
  1286. 100
  1287. ).toFixed(2); //不合格率
  1288. this.$refs.baseInfoRefs.updateQualificationRate(
  1289. qualifiedNumber,
  1290. noQualifiedNumber,
  1291. qualificationRate,
  1292. noQualificationRate
  1293. );
  1294. },
  1295. closeDispose() {
  1296. this.rowData = null;
  1297. this.sampleDisposeVisble = false;
  1298. // this.rowData = null;
  1299. }
  1300. }
  1301. };
  1302. </script>
  1303. <style lang="scss" scoped></style>