scannedMaterials.vue 41 KB

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