scannedMaterials.vue 42 KB

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