addSample.vue 48 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747
  1. <template>
  2. <view>
  3. <u-popup
  4. :show="visible"
  5. :round="0"
  6. :closeOnClickOverlay="false"
  7. :zIndex="99999"
  8. @close="closePopup"
  9. >
  10. <view class="popup-content">
  11. <view class="popup-header">
  12. <text class="popup-title">{{ title }}</text>
  13. <view class="close-btn" @click="closePopup">×</view>
  14. </view>
  15. <scroll-view class="popup-body" scroll-y>
  16. <view class="form-section">
  17. <view class="section-title">基本信息</view>
  18. <view class="form-row">
  19. <view class="form-item">
  20. <text class="label">工单编码</text>
  21. <view
  22. class="value-wrap"
  23. @click="selectQualityWorkOrder"
  24. v-if="!isSampleRecord || (isSampleRecord && type != 'add')"
  25. >
  26. <u-input
  27. v-model="form.qualityWorkOrderCode"
  28. disabled
  29. placeholder=" "
  30. border="none"
  31. ></u-input>
  32. </view>
  33. <view class="value-wrap" v-else>
  34. <u-input
  35. v-model="form.qualityWorkOrderCode"
  36. disabled
  37. placeholder=" "
  38. border="none"
  39. ></u-input>
  40. </view>
  41. </view>
  42. </view>
  43. <view class="form-row">
  44. <view class="form-item">
  45. <text class="label">工单名称</text>
  46. <view class="value-wrap">
  47. <u-input
  48. v-model="form.qualityWorkOrderName"
  49. disabled
  50. placeholder=" "
  51. border="none"
  52. ></u-input>
  53. </view>
  54. </view>
  55. </view>
  56. <view class="form-row">
  57. <view class="form-item">
  58. <text class="label">编码</text>
  59. <view class="value-wrap">
  60. <u-input
  61. v-model="form.productCode"
  62. disabled
  63. placeholder=" "
  64. border="none"
  65. ></u-input>
  66. </view>
  67. </view>
  68. </view>
  69. <view class="form-row">
  70. <view class="form-item">
  71. <text class="label">名称</text>
  72. <view class="value-wrap">
  73. <u-input
  74. v-model="form.productName"
  75. disabled
  76. placeholder=" "
  77. border="none"
  78. ></u-input>
  79. </view>
  80. </view>
  81. </view>
  82. <view class="form-row">
  83. <view class="form-item">
  84. <text class="label">批次号</text>
  85. <view class="value-wrap">
  86. <u-input
  87. v-model="form.batchNo"
  88. disabled
  89. placeholder=" "
  90. border="none"
  91. ></u-input>
  92. </view>
  93. </view>
  94. </view>
  95. <view class="form-row">
  96. <view class="form-item">
  97. <text class="label">规格</text>
  98. <view class="value-wrap">
  99. <u-input
  100. v-model="form.specification"
  101. disabled
  102. placeholder=" "
  103. border="none"
  104. ></u-input>
  105. </view>
  106. </view>
  107. </view>
  108. <view class="form-row">
  109. <view class="form-item">
  110. <text class="label">型号</text>
  111. <view class="value-wrap">
  112. <u-input
  113. v-model="form.modelType"
  114. disabled
  115. placeholder=" "
  116. border="none"
  117. ></u-input>
  118. </view>
  119. </view>
  120. </view>
  121. <view class="form-row">
  122. <view class="form-item">
  123. <text class="label">牌号</text>
  124. <view class="value-wrap">
  125. <u-input
  126. v-model="form.brandNo"
  127. disabled
  128. placeholder=" "
  129. border="none"
  130. ></u-input>
  131. </view>
  132. </view>
  133. </view>
  134. <view class="form-row">
  135. <view class="form-item">
  136. <text class="label">总数</text>
  137. <view class="value-wrap">
  138. <u-input
  139. v-model="form.total"
  140. disabled
  141. placeholder=" "
  142. border="none"
  143. >
  144. <template #suffix>{{
  145. tableList[0] && tableList[0].measureUnit
  146. }}</template>
  147. </u-input>
  148. </view>
  149. </view>
  150. </view>
  151. </view>
  152. <view class="form-section">
  153. <view class="section-title">来源清单</view>
  154. <view class="table-info">
  155. <text
  156. >累计请样数量:{{ workSampleQuantity
  157. }}{{
  158. (sampleList[0] && sampleList[0].measureUnit) ||
  159. form.measureUnit
  160. }}</text
  161. >
  162. </view>
  163. <view class="table-wrapper">
  164. <scroll-view scroll-x scroll-y class="table-scroll">
  165. <view class="source-table">
  166. <view class="table-header">
  167. <view class="table-cell select-cell">
  168. <checkbox
  169. :checked="isAllSelected"
  170. @click="toggleSelectAll"
  171. />
  172. </view>
  173. <view
  174. class="table-cell"
  175. v-for="col in displaySourceColumns.filter(
  176. (c) => c.prop !== 'select',
  177. )"
  178. :key="col.prop"
  179. >{{ col.label }}</view
  180. >
  181. </view>
  182. <view class="table-body">
  183. <view
  184. class="table-row"
  185. v-for="(item, index) in tableList"
  186. :key="index"
  187. >
  188. <view class="table-cell select-cell">
  189. <checkbox
  190. :checked="isSelected(item)"
  191. @click="toggleSelect(item)"
  192. />
  193. </view>
  194. <view
  195. class="table-cell"
  196. v-for="col in displaySourceColumns.filter(
  197. (c) => c.prop !== 'select',
  198. )"
  199. :key="col.prop"
  200. >
  201. {{ item[col.prop] || "-" }}
  202. </view>
  203. </view>
  204. <view
  205. class="table-empty"
  206. v-if="!tableList || tableList.length === 0"
  207. >
  208. <text>暂无数据</text>
  209. </view>
  210. </view>
  211. </view>
  212. </scroll-view>
  213. </view>
  214. </view>
  215. <view class="form-section">
  216. <view class="section-title">请样信息</view>
  217. <view class="form-row">
  218. <view class="form-item">
  219. <text class="label">请样目的</text>
  220. <view class="value-wrap">
  221. <u-input
  222. v-model="form.pleasePurpose"
  223. placeholder="请输入"
  224. border="none"
  225. :disabled="type == 'view'"
  226. ></u-input>
  227. </view>
  228. </view>
  229. </view>
  230. <view class="form-row">
  231. <view class="form-item">
  232. <text class="label">质检方式</text>
  233. <view class="value-wrap">
  234. <DictSelection
  235. v-model="form.qualityMode"
  236. @itemChange="handleQualityModeChange"
  237. :disabled="form.isFirstSampling != '1' || type == 'view'"
  238. dictName="取样类型"
  239. >
  240. </DictSelection>
  241. </view>
  242. </view>
  243. </view>
  244. <view class="form-row">
  245. <view class="form-item">
  246. <text class="label">记录方法</text>
  247. <view class="value-wrap">
  248. <view
  249. class="select-input"
  250. :class="{
  251. disabled: form.isFirstSampling != '1' || type == 'view',
  252. }"
  253. @click="selectRecordingMethod"
  254. >
  255. <text class="value-text">{{
  256. (recordingMethodList.find(
  257. (item) => item.value == form.recordingMethod,
  258. ) &&
  259. recordingMethodList.find(
  260. (item) => item.value == form.recordingMethod,
  261. ).label) ||
  262. "请选择"
  263. }}</text>
  264. <text class="arrow">›</text>
  265. </view>
  266. </view>
  267. </view>
  268. </view>
  269. <view class="form-section-inner" v-if="form.qualityMode == '2'">
  270. <view class="form-row">
  271. <view class="form-item">
  272. <text class="label">请样类型</text>
  273. <view class="value-wrap" @click="selectConditionType">
  274. <view
  275. class="select-input"
  276. :class="{
  277. disabled: form.isFirstSampling != '1' || type == 'view',
  278. }"
  279. @click="selectConditionType"
  280. >
  281. <text class="value-text">{{
  282. (conditionTypeColumns.find(
  283. (item) => item.value == form.conditionType,
  284. ) &&
  285. conditionTypeColumns.find(
  286. (item) => item.value == form.conditionType,
  287. ).label) ||
  288. "请选择"
  289. }}</text>
  290. <text class="arrow">›</text>
  291. </view>
  292. </view>
  293. </view>
  294. </view>
  295. <view class="form-row" v-if="form.conditionType == 2">
  296. <view class="form-item">
  297. <text class="label">数量</text>
  298. <view class="value-wrap">
  299. <u-input
  300. v-model="form.quantity"
  301. :disabled="type == 'view'"
  302. placeholder="请输入"
  303. border="none"
  304. ></u-input>
  305. </view>
  306. </view>
  307. </view>
  308. <view class="form-row" v-if="form.conditionType == 2">
  309. <view class="form-item">
  310. <text class="label">单位</text>
  311. <view class="value-wrap">
  312. <DictSelection
  313. v-model="form.unit"
  314. @itemChange="handleQualityModeChange"
  315. :disabled="form.isFirstSampling != '1' || type == 'view'"
  316. dictName="计量单位"
  317. >
  318. </DictSelection>
  319. </view>
  320. </view>
  321. </view>
  322. <view class="form-row" v-if="form.conditionType == 2">
  323. <view class="form-item">
  324. <text class="label">条数</text>
  325. <view class="value-wrap">
  326. <u-input
  327. v-model="form.portion"
  328. :disabled="type == 'view'"
  329. placeholder="请输入"
  330. border="none"
  331. ></u-input>
  332. </view>
  333. </view>
  334. </view>
  335. <view class="form-row" v-if="form.conditionType == 1">
  336. <view class="form-item">
  337. <text class="label">数量</text>
  338. <view class="value-wrap">
  339. <u-input
  340. v-model="form.portion"
  341. :disabled="type == 'view'"
  342. placeholder="请输入"
  343. border="none"
  344. ></u-input>
  345. </view>
  346. </view>
  347. </view>
  348. <view class="form-row" v-if="form.conditionType == 1">
  349. <view class="form-item">
  350. <text class="label">单位</text>
  351. <view class="value-wrap">
  352. <view
  353. class="select-input"
  354. :class="{
  355. disabled: form.isFirstSampling != '1' || type == 'view',
  356. }"
  357. @click="selectPackingUnit"
  358. >
  359. <text class="value-text">{{
  360. (packingSpecificationOption.find(
  361. (item) => item.id == form.packingUnit,
  362. ) &&
  363. packingSpecificationOption.find(
  364. (item) => item.id == form.packingUnit,
  365. ).conversionUnit) ||
  366. "请选择"
  367. }}</text>
  368. <text class="arrow">›</text>
  369. </view>
  370. </view>
  371. </view>
  372. </view>
  373. <view class="confirm-btn-wrap" v-if="type != 'view'">
  374. <u-button type="primary" @click="handleSampleSubmit"
  375. >确认</u-button
  376. >
  377. </view>
  378. </view>
  379. </view>
  380. <view class="form-section">
  381. <view class="section-title">样品信息</view>
  382. <view class="table-wrapper">
  383. <scroll-view scroll-x scroll-y class="table-scroll">
  384. <view class="sample-table">
  385. <view class="table-header">
  386. <view
  387. class="table-cell"
  388. v-for="col in displaySampleColumns"
  389. :key="col.prop"
  390. >
  391. {{ col.label }}
  392. </view>
  393. </view>
  394. <view class="table-body">
  395. <view
  396. class="table-row"
  397. v-for="(item, index) in sampleList"
  398. :key="index"
  399. >
  400. <view
  401. class="table-cell"
  402. v-for="col in displaySampleColumns"
  403. :key="col.prop"
  404. >
  405. {{ item[col.prop] || "-" }}
  406. </view>
  407. </view>
  408. <view
  409. class="table-empty"
  410. v-if="!sampleList || sampleList.length === 0"
  411. >
  412. <text>暂无数据</text>
  413. </view>
  414. </view>
  415. </view>
  416. </scroll-view>
  417. </view>
  418. </view>
  419. </scroll-view>
  420. <view class="popup-footer">
  421. <u-button type="default" @click="closePopup">关闭</u-button>
  422. <u-button
  423. type="primary"
  424. @click="save()"
  425. v-if="type != 'view'"
  426. :loading="loading"
  427. >保存</u-button
  428. >
  429. </view>
  430. </view>
  431. <u-toast ref="uToast"></u-toast>
  432. <!-- 记录方法选择 -->
  433. <u-picker
  434. :show="showRecordingMethodPicker"
  435. keyName="label"
  436. :columns="[recordingMethodList]"
  437. @confirm="confirmRecordingMethod"
  438. @cancel="showRecordingMethodPicker = false"
  439. ></u-picker>
  440. <!-- 请样类型选择 -->
  441. <u-picker
  442. :show="showConditionTypePicker"
  443. :columns="[conditionTypeColumns]"
  444. keyName="label"
  445. @confirm="confirmConditionType"
  446. @cancel="showConditionTypePicker = false"
  447. ></u-picker>
  448. <!-- 包装单位选择 -->
  449. <u-picker
  450. :show="showPackingUnitPicker"
  451. keyName="label"
  452. :columns="[
  453. packingSpecificationOption.map((item) => {
  454. return {
  455. label: item.conversionUnit,
  456. value: item.id,
  457. };
  458. }),
  459. ]"
  460. @confirm="confirmPackingUnit"
  461. @cancel="showPackingUnitPicker = false"
  462. ></u-picker>
  463. </u-popup>
  464. </view>
  465. </template>
  466. <script>
  467. import { recordingMethodList } from "@/utils/utils.js";
  468. import DictSelection from "@/components/Dict/DictSelection.vue";
  469. const defForm = {
  470. code: "", //编码
  471. name: "", //名称
  472. conditionType: "",
  473. quantity: "",
  474. unit: "",
  475. portion: "",
  476. qualityMode: "",
  477. qualityModeName: "",
  478. recordingMethod: 1,
  479. recordingMethodName: "",
  480. pleaseQuantity: "",
  481. pleasePurpose: "",
  482. pleaseUnit: "",
  483. sampleQuantity: "",
  484. qualityWorkOrderId: "",
  485. qualityWorkOrderCode: "",
  486. qualityWorkOrderName: "",
  487. isFirstSampling: "",
  488. measureUnit: "",
  489. };
  490. import {
  491. queryQualityInventory,
  492. queryQualityTempleContent,
  493. } from "@/api/inspectionWork";
  494. import {
  495. samplingrecordSave,
  496. getById,
  497. samplingrecordUpdate,
  498. samplingRecordsPage,
  499. } from "@/api/samplingRecords";
  500. import { getCodeList, getCode, parameterGetByCode } from "@/api/pda/picking.js";
  501. export default {
  502. components: {
  503. DictSelection,
  504. },
  505. data() {
  506. return {
  507. recordingMethodList,
  508. form: {
  509. ...defForm,
  510. },
  511. activeComp: "main",
  512. tabOptions: [
  513. {
  514. key: "main",
  515. name: "请样详情",
  516. },
  517. {
  518. key: "bpm",
  519. name: "流程详情",
  520. },
  521. ],
  522. workSampleQuantity: 0,
  523. visible: false,
  524. loading: false,
  525. sampleNumberList: [
  526. {
  527. label: "全检",
  528. value: 1,
  529. },
  530. {
  531. label: "抽检",
  532. value: 2,
  533. },
  534. ],
  535. selection: [],
  536. // 弹窗相关
  537. showRecordingMethodPicker: false,
  538. showConditionTypePicker: false,
  539. showUnitPicker: false,
  540. showPackingUnitPicker: false,
  541. recordingMethodPickerColumns: [],
  542. conditionTypeColumns: [
  543. {
  544. label: "请整样",
  545. value: 1,
  546. },
  547. {
  548. label: "请小样",
  549. value: 2,
  550. },
  551. ],
  552. packingUnitColumns: [[]],
  553. // 显示的表格列
  554. displaySourceColumns: [
  555. {
  556. label: "",
  557. prop: "select",
  558. type: "selection",
  559. },
  560. {
  561. label: "名称",
  562. prop: "categoryName",
  563. },
  564. {
  565. label: "计量数量",
  566. prop: "measureQuantity",
  567. },
  568. {
  569. label: "计量单位",
  570. prop: "measureUnit",
  571. },
  572. {
  573. label: "包装数量",
  574. prop: "packingQuantity",
  575. },
  576. {
  577. label: "包装单位",
  578. prop: "packingUnit",
  579. },
  580. ],
  581. displaySampleColumns: [
  582. {
  583. label: "样品编码",
  584. prop: "sampleCode",
  585. },
  586. {
  587. label: "名称",
  588. prop: "categoryName",
  589. },
  590. {
  591. label: "计量数量",
  592. prop: "measureQuantity",
  593. },
  594. {
  595. label: "计量单位",
  596. prop: "measureUnit",
  597. },
  598. {
  599. label: "包装数量",
  600. prop: "packingQuantity",
  601. },
  602. {
  603. label: "包装单位",
  604. prop: "packingUnit",
  605. },
  606. ],
  607. packingSpecificationOption: [],
  608. sampleList: [],
  609. schemeList: [],
  610. tableList: [],
  611. type: "add",
  612. title: "",
  613. isSamplingApproval: 0,
  614. isSampleRecord: false,
  615. isAllSelected: false,
  616. };
  617. },
  618. computed: {
  619. allSelected() {
  620. return (
  621. this.tableList.length > 0 &&
  622. this.selection.length === this.tableList.length
  623. );
  624. },
  625. },
  626. created() {},
  627. methods: {
  628. // 切换全选
  629. toggleSelectAll() {
  630. if (this.isAllSelected) {
  631. this.selection = [];
  632. } else {
  633. this.selection = [...this.tableList];
  634. }
  635. this.isAllSelected = !this.isAllSelected;
  636. },
  637. // 切换单选
  638. toggleSelect(item) {
  639. const index = this.selection.findIndex((row) => row.id === item.id);
  640. if (index > -1) {
  641. this.selection.splice(index, 1);
  642. } else {
  643. this.selection.push(item);
  644. }
  645. this.isAllSelected = this.selection.length === this.tableList.length;
  646. },
  647. // 判断是否选中
  648. isSelected(item) {
  649. return this.selection.findIndex((row) => row.id === item.id) > -1;
  650. },
  651. closePopup() {
  652. this.cancel();
  653. },
  654. async open(type, row) {
  655. // this.activeComp = 'main';
  656. this.visible = true;
  657. this.type = type;
  658. // this.parameterGetByCode();
  659. this.title =
  660. type == "add" ? "请样" : type == "edit" ? "修改请样" : "详情";
  661. if (type == "add") {
  662. if (row) {
  663. this.init(row);
  664. }
  665. } else {
  666. this.getById(row.id);
  667. }
  668. },
  669. // 记录方法选择
  670. selectRecordingMethod() {
  671. console.log(this.form.isFirstSampling, "this.form.isFirstSampling");
  672. if (this.form.isFirstSampling != "1") return;
  673. // this.recordingMethodPickerColumns = [this.recordingMethodList];
  674. this.showRecordingMethodPicker = true;
  675. },
  676. confirmRecordingMethod(e) {
  677. this.form.recordingMethod = e.value[0].value;
  678. this.form.recordingMethodName = e.value[0].label;
  679. this.showRecordingMethodPicker = false;
  680. },
  681. // 请样类型选择
  682. selectConditionType() {
  683. if (this.form.isFirstSampling != "1") return;
  684. this.showConditionTypePicker = true;
  685. },
  686. confirmConditionType(e) {
  687. this.form.conditionType = e.value[0].value;
  688. this.form.conditionTypeName = e.value[0].label;
  689. this.showConditionTypePicker = false;
  690. },
  691. // 包装单位选择
  692. selectPackingUnit() {
  693. if (this.form.isFirstSampling != "1") return;
  694. // let unitList = this.packingSpecificationOption.map(
  695. // (item) => item.conversionUnit,
  696. // );
  697. // this.packingUnitColumns = [unitList];
  698. this.showPackingUnitPicker = true;
  699. },
  700. confirmPackingUnit(e) {
  701. this.$set(this.form, "packingUnit", e.value[0].value);
  702. this.$set(this.form, "unit", e.value[0].label);
  703. this.showPackingUnitPicker = false;
  704. },
  705. parameterGetByCode() {
  706. parameterGetByCode({
  707. code: "sampling_approval",
  708. }).then((res) => {
  709. this.isSamplingApproval = res.value;
  710. });
  711. },
  712. async init(row) {
  713. let isPackingUnit = false;
  714. let data = await samplingRecordsPage({
  715. qualityWorkOrderId: row.id,
  716. });
  717. let list = data.list.filter(
  718. (item) => item.status === 0 || item.status === 4,
  719. );
  720. let list1 = data.list.filter((item) => item.status != 3);
  721. if (list?.length) {
  722. this.getById(list[0].id);
  723. this.type = "edit";
  724. this.title = "修改请样";
  725. } else {
  726. row.sourceCode = row.qualityPlanCode || row.workOrderCode;
  727. this.form = JSON.parse(JSON.stringify(row));
  728. this.form.qualityWorkOrderId = row.id;
  729. this.form.qualityWorkOrderCode = row.code;
  730. this.form.qualityWorkOrderName = row.name;
  731. this.workSampleQuantity = Number(row.sampleQuantity) || 0;
  732. this.form.recordingMethod = this.form.recordingMethod || "1";
  733. if (!list1?.length) {
  734. this.form.isFirstSampling = 1;
  735. isPackingUnit = true;
  736. if (this.form.conditionType == 1) {
  737. this.$set(this.form, "packingUnit", "111");
  738. }
  739. } else {
  740. this.$set(this.form, "unit", list1[0].unit);
  741. this.$set(this.form, "measureUnit", list1[0].measureUnit);
  742. }
  743. await this.datasource(list1[0]?.unit, isPackingUnit);
  744. await this.queryQualityTempleContent(
  745. !list1.length && row.qualityMode == 1,
  746. );
  747. let userInfo = uni.getStorageSync("userInfo");
  748. if (userInfo.clientEnvironmentId == 10 && this.form.qualityType == 3) {
  749. this.form.qualityMode = 2;
  750. this.form.recordingMethod = 2;
  751. this.form.conditionType = 2;
  752. this.form.quantity = 1;
  753. this.form.portion = 1;
  754. await this.queryQualityTempleContent(true);
  755. this.save();
  756. }
  757. }
  758. },
  759. getById(id) {
  760. getById(id).then((res) => {
  761. this.workSampleQuantity =
  762. Number(res.qualityWorkOrderVO.sampleQuantity) || 0;
  763. [
  764. "id",
  765. "code",
  766. "name",
  767. "createTime",
  768. "createUserId",
  769. "status",
  770. "approvalStatus",
  771. "approvalUserId",
  772. "sampleQuantity",
  773. "processInstanceId",
  774. ].forEach((it) => {
  775. delete res.qualityWorkOrderVO[it];
  776. });
  777. this.form = {
  778. ...res,
  779. ...res.qualityWorkOrderVO,
  780. };
  781. this.datasource(this.form.unit);
  782. this.queryQualityTempleContent();
  783. if (this.form.qualityMode == 2) {
  784. if (res.qualityWorkOrderVO.conditionType == 1) {
  785. this.$set(this.form, "portion", res.quantity);
  786. this.$set(this.form, "quantity", 0);
  787. } else {
  788. this.$set(this.form, "portion", res.copies);
  789. }
  790. }
  791. this.sampleList = res.qualitySampleList;
  792. });
  793. },
  794. /* 查询质检模板内容 */
  795. async queryQualityTempleContent(is) {
  796. const res = await queryQualityTempleContent({
  797. qualityWorkerId: this.form.qualityWorkOrderId,
  798. page: 1,
  799. size: 10000,
  800. });
  801. this.schemeList = res.list;
  802. if (is) {
  803. await this.updatePackingList();
  804. }
  805. return;
  806. },
  807. cancel() {
  808. this.form = {
  809. ...defForm,
  810. };
  811. this.workSampleQuantity = 0;
  812. this.schemeList = [];
  813. this.packingSpecificationOption = [];
  814. this.sampleList = [];
  815. this.tableList = [];
  816. this.visible = false;
  817. },
  818. async datasource(unit, isPackingUnit) {
  819. const res = await queryQualityInventory({
  820. qualityWorkerId: this.form.qualityWorkOrderId,
  821. pageNum: 1,
  822. size: -1,
  823. });
  824. console.log(res, "res");
  825. let o = res.list[0];
  826. let listArr = [];
  827. if (o.measureUnit) {
  828. listArr.push({
  829. packageCellTotal: 1,
  830. conversionUnit: o.measureUnit,
  831. id: "111",
  832. });
  833. }
  834. if (o.packingUnit) {
  835. listArr.push({
  836. packageCellTotal: o.measureQuantity - 0,
  837. conversionUnit: o.packingUnit,
  838. id: "222",
  839. });
  840. }
  841. if (unit) {
  842. this.$set(
  843. this.form,
  844. "packingUnit",
  845. listArr.find((item) => unit == item.conversionUnit)?.id,
  846. );
  847. }
  848. if (isPackingUnit) {
  849. this.$set(this.form, "unit", res.list[0]?.measureUnit);
  850. }
  851. this.form.pleaseUnit = res.list[0]?.measureUnit;
  852. res.list.map((el) => {
  853. el.weightProportion = el.weight
  854. ? (el.weight / el.measureQuantity).toFixed(4)
  855. : 0;
  856. el.weightProportion = el.weightProportion - 0;
  857. });
  858. this.packingSpecificationOption = listArr;
  859. this.tableList = res.list;
  860. return res;
  861. },
  862. handleSampleSubmit() {
  863. let params = {
  864. conditionType: this.form.conditionType,
  865. quantity: this.form.quantity,
  866. sampleUnit: this.form.unit,
  867. portion: this.form.portion,
  868. };
  869. let specifications = this.packingSpecificationOption.find(
  870. (el) => el.id == this.form.packingUnit,
  871. );
  872. this.sampleFn(params, specifications);
  873. },
  874. async sampleFn(data, specifications) {
  875. console.log(this.selection, "this.selection");
  876. this.sampleList = [];
  877. if (!this.selection || this.selection.length == 0) {
  878. this.$refs.uToast.show({
  879. type: "error",
  880. icon: false,
  881. message: "请先选择来源清单!",
  882. });
  883. return;
  884. }
  885. const quantity = data.quantity || 1;
  886. const unit = data.sampleUnit;
  887. const sampleCount = Number(data.portion);
  888. try {
  889. // 2 取小样
  890. if (this.form.conditionType == 2) {
  891. if (!this.validateMeasureQuantity(quantity, unit, sampleCount))
  892. return; //取样数量验证
  893. if (unit === "KG" && !this.validateWeight(quantity, sampleCount))
  894. return; // 若计量单位为重量,还需验证总重量是否足够
  895. await this.getNewFullSampleList(
  896. Math.ceil(sampleCount),
  897. quantity,
  898. unit,
  899. specifications,
  900. );
  901. } else {
  902. let isFlag = this.validateSampleQuantity(sampleCount, specifications);
  903. if (!isFlag) return;
  904. if (this.form.inspectionStandards == 1) {
  905. await this.getNewFullSampleList(
  906. Math.ceil(sampleCount),
  907. quantity,
  908. unit,
  909. specifications,
  910. );
  911. } else {
  912. await this.handleWeightFullSample(sampleCount, specifications);
  913. }
  914. }
  915. } catch (error) {
  916. console.error("请样处理失败:", error);
  917. this.$refs.uToast.show({
  918. type: "error",
  919. icon: false,
  920. message: "请样处理失败!",
  921. });
  922. }
  923. },
  924. validateWeight(quantity, sampleCount) {
  925. let totalMaxPossible = 0;
  926. this.selection.forEach((item) => {
  927. totalMaxPossible += item.measureQuantity / quantity;
  928. });
  929. if (totalMaxPossible < sampleCount) {
  930. console.error("请样处理失败:", error);
  931. this.$refs.uToast.show({
  932. type: "error",
  933. icon: false,
  934. message: `最大请样条数为${totalMaxPossible}`,
  935. });
  936. return false;
  937. }
  938. let totalWeight = this.selection.reduce(
  939. (sum, item) => sum + item.weight,
  940. 0,
  941. );
  942. const weightUnit = this.selection[0].weightUnit;
  943. if (weightUnit === "G") totalWeight /= 1000;
  944. if (quantity * sampleCount > totalWeight) {
  945. this.$refs.uToast.show({
  946. type: "error",
  947. icon: false,
  948. message: `请样计量重量不能大于总计量重量`,
  949. });
  950. return false;
  951. }
  952. const invalidItem = this.selection.find((item) => {
  953. const weight =
  954. item.weightUnit === "G" ? item.weight / 1000 : item.weight;
  955. return weight < quantity;
  956. });
  957. if (invalidItem) {
  958. this.$refs.uToast.show({
  959. type: "error",
  960. icon: false,
  961. message: `勾选条目重量小于请样重量`,
  962. });
  963. return false;
  964. }
  965. return true;
  966. },
  967. validateMeasureQuantity(quantity, unit, sampleCount) {
  968. if (quantity <= 0) {
  969. this.$refs.uToast.show({
  970. type: "error",
  971. icon: false,
  972. message: `请样计量数量必须大于`,
  973. });
  974. return false;
  975. }
  976. const totalQuantity =
  977. this.selection.reduce((sum, item) => sum + item.measureQuantity, 0) -
  978. this.workSampleQuantity;
  979. if (
  980. this.selection[0].measureUnit === unit &&
  981. quantity * sampleCount > totalQuantity
  982. ) {
  983. this.$refs.uToast.show({
  984. type: "error",
  985. icon: false,
  986. message: `请样计量数量不能大于总计量数量`,
  987. });
  988. return false;
  989. }
  990. const invalidItem = this.selection.find(
  991. (item) => item.measureQuantity < quantity,
  992. );
  993. if (invalidItem) {
  994. this.$refs.uToast.show({
  995. type: "error",
  996. icon: false,
  997. message: `条目计量数量小于请样计量数量`,
  998. });
  999. return false;
  1000. }
  1001. return true;
  1002. },
  1003. async handleWeightFullSample(sampleCount, specifications) {
  1004. const dataList = [];
  1005. let currentNum = sampleCount - this.selection.length;
  1006. let currentNum1 = sampleCount;
  1007. for (const item of this.selection) {
  1008. const qualitySampleTemplateList = item.qualitySampleTemplateList?.length
  1009. ? JSON.parse(JSON.stringify(item.qualitySampleTemplateList))
  1010. : JSON.parse(
  1011. JSON.stringify(
  1012. this.schemeList.map((item) => {
  1013. item["qualityResults"] = 1;
  1014. return item;
  1015. }),
  1016. ),
  1017. );
  1018. if (sampleCount >= this.selection.length) {
  1019. dataList.push({
  1020. ...item,
  1021. measureQuantity: 1, //作为计量数量
  1022. sampleCode: await getCode("sample_code"),
  1023. qualitySampleTemplateList,
  1024. });
  1025. } else {
  1026. if (dataList.length < sampleCount) {
  1027. dataList.push({
  1028. ...item,
  1029. measureQuantity: currentNum1 > 1 ? 1 : currentNum1, //作为计量数量
  1030. sampleCode: await getCode("sample_code"),
  1031. qualitySampleTemplateList,
  1032. });
  1033. currentNum1 -= 1;
  1034. }
  1035. }
  1036. }
  1037. if (sampleCount > this.selection.length) {
  1038. dataList.forEach((item) => {
  1039. if (currentNum > 0) {
  1040. let data = this.selection.find((val) => val.id == item.id);
  1041. item["measureQuantity"] =
  1042. data.measureQuantity - 1 - currentNum > 0
  1043. ? currentNum + 1
  1044. : data.measureQuantity;
  1045. currentNum = currentNum - (data.measureQuantity - 1);
  1046. }
  1047. });
  1048. }
  1049. // 更改 从新计算 样品清单 取整样 数据
  1050. if (specifications && specifications.id) {
  1051. dataList.map((el) => {
  1052. el.measureQuantity =
  1053. el.measureQuantity * specifications.packageCellTotal;
  1054. el.weight = this.formatNumber(
  1055. el.measureQuantity,
  1056. el.weightProportion,
  1057. );
  1058. });
  1059. }
  1060. // 更改
  1061. this.sampleList = dataList;
  1062. this.getTotal();
  1063. },
  1064. // 小数点数据判断
  1065. formatNumber(a, b, maxDecimals = 4) {
  1066. if (a == 0 || b == 0 || !a || !b) {
  1067. return 0;
  1068. }
  1069. const product = a * b;
  1070. const rounded = Number(product.toFixed(maxDecimals));
  1071. const str = rounded.toString();
  1072. if (str.indexOf(".") !== -1) {
  1073. return str.replace(/\.?0+$/, "");
  1074. }
  1075. return str;
  1076. },
  1077. //从来源数组取样到目标数组
  1078. async getNewFullSampleList(
  1079. sampleCount,
  1080. sampleQuantity,
  1081. sampleUnit,
  1082. specifications,
  1083. ) {
  1084. const sourceArray = this.selection;
  1085. const isUnitMismatch =
  1086. sourceArray.length > 0 && sourceArray[0].measureUnit !== sampleUnit;
  1087. const items = sourceArray.map((item) => ({
  1088. ...item,
  1089. remainingQuantity: isUnitMismatch ? Infinity : item["measureQuantity"],
  1090. maxPossible: item["measureQuantity"] / sampleQuantity,
  1091. }));
  1092. const result = [];
  1093. let remainingCount = sampleCount;
  1094. let count = Math.ceil(remainingCount);
  1095. const codeList = await this.batchCodes(count);
  1096. let codeIdx = 0;
  1097. while (remainingCount > 0) {
  1098. items.sort(
  1099. (a, b) =>
  1100. b.remainingQuantity / b["measureQuantity"] -
  1101. a.remainingQuantity / a["measureQuantity"],
  1102. );
  1103. let distributed = false;
  1104. for (const item of items) {
  1105. if (
  1106. !isUnitMismatch ||
  1107. (item.remainingQuantity >= sampleQuantity && remainingCount > 0)
  1108. ) {
  1109. let qualitySampleTemplateList = [];
  1110. if (
  1111. item.qualitySampleTemplateList == undefined ||
  1112. item.qualitySampleTemplateList == null ||
  1113. item.qualitySampleTemplateList.length == 0
  1114. ) {
  1115. qualitySampleTemplateList = JSON.parse(
  1116. JSON.stringify(this.schemeList),
  1117. );
  1118. } else {
  1119. qualitySampleTemplateList = item.qualitySampleTemplateList;
  1120. }
  1121. let sampleCode = codeList[codeIdx];
  1122. if (
  1123. this.form.conditionType == 1 &&
  1124. this.form.inspectionStandards == 1
  1125. ) {
  1126. result.push({
  1127. ...item,
  1128. measureQuantity: 1,
  1129. sampleCode,
  1130. qualitySampleTemplateList,
  1131. });
  1132. } else if (this.form.conditionType == 2) {
  1133. let weight = (item.weight / item.maxPossible).toFixed(2);
  1134. result.push({
  1135. ...item,
  1136. measureQuantity: sampleQuantity,
  1137. measureUnit: sampleUnit,
  1138. sampleCode,
  1139. weight,
  1140. qualitySampleTemplateList,
  1141. });
  1142. }
  1143. if (!isUnitMismatch) {
  1144. item.remainingQuantity -= sampleQuantity;
  1145. }
  1146. remainingCount = (remainingCount - 1).toFixed(2);
  1147. codeIdx++;
  1148. distributed = true;
  1149. }
  1150. }
  1151. if (!distributed) {
  1152. break;
  1153. }
  1154. }
  1155. if (this.form.conditionType == 1 && specifications && specifications.id) {
  1156. result.map((el) => {
  1157. el.measureQuantity =
  1158. el.measureQuantity * specifications.packageCellTotal;
  1159. el.weight = this.formatNumber(
  1160. el.measureQuantity,
  1161. el.weightProportion,
  1162. );
  1163. });
  1164. }
  1165. this.sampleList = result;
  1166. if (this.sampleList.length > sampleCount) {
  1167. this.sampleList = this.sampleList.splice(0, sampleCount);
  1168. }
  1169. this.getTotal();
  1170. },
  1171. // 当计量类型 是数量的时候 取整样 校验
  1172. validateSampleQuantity(sampleCount, specifications) {
  1173. let packingUnit = this.selection[0].packingUnit?.trim() || "";
  1174. let totalS = 0;
  1175. let measureQuantityCount = 0;
  1176. let labelKey =
  1177. packingUnit == specifications.conversionUnit.trim()
  1178. ? "packingQuantity"
  1179. : "measureQuantity";
  1180. let labelName = labelKey == "packingQuantity" ? "包装数量" : "计量数量";
  1181. totalS = this.selection.reduce((total, el) => total + el[labelKey], 0);
  1182. let formTotalS = this.tableList.reduce(
  1183. (total, el) => total + el.measureQuantity,
  1184. 0,
  1185. );
  1186. if (sampleCount > totalS) {
  1187. this.$refs.uToast.show({
  1188. type: "error",
  1189. icon: false,
  1190. message: `所填的条目数量不能超过所选${labelName}总和${totalS}`,
  1191. });
  1192. return false;
  1193. }
  1194. if (labelKey == "packingQuantity") {
  1195. measureQuantityCount = sampleCount * this.selection[0].measureQuantity;
  1196. } else {
  1197. measureQuantityCount = sampleCount;
  1198. }
  1199. if (measureQuantityCount > formTotalS - this.workSampleQuantity) {
  1200. this.$refs.uToast.show({
  1201. type: "error",
  1202. icon: false,
  1203. message: `请样数量不能大于${formTotalS - this.workSampleQuantity} ${
  1204. this.selection[0].measureUnit
  1205. }`,
  1206. });
  1207. return false;
  1208. }
  1209. return true;
  1210. },
  1211. handleQualityModeChange({ dictCode, dictValue }) {
  1212. if (dictCode == 1) {
  1213. this.updatePackingList();
  1214. } else {
  1215. this.sampleList = [];
  1216. this.getTotal();
  1217. }
  1218. },
  1219. // 全检
  1220. async updatePackingList() {
  1221. let list = this.tableList;
  1222. const dataList = [];
  1223. let count = list ? list.length : 0;
  1224. const codeList = await this.batchCodes(count);
  1225. for (const [index, item] of list.entries()) {
  1226. const qualitySampleTemplateList = item.qualitySampleTemplateList?.length
  1227. ? JSON.parse(JSON.stringify(item.qualitySampleTemplateList))
  1228. : JSON.parse(
  1229. JSON.stringify(
  1230. this.schemeList.map((item) => {
  1231. item["qualityResults"] = 1;
  1232. return item;
  1233. }),
  1234. ),
  1235. );
  1236. dataList.push({
  1237. ...item,
  1238. measureQuantity: item.measureQuantity,
  1239. sampleCode: codeList[index],
  1240. qualitySampleTemplateList,
  1241. });
  1242. }
  1243. this.sampleList = dataList;
  1244. this.getTotal();
  1245. },
  1246. getTotal() {
  1247. this.form.sampleQuantity = this.sampleList
  1248. .reduce((total, el) => total + Number(el.measureQuantity), 0)
  1249. .toFixed(2);
  1250. this.form.sampleWeight = this.sampleList
  1251. .reduce((total, el) => total + Number(el.weight), 0)
  1252. .toFixed(2);
  1253. },
  1254. async batchCodes(count) {
  1255. if (count <= 0) return;
  1256. let params = {
  1257. count,
  1258. };
  1259. const res = await getCodeList("sample_code", params);
  1260. return res;
  1261. },
  1262. /* 保存编辑 */
  1263. save(type) {
  1264. if (this.type == "add") {
  1265. [
  1266. "id",
  1267. "code",
  1268. "name",
  1269. "createTime",
  1270. "createUserId",
  1271. "status",
  1272. "approvalStatus",
  1273. "approvalUserId",
  1274. ].forEach((key) => {
  1275. delete this.form[key];
  1276. });
  1277. }
  1278. let data = JSON.parse(JSON.stringify(this.form));
  1279. // 验证
  1280. if (!this.form.qualityWorkOrderCode) {
  1281. uni.showToast({
  1282. title: "请选择质检工单",
  1283. icon: "none",
  1284. });
  1285. return;
  1286. }
  1287. if (!this.form.qualityMode) {
  1288. uni.showToast({
  1289. title: "请选择质检方式",
  1290. icon: "none",
  1291. });
  1292. return;
  1293. }
  1294. if (!this.form.recordingMethod) {
  1295. uni.showToast({
  1296. title: "请选择记录方法",
  1297. icon: "none",
  1298. });
  1299. return;
  1300. }
  1301. if (this.form.qualityMode == "2" && !this.form.conditionType) {
  1302. uni.showToast({
  1303. title: "请选择请样类型",
  1304. icon: "none",
  1305. });
  1306. return;
  1307. }
  1308. if (!this.sampleList.length) {
  1309. uni.showToast({
  1310. title: "样品清单不能为空!",
  1311. icon: "none",
  1312. });
  1313. return;
  1314. }
  1315. //抽检
  1316. if (data.qualityMode == 2) {
  1317. //取整样
  1318. if (data.conditionType == 1) {
  1319. data.quantity = data.portion;
  1320. } else {
  1321. data.copies = data.portion;
  1322. }
  1323. }
  1324. data.measureUnit = this.sampleList[0].measureUnit;
  1325. let api = this.type == "add" ? samplingrecordSave : samplingrecordUpdate;
  1326. this.loading = true;
  1327. api({
  1328. ...data,
  1329. sampleList: this.sampleList,
  1330. })
  1331. .then((res) => {
  1332. this.loading = false;
  1333. uni.showToast({
  1334. title: "操作成功",
  1335. icon: "success",
  1336. });
  1337. if (type == "submit") {
  1338. this.approvalSubmit(this.type == "add" ? res : data.id);
  1339. } else {
  1340. this.cancel();
  1341. this.$emit("reload");
  1342. }
  1343. })
  1344. .catch(() => {
  1345. this.loading = false;
  1346. });
  1347. },
  1348. async approvalSubmit(id) {
  1349. const res = await getById(id);
  1350. this.processSubmitDialogFlag = true;
  1351. this.$nextTick(() => {
  1352. let params = {
  1353. businessId: res.id,
  1354. businessKey: "sampling_approval_process",
  1355. formCreateUserId: res.createUserId,
  1356. variables: {
  1357. businessCode: res.code,
  1358. businessName: "请样",
  1359. businessType:
  1360. res.qualityWorkOrderVO.conditionType == 1 ? "整样" : "小样",
  1361. },
  1362. };
  1363. this.$refs.processSubmitDialogRef.init(params);
  1364. });
  1365. },
  1366. search() {
  1367. this.cancel();
  1368. this.$emit("reload");
  1369. },
  1370. },
  1371. };
  1372. </script>
  1373. <style lang="scss" scoped>
  1374. .popup-content {
  1375. width: 100vw;
  1376. height: 90vh;
  1377. background: #fff;
  1378. border-radius: 0;
  1379. display: flex;
  1380. flex-direction: column;
  1381. }
  1382. .popup-header {
  1383. display: flex;
  1384. justify-content: space-between;
  1385. align-items: center;
  1386. padding: 30rpx;
  1387. border-bottom: 1rpx solid #e5e5e5;
  1388. .popup-title {
  1389. font-size: 36rpx;
  1390. font-weight: bold;
  1391. color: #333;
  1392. }
  1393. .close-btn {
  1394. width: 60rpx;
  1395. height: 60rpx;
  1396. display: flex;
  1397. align-items: center;
  1398. justify-content: center;
  1399. font-size: 60rpx;
  1400. color: #999;
  1401. line-height: 1;
  1402. }
  1403. }
  1404. .popup-body {
  1405. flex: 1;
  1406. overflow-y: auto;
  1407. padding: 0 30rpx 30rpx;
  1408. }
  1409. .form-section {
  1410. margin-top: 30rpx;
  1411. .section-title {
  1412. font-size: 32rpx;
  1413. font-weight: bold;
  1414. color: #333;
  1415. margin-bottom: 20rpx;
  1416. padding-left: 20rpx;
  1417. border-left: 6rpx solid #157a2c;
  1418. }
  1419. .form-row {
  1420. margin-bottom: 20rpx;
  1421. .form-item {
  1422. display: flex;
  1423. align-items: center;
  1424. padding: 20rpx 0;
  1425. border-bottom: 1rpx solid #f5f5f5;
  1426. .label {
  1427. width: 150rpx;
  1428. font-size: 28rpx;
  1429. color: #333;
  1430. flex-shrink: 0;
  1431. &::after {
  1432. content: ":";
  1433. }
  1434. }
  1435. .value-wrap {
  1436. flex: 1;
  1437. min-height: 60rpx;
  1438. display: flex;
  1439. align-items: center;
  1440. position: relative;
  1441. &.disabled {
  1442. opacity: 0.6;
  1443. }
  1444. .arrow {
  1445. color: #999;
  1446. font-size: 40rpx;
  1447. line-height: 1;
  1448. }
  1449. }
  1450. }
  1451. }
  1452. }
  1453. .table-info {
  1454. padding: 20rpx;
  1455. font-size: 28rpx;
  1456. color: #666;
  1457. background: #f9f9f9;
  1458. border-radius: 8rpx;
  1459. margin-bottom: 20rpx;
  1460. }
  1461. .table-wrapper {
  1462. border: 1rpx solid #e5e5e5;
  1463. border-radius: 8rpx;
  1464. overflow: hidden;
  1465. max-height: 400rpx;
  1466. }
  1467. .table-scroll {
  1468. width: 100%;
  1469. height: 400rpx;
  1470. }
  1471. .source-table {
  1472. min-width: 100%;
  1473. width: 950rpx;
  1474. }
  1475. .table-header {
  1476. display: flex;
  1477. background: #f5f5f5;
  1478. z-index: 10;
  1479. min-width: 100%;
  1480. box-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.05);
  1481. .table-cell {
  1482. padding: 20rpx 10rpx;
  1483. font-size: 26rpx;
  1484. font-weight: bold;
  1485. color: #333;
  1486. text-align: center;
  1487. border-right: 1rpx solid #e5e5e5;
  1488. white-space: nowrap;
  1489. overflow: hidden;
  1490. text-overflow: ellipsis;
  1491. flex-shrink: 0;
  1492. &.select-cell {
  1493. width: 80rpx;
  1494. display: flex;
  1495. align-items: center;
  1496. justify-content: center;
  1497. padding: 20rpx;
  1498. }
  1499. &:nth-child(2) {
  1500. width: 300rpx;
  1501. }
  1502. &:nth-child(3),
  1503. &:nth-child(4),
  1504. &:nth-child(5),
  1505. &:nth-child(6) {
  1506. width: 140rpx;
  1507. }
  1508. &:last-child {
  1509. border-right: none;
  1510. }
  1511. }
  1512. }
  1513. .sample-table {
  1514. min-width: 100%;
  1515. width: 1040rpx;
  1516. }
  1517. .table-body {
  1518. .table-row {
  1519. display: flex;
  1520. border-bottom: 1rpx solid #e5e5e5;
  1521. &:last-child {
  1522. border-bottom: none;
  1523. }
  1524. .table-cell {
  1525. padding: 20rpx 10rpx;
  1526. font-size: 24rpx;
  1527. color: #666;
  1528. text-align: center;
  1529. border-right: 1rpx solid #e5e5e5;
  1530. white-space: nowrap;
  1531. overflow: hidden;
  1532. text-overflow: ellipsis;
  1533. flex-shrink: 0;
  1534. &.select-cell {
  1535. width: 80rpx;
  1536. display: flex;
  1537. align-items: center;
  1538. justify-content: center;
  1539. padding: 20rpx;
  1540. }
  1541. &:nth-child(2) {
  1542. width: 300rpx;
  1543. }
  1544. &:nth-child(3),
  1545. &:nth-child(4),
  1546. &:nth-child(5),
  1547. &:nth-child(6) {
  1548. width: 140rpx;
  1549. }
  1550. &:last-child {
  1551. border-right: none;
  1552. }
  1553. }
  1554. }
  1555. .table-empty {
  1556. padding: 60rpx 0;
  1557. text-align: center;
  1558. font-size: 28rpx;
  1559. color: #999;
  1560. }
  1561. }
  1562. // 样品信息表格特定样式
  1563. .sample-table {
  1564. .table-header {
  1565. .table-cell {
  1566. &:nth-child(1) {
  1567. width: 200rpx;
  1568. }
  1569. &:nth-child(2) {
  1570. width: 250rpx;
  1571. }
  1572. &:nth-child(3),
  1573. &:nth-child(4),
  1574. &:nth-child(5),
  1575. &:nth-child(6) {
  1576. width: 140rpx;
  1577. }
  1578. }
  1579. }
  1580. .table-body {
  1581. .table-cell {
  1582. &:nth-child(1) {
  1583. width: 200rpx;
  1584. }
  1585. &:nth-child(2) {
  1586. width: 250rpx;
  1587. }
  1588. &:nth-child(3),
  1589. &:nth-child(4),
  1590. &:nth-child(5),
  1591. &:nth-child(6) {
  1592. width: 140rpx;
  1593. }
  1594. }
  1595. }
  1596. }
  1597. .confirm-btn-wrap {
  1598. margin-top: 20rpx;
  1599. padding: 0 20rpx;
  1600. }
  1601. .popup-footer {
  1602. display: flex;
  1603. padding: 20rpx 30rpx;
  1604. border-top: 1rpx solid #e5e5e5;
  1605. gap: 20rpx;
  1606. /deep/ .u-button {
  1607. flex: 1;
  1608. }
  1609. }
  1610. .select-input {
  1611. display: flex;
  1612. align-items: center;
  1613. justify-content: space-between;
  1614. padding: 20rpx 0;
  1615. min-height: 70rpx;
  1616. border-bottom: 1rpx solid #e5e5e5;
  1617. width: 100%;
  1618. &.disabled {
  1619. opacity: 0.6;
  1620. }
  1621. .value-text {
  1622. flex: 1;
  1623. font-size: 28rpx;
  1624. color: #333;
  1625. &.empty {
  1626. color: #999;
  1627. }
  1628. }
  1629. .arrow {
  1630. font-size: 40rpx;
  1631. color: #999;
  1632. line-height: 1;
  1633. margin-left: 20rpx;
  1634. }
  1635. }
  1636. </style>