scannedMaterials.vue 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387
  1. <template>
  2. <gui-page :custom-header="true" :header-class="['gui-theme-background-color']">
  3. <template #gHeader>
  4. <view style="height:44px;" class="gui-flex gui-nowrap gui-rows gui-align-items-center">
  5. <!-- 使用组件实现返回按钮及返回首页按钮 -->
  6. <text style="font-size:44rpx;" class="gui-header-leader-btns gui-color-white font-icons"
  7. @tap="goBack">&#xe6c5;</text>
  8. <!-- 导航文本此处也可以是其他自定义内容 -->
  9. <text
  10. class="gui-h4 gui-blod gui-flex1 gui-text-center gui-ellipsis gui-color-white gui-primary-text">扫描出库明细</text>
  11. <!-- 此处加一个右侧展位元素与左侧同宽,实现标题居中 -->
  12. <!-- 实际宽度请根据自己情况设置 -->
  13. <view style="width:40px;" />
  14. <!-- 如果右侧有其他内容可以利用条件编译和定位来实现-->
  15. </view>
  16. </template>
  17. <template #gBody>
  18. <view class="list-content">
  19. <view class="scan" v-if="scanTie">
  20. <view class="scan-card" style="margin-top:8px;">
  21. <uni-easyinput
  22. ref="tmInput"
  23. v-model="tmId"
  24. :input-border="false"
  25. :clearable="false"
  26. type="text"
  27. placeholder="请扫描或输入贴纸ID"
  28. @confirm="setTmOnly"
  29. />
  30. <text class="font-icons" @click="setTmOnly">&#xe6b7;</text>
  31. </view>
  32. </view>
  33. <view class="scan" v-if="scanTie">
  34. <view class="scan-card" style="margin-top:8px;">
  35. <uni-easyinput
  36. ref="partInput"
  37. v-model="tmMaterialNo"
  38. :input-border="false"
  39. :clearable="false"
  40. type="text"
  41. placeholder="请输入料号"
  42. @confirm="handlePartKeydown"
  43. />
  44. <text class="font-icons" @click="handleQueryPart">&#xe6b7;</text>
  45. </view>
  46. </view>
  47. <view class="scan">
  48. <view class="scan-card">
  49. <!-- 禁用软键盘 -->
  50. <!-- <uni-easyinput ref="easyinput" v-model="scanBatchNumber" :input-border="false"
  51. :clearable="false" type="text" focus @focus="handleInputFocus" placeholder="请扫描物料二维码"
  52. @confirm="handleKeydown" /> -->
  53. <!-- 不禁用软键盘 -->
  54. <uni-easyinput ref="easyinput" v-model="scanBatchNumber" :input-border="false"
  55. :clearable="false" type="text" focus placeholder="请扫描物料二维码"
  56. @confirm="handleKeydown" />
  57. <text class="font-icons" @click="handleScanMaterial">&#xe6b7;</text>
  58. </view>
  59. </view>
  60. <view class="tabs">
  61. <div class="tabs-list">
  62. <text :class="!isBefore?'tabs-item-active':'tabs-item'" @click="isBefore = false">物料需求</text>
  63. <text :class="isBefore?'tabs-item-active':'tabs-item'" @click="isBefore = true">已扫物料</text>
  64. </div>
  65. </view>
  66. <view v-if="!isBefore" class="custom-table">
  67. <uni-table border stripe empty-text="暂无更多数据">
  68. <!-- 表头行 -->
  69. <uni-tr class="custom-table-head">
  70. <uni-th align="center" width="180px" class="break-col">可出库位(数量)</uni-th>
  71. <uni-th align="center" width="180px">物料</uni-th>
  72. <uni-th align="center" width="120px">应备数</uni-th>
  73. <uni-th align="center" width="120px">已备数</uni-th>
  74. </uni-tr>
  75. <!-- 表格数据行 -->
  76. <!-- 可点击行,方法存在 -->
  77. <uni-tr v-for="(item, key) in tableData" :key="key" @click="handleToDetails(item)">
  78. <!-- 不可点击行 -->
  79. <!-- <uni-tr v-for="(item, key) in tableData" :key="key"> -->
  80. <uni-td align="center" class="break-cell">{{ item.ableStockLocation }}</uni-td>
  81. <uni-td align="center">{{ item.materialNo }}({{ item.materialName }})</uni-td>
  82. <uni-td align="center">{{ item.nowDeliveredQty }}</uni-td>
  83. <uni-td align="center"
  84. style="color: orange;font-weight: bold;">{{ item.completedQty }}</uni-td>
  85. </uni-tr>
  86. </uni-table>
  87. </view>
  88. <view v-else class="custom-table">
  89. <scroll-view scroll-y class="scroll-box" style="height: 300px;">
  90. <view class="cell-row">
  91. <view class="cell1">物料</view>
  92. <view class="cell2">数量</view>
  93. <view class="cell3">批号</view>
  94. </view>
  95. <view
  96. v-for="(item, idx) in beforeTableData"
  97. :key="item.uniqueId"
  98. class="swipe-row"
  99. @touchstart="touchStart"
  100. @touchmove="touchMove"
  101. @touchend="touchEnd"
  102. :data-index="idx"
  103. >
  104. <view class="content-area" :style="`transform: translateX(${item.slideX}px)`">
  105. <view class="cell1">{{ item.materialNo }}({{ item.materialName }})</view>
  106. <view class="cell2">{{ item.batchQty }}</view>
  107. <view class="cell3">{{ item.batchNumber }}</view>
  108. </view>
  109. <view class="btn-area" @click="deleteItem(idx)">删除</view>
  110. </view>
  111. </scroll-view>
  112. </view>
  113. <view class="card-list-item"
  114. style="margin: 12px 0;display: grid;grid-template-columns: 1fr 1fr;grid-template-rows: 1fr;gap: 10px;">
  115. <view class="sign-btn" :class="{ disabled: saveDisabled }" @click="handleSave">
  116. <text :style="saveBtnTextStyle">保存</text>
  117. </view>
  118. <view class="sign-btn" :class="{ disabled: submitDisabled }" @click="handleSubmit">
  119. <text :style="submitBtnTextStyle">提交</text>
  120. </view>
  121. <view style="width: 0px;">
  122. <!-- <uni-easyinput ref="signInput" v-model="signText" @focus="handleInputFocus"
  123. :input-border="false" :clearable="false" type="text" @confirm="handleComplete" /> -->
  124. <uni-easyinput ref="signInput" v-model="signText"
  125. :input-border="false" :clearable="false" type="text" @confirm="handleComplete" />
  126. </view>
  127. </view>
  128. <gui-modal ref="modalForm" :custom-class="['gui-bg-white', 'gui-dark-bg-level-3', 'gui-border-radius']"
  129. title="提示">
  130. <template #content>
  131. <view class="gui-padding gui-bg-gray gui-dark-bg-level-2">
  132. <text class="gui-block gui-text-center gui-text gui-color-gray"
  133. style="line-height:100rpx; padding:10rpx;">备料超出,是否拆分?</text>
  134. </view>
  135. </template>
  136. <!-- 利用 flex 布局 可以放置多个自定义按钮哦 -->
  137. <template #btns>
  138. <view class="gui-flex gui-row gui-space-between operation-flex">
  139. <view hover-class="gui-tap" class="modal-btns gui-flex1" @tap="modalForm.close()">
  140. <text class="modal-btns gui-color-gray">取消</text>
  141. </view>
  142. <view class="line" />
  143. <view hover-class="gui-tap" class="modal-btns gui-flex1" @tap="handleSplitMaterial">
  144. <text class="modal-btns gui-primary-color">确认</text>
  145. </view>
  146. </view>
  147. </template>
  148. </gui-modal>
  149. <uni-popup ref="errorTip" type="dialog">
  150. <uni-popup-dialog type="error" cancel-text="关闭" confirm-text="确认" title="提示"
  151. :content="errorTipMessage" @confirm="handleCloseErrorTipsModal"
  152. @close="handleCloseErrorTipsModal" />
  153. </uni-popup>
  154. <!-- FIFO 二次确认弹窗 -->
  155. <uni-popup ref="fifoPopup" type="dialog">
  156. <uni-popup-dialog
  157. title="FIFO 提示"
  158. :content="fifoMsg"
  159. confirm-text="继续"
  160. cancel-text="取消"
  161. @confirm="fifoContinue"
  162. @close="fifoCancel" />
  163. </uni-popup>
  164. </view>
  165. </template>
  166. </gui-page>
  167. </template>
  168. <script>
  169. import {
  170. onReachBottom
  171. } from '@dcloudio/uni-app'
  172. import {
  173. ref,
  174. onMounted,
  175. defineComponent,
  176. onBeforeMount,
  177. computed,
  178. watch,
  179. nextTick
  180. } from 'vue'
  181. export default defineComponent({
  182. setup(options) {
  183. const popup = ref()
  184. const queryParams = ref({
  185. pageSize: 20,
  186. pageNo: 1,
  187. masterId: options?.id ?? '',
  188. wmsProductionWorkOrderBomId: options?.id ?? ''
  189. })
  190. const errorTip = ref('')
  191. const errorTipMessage = ref('')
  192. const easyinput = ref('')
  193. const partInput = ref(null) // ref 指向料号输入框
  194. const tmMaterialNo = ref('') // 料号
  195. const tmId = ref('') // 贴纸ID
  196. const tmInput = ref(null) // ref 指向贴纸ID输入框
  197. const scanTie = ref(0) // 控制贴纸和料号扫描框显示
  198. const errorState = ref(0)
  199. const modalForm = ref()
  200. const parentRow = uni.getStorageSync('masterId') ?? {}
  201. const masterId = ref('')
  202. const businessType = ref('')
  203. // const saveId = ref('')
  204. const signInput = ref()
  205. const signText = ref('')
  206. const isLightText = ref('')
  207. const isSubmitLight = ref('')
  208. const scanBatchNumber = ref('')
  209. const isBefore = ref(false)
  210. const tableData = ref([])
  211. const beforeTableData = ref([])
  212. const scanMaterialList = ref([])
  213. const receiveList = ref([])
  214. const currentWarehouseId = ref('')
  215. const currentWarehouseName = ref('')
  216. // 当前处理的数据行
  217. const fdIndex = ref(-1)
  218. // 当前扫描的物料
  219. const currentScanMaterial = ref([])
  220. // 前端临时缓存:已扫物料
  221. const localScannedList = ref([])
  222. // 控制保存按钮能否点击
  223. const saveDisabled = ref(false)
  224. // 控制提交按钮能否点击
  225. const submitDisabled = ref(false)
  226. /* -------------------- 下面 4 行是新增变量 -------------------- */
  227. const fifoPopup = ref(null) // 弹窗实例
  228. const fifoMsg = ref('') // 提示语
  229. let fifoQrCode = '' // 缓存本次二维码
  230. const fifoGo = ref(false) // 用户是否点了“继续”
  231. // 存储fifo_check_order_type字典数据
  232. const fifoCheckOrderTypeDict = ref([])
  233. // 标记businessType是否在fifo_check_order_type字典内
  234. const isBusinessTypeInFifoDict = ref(false)
  235. onBeforeMount(() => {
  236. const parsedData = JSON.parse(parentRow)
  237. masterId.value = parsedData?.id
  238. businessType.value = parsedData?.businessType || '0'
  239. console.log('获取到的businessType:', businessType.value)
  240. // 获取fifo_check_order_type字典数据
  241. getFifoCheckOrderTypeDict()
  242. })
  243. // 获取fifo_check_order_type字典数据
  244. const getFifoCheckOrderTypeDict = function() {
  245. uni.$reqGet('getDictDataPage', {
  246. dictType: 'fifo_check_order_type'
  247. })
  248. .then(({ code, data, msg }) => {
  249. if (code === 0) {
  250. fifoCheckOrderTypeDict.value = data?.list || []
  251. console.log('fifo_check_order_type字典数据:', fifoCheckOrderTypeDict.value)
  252. console.log('fifo_check_order_type字典数据长度:', fifoCheckOrderTypeDict.value.length)
  253. // 判断businessType是否在字典内
  254. checkBusinessTypeInFifoDict()
  255. } else {
  256. console.error('获取fifo_check_order_type字典失败:', msg)
  257. }
  258. })
  259. .catch(error => {
  260. console.error('获取fifo_check_order_type字典异常:', error)
  261. })
  262. }
  263. // 判断businessType是否在fifo_check_order_type字典内
  264. const checkBusinessTypeInFifoDict = function() {
  265. // 使用some方法检查businessType是否存在于字典数据中
  266. isBusinessTypeInFifoDict.value = fifoCheckOrderTypeDict.value.some(item =>
  267. String(item?.value).trim() === String(businessType.value).trim()
  268. )
  269. console.log('businessType是否在fifo_check_order_type字典内:', isBusinessTypeInFifoDict.value)
  270. }
  271. const search = function() {
  272. uni.$reqGet('getScannedOutMatersDetails', { id: masterId.value })
  273. .then(({ code, data, msg }) => {
  274. if (code === 0) {
  275. uni.setStorageSync('ids', JSON.stringify(data?.inoutRequestDetailPDARespVOList?.[0] || {}))
  276. // saveId.value = data?.id
  277. receiveList.value = data
  278. scanTie.value = data?.scanTie
  279. currentWarehouseId.value = data?.warehouseId
  280. currentWarehouseName.value = data?.warehouseName
  281. tableData.value = data?.inoutRequestDetailPDARespVOList || []
  282. console.log('获取到的scanTie:', scanTie.value)
  283. // 1. 先清空本地已扫列表,准备重新填充
  284. localScannedList.value = []
  285. // 2. 将后端返回的已扫物料数据塞进localScannedList
  286. tableData.value.forEach(item => {
  287. if (item.inoutRequestSubdetailList?.length) {
  288. localScannedList.value.push(...item.inoutRequestSubdetailList)
  289. }
  290. })
  291. // 3. 调用flushBeforeTableData(),以localScannedList为准重新生成beforeTableData
  292. flushBeforeTableData()
  293. // 新增:根据 scanTie 决定首次焦点
  294. nextTick(() => {
  295. if (Number(scanTie.value) === 1) {
  296. // 先让贴纸 ID 框聚焦
  297. tmInput.value.onBlur()
  298. tmInput.value.onFocus()
  299. } else {
  300. setInputFocus()
  301. }
  302. })
  303. } else {
  304. uni.showToast({
  305. title: msg,
  306. icon: 'none',
  307. duration: 2000
  308. })
  309. }
  310. })
  311. }
  312. onMounted(() => {
  313. search()
  314. })
  315. const goBack = function() {
  316. if (uni.getStorageSync('masterId')) {
  317. uni.removeStorageSync('masterId')
  318. }
  319. if (uni.getStorageSync('ids')) {
  320. uni.removeStorageSync('ids')
  321. }
  322. uni.$goBack('/pages/workbranch/warehouse/scanInOut/Out/scanOutPage')
  323. }
  324. const handleScanMaterial = async function() {
  325. // #ifdef APP-PLUS
  326. /* 0. 基本校验 */
  327. /* 1. 先调摄像头 */
  328. const mpaasScanModule = uni.requireNativePlugin('Mpaas-Scan-Module');
  329. const ret = await new Promise(resolve =>
  330. mpaasScanModule.mpaasScan(
  331. { scanType: ['qrCode', 'barCode'], hideAlbum: false },
  332. resolve
  333. )
  334. );
  335. if (ret.resp_code !== 1000) return;
  336. const qrCode = ret.resp_result;
  337. /* 2. FIFO 校验 */
  338. const ok = await checkFifo(qrCode);
  339. if (!ok && !fifoGo.value) {
  340. // 新增:清空二维码框并重新聚焦
  341. resetAllInputs() // 如果你只想清二维码,也可以只写 scanBatchNumber.value = ''
  342. nextTick(() => easyinput.value.onFocus())
  343. return;
  344. }
  345. /* 3. 业务接口 */
  346. uni.$reqGet('scanPrepareMaterial', {
  347. qrCode,
  348. requestNo: receiveList.value.requestNo,
  349. businessType: receiveList.value.businessType,
  350. tmMaterialNo: tmMaterialNo.value.trim(),
  351. tmId: tmId.value.trim()
  352. })
  353. .then(({ code, data, msg }) => {
  354. fifoGo.value = false;
  355. if (code !== 0) {
  356. // #ifdef APP-PLUS
  357. plus.device.beep(2);
  358. // #endif
  359. resetAllInputs(); // ← 新增
  360. errorTipMessage.value = msg;
  361. errorTip.value.open();
  362. errorState.value = 0;
  363. /* 补焦点 */
  364. nextTick(() => {
  365. Number(scanTie.value) === 1 ? tmInput.value.onFocus() : easyinput.value.onFocus()
  366. });
  367. return;
  368. }
  369. /* ---------- 新增仓库ID校验 ---------- */
  370. if (!validateWarehouseId(data)) {
  371. return; // 仓库ID不一致,终止后续逻辑
  372. }
  373. /* ------------------------------------ */
  374. /* ---------- 新增批号重复校验 ---------- */
  375. const cur = Array.isArray(data) ? data[0] : data;
  376. if (cur && isBatchExist(cur.batchNumber)) {
  377. showBatchRepeatTip();
  378. return;// 直接终止
  379. }
  380. /* ------------------------------------ */
  381. scanBatchNumber.value = qrCode;
  382. // 以下保持你原有逻辑不变
  383. if (Object.prototype.toString.call(data) === '[object Array]') {
  384. fdIndex.value = tableData.value.findIndex(
  385. (item) => item?.materialNo === data[0]?.materialNo
  386. );
  387. }
  388. if (fdIndex.value === -1) {
  389. // #ifdef APP-PLUS
  390. plus.device.beep(2);
  391. // #endif
  392. errorTipMessage.value = '请扫描所需物料的物料条码';
  393. errorTip.value.open();
  394. errorState.value = 0;
  395. return;
  396. }
  397. currentScanMaterial.value = data[0] ?? [];
  398. const row = tableData.value[fdIndex.value];
  399. if (row.nowDeliveredQty > row.completedQty) {
  400. /* ===== 前端暂存逻辑 ===== */
  401. row.completedQty += currentScanMaterial.value.receiptQty || 1;
  402. localScannedList.value.push({
  403. ...currentScanMaterial.value,
  404. batchQty: currentScanMaterial.value.receiptQty || 1,
  405. supplierName: currentScanMaterial.value.supplierName || '',
  406. });
  407. flushBeforeTableData();
  408. /* 唯一成功出口:全部清空 */
  409. resetAllInputs();
  410. /* 再决定下一个焦点 */
  411. nextTick(() => {
  412. Number(scanTie.value) === 1
  413. ? tmInput.value.onFocus() // 贴纸模式→回到贴纸框
  414. : easyinput.value.onFocus() // 原模式→回到二维码框
  415. });
  416. } else {
  417. // #ifdef APP-PLUS
  418. plus.device.beep(2);
  419. // #endif
  420. errorTipMessage.value = '已备数量已满,无需再扫';
  421. errorTip.value.open();
  422. errorState.value = 0;
  423. }
  424. }).catch(() => {
  425. // 异常也要复位
  426. fifoGo.value = false;
  427. });
  428. // #endif
  429. };
  430. const handleToNavigate = function() {
  431. uni.navigateTo({
  432. url: '/pages/workbranch/warehouse/production/materialIssuance'
  433. })
  434. }
  435. const handleComplete = function(e) {
  436. // #ifdef APP-PLUS
  437. // 扫描员工工号
  438. uni.$reqPost('scanPrepareMaterialSign', {
  439. encodedEmployeeId: e,
  440. id: masterId.value
  441. })
  442. .then(({
  443. code,
  444. data,
  445. msg
  446. }) => {
  447. if (code === 0) {
  448. uni.showToast({
  449. title: '扫码成功',
  450. icon: 'none',
  451. duration: 2000
  452. })
  453. setTimeout(() => {
  454. goBack();
  455. }, 500)
  456. } else {
  457. // #ifdef APP-PLUS
  458. plus.device.beep(2)
  459. // #endif
  460. errorTipMessage.value = msg
  461. errorTip.value.open()
  462. errorState.value = -1
  463. }
  464. isLightText.value = false
  465. signText.value = ''
  466. })
  467. // #endif
  468. }
  469. // 物料拆分
  470. const handleSplitMaterial = function() {
  471. uni.$reqPost('prepareSplit', {
  472. prepareId: masterId.value,
  473. id: scanBatchNumber.value,
  474. inQty: currentScanMaterial.value?.receiptQty,
  475. splitQty: tableData.value[fdIndex.value].completedQty - currentScanMaterial.value?.receiptQty
  476. })
  477. .then(res => {
  478. search()
  479. modalForm.value.close()
  480. if (res.code === 0) {
  481. // 调取打印机拆分物料后打印标签
  482. uni.showToast({
  483. title: '拆分完毕',
  484. icon: 'none',
  485. duration: 2000
  486. })
  487. } else {
  488. // #ifdef APP-PLUS
  489. plus.device.beep(2)
  490. // #endif
  491. errorTipMessage.value = res.msg
  492. errorTip.value.open()
  493. errorState.value = 0
  494. }
  495. })
  496. }
  497. const handleKeydown = async function (e) {
  498. const qrCode = e;
  499. /* ===== 新增 FIFO 校验 ===== */
  500. const ok = await checkFifo(qrCode);
  501. if (!ok && !fifoGo.value) {
  502. resetAllInputs()
  503. nextTick(() => easyinput.value.onFocus())
  504. return;
  505. }
  506. /* ========================= */
  507. uni.$reqGet('scanPrepareMaterial', {
  508. qrCode,
  509. requestNo: receiveList.value.requestNo,
  510. businessType: receiveList.value.businessType,
  511. tmMaterialNo: tmMaterialNo.value.trim(),
  512. tmId: tmId.value.trim(),
  513. })
  514. .then(async ({ code, data, msg }) => {
  515. scanBatchNumber.value = qrCode;
  516. fifoGo.value = false;
  517. if (code !== 0) {
  518. // #ifdef APP-PLUS
  519. plus.device.beep(2);
  520. // #endif
  521. /* 1. 全部输入框清空(含二维码) */
  522. resetAllInputs()
  523. errorTipMessage.value = msg;
  524. errorTip.value.open();
  525. errorState.value = 0;
  526. /* 2. 焦点回到正确的输入框 */
  527. nextTick(() => {
  528. Number(scanTie.value) === 1 ? tmInput.value.onFocus() : easyinput.value.onFocus()
  529. });
  530. return;
  531. }
  532. /* ---------- 新增仓库ID校验 ---------- */
  533. if (!validateWarehouseId(data)) {
  534. return; // 仓库ID不一致,终止后续逻辑
  535. }
  536. /* ------------------------------------ */
  537. /* ---------- 新增批号重复校验 ---------- */
  538. const cur = Array.isArray(data) ? data[0] : data;
  539. if (cur && isBatchExist(cur.batchNumber)) {
  540. showBatchRepeatTip();
  541. return;// 直接终止
  542. }
  543. /* ------------------------------------ */
  544. if (Object.prototype.toString.call(data) === '[object Array]') {
  545. fdIndex.value = tableData.value.findIndex(
  546. (item) => item?.materialNo === data[0]?.materialNo
  547. );
  548. }
  549. if (fdIndex.value === -1) {
  550. // #ifdef APP-PLUS
  551. plus.device.beep(2);
  552. // #endif
  553. errorTipMessage.value = '请扫描所需物料的物料条码';
  554. errorTip.value.open();
  555. errorState.value = 0;
  556. return;
  557. }
  558. currentScanMaterial.value = data[0] ?? [];
  559. const row = tableData.value[fdIndex.value];
  560. if (row.nowDeliveredQty > row.completedQty) {
  561. /* ===== 前端暂存逻辑 ===== */
  562. row.completedQty += currentScanMaterial.value.receiptQty || 1;
  563. localScannedList.value.push({
  564. ...currentScanMaterial.value,
  565. batchQty: currentScanMaterial.value.receiptQty || 1,
  566. supplierName: currentScanMaterial.value.supplierName || '',
  567. });
  568. flushBeforeTableData();
  569. setInputFocus();
  570. } else {
  571. // #ifdef APP-PLUS
  572. plus.device.beep(2);
  573. // #endif
  574. errorTipMessage.value = '已备数量已满,无需再扫';
  575. errorTip.value.open();
  576. errorState.value = 0;
  577. }
  578. }).catch(() => {
  579. // 异常也要复位
  580. fifoGo.value = false
  581. });
  582. };
  583. const handleToDetails = function(ret) {
  584. uni.navigateTo({
  585. url: '/pages/workbranch/warehouse/scanInOut/Out/materialsDetail'
  586. })
  587. uni.setStorageSync('mixMaterialDetail', JSON.stringify(ret))
  588. }
  589. // 设置高亮
  590. const handleBtnLight = function() {
  591. // #ifdef APP-PLUS
  592. signInput.value.onBlur()
  593. isLightText.value = true
  594. signInput.value.onFocus()
  595. // #endif
  596. }
  597. const setInputFocus = function() {
  598. if (Number(scanTie.value) === 1) {
  599. // 闭环:回到贴纸 ID
  600. nextTick(() => {
  601. tmInput.value.onBlur()
  602. tmInput.value.onFocus()
  603. })
  604. } else {
  605. // 原逻辑:继续在二维码框循环
  606. easyinput.value.onBlur()
  607. easyinput.value.onFocus()
  608. }
  609. }
  610. /* 统一出口:清空所有输入框 */
  611. const resetAllInputs = () => {
  612. scanBatchNumber.value = ''
  613. tmMaterialNo.value = ''
  614. tmId.value = ''
  615. }
  616. /* ===== 2. 键盘回车 ===== */
  617. const handlePartKeydown = async (e) => {
  618. const desc = tmMaterialNo.value.trim()
  619. if (!desc) return
  620. await queryPart(desc)
  621. }
  622. /* ===== 3. 右侧图标点击 ===== */
  623. const handleQueryPart = async () => {
  624. const desc = tmMaterialNo.value.trim()
  625. if (!desc) return
  626. await queryPart(desc)
  627. }
  628. /* ===== 4. 真正查料号 ===== */
  629. /* ===== 料号框:只保存,不调接口 ===== */
  630. const queryPart = (desc) => {
  631. tmMaterialNo.value = desc.trim() // 1. 保存
  632. if (Number(scanTie.value) === 1) {
  633. nextTick(() => { // 2. 跳二维码框
  634. easyinput.value.onBlur()
  635. easyinput.value.onFocus()
  636. })
  637. } else {
  638. nextTick(() => easyinput.value.onFocus())
  639. }
  640. }
  641. /* ===== 5. 料号框重新聚焦 ===== */
  642. const setPartFocus = () => {
  643. if (Number(scanTie.value) === 1) {
  644. nextTick(() => {
  645. easyinput.value.onBlur()
  646. easyinput.value.onFocus()
  647. })
  648. } else {
  649. // 非贴纸模式保持原逻辑(仅保存)
  650. partInput.value.onBlur()
  651. partInput.value.onFocus()
  652. }
  653. }
  654. /* ===== 2. 仅保存贴纸ID,不请求 ===== */
  655. const setTmOnly = () => {
  656. tmId.value = tmId.value.trim()
  657. if (Number(scanTie.value) === 1) {
  658. // 只在贴纸模式下才自动跳料号
  659. nextTick(() => {
  660. partInput.value.onBlur()
  661. partInput.value.onFocus()
  662. })
  663. } else {
  664. // 非贴纸模式保持原逻辑(仅保存)
  665. tmInput.value.onBlur()
  666. tmInput.value.onFocus()
  667. }
  668. }
  669. // 相同物料+相同批号才合并数量,否则新增一行
  670. const flushBeforeTableData = function() {
  671. const map = new Map()
  672. localScannedList.value.forEach(it => {
  673. // 用“物料编码+批号”当唯一键
  674. const key = `${it.materialNo}__${it.batchNumber}`
  675. if (map.has(key)) {
  676. map.get(key).batchQty += it.batchQty // 同批号累加
  677. } else {
  678. map.set(key, { ...it })// 新批号新开一行
  679. }
  680. })
  681. // 为每个项目添加唯一ID和滑动属性
  682. beforeTableData.value = Array.from(map.values()).map((v, i) => ({
  683. ...v,
  684. uniqueId: `${v.materialNo}_${v.batchNumber}_${i}`,
  685. slideX: 0
  686. }))
  687. }
  688. /* ========= 左滑删除 ========= */
  689. const touchStart = (e) => {
  690. const idx = e.currentTarget.dataset.index
  691. beforeTableData.value.forEach((v, i) => {
  692. if (i !== idx) v.slideX = 0 // 其余归位
  693. })
  694. beforeTableData.value[idx].startX = e.touches[0].pageX
  695. beforeTableData.value[idx].slideX = beforeTableData.value[idx].slideX || 0
  696. }
  697. const touchMove = (e) => {
  698. const idx = e.currentTarget.dataset.index
  699. const row = beforeTableData.value[idx]
  700. const delta = e.touches[0].pageX - row.startX
  701. if (delta < 0) { // 只允许左滑
  702. row.slideX = Math.max(delta, -70) // 70 = 按钮宽度
  703. } else {
  704. row.slideX = Math.min(delta, 0)
  705. }
  706. }
  707. const touchEnd = (e) => {
  708. const idx = e.currentTarget.dataset.index
  709. const row = beforeTableData.value[idx]
  710. row.slideX = row.slideX <= -35 ? -70 : 0 // 过半则露出,否则收回
  711. }
  712. /**
  713. * 删除一条已扫物料
  714. * @param {number} idx 在 beforeTableData 中的下标
  715. */
  716. const deleteItem = async (idx) => {
  717. const target = beforeTableData.value[idx];
  718. /* 1. 有 id 就先调接口删后端 */
  719. if (target.id) {
  720. try {
  721. const { code, msg } = await uni.$reqDelete('deleteScanOutMaterial', { id: target.id });
  722. if (code !== 0) {
  723. // 接口明确返回失败,提示用户并终止后续逻辑
  724. errorTipMessage.value = msg || '后端删除失败';
  725. errorTip.value.open();
  726. return;
  727. }
  728. } catch (err) {
  729. // 网络或其它异常
  730. errorTipMessage.value = err.errMsg || '网络异常,删除失败';
  731. errorTip.value.open();
  732. return;
  733. }
  734. }
  735. /* 2. 无论有没有 id、接口成不成功,只要走到这里就删本地 */
  736. // 2.1 从 localScannedList 里删掉对应项(同物料+同批号)
  737. const key = `${target.materialNo}__${target.batchNumber}`;
  738. const listIdx = localScannedList.value.findIndex(
  739. v => `${v.materialNo}__${v.batchNumber}` === key
  740. );
  741. if (listIdx > -1) localScannedList.value.splice(listIdx, 1);
  742. // 2.2 重新合并生成 beforeTableData
  743. flushBeforeTableData();
  744. // 2.3 把对应物料的“已备数”回退
  745. const row = tableData.value.find(r => r.materialNo === target.materialNo);
  746. if (row) row.completedQty -= target.batchQty;
  747. }
  748. // 关闭错误信息弹窗
  749. const handleCloseErrorTipsModal = async function() {
  750. errorTip.value.close()
  751. if (errorState.value === 0) {
  752. await setInputFocus()
  753. }
  754. }
  755. /* ===================== 公共校验函数 ===================== */
  756. // 仓库ID校验函数
  757. const validateWarehouseId = (scanData) => {
  758. const cur = Array.isArray(scanData) ? scanData[0] : scanData;
  759. if (cur && cur.warehouseId && currentWarehouseId.value && cur.warehouseId !== currentWarehouseId.value) {
  760. // #ifdef APP-PLUS
  761. plus.device.beep(2);
  762. // #endif
  763. errorTipMessage.value = `物料仓库(${cur.erpStockName})与当前仓库(${currentWarehouseName.value})不一致`;
  764. errorTip.value.open();
  765. errorState.value = 0;
  766. return false;
  767. }
  768. return true;
  769. };
  770. // 仅扫描本地缓存池,不再读 beforeTableData
  771. const isBatchExist = (batchNo) =>
  772. beforeTableData.value.some((it) => it.batchNumber === batchNo);
  773. const showBatchRepeatTip = () => {
  774. // #ifdef APP-PLUS
  775. plus.device.beep(2);
  776. // #endif
  777. errorTipMessage.value = '该批号已存在,请勿重复扫描';
  778. errorTip.value.open();
  779. errorState.value = 0;
  780. };
  781. // 禁用软键盘
  782. const handleInputFocus = function() {
  783. setTimeout(() => {
  784. uni.hideKeyboard()
  785. }, 100)
  786. }
  787. // 把 beforeTableData 追加到 tableData 对应物料的 inoutRequestSubdetailList
  788. const mergeBeforeIntoTable = () => {
  789. // 创建新数组存储合并结果
  790. const mergedTableData = JSON.parse(JSON.stringify(tableData.value))
  791. // 先建索引
  792. const map = {}
  793. mergedTableData.forEach(row => {
  794. if (!row.inoutRequestSubdetailList) row.inoutRequestSubdetailList = []
  795. map[row.materialNo] = row
  796. })
  797. // 只追加,不新增
  798. beforeTableData.value.forEach(item => {
  799. const target = map[item.materialNo]
  800. if (target) {
  801. target.inoutRequestSubdetailList.push({ ...item }) // 整条记录丢进去
  802. }
  803. // 不存在就跳过
  804. })
  805. return mergedTableData
  806. }
  807. // 保存按钮点击事件
  808. const handleSave = async function() {
  809. if (saveDisabled.value) return
  810. saveDisabled.value = true
  811. try {
  812. // 保存逻辑实现
  813. isLightText.value = true
  814. // 先合并数据,获取合并后的新数组
  815. const mergedData = mergeBeforeIntoTable()
  816. // 调用保存API,使用合并后的新数组作为参数
  817. await uni.$reqPost('saveScannedOutMaterials', {
  818. id: receiveList.value?.id,
  819. requestNo: receiveList.value?.requestNo,
  820. requestType: receiveList.value?.requestType,
  821. businessType: receiveList.value?.businessType,
  822. businessSubType: receiveList.value?.businessSubType,
  823. status: receiveList.value?.status,
  824. priority: receiveList.value?.priority,
  825. inoutRequestDetailPDASaveReqVOList: mergedData
  826. })
  827. .then(({ code, data, msg }) => {
  828. if (code === 0) {
  829. uni.showModal({
  830. title: '提示',
  831. content: '保存成功',
  832. showCancel: false
  833. })
  834. search();
  835. } else {
  836. // #ifdef APP-PLUS
  837. plus.device.beep(2)
  838. // #endif
  839. errorTipMessage.value = msg
  840. errorTip.value.open()
  841. errorState.value = 0
  842. }
  843. })
  844. } finally {
  845. saveDisabled.value = false
  846. }
  847. }
  848. // 提交按钮点击事件
  849. const handleSubmit = async function() {
  850. if (submitDisabled.value) return
  851. submitDisabled.value = true
  852. try {
  853. // 提交逻辑实现
  854. isSubmitLight.value = true
  855. // 先合并数据,获取合并后的新数组
  856. const mergedData = mergeBeforeIntoTable()
  857. // 调用提交API,使用合并后的新数组作为参数
  858. await uni.$reqPut('submitScannedOutMaterials', {
  859. id: receiveList.value?.id,
  860. requestNo: receiveList.value?.requestNo,
  861. requestType: receiveList.value?.requestType,
  862. businessType: receiveList.value?.businessType,
  863. businessSubType: receiveList.value?.businessSubType,
  864. status: receiveList.value?.status,
  865. priority: receiveList.value?.priority,
  866. inoutRequestDetailPDASaveReqVOList: mergedData
  867. })
  868. .then(({ code, data, msg }) => {
  869. if (code === 0) {
  870. uni.showModal({
  871. title: '提示',
  872. content: '提交成功',
  873. showCancel: false
  874. })
  875. search();
  876. // 保存成功后可以跳转到其他页面或执行其他操作
  877. // goBack()
  878. } else {
  879. // #ifdef APP-PLUS
  880. plus.device.beep(2)
  881. // #endif
  882. errorTipMessage.value = msg
  883. errorTip.value.open()
  884. errorState.value = 0
  885. }
  886. })
  887. } finally {
  888. submitDisabled.value = false
  889. }
  890. }
  891. // uniapp移动端触底事件
  892. onReachBottom(() => {
  893. queryParams.value.pageNo += 1
  894. uni.$reqGet('getPrepareMaterialList', queryParams.value)
  895. .then(({
  896. data
  897. }) => {
  898. Array.prototype.push.call(scanMaterialList.value, ...data?.list ?? [])
  899. })
  900. })
  901. // 保存按钮文字样式
  902. const saveBtnTextStyle = computed(() => ({
  903. fontSize: '14px',
  904. fontWeight: 'bold',
  905. color: saveDisabled.value ? '#ccc' : (isLightText.value ? 'rgba(0,160,233,1)' : '')
  906. }))
  907. // 提交按钮文字样式
  908. const submitBtnTextStyle = computed(() => ({
  909. fontSize: '14px',
  910. fontWeight: 'bold',
  911. color: submitDisabled.value ? '#ccc' : (isSubmitLight.value ? 'rgba(0,160,233,1)' : '')
  912. }))
  913. // 移除status监听,提交按钮和保存按钮均始终可用
  914. // watch(() => receiveList.value?.status, (newStatus) => {
  915. // submitDisabled.value = newStatus !== 0
  916. // })
  917. /* -------------------- 新增 3 个方法 -------------------- */
  918. // 真正继续扫码(关闭弹窗并置标志)
  919. const fifoContinue = () => {
  920. fifoPopup.value.close()
  921. fifoGo.value = true
  922. // 用下一个 tick 把老流程续起来
  923. nextTick(() => {
  924. if (fifoQrCode) handleKeydown(fifoQrCode)
  925. })
  926. }
  927. const fifoCancel = () => { fifoPopup.value.close() } // 什么都不做
  928. // 统一 FIFO 校验入口
  929. const checkFifo = (qrCode) => {
  930. // 用户已点“继续”,直接放行
  931. if (fifoGo.value) return Promise.resolve(true)
  932. if (!isBusinessTypeInFifoDict.value) return Promise.resolve(true)
  933. return uni.$reqPost('fifoCheck', { qrCode,
  934. requestNo: receiveList.value.requestNo,
  935. businessType: receiveList.value.businessType,
  936. }).then(({ code, data, msg }) => {
  937. if (code !== 0) {
  938. errorTipMessage.value = msg || 'FIFO 校验异常'
  939. errorTip.value.open()
  940. return false
  941. }
  942. if (data === null) return true
  943. fifoMsg.value = `当前条码(${qrCode})不是库存中生产日期最早的物料条码(${data}),是否继续发料?`
  944. fifoQrCode = qrCode
  945. fifoPopup.value.open()
  946. return false
  947. })
  948. }
  949. return {
  950. goBack,
  951. popup,
  952. signText,
  953. isBefore,
  954. tableData,
  955. beforeTableData,
  956. signInput,
  957. modalForm,
  958. easyinput,
  959. errorTip,
  960. errorTipMessage,
  961. handleInputFocus,
  962. isLightText,
  963. isSubmitLight,
  964. handleBtnLight,
  965. handleKeydown,
  966. scanBatchNumber,
  967. handleScanMaterial,
  968. handleToNavigate,
  969. saveDisabled,
  970. submitDisabled,
  971. saveBtnTextStyle,
  972. submitBtnTextStyle,
  973. scanMaterialList,
  974. handleComplete,
  975. handleSplitMaterial,
  976. handleToDetails,
  977. handleCloseErrorTipsModal,
  978. handleSubmit,
  979. handleSave,
  980. // 左滑删除相关
  981. touchStart,
  982. touchMove,
  983. touchEnd,
  984. deleteItem,
  985. scanTie,
  986. // 料号输入相关
  987. tmMaterialNo,
  988. partInput,
  989. handlePartKeydown,
  990. handleQueryPart,
  991. // 贴纸ID输入相关
  992. tmId,
  993. tmInput,
  994. setTmOnly,
  995. // FIFO相关
  996. fifoPopup,
  997. fifoMsg,
  998. fifoContinue,
  999. fifoCancel
  1000. }
  1001. }
  1002. })
  1003. </script>
  1004. <style lang="scss" scoped>
  1005. .gui-header-leader-btns {
  1006. color: black;
  1007. font-size: 24px !important;
  1008. margin-left: 24rpx;
  1009. }
  1010. .list-content {
  1011. margin-top: 80px;
  1012. background-color: #edeeee;
  1013. }
  1014. .card-list-flexbox {
  1015. display: flex;
  1016. flex-direction: row;
  1017. align-items: center;
  1018. flex-wrap: wrap;
  1019. margin: 3px 2px;
  1020. .card-list-item {
  1021. width: 750rpx;
  1022. height: 40px;
  1023. margin: 2rpx 0;
  1024. display: flex;
  1025. flex-direction: row;
  1026. align-items: center;
  1027. justify-content: space-between;
  1028. background-color: #fff;
  1029. uni-text {
  1030. font-size: 14px;
  1031. height: 50rpx;
  1032. text-align: left;
  1033. padding: 0 12px;
  1034. display: flex;
  1035. flex-direction: row;
  1036. align-items: center;
  1037. }
  1038. .text-1 {
  1039. flex: 1;
  1040. height: 40px;
  1041. justify-content: flex-start;
  1042. }
  1043. .text-2 {
  1044. flex: 3;
  1045. height: 40px;
  1046. justify-content: flex-end;
  1047. margin-right: 4px;
  1048. padding: 2px 6px;
  1049. }
  1050. }
  1051. }
  1052. .card-list-flexbox:nth-of-type(2) {
  1053. margin-top: 48px;
  1054. }
  1055. .fixedTop {
  1056. bottom: 0 !important;
  1057. top: 3.25rem !important;
  1058. }
  1059. .popup-content {
  1060. height: 75vh;
  1061. overflow-y: scroll;
  1062. background-color: #edeeee;
  1063. }
  1064. .font-icons {
  1065. width: 40px;
  1066. font-size: 20px;
  1067. }
  1068. .scan {
  1069. height: 45px;
  1070. width: calc(100% - 48px);
  1071. margin: 12px;
  1072. padding: 0 12px;
  1073. display: flex;
  1074. justify-content: space-between;
  1075. align-items: center;
  1076. border-radius: 6px;
  1077. background-color: white;
  1078. .scan-card {
  1079. width: 100%;
  1080. display: grid;
  1081. grid-template-rows: 1fr;
  1082. grid-template-columns: 7fr 2fr;
  1083. align-items: center;
  1084. input {
  1085. height: 35px;
  1086. line-height: 35px;
  1087. }
  1088. text {
  1089. width: 100%;
  1090. text-align: right;
  1091. }
  1092. }
  1093. }
  1094. .custom-table {
  1095. height: calc(100vh - 265px);
  1096. min-height: 230px;
  1097. margin: 5px 0;
  1098. // min-height: 600px;
  1099. overflow-y: scroll;
  1100. }
  1101. .modal-btns {
  1102. height: 100rpx;
  1103. line-height: 100rpx;
  1104. display: flex;
  1105. justify-content: center;
  1106. align-items: center;
  1107. }
  1108. .line {
  1109. margin-top: 10rpx;
  1110. height: 80rpx;
  1111. width: 1rpx;
  1112. background-color: #dcdcdc;
  1113. }
  1114. .tabs {
  1115. width: 100%;
  1116. height: 45px;
  1117. display: flex;
  1118. align-items: flex-end;
  1119. padding: 0 2px;
  1120. background-color: white;
  1121. .tabs-list {
  1122. border-radius: 3px;
  1123. overflow: hidden;
  1124. }
  1125. .tabs-item {
  1126. display: inline-block;
  1127. width: 72px;
  1128. height: 30px;
  1129. line-height: 30px;
  1130. padding: 0 8px;
  1131. font-size: 14px;
  1132. font-weight: bold;
  1133. text-align: center;
  1134. color: black;
  1135. border-bottom: 1.5px dashed #00a0e9;
  1136. transition: all .5s ease-in-out;
  1137. }
  1138. .tabs-item-active {
  1139. position: relative;
  1140. display: inline-block;
  1141. width: 72px;
  1142. height: 30px;
  1143. line-height: 30px;
  1144. padding: 0 8px;
  1145. font-size: 14px;
  1146. font-weight: bold;
  1147. text-align: center;
  1148. color: white;
  1149. border-left: 1px solid #00a0e9;
  1150. border-top: 1px solid #00a0e9;
  1151. border-right: 1px solid #00a0e9;
  1152. border-bottom: 1.5px solid #00a0e9;
  1153. border-radius: 5px 5px 0 0;
  1154. animation: .3s linear show;
  1155. background-color: #00a0e9;
  1156. }
  1157. .tabs-item-active::before {
  1158. content: '';
  1159. position: absolute;
  1160. left: -10px;
  1161. bottom: 0;
  1162. width: 10px;
  1163. height: 10px;
  1164. background: radial-gradient(circle at 0% 25%, transparent 10px, #00a0e9 0)
  1165. }
  1166. .tabs-item-active::after {
  1167. content: '';
  1168. position: absolute;
  1169. right: -10px;
  1170. bottom: 0;
  1171. width: 10px;
  1172. height: 10px;
  1173. background: radial-gradient(circle at 100% 25%, transparent 10px, #00a0e9 0)
  1174. }
  1175. }
  1176. @keyframes show {
  1177. from {
  1178. transform: translateY(5%);
  1179. }
  1180. to {
  1181. transform: translateY(0%);
  1182. }
  1183. }
  1184. .sign-btn {
  1185. display: flex;
  1186. align-items: center;
  1187. justify-content: center;
  1188. margin: 0 8px;
  1189. border: 1px solid #999999;
  1190. background-color: white;
  1191. border-radius: 6px;
  1192. }
  1193. .sign-btn.disabled {
  1194. border-color: #ccc;
  1195. background-color: #f5f5f5;
  1196. pointer-events: none;
  1197. }
  1198. /* 左滑删除样式 */
  1199. .scroll-box{
  1200. height:100%; /* 继承父级高度 */
  1201. }
  1202. .cell-row {
  1203. display: flex;
  1204. background-color: #f5f7fa;
  1205. font-weight: bold;
  1206. border-radius: 4px;
  1207. margin-bottom: 5px;
  1208. }
  1209. .swipe-row{
  1210. position:relative;
  1211. width:100%;
  1212. height:44px;
  1213. overflow:hidden;
  1214. border-bottom:1px solid #eee;
  1215. margin-bottom: 5px;
  1216. border-radius: 4px;
  1217. }
  1218. .content-area{
  1219. position:absolute;
  1220. left:0;
  1221. top:0;
  1222. right:0;
  1223. bottom:0;
  1224. z-index:2;
  1225. background:#fff;
  1226. display:flex;
  1227. align-items:center;
  1228. transition: transform .25s;
  1229. border-radius: 4px;
  1230. }
  1231. .cell1{
  1232. flex:2;
  1233. text-align:center;
  1234. font-size:14px;
  1235. color:#333;
  1236. height: 44px;
  1237. line-height: 44px;
  1238. }
  1239. .cell2{
  1240. flex:1;
  1241. text-align:center;
  1242. font-size:14px;
  1243. color:#333;
  1244. height: 44px;
  1245. line-height: 44px;
  1246. }
  1247. .cell3{
  1248. flex:2;
  1249. text-align:center;
  1250. font-size:14px;
  1251. color:#333;
  1252. height: 44px;
  1253. line-height: 44px;
  1254. }
  1255. .btn-area{
  1256. position:absolute;
  1257. right:0;
  1258. top:0;
  1259. width:70px;
  1260. height:100%;
  1261. background:#e54d42;
  1262. color:#fff;
  1263. display:flex;
  1264. align-items:center;
  1265. justify-content:center;
  1266. font-size:14px;
  1267. z-index:1;
  1268. border-radius: 4px;
  1269. }
  1270. // /* 表头也允许换行,保证与列宽对齐 */
  1271. // ::v-deep .break-col {
  1272. // white-space: normal !important;
  1273. // word-break: break-all !important;
  1274. // line-height: 1.2;
  1275. // }
  1276. // /* 单元格超长自动分段 */
  1277. // ::v-deep .break-cell {
  1278. // white-space: normal !important;
  1279. // word-break: break-all !important;
  1280. // line-height: 1.2;
  1281. // padding: 4px 2px; /* 上下留一点空隙,视觉更舒服 */
  1282. // }
  1283. </style>