addSample.vue 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583
  1. <template>
  2. <view>
  3. <u-popup :show="visible" :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. const dataList = [];
  1083. let count = list ? list.length : 0;
  1084. const codeList = await this.batchCodes(count);
  1085. for (const [index, item] of list.entries()) {
  1086. const qualitySampleTemplateList = item.qualitySampleTemplateList?.length ?
  1087. JSON.parse(JSON.stringify(item.qualitySampleTemplateList)) :
  1088. JSON.parse(
  1089. JSON.stringify(
  1090. this.schemeList.map((item) => {
  1091. item["qualityResults"] = 1;
  1092. return item;
  1093. }),
  1094. ),
  1095. );
  1096. dataList.push({
  1097. ...item,
  1098. measureQuantity: item.measureQuantity,
  1099. sampleCode: codeList[index],
  1100. qualitySampleTemplateList,
  1101. });
  1102. }
  1103. this.sampleList = dataList;
  1104. this.getTotal();
  1105. },
  1106. getTotal() {
  1107. this.form.sampleQuantity = this.sampleList
  1108. .reduce((total, el) => total + Number(el.measureQuantity), 0)
  1109. .toFixed(2);
  1110. this.form.sampleWeight = this.sampleList
  1111. .reduce((total, el) => total + Number(el.weight), 0)
  1112. .toFixed(2);
  1113. },
  1114. async batchCodes(count) {
  1115. if (count <= 0) return;
  1116. let params = {
  1117. count
  1118. };
  1119. const res = await getCodeList("sample_code", params);
  1120. return res;
  1121. },
  1122. /* 保存编辑 */
  1123. save(type) {
  1124. if (this.type == "add") {
  1125. [
  1126. "id",
  1127. "code",
  1128. "name",
  1129. "createTime",
  1130. "createUserId",
  1131. "status",
  1132. "approvalStatus",
  1133. "approvalUserId",
  1134. ].forEach((key) => {
  1135. delete this.form[key];
  1136. });
  1137. }
  1138. let data = JSON.parse(JSON.stringify(this.form));
  1139. // 验证
  1140. if (!this.form.qualityWorkOrderCode) {
  1141. uni.showToast({
  1142. title: "请选择质检工单",
  1143. icon: "none"
  1144. });
  1145. return;
  1146. }
  1147. if (!this.form.qualityMode) {
  1148. uni.showToast({
  1149. title: "请选择质检方式",
  1150. icon: "none"
  1151. });
  1152. return;
  1153. }
  1154. if (!this.form.recordingMethod) {
  1155. uni.showToast({
  1156. title: "请选择记录方法",
  1157. icon: "none"
  1158. });
  1159. return;
  1160. }
  1161. if (this.form.qualityMode == "2" && !this.form.conditionType) {
  1162. uni.showToast({
  1163. title: "请选择请样类型",
  1164. icon: "none"
  1165. });
  1166. return;
  1167. }
  1168. if (!this.sampleList.length) {
  1169. uni.showToast({
  1170. title: "样品清单不能为空!",
  1171. icon: "none"
  1172. });
  1173. return;
  1174. }
  1175. //抽检
  1176. if (data.qualityMode == 2) {
  1177. //取整样
  1178. if (data.conditionType == 1) {
  1179. data.quantity = data.portion;
  1180. } else {
  1181. data.copies = data.portion;
  1182. }
  1183. }
  1184. data.measureUnit = this.sampleList[0].measureUnit;
  1185. let api = this.type == "add" ? samplingrecordSave : samplingrecordUpdate;
  1186. this.loading = true;
  1187. api({
  1188. ...data,
  1189. sampleList: this.sampleList,
  1190. })
  1191. .then((res) => {
  1192. this.loading = false;
  1193. uni.showToast({
  1194. title: "操作成功",
  1195. icon: "success"
  1196. });
  1197. if (type == "submit") {
  1198. this.approvalSubmit(this.type == "add" ? res : data.id);
  1199. } else {
  1200. this.cancel();
  1201. this.$emit("reload");
  1202. }
  1203. })
  1204. .catch(() => {
  1205. this.loading = false;
  1206. });
  1207. },
  1208. async approvalSubmit(id) {
  1209. const res = await getById(id);
  1210. this.processSubmitDialogFlag = true;
  1211. this.$nextTick(() => {
  1212. let params = {
  1213. businessId: res.id,
  1214. businessKey: "sampling_approval_process",
  1215. formCreateUserId: res.createUserId,
  1216. variables: {
  1217. businessCode: res.code,
  1218. businessName: "请样",
  1219. businessType: res.qualityWorkOrderVO.conditionType == 1 ? "整样" : "小样",
  1220. },
  1221. };
  1222. this.$refs.processSubmitDialogRef.init(params);
  1223. });
  1224. },
  1225. search() {
  1226. this.cancel();
  1227. this.$emit("reload");
  1228. },
  1229. },
  1230. };
  1231. </script>
  1232. <style lang="scss" scoped>
  1233. .popup-content {
  1234. width: 100vw;
  1235. height: 90vh;
  1236. background: #fff;
  1237. border-radius: 0;
  1238. display: flex;
  1239. flex-direction: column;
  1240. }
  1241. .popup-header {
  1242. display: flex;
  1243. justify-content: space-between;
  1244. align-items: center;
  1245. padding: 30rpx;
  1246. border-bottom: 1rpx solid #e5e5e5;
  1247. .popup-title {
  1248. font-size: 36rpx;
  1249. font-weight: bold;
  1250. color: #333;
  1251. }
  1252. .close-btn {
  1253. width: 60rpx;
  1254. height: 60rpx;
  1255. display: flex;
  1256. align-items: center;
  1257. justify-content: center;
  1258. font-size: 60rpx;
  1259. color: #999;
  1260. line-height: 1;
  1261. }
  1262. }
  1263. .popup-body {
  1264. flex: 1;
  1265. overflow-y: auto;
  1266. padding: 0 30rpx 30rpx;
  1267. }
  1268. .form-section {
  1269. margin-top: 30rpx;
  1270. .section-title {
  1271. font-size: 32rpx;
  1272. font-weight: bold;
  1273. color: #333;
  1274. margin-bottom: 20rpx;
  1275. padding-left: 20rpx;
  1276. border-left: 6rpx solid #157a2c;
  1277. }
  1278. .form-row {
  1279. margin-bottom: 20rpx;
  1280. .form-item {
  1281. display: flex;
  1282. align-items: center;
  1283. padding: 20rpx 0;
  1284. border-bottom: 1rpx solid #f5f5f5;
  1285. .label {
  1286. width: 150rpx;
  1287. font-size: 28rpx;
  1288. color: #333;
  1289. flex-shrink: 0;
  1290. &::after {
  1291. content: ":";
  1292. }
  1293. }
  1294. .value-wrap {
  1295. flex: 1;
  1296. min-height: 60rpx;
  1297. display: flex;
  1298. align-items: center;
  1299. position: relative;
  1300. &.disabled {
  1301. opacity: 0.6;
  1302. }
  1303. .arrow {
  1304. color: #999;
  1305. font-size: 40rpx;
  1306. line-height: 1;
  1307. }
  1308. }
  1309. }
  1310. }
  1311. }
  1312. .table-info {
  1313. padding: 20rpx;
  1314. font-size: 28rpx;
  1315. color: #666;
  1316. background: #f9f9f9;
  1317. border-radius: 8rpx;
  1318. margin-bottom: 20rpx;
  1319. }
  1320. .table-wrapper {
  1321. border: 1rpx solid #e5e5e5;
  1322. border-radius: 8rpx;
  1323. overflow: hidden;
  1324. max-height: 400rpx;
  1325. }
  1326. .table-scroll {
  1327. width: 100%;
  1328. height: 400rpx;
  1329. }
  1330. .source-table {
  1331. min-width: 100%;
  1332. width: 950rpx;
  1333. }
  1334. .table-header {
  1335. display: flex;
  1336. background: #f5f5f5;
  1337. z-index: 10;
  1338. min-width: 100%;
  1339. box-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.05);
  1340. .table-cell {
  1341. padding: 20rpx 10rpx;
  1342. font-size: 26rpx;
  1343. font-weight: bold;
  1344. color: #333;
  1345. text-align: center;
  1346. border-right: 1rpx solid #e5e5e5;
  1347. white-space: nowrap;
  1348. overflow: hidden;
  1349. text-overflow: ellipsis;
  1350. flex-shrink: 0;
  1351. &.select-cell {
  1352. width: 80rpx;
  1353. display: flex;
  1354. align-items: center;
  1355. justify-content: center;
  1356. padding: 20rpx;
  1357. }
  1358. &:nth-child(2) {
  1359. width: 300rpx;
  1360. }
  1361. &:nth-child(3),
  1362. &:nth-child(4),
  1363. &:nth-child(5),
  1364. &:nth-child(6) {
  1365. width: 140rpx;
  1366. }
  1367. &:last-child {
  1368. border-right: none;
  1369. }
  1370. }
  1371. }
  1372. .sample-table {
  1373. min-width: 100%;
  1374. width: 1040rpx;
  1375. }
  1376. .table-body {
  1377. .table-row {
  1378. display: flex;
  1379. border-bottom: 1rpx solid #e5e5e5;
  1380. &:last-child {
  1381. border-bottom: none;
  1382. }
  1383. .table-cell {
  1384. padding: 20rpx 10rpx;
  1385. font-size: 24rpx;
  1386. color: #666;
  1387. text-align: center;
  1388. border-right: 1rpx solid #e5e5e5;
  1389. white-space: nowrap;
  1390. overflow: hidden;
  1391. text-overflow: ellipsis;
  1392. flex-shrink: 0;
  1393. &.select-cell {
  1394. width: 80rpx;
  1395. display: flex;
  1396. align-items: center;
  1397. justify-content: center;
  1398. padding: 20rpx;
  1399. }
  1400. &:nth-child(2) {
  1401. width: 300rpx;
  1402. }
  1403. &:nth-child(3),
  1404. &:nth-child(4),
  1405. &:nth-child(5),
  1406. &:nth-child(6) {
  1407. width: 140rpx;
  1408. }
  1409. &:last-child {
  1410. border-right: none;
  1411. }
  1412. }
  1413. }
  1414. .table-empty {
  1415. padding: 60rpx 0;
  1416. text-align: center;
  1417. font-size: 28rpx;
  1418. color: #999;
  1419. }
  1420. }
  1421. // 样品信息表格特定样式
  1422. .sample-table {
  1423. .table-header {
  1424. .table-cell {
  1425. &:nth-child(1) {
  1426. width: 200rpx;
  1427. }
  1428. &:nth-child(2) {
  1429. width: 250rpx;
  1430. }
  1431. &:nth-child(3),
  1432. &:nth-child(4),
  1433. &:nth-child(5),
  1434. &:nth-child(6) {
  1435. width: 140rpx;
  1436. }
  1437. }
  1438. }
  1439. .table-body {
  1440. .table-cell {
  1441. &:nth-child(1) {
  1442. width: 200rpx;
  1443. }
  1444. &:nth-child(2) {
  1445. width: 250rpx;
  1446. }
  1447. &:nth-child(3),
  1448. &:nth-child(4),
  1449. &:nth-child(5),
  1450. &:nth-child(6) {
  1451. width: 140rpx;
  1452. }
  1453. }
  1454. }
  1455. }
  1456. .confirm-btn-wrap {
  1457. margin-top: 20rpx;
  1458. padding: 0 20rpx;
  1459. }
  1460. .popup-footer {
  1461. display: flex;
  1462. padding: 20rpx 30rpx;
  1463. border-top: 1rpx solid #e5e5e5;
  1464. gap: 20rpx;
  1465. /deep/ .u-button {
  1466. flex: 1;
  1467. }
  1468. }
  1469. </style>