addSample.vue 40 KB

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