new-edit.vue 91 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683
  1. <!-- 用户编辑弹窗 -->
  2. <template>
  3. <ele-modal
  4. :title="title"
  5. :visible.sync="visible"
  6. :before-close="handleClose"
  7. :close-on-click-modal="false"
  8. :close-on-press-escape="false"
  9. append-to-body
  10. width="80%"
  11. :maxable="true"
  12. >
  13. <header-title title="基本信息"></header-title>
  14. <base-info
  15. ref="baseInfoRefs"
  16. v-if="baseForm"
  17. :form="baseForm"
  18. :btnType="btnType"
  19. :isChangeNumber="isChangeNumber"
  20. :isChangeType="isChangeType"
  21. @resetTable="resetTable"
  22. @changeModel="changeModel"
  23. @getList="getList"
  24. @table2="table2"
  25. @changeType="changeType"
  26. @changeSource="changeSource"
  27. @getInspectionStandards="getInspectionStandards"
  28. :packingLists="packingList"
  29. @getCategoryInfo="getCategoryInfo"
  30. @changeProductNumberModel="changeProductNumberModel"
  31. @changesStokledgerNumberModal="changesStokledgerNumberModal"
  32. @getQualityTemplate="getQualityTemplate"
  33. ></base-info>
  34. <el-row>
  35. <header-title title="质检内容"></header-title>
  36. <el-tabs v-model="activeName" @tab-click="handleClick">
  37. <el-tab-pane label="来源清单" name="1">
  38. <!-- <ele-pro-table
  39. ref="table12"
  40. :columns="tableColumns"
  41. :datasource="datasource"
  42. :needPage="
  43. btnType == 'add' ||
  44. (btnType == 'edit' && !isFormNumber && !isOrder)
  45. ? false
  46. : true
  47. "
  48. @selection-change="handleSelectionChange"
  49. > -->
  50. <!-- :datasource="sourceList" -->
  51. <!-- :datasource="
  52. btnType == 'add' ||
  53. (btnType == 'edit' && (!isPackingList || !isSampleList))
  54. ? sourceList
  55. : datasource
  56. " -->
  57. <!-- 来料列表表格 -->
  58. <ele-pro-table
  59. ref="table12"
  60. :columns="tableColumns"
  61. :datasource="sourceList"
  62. @selection-change="handleSelectionChange"
  63. >
  64. <template
  65. v-slot:toolbar
  66. v-if="this.baseForm.qualityMode == 2 && btnType != 'detail'"
  67. >
  68. <el-dropdown trigger="click" @command="handleSampleNumber">
  69. <el-link type="primary" icon="el-icon-plus">取样</el-link>
  70. <el-dropdown-menu slot="dropdown">
  71. <el-dropdown-item command="1">取整样</el-dropdown-item>
  72. <el-dropdown-item command="2">取小样</el-dropdown-item>
  73. </el-dropdown-menu>
  74. </el-dropdown>
  75. </template>
  76. <template v-slot:toolkit v-if="this.baseForm.qualityMode == 2">
  77. <el-row>
  78. <el-form
  79. ref="ruleForm"
  80. :model="formData"
  81. label-width="60px"
  82. size="mini"
  83. :rules="rules"
  84. class="flex"
  85. :show-message="false"
  86. >
  87. <el-col :span="6" v-if="conditionType == 2">
  88. <el-form-item
  89. prop="number"
  90. label-width="0"
  91. style="margin-bottom: 0"
  92. >
  93. <el-input
  94. v-model="formData.number"
  95. placeholder="请输入"
  96. size="mini"
  97. ></el-input>
  98. </el-form-item>
  99. </el-col>
  100. <el-col :span="6" v-if="conditionType == 2">
  101. <el-form-item
  102. prop="sampleUnit"
  103. label-width="0"
  104. style="margin: 0"
  105. >
  106. <DictSelection
  107. dictName="计量单位"
  108. clearable
  109. v-model="formData.sampleUnit"
  110. size="mini"
  111. @change="changeSamUnit"
  112. ></DictSelection>
  113. </el-form-item>
  114. </el-col>
  115. <el-col :span="8" v-if="conditionType == 2">
  116. <el-form-item prop="portion" label="数量" style="margin: 0">
  117. <el-input
  118. v-model="formData.portion"
  119. placeholder="请输入"
  120. size="mini"
  121. clearable
  122. ></el-input>
  123. </el-form-item>
  124. </el-col>
  125. <el-col :span="24" v-if="conditionType == 1">
  126. <el-form-item prop="portion" label="数量" style="margin: 0">
  127. <el-input
  128. v-model="formData.portion"
  129. placeholder="请输入"
  130. size="mini"
  131. clearable
  132. ></el-input>
  133. </el-form-item>
  134. </el-col>
  135. <el-col
  136. :span="4"
  137. style="text-align: right"
  138. v-if="conditionType == 1"
  139. >
  140. <el-button
  141. type="primary"
  142. size="mini"
  143. @click="handleExtractFull"
  144. style="margin-right: 12px"
  145. >确认</el-button
  146. >
  147. </el-col>
  148. <el-col
  149. :span="4"
  150. style="text-align: right"
  151. v-if="conditionType == 2"
  152. >
  153. <el-button
  154. type="primary"
  155. size="mini"
  156. @click="handleExtractFull"
  157. style="margin-right: 12px"
  158. >确认</el-button
  159. >
  160. </el-col>
  161. </el-form>
  162. </el-row>
  163. </template>
  164. </ele-pro-table>
  165. </el-tab-pane>
  166. <el-tab-pane label="样品清单" name="2">
  167. <el-table
  168. v-show="activeName === '2'"
  169. v-if="sampleList.length > 0"
  170. ref="showSampleListTable"
  171. :data="paginatedSampleList"
  172. tooltip-effect="dark"
  173. :max-height="300"
  174. border
  175. row-key="sampleCode"
  176. >
  177. <el-table-column
  178. label="序号"
  179. type="index"
  180. width="50"
  181. align="center"
  182. ></el-table-column>
  183. <template v-for="column in tableColumns2">
  184. <el-table-column
  185. :key="column.prop"
  186. :label="column.label"
  187. :prop="column.prop"
  188. :show-overflow-tooltip="true"
  189. :width="column.width"
  190. :align="column.align"
  191. ></el-table-column>
  192. </template>
  193. </el-table>
  194. <el-pagination
  195. v-show="activeName === '2' && sampleList.length > 0"
  196. @size-change="handleSampleSizeChange"
  197. @current-change="handleSampleCurrentChange"
  198. :current-page="samplePagination.currentPage"
  199. :page-sizes="[10, 20, 50, 100]"
  200. :page-size="samplePagination.pageSize"
  201. layout="total, sizes, prev, pager, next, jumper"
  202. :total="samplePagination.total"
  203. style="margin-top: 10px"
  204. ></el-pagination>
  205. </el-tab-pane>
  206. <el-tab-pane label="质检方案" name="3">
  207. <el-button
  208. @click="addInspectionTemplate(baseForm.type)"
  209. type="primary"
  210. style="margin-top: 5px"
  211. >选择质检方案</el-button
  212. >
  213. <el-table
  214. v-show="activeName === '3'"
  215. v-if="schemeList.length > 0"
  216. ref="showSchemeListTable"
  217. :data="paginatedSchemeList"
  218. tooltip-effect="dark"
  219. :max-height="300"
  220. border
  221. row-key="id"
  222. >
  223. <el-table-column
  224. label="序号"
  225. type="index"
  226. width="50"
  227. align="center"
  228. ></el-table-column>
  229. <el-table-column
  230. label="质检方案编码"
  231. prop="qualitySchemeTemplateCode"
  232. align="center"
  233. width="170"
  234. ></el-table-column>
  235. <el-table-column
  236. label="质检方案名称"
  237. prop="qualitySchemeTemplateName"
  238. align="center"
  239. width="170"
  240. ></el-table-column>
  241. <el-table-column
  242. label="质检类型"
  243. prop="categoryLevelClassName"
  244. align="center"
  245. width="170"
  246. ></el-table-column>
  247. <el-table-column
  248. label="质检项编码"
  249. prop="inspectionCode"
  250. align="center"
  251. width="170"
  252. ></el-table-column>
  253. <el-table-column
  254. label="质检项名称"
  255. prop="inspectionName"
  256. align="center"
  257. width="150"
  258. ></el-table-column>
  259. <el-table-column
  260. label="工艺参数"
  261. prop="defaultValue"
  262. align="center"
  263. >
  264. <template slot-scope="scope">
  265. <div style="display: flex; flex-direction: row">
  266. <DictSelection
  267. v-if="btnType != 'detail'"
  268. style="width: 85px"
  269. clearable
  270. dictName="数学字符"
  271. v-model="scope.row.symbol"
  272. ></DictSelection>
  273. <el-input
  274. :disabled="btnType == 'detail'"
  275. v-model="scope.row.defaultValue"
  276. placeholder="请输入内容"
  277. style="width: 120px"
  278. ></el-input>
  279. <DictSelection
  280. v-if="btnType != 'detail'"
  281. dictName="工艺参数单位"
  282. clearable
  283. filterable
  284. v-model="scope.row.unitName"
  285. style="width: 100px"
  286. >
  287. </DictSelection>
  288. </div>
  289. </template>
  290. </el-table-column>
  291. <el-table-column fixed="right" label="操作" width="80">
  292. <template slot-scope="scope">
  293. <el-popconfirm
  294. class="ele-action"
  295. title="确定要删除当前方案吗?"
  296. @confirm="handDel(scope.$index)"
  297. >
  298. <template v-slot:reference>
  299. <el-link
  300. type="danger"
  301. :underline="false"
  302. icon="el-icon-delete"
  303. >
  304. 删除
  305. </el-link>
  306. </template>
  307. </el-popconfirm>
  308. </template>
  309. </el-table-column>
  310. </el-table>
  311. <el-pagination
  312. v-show="activeName === '3' && schemeList.length > 0"
  313. @size-change="handleSchemeSizeChange"
  314. @current-change="handleSchemeCurrentChange"
  315. :current-page="schemePagination.currentPage"
  316. :page-sizes="[10, 20, 50, 100]"
  317. :page-size="schemePagination.pageSize"
  318. layout="total, sizes, prev, pager, next, jumper"
  319. :total="schemePagination.total"
  320. style="margin-top: 10px"
  321. ></el-pagination>
  322. </el-tab-pane>
  323. </el-tabs>
  324. </el-row>
  325. <template v-slot:footer>
  326. <el-button @click="handleClose">取消</el-button>
  327. <el-button
  328. v-if="btnType != 'detail' && btnType != 'issued'"
  329. type="primary"
  330. :loading="loading"
  331. @click="handleSave"
  332. >保存</el-button
  333. >
  334. <el-button
  335. v-if="btnType != 'detail'"
  336. type="primary"
  337. :loading="loading"
  338. @click="handleIssued"
  339. >下发</el-button
  340. >
  341. <!-- 选择质检方案 -->
  342. <inspectionTemplateDialog
  343. v-if="baseForm"
  344. :type="baseForm.type"
  345. ref="inspectionTemplateRef"
  346. @choose="inspectionTemplateSuccess"
  347. ></inspectionTemplateDialog>
  348. </template>
  349. </ele-modal>
  350. </template>
  351. <script>
  352. // import baseInfo from './baseInfo.vue';
  353. import baseInfo from './new-baseInfo.vue';
  354. // 质检方案的弹窗
  355. import inspectionTemplateDialog from '@/views/inspectionTemplate/components/inspectionTemplateDialog.vue';
  356. import { getCode } from '@/api/login';
  357. import { save, update, planIssued } from '@/api/inspectionPlan';
  358. import {
  359. getQualityTemplateList,
  360. getTemplateListByPlanId,
  361. getSampleListByPlanId,
  362. getInventoryListByPlanId,
  363. outInRecordsPage,
  364. getBatchInfoData,
  365. getProductOrder,
  366. getProductSteup
  367. } from '@/api/inspectionPlan/index.js';
  368. import { getQualityTemplateByIds } from '@/api/inspectionTemplate';
  369. export default {
  370. components: {
  371. baseInfo,
  372. inspectionTemplateDialog
  373. },
  374. data() {
  375. const defaultForm = function () {
  376. return {
  377. id: '',
  378. code: '',
  379. name: '',
  380. type: '',
  381. qualityMode: '',
  382. inspectionStandards: '',
  383. autoOrder: '',
  384. groupId: '',
  385. groupName: '',
  386. executeId: '',
  387. executeName: '',
  388. planStartTime: '',
  389. planEndTime: '',
  390. standard: '',
  391. planSource: '',
  392. planSourceCode: '',
  393. productName: '',
  394. productCode: '',
  395. batchNo: '',
  396. specification: '',
  397. modelType: '',
  398. brandNo: '',
  399. productNumber: '',
  400. qualifiedNumber: '',
  401. unqualifiedNumber: '',
  402. qualificationRate: '',
  403. totalWeight: '',
  404. sampleNumber: null,
  405. sampleMeasureUnit: '',
  406. sampleProportion: '',
  407. supplierMark: '',
  408. remark: '',
  409. accessory: [],
  410. conditionType: 1
  411. };
  412. };
  413. return {
  414. defaultForm,
  415. // 表单数据
  416. baseForm: { ...defaultForm() },
  417. tableColumns2: [
  418. {
  419. label: '样品编码',
  420. prop: 'sampleCode',
  421. width: '150',
  422. align: 'center'
  423. },
  424. {
  425. label: '编码',
  426. prop: 'categoryCode',
  427. width: '150',
  428. align: 'center'
  429. },
  430. {
  431. label: '名称',
  432. prop: 'categoryName',
  433. width: '150',
  434. align: 'center'
  435. },
  436. { label: '批次号', prop: 'batchNo', align: 'center', width: 120 },
  437. { label: '发货条码', prop: 'barcodes', align: 'center' },
  438. { label: '包装编码', prop: 'packageNo', align: 'center' },
  439. { label: '计量数量', prop: 'measureQuantity', align: 'center' },
  440. { label: '计量单位', prop: 'measureUnit', align: 'center' },
  441. { label: '物料代号', prop: 'materielDesignation', align: 'center' },
  442. { label: '客户代号', prop: 'clientCode', align: 'center' },
  443. { label: '刻码', prop: 'engrave', align: 'center' },
  444. // { prop: 'specification', label: '规格', align: 'center', width: 100, showOverflowTooltip: true },
  445. // { prop: 'brandNum', label: '牌号', align: 'center', width: 100, showOverflowTooltip: true },
  446. // { prop: 'modelType', label: '型号', align: 'center', width: 100, showOverflowTooltip: true },
  447. { label: '重量', prop: 'weight', align: 'center' },
  448. { label: '重量单位', prop: 'weightUnit', align: 'center' },
  449. { label: '仓库', prop: 'warehouseName', align: 'center' },
  450. { label: '货区', prop: 'areaName', align: 'center' },
  451. { label: '货架', prop: 'goodsShelfName', align: 'center' },
  452. { label: '货位', prop: 'goodsAllocationName', align: 'center' },
  453. { label: '生产日期', prop: 'productionDate', align: 'center' },
  454. { label: '采购日期', prop: 'purchaseDate', align: 'center' }
  455. ],
  456. packingList: [],
  457. sourceList: [],
  458. sourcePagination: {
  459. currentPage: 1,
  460. pageSize: 10,
  461. total: 0
  462. },
  463. sampleList: [],
  464. samplePagination: {
  465. currentPage: 1,
  466. pageSize: 10,
  467. total: 0
  468. },
  469. schemeList: [],
  470. schemePagination: {
  471. currentPage: 1,
  472. pageSize: 10,
  473. total: 0
  474. },
  475. // 表单验证规则
  476. visible: false,
  477. btnType: null,
  478. title: null,
  479. loading: false,
  480. listPage: [],
  481. activeName: '1',
  482. selectedList: [],
  483. isCheck: false, // 是否拆包 false 不拆包 true 拆包
  484. rowIds: '',
  485. formData: {
  486. number: 1,
  487. sampleUnit: '',
  488. portion: null
  489. },
  490. rules: {
  491. number: [
  492. {
  493. required: true,
  494. message: '请输入',
  495. trigger: 'blur'
  496. }
  497. ],
  498. sampleUnit: [
  499. {
  500. required: true,
  501. message: '请选择样品单位',
  502. trigger: 'change'
  503. }
  504. ],
  505. portion: [
  506. {
  507. required: true,
  508. message: '请输入',
  509. trigger: 'blur'
  510. }
  511. ]
  512. },
  513. isScheme: true,
  514. isOrder: true,
  515. isConsumable: '', //0 单件 1批量
  516. netWeight: '', // 净重
  517. conditionType: null,
  518. isFormNumber: true,
  519. sampleListCode: '',
  520. productItem: {}, //产品信息
  521. isUpdateData: true,
  522. isChangeNumber: true,
  523. isChangeType: true,
  524. isOnce: true,
  525. dimensionType: '',
  526. isSampleList: true,
  527. isPackingList: true,
  528. isSchemeList: true,
  529. newSampleList: [],
  530. kkconditionType: ''
  531. };
  532. },
  533. computed: {
  534. tableColumns() {
  535. let arr = [
  536. // (this.btnType !== 'issued' || this.baseForm.qualityMode === 2)
  537. // ? {
  538. // columnKey: 'selection',
  539. // type: 'selection',
  540. // width: 45,
  541. // align: 'center'
  542. // }
  543. // : null,
  544. {
  545. columnKey: 'selection',
  546. type: 'selection',
  547. width: 45,
  548. align: 'center'
  549. },
  550. {
  551. columnKey: 'index',
  552. label: '序号',
  553. type: 'index',
  554. width: 55,
  555. align: 'center',
  556. fixed: 'left'
  557. },
  558. {
  559. label: '编码',
  560. prop: 'categoryCode',
  561. width: 150,
  562. align: 'center',
  563. showOverflowTooltip: true
  564. },
  565. {
  566. label: '名称',
  567. prop: 'categoryName',
  568. width: '150',
  569. align: 'center',
  570. width: 120,
  571. showOverflowTooltip: true
  572. },
  573. { label: '批次号', prop: 'batchNo', align: 'center', width: 120 },
  574. { label: '发货条码', prop: 'barcodes', align: 'center' },
  575. {
  576. label: '包装编码',
  577. prop: 'packageNo',
  578. align: 'center',
  579. width: 120,
  580. showOverflowTooltip: true
  581. },
  582. { label: '包装数量', prop: 'packingQuantity', align: 'center' },
  583. { label: '包装单位', prop: 'packingUnit', align: 'center' },
  584. { label: '计量数量', prop: 'measureQuantity', align: 'center' },
  585. { label: '计量单位', prop: 'measureUnit', align: 'center' },
  586. { label: '物料代号', prop: 'materielDesignation', align: 'center' },
  587. { label: '客户代号', prop: 'clientCode', align: 'center' },
  588. {
  589. label: '供应商名称',
  590. prop: 'supplierName',
  591. align: 'center',
  592. width: 120,
  593. showOverflowTooltip: true
  594. },
  595. {
  596. label: '供应商代号',
  597. prop: 'supplierCode',
  598. align: 'center',
  599. width: '120'
  600. },
  601. { label: '刻码', prop: 'engrave', align: 'center' },
  602. { label: '重量', prop: 'weight', align: 'center' },
  603. { label: '重量单位', prop: 'weightUnit', align: 'center' },
  604. {
  605. label: '仓库',
  606. prop: 'warehouseName',
  607. align: 'center',
  608. width: 120,
  609. showOverflowTooltip: true
  610. },
  611. { label: '货区', prop: 'areaName', align: 'center' },
  612. { label: '货架', prop: 'goodsShelfName', align: 'center' },
  613. { label: '货位', prop: 'goodsAllocationName', align: 'center' },
  614. {
  615. label: '生产日期',
  616. prop: 'productionDate',
  617. align: 'center',
  618. width: 120,
  619. showOverflowTooltip: true
  620. },
  621. {
  622. label: '采购日期',
  623. prop: 'purchaseDate',
  624. align: 'center',
  625. width: 120,
  626. showOverflowTooltip: true
  627. }
  628. ];
  629. return arr;
  630. },
  631. //分页后的来源列表
  632. paginatedSourceList() {
  633. console.log('分页', this.sourceList);
  634. const { currentPage, pageSize } = this.sourcePagination;
  635. const start = (currentPage - 1) * pageSize;
  636. const end = start + pageSize;
  637. return this.sourceList.slice(start, end);
  638. },
  639. // 分页后的样品列表
  640. paginatedSampleList() {
  641. if (this.rowIds && this.isSampleList) {
  642. console.log(this.sampleList, 'sampleList');
  643. return this.sampleList;
  644. }
  645. const { currentPage, pageSize } = this.samplePagination;
  646. const start = (currentPage - 1) * pageSize;
  647. const end = start + pageSize;
  648. return this.sampleList.slice(start, end);
  649. },
  650. // 分页后的质检方案列表
  651. paginatedSchemeList() {
  652. if (this.rowIds && this.isScheme) {
  653. console.log(this.schemeList, 'test');
  654. return this.schemeList;
  655. }
  656. const { currentPage, pageSize } = this.schemePagination;
  657. const start = (currentPage - 1) * pageSize;
  658. const end = start + pageSize;
  659. return this.schemeList.slice(start, end);
  660. }
  661. },
  662. created() {},
  663. methods: {
  664. //成品检验类型,计划来源主数据,修改数量生成来源清单
  665. changeProductNumberModel(num) {
  666. // if (
  667. // this.btnType == 'add' ||
  668. // (this.btnType == 'edit' && !this.isUpdateData)
  669. // ) {
  670. // this.$refs.table12.setData([]);
  671. // this.isOrder = false;
  672. // let nums = Number(num);
  673. // let p = this.productItem;
  674. // let list = [];
  675. // if (this.isConsumable == 0) {
  676. // for (let i = 0; i < nums; i++) {
  677. // let obj = {
  678. // id: p.id,
  679. // batchNo: p.batchNo,
  680. // categoryCode: p.code, //编码
  681. // categoryName: p.name, //名称
  682. // measureQuantity: 1,
  683. // measureUnit: p.measuringUnit, //计量单位
  684. // weightUnit: p.weightUnit, //重量单位
  685. // weight: p.netWeight //重量
  686. // };
  687. // list.push(obj);
  688. // }
  689. // } else if (this.isConsumable == 1) {
  690. // let obj = {
  691. // id: p.id,
  692. // batchNo: p.batchNo,
  693. // categoryCode: p.code, //编码
  694. // categoryName: p.name, //名称
  695. // measureQuantity: nums, //计量数量
  696. // measureUnit: p.measuringUnit, //计量单位
  697. // weightUnit: p.weightUnit, //重量单位
  698. // weight: p.netWeight * nums //重量
  699. // };
  700. // list.push(obj);
  701. // }
  702. // this.$refs.table12.setData(list);
  703. // // *** 如果检验方式是全量的话 还需要同步样品清单数据
  704. // if (
  705. // this.baseForm.qualityMode == 1 &&
  706. // this.baseForm.inspectionStandards
  707. // ) {
  708. // this.isFormNumber = false;
  709. // this.handleSampleList();
  710. // }
  711. // console.log(this.baseForm, 'form --');
  712. // }
  713. console.log('数据33333');
  714. // this.$refs.table12.setData([]);
  715. this.sourceList = [];
  716. this.packingList = [];
  717. this.isOrder = false;
  718. let nums = Number(num);
  719. let p = this.productItem;
  720. let list = [];
  721. if (this.isConsumable == 0) {
  722. for (let i = 0; i < nums; i++) {
  723. let obj = {
  724. id: p.id,
  725. batchNo: p.batchNo,
  726. categoryCode: p.code, //编码
  727. categoryName: p.name, //名称
  728. measureQuantity: 1,
  729. measureUnit: p.measuringUnit, //计量单位
  730. weightUnit: p.weightUnit, //重量单位
  731. weight: p.netWeight //重量
  732. };
  733. list.push(obj);
  734. }
  735. } else if (this.isConsumable == 1) {
  736. let obj = {
  737. id: p.id,
  738. batchNo: p.batchNo,
  739. categoryCode: p.code, //编码
  740. categoryName: p.name, //名称
  741. measureQuantity: nums, //计量数量
  742. measureUnit: p.measuringUnit, //计量单位
  743. weightUnit: p.weightUnit, //重量单位
  744. weight: p.netWeight * nums //重量
  745. };
  746. list.push(obj);
  747. }
  748. console.log('数据22222');
  749. console.log(this.isOrder);
  750. // this.$refs.table12.setData(list);
  751. this.sourceList = list;
  752. this.packingList = list;
  753. // *** 如果检验方式是全量的话 还需要同步样品清单数据
  754. if (
  755. this.baseForm.qualityMode == 1 &&
  756. this.baseForm.inspectionStandards
  757. ) {
  758. this.isFormNumber = false;
  759. console.log('+++++++++2');
  760. this.handleSampleList();
  761. }
  762. console.log(this.baseForm, 'form --');
  763. },
  764. //成品类型检验类型,计划来源库存台账, 生成来源清单
  765. changesStokledgerNumberModal(val, dimension, type) {
  766. console.log(val, dimension, '获取成品检验订单数据', type);
  767. // this.$refs.table12.setData([]);
  768. this.sourceList = [];
  769. this.packingList = [];
  770. if (dimension) this.dimensionType = dimension;
  771. if (dimension == 3) {
  772. // this.$refs.table12.setData(val);
  773. this.sourceList = val;
  774. this.packingList = val;
  775. this.calculateWeightAndQuantity(val);
  776. if (this.baseForm.qualityMode == '1' || type) {
  777. this.handleUnpackCase(val);
  778. } else if (this.baseForm.qualityMode == '2' || type) {
  779. this.sampleList = [];
  780. }
  781. return;
  782. }
  783. console.log('其他', 'dimension');
  784. let item = val[0];
  785. let num = Number(item.outboundNum);
  786. let list = [];
  787. // let weight = (item.weight / item.measureQuantity).toFixed(2);
  788. let weight = (
  789. (item.weight / item.measureQuantity) *
  790. item.outboundNum
  791. ).toFixed(2);
  792. list.push({
  793. ...item,
  794. id: 1,
  795. packingQuantity: null,
  796. measureQuantity: item.outboundNum,
  797. weight
  798. });
  799. // for (let i = 0; i < num; i++) {
  800. // list.push({
  801. // ...item,
  802. // id: i + 1,
  803. // packingQuantity: null,
  804. // measureQuantity: 1,
  805. // weight
  806. // });
  807. // }
  808. // list.push({
  809. // ...item
  810. // });
  811. console.log(list, 'for循环成品检验订单数据');
  812. // this.$refs.table12.setData(list);
  813. this.sourceList = list;
  814. this.packingList = list;
  815. if (this.baseForm.qualityMode == '1' || type) {
  816. this.handleUnpackCase(list);
  817. } else if (this.baseForm.qualityMode == '2' || type) {
  818. this.sampleList = [];
  819. }
  820. },
  821. // changesStokledgerNumberModal(val, dimension) {
  822. // console.log(val, dimension, '获取成品检验订单数据');
  823. // this.$refs.table12.setData([]);
  824. // if (dimension) this.dimensionType = dimension;
  825. // if (dimension == 3) return this.$refs.table12.setData(val);
  826. // let item = val[0];
  827. // let num = Number(item.outboundNum);
  828. // let list = [];
  829. // let weight = (item.weight / item.measureQuantity).toFixed(2);
  830. // for (let i = 0; i < num; i++) {
  831. // list.push({
  832. // ...item,
  833. // id: i + 1,
  834. // packingQuantity: null,
  835. // measureQuantity: 1,
  836. // weight
  837. // });
  838. // }
  839. // console.log(list, 'for循环成品检验订单数据');
  840. // this.$refs.table12.setData(list);
  841. // if (this.baseForm.qualityMode == '1') {
  842. // this.handleUnpackCase(list);
  843. // } else if (this.baseForm.qualityMode == '2') {
  844. // this.sampleList = [];
  845. // }
  846. // },
  847. //获取基本信息中计量方式
  848. getInspectionStandards(data) {
  849. console.log(data, 'data');
  850. this.baseForm.inspectionStandards = data;
  851. if (this.baseForm.type == '3' && this.baseForm.planSource == '6') {
  852. // this.isOrder = false;
  853. this.handleSampleList();
  854. }
  855. if (this.btnType == 'edit' && !this.isOnce) {
  856. this.isOrder = false;
  857. this.handleSampleList();
  858. }
  859. this.isOnce = false;
  860. },
  861. async datasource({ page, limit, where }) {
  862. // console.log(this.btnType);
  863. // console.log(this.isScheme, this.isOrder);
  864. // const res = await getInventoryListByPlanId({
  865. // ...where,
  866. // pageNum: page,
  867. // size: limit
  868. // });
  869. // console.log(res.list);
  870. // this.packingList = res.list;
  871. // return res;
  872. return await getInventoryListByPlanId({
  873. ...where,
  874. pageNum: page,
  875. size: limit
  876. });
  877. },
  878. // 切换质检内容
  879. handleClick(tab) {
  880. this.activeName = tab.name;
  881. },
  882. async open(type, row) {
  883. this.kkconditionType = row?.conditionType;
  884. this.visible = true;
  885. this.activeName = '1';
  886. this.btnType = type;
  887. this.title =
  888. type == 'add'
  889. ? '新增'
  890. : type == 'edit'
  891. ? '编辑'
  892. : type == 'issued'
  893. ? '下发'
  894. : '详情';
  895. if (this.btnType === 'add') {
  896. const code = await getCode('qms_plan_code');
  897. this.baseForm.code = code;
  898. this.rowIds = '';
  899. return;
  900. } else {
  901. await this.handleEditOrDetail(row);
  902. }
  903. },
  904. addInspectionTemplate(type) {
  905. this.$refs.inspectionTemplateRef.open(type);
  906. },
  907. async inspectionTemplateSuccess(select) {
  908. let data = await getQualityTemplateByIds({
  909. templateIds: select.map((item) => item.id)
  910. });
  911. console.log('---------------------------');
  912. this.isScheme = false;
  913. this.schemeList.push(...data);
  914. const strings = this.schemeList.map((item) => JSON.stringify(item));
  915. const removeDupList = [...new Set(strings)];
  916. const result = removeDupList.map((item) => JSON.parse(item));
  917. this.schemeList = result;
  918. this.schemePagination.total = this.schemeList.length;
  919. },
  920. async handleEditOrDetail(row) {
  921. console.log('row====', row);
  922. row.accessory = row.accessory || [];
  923. this.baseForm = {
  924. ...JSON.parse(JSON.stringify(row)),
  925. groupId: row.groupId,
  926. qualityMode: row.qualityMode
  927. };
  928. this.$nextTick(() => {
  929. if (this.$refs.baseInfoRefs) {
  930. // 获取人员
  931. if (this.baseForm.groupId) {
  932. this.$refs.baseInfoRefs.getUserList({
  933. groupId: this.baseForm.groupId
  934. });
  935. }
  936. //根据类型获取计划来源
  937. if (this.baseForm.type) {
  938. this.$refs.baseInfoRefs.typeChange(this.baseForm.type, '1111');
  939. }
  940. if (this.baseForm.productId) {
  941. this.$refs.baseInfoRefs.getProductDetails(
  942. this.baseForm.productId
  943. );
  944. }
  945. }
  946. });
  947. // 如果是编辑或者详情,则查询物料清单、质检方案和样品列表
  948. if (row.id) {
  949. this.rowIds = row.id;
  950. this.isScheme = true;
  951. this.schemePagination.currentPage = 1;
  952. this.schemePagination.pageSize = 10;
  953. this.schemePagination.total = 0;
  954. this.samplePagination.pageSize = 10;
  955. this.samplePagination.currentPage = 1;
  956. this.samplePagination.total = 0;
  957. this.isFormNumber = true;
  958. this.isOrder = true;
  959. console.log('edit true');
  960. if (row.isUnpack === 1) {
  961. this.isCheck = true;
  962. } else {
  963. this.isCheck = false;
  964. }
  965. await this.getSourceList(row.id);
  966. //操作行点击时查询清单
  967. // await this.getInventoryList();
  968. await this.reload({ planId: row.id });
  969. //操作行点击时查询样品
  970. await this.getSampleList(row.id);
  971. //操作行点击时查询质检
  972. await this.getTemplateList(row.id);
  973. }
  974. },
  975. reload(where) {
  976. this.$nextTick(() => {
  977. if (this.$refs.table12 && this.$refs.table12.reload)
  978. this.$refs.table12.reload({ page: 1, where: where });
  979. });
  980. },
  981. async getSourceList(id) {
  982. const listData = await getInventoryListByPlanId({
  983. planId: id,
  984. pageNum: 1,
  985. size: -1
  986. });
  987. this.sourceList = listData.list;
  988. console.log(this.sourceList);
  989. },
  990. async getSampleList(id) {
  991. let res = await getSampleListByPlanId({
  992. planId: id,
  993. pageNum: this.samplePagination.currentPage,
  994. size: this.samplePagination.pageSize
  995. });
  996. console.log(res.list, 'yyyyyyyyyyyyyy样品----------------------------');
  997. this.sampleList = res?.list || [];
  998. this.samplePagination.total = res.count;
  999. let newRes = await getSampleListByPlanId({
  1000. planId: id,
  1001. pageNum: 1,
  1002. size: -1
  1003. });
  1004. this.newSampleList = newRes?.list || [];
  1005. },
  1006. async getTemplateList(id) {
  1007. let res = await getTemplateListByPlanId({
  1008. planId: id,
  1009. pageNum: this.schemePagination.currentPage,
  1010. size: this.schemePagination.pageSize
  1011. });
  1012. console.log(res.list, 'fffffffffffffff方案--------------------------');
  1013. this.schemeList = res?.list || [];
  1014. this.schemePagination.total = res.count;
  1015. },
  1016. async getList(
  1017. receiveNo,
  1018. productCode,
  1019. productCategoryId,
  1020. productCategoryName,
  1021. categoryid,
  1022. batchNo,
  1023. supplierName,
  1024. supplierMark
  1025. ) {
  1026. //通过来源和产品 获取来料清单
  1027. await this.getGoodsList(
  1028. receiveNo,
  1029. productCode,
  1030. null,
  1031. productCategoryId,
  1032. productCategoryName,
  1033. categoryid,
  1034. batchNo,
  1035. supplierName,
  1036. supplierMark
  1037. );
  1038. //通过来源和产品 获取质检方案
  1039. await this.getQualityTemplate(productCode);
  1040. },
  1041. async getGoodsList(
  1042. receiveNo,
  1043. productCode,
  1044. ids,
  1045. productCategoryId,
  1046. productCategoryName,
  1047. categoryid,
  1048. batchNo,
  1049. supplierName,
  1050. supplierMark
  1051. ) {
  1052. // this.$refs.table12.setData([]);
  1053. this.sourceList = [];
  1054. this.packingList = [];
  1055. let res;
  1056. const res1 = await outInRecordsPage({
  1057. sourceBizNo: receiveNo,
  1058. categoryCode: productCode,
  1059. categoryId: categoryid,
  1060. qualityQlanId: ids,
  1061. size: -1
  1062. });
  1063. console.log(res1, 'res1');
  1064. if (res1.list.length > 0) {
  1065. console.log(res1.list[0].status, 'status=2 不赋值');
  1066. if (res1.list[0].status != 2) {
  1067. res = res1.list;
  1068. this.isCheck = true;
  1069. console.log('this.isCheck=true', this.isCheck);
  1070. } else {
  1071. res = [];
  1072. this.$message.error('此数据已质检,无需再次质检!');
  1073. return;
  1074. }
  1075. } else {
  1076. let resData = await getBatchInfoData({
  1077. sourceBizNo: receiveNo,
  1078. categoryCode: productCode,
  1079. batchNo: batchNo
  1080. });
  1081. console.log(resData, 'resData');
  1082. if (resData) {
  1083. if (resData.qualityControl != 2) {
  1084. this.isCheck = false;
  1085. res = [resData];
  1086. } else {
  1087. res = [];
  1088. this.$message.error('此数据已质检,无需再次质检!');
  1089. return;
  1090. }
  1091. }
  1092. }
  1093. console.log(res, '来料清单');
  1094. if (res.length > 0) {
  1095. const _arr1 = res.map((m) => {
  1096. m.sourceId = m.id;
  1097. m.productCategoryId = productCategoryId;
  1098. m.productCategoryName = productCategoryName;
  1099. delete m.id;
  1100. return { ...m };
  1101. });
  1102. this.packingList = _arr1;
  1103. // this.$refs.table12.setData(_arr1); //赋值
  1104. this.sourceList = _arr1;
  1105. this.packingList = _arr1;
  1106. // const _arr2 = this.$refs.table12.getData();
  1107. // if (_arr2.length > 1) {
  1108. // this.baseForm.productNumber = _arr2.length;
  1109. // } else {
  1110. // this.baseForm.productNumber = _arr2[0].measureQuantity;
  1111. // }
  1112. this.baseForm.totalWeight = this.sourceList.reduce((acc, pre) => {
  1113. return pre.weight ? acc + Number(pre.weight) : acc;
  1114. }, 0);
  1115. if (this.sourceList.length > 1) {
  1116. this.baseForm.productNumber = this.sourceList.reduce((acc, pre) => {
  1117. return pre.measureQuantity
  1118. ? acc + Number(pre.measureQuantity)
  1119. : acc;
  1120. }, 0);
  1121. } else {
  1122. this.baseForm.productNumber = this.sourceList[0].measureQuantity;
  1123. }
  1124. //处理样品清单
  1125. console.log('处理来源清单数据');
  1126. // await this.handleSampleList();
  1127. await this.updatePackingList(_arr1);
  1128. } else {
  1129. console.log('来料清单数据为空');
  1130. // this.$refs.table12.setData([]);
  1131. this.sourceList = val;
  1132. this.packingList = [];
  1133. }
  1134. },
  1135. async handleSampleList() {
  1136. // let packingList = this.$refs.table12.getData();
  1137. if (this.baseForm.type == '1' && this.btnType != 'detail') {
  1138. if (this.baseForm.inspectionStandards == '2') {
  1139. console.log(13131313213);
  1140. this.sampleList = [];
  1141. let list = [];
  1142. if (this.baseForm.productNumber) {
  1143. let p = this.productItem;
  1144. console.log(p);
  1145. let obj = {
  1146. id: p.id,
  1147. batchNo: p.batchNo,
  1148. categoryCode: p.code, //编码
  1149. categoryName: p.name, //名称
  1150. measureQuantity: this.baseForm.productNumber, //计量数量
  1151. measureUnit: p.measuringUnit, //计量单位
  1152. weightUnit: p.weightUnit, //重量单位
  1153. weight: p.netWeight * this.baseForm.productNumber //重量
  1154. };
  1155. list.push(obj);
  1156. }
  1157. if (list.length > 0 && list[0].categoryCode) {
  1158. // this.$refs.table12.setData(list);
  1159. this.sourceList = list;
  1160. this.packingList = list;
  1161. let packList = this.$refs.table12.getData();
  1162. this.getFullInspectionWeight(packList);
  1163. }
  1164. // this.$refs.table12.setData(list);
  1165. // let packList = this.$refs.table12.getData();
  1166. // console.log(list);
  1167. // console.log(1654646);
  1168. // this.getFullInspectionWeight(packList);
  1169. // this.getFullInspectionWeight(list);
  1170. } else {
  1171. if (this.$refs.table12) {
  1172. let packingList = this.$refs.table12.getData();
  1173. if (
  1174. Math.ceil(Number(this.baseForm.productNumber || 0)) ===
  1175. packingList.length
  1176. ) {
  1177. console.log(
  1178. '--->',
  1179. Math.ceil(Number(this.baseForm.productNumber || 0))
  1180. );
  1181. console.log('--->', packingList.length);
  1182. await this.handleUnpackCase(packingList);
  1183. return;
  1184. } else {
  1185. this.getFullInspectionWeight(packingList);
  1186. }
  1187. }
  1188. // let packingList = this.$refs.table12.getData();
  1189. // if (
  1190. // Math.ceil(Number(this.baseForm.productNumber || 0)) ===
  1191. // packingList.length
  1192. // ) {
  1193. // await this.handleUnpackCase(packingList);
  1194. // return;
  1195. // } else {
  1196. // this.getFullInspectionWeight(packingList);
  1197. // }
  1198. }
  1199. }
  1200. //全检时 计量时
  1201. else if (
  1202. this.baseForm.qualityMode == 1 &&
  1203. this.baseForm.inspectionStandards == 1 &&
  1204. this.btnType != 'detail'
  1205. ) {
  1206. this.sampleList = [];
  1207. console.log(this.baseForm, '---isUnpack---');
  1208. if (this.baseForm.productNumber) {
  1209. console.log('数据777777');
  1210. if (this.$refs.table12) {
  1211. // this.$refs.table12.setData([]);
  1212. this.sourceList = [];
  1213. this.packingList = [];
  1214. let nums = Number(this.baseForm.productNumber);
  1215. let p = this.productItem;
  1216. let list = [];
  1217. for (let i = 0; i < nums; i++) {
  1218. let obj = {
  1219. id: p.id,
  1220. batchNo: p.batchNo,
  1221. categoryCode: p.code, //编码
  1222. categoryName: p.name, //名称
  1223. measureQuantity: 1,
  1224. measureUnit: p.measuringUnit, //计量单位
  1225. weightUnit: p.weightUnit, //重量单位
  1226. weight: p.netWeight //重量
  1227. };
  1228. list.push(obj);
  1229. }
  1230. console.log('数据666666');
  1231. // this.$refs.table12.setData(list);
  1232. this.sourceList = list;
  1233. this.packingList = list;
  1234. let packList = this.$refs.table12.getData();
  1235. await this.handleUnpackCase(packList);
  1236. return;
  1237. }
  1238. // this.$refs.table12.setData([]);
  1239. // let nums = Number(this.baseForm.productNumber);
  1240. // let p = this.productItem;
  1241. // let list = [];
  1242. // for (let i = 0; i < nums; i++) {
  1243. // let obj = {
  1244. // id: p.id,
  1245. // batchNo: p.batchNo,
  1246. // categoryCode: p.code, //编码
  1247. // categoryName: p.name, //名称
  1248. // measureQuantity: 1,
  1249. // measureUnit: p.measuringUnit, //计量单位
  1250. // weightUnit: p.weightUnit, //重量单位
  1251. // weight: p.netWeight //重量
  1252. // };
  1253. // list.push(obj);
  1254. // }
  1255. // console.log('数据666666');
  1256. // this.$refs.table12.setData(list);
  1257. // let packList = this.$refs.table12.getData();
  1258. // await this.handleUnpackCase(packList);
  1259. // return;
  1260. }
  1261. // if (this.rowIds) {
  1262. // const res = await getInventoryListByPlanId({
  1263. // planId: this.rowIds,
  1264. // pageNum: 1,
  1265. // size: 5000
  1266. // });
  1267. // // console.log(res.list);
  1268. // if (res.list.length > 0) {
  1269. // await this.handleUnpackCase(res.list);
  1270. // }
  1271. // } else {
  1272. // await this.handleUnpackCase(packingList);
  1273. // }
  1274. // if (this.baseForm.isUnpack != null && this.baseForm.isUnpack != undefined && this.baseForm.isUnpack != '') {
  1275. // //拆包
  1276. // if (this.baseForm.isUnpack == 1) {
  1277. // await this.handleUnpackCase(packingList);
  1278. // } else if (this.baseForm.isUnpack == 0) {
  1279. // await this.updatePackingList(packingList);
  1280. // }
  1281. // } else {
  1282. // console.log(this.isCheck, 'this.isCheck')
  1283. // if (!this.isCheck) {
  1284. // await this.handleUnpackCase(packingList);
  1285. // } else {
  1286. // await this.updatePackingList(packingList);
  1287. // }
  1288. // }
  1289. //全检 计重时
  1290. } else if (
  1291. this.baseForm.qualityMode == 1 &&
  1292. this.baseForm.inspectionStandards == 2 &&
  1293. this.btnType != 'detail'
  1294. // (this.btnType != 'detail' || this.btnType != 'edit')
  1295. // this.btnType == 'add'
  1296. ) {
  1297. this.sampleList = [];
  1298. let list = [];
  1299. if (this.baseForm.productNumber) {
  1300. let p = this.productItem;
  1301. let obj = {
  1302. id: p.id,
  1303. batchNo: p.batchNo,
  1304. categoryCode: p.code, //编码
  1305. categoryName: p.name, //名称
  1306. measureQuantity: this.baseForm.productNumber, //计量数量
  1307. measureUnit: p.measuringUnit, //计量单位
  1308. weightUnit: p.weightUnit, //重量单位
  1309. weight: p.netWeight * this.baseForm.productNumber //重量
  1310. };
  1311. list.push(obj);
  1312. }
  1313. console.log('数据55555');
  1314. console.log(list);
  1315. if (list.length > 0 && list[0].categoryCode) {
  1316. // this.$refs.table12.setData(list);
  1317. this.sourceList = list;
  1318. this.packingList = list;
  1319. let packList = this.$refs.table12.getData();
  1320. this.getFullInspectionWeight(packList);
  1321. }
  1322. // this.$refs.table12.setData(list);
  1323. // let packList = this.$refs.table12.getData();
  1324. // this.getFullInspectionWeight(packList);
  1325. // this.getFullInspectionWeight(packList);
  1326. } else {
  1327. console.log('进来了这里');
  1328. this.sampleList = [];
  1329. }
  1330. },
  1331. //全检 计重时生成样品清单
  1332. async getFullInspectionWeight(packingList) {
  1333. this.updatePackingList(packingList);
  1334. },
  1335. //拆包处理样品清单数据
  1336. async handleUnpackCase(packingList) {
  1337. if (this.baseForm.type == '3') {
  1338. this.getFullInspectionWeight(packingList);
  1339. } else {
  1340. const num = Number(this.baseForm.productNumber || 0);
  1341. console.log('num:' + num);
  1342. if (num) {
  1343. await this.getUnpackSamList(packingList, num);
  1344. }
  1345. }
  1346. },
  1347. //获取样品编码
  1348. async getSampleCode() {
  1349. return await getCode('sample_code');
  1350. },
  1351. // 创建计量数量为1的样品清单函数,用于计数类型的
  1352. async createSampleList(list) {
  1353. if (this.baseForm.qualityMode != null) {
  1354. const ProductSampleList = [];
  1355. console.log(list, 'list');
  1356. for (const oldItem of list) {
  1357. const count = oldItem.measureQuantity;
  1358. const newMeasureQuantity = oldItem.measureQuantity / count;
  1359. const newWeight = parseFloat((oldItem.weight / count).toFixed(2));
  1360. console.log(typeof oldItem.qualitySampleTemplateList, 'ssssss');
  1361. // 遍历新数组设置 qualityResults 默认值
  1362. this.schemeList.forEach((item) => {
  1363. if (typeof item === 'object' && item !== null) {
  1364. item.qualityResults = 1; // 设置默认值
  1365. }
  1366. delete item.id;
  1367. });
  1368. console.log(oldItem, 'oldItem');
  1369. console.log(count, newMeasureQuantity, newWeight);
  1370. delete oldItem.id;
  1371. if (
  1372. oldItem.qualitySampleTemplateList == undefined ||
  1373. oldItem.qualitySampleTemplateList == null ||
  1374. oldItem.qualitySampleTemplateList.length == 0
  1375. ) {
  1376. oldItem.qualitySampleTemplateList = JSON.parse(
  1377. JSON.stringify(this.schemeList)
  1378. );
  1379. for (let i = 0; i < count; i++) {
  1380. ProductSampleList.push({
  1381. ...oldItem,
  1382. measureQuantity: newMeasureQuantity,
  1383. weight: newWeight,
  1384. sampleCode: await this.getSampleCode(),
  1385. qualitySampleTemplateList: JSON.parse(
  1386. JSON.stringify(this.schemeList)
  1387. )
  1388. });
  1389. }
  1390. console.log(ProductSampleList, 'ProductSampleList');
  1391. this.sampleList = ProductSampleList;
  1392. const pNum = ProductSampleList.reduce((sum, item) => {
  1393. return sum + Number(item.weight || 0);
  1394. }, 0);
  1395. this.baseForm.totalWeight = parseFloat(pNum.toFixed(2));
  1396. } else {
  1397. for (let i = 0; i < count; i++) {
  1398. ProductSampleList.push({
  1399. ...oldItem,
  1400. measureQuantity: newMeasureQuantity,
  1401. weight: newWeight,
  1402. sampleCode: await this.getSampleCode(),
  1403. qualitySampleTemplateList: JSON.parse(
  1404. JSON.stringify(oldItem.qualitySampleTemplateList)
  1405. )
  1406. });
  1407. }
  1408. console.log(ProductSampleList, 'ProductSampleList');
  1409. this.sampleList = ProductSampleList;
  1410. const pNum = ProductSampleList.reduce((sum, item) => {
  1411. return sum + Number(item.weight || 0);
  1412. }, 0);
  1413. this.baseForm.totalWeight = parseFloat(pNum.toFixed(2));
  1414. }
  1415. }
  1416. }
  1417. },
  1418. //更新样品清单数据
  1419. async updatePackingList(list) {
  1420. // 计量类型1是数量,2是重量
  1421. if (this.baseForm.inspectionStandards == 1) {
  1422. this.createSampleList(list);
  1423. }
  1424. if (this.baseForm.inspectionStandards == 2) {
  1425. for (let i = 0; i < list.length; i++) {
  1426. list[i].sampleCode = await this.getSampleCode();
  1427. }
  1428. // this.updatePackingList(list, this.form.total);
  1429. // this.handleWeightFullSample(this.form.total);
  1430. }
  1431. console.log(this.baseForm.inspectionStandards);
  1432. this.sampleList = list;
  1433. this.baseForm.sampleNumber = list.length;
  1434. this.samplePagination.currentPage = 1;
  1435. this.samplePagination.total = list.length;
  1436. // const sampleProportion = this
  1437. // this.samplePagination.total = this.sampleList.length;
  1438. },
  1439. async getUnpackSamList(list, num) {
  1440. console.log(list, num);
  1441. let data = [];
  1442. list.forEach((oldItem, index) => {
  1443. const newMeasureQuantity =
  1444. oldItem.measureQuantity / this.baseForm.productNumber;
  1445. const newWeight = parseFloat(
  1446. (oldItem.weight / this.baseForm.productNumber).toFixed(2)
  1447. );
  1448. // 将 measureQuantity 转换为数字
  1449. const measureQuantity = Number(oldItem.measureQuantity);
  1450. // 判断是否有小数部分
  1451. const hasDecimal = measureQuantity % 1 !== 0;
  1452. let roundedQuantity;
  1453. if (hasDecimal) {
  1454. // 有小数部分,向上取整
  1455. roundedQuantity = Math.ceil(measureQuantity);
  1456. } else {
  1457. roundedQuantity = measureQuantity;
  1458. }
  1459. delete oldItem.id;
  1460. for (let i = 0; i < roundedQuantity; i++) {
  1461. data.push({
  1462. ...oldItem,
  1463. // measureQuantity: 1,
  1464. weight: this.netWeight || 0
  1465. // weight:
  1466. // num - index >= 1
  1467. // ? this.netWeight
  1468. // : ((num * 100000 - index * 100000) / 100000) * this.netWeight
  1469. });
  1470. }
  1471. });
  1472. console.log(data, '样品数据-条数', num);
  1473. await this.updatePackingList(data);
  1474. },
  1475. async getQualityTemplate(productCode, ids) {
  1476. await getQualityTemplateList({
  1477. type: this.baseForm.type,
  1478. productCode: productCode,
  1479. qualityQlanId: ids
  1480. }).then((res) => {
  1481. if (Object.keys(res).length === 0) {
  1482. return;
  1483. }
  1484. this.baseForm.sampleProportion = res.checkProportion;
  1485. // this.baseForm.inspectionStandards = res?.inspectionStandards;
  1486. let combinedList = [];
  1487. for (let i = 0; i < res.qualityTemplateVOList.length; i++) {
  1488. res.qualityTemplateVOList[i].inspectionItemVOList =
  1489. res.qualityTemplateVOList[i]?.inspectionItemVOList.map((item) => {
  1490. item.templateId = res.qualityTemplateVOList[i]?.id;
  1491. item.qualitySchemeTemplateCode =
  1492. res.qualityTemplateVOList[i]?.qualitySchemeTemplateCode;
  1493. item.qualitySchemeTemplateName =
  1494. res.qualityTemplateVOList[i]?.qualitySchemeTemplateName;
  1495. delete item.id;
  1496. return {
  1497. ...item
  1498. };
  1499. });
  1500. combinedList = combinedList.concat(
  1501. res.qualityTemplateVOList[i].inspectionItemVOList
  1502. );
  1503. console.log(combinedList, '质检方案');
  1504. this.schemeList = combinedList;
  1505. this.schemePagination.currentPage = 1;
  1506. this.schemePagination.total = this.schemeList.length;
  1507. }
  1508. });
  1509. },
  1510. //来料列表表格选择事件
  1511. handleSelectionChange(selection) {
  1512. console.log(selection, '勾选');
  1513. this.selectedList = selection;
  1514. //如果取小样
  1515. if (this.conditionType == 2) {
  1516. if (this.isCheck) {
  1517. this.formData.portion = selection.length;
  1518. this.baseForm.sampleNumber = selection.length;
  1519. } else {
  1520. this.baseForm.sampleNumber = this.formData.portion;
  1521. }
  1522. const data1 = this.$refs.table12.getData();
  1523. this.$set(this.formData, 'sampleUnit', data1[0]?.measureUnit);
  1524. this.$set(this.baseForm, 'sampleMeasureUnit', data1[0]?.measureUnit);
  1525. } else if (this.conditionType == 1) {
  1526. this.baseForm.sampleNumber = this.formData.portion;
  1527. this.formData.number = 0;
  1528. }
  1529. },
  1530. //取样方式选择
  1531. async handleSampleNumber(val) {
  1532. console.log(val, 'val');
  1533. this.conditionType = val;
  1534. //清空样品清单列表
  1535. this.sampleList = [];
  1536. // const dataS = this.$refs.table12.getData();
  1537. //取整样
  1538. // if (val == 1) {
  1539. // if (this.selectedList.length == 0) {
  1540. // this.$message.warning('请先选择样品!');
  1541. // } else {
  1542. // if (this.isCheck) {
  1543. // for (let i = 0; i < this.selectedList.length; i++) {
  1544. // for (let j = 0; j < this.selectedList[i].measureQuantity; j++) {
  1545. // // this.selectedList[i].sampleCode = await this.getSampleCode();
  1546. // this.sampleList.push({
  1547. // ...this.selectedList[i],
  1548. // sampleCode: await this.getSampleCode(),
  1549. // measureQuantity: 1,
  1550. // weight: this.selectedList[i].weight / this.selectedList[i].measureQuantity
  1551. // });
  1552. // }
  1553. // }
  1554. // } else {
  1555. // for (let i = 0; i < this.selectedList.length; i++) {
  1556. // let forNum = 0;
  1557. // if (this.formData.portion != null && this.formData.portion != '') {
  1558. // forNum = this.formData.portion;
  1559. // } else {
  1560. // forNum = this.selectedList[i].measureQuantity;
  1561. // }
  1562. // for (let j = 0; j < forNum; j++) {
  1563. // // this.selectedList[i].sampleCode = await this.getSampleCode();
  1564. // this.sampleList.push({
  1565. // ...this.selectedList[i],
  1566. // sampleCode: await this.getSampleCode(),
  1567. // measureQuantity: 1,
  1568. // weight: this.selectedList[i].weight / this.selectedList[i].measureQuantity
  1569. // });
  1570. // }
  1571. // }
  1572. // }
  1573. // this.formData.portion = this.sampleList.length;
  1574. // this.activeName = '2';
  1575. // this.$message.success('取样成功!');
  1576. // }
  1577. // } else if (val == 2) {
  1578. // this.formData.sampleUnit = dataS[0].measureUnit;
  1579. // this.$refs.table12.clearSelection();
  1580. // //小样
  1581. // if (this.selectedList.length == 0) {
  1582. // this.$message.warning('请先选择样品!');
  1583. // } else {
  1584. // if (this.formData.number == null || this.formData.sampleUnit == '') {
  1585. // this.$message.warning('请先选择取样的数量和单位!');
  1586. // }
  1587. // }
  1588. // }
  1589. },
  1590. handleInputNumber(val) {
  1591. let packingList = this.$refs.table12.getData();
  1592. const maxValue =
  1593. packingList.length > 1
  1594. ? packingList.length
  1595. : packingList[0].measureQuantity;
  1596. if (val > maxValue) {
  1597. this.$message.warning('数量不能大于计量数量!');
  1598. this.formData.number = maxValue;
  1599. return;
  1600. }
  1601. },
  1602. // 整样输入框事件
  1603. handleInput(val) {
  1604. if (val == 0 || val == '' || val == null) {
  1605. this.$refs.table12.clearSelection();
  1606. return;
  1607. }
  1608. let packingList = this.$refs.table12.getData();
  1609. if (!packingList || packingList.length === 0) {
  1610. return;
  1611. }
  1612. // 计算 packingList 中 measureQuantity 字段的总和
  1613. const measureQuantitySum = packingList.reduce((sum, item) => {
  1614. const quantity = Number(item.measureQuantity) || 0;
  1615. return sum + quantity;
  1616. }, 0);
  1617. const portion = Number(this.formData.portion);
  1618. // 清空当前选中
  1619. this.$refs.table12.clearSelection();
  1620. if (this.conditionType == 2) {
  1621. // 取小样
  1622. // 确保 portion 不超过数据列表长度
  1623. const safePortion = Math.min(portion, packingList.length);
  1624. if (this.isCheck) {
  1625. // 是否拆包 false 不拆包
  1626. if (portion > packingList.length) {
  1627. this.$message.warning('取样数量不能大于来源清单数量!');
  1628. this.formData.portion = packingList.length;
  1629. }
  1630. } else {
  1631. const maxQuantity = Number(packingList[0].measureQuantity);
  1632. if (portion > maxQuantity) {
  1633. this.$message.warning('取样数量不能大于计量数量!');
  1634. this.formData.portion = maxQuantity;
  1635. }
  1636. }
  1637. // 选中前 safePortion 行
  1638. packingList.slice(0, safePortion).forEach((row) => {
  1639. this.$refs.table12.toggleRowSelection(row, true);
  1640. });
  1641. } else if (this.conditionType == 1) {
  1642. // 确保 portion 不超过数据列表长度
  1643. const safePortion = Math.min(portion, measureQuantitySum);
  1644. if (portion > measureQuantitySum) {
  1645. this.$message.warning('取样数量不能大于计量数量!');
  1646. this.formData.portion = measureQuantitySum;
  1647. }
  1648. // 选中前 safePortion 行
  1649. packingList.slice(0, safePortion).forEach((row) => {
  1650. this.$refs.table12.toggleRowSelection(row, true);
  1651. });
  1652. }
  1653. },
  1654. // 选中物品后触发了这个事件
  1655. async getCategoryInfo(val) {
  1656. console.log(this.baseForm.type, this.baseForm.planSource);
  1657. // this.baseForm.isUnpack = val.categoryWms.isUnpack;
  1658. console.log(val, '产品信息');
  1659. if (this.baseForm.type == 2 && this.baseForm.planSource == '4') {
  1660. if (val.category.id) {
  1661. const res1 = await getProductSteup(val.category.id);
  1662. const index = res1.findIndex(
  1663. (item) => item.taskId == val.category.taskId
  1664. );
  1665. if (index) {
  1666. const res2 = await getProductOrder({
  1667. taskId: res1[index - 1].taskId,
  1668. workOrderId: val.category.id
  1669. });
  1670. if (res2[0].semiProductList.length > 1) {
  1671. this.baseForm.productNumber = res2[0].semiProductList.length;
  1672. } else {
  1673. this.baseForm.productNumber =
  1674. res2[0].semiProductList.measureQuantity;
  1675. }
  1676. }
  1677. this.isConsumable = val.category.isConsumable;
  1678. this.netWeight = val.category.netWeight;
  1679. this.productItem = val.category;
  1680. console.log('+++++++++');
  1681. this.handleSampleList();
  1682. return;
  1683. }
  1684. }
  1685. this.isConsumable = val.category.isConsumable;
  1686. this.netWeight = val.category.netWeight;
  1687. this.productItem = val.category; //产品信息
  1688. },
  1689. changeSamUnit(val) {
  1690. console.log(val);
  1691. this.$refs.baseInfoRefs.getsampleMeasureUnit(val);
  1692. },
  1693. calculateWeightAndQuantity(list) {
  1694. console.log(list);
  1695. this.baseForm.totalWeight = list.reduce((acc, pre) => {
  1696. return pre.weight ? acc + Number(pre.weight) : acc;
  1697. }, 0);
  1698. this.baseForm.productNumber = list.reduce((acc, pre) => {
  1699. return pre.measureQuantity ? acc + Number(pre.measureQuantity) : acc;
  1700. }, 0);
  1701. },
  1702. //整样确认按钮-样品列表右上角确认按钮
  1703. // handleExtractFull() {
  1704. // this.$refs.ruleForm.validate((valid) => {
  1705. // if (valid) {
  1706. // if (!this.selectedList || this.selectedList.length == 0) {
  1707. // this.$message.warning('请先选择样品!');
  1708. // return;
  1709. // }
  1710. // this.sampleList = []
  1711. // //取样条数
  1712. // let safePortion = Number(this.formData.portion);
  1713. // //计量数量
  1714. // let measureQ = this.formData.number || 1;
  1715. // //计量单位
  1716. // let unit = this.formData.sampleUnit;
  1717. // //抽检计量整样小样或者抽检计重小样
  1718. // if ((this.baseForm.inspectionStandards === 1) || (this.baseForm.inspectionStandards === 2 && this.conditionType == 2)) {
  1719. // if (this.conditionType == 2) {
  1720. // if (measureQ <= 0) {
  1721. // this.$message.info('取样计量数量必须大于0');
  1722. // return
  1723. // }
  1724. // }
  1725. // // 计算总计量数量
  1726. // const totalQuantity = this.selectedList.reduce((sum, item) => sum + item['measureQuantity'], 0);
  1727. // // 验证取样总量不超过总计量数量,只有计量单位相同才进行验证
  1728. // if (this.selectedList[0].measureUnit == unit || this.conditionType == 1) {
  1729. // if (measureQ * safePortion > totalQuantity) {
  1730. // this.$message.info('取样计量数量不能大于总计量数量');
  1731. // return
  1732. // }
  1733. // // 验证每条数据的计量数量都大于等于取样计量数量
  1734. // for (const item of this.selectedList) {
  1735. // if (item['measureQuantity'] < measureQ) {
  1736. // this.$message.info(`条目计量数量小于取样计量数量`);
  1737. // return
  1738. // }
  1739. // }
  1740. // }
  1741. // if (unit === 'KG') {
  1742. // let totalMaxPossible = 0;
  1743. // this.selectedList.map(item => {
  1744. // const maxPossible = item['measureQuantity'] / measureQ;
  1745. // totalMaxPossible += maxPossible;});
  1746. // if (totalMaxPossible < safePortion) {
  1747. // this.formData.portion = totalMaxPossible;
  1748. // return this.$message.info(`最大取样条数为${totalMaxPossible}`);
  1749. // }
  1750. // // 计算总重量
  1751. // let totalWeight = this.selectedList.reduce((sum, item) => sum + item['weight'], 0);
  1752. // let weightUnit = this.selectedList[0].weightUnit;
  1753. // if (weightUnit === 'G') {
  1754. // totalWeight = totalWeight / 1000
  1755. // }
  1756. // if (measureQ * safePortion > totalWeight) {
  1757. // this.$message.info('取样计量重量不能大于总计量重量');
  1758. // return
  1759. // }
  1760. // for (const item of this.selectedList) {
  1761. // let weight = weightUnit === 'G' ? item.weight / 1000 : item.weight
  1762. // if (weight < measureQ) {
  1763. // this.$message.info(`勾选条目重量小于取样重量`);
  1764. // return
  1765. // }
  1766. // }
  1767. // }
  1768. // this.getNewFullSampleList(Math.ceil(safePortion), measureQ, unit);
  1769. // //抽检计重整样
  1770. // } else if (this.baseForm.inspectionStandards === 2 && this.conditionType == 1) {
  1771. // for (const item of this.selectedList) {
  1772. // if (item['measureQuantity'] < safePortion) {
  1773. // this.$message.info(`所选的条目计量数量小于取样计量数量`);
  1774. // return
  1775. // }
  1776. // }
  1777. // let list = [];
  1778. // for (let i = 0; i < this.selectedList.length; i++) {
  1779. // list.push({
  1780. // ...this.selectedList[i],
  1781. // measureQuantity: safePortion, //作为计量数量
  1782. // });
  1783. // }
  1784. // this.updatePackingList(list);
  1785. // }
  1786. // this.activeName = '2'
  1787. // }
  1788. // });
  1789. // },
  1790. //从来源数组取样到目标数组
  1791. async getNewFullSampleList(sampleCount, sampleQuantity, sampleUnit) {
  1792. console.log(
  1793. '从来源数组取样到目标数组',
  1794. sampleCount,
  1795. sampleQuantity,
  1796. sampleUnit
  1797. );
  1798. const sourceArray = this.selectedList;
  1799. // 检查单位是否匹配
  1800. const isUnitMismatch =
  1801. sourceArray.length > 0 && sourceArray[0].measureUnit !== sampleUnit;
  1802. // 创建副本并计算初始可取样数量
  1803. const items = sourceArray.map((item) => ({
  1804. ...item,
  1805. remainingQuantity: isUnitMismatch
  1806. ? Infinity
  1807. : item['measureQuantity'], // 剩余可取样数量
  1808. maxPossible: item['measureQuantity'] / sampleQuantity // 最大取样次数
  1809. }));
  1810. const result = [];
  1811. let remainingCount = sampleCount;
  1812. // 尽可能均匀地从各条目取样
  1813. while (remainingCount > 0) {
  1814. // 按剩余可取样比例排序
  1815. items.sort(
  1816. (a, b) =>
  1817. b.remainingQuantity / b['measureQuantity'] -
  1818. a.remainingQuantity / a['measureQuantity']
  1819. );
  1820. let distributed = false;
  1821. for (const item of items) {
  1822. if (
  1823. (!isUnitMismatch && remainingCount > 0) ||
  1824. (item.remainingQuantity >= sampleQuantity && remainingCount > 0)
  1825. ) {
  1826. // 添加到结果数组
  1827. this.samplePagination.total = 0;
  1828. let sampleCode = await this.getSampleCode();
  1829. if (
  1830. this.conditionType == 1 &&
  1831. this.baseForm.inspectionStandards == 1
  1832. ) {
  1833. result.push({ ...item, measureQuantity: 1, sampleCode });
  1834. } else if (
  1835. this.conditionType == 2 &&
  1836. (this.baseForm.inspectionStandards == 1 ||
  1837. this.baseForm.inspectionStandards == 2)
  1838. ) {
  1839. let weight = (item.weight / item.maxPossible).toFixed(2);
  1840. result.push({
  1841. ...item,
  1842. measureQuantity: sampleQuantity,
  1843. measureUnit: sampleUnit,
  1844. sampleCode,
  1845. weight
  1846. });
  1847. }
  1848. // 更新剩余数量
  1849. if (!isUnitMismatch) {
  1850. item.remainingQuantity -= sampleQuantity;
  1851. }
  1852. remainingCount--;
  1853. distributed = true;
  1854. }
  1855. }
  1856. // 如果没有分配任何取样
  1857. if (!distributed) {
  1858. break;
  1859. }
  1860. }
  1861. console.log('样品清单', this.sampleList);
  1862. console.log('样品清单List', result);
  1863. this.sampleList = result;
  1864. this.samplePagination.total = result.length;
  1865. this.baseForm.sampleNumber = this.sampleList.length; // 更新样品数量
  1866. this.changeSamUnit(sampleUnit);
  1867. },
  1868. //抽样确认按钮事件-样品列表右上角确认按钮
  1869. handleSampleSubmit() {
  1870. this.$refs.ruleForm.validate((valid) => {
  1871. if (valid) {
  1872. this.sampleList = [];
  1873. this.baseForm.sampleMeasureUnit = this.formData.sampleUnit;
  1874. let measureQ = this.formData.number;
  1875. let unit = this.formData.sampleUnit;
  1876. let nums = Number(this.formData.portion);
  1877. console.log(measureQ, unit, nums, 'measureQ, unit, nums');
  1878. this.getNewFullSampleList(nums, measureQ, unit);
  1879. // if (this.conditionType == 1) {
  1880. // this.sampleList = this.selectedList
  1881. // } else {
  1882. // let measureQ = this.formData.number;
  1883. // let unit = this.formData.sampleUnit;
  1884. // let nums = Number(this.formData.portion);
  1885. //
  1886. // console.log(measureQ, unit, nums, 'measureQ, unit, nums')
  1887. // this.getNewSampleList(measureQ, unit, nums)
  1888. // }
  1889. this.activeName = '2';
  1890. }
  1891. });
  1892. },
  1893. //更新计量数量、单位后重新生成样品列表数据
  1894. // async getNewSampleList(measureQ, unit, nums) {
  1895. // this.sampleList = [];
  1896. // if (!this.selectedList || this.selectedList.length == 0) {
  1897. // this.$message.warning('请先选择样品!');
  1898. // return;
  1899. // }
  1900. // if (!this.isCheck) {
  1901. // let measureQuantity = 1;
  1902. // if (this.conditionType == 2) {
  1903. // measureQuantity = this.formData.number;
  1904. // }
  1905. // for (let i = 0; i < nums; i++) {
  1906. // this.sampleList.push({
  1907. // ...this.selectedList[0],
  1908. // sampleCode: await this.getSampleCode(),
  1909. // measureQuantity: measureQuantity,
  1910. // measureUnit: unit,
  1911. // weight: this.netWeight || 0
  1912. // });
  1913. // }
  1914. // } else {
  1915. // if (this.conditionType == 1) {
  1916. // measureQ = 1;
  1917. // }
  1918. // for (let i = 0; i < this.selectedList.length; i++) {
  1919. // this.sampleList.push({
  1920. // ...this.selectedList[i],
  1921. // sampleCode: await this.getSampleCode(),
  1922. // measureQuantity: measureQ,
  1923. // measureUnit: unit,
  1924. // weight: this.netWeight || 0
  1925. // });
  1926. // }
  1927. // }
  1928. // },
  1929. //监听类型变化
  1930. resetTable() {
  1931. this.$nextTick(() => {
  1932. this.table1();
  1933. this.table2();
  1934. });
  1935. },
  1936. table1() {
  1937. this.$refs.table12.setData([]);
  1938. this.sourceList = [];
  1939. this.packingList = [];
  1940. this.schemeList = [];
  1941. },
  1942. table2() {
  1943. this.$nextTick(() => {
  1944. // if (this.btnType == 'edit' && !this.isOnce) {
  1945. // this.isOrder = false;
  1946. this.sampleList = [];
  1947. // }
  1948. });
  1949. },
  1950. resetForm() {
  1951. this.baseForm = { ...this.defaultForm() };
  1952. },
  1953. handleClose() {
  1954. this.$nextTick(() => {
  1955. // 关闭后,销毁所有的表单数据
  1956. this.resetForm();
  1957. this.resetTable();
  1958. this.isScheme = true;
  1959. this.isOrder = true;
  1960. this.packingList = [];
  1961. this.sampleList = [];
  1962. this.samplePagination = {
  1963. currentPage: 1,
  1964. pageSize: 10,
  1965. total: 0
  1966. };
  1967. (this.schemeList = []),
  1968. (this.schemePagination = {
  1969. currentPage: 1,
  1970. pageSize: 10,
  1971. total: 0
  1972. });
  1973. // 表单验证规则
  1974. this.visible = false;
  1975. this.btnType = null;
  1976. this.title = null;
  1977. this.loading = false;
  1978. this.listPage = [];
  1979. this.activeName = '1';
  1980. this.selectedList = [];
  1981. this.isCheck = false; // 是否拆包 false 不拆包 true 拆包
  1982. this.rowIds = '';
  1983. (this.formData = {
  1984. number: 1,
  1985. sampleUnit: '',
  1986. portion: null
  1987. }),
  1988. (this.rules = {
  1989. number: [
  1990. {
  1991. required: true,
  1992. message: '请输入',
  1993. trigger: 'blur'
  1994. }
  1995. ],
  1996. sampleUnit: [
  1997. {
  1998. required: true,
  1999. message: '请选择样品单位',
  2000. trigger: 'change'
  2001. }
  2002. ],
  2003. portion: [
  2004. {
  2005. required: true,
  2006. message: '请输入',
  2007. trigger: 'blur'
  2008. }
  2009. ]
  2010. });
  2011. this.isConsumable = ''; //0 单件 1批量
  2012. this.netWeight = ''; // 净重
  2013. this.conditionType = null;
  2014. this.isFormNumber = true;
  2015. this.sampleListCode = '';
  2016. this.productItem = {}; //产品信息
  2017. this.$refs['baseInfoRefs'] &&
  2018. this.$refs['baseInfoRefs'].$refs.form1.resetFields();
  2019. this.visible = false;
  2020. this.baseForm.groupId = '';
  2021. this.baseForm.qualityMode = '';
  2022. this.baseForm = { ...this.defaultForm() };
  2023. this.isChangeNumber = true;
  2024. this.isChangeType = true;
  2025. this.isOnce = true;
  2026. this.dimensionType = '';
  2027. this.isPackingList = true;
  2028. this.isSampleList = true;
  2029. });
  2030. },
  2031. /* 保存编辑 */
  2032. handleSave() {
  2033. this.$refs.baseInfoRefs.$refs.form1.validate((valid) => {
  2034. if (!valid) {
  2035. return false;
  2036. }
  2037. this.loading = true;
  2038. if (this.baseForm.isUnpack == null || this.baseForm.isUnpack == '') {
  2039. this.baseForm.isUnpack = this.isCheck ? 1 : 2;
  2040. }
  2041. this.baseForm.conditionType = this.conditionType;
  2042. // isSampleList: true,
  2043. // isPackingList: true,
  2044. console.log(this.isSampleList);
  2045. console.log(this.isPackingList);
  2046. console.log(this.$refs.table12.getData());
  2047. const qualityListData =
  2048. this.btnType == 'add'
  2049. ? this.sourceList
  2050. : this.btnType == 'edit' && this.isPackingList
  2051. ? []
  2052. : this.sourceList;
  2053. const sampleListData =
  2054. this.btnType == 'add'
  2055. ? this.sampleList
  2056. : this.btnType == 'edit' && this.isSampleList
  2057. ? this.newSampleList
  2058. : this.sampleList;
  2059. // let params = {
  2060. // ...this.baseForm,
  2061. // qualityInventoryList: this.$refs.table12.getData(),
  2062. // sampleList: this.sampleList,
  2063. // planTemplateList: this.schemeList
  2064. // };
  2065. let params = {
  2066. ...this.baseForm,
  2067. qualityInventoryList: qualityListData,
  2068. sampleList: sampleListData,
  2069. planTemplateList: this.schemeList
  2070. };
  2071. console.log(params, 'params');
  2072. if (this.btnType == 'issued' && this.schemeList.length < 1) {
  2073. this.$message.warning('质检方案不能为空!');
  2074. this.loading = false;
  2075. return;
  2076. }
  2077. let URL =
  2078. this.btnType == 'add' ? save : this.btnType == 'edit' ? update : '';
  2079. console.log(params, 'params');
  2080. URL(params)
  2081. .then((msg) => {
  2082. this.loading = false;
  2083. this.$message.success(msg);
  2084. this.handleClose();
  2085. this.$emit('done');
  2086. })
  2087. .catch((e) => {
  2088. this.loading = false;
  2089. });
  2090. });
  2091. },
  2092. handleIssued() {
  2093. if (this.sampleList.length == 0) {
  2094. this.$message.warning('样品清单为空!先进行修改操作再下发!');
  2095. return;
  2096. }
  2097. this.$refs.baseInfoRefs.$refs.form1.validate((valid) => {
  2098. if (!valid) {
  2099. return false;
  2100. }
  2101. this.loading = true;
  2102. if (this.baseForm.isUnpack == null || this.baseForm.isUnpack == '') {
  2103. this.baseForm.isUnpack = this.isCheck ? 1 : 2;
  2104. }
  2105. this.baseForm.conditionType =
  2106. this.conditionType ?? this.kkconditionType;
  2107. // let params = {
  2108. // ...this.baseForm,
  2109. // qualityInventoryList: this.$refs.table12.getData(),
  2110. // sampleList: this.sampleList,
  2111. // planTemplateList: this.schemeList
  2112. // };
  2113. // const qualityListData =
  2114. // this.btnType == 'add'
  2115. // ? this.sourceList
  2116. // : this.btnType == 'edit' && this.isPackingList
  2117. // ? []
  2118. // : this.sourceList;
  2119. console.log(this.newSampleList, 'newSampleList');
  2120. const qualityListData = this.sourceList;
  2121. const sampleListData =
  2122. this.btnType == 'add'
  2123. ? this.sampleList
  2124. : this.btnType == 'issued' && this.isSampleList
  2125. ? this.newSampleList
  2126. : this.sampleList;
  2127. // let params = {
  2128. // ...this.baseForm,
  2129. // qualityInventoryList: this.$refs.table12.getData(),
  2130. // sampleList: this.sampleList,
  2131. // planTemplateList: this.schemeList
  2132. // };
  2133. let params = {
  2134. ...this.baseForm,
  2135. qualityInventoryList: qualityListData,
  2136. sampleList: sampleListData,
  2137. planTemplateList: this.schemeList
  2138. };
  2139. console.log(params, 'params');
  2140. if (this.btnType == 'issued' && this.schemeList.length < 1) {
  2141. this.$message.warning('质检方案不能为空!');
  2142. this.loading = false;
  2143. return;
  2144. }
  2145. planIssued(params)
  2146. .then((msg) => {
  2147. this.loading = false;
  2148. this.$message.success(msg);
  2149. this.handleClose();
  2150. this.$emit('done');
  2151. })
  2152. .catch((e) => {
  2153. this.loading = false;
  2154. });
  2155. });
  2156. },
  2157. // 样品列表分页方法
  2158. async handleSampleSizeChange(val) {
  2159. this.samplePagination.pageSize = val;
  2160. this.samplePagination.currentPage = 1;
  2161. if (this.rowIds && this.isOrder) {
  2162. await this.getSampleList(this.rowIds);
  2163. }
  2164. //操作行点击时查询样品
  2165. },
  2166. async handleSampleCurrentChange(val) {
  2167. this.samplePagination.currentPage = val;
  2168. if (this.rowIds && this.isSampleList) {
  2169. await this.getSampleList(this.rowIds);
  2170. }
  2171. },
  2172. // 质检方案分页方法
  2173. async handleSchemeSizeChange(val) {
  2174. this.schemePagination.pageSize = val;
  2175. this.schemePagination.currentPage = 1;
  2176. //操作行点击时查询质检
  2177. if (this.rowIds && this.isScheme) {
  2178. await this.getTemplateList(this.rowIds);
  2179. }
  2180. },
  2181. async handleSchemeCurrentChange(val) {
  2182. this.schemePagination.currentPage = val;
  2183. //操作行点击时查询质检
  2184. if (this.rowIds && this.isScheme) {
  2185. await this.getTemplateList(this.rowIds);
  2186. }
  2187. },
  2188. //检验方式改变时,重新获取样品列表
  2189. changeModel(val) {
  2190. console.log('更改检验方式');
  2191. this.baseForm.qualityMode = val;
  2192. this.isSampleList = false;
  2193. if (this.btnType != 'issued') {
  2194. this.baseForm.sampleNumber = '';
  2195. }
  2196. if (this.baseForm.type == '3') {
  2197. console.log(this.sourceList, this.dimensionType, '更改检验方式223');
  2198. if (
  2199. this.sourceList &&
  2200. this.dimensionType &&
  2201. this.baseForm.qualityMode == '1'
  2202. ) {
  2203. // const listData = this.$refs.table12.getData();
  2204. console.log(this.sourceList, '成品检验订单数据');
  2205. this.changesStokledgerNumberModal(
  2206. this.sourceList,
  2207. this.dimensionType,
  2208. 'type'
  2209. );
  2210. return;
  2211. } else if (
  2212. this.sourceList &&
  2213. this.dimensionType &&
  2214. this.baseForm.qualityMode == '2'
  2215. ) {
  2216. this.sampleList = [];
  2217. } else {
  2218. if (
  2219. this.baseForm.qualityMode == '1' &&
  2220. this.sourceList.length > 1
  2221. ) {
  2222. this.changesStokledgerNumberModal(this.sourceList, '3', 'type');
  2223. } else if (
  2224. this.baseForm.qualityMode == '2' &&
  2225. this.sourceList.length > 1
  2226. ) {
  2227. this.sampleList = [];
  2228. } else if (
  2229. this.baseForm.qualityMode == '1' &&
  2230. this.sourceList.length > 0
  2231. ) {
  2232. this.changesStokledgerNumberModal(
  2233. this.sourceList,
  2234. this.dimensionType,
  2235. 'type'
  2236. );
  2237. } else {
  2238. this.sampleList = [];
  2239. }
  2240. }
  2241. // if (this.$refs.table12 && this.dimensionType) {
  2242. // const listData = this.$refs.table12.getData();
  2243. // console.log(listData, '成品检验订单数据');
  2244. // this.changesStokledgerNumberModal(
  2245. // listData,
  2246. // this.dimensionType,
  2247. // 'type'
  2248. // );
  2249. // // if (this.dimensionType == 3) {
  2250. // // if (this.baseForm.qualityMode == '1') {
  2251. // // this.handleUnpackCase(val);
  2252. // // } else if (this.baseForm.qualityMode == '2') {
  2253. // // this.sampleList = [];
  2254. // // }
  2255. // // } else {
  2256. // // if (this.baseForm.qualityMode == '1') {
  2257. // // this.handleUnpackCase(listData);
  2258. // // } else if (this.baseForm.qualityMode == '2') {
  2259. // // this.sampleList = [];
  2260. // // }
  2261. // // }
  2262. // }
  2263. return;
  2264. }
  2265. // 全检
  2266. if (this.baseForm.qualityMode == 1) {
  2267. // console.log('+++++++++1');
  2268. // this.handleSampleList();
  2269. this.updatePackingList(this.sourceList);
  2270. } else {
  2271. this.sampleList = [];
  2272. }
  2273. },
  2274. changeType() {
  2275. this.isPackingList = false;
  2276. },
  2277. changeSource() {
  2278. this.isSampleList = false;
  2279. },
  2280. //确定按钮
  2281. handleExtractFull() {
  2282. this.$refs.ruleForm.validate(async (valid) => {
  2283. if (!valid || !this.validateSelection()) return;
  2284. this.isSampleList = false;
  2285. this.baseForm.sampleMeasureUnit = this.formData.sampleUnit;
  2286. this.sampleList = [];
  2287. const sampleCount = Number(this.formData.portion);
  2288. const measureQ = this.formData.number || 1;
  2289. const unit = this.formData.sampleUnit;
  2290. // console.log(this.conditionType, this.baseForm.inspectionStandards);
  2291. // console.log(this.isStandard1OrWeightSample())
  2292. // console.log(this.isWeightStandardFullSample())
  2293. try {
  2294. if (this.isStandard1OrWeightSample()) {
  2295. //抽检计量整样小样或者抽检计重小样
  2296. if (!this.validateMeasureQuantity(measureQ, unit, sampleCount))
  2297. return;
  2298. if (unit === 'KG' && !this.validateWeight(measureQ, sampleCount))
  2299. return; // 若计量单位为重量,还需验证总重量是否足够
  2300. console.log('getNewFullSampleList');
  2301. if (this.conditionType == '1' && this.baseForm.type == '3') {
  2302. await this.handleWeightFullSample(sampleCount);
  2303. } else {
  2304. await this.getNewFullSampleList(
  2305. Math.ceil(sampleCount),
  2306. measureQ,
  2307. unit
  2308. );
  2309. }
  2310. } else if (this.isWeightStandardFullSample()) {
  2311. console.log('handleWeightFullSample');
  2312. //抽检取计重取整样
  2313. if (!this.validateSampleCount(sampleCount)) return;
  2314. await this.handleWeightFullSample(sampleCount);
  2315. }
  2316. this.activeName = '2';
  2317. } catch (error) {
  2318. console.error('取样处理失败:', error);
  2319. this.$message.error('取样处理失败');
  2320. }
  2321. });
  2322. },
  2323. validateSelection() {
  2324. if (!this.selectedList?.length) {
  2325. this.$message.warning('请先选择样品!');
  2326. return false;
  2327. }
  2328. return true;
  2329. },
  2330. isStandard1OrWeightSample() {
  2331. return (
  2332. this.baseForm.inspectionStandards === 1 ||
  2333. (this.baseForm.inspectionStandards === 2 && this.conditionType == 2)
  2334. );
  2335. },
  2336. isWeightStandardFullSample() {
  2337. return (
  2338. this.baseForm.inspectionStandards === 2 && this.conditionType == 1
  2339. );
  2340. },
  2341. validateMeasureQuantity(measureQ, unit, sampleCount) {
  2342. if (this.conditionType == 2 && measureQ <= 0) {
  2343. this.$message.info('取样计量数量必须大于0');
  2344. return false;
  2345. }
  2346. const totalQuantity = this.selectedList.reduce(
  2347. (sum, item) => sum + item.measureQuantity,
  2348. 0
  2349. );
  2350. if (
  2351. (this.selectedList[0].measureUnit === unit ||
  2352. this.conditionType == 1) &&
  2353. measureQ * sampleCount > totalQuantity
  2354. ) {
  2355. this.$message.info('取样计量数量不能大于总计量数量');
  2356. return false;
  2357. }
  2358. const invalidItem = this.selectedList.find(
  2359. (item) => item.measureQuantity < measureQ
  2360. );
  2361. if (invalidItem) {
  2362. this.$message.info('条目计量数量小于取样计量数量');
  2363. return false;
  2364. }
  2365. return true;
  2366. },
  2367. validateWeight(measureQ, sampleCount) {
  2368. let totalMaxPossible = 0;
  2369. this.selectedList.forEach((item) => {
  2370. totalMaxPossible += item.measureQuantity / measureQ;
  2371. });
  2372. if (totalMaxPossible < sampleCount) {
  2373. this.formData.portion = totalMaxPossible;
  2374. this.$message.info(`最大取样条数为${totalMaxPossible}`);
  2375. return false;
  2376. }
  2377. let totalWeight = this.selectedList.reduce(
  2378. (sum, item) => sum + item.weight,
  2379. 0
  2380. );
  2381. const weightUnit = this.selectedList[0].weightUnit;
  2382. if (weightUnit === 'G') totalWeight /= 1000;
  2383. console.log(measureQ * sampleCount, totalWeight);
  2384. if (measureQ * sampleCount > totalWeight) {
  2385. this.$message.info('取样计量重量不能大于总计量重量');
  2386. return false;
  2387. }
  2388. const invalidItem = this.selectedList.find((item) => {
  2389. const weight =
  2390. item.weightUnit === 'G' ? item.weight / 1000 : item.weight;
  2391. return weight < measureQ;
  2392. });
  2393. if (invalidItem) {
  2394. this.$message.info('勾选条目重量小于取样重量');
  2395. return false;
  2396. }
  2397. return true;
  2398. },
  2399. validateSampleCount(sampleCount) {
  2400. // const invalidItem = this.selectedList.find(
  2401. // (item) => item.measureQuantity < sampleCount
  2402. // );
  2403. // const totalNumber = this.sourceList.reduce((acc, pro) => {
  2404. // return pro.measureQuantity ? acc + Number(pro.measureQuantity) : acc;
  2405. // }, 0);
  2406. const chooseNumber = this.selectedList.reduce((acc, pro) => {
  2407. return pro.measureQuantity ? acc + Number(pro.measureQuantity) : acc;
  2408. }, 0);
  2409. const invalidItem = chooseNumber < sampleCount;
  2410. if (invalidItem) {
  2411. this.$message.info('所选的条目计量数量小于取样计量数量');
  2412. return false;
  2413. }
  2414. return true;
  2415. },
  2416. async handleWeightFullSample(sampleCount) {
  2417. // console.log(sampleCount, 'sampleCount');
  2418. // console.log(this.selectedList, 'this.selectedList');
  2419. let currentNum = sampleCount - this.selectedList.length;
  2420. let currentNum1 = sampleCount;
  2421. let list = [];
  2422. this.selectedList.forEach((item) => {
  2423. if (sampleCount >= this.selectedList.length) {
  2424. list.push({
  2425. ...item,
  2426. measureQuantity: 1, //作为计量数量
  2427. weight: item.singleWeight
  2428. ? (Number(item.singleWeight) * Number(sampleCount)).toFixed(2)
  2429. : item.outboundNum
  2430. ? (
  2431. (Number(item.weight) / Number(item.outboundNum)) *
  2432. Number(sampleCount)
  2433. ).toFixed(2)
  2434. : item.weight
  2435. });
  2436. } else {
  2437. if (list.length < sampleCount) {
  2438. list.push({
  2439. ...item,
  2440. measureQuantity: currentNum1 > 1 ? 1 : currentNum1, //作为计量数量
  2441. weight: item.singleWeight
  2442. ? (Number(item.singleWeight) * Number(sampleCount)).toFixed(2)
  2443. : item.outboundNum
  2444. ? (
  2445. (Number(item.weight) / Number(item.outboundNum)) *
  2446. Number(sampleCount)
  2447. ).toFixed(2)
  2448. : item.weight
  2449. });
  2450. currentNum1 -= 1;
  2451. }
  2452. }
  2453. if (sampleCount > this.selectedList.length) {
  2454. list.forEach((item) => {
  2455. if (currentNum > 0) {
  2456. let data = this.selectedList.find((val) => val.id == item.id);
  2457. item['measureQuantity'] =
  2458. data.measureQuantity - 1 - currentNum > 0
  2459. ? currentNum + 1
  2460. : data.measureQuantity;
  2461. currentNum = currentNum - (data.measureQuantity - 1);
  2462. }
  2463. });
  2464. }
  2465. // ...item,
  2466. // // measureQuantity: sampleCount,
  2467. // weight: item.singleWeight
  2468. // ? (Number(item.singleWeight) * Number(sampleCount)).toFixed(2)
  2469. // : item.outboundNum
  2470. // ? (
  2471. // (Number(item.weight) / Number(item.outboundNum)) *
  2472. // Number(sampleCount)
  2473. // ).toFixed(2)
  2474. // : item.weight
  2475. // weight: item.singleWeight ? Number(item.singleWeight) : item.weight
  2476. });
  2477. // if (this.selectedList.length > sampleCount) {
  2478. // const newList = list.splice(0, sampleCount);
  2479. // await this.updatePackingList(newList);
  2480. // } else {
  2481. // await this.updatePackingList(list);
  2482. // }
  2483. await this.updatePackingList(list);
  2484. },
  2485. handDel(index) {
  2486. console.log(index);
  2487. this.schemeList.splice(index, 1);
  2488. }
  2489. }
  2490. };
  2491. </script>
  2492. <style lang="scss" scoped>
  2493. .location-warp {
  2494. display: flex;
  2495. .detail {
  2496. margin-left: 10px;
  2497. }
  2498. }
  2499. :deep(.el-form-item__content .el-input-group__prepend) {
  2500. background-color: #fff;
  2501. }
  2502. :deep(
  2503. .el-dialog:not(.ele-dialog-form)
  2504. .el-dialog__body
  2505. .el-form
  2506. .el-form-item:last-child
  2507. ) {
  2508. margin-bottom: 22px;
  2509. }
  2510. .add-product {
  2511. width: 100%;
  2512. display: flex;
  2513. align-items: center;
  2514. justify-content: flex-end;
  2515. font-size: 30px;
  2516. color: #1890ff;
  2517. margin: 10px 0;
  2518. cursor: pointer;
  2519. }
  2520. .el-pagination {
  2521. padding: 12px 16px;
  2522. background: #fff;
  2523. border: 1px solid#ebeef5;
  2524. border-top: none;
  2525. }
  2526. .flex {
  2527. display: flex;
  2528. align-items: center;
  2529. }
  2530. </style>