1. <!-- eslint-disable no-console -->
    2. <!--
    3. * @Author: Ashun
    4. * @Date: 2022-07-19 20:08:49
    5. * @LastEditors: zzd993
    6. * @LastEditTime: 2022-07-26 18:21:36
    7. * @FilePath: \elabnote-front-main\src\views\inventory\components\out-in-stock\query-detail\components\WillRecallStockTable.vue
    8. * Copyright (c) 2022 by BMY, All Rights Reserved.
    9. -->
    10. <template>
    11. <div>
    12. <div class="will-recall-stock-table">
    13. <BasicTable
    14. ref="tableRef"
    15. rowKey="id"
    16. :loading="loading"
    17. :columns="columns"
    18. :data="(data as any)"
    19. :pagination="pagination"
    20. :rowSelection="rowSelection"
    21. v-model:selectedRowKeys="selectedKeys"
    22. v-model:selectedRows="selectedRows"
    23. :scroll="{
    24. y: 630
    25. }"
    26. column-resizable
    27. :bordered="{ headerCell: true }"
    28. >
    29. <template #customTitle>
    30. <div v-if="true" class="custom-title-box">
    31. <a-space>
    32. 已选定 {{ selectedKeys.length }} 个
    33. <a-button size="small" @click="confirmRecallStock">返库</a-button>
    34. </a-space>
    35. </div>
    36. </template>
    37. <!-- 个性化展示的列👇 -->
    38. <!-- 序号 -->
    39. <template #serialNumber="{ item }">
    40. {{ computedShowSerialNumber(item.record.index + 1) }}
    41. </template>
    42. <!-- 容量 -->
    43. <template #applyCapacity="{ item }"> {{ item.record.applyCapacity }}{{ item.record.unitName }} </template>
    44. <!-- 内容物 -->
    45. <template #embedInfo="{ item }">
    46. <EmbedInfo :record="item.record.embedInfo" isShowTooltip />
    47. </template>
    48. <!-- operates -->
    49. <template #operates>
    50. <a-link> 返库 </a-link>
    51. </template>
    52. <!-- 预计返库时间 -->
    53. <template #col_time_recallDate="{ item }">
    54. <span>
    55. {{ handleShowDynamicParam({ type: ParameterType.MOMENT, value: item.record.recallDate }) }}
    56. </span>
    57. </template>
    58. <!-- 返库申请时间 -->
    59. <template #col_time_recallApplyTime="{ item }">
    60. <span>
    61. {{ handleShowDynamicParam({ type: ParameterType.MOMENT, value: item.record.recallApplyTime }) }}
    62. </span>
    63. </template>
    64. </BasicTable>
    65. </div>
    66. <ConfirmRecallStockModal ref="ConfirmRecallStockModalRef" @refreshTable="handleRefreshTable" />
    67. </div>
    68. </template>
    69. <script lang="ts">
    70. type tooltipPosition =
    71. | 'lb'
    72. | 'left'
    73. | 'right'
    74. | 'bottom'
    75. | 'top'
    76. | 'tl'
    77. | 'tr'
    78. | 'bl'
    79. | 'br'
    80. | 'rt'
    81. | 'lt'
    82. | 'rb'
    83. | undefined
    84. //一些表格配置
    85. const rowSelection = {
    86. showCheckedAll: true
    87. }
    88. </script>
    89. <script lang="ts" setup>
    90. import ConfirmRecallStockModal from './ConfirmRecallStockModal.vue'
    91. //components
    92. import EmbedInfo from '@/components/EmbedInfo/index.vue'
    93. //api
    94. import { getWarehouseInventorynList } from '@/api/material'
    95. //utils
    96. import { watch, ref, reactive, computed, nextTick } from 'vue'
    97. import { useFetch } from '@/hooks/useFetch'
    98. import { handleShowDynamicParam } from '@/util/tools/showDynamicParam'
    99. import { StockSearchColumns, formatTableData } from '@/views/inventory/components/out-in-stock/utils'
    100. //types
    101. import { ParameterType } from '@/common/enum'
    102. //store
    103. import { useOutInStockStore } from '@/store/modules/inventory/out-in-stock'
    104. import { TableData } from '@arco-design/web-vue'
    105. const outInStockStore = useOutInStockStore()
    106. const Emiter = defineEmits(['changePagination'])
    107. const data = ref([])
    108. const columns = ref<[]>(StockSearchColumns[outInStockStore.currentNodeType] as [])
    109. const selectedKeys = ref<string[]>([])
    110. const initialSelectedKeys = () => {
    111. selectedKeys.value = []
    112. tableRef?.value?.clearSelectedKeysCache?.()
    113. }
    114. const ConfirmRecallStockModalRef = ref<InstanceType<typeof ConfirmRecallStockModal> | null>(null)
    115. const tableRef = ref()
    116. const {
    117. loading,
    118. fetchResource: refreshTable,
    119. result: refreshTableRes
    120. } = useFetch(getWarehouseInventorynList, { isLazy: true })
    121. /**
    122. * 获取消费、返库列表
    123. * @param {{pageIndex: number, pageSize: number, recallStatus?: number, keyword?: string}} data
    124. * @returns {Object}
    125. */
    126. refreshTable(outInStockStore.willRecallStockSearchInfo)
    127. //获取最新的列表数据
    128. watch(refreshTableRes, () => {
    129. data.value = Array.from(formatTableData(refreshTableRes.value?.data))
    130. console.log(data.value)
    131. })
    132. /**
    133. * 侦听全局维护的 searchTriggerNum 的改变,刷新列表
    134. */
    135. watch(
    136. () => outInStockStore.searchTriggerNum,
    137. async () => {
    138. if (isInitialPresetPagination.value) {
    139. const searchInfo = outInStockStore.willRecallStockSearchInfo
    140. await refreshTable(searchInfo)
    141. } else {
    142. initialPresetPagination()
    143. }
    144. initialSelectedKeys()
    145. refreshTableScroll()
    146. }
    147. )
    148. /**
    149. * 初始化表格的滚动条
    150. */
    151. function refreshTableScroll() {
    152. nextTick(() => {
    153. const tableBody = document.querySelector('will-recall-stock-table .arco-table-body')
    154. tableBody?.scroll({ top: 0, left: 1, behavior: 'smooth' })
    155. })
    156. }
    157. /**
    158. * 分页相关
    159. */
    160. let paginationInfo = reactive({
    161. pageNum: 1,
    162. pageSize: 10
    163. })
    164. const isInitialPresetPagination = computed(() => {
    165. return paginationInfo.pageNum === 1 && paginationInfo.pageSize === 10
    166. })
    167. function initialPresetPagination() {
    168. paginationInfo.pageNum = 1
    169. paginationInfo.pageSize = 10
    170. }
    171. const pagination = computed(() => {
    172. const { pageNum, pageSize } = paginationInfo
    173. return {
    174. total: refreshTableRes.value?.totalRecords,
    175. showPageSize: true,
    176. current: pageNum,
    177. pageSize,
    178. //页码改变时触发
    179. onChange: (current) => {
    180. paginationInfo.pageNum = current
    181. Emiter('changePagination', { paginationInfo })
    182. },
    183. //数据条数改变时触发
    184. onPageSizeChange: (pageSize) => {
    185. paginationInfo.pageNum = 1
    186. paginationInfo.pageSize = pageSize
    187. Emiter('changePagination', { paginationInfo })
    188. }
    189. }
    190. })
    191. //侦听分页信息,刷新列表数据
    192. watch(paginationInfo, (newPagination) => {
    193. const { pageNum, pageSize } = newPagination
    194. const newSearchInfo = { ...outInStockStore.willRecallStockSearchInfo, pageIndex: pageNum, pageSize }
    195. outInStockStore.coverWillRecallStockSearchInfo({ searchInfo: newSearchInfo })
    196. // //触发搜索Trigger
    197. // outInStockStore.searchTrigger()
    198. refreshTable(outInStockStore.willRecallStockSearchInfo)
    199. })
    200. /**
    201. * 个性化展示列相关逻辑
    202. */
    203. //合理展示序号列
    204. function computedShowSerialNumber(num) {
    205. const { pageNum, pageSize } = paginationInfo
    206. const showNum = (pageNum - 1) * pageSize + num
    207. return showNum
    208. }
    209. const tooltipPosition: tooltipPosition = 'lb'
    210. /**
    211. * 确认返库相关业务
    212. */
    213. const selectedRows = ref<TableData[] | undefined>(void 0)
    214. function confirmRecallStock() {
    215. ConfirmRecallStockModalRef.value?.openModal(
    216. selectedKeys.value,
    217. selectedRows.value as Exclude<TableData[] | undefined, undefined>
    218. )
    219. }
    220. const handleRefreshTable = () => {
    221. outInStockStore.searchTrigger()
    222. }
    223. </script>
    224. <style scoped lang="scss"></style>

    image.png

    image.png

    1. <!--
    2. * @Author: Ashun
    3. * @Date: 2022-07-19 20:08:15
    4. * @LastEditors: zzd993
    5. * @LastEditTime: 2022-07-27 18:16:19
    6. * @FilePath: \elabnote-front-main\src\views\inventory\components\out-in-stock\query-detail\components\WillOutStockTable.vue
    7. * Copyright (c) 2022 by BMY, All Rights Reserved.
    8. -->
    9. <template>
    10. <div class="will-out-stock-table">
    11. // 自己封装的表单组件
    12. <BasicTable
    13. ref="tableRef"
    14. rowKey="id"
    15. :loading="loading"
    16. :columns="columns" // 展示的每一列的表头信息
    17. :data="(data as any)" // 表格数据
    18. :pagination="pagination"
    19. :rowSelection="rowSelection"
    20. v-model:selectedRowKeys="selectedKeys"
    21. v-model:selectedRows="selectedRows"
    22. :scroll="{
    23. y: 630
    24. }"
    25. column-resizable
    26. :bordered="{ headerCell: true }"
    27. >
    28. <template #customTitle>
    29. <div v-if="true" class="custom-title-box">
    30. <a-space>
    31. 已选定{{ selectedKeys.length }}个 <a-button size="mini" @click="confirmRecallStock">确认出库</a-button>
    32. <a-button size="mini" @click="revokeRecallStock">撤销出库</a-button>
    33. </a-space>
    34. </div>
    35. </template>
    36. <!-- 个性化展示的列👇 -->
    37. <!-- 序号 -->
    38. <template #serialNumber="{ item }"> // item表示数据中的每一列数据,是子组件通过作用域插槽传递来的
    39. {{ computedShowSerialNumber(item.record.index + 1) }}
    40. </template>
    41. <!-- 状态 -->
    42. <template #col_status="{ item }">
    43. <a-tag :color="showStatus(item.record.statusId)?.color">
    44. {{ showStatus(item.record.statusId)?.label }}
    45. </a-tag>
    46. </template>
    47. <!-- 库存编号 -->
    48. <template #col_stockNo="{ item }">
    49. <a-link> {{ item.record.entityCode }} </a-link>
    50. </template>
    51. <!-- 注册&批次信息 -->
    52. <template #col_productAndBatchInfo="{ item }">
    53. <a-tooltip :position="tooltipPosition">
    54. <template #content>{{ item.record.productName }} </template>
    55. <a-tag> {{ item.record.productName }} </a-tag>
    56. </a-tooltip>
    57. </template>
    58. <!-- 存储容器 -->
    59. <template #col_locationPath="{ item }">
    60. <a-link> {{ item.record.locationPath }} </a-link>
    61. </template>
    62. <!-- 位置 -->
    63. <template #col_location="{ item }">
    64. <a-link> {{ item.record.location }} </a-link>
    65. </template>
    66. <!-- 入库时间 -->
    67. <template #col_time_confirmTime="{ item }">
    68. <span>
    69. {{ handleShowDynamicParam({ type: ParameterType.MOMENT, value: item.record.confirmTime }) }}
    70. </span>
    71. </template>
    72. <!-- 截止日期 -->
    73. <template #col_time_expirationDate="{ item }">
    74. <span>
    75. {{ handleShowDynamicParam({ type: ParameterType.MOMENT, value: item.record.expirationDate }) }}
    76. </span>
    77. </template>
    78. </BasicTable>
    79. <StockOutModal ref="StockOutModalRef" @ok="confirmRecallStockOk" :confirm="true" />
    80. <RevokeOutModal ref="RevokeOutModalRef" @ok="revokeRecallStockOk" :confirm="true" />
    81. </div>
    82. </template>
    83. <script lang="ts">
    84. type tooltipPosition =
    85. | 'lb'
    86. | 'left'
    87. | 'right'
    88. | 'bottom'
    89. | 'top'
    90. | 'tl'
    91. | 'tr'
    92. | 'bl'
    93. | 'br'
    94. | 'rt'
    95. | 'lt'
    96. | 'rb'
    97. | undefined
    98. //一些表格配置
    99. const rowSelection = {
    100. showCheckedAll: true
    101. }
    102. </script>
    103. <script lang="ts" setup>
    104. //api
    105. import { queryInventoryGoods } from '@/api/material'
    106. //utils
    107. import { computed, reactive, ref, watch, nextTick } from 'vue'
    108. import { useFetch } from '@/hooks/useFetch' // 调接封装的函数
    109. import { EntityStatusLabelTypeEnumStatus } from '@/common/constant'
    110. import { handleShowDynamicParam } from '@/util/tools/showDynamicParam'
    111. import { StockSearchColumns, formatTableData } from '@/views/inventory/components/out-in-stock/utils'
    112. import { TabKeys } from '@/views/inventory/components/out-in-stock/type'
    113. //types
    114. // import { TabKeys } from '@/views/inventory/components/out-in-stock/type'
    115. import { ParameterType } from '@/common/enum'
    116. //store
    117. import { useOutInStockStore } from '@/store/modules/inventory/out-in-stock'
    118. import StockOutModal from '@/views/inventory/components/StockOutModal.vue'
    119. import RevokeOutModal from '@/views/inventory/components/RevokeOutModal.vue'
    120. import { TableData } from '@arco-design/web-vue'
    121. const outInStockStore = useOutInStockStore() // pinia实例
    122. // ref
    123. const StockOutModalRef = ref<InstanceType<typeof StockOutModal> | null>(null)
    124. const RevokeOutModalRef = ref<InstanceType<typeof RevokeOutModal> | null>(null)
    125. const Emiter = defineEmits(['changePagination'])
    126. // const Props = defineProps<{
    127. // currentTabKey: WarehouseInventoryActionTypeEnum
    128. // }>()
    129. const data = ref([])
    130. //请求表格数据的接口
    131. const {
    132. loading,
    133. result: refreshTableRes,
    134. fetchResource: refreshTable
    135. } = useFetch(queryInventoryGoods, {
    136. isLazy: true
    137. })
    138. // refreshTable(outInStockStore.willOutStockSearchInfo)
    139. const columns = ref<[]>(StockSearchColumns[outInStockStore.currentNodeType] as []) // 表格表头信息
    140. const selectedKeys = ref<string[]>([])
    141. const initialSelectedKeys = () => {
    142. selectedKeys.value = []
    143. tableRef?.value?.clearSelectedKeysCache?.()
    144. }
    145. const selectedRows = ref<Array<TableData>>()
    146. const tableRef = ref()
    147. //获取最新的列表数据
    148. watch(refreshTableRes, (res) => {
    149. data.value = Array.from(formatTableData((res as any).data))
    150. })
    151. /**
    152. * 侦听全局维护的 searchTriggerNum 的改变,刷新列表
    153. */
    154. watch(
    155. () => outInStockStore.searchTriggerNum,
    156. async () => {
    157. if (outInStockStore.currentNodeType !== Number(TabKeys.WILL_OUT_STOCK)) return
    158. if (isInitialPresetPagination.value) {
    159. // const currentNodeType = outInStockStore.currentNodeType
    160. // const searchInfoName = stockStatusMapSearchInfoName[currentNodeType]
    161. // const searchInfo = outInStockStore[searchInfoName]
    162. const searchInfo = outInStockStore.willOutStockSearchInfo
    163. await refreshTable(searchInfo)
    164. } else {
    165. initialPresetPagination()
    166. }
    167. initialSelectedKeys()
    168. refreshTableScroll()
    169. }
    170. )
    171. /**
    172. * 初始化表格的滚动条
    173. */
    174. function refreshTableScroll() {
    175. nextTick(() => {
    176. const tableBody = document.querySelector('will-in-stock-table .arco-table-body')
    177. tableBody?.scroll({ top: 0, left: 1, behavior: 'smooth' })
    178. })
    179. }
    180. /**
    181. * 分页相关
    182. */
    183. let paginationInfo = reactive({
    184. pageNum: 1,
    185. pageSize: 10
    186. })
    187. const isInitialPresetPagination = computed(() => {
    188. return paginationInfo.pageNum === 1 && paginationInfo.pageSize === 10
    189. })
    190. function initialPresetPagination() {
    191. paginationInfo.pageNum = 1
    192. paginationInfo.pageSize = 10
    193. }
    194. const pagination = computed(() => {
    195. const { pageNum, pageSize } = paginationInfo
    196. return {
    197. total: refreshTableRes.value?.totalRecords,
    198. showPageSize: true,
    199. current: pageNum,
    200. pageSize,
    201. //页码改变时触发
    202. onChange: (current) => {
    203. paginationInfo.pageNum = current
    204. Emiter('changePagination', { paginationInfo })
    205. },
    206. //数据条数改变时触发
    207. onPageSizeChange: (pageSize) => {
    208. paginationInfo.pageNum = 1
    209. paginationInfo.pageSize = pageSize
    210. Emiter('changePagination', { paginationInfo })
    211. }
    212. }
    213. })
    214. //侦听分页信息,刷新列表数据
    215. watch(paginationInfo, (newPagination) => {
    216. const { pageNum, pageSize } = newPagination
    217. const newSearchInfo = { ...outInStockStore.willOutStockSearchInfo, pageNum, pageSize }
    218. outInStockStore.coverWillOutStockSearchInfo({ searchInfo: newSearchInfo })
    219. // //触发搜索Trigger
    220. // outInStockStore.searchTrigger()
    221. refreshTable(outInStockStore.willOutStockSearchInfo)
    222. })
    223. /**
    224. * 个性化展示列相关逻辑
    225. */
    226. //合理展示序号列
    227. function computedShowSerialNumber(num) {
    228. const { pageNum, pageSize } = paginationInfo
    229. const showNum = (pageNum - 1) * pageSize + num
    230. return showNum
    231. }
    232. //合理展示状态
    233. function showStatus(statusNum) {
    234. return EntityStatusLabelTypeEnumStatus[statusNum]
    235. }
    236. const tooltipPosition: tooltipPosition = 'lb'
    237. /**
    238. * 确认返库
    239. */
    240. async function confirmRecallStock() {
    241. StockOutModalRef.value?.openModal(selectedRows.value!)
    242. }
    243. /**
    244. * 撤销出库
    245. */
    246. async function revokeRecallStock() {
    247. RevokeOutModalRef.value?.openModal(selectedRows.value!)
    248. }
    249. /**
    250. * 确认返库成功后的操作
    251. */
    252. const confirmRecallStockOk = async () => {
    253. outInStockStore.searchTrigger()
    254. outInStockStore.coverStockStatusTotalNum()
    255. }
    256. const revokeRecallStockOk = async () => {
    257. outInStockStore.searchTrigger()
    258. outInStockStore.coverStockStatusTotalNum()
    259. }
    260. </script>
    261. <style scoped lang="scss"></style>
    1. <!--
    2. * @Author: zhangy
    3. * @Date: 2022-07-21 17:38:07
    4. * @LastEditors: zzd993
    5. * @LastEditTime: 2022-07-27 18:00:54
    6. * @FilePath: \elabnote-front-main\src\views\inventory\components\StockOutModal.vue
    7. * Copyright (c) 2022 by BMY, All Rights Reserved.
    8. -->
    9. <template>
    10. <a-modal
    11. :width="900"
    12. :visible="visible"
    13. title-align="start"
    14. :title="Props.confirm ? '出库确认' : '出库'"
    15. @cancel="handleCancel"
    16. @ok="handleOk"
    17. :okText="Props.confirm ? '确认出库' : '确认'"
    18. >
    19. <BasicTable :columns="columns" :data="data" :pagination="false">
    20. <template #capacity="{ item }" v-if="!Props.confirm">
    21. <a-input-number :min="0" :max="item.record.capacity" type="text" v-model="item.record.actualCapacity" />
    22. </template>
    23. <template #productName="{ item }">
    24. <a-tag> {{ item.record[item.column.dataIndex] }} </a-tag>
    25. </template>
    26. <template #isStocked="{ item }">
    27. <span>{{
    28. item.record[item.column.dataIndex] ? showRetainOriginStocks(item.record[item.column.dataIndex]) : ''
    29. }}</span>
    30. </template>
    31. </BasicTable>
    32. <a-form v-if="!Props.confirm" ref="FormRef" :model="form" :style="{ width: '200px' }" layout="vertical">
    33. <a-form-item field="recallDate" label="如果需要返库,请选择返库时间">
    34. <a-date-picker v-model="form.recallDate" style="width: 100%" />
    35. </a-form-item>
    36. <a-form-item field="isLocaked" label="请确认是否保留原库位" validate-trigger="change" :rules="retainRules">
    37. <a-select v-model="form.isLocaked" allow-clear style="width: 100%" placeholder="请选择是否保留">
    38. <a-option :key="item.value" :value="item.value" v-for="item in RetainOriginStocks">{{ item.label }}</a-option>
    39. </a-select>
    40. </a-form-item>
    41. </a-form>
    42. </a-modal>
    43. </template>
    44. <script setup lang="ts">
    45. import { StockActionTypeEnum, SystemYesNoEnum } from '@/common/enum'
    46. import { computed, reactive, readonly, ref } from 'vue'
    47. import type { TableColumnData, TableData, Form } from '@arco-design/web-vue'
    48. import { commitStock, outStock } from '@/api/material'
    49. const visible = ref<boolean>(false)
    50. const Props = withDefaults(defineProps<{ confirm?: boolean }>(), {
    51. confirm: false
    52. })
    53. const FormRef = ref<InstanceType<typeof Form> | null>(null)
    54. const RetainOriginStocks = readonly([
    55. {
    56. label: '是',
    57. value: SystemYesNoEnum.YES
    58. },
    59. {
    60. label: '否',
    61. value: SystemYesNoEnum.NO
    62. }
    63. ])
    64. const form = reactive<{ recallDate: Date | string; isLocaked: SystemYesNoEnum }>({
    65. recallDate: undefined as unknown as Date,
    66. isLocaked: undefined as unknown as SystemYesNoEnum
    67. })
    68. const retainRules = computed(() => {
    69. if (form.recallDate) {
    70. return [{ required: true, message: '必填' }]
    71. }
    72. return []
    73. })
    74. const STOCK_COLUMNS: Array<TableColumnData> = [
    75. {
    76. title: '序号',
    77. width: 80,
    78. render: ({ rowIndex }) => rowIndex + 1
    79. },
    80. {
    81. title: '位置',
    82. dataIndex: 'location',
    83. width: 80,
    84. ellipsis: true,
    85. tooltip: true
    86. },
    87. {
    88. title: '存储容器',
    89. dataIndex: 'locationPath',
    90. width: 80,
    91. ellipsis: true,
    92. tooltip: true
    93. },
    94. {
    95. title: '出库量',
    96. dataIndex: 'capacity',
    97. slotName: 'capacity',
    98. width: 80,
    99. ellipsis: true,
    100. tooltip: true
    101. },
    102. {
    103. title: '量单位',
    104. dataIndex: 'unitName',
    105. width: 80,
    106. ellipsis: true,
    107. tooltip: true
    108. },
    109. {
    110. title: '库存编号',
    111. dataIndex: 'entityCode',
    112. width: 80,
    113. ellipsis: true,
    114. tooltip: true
    115. },
    116. {
    117. title: '注册编号',
    118. dataIndex: 'prefix',
    119. width: 80,
    120. ellipsis: true,
    121. tooltip: true
    122. },
    123. {
    124. title: '注册&批次信息',
    125. dataIndex: 'productName',
    126. slotName: 'productName',
    127. width: 130,
    128. ellipsis: true,
    129. tooltip: true
    130. }
    131. ]
    132. const CONFIRM_STOCK_COLUMNS: Array<TableColumnData> = [
    133. {
    134. title: '是否保留原库位',
    135. dataIndex: 'isStocked',
    136. slotName: 'isStocked',
    137. width: 130,
    138. ellipsis: true,
    139. tooltip: true
    140. }
    141. // {
    142. // title: '预计返库时间',
    143. // dataIndex: 'recallDate',
    144. // slotName: 'recallDate',
    145. // width: 130,
    146. // ellipsis: true,
    147. // tooltip: true
    148. // }
    149. ]
    150. const columns = computed(() => {
    151. if (Props.confirm) {
    152. return ([] as Array<TableColumnData>).concat(STOCK_COLUMNS).concat(CONFIRM_STOCK_COLUMNS)
    153. }
    154. return STOCK_COLUMNS
    155. })
    156. const data = ref<Array<TableData>>([])
    157. const handleCancel = () => {
    158. visible.value = false
    159. }
    160. /**
    161. * 是否保留原库位
    162. */
    163. const showRetainOriginStocks = (isLocaked: SystemYesNoEnum) => {
    164. return RetainOriginStocks.find((item) => item.value === isLocaked)?.label
    165. }
    166. /**
    167. * 确定
    168. */
    169. const handleOk = async () => {
    170. if (!Props.confirm) {
    171. FormRef.value!.validate()
    172. const stockOutConsumers = data.value.map((item) => {
    173. return {
    174. productEntityId: item.id as string,
    175. actualCapacity: item.actualCapacity as number,
    176. recallDate: form.recallDate as unknown as string
    177. }
    178. })
    179. await outStock({ stockOutConsumers, isLocked: form.isLocaked })
    180. } else {
    181. await commitStock({ productEntityIds: data.value.map((item) => item.id), actionType: StockActionTypeEnum.OUT })
    182. }
    183. handleCancel()
    184. Emits('ok')
    185. }
    186. interface IEmitType {
    187. (e: 'ok'): void
    188. }
    189. const Emits = defineEmits<IEmitType>()
    190. defineExpose({
    191. openModal: (list: Array<TableData>) => {
    192. data.value = list.map((item) => ({ ...item, actualCapacity: item.capacity ?? 0 }))
    193. visible.value = true
    194. }
    195. })
    196. </script>
    197. <style scoped lang="scss">
    198. :deep(.arco-form-item-label) {
    199. color: $font3Color;
    200. font-size: 14px;
    201. margin-top: 8px;
    202. }
    203. :deep(.arco-form-item) {
    204. margin-bottom: 0;
    205. }
    206. </style>