experimentReport.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770
  1. <template>
  2. <el-dialog
  3. title="实验报工"
  4. :visible.sync="visible"
  5. :before-close="handleClose"
  6. :close-on-click-modal="false"
  7. :close-on-press-escape="false"
  8. append-to-body
  9. width="80%"
  10. :maxable="true"
  11. >
  12. <header-title title="基础信息"> </header-title>
  13. <el-form
  14. label-width="115px"
  15. :model="form"
  16. :rules="[{}]"
  17. ref="formRef"
  18. :disabled="type == 'detail'"
  19. >
  20. <el-row>
  21. <el-col :span="8">
  22. <el-form-item label="质检项:" prop="inspectionName">
  23. {{ tableData[0]?.inspectionName }}</el-form-item
  24. >
  25. </el-col>
  26. <el-col :span="8">
  27. <el-form-item label="编码:" prop="inspectionCode">
  28. {{ tableData[0]?.inspectionCode }}
  29. </el-form-item>
  30. </el-col>
  31. <el-col :span="8">
  32. <el-form-item label="批次号:" prop="batchNo">
  33. {{ tableData[0]?.batchNo }}
  34. </el-form-item>
  35. </el-col></el-row
  36. >
  37. <header-title title=" 样品信息"> </header-title>
  38. <ele-pro-table
  39. :needPage="false"
  40. :columns="workColumns"
  41. :datasource="tableData"
  42. >
  43. <template v-slot:toolbar v-if="type != 'detail'">
  44. 当前质检剩余样品数:{{ getSampleQuantityCount1 }}
  45. </template>
  46. <template v-slot:sampleQuantity="{ row, $index }">
  47. <el-input
  48. v-model="row.sampleQuantity"
  49. placeholder="请输入"
  50. :disabled="type == 'detail'"
  51. type="number"
  52. @input="inputValue('sampleQuantity', row, $index)"
  53. >
  54. </el-input>
  55. </template>
  56. <template v-slot:qualifiedQuantity="{ row, $index }">
  57. <el-input
  58. v-model="row.qualifiedQuantity"
  59. placeholder="请输入"
  60. :disabled="type == 'detail'"
  61. type="number"
  62. @input="inputValue('qualifiedQuantity', row, $index)"
  63. >
  64. </el-input>
  65. </template>
  66. <template v-slot:noQualifiedQuantity="{ row, $index }">
  67. <el-input
  68. v-model="row.noQualifiedQuantity"
  69. placeholder="请输入"
  70. :disabled="type == 'detail'"
  71. type="number"
  72. @input="inputValue('noQualifiedQuantity', row, $index)"
  73. >
  74. </el-input>
  75. </template>
  76. <template v-slot:lossNumber="{ row, $index }">
  77. <el-input
  78. v-model="row.lossNumber"
  79. placeholder="请输入"
  80. :disabled="type == 'detail'"
  81. type="number"
  82. @input="inputValue('lossNumber', row, $index)"
  83. @click.native="curretNum = row.lossNumber"
  84. >
  85. </el-input>
  86. </template>
  87. <template v-slot:lossNumberUnqualified="{ row, $index }">
  88. <el-input
  89. v-model="row.lossNumberUnqualified"
  90. placeholder="请输入"
  91. :disabled="type == 'detail'"
  92. type="number"
  93. @input="inputValue('lossNumberUnqualified', row, $index)"
  94. @click.native="curretNum = row.lossNumberUnqualified"
  95. >
  96. </el-input>
  97. </template>
  98. <template v-slot:retainedSampleQuantity="{ row, $index }">
  99. <el-input
  100. v-model="row.retainedSampleQuantity"
  101. placeholder="请输入"
  102. :disabled="type == 'detail'"
  103. type="number"
  104. @input="inputValue('retainedSampleQuantity', row, $index)"
  105. @click.native="curretNum = row.retainedSampleQuantity"
  106. >
  107. </el-input>
  108. </template>
  109. <template v-slot:retainedSampleUnqualified="{ row, $index }">
  110. <el-input
  111. v-model="row.retainedSampleUnqualified"
  112. placeholder="请输入"
  113. :disabled="type == 'detail'"
  114. type="number"
  115. @input="inputValue('retainedSampleUnqualified', row, $index)"
  116. @click.native="curretNum = row.retainedSampleUnqualified"
  117. >
  118. </el-input>
  119. </template>
  120. </ele-pro-table>
  121. <header-title title="实验数据" style="margin-top: 15px"> </header-title>
  122. <el-row>
  123. <el-col :span="8">
  124. <el-form-item label="实验编号:" prop="code">
  125. <el-input v-model="form.code" placeholder="请输入" :disabled="true">
  126. </el-input>
  127. </el-form-item> </el-col
  128. ></el-row>
  129. <el-row>
  130. <el-col :span="8">
  131. <el-form-item label="实验时间:" prop="experimentalTime">
  132. <el-date-picker
  133. v-model="form.experimentalTime"
  134. type="datetime"
  135. placeholder="选择日期时间"
  136. value-format="yyyy-MM-dd HH:mm:ss"
  137. style="width: 100%"
  138. >
  139. </el-date-picker>
  140. </el-form-item>
  141. </el-col>
  142. <el-col :span="8">
  143. <el-form-item label="执行标准:" prop="qualityStandardName">
  144. <el-input
  145. :value="getDictValue('质检标准类型', form.qualityStandardName)"
  146. placeholder="请输入"
  147. :disabled="true"
  148. >
  149. </el-input>
  150. </el-form-item>
  151. </el-col>
  152. </el-row>
  153. <header-title title="实验室/实验设备"> </header-title>
  154. <el-row>
  155. <el-col :span="8">
  156. <el-form-item label="实验室:" prop="workshopId">
  157. <el-select
  158. v-model="form.workshopId"
  159. style="width: 100%"
  160. placeholder="请选择"
  161. >
  162. <el-option
  163. v-for="item in laboratoryList"
  164. :key="item.workshopId"
  165. :label="item.workshopName"
  166. :value="item.workshopId"
  167. @click.native="form.workshopName = item.workshopName"
  168. >
  169. </el-option>
  170. </el-select>
  171. </el-form-item>
  172. </el-col>
  173. </el-row>
  174. <el-row v-for="(item, index) in form.experimentEquipmentList">
  175. <el-col :span="24">
  176. <el-row>
  177. <el-col :span="8">
  178. <el-form-item
  179. :label="'实验设备' + (index + 1) + ':'"
  180. prop="equipmentName"
  181. >
  182. <el-input
  183. placeholder="请选择"
  184. v-model="item.equipmentName"
  185. @click.native="equipmentOpen(index)"
  186. readonly
  187. style="width: calc(100% - 30px)"
  188. >
  189. </el-input>
  190. <i
  191. class="el-icon-delete"
  192. style="
  193. color: #f56c6c;
  194. font-size: 16px;
  195. margin-left: 10px;
  196. cursor: pointer;
  197. "
  198. @click="delLaboratoryItemList(index)"
  199. ></i>
  200. </el-form-item>
  201. </el-col>
  202. </el-row>
  203. </el-col>
  204. <el-col :span="24">
  205. <el-row>
  206. <el-col :span="8">
  207. <el-form-item label="开始时间:" prop="startTime">
  208. <el-date-picker
  209. v-model="item.startTime"
  210. type="datetime"
  211. placeholder="选择日期时间"
  212. value-format="yyyy-MM-dd HH:mm:ss"
  213. style="width: 100%"
  214. >
  215. </el-date-picker
  216. ></el-form-item>
  217. </el-col>
  218. <el-col :span="8">
  219. <el-form-item label="结束时间:" prop="endTime">
  220. <el-date-picker
  221. v-model="item.endTime"
  222. type="datetime"
  223. placeholder="选择日期时间"
  224. value-format="yyyy-MM-dd HH:mm:ss"
  225. style="width: 100%"
  226. >
  227. </el-date-picker
  228. ></el-form-item>
  229. </el-col>
  230. </el-row>
  231. </el-col>
  232. <el-col :span="24">
  233. <el-row>
  234. <el-col :span="16">
  235. <el-form-item label="运行参数:" prop="operatingParameters">
  236. <el-input
  237. v-model="item.operatingParameters"
  238. placeholder="请输入"
  239. >
  240. </el-input
  241. ></el-form-item>
  242. </el-col>
  243. </el-row>
  244. </el-col>
  245. </el-row>
  246. <el-row>
  247. <el-col :span="24">
  248. <el-form-item label=" " prop="industryType">
  249. <el-button type="primary" @click="addExperimentEquipmentList">
  250. 新增实验设备
  251. </el-button>
  252. </el-form-item>
  253. </el-col></el-row
  254. >
  255. <header-title title="实验过程"> </header-title>
  256. <el-button type="primary" size="small" @click="releaseRulesRefOpen(1)"
  257. >选择实验过程</el-button
  258. >
  259. <el-row>
  260. <el-col :span="24">
  261. <experimentationProcess
  262. ref="experimentationProcess1"
  263. :edit="false"
  264. ></experimentationProcess> </el-col
  265. ></el-row>
  266. <header-title title="工艺要求"> </header-title>
  267. <el-input
  268. type="textarea"
  269. autosize
  270. placeholder="请输入内容"
  271. :disabled="true"
  272. v-model="form.processRequirementsJson"
  273. >
  274. </el-input>
  275. <header-title title="实验工具" style="margin-top: 15px"> </header-title>
  276. <el-button type="primary" size="small" @click="handleAdd('toolJson')"
  277. >选择实验工具</el-button
  278. >
  279. <ele-pro-table
  280. :needPage="false"
  281. :columns="unitColumns"
  282. :datasource="form.toolJson"
  283. style="margin-top: 15px"
  284. >
  285. <template v-slot:action="{ row, $index }">
  286. <el-popconfirm
  287. class="ele-action"
  288. title="确定要删除此条数据吗?"
  289. @confirm="remove($index, 'toolJson')"
  290. >
  291. <template v-slot:reference>
  292. <el-link type="danger" :underline="false" icon="el-icon-delete">
  293. 删除
  294. </el-link>
  295. </template>
  296. </el-popconfirm>
  297. </template>
  298. </ele-pro-table>
  299. <header-title title="实验耗材" style="margin-top: 15px"> </header-title>
  300. <el-button
  301. type="primary"
  302. size="small"
  303. @click="handleAdd('consumablesJson')"
  304. >选择实验耗材</el-button
  305. >
  306. <ele-pro-table
  307. :needPage="false"
  308. :columns="unitColumns1"
  309. style="margin-top: 15px"
  310. :datasource="form.consumablesJson"
  311. >
  312. <template v-slot:remark="{ row, $index }">
  313. <el-input type="textarea" v-model="row.remark"></el-input>
  314. </template>
  315. <template v-slot:batchNo="{ row, $index }">
  316. <el-input v-model="row.batchNo"></el-input>
  317. </template>
  318. <template v-slot:action="{ row, $index }">
  319. <el-popconfirm
  320. class="ele-action"
  321. title="确定要删除此条数据吗?"
  322. @confirm="remove($index, 'consumablesJson')"
  323. >
  324. <template v-slot:reference>
  325. <el-link type="danger" :underline="false" icon="el-icon-delete">
  326. 删除
  327. </el-link>
  328. </template>
  329. </el-popconfirm>
  330. </template>
  331. </ele-pro-table>
  332. <header-title title="实验记录" style="margin-top: 15px"> </header-title>
  333. <el-button type="primary" size="small" @click="releaseRulesRefOpen(2)"
  334. >选择实验记录</el-button
  335. >
  336. <el-row>
  337. <el-col :span="24">
  338. <experimentationProcess
  339. ref="experimentationProcess2"
  340. :edit="false"
  341. ></experimentationProcess> </el-col
  342. ></el-row>
  343. <el-row>
  344. <el-col :span="16">
  345. <el-form-item label="实验结果:" prop="resultsDescription">
  346. <el-input
  347. type="resultsDescription"
  348. :rows="4"
  349. placeholder="请输入内容"
  350. v-model="form.resultsDescription"
  351. >
  352. </el-input>
  353. </el-form-item>
  354. </el-col>
  355. </el-row>
  356. <el-row>
  357. <el-col :span="8">
  358. <el-form-item label="实验结论:" prop="results">
  359. <el-select v-model="form.results" placeholder="请选择">
  360. <el-option :label="'合格'" :value="1"> </el-option>
  361. <el-option :label="'不合格'" :value="2"> </el-option>
  362. </el-select>
  363. </el-form-item>
  364. </el-col>
  365. </el-row>
  366. <el-row>
  367. <el-col :span="24">
  368. <el-form-item label="实验图片:" prop="imgUrl">
  369. <imgList v-model="form.imgUrl"></imgList>
  370. </el-form-item>
  371. </el-col>
  372. </el-row>
  373. <el-row>
  374. <el-col :span="24">
  375. <el-form-item label="附件图片:" prop="attachmentUrl">
  376. <imgList v-model="form.attachmentUrl"></imgList>
  377. </el-form-item>
  378. </el-col>
  379. </el-row>
  380. </el-form>
  381. <template v-slot:footer>
  382. <el-button size="small" @click="handleClose">关闭</el-button>
  383. <el-button
  384. type="primary"
  385. size="small"
  386. @click="save"
  387. v-if="type != 'detail'"
  388. >保存</el-button
  389. >
  390. <!-- <el-button type="primary" size="small" @click="submit">提交</el-button> -->
  391. </template>
  392. <releaseRules
  393. ref="releaseRulesRef"
  394. @success="releaseRulesSuccess"
  395. ></releaseRules>
  396. <ProductModal
  397. ref="productRefs"
  398. @chooseModal="chooseModal"
  399. @chooseCurrent="chooseCurrent"
  400. />
  401. </el-dialog>
  402. </template>
  403. <script>
  404. import dictMixins from '@/mixins/dictMixins';
  405. import experimentationProcess from '@/components/templateDiv/experimentationProcess.vue';
  406. import releaseRules from '@/components/releaseRules/index.vue';
  407. import { getFactoryarea } from '@/api/aps/index.js';
  408. import { save, getById, update } from '@/api/experimentReport/index.js';
  409. import ProductModal from '@/views/inspectionProject/components/ProductModal.vue';
  410. import imgList from '@/components/upload/imgList.vue';
  411. import detailMixins from '../mixins/detailMixins';
  412. export default {
  413. components: { experimentationProcess, releaseRules, ProductModal, imgList },
  414. props: {},
  415. mixins: [dictMixins, detailMixins],
  416. data() {
  417. return {
  418. visible: false,
  419. tableData: [],
  420. unitListKey: '',
  421. curretNum: 0,
  422. type: '',
  423. getSampleQuantityCount: 0,
  424. form: {
  425. code: '',
  426. correlationId: '',
  427. consumablesJson: [],
  428. toolJson: [],
  429. attachmentUrl: [],
  430. experimentalTime: '',
  431. imgUrl: [],
  432. procedureJson: null,
  433. qualityStandardName: '',
  434. qualityStandardId: '',
  435. processRequirementsJson: '',
  436. recordJson: null,
  437. qualityWorkOrderId: '',
  438. results: 1,
  439. resultsDescription: '',
  440. experimentEquipmentList: []
  441. },
  442. laboratoryList: [],
  443. unitColumns: [
  444. {
  445. minWidth: 200,
  446. prop: 'name',
  447. align: 'center',
  448. label: '工具名称',
  449. showOverflowTooltip: true
  450. },
  451. {
  452. minWidth: 200,
  453. prop: 'modelType',
  454. align: 'center',
  455. label: '型号',
  456. showOverflowTooltip: true
  457. },
  458. {
  459. minWidth: 200,
  460. prop: 'code',
  461. align: 'center',
  462. label: '编号',
  463. showOverflowTooltip: true
  464. },
  465. {
  466. columnKey: 'action',
  467. label: '操作',
  468. align: 'center',
  469. width: 100,
  470. resizable: false,
  471. slot: 'action',
  472. fixed: 'right'
  473. }
  474. ],
  475. unitColumns1: [
  476. {
  477. minWidth: 200,
  478. prop: 'name',
  479. align: 'center',
  480. label: '耗材名称',
  481. showOverflowTooltip: true
  482. },
  483. {
  484. minWidth: 200,
  485. prop: 'code',
  486. align: 'center',
  487. label: '编号',
  488. showOverflowTooltip: true
  489. },
  490. {
  491. minWidth: 200,
  492. prop: 'batchNo',
  493. slot: 'batchNo',
  494. align: 'center',
  495. label: '批次号',
  496. showOverflowTooltip: true
  497. },
  498. {
  499. minWidth: 200,
  500. prop: 'specification',
  501. align: 'center',
  502. label: '浓度',
  503. showOverflowTooltip: true
  504. },
  505. {
  506. minWidth: 200,
  507. prop: 'gys',
  508. align: 'center',
  509. label: '来源',
  510. showOverflowTooltip: true
  511. },
  512. {
  513. minWidth: 300,
  514. prop: 'remark',
  515. slot: 'remark',
  516. align: 'center',
  517. label: '过程',
  518. showOverflowTooltip: true
  519. },
  520. {
  521. columnKey: 'action',
  522. label: '操作',
  523. align: 'center',
  524. width: 100,
  525. resizable: false,
  526. slot: 'action',
  527. fixed: 'right'
  528. }
  529. ],
  530. workColumns: [
  531. {
  532. minWidth: 120,
  533. prop: 'sampleQuantity',
  534. slot: 'sampleQuantity',
  535. align: 'center',
  536. label: '样品数',
  537. showOverflowTooltip: true
  538. },
  539. {
  540. minWidth: 120,
  541. prop: 'qualifiedQuantity',
  542. align: 'center',
  543. slot: 'qualifiedQuantity',
  544. label: '合格数',
  545. showOverflowTooltip: true
  546. },
  547. {
  548. minWidth: 130,
  549. prop: 'noQualifiedQuantity',
  550. slot: 'noQualifiedQuantity',
  551. align: 'center',
  552. label: '不合格数',
  553. showOverflowTooltip: true
  554. },
  555. {
  556. minWidth: 140,
  557. prop: 'lossNumber',
  558. slot: 'lossNumber',
  559. align: 'center',
  560. label: '损耗数(合格品)',
  561. showOverflowTooltip: true
  562. },
  563. {
  564. minWidth: 150,
  565. prop: 'lossNumberUnqualified',
  566. slot: 'lossNumberUnqualified',
  567. align: 'center',
  568. label: '损耗数(不合格品)',
  569. showOverflowTooltip: true
  570. },
  571. {
  572. minWidth: 140,
  573. prop: 'retainedSampleQuantity',
  574. slot: 'retainedSampleQuantity',
  575. align: 'center',
  576. label: '留样数(合格品)',
  577. showOverflowTooltip: true
  578. },
  579. {
  580. minWidth: 150,
  581. prop: 'retainedSampleUnqualified',
  582. slot: 'retainedSampleUnqualified',
  583. align: 'center',
  584. label: '留样数(不合格品)',
  585. showOverflowTooltip: true
  586. }
  587. ]
  588. };
  589. },
  590. computed: {
  591. getSampleQuantityCount1() {
  592. return this.getSampleQuantityCount - this.numTotal;
  593. },
  594. numTotal() {
  595. return (
  596. (Number(this.tableData[0].lossNumber) || 0) +
  597. (Number(this.tableData[0].lossNumberUnqualified) || 0) +
  598. (Number(this.tableData[0].retainedSampleQuantity) || 0) +
  599. (Number(this.tableData[0].retainedSampleUnqualified) || 0)
  600. );
  601. }
  602. },
  603. watch: {},
  604. methods: {
  605. async open(row, type) {
  606. this.tableData = [row];
  607. this.type = type;
  608. this.getSampleQuantityCount = row.getSampleQuantityCount;
  609. if (row.experimentId) {
  610. this.$set(this, 'form', await getById(row.experimentId));
  611. this.$nextTick(() => {
  612. if (this.form.procedureJson) {
  613. this.$refs.experimentationProcess1.init(
  614. this.form.procedureJson.tempJson
  615. );
  616. }
  617. if (this.form.recordJson) {
  618. this.$refs.experimentationProcess2.init(
  619. this.form.recordJson.tempJson
  620. );
  621. }
  622. });
  623. } else {
  624. this.form.correlationId = row.id;
  625. this.form.qualityStandardName = row.qualityStandardName;
  626. this.form.qualityStandardId = row.qualityStandardId;
  627. this.form.qualityWorkOrderId = row.qualityWorkOrderId;
  628. this.form.processRequirementsJson = row.defaultValue;
  629. this.$nextTick(async () => {
  630. if (row.procedureJson.tempJson) {
  631. this.$refs.experimentationProcess1.init(
  632. row.procedureJson.tempJson
  633. );
  634. }
  635. if (row.recordJson.tempJson) {
  636. this.$refs.experimentationProcess2.init(row.recordJson.tempJson);
  637. }
  638. });
  639. }
  640. this.getFactoryarea();
  641. this.visible = true;
  642. },
  643. equipmentOpen(index) {
  644. this.$refs.productRefs.open([], index);
  645. },
  646. chooseCurrent(data) {
  647. this.$set(
  648. this.form.experimentEquipmentList[data[0].currentIndex],
  649. 'equipmentId',
  650. data[0].id
  651. );
  652. this.$set(
  653. this.form.experimentEquipmentList[data[0].currentIndex],
  654. 'equipmentName',
  655. data[0].name
  656. );
  657. },
  658. handleAdd(key) {
  659. this.unitListKey = key;
  660. this.$refs.productRefs.open(this.form[key]);
  661. },
  662. remove(index, key) {
  663. this.form[key].splice(index, 1);
  664. },
  665. chooseModal(data) {
  666. this.form[this.unitListKey] = [...this.form[this.unitListKey], ...data];
  667. },
  668. delLaboratoryItemList(index) {
  669. this.form.experimentEquipmentList.splice(index, 1);
  670. },
  671. addExperimentEquipmentList() {
  672. this.form.experimentEquipmentList.push({});
  673. },
  674. async getFactoryarea() {
  675. const data = await getFactoryarea({
  676. pageNum: 1,
  677. size: 1000,
  678. type: 3
  679. });
  680. this.laboratoryList = data.list;
  681. },
  682. releaseRulesRefOpen(type) {
  683. this.releaseRulesType = type;
  684. this.$refs.releaseRulesRef.open(type);
  685. },
  686. releaseRulesSuccess(data) {
  687. if (this.releaseRulesType == 1) {
  688. this.$refs.experimentationProcess1.init(data.tempJson.tempJson);
  689. }
  690. if (this.releaseRulesType == 2) {
  691. this.$refs.experimentationProcess2.init(data.tempJson.tempJson);
  692. }
  693. },
  694. inputValue(type, item, index) {
  695. //样品数
  696. if (type == 'sampleQuantity') {
  697. this.isSampleQuantity(item, index);
  698. }
  699. //样品合格数、不合格数
  700. if (type == 'qualifiedQuantity' || type == 'noQualifiedQuantity') {
  701. this.isQualifiedQuantity(item, index, type);
  702. }
  703. //损耗数
  704. if (type == 'lossNumber' || type == 'lossNumberUnqualified') {
  705. this.setNumber(item, index, type, '损耗', 'lossNumber');
  706. if (this.numTotal > this.getSampleQuantityCount) {
  707. this.$message.error('不能大于当前质检剩余样品数');
  708. this.$set(this.tableData[index], type, 0);
  709. }
  710. }
  711. //留样数
  712. if (
  713. type == 'retainedSampleQuantity' ||
  714. type == 'retainedSampleUnqualified'
  715. ) {
  716. this.setNumber(item, index, type, '留样', 'retainedSampleQuantity');
  717. if (this.numTotal > this.getSampleQuantityCount) {
  718. this.$message.error('不能大于当前质检剩余样品数');
  719. this.$set(this.tableData[index], type, 0);
  720. }
  721. }
  722. },
  723. save() {
  724. this.$refs.formRef.validate((valid) => {
  725. if (!valid) return false;
  726. let data = JSON.parse(JSON.stringify(this.form));
  727. let procedureJson = this.$refs.experimentationProcess1.getValue();
  728. let recordJson = this.$refs.experimentationProcess2.getValue();
  729. if (procedureJson) {
  730. data.procedureJson = {
  731. tempJson: JSON.stringify(procedureJson)
  732. };
  733. }
  734. if (recordJson) {
  735. data.recordJson = {
  736. tempJson: JSON.stringify(recordJson)
  737. };
  738. }
  739. let api = data.id ? update : save;
  740. api(data)
  741. .then((msg) => {
  742. this.loading = false;
  743. this.$message.success(msg);
  744. this.handleClose();
  745. this.$emit('done', this.tableData[0]);
  746. })
  747. .catch((e) => {
  748. this.loading = false;
  749. });
  750. });
  751. },
  752. handleClose() {
  753. this.visible = false;
  754. }
  755. }
  756. };
  757. </script>
  758. <style lang="scss" scoped></style>