| | |
| | | <wd-col :span="21"> |
| | | <wd-search |
| | | v-model="searchKeyword" |
| | | placeholder="请输入规格型号" |
| | | placeholder="请输入" |
| | | placeholder-left |
| | | hide-cancel |
| | | @search="handleSearch" |
| | |
| | | :key="`wait-${searchKey}`" |
| | | :api="ManageApi.getProductList" |
| | | state="待完成" |
| | | :model="searchKeyword" |
| | | :search="searchKeyword" |
| | | @ok="changeWait" |
| | | /> |
| | | </wd-tab> |
| | | <wd-tab :title="`部分完成(${total.partial})`" class="tab_bg"> |
| | | <ProductList |
| | | ref="partialRef" |
| | | :key="`partial-${searchKey}`" |
| | | :api="ManageApi.getProductList" |
| | | state="部分完成" |
| | | :model="searchKeyword" |
| | | @ok="changePartial" |
| | | /> |
| | | </wd-tab> |
| | | <wd-tab :title="`已生产(${total.already})`" class="tab_bg"> |
| | |
| | | :key="`already-${searchKey}`" |
| | | :api="ManageApi.getProductList" |
| | | state="已完成" |
| | | :model="searchKeyword" |
| | | :search="searchKeyword" |
| | | @ok="changeAlready" |
| | | /> |
| | | </wd-tab> |
| | |
| | | const toast = useToast(); |
| | | |
| | | const waitRef = ref(); |
| | | const partialRef = ref(); |
| | | const alreadyRef = ref(); |
| | | const tab = ref<number>(0); |
| | | const searchKeyword = ref(""); |
| | | const searchKey = ref(0); |
| | | const total = reactive({ |
| | | wait: 0, |
| | | partial: 0, |
| | | already: 0, |
| | | }); |
| | | |
| | |
| | | total.wait = num; |
| | | }; |
| | | |
| | | const changePartial = (num: number) => { |
| | | total.partial = num; |
| | | }; |
| | | |
| | | const changeAlready = (num: number) => { |
| | | total.already = num; |
| | | }; |
| | | |
| | | // 获取统计数据 |
| | | const getStatistics = async () => { |
| | | try { |
| | | const params: any = {}; |
| | | if (searchKeyword.value) { |
| | | params.search = searchKeyword.value; |
| | | } |
| | | const { code, data } = await ManageApi.getProductStatistics(params); |
| | | if (code === 200 && data) { |
| | | total.wait = data["待完成"] || 0; |
| | | total.already = data["已完成"] || 0; |
| | | } |
| | | } catch (error) { |
| | | console.error("获取统计数据失败:", error); |
| | | } |
| | | }; |
| | | |
| | | const handleSearch = () => { |
| | | searchKey.value++; |
| | | // 搜索时更新统计数据 |
| | | getStatistics(); |
| | | }; |
| | | |
| | | const handleClear = () => { |
| | |
| | | onMounted(() => { |
| | | // 开启广播监听事件 |
| | | setupScanListener(); |
| | | // 获取统计数据 |
| | | getStatistics(); |
| | | console.log("显示1"); |
| | | }); |
| | | onUnmounted(() => { |