edit.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642
  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 type="primary" @click="save" :loading="loading" v-if="type != 'detail'">保存</el-button>
  7. <el-button type="primary" @click="handleReporting" :loading="loading" v-if="type != 'detail'">报工完成</el-button>
  8. </header-title>
  9. <base-info ref="baseInfoRefs" v-if="form" :form="form" :btnType="type" :qualityType1="qualityType"
  10. @changeModel="changeModel" @changeNumber="changeNumber"></base-info>
  11. <el-row>
  12. <header-title title="质检内容">
  13. <el-button type="primary" :loading="loading" v-if="type != 'detail'"
  14. @click="batchQuality(null, null, 'report')">批量质检</el-button>
  15. </header-title>
  16. <el-tabs v-model="activeName" @tab-click="handleClick">
  17. <el-tab-pane label="来源清单" name="1"></el-tab-pane>
  18. <el-tab-pane label="样品清单" name="2"></el-tab-pane>
  19. <el-tab-pane label="质检方案" name="3"></el-tab-pane>
  20. </el-tabs>
  21. </el-row>
  22. <!-- -->
  23. <el-row style="margin-top: 24px">
  24. <el-table v-show="activeName === '1'" v-if="packingList.length > 0" ref="showPackingListTable"
  25. :data="paginatedPackingList" tooltip-effect="dark" :max-height="300" border row-key="id"
  26. @selection-change="handleSelectionChange1">
  27. <el-table-column type="selection" width="55" align="center" :reserve-selection="true"
  28. :selectable="checkSelectable"></el-table-column>
  29. <el-table-column label="序号" type="index" width="50" align="center"></el-table-column>
  30. <template v-for="column in tableColumns">
  31. <el-table-column :label="column.label" :prop="column.prop" :show-overflow-tooltip="true"
  32. :width="column.width" :align="column.align"></el-table-column>
  33. </template>
  34. </el-table>
  35. <el-pagination v-show="activeName === '1' && packingList.length > 0" @size-change="handleSizeChange"
  36. @current-change="handleCurrentChange" :current-page="pagination.currentPage" :page-sizes="[10, 20, 50, 100]"
  37. :page-size="pagination.pageSize" layout="total, sizes, prev, pager, next" :total="packingList.length"
  38. style="margin-top: 16px" />
  39. <!-- -->
  40. <el-table v-show="activeName === '2'" v-if="sampleList.length > 0" ref="showSampleListTable"
  41. :data="paginatedSampleList" tooltip-effect="dark" :max-height="300" border row-key="id">
  42. <el-table-column label="序号" type="index" width="50" align="center" fixed="left"></el-table-column>
  43. <template v-for="column in tableColumns">
  44. <el-table-column :key="column.prop" :label="column.label" :prop="column.prop" :fixed="column.fixed"
  45. :show-overflow-tooltip="true" :width="column.width" :align="column.align">
  46. <template slot-scope="scope">
  47. <template v-if="column.prop === 'categoryCode'">
  48. <el-link type="primary" :underline="false" @click="handleDetail(scope.$index, scope.row, 'detail')">
  49. {{ scope.row.categoryCode }}
  50. </el-link>
  51. </template>
  52. <template v-else>
  53. {{ scope.row[column.prop] }}
  54. </template>
  55. </template>
  56. </el-table-column>
  57. </template>
  58. <el-table-column label="重量" prop="weight" align="center" width="100" fixed="right"
  59. :show-overflow-tooltip="true">
  60. <template slot-scope="scope">
  61. <el-input type="number" v-model="scope.row.weight" :min="0"></el-input>
  62. </template>
  63. </el-table-column>
  64. <el-table-column label="重量单位" prop="weightUnit" align="center" width="80" fixed="right"
  65. :show-overflow-tooltip="true"></el-table-column>
  66. <el-table-column label="处置状态" prop="disposalStatus" align="center" width="80" fixed="right"
  67. :show-overflow-tooltip="true">
  68. <template slot-scope="scope">
  69. <span v-if="scope.row.disposalStatus == 1 && form.qualityType == 2">返工</span>
  70. <span v-if="scope.row.disposalStatus == 2 && form.qualityType == 2">返修</span>
  71. <span v-if="scope.row.disposalStatus == 3">报废</span>
  72. <span v-if="scope.row.disposalStatus == 4 && form.qualityType == 2">降级使用</span>
  73. <span v-if="scope.row.disposalStatus == 5 && form.qualityType == 2">让步接收</span>
  74. <span v-if="scope.row.disposalStatus == 6">留样</span>
  75. <span v-if="scope.row.disposalStatus == 7">消耗</span>
  76. <span v-if="scope.row.disposalStatus == 8">回用</span>
  77. </template>
  78. </el-table-column>
  79. <el-table-column label="处置时间" prop="disposeTime" align="center" width="100" fixed="right"
  80. :show-overflow-tooltip="true">
  81. </el-table-column>
  82. <el-table-column label="质检状态" prop="qualityStatus" align="center" width="120" fixed="right"
  83. :show-overflow-tooltip="true">
  84. <template slot-scope="scope">
  85. <span v-if="scope.row.qualityStatus == 0">未检</span>
  86. <span v-if="scope.row.qualityStatus == 1">已检</span>
  87. <span v-if="scope.row.qualityStatus == 2">待检</span>
  88. </template>
  89. </el-table-column>
  90. <el-table-column label="质检结果" prop="qualityResults" align="center" width="110" fixed="right"
  91. :show-overflow-tooltip="true">
  92. <template slot-scope="scope">
  93. <el-select v-model="scope.row.qualityResults" placeholder="请选择" style="width: 100%;"
  94. :disabled="type == 'detail'" size="mini">
  95. <el-option v-for="item in qualityResultsList" :key="item.value" :label="item.label" :value="item.value">
  96. </el-option>
  97. </el-select>
  98. </template>
  99. </el-table-column>
  100. <el-table-column label="操作" align="center" width="120" fixed="right" v-if="type != 'detail'">
  101. <template slot-scope="scope">
  102. <el-link :type="scope.row.isValid ? 'primary' : 'danger'" :underline="false"
  103. @click="handleDetail(scope.$index, scope.row, 'report')">
  104. 质检
  105. </el-link>
  106. <el-link type='primary' :underline="false" @click="handleDispose(scope.$index, scope.row, 'dispose')"> 处置
  107. </el-link>
  108. </template>
  109. </el-table-column>
  110. </el-table>
  111. <el-pagination v-show="activeName === '2'" v-if="sampleList" @size-change="handleSampleSizeChange"
  112. @current-change="handleSampleCurrentChange" :current-page="samplePagination.currentPage"
  113. :page-sizes="[10, 20, 50, 100]" :page-size="samplePagination.pageSize"
  114. layout="total, sizes, prev, pager, next, jumper" :total="sampleList.length"
  115. style="margin-top: 10px"></el-pagination>
  116. <!-- -->
  117. <el-table v-show="activeName === '3'" ref="showSchemeListTable" :data="paginatedSchemeList"
  118. tooltip-effect="dark" :max-height="300" border row-key="id">
  119. <el-table-column label="序号" type="index" width="50" align="center"></el-table-column>
  120. <el-table-column label="质检方案编码" prop="qualitySchemeTemplateCode" align="center">
  121. </el-table-column>
  122. <el-table-column label="质检方案名称" prop="qualitySchemeTemplateName" align="center"></el-table-column>
  123. <el-table-column label="质检类型" prop="categoryLevelClassName" align="center"></el-table-column>
  124. <el-table-column label="质检项编码" prop="inspectionCode" align="center"></el-table-column>
  125. <el-table-column label="质检项名称" prop="inspectionName" align="center"></el-table-column>
  126. <el-table-column label="工艺参数" prop="defaultValue" align="center">
  127. </el-table-column>
  128. </el-table>
  129. <el-pagination v-show="activeName === '3'" @size-change="handleSchemeSizeChange"
  130. @current-change="handleSchemeCurrentChange" :current-page="schemePagination.currentPage"
  131. :page-sizes="[10, 20, 50, 100]" :page-size="schemePagination.pageSize"
  132. layout="total, sizes, prev, pager, next, jumper" :total="schemeList.length"
  133. style="margin-top: 10px"></el-pagination>
  134. </el-row>
  135. </el-card>
  136. <sampleListDialog ref="detailRef" @handleConfirm="handleConfirm" @handleDispose="handleDispose"></sampleListDialog>
  137. <sampleDisposeDialog ref="disposeRef" @handleDisposeConfirm="handleDisposeConfirm"></sampleDisposeDialog>
  138. </div>
  139. </template>
  140. <script>
  141. import baseInfo from './components/baseInfo.vue';
  142. import { getCode } from '@/api/login';
  143. import { save, update, getById, exeReportWork, queryQualitySamplContent, queryQualityTempleContent, queryQualityInventory } from '@/api/inspectionWork';
  144. import dictMixins from '@/mixins/dictMixins';
  145. // import term from './term';
  146. import sampleListDialog from './components/sampleListDialog.vue';
  147. import sampleDisposeDialog from './components/sampleDisposeDialog.vue';
  148. import { finishPageTab } from '@/utils/page-tab-util';
  149. export default {
  150. components: {
  151. baseInfo,
  152. // term
  153. sampleListDialog,
  154. sampleDisposeDialog
  155. },
  156. mixins: [dictMixins],
  157. data() {
  158. const defaultForm = function () {
  159. return {
  160. code: '',
  161. qualityType: null,
  162. qualityModeproduceRoutingId: '',
  163. produceRoutingName: '',
  164. produceTaskId: '',
  165. produceTaskName: '',
  166. productName: '',
  167. productCode: '',
  168. batchNo: '',
  169. specification: '',
  170. modelType: '',
  171. brandNo: '',
  172. total: '',
  173. qualifiedNumber: '',
  174. noQualifiedNumber: '',
  175. groupId: '',
  176. groupName: '',
  177. qualityId: '',
  178. qualityName: '',
  179. qualityTime: '',
  180. hours: '',
  181. qualificationRate: '',
  182. noQualificationRate: '',
  183. totalWeight: '',
  184. sampleNumber: '',
  185. imgUrl: [],
  186. qualityTimeStart: '',
  187. qualityTimeEnd: ''
  188. };
  189. };
  190. return {
  191. defaultForm,
  192. // 表单数据
  193. form: { ...defaultForm() },
  194. voList: [],
  195. // 表单验证规则
  196. categoryParamList: [],
  197. type: '',
  198. title: '',
  199. loading: false,
  200. tabTaskId: null,
  201. activeName: '2',
  202. qualityResultsList: [{
  203. value: 1,
  204. label: '合格'
  205. },
  206. {
  207. value: 2,
  208. label: '不合格'
  209. },
  210. {
  211. value: 3,
  212. label: '让步接收'
  213. }],
  214. tableColumns: [
  215. {
  216. label: '编码',
  217. prop: 'categoryCode',
  218. width: '160',
  219. align: 'center',
  220. fixed: 'left'
  221. },
  222. {
  223. label: '名称',
  224. prop: 'categoryName',
  225. width: '150',
  226. align: 'center'
  227. },
  228. { label: '批次号', prop: 'batchNo', align: 'center' },
  229. { label: '发货条码', prop: 'barcodes', align: 'center' },
  230. { label: '包装编码', prop: 'packageNo', align: 'center' },
  231. // { label: '包装数量', prop: 'packingQuantity', align: 'center' },
  232. { label: '包装单位', prop: 'packingUnit', align: 'center' },
  233. { label: '计量数量', prop: 'measureQuantity', align: 'center' },
  234. { label: '计量单位', prop: 'measureUnit', align: 'center' },
  235. { label: '物料代号', prop: 'materielDesignation', align: 'center' },
  236. { label: '客户代号', prop: 'clientCode', align: 'center' },
  237. { label: '刻码', prop: 'engrave', align: 'center' },
  238. { label: '重量', prop: 'weight', align: 'center' },
  239. { label: '重量单位', prop: 'weightUnit', align: 'center' },
  240. { label: '仓库', prop: 'warehouseName', align: 'center' },
  241. { label: '货区', prop: 'areaName', align: 'center' },
  242. { label: '货架', prop: 'goodsShelfName', align: 'center' },
  243. { label: '货位', prop: 'goodsAllocationName', align: 'center' },
  244. { label: '生产日期', prop: 'productionDate', align: 'center' },
  245. { label: '采购日期', prop: 'purchaseDate', align: 'center' },
  246. ],
  247. packingList: [],
  248. pagination: {
  249. currentPage: 1,
  250. pageSize: 10,
  251. total: 0
  252. },
  253. sampleList: [],
  254. samplePagination: {
  255. currentPage: 1,
  256. pageSize: 10,
  257. total: 0
  258. },
  259. schemeList: [],
  260. schemePagination: {
  261. currentPage: 1,
  262. pageSize: 10,
  263. total: 0
  264. },
  265. isValid: true,
  266. isStatus: true,
  267. SampleListbyReportList: [],
  268. qualityTimeStart: ''
  269. };
  270. },
  271. watch: {
  272. '$route.query.id': {
  273. handler(id) {
  274. if (id) {
  275. this.getDetail();
  276. } else {
  277. this.form = { ...defaultForm() };
  278. }
  279. }
  280. },
  281. },
  282. computed: {
  283. paginatedPackingList() {
  284. const start =
  285. (this.pagination.currentPage - 1) * this.pagination.pageSize;
  286. const end = start + this.pagination.pageSize;
  287. return this.packingList.slice(start, end);
  288. },
  289. // 分页后的样品列表
  290. paginatedSampleList() {
  291. const { currentPage, pageSize } = this.samplePagination;
  292. const start = (currentPage - 1) * pageSize;
  293. const end = start + pageSize;
  294. return this.sampleList?.slice(start, end);
  295. },
  296. // 分页后的质检方案列表
  297. paginatedSchemeList() {
  298. const { currentPage, pageSize } = this.schemePagination;
  299. const start = (currentPage - 1) * pageSize;
  300. const end = start + pageSize;
  301. return this.schemeList?.slice(start, end);
  302. }
  303. },
  304. created() {
  305. this.open()
  306. if (this.$route.query.id) {
  307. this.getDetail();
  308. }
  309. },
  310. methods: {
  311. checkSelectable(row, index) {
  312. // 只有当质检方式为抽检(qualityMode=2)时才可选
  313. return this.form.qualityMode === 2;
  314. },
  315. changeModel(val) {
  316. this.form.qualityMode = val;
  317. if (this.form.qualityMode == 1) {
  318. this.sampleList = this.packingList;
  319. this.samplePagination.currentPage = 1;
  320. this.samplePagination.total = this.packingList.length;
  321. } else {
  322. this.sampleList = [];
  323. }
  324. },
  325. changeNumber(val) {
  326. if (this.form.qualityMode !== 2) {
  327. return;
  328. }
  329. if (val <= 0) {
  330. this.$refs.showPackingListTable.clearSelection();
  331. return;
  332. }
  333. if (val > this.packingList.length) {
  334. this.$message.warning('取样数量不能大于物料明细总数!');
  335. return;
  336. }
  337. const rows = this.packingList.slice(0, val);
  338. rows.forEach((row) => {
  339. this.$refs.showPackingListTable.toggleRowSelection(row);
  340. });
  341. },
  342. getNowDate() {
  343. let date = new Date(),
  344. obj = {
  345. year: date.getFullYear(), //获取当前月份(0-11,0代表1月)
  346. month: date.getMonth() + 1, //获取当前月份(0-11,0代表1月)
  347. strDate: date.getDate(), // 获取当前日(1-31)
  348. hour: date.getHours(), //获取当前小时(0 ~ 23)
  349. minute: date.getMinutes(), //获取当前分钟(0 ~ 59)
  350. second: date.getSeconds() //获取当前秒数(0 ~ 59)
  351. };
  352. Object.keys(obj).forEach((key) => {
  353. if (obj[key] < 10) obj[key] = `0${obj[key]}`;
  354. });
  355. return obj;
  356. },
  357. handleSelectionChange1(selection) {
  358. console.log(selection, '勾选列表');
  359. if (this.form.qualityMode === 2) {
  360. this.selectedList = selection;
  361. this.sampleList = selection;
  362. this.samplePagination.currentPage = 1;
  363. this.samplePagination.total = selection.length;
  364. this.form.sampleNumber = selection.length;
  365. }
  366. },
  367. async open() {
  368. this.type = this.$route.query.type;
  369. this.qualityType = this.$route.query.qualityType;
  370. this.title = this.type == 'add' ? '新增' : this.type == 'edit' ? '报工' : '详情';
  371. if (this.type == 'add') {
  372. const code = await getCode('quality_work_order_code');
  373. this.form.code = code;
  374. } else {
  375. if (this.$route.query.qualityTimeStart != '' || this.$route.query.qualityTimeStart != null || this.$route.query.qualityTimeStart != undefined) {
  376. this.qualityTimeStart = this.getNowTime();
  377. console.log(this.qualityTimeStart, '开始报工时间')
  378. }
  379. }
  380. },
  381. getNowTime() {
  382. const nowDate = this.getNowDate()
  383. return nowDate.year + '-' + nowDate.month + '-' + nowDate.strDate + ' ' + nowDate.hour + ':' + nowDate.minute + ':' + nowDate.second
  384. },
  385. getNowTimes() {
  386. const nowDate = this.getNowDate()
  387. return nowDate.year + '-' + nowDate.month + '-' + nowDate.strDate
  388. },
  389. async getDetail() {
  390. getById(this.$route.query.id).then((res) => {
  391. this.form = res.data;
  392. this.tabTaskId =
  393. this.categoryParamList[0] && this.categoryParamList[0].id;
  394. if (this.form.groupId) {
  395. this.$nextTick(() => {
  396. if (this.$refs.baseInfoRefs) {
  397. this.$refs.baseInfoRefs.getUserList({
  398. groupId: this.form.groupId
  399. });
  400. this.$refs.baseInfoRefs.getTaskList();
  401. }
  402. });
  403. }
  404. });
  405. await this.queryQualityInventory()
  406. await this.queryQualitySamplContent()
  407. await this.queryQualityTempleContent()
  408. },
  409. async queryQualityInventory() {
  410. let res = await queryQualityInventory({ qualityWorkerId: this.$route.query.id });
  411. console.log(res, '清单列表');
  412. this.packingList = res;
  413. this.samplePagination.currentPage = 1;
  414. this.samplePagination.total = this.packingList.length;
  415. },
  416. async queryQualitySamplContent() {
  417. const res = await queryQualitySamplContent({ qualityWorkerId: this.$route.query.id })
  418. let addStatus = res.map((item) => {
  419. item.isValid = true;
  420. item.disposeTime = item.disposeTime ? item.disposeTime.split(' ')[0] : null;
  421. item.sampleDate = item.sampleDate ? item.sampleDate.split(' ')[0] : null;
  422. return {
  423. ...item
  424. }
  425. })
  426. console.log(addStatus, '样品清单')
  427. //样品
  428. this.sampleList = addStatus;
  429. this.samplePagination.currentPage = 1;
  430. this.samplePagination.total = this.sampleList.length;
  431. },
  432. async queryQualityTempleContent() {
  433. const res = await queryQualityTempleContent({ qualityWorkerId: this.$route.query.id })
  434. console.log(res, '222');
  435. // 方案
  436. this.schemeList = res;
  437. this.schemePagination.currentPage = 1;
  438. this.schemePagination.total = this.schemeList.length;
  439. },
  440. handleClick(tab) {
  441. this.activeName = tab.name;
  442. },
  443. // 来料清单列表分页方法
  444. handleSizeChange(val) {
  445. this.pagination.pageSize = val;
  446. this.pagination.currentPage = 1;
  447. },
  448. handleCurrentChange(val) {
  449. this.pagination.currentPage = val;
  450. },
  451. // 样品列表分页方法
  452. handleSampleSizeChange(val) {
  453. this.samplePagination.pageSize = val;
  454. this.samplePagination.currentPage = 1;
  455. },
  456. handleSampleCurrentChange(val) {
  457. this.samplePagination.currentPage = val;
  458. },
  459. // 质检方案分页方法
  460. handleSchemeSizeChange(val) {
  461. this.schemePagination.pageSize = val;
  462. this.schemePagination.currentPage = 1;
  463. },
  464. handleSchemeCurrentChange(val) {
  465. this.schemePagination.currentPage = val;
  466. },
  467. /* 保存编辑 */
  468. save() {
  469. this.$refs.baseInfoRefs.$refs.form1.validate((valid) => {
  470. if (!valid) {
  471. return false;
  472. }
  473. this.loading = true;
  474. let URL =
  475. this.type == 'add' ? save : this.type == 'edit' ? update : '';
  476. let params = {
  477. ...this.form,
  478. sampleList: this.sampleList,
  479. planTemplateList: this.schemeList,
  480. qualityInventoryList: this.packingList
  481. }
  482. URL(params)
  483. .then((msg) => {
  484. this.loading = false;
  485. this.$message.success(msg);
  486. this.cancel();
  487. this.$emit('done');
  488. })
  489. .catch((e) => {
  490. this.loading = false;
  491. });
  492. });
  493. },
  494. update() {
  495. this.loading = true;
  496. this.form['status'] = 1;
  497. update({ ...this.form })
  498. .then((msg) => {
  499. this.loading = false;
  500. this.$message.success(msg);
  501. this.$emit('done');
  502. })
  503. .catch((e) => {
  504. this.loading = false;
  505. });
  506. },
  507. restForm() {
  508. this.form = { ...this.defaultForm() };
  509. this.$nextTick(() => {
  510. this.$refs.baseInfoRefs.$refs.form1.clearValidate();
  511. });
  512. },
  513. cancel() {
  514. finishPageTab();
  515. this.$router.go(-1);
  516. },
  517. handleDetail(index, row, type) {
  518. if (!this.sampleList[index] || !this.schemeList) {
  519. return;
  520. }
  521. const selectedData = [];
  522. selectedData.push(this.sampleList[index])
  523. this.$refs.detailRef.openDia(index, row, type, selectedData, null);
  524. },
  525. handleDispose(index, row, type) {
  526. if (!this.sampleList[index]) {
  527. return;
  528. }
  529. this.sampleList[index].sampleDate = this.getNowTimes();
  530. this.sampleList[index].disposeTime = this.getNowTimes();
  531. console.log(index, row, type, this.qualityType)
  532. this.$refs.disposeRef.openDispose(index, row, type, this.qualityType);
  533. },
  534. // 报工
  535. handleReporting(index, row) {
  536. this.$refs.baseInfoRefs.$refs.form1.validate((valid) => {
  537. if (!valid) {
  538. return false;
  539. }
  540. // let form = {
  541. // qualityTimeEnd: this.getNowTime(),
  542. // qualityTimeStart: this.qualityTimeStart,
  543. // ...this.form,
  544. // }
  545. this.form.qualityTimeEnd = new Date(this.getNowTime())
  546. this.form.qualityTimeStart = new Date(this.qualityTimeStart)
  547. let params = {
  548. ...this.form,
  549. sampleList: this.sampleList,
  550. planTemplateList: this.schemeList,
  551. qualityInventoryList: this.packingList
  552. }
  553. console.log(params, 'params')
  554. exeReportWork(params)
  555. .then((msg) => {
  556. this.loading = false;
  557. this.$message.success(msg);
  558. this.cancel();
  559. this.$emit('done');
  560. })
  561. .catch((e) => {
  562. this.loading = false;
  563. });
  564. })
  565. },
  566. // 处理确认事件
  567. handleDisposeConfirm(row, index) {
  568. if (index > -1) {
  569. this.$set(this.sampleList, index, row)
  570. }
  571. },
  572. //确认报工
  573. handleConfirm(list, index) {
  574. console.log(list)
  575. // 检查有效性
  576. for (const item of list) {
  577. for (const child of item.qualitySampleTemplateList) {
  578. console.log(child, 'child')
  579. if (!child.qualityResultContent || !child.qualityResults) {
  580. this.$message.error('请完善报工内容!');
  581. return;
  582. }
  583. }
  584. }
  585. console.log(list, 'listlistlistlist')
  586. list.forEach((item) => {
  587. if (item.qualitySampleTemplateList.some(child => child.qualityResults === 2)) {
  588. item.isValid = false;
  589. item.qualityResults = 2;
  590. } else {
  591. item.isValid = true;
  592. item.qualityResults = 1;
  593. }
  594. item.qualityStatus = 1;
  595. })
  596. if (index != null) {
  597. this.$set(this.sampleList, index, list[0]);
  598. } else {
  599. this.$set(this.sampleList, null, list);
  600. }
  601. console.log(this.sampleList, '222表')
  602. },
  603. // 批量质检
  604. batchQuality(index, row, type) {
  605. this.$refs.detailRef.openDia(null, null, type, this.sampleList, null)
  606. }
  607. }
  608. };
  609. </script>
  610. <style lang="scss" scoped></style>