bug: 修改eslint检查的代码缺陷
This commit is contained in:
parent
eebfca8790
commit
b88e8479ef
@ -1,27 +0,0 @@
|
|||||||
<template>
|
|
||||||
<a-row bordered>
|
|
||||||
<a-col :span="8">
|
|
||||||
<a-button type="primary" width="90%">开始扫码</a-button>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="8">
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="8">
|
|
||||||
<a-input bordered size="large" ref="snInput" placeholder="输入条形码" style="width: 90%" />
|
|
||||||
</a-col>
|
|
||||||
</a-row>
|
|
||||||
|
|
||||||
|
|
||||||
<vxe-table border stripe show-overflow ref="applyDetailTableRef" max-height="500" :column-config="{ resizable: true }"
|
|
||||||
:keyboard-config="{ isEsc: true }" size="medium">
|
|
||||||
<vxe-column type="seq" title="序号" width="60"></vxe-column>
|
|
||||||
<vxe-column field="id" title="物料id" :visible="false"></vxe-column>
|
|
||||||
<vxe-column field="name" title="物料名称" />
|
|
||||||
<vxe-column field="code" title="编码" />
|
|
||||||
<vxe-column field="spec" title="规格" />
|
|
||||||
<vxe-column field="type" title="类型" />
|
|
||||||
<vxe-column field="times" title="库存数量" />
|
|
||||||
<vxe-column field="oprator" title="盘点数量" />
|
|
||||||
</vxe-table>
|
|
||||||
</template>
|
|
||||||
<script setup lang="ts">
|
|
||||||
</script>
|
|
@ -1,202 +1,207 @@
|
|||||||
<template>
|
<template>
|
||||||
<a-button type="primary" @click="beiginScan">开始扫码</a-button>
|
<a-button type="primary" @click="beiginScan">开始扫码</a-button>
|
||||||
<a-button type="primary" danger style="left: 20px;">重新扫码</a-button>
|
<a-button type="primary" danger style="left: 20px">重新扫码</a-button>
|
||||||
<a-input bordered size="large" ref="snInput" v-model:value="value" placeholder="输入条形码" @pressEnter="autoInsertOneRow"
|
<a-input
|
||||||
style="margin-top: 20px; margin-bottom: 20px;" />
|
ref="snInput"
|
||||||
<a-row style="margin-bottom: 20px;">
|
v-model:value="value"
|
||||||
<a-col :span="12">
|
bordered
|
||||||
<a-statistic title="扫码合计" :value="totalValue" style="margin-right: 50px" />
|
size="large"
|
||||||
</a-col>
|
placeholder="输入条形码"
|
||||||
<a-col :span="12">
|
style="margin-top: 20px; margin-bottom: 20px"
|
||||||
<a-statistic title="已扫码" :value="remainderValue" />
|
@press-enter="autoInsertOneRow"
|
||||||
</a-col>
|
/>
|
||||||
</a-row>
|
<a-row style="margin-bottom: 20px">
|
||||||
<!-- Esc键退出编辑功能 -->
|
<a-col :span="12">
|
||||||
<vxe-table border stripe show-overflow ref="applyDetailTableRef" max-height="500" :column-config="{ resizable: true }"
|
<a-statistic title="扫码合计" :value="totalValue" style="margin-right: 50px" />
|
||||||
:keyboard-config="{ isEsc: true }" size="medium" empty-text="请先扫码物料体条码"
|
</a-col>
|
||||||
:edit-config="{ trigger: 'click', mode: 'cell' }">
|
<a-col :span="12">
|
||||||
|
<a-statistic title="已扫码" :value="remainderValue" />
|
||||||
<vxe-column type="seq" title="序号" width="60"></vxe-column>
|
</a-col>
|
||||||
<vxe-column field="id" title="物料id" :visible="false"></vxe-column>
|
</a-row>
|
||||||
<vxe-column field="barcode" title="物料条码" />
|
<!-- Esc键退出编辑功能 -->
|
||||||
<vxe-column field="name" title="物料名称" />
|
<vxe-table
|
||||||
<vxe-column field="code" title="编码" />
|
ref="applyDetailTableRef"
|
||||||
<vxe-column field="spec" title="规格" />
|
border
|
||||||
<vxe-column field="type" title="类型" />
|
stripe
|
||||||
<vxe-column field="times" title="扫码时间" />
|
show-overflow
|
||||||
<vxe-column field="oprator" title="操作">
|
max-height="500"
|
||||||
<template #default="{ row }">
|
:column-config="{ resizable: true }"
|
||||||
<vxe-button mode="text" status="error" @click="removeStep2Row(row)">删除</vxe-button>
|
:keyboard-config="{ isEsc: true }"
|
||||||
</template>
|
size="medium"
|
||||||
</vxe-column>
|
empty-text="请先扫码物料体条码"
|
||||||
|
:edit-config="{ trigger: 'click', mode: 'cell' }"
|
||||||
</vxe-table>
|
>
|
||||||
|
<vxe-column type="seq" title="序号" width="60"></vxe-column>
|
||||||
|
<vxe-column field="id" title="物料id" :visible="false"></vxe-column>
|
||||||
|
<vxe-column field="barcode" title="物料条码" />
|
||||||
|
<vxe-column field="name" title="物料名称" />
|
||||||
|
<vxe-column field="code" title="编码" />
|
||||||
|
<vxe-column field="spec" title="规格" />
|
||||||
|
<vxe-column field="type" title="类型" />
|
||||||
|
<vxe-column field="times" title="扫码时间" />
|
||||||
|
<vxe-column field="oprator" title="操作">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<vxe-button mode="text" status="error" @click="removeStep2Row(row)">删除</vxe-button>
|
||||||
|
</template>
|
||||||
|
</vxe-column>
|
||||||
|
</vxe-table>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { VxeTableInstance } from 'vxe-table'
|
import { VxeTableInstance } from 'vxe-table'
|
||||||
import { useTemplateRef } from 'vue'
|
import { useTemplateRef } from 'vue'
|
||||||
import { api } from '@/api'
|
import { api } from '@/api'
|
||||||
import { message } from 'ant-design-vue';
|
import { message } from 'ant-design-vue'
|
||||||
|
|
||||||
// 父组件数据交互
|
// 父组件数据交互
|
||||||
const props = defineProps(
|
const props = defineProps({
|
||||||
{
|
totalValue: {
|
||||||
totalValue: {
|
type: Number,
|
||||||
type: Number,
|
default: 0,
|
||||||
default: 0
|
},
|
||||||
},
|
applyId: {
|
||||||
applyId: {
|
type: Number,
|
||||||
type: Number,
|
required: false,
|
||||||
required: false
|
default: 0,
|
||||||
}
|
},
|
||||||
}
|
})
|
||||||
)
|
|
||||||
|
|
||||||
//获取扫码的集合
|
//获取扫码的集合
|
||||||
const getTableData = () => {
|
const getTableData = () => {
|
||||||
const $table = applyDetailTableRef.value
|
const $table = applyDetailTableRef.value
|
||||||
if ($table) {
|
if ($table) {
|
||||||
return $table.getTableData().fullData.map(item => ({
|
return $table.getTableData().fullData.map((item) => ({
|
||||||
assignRule: item.assignRule,
|
assignRule: item.assignRule,
|
||||||
materialId: item.id,
|
materialId: item.id,
|
||||||
barcode: item.barcode,
|
barcode: item.barcode,
|
||||||
code: item.code,
|
code: item.code,
|
||||||
date: item.times
|
date: item.times,
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取盘点审核的数据
|
// 获取盘点审核的数据
|
||||||
const getApplyData = () => {
|
const getApplyData = () => {
|
||||||
const $table = applyDetailTableRef.value
|
const $table = applyDetailTableRef.value
|
||||||
if ($table) {
|
if ($table) {
|
||||||
return $table.getTableData().fullData.map(item => ({
|
return $table.getTableData().fullData.map((item) => ({
|
||||||
applyId: props.applyId,
|
applyId: props.applyId,
|
||||||
materialId: item.id,
|
materialId: item.id,
|
||||||
barcode: item.barcode
|
barcode: item.barcode,
|
||||||
}))
|
}))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}}
|
defineExpose({ getTableData, getApplyData })
|
||||||
|
|
||||||
|
const remainderValue = ref(0)
|
||||||
|
|
||||||
defineExpose({ getTableData,getApplyData })
|
//扫码的条形码字符串
|
||||||
|
const value = ref('')
|
||||||
|
const input = useTemplateRef('snInput')
|
||||||
|
|
||||||
|
const snListCache = ref<string[]>([]) // 缓存扫码的条形码列表
|
||||||
|
// 定义一个map缓存物料信息
|
||||||
|
const materialMapCache = ref<Map<string, material.Material>>(new Map<string, material.Material>()) // 缓存物料信息,key是code
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请求接口获取缓存数据
|
||||||
|
*/
|
||||||
|
const getCache = () => {
|
||||||
|
api.materialApi.material.all((data) => {
|
||||||
|
data.forEach((item) => {
|
||||||
|
if (item.code) {
|
||||||
|
materialMapCache.value.set(item.code, item) // 物料编码定义为6位
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
getCache()
|
||||||
|
|
||||||
const remainderValue = ref(0)
|
interface TableRowVO {
|
||||||
|
id: number
|
||||||
|
barcode: string
|
||||||
|
assignRule: string
|
||||||
|
name: string
|
||||||
|
code: string
|
||||||
|
spec: string
|
||||||
|
type: string
|
||||||
|
times: string
|
||||||
|
}
|
||||||
|
|
||||||
//扫码的条形码字符串
|
// 扫码点货的table对象
|
||||||
const value = ref('')
|
const applyDetailTableRef = ref<VxeTableInstance<TableRowVO>>()
|
||||||
const input = useTemplateRef('snInput');
|
|
||||||
|
|
||||||
const snListCache = ref<string[]>([]) // 缓存扫码的条形码列表
|
// 移除table中的行
|
||||||
// 定义一个map缓存物料信息
|
const removeStep2Row = async (row: TableRowVO) => {
|
||||||
const materialMapCache = ref<Map<string, material.Material>>(new Map<string, material.Material>()) // 缓存物料信息,key是code
|
const $table = applyDetailTableRef.value
|
||||||
|
if ($table) {
|
||||||
|
$table.remove(row)
|
||||||
|
//删除缓存的sn
|
||||||
|
snListCache.value = snListCache.value.filter((item) => item !== row.barcode)
|
||||||
|
|
||||||
|
// 已扫码数量-1
|
||||||
|
remainderValue.value = remainderValue.value - 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
function beiginScan() {
|
||||||
* 请求接口获取缓存数据
|
// input.value?.focus()
|
||||||
*/
|
const el = input.value as HTMLInputElement | null
|
||||||
const getCache = () => {
|
if (el) {
|
||||||
|
el.focus()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
api.materialApi.material.all((data) => {
|
// 点击开始扫码按钮,自动新增一行 或者 扫码结束后也自动新增一行
|
||||||
data.forEach(item => {
|
const autoInsertOneRow = async () => {
|
||||||
if (item.code) {
|
const $table = applyDetailTableRef.value
|
||||||
materialMapCache.value.set(item.code, item) // 物料编码定义为6位
|
const sn = value.value.trim()
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
getCache();
|
|
||||||
|
|
||||||
interface TableRowVO {
|
/**
|
||||||
id: number
|
* 1. 判断sn是否合法
|
||||||
barcode: string
|
* 2. 判断sn是否已经存在于表格中,需要缓存sn列表
|
||||||
assignRule: string
|
* 3. 根据sn获取物料信息,并新增一行到表格中,需要缓存物料信息
|
||||||
name: string
|
* 4. 插入成功后缓存sn
|
||||||
code: string
|
*/
|
||||||
spec: string
|
if (sn.length === 0) {
|
||||||
type: string
|
value.value = ''
|
||||||
times: string
|
message.warning('【' + sn + '】条形码为空,请重新扫码', 5)
|
||||||
}
|
return
|
||||||
|
}
|
||||||
|
if (snListCache.value.includes(sn)) {
|
||||||
|
value.value = ''
|
||||||
|
message.warning('【' + sn + '】条形码重复,请重新扫码', 5)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 找到条形码对应的物料编码
|
||||||
|
const code = sn.slice(0, 6)
|
||||||
|
const materialInfo = materialMapCache.value.get(code)
|
||||||
|
if (!materialInfo) {
|
||||||
|
value.value = ''
|
||||||
|
message.warning('【' + sn + '】条形码不合法,请重新扫码', 5)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// 扫码点货的table对象
|
if ($table) {
|
||||||
const applyDetailTableRef = ref<VxeTableInstance<TableRowVO>>()
|
const row: TableRowVO = {
|
||||||
|
id: materialInfo?.id ?? 0,
|
||||||
// 移除table中的行
|
barcode: sn,
|
||||||
const removeStep2Row = async (row: TableRowVO) => {
|
assignRule: materialInfo?.assignRule ?? '',
|
||||||
const $table = applyDetailTableRef.value
|
name: materialInfo?.name ?? '',
|
||||||
if ($table) {
|
code: materialInfo?.code ?? '',
|
||||||
$table.remove(row)
|
spec: materialInfo?.spec ?? '',
|
||||||
//删除缓存的sn
|
type: materialInfo?.type ?? '',
|
||||||
snListCache.value = snListCache.value.filter(item => item!== row.barcode)
|
times: new Date().toLocaleString(),
|
||||||
|
}
|
||||||
// 已扫码数量-1
|
$table.insert(row)
|
||||||
remainderValue.value = remainderValue.value - 1
|
// 缓存sn
|
||||||
}
|
snListCache.value.push(sn)
|
||||||
}
|
//已扫码数量+1
|
||||||
|
|
||||||
function beiginScan() {
|
|
||||||
// input.value?.focus()
|
|
||||||
const el = input.value as HTMLInputElement | null;
|
|
||||||
if (el) {
|
|
||||||
el.focus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 点击开始扫码按钮,自动新增一行 或者 扫码结束后也自动新增一行
|
|
||||||
const autoInsertOneRow = async () => {
|
|
||||||
const $table = applyDetailTableRef.value
|
|
||||||
const sn = value.value.trim();
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 1. 判断sn是否合法
|
|
||||||
* 2. 判断sn是否已经存在于表格中,需要缓存sn列表
|
|
||||||
* 3. 根据sn获取物料信息,并新增一行到表格中,需要缓存物料信息
|
|
||||||
* 4. 插入成功后缓存sn
|
|
||||||
*/
|
|
||||||
if (sn.length === 0) {
|
|
||||||
value.value = ''
|
|
||||||
message.warning('【' + sn + '】条形码为空,请重新扫码', 5)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (snListCache.value.includes(sn)) {
|
|
||||||
value.value = ''
|
|
||||||
message.warning('【' + sn + '】条形码重复,请重新扫码', 5)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// 找到条形码对应的物料编码
|
|
||||||
const code = sn.slice(0, 6)
|
|
||||||
const materialInfo = materialMapCache.value.get(code)
|
|
||||||
if (!materialInfo) {
|
|
||||||
value.value = ''
|
|
||||||
message.warning('【' + sn + '】条形码不合法,请重新扫码', 5)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if ($table) {
|
|
||||||
const row: TableRowVO = {
|
|
||||||
id: materialInfo?.id ?? 0,
|
|
||||||
barcode: sn,
|
|
||||||
assignRule: materialInfo?.assignRule ?? '',
|
|
||||||
name: materialInfo?.name ?? '',
|
|
||||||
code: materialInfo?.code ?? '',
|
|
||||||
spec: materialInfo?.spec ?? '',
|
|
||||||
type: materialInfo?.type ?? '',
|
|
||||||
times: new Date().toLocaleString()
|
|
||||||
}
|
|
||||||
$table.insert(row)
|
|
||||||
// 缓存sn
|
|
||||||
snListCache.value.push(sn)
|
|
||||||
//已扫码数量+1
|
|
||||||
|
|
||||||
remainderValue.value = remainderValue.value + 1
|
|
||||||
// 添加后就清空输入框
|
|
||||||
value.value = ''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
remainderValue.value = remainderValue.value + 1
|
||||||
|
// 添加后就清空输入框
|
||||||
|
value.value = ''
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
32
src/views/stock/component/stock-taking.vue
Normal file
32
src/views/stock/component/stock-taking.vue
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<template>
|
||||||
|
<a-row bordered>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-button type="primary" width="90%">开始扫码</a-button>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8"></a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-input ref="snInput" bordered size="large" placeholder="输入条形码" style="width: 90%" />
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
|
||||||
|
<vxe-table
|
||||||
|
ref="applyDetailTableRef"
|
||||||
|
border
|
||||||
|
stripe
|
||||||
|
show-overflow
|
||||||
|
max-height="500"
|
||||||
|
:column-config="{ resizable: true }"
|
||||||
|
:keyboard-config="{ isEsc: true }"
|
||||||
|
size="medium"
|
||||||
|
>
|
||||||
|
<vxe-column type="seq" title="序号" width="60"></vxe-column>
|
||||||
|
<vxe-column field="id" title="物料id" :visible="false"></vxe-column>
|
||||||
|
<vxe-column field="name" title="物料名称" />
|
||||||
|
<vxe-column field="code" title="编码" />
|
||||||
|
<vxe-column field="spec" title="规格" />
|
||||||
|
<vxe-column field="type" title="类型" />
|
||||||
|
<vxe-column field="times" title="库存数量" />
|
||||||
|
<vxe-column field="oprator" title="盘点数量" />
|
||||||
|
</vxe-table>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts"></script>
|
@ -1,303 +1,323 @@
|
|||||||
<template>
|
<template>
|
||||||
<page-container>
|
<page-container>
|
||||||
<!-- 页面操作栏 -->
|
<!-- 页面操作栏 -->
|
||||||
<template #ops>
|
<template #ops>
|
||||||
<a-row>
|
<a-row>
|
||||||
<a-col :span="18">
|
<a-col :span="18">
|
||||||
<a-input-search v-model:value="searchKey" :placeholder="`请输入`" allow-clear enter-button
|
<a-input-search
|
||||||
@search="loadData()"></a-input-search>
|
v-model:value="searchKey"
|
||||||
</a-col>
|
:placeholder="`请输入`"
|
||||||
<a-col :span="6">
|
allow-clear
|
||||||
<a-button type="primary" style="margin-left: 10px" @click="formDrawer?.show()">
|
enter-button
|
||||||
<template #icon>
|
@search="loadData()"
|
||||||
<icon-font type="icon-plus" />
|
></a-input-search>
|
||||||
</template>
|
</a-col>
|
||||||
申请扫码
|
<a-col :span="6">
|
||||||
</a-button>
|
<a-button type="primary" style="margin-left: 10px" @click="formDrawer?.show()">
|
||||||
|
<template #icon>
|
||||||
</a-col>
|
<icon-font type="icon-plus" />
|
||||||
</a-row>
|
</template>
|
||||||
</template>
|
申请扫码
|
||||||
<!-- 页面表格内容 -->
|
</a-button>
|
||||||
<div style="min-height: calc(100vh - 305px)">
|
</a-col>
|
||||||
<!-- 表格行 -->
|
</a-row>
|
||||||
<a-table :columns="columns" :data-source="auditPage?.records" bordered :pagination="pagination" :loading="loading"
|
</template>
|
||||||
row-key="key">
|
<!-- 页面表格内容 -->
|
||||||
<template #bodyCell="{ column, record }">
|
<div style="min-height: calc(100vh - 305px)">
|
||||||
<template v-if="column.dataIndex === 'auditType'">
|
<!-- 表格行 -->
|
||||||
{{ record.auditType === 'ALL' ? '全部盘点' : '部分盘点' }}
|
<a-table
|
||||||
</template>
|
:columns="columns"
|
||||||
<template v-if="column.dataIndex === 'reviewResult'">
|
:data-source="auditPage?.records"
|
||||||
<template v-if="record.reviewResult === 'WAIT_SCAN'"> 待扫码</template>
|
bordered
|
||||||
<template v-if="record.reviewResult === 'WAIT_SUBMIT'"> 待提交</template>
|
:pagination="pagination"
|
||||||
<template v-if="record.reviewResult === 'WAIT_REVIEW'"> 待审核 </template>
|
:loading="loading"
|
||||||
<template v-if="record.reviewResult === 'PASS'"> 审核通过</template>
|
row-key="key"
|
||||||
<template v-if="record.reviewResult === 'REJECT'"> 退回</template>
|
>
|
||||||
</template>
|
<template #bodyCell="{ column, record }">
|
||||||
<template v-if="column.dataIndex === 'operation'">
|
<template v-if="column.dataIndex === 'auditType'">
|
||||||
<a-button type="link" @click="showModal(record.id)" v-if="record.reviewResult === 'WAIT_SCAN'
|
{{ record.auditType === 'ALL' ? '全部盘点' : '部分盘点' }}
|
||||||
|| record.reviewResult === 'REJECT'">
|
</template>
|
||||||
<template #icon>
|
<template v-if="column.dataIndex === 'reviewResult'">
|
||||||
<icon-font type="icon-edit" />
|
<template v-if="record.reviewResult === 'WAIT_SCAN'">待扫码</template>
|
||||||
</template>
|
<template v-if="record.reviewResult === 'WAIT_SUBMIT'">待提交</template>
|
||||||
开始扫码
|
<template v-if="record.reviewResult === 'WAIT_REVIEW'">待审核</template>
|
||||||
</a-button>
|
<template v-if="record.reviewResult === 'PASS'">审核通过</template>
|
||||||
<a-button type="link" style="margin-left: 10px" @click="showResultModal(record.id)"
|
<template v-if="record.reviewResult === 'REJECT'">退回</template>
|
||||||
v-if="record.reviewResult === 'WAIT_SUBMIT' || record.reviewResult === 'WAIT_SCAN'">
|
</template>
|
||||||
<template #icon>
|
<template v-if="column.dataIndex === 'operation'">
|
||||||
<icon-font type="icon-plus" />
|
<a-button
|
||||||
</template>
|
v-if="record.reviewResult === 'WAIT_SCAN' || record.reviewResult === 'REJECT'"
|
||||||
生成结果
|
type="link"
|
||||||
</a-button>
|
@click="showModal(record.id)"
|
||||||
<a-button type="link" style="margin-left: 10px" v-if="record.reviewResult === 'WAIT_REVIEW'">
|
>
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<icon-font type="icon-plus" />
|
<icon-font type="icon-edit" />
|
||||||
</template>
|
</template>
|
||||||
审核
|
开始扫码
|
||||||
</a-button>
|
</a-button>
|
||||||
</template>
|
<a-button
|
||||||
</template>
|
v-if="record.reviewResult === 'WAIT_SUBMIT' || record.reviewResult === 'WAIT_SCAN'"
|
||||||
|
type="link"
|
||||||
</a-table>
|
style="margin-left: 10px"
|
||||||
</div>
|
@click="showResultModal(record.id)"
|
||||||
</page-container>
|
>
|
||||||
|
<template #icon>
|
||||||
<!-- 新增申请抽屉 -->
|
<icon-font type="icon-plus" />
|
||||||
<form-drawer ref="formDrawer" v-model="applyForm" :form-items="items" :config="formConfig"
|
</template>
|
||||||
:disabled-fields=disabledFields @ok="doSave" title="扫码盘点" />
|
生成结果
|
||||||
<!-- 盘点作业弹窗 -->
|
</a-button>
|
||||||
<a-modal v-model:open="open" title="盘点作业" width="100%" wrap-class-name="full-modal" @ok="handleOk"
|
<a-button v-if="record.reviewResult === 'WAIT_REVIEW'" type="link" style="margin-left: 10px">
|
||||||
:confirm-loading="confirmLoading">
|
<template #icon>
|
||||||
<scan-form ref="scanFormRef" :apply-id="applyIdRef" :total-value="88"></scan-form>
|
<icon-font type="icon-plus" />
|
||||||
</a-modal>
|
</template>
|
||||||
<!-- 盘点结果弹窗 -->
|
审核
|
||||||
<a-modal v-model:open="openResult" title="盘点异常数据:" okText= "提交审核" @ok="submitHandle" width="80%" :confirm-loading="confirmLoading">
|
</a-button>
|
||||||
<result-form ref="handleResultRef" :apply-id="applyIdRef"></result-form>
|
</template>
|
||||||
</a-modal>
|
</template>
|
||||||
|
</a-table>
|
||||||
|
</div>
|
||||||
|
</page-container>
|
||||||
|
|
||||||
|
<!-- 新增申请抽屉 -->
|
||||||
|
<form-drawer
|
||||||
|
ref="formDrawer"
|
||||||
|
v-model="applyForm"
|
||||||
|
:form-items="items"
|
||||||
|
:config="formConfig"
|
||||||
|
:disabled-fields="disabledFields"
|
||||||
|
title="扫码盘点"
|
||||||
|
@ok="doSave"
|
||||||
|
/>
|
||||||
|
<!-- 盘点作业弹窗 -->
|
||||||
|
<a-modal
|
||||||
|
v-model:open="open"
|
||||||
|
title="盘点作业"
|
||||||
|
width="100%"
|
||||||
|
wrap-class-name="full-modal"
|
||||||
|
:confirm-loading="confirmLoading"
|
||||||
|
@ok="handleOk"
|
||||||
|
>
|
||||||
|
<scan-form ref="scanFormRef" :apply-id="applyIdRef" :total-value="88"></scan-form>
|
||||||
|
</a-modal>
|
||||||
|
<!-- 盘点结果弹窗 -->
|
||||||
|
<a-modal
|
||||||
|
v-model:open="openResult"
|
||||||
|
title="盘点异常数据:"
|
||||||
|
ok-text="提交审核"
|
||||||
|
width="80%"
|
||||||
|
:confirm-loading="confirmLoading"
|
||||||
|
@ok="submitHandle"
|
||||||
|
>
|
||||||
|
<result-form ref="handleResultRef" :apply-id="applyIdRef"></result-form>
|
||||||
|
</a-modal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import api from '@/api';
|
import api from '@/api'
|
||||||
import { IPage } from '@/api/api'
|
import { IPage } from '@/api/api'
|
||||||
import FormDrawer from '@/components/form-render/form-drawer.vue'
|
import FormDrawer from '@/components/form-render/form-drawer.vue'
|
||||||
import { config, formItems } from './form'
|
import { config, formItems } from './form'
|
||||||
import { notification } from 'ant-design-vue'
|
import { notification } from 'ant-design-vue'
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs'
|
||||||
import { useUserStore } from '@/stores/user'
|
import { useUserStore } from '@/stores/user'
|
||||||
import scanForm from '../component/scan-form.vue'
|
import scanForm from '../component/scan-form.vue'
|
||||||
import resultForm from './result-form.vue'
|
import resultForm from './result-form.vue'
|
||||||
|
|
||||||
|
const searchKey = ref('')
|
||||||
|
const userStore = useUserStore()
|
||||||
|
const scanFormRef = ref() // 盘点作业弹窗组件
|
||||||
|
const handleResultRef = ref() // 盘点结果弹窗组件
|
||||||
|
const confirmLoading = ref(false) // 盘点作业弹窗提交按钮loading
|
||||||
|
// 新增申请表单对象
|
||||||
|
const applyForm = ref<Partial<material.AuditApplyInfo>>({
|
||||||
|
auditType: 'ALL',
|
||||||
|
applicant: userStore.userName,
|
||||||
|
type: 'AUDIT',
|
||||||
|
applyDate: dayjs() + '',
|
||||||
|
isConfirm: false,
|
||||||
|
reviewResult: 'WAIT_SCAN',
|
||||||
|
})
|
||||||
|
|
||||||
const searchKey = ref('')
|
//列表数据
|
||||||
const userStore = useUserStore()
|
const auditPage = ref<IPage<material.ApplyForm>>()
|
||||||
const scanFormRef = ref(); // 盘点作业弹窗组件
|
const loading = ref(false)
|
||||||
const handleResultRef = ref(); // 盘点结果弹窗组件
|
|
||||||
const confirmLoading = ref(false) // 盘点作业弹窗提交按钮loading
|
|
||||||
// 新增申请表单对象
|
|
||||||
const applyForm = ref<Partial<material.AuditApplyInfo>>({
|
|
||||||
auditType: 'ALL',
|
|
||||||
applicant: userStore.userName,
|
|
||||||
type: 'AUDIT',
|
|
||||||
applyDate: dayjs() + '',
|
|
||||||
isConfirm: false,
|
|
||||||
reviewResult: 'WAIT_SCAN'
|
|
||||||
|
|
||||||
})
|
//新增申请的下拉框选择对象
|
||||||
|
const materialList = ref<Array<{ value: string | undefined; label: string | undefined }>>([])
|
||||||
|
const personList = ref<Array<{ value: string | undefined; label: string | undefined }>>([])
|
||||||
|
const required = ref(false)
|
||||||
|
api.materialApi.material.all((data) => {
|
||||||
|
materialList.value = data.map((item) => {
|
||||||
|
return {
|
||||||
|
value: item?.id + '',
|
||||||
|
label: item?.name,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
api.aclApi.user.all((data) => {
|
||||||
|
personList.value = data.map((item) => {
|
||||||
|
return {
|
||||||
|
value: item?.name,
|
||||||
|
label: item?.fullName,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
//列表数据
|
//是否必填
|
||||||
const auditPage = ref<IPage<material.ApplyForm>>()
|
const disabledFields = computed(() => {
|
||||||
const loading = ref(false)
|
return applyForm.value?.auditType === 'ALL' ? ['materials'] : []
|
||||||
|
})
|
||||||
|
|
||||||
//新增申请的下拉框选择对象
|
//抽屉组件
|
||||||
const materialList = ref<Array<{ value: string | undefined, label: string | undefined }>>([])
|
const formDrawer = ref<typeof FormDrawer>()
|
||||||
const personList = ref<Array<{ value: string | undefined, label: string | undefined }>>([])
|
const formConfig = computed(() => {
|
||||||
const required = ref(false)
|
return config
|
||||||
api.materialApi.material.all((data) => {
|
})
|
||||||
materialList.value = data.map(item => {
|
//表单配置
|
||||||
return {
|
const items = computed(() => {
|
||||||
value: item?.id + '',
|
return formItems(materialList.value, required, personList.value)
|
||||||
label: item?.name
|
})
|
||||||
}
|
// 加载数据的方法
|
||||||
})
|
const loadData = async (page = 1, size = 10) => {
|
||||||
})
|
loading.value = true
|
||||||
api.aclApi.user.all((data) => {
|
api.materialApi.apply.searchAuditPage(
|
||||||
personList.value = data.map(item => {
|
{
|
||||||
return {
|
page: page,
|
||||||
value: item?.name,
|
size: size,
|
||||||
label: item?.fullName
|
reviewResults: ['WAIT_SUBMIT', 'WAIT_SCAN', 'WAIT_REVIEW', 'PASS'],
|
||||||
}
|
},
|
||||||
})
|
(data) => {
|
||||||
})
|
auditPage.value = data
|
||||||
|
loading.value = false
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
//初始加载
|
||||||
|
loadData()
|
||||||
|
|
||||||
//是否必填
|
//表格列
|
||||||
const disabledFields = computed(() => {
|
const columns = [
|
||||||
if (applyForm.value?.auditType !== 'ALL') {
|
{
|
||||||
required.value = true
|
title: '申请ID',
|
||||||
}
|
dataIndex: 'id',
|
||||||
return applyForm.value?.auditType === 'ALL' ? ['materials'] : []
|
},
|
||||||
})
|
{
|
||||||
|
title: '盘点类型',
|
||||||
//抽屉组件
|
dataIndex: 'auditType',
|
||||||
const formDrawer = ref<typeof FormDrawer>()
|
},
|
||||||
const formConfig = computed(() => {
|
{
|
||||||
return config
|
title: '申请人',
|
||||||
})
|
dataIndex: 'applicant',
|
||||||
//表单配置
|
},
|
||||||
const items = computed(() => {
|
{
|
||||||
return formItems(materialList.value, required, personList.value)
|
title: '盘点人',
|
||||||
})
|
dataIndex: 'taker',
|
||||||
// 加载数据的方法
|
},
|
||||||
const loadData = async (page = 1, size = 10) => {
|
{
|
||||||
loading.value = true
|
title: '任务状态',
|
||||||
api.materialApi.apply.searchAuditPage(
|
dataIndex: 'reviewResult',
|
||||||
{
|
},
|
||||||
page: page,
|
{
|
||||||
size: size,
|
title: '盘点审核人',
|
||||||
reviewResults: ['WAIT_SUBMIT', 'WAIT_SCAN', 'WAIT_REVIEW', 'PASS'],
|
dataIndex: 'reviewer',
|
||||||
}, (data) => {
|
},
|
||||||
auditPage.value = data
|
|
||||||
loading.value = false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
//初始加载
|
|
||||||
loadData()
|
|
||||||
|
|
||||||
//表格列
|
|
||||||
const columns = [
|
|
||||||
{
|
|
||||||
title: '申请ID',
|
|
||||||
dataIndex: 'id',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '盘点类型',
|
|
||||||
dataIndex: 'auditType',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '申请人',
|
|
||||||
dataIndex: 'applicant',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '盘点人',
|
|
||||||
dataIndex: 'taker',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '任务状态',
|
|
||||||
dataIndex: 'reviewResult',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '盘点审核人',
|
|
||||||
dataIndex: 'reviewer',
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
title: '创建时间',
|
|
||||||
dataIndex: 'createdTime',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '操作',
|
|
||||||
dataIndex: 'operation',
|
|
||||||
width: 400,
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
//分页信息
|
|
||||||
const pagination = computed(() => {
|
|
||||||
return {
|
|
||||||
current: auditPage.value?.current,
|
|
||||||
pageSize: auditPage.value?.size,
|
|
||||||
total: auditPage.value?.total,
|
|
||||||
onChange: (page: number, pageSize: number) => {
|
|
||||||
loadData(page, pageSize)
|
|
||||||
},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
// 新增申请保存
|
|
||||||
const doSave = (_data: material.AuditApplyInfo) => {
|
|
||||||
api.materialApi.apply.auditApply(_data, () => {
|
|
||||||
formDrawer.value?.close()
|
|
||||||
notification.success({
|
|
||||||
message: '操作成功',
|
|
||||||
description: '盘点申请保存成功,页面将自动刷新!',
|
|
||||||
onClose: () => {
|
|
||||||
loadData(1)
|
|
||||||
},
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// 盘点作业弹窗相关
|
|
||||||
const open = ref<boolean>(false);
|
|
||||||
const applyIdRef = ref();
|
|
||||||
const showModal = (applyId: number) => {
|
|
||||||
open.value = true;
|
|
||||||
applyIdRef.value = applyId;
|
|
||||||
|
|
||||||
};
|
|
||||||
// 盘点作业提交数据
|
|
||||||
|
|
||||||
|
|
||||||
//关闭弹窗 提交数据
|
|
||||||
const handleOk = () => {
|
|
||||||
confirmLoading.value = true;
|
|
||||||
if (scanFormRef.value) {
|
|
||||||
const data = scanFormRef.value.getApplyData();
|
|
||||||
api.materialApi.apply.saveScanData(applyIdRef.value, data, () => {
|
|
||||||
open.value = false;
|
|
||||||
confirmLoading.value = false;
|
|
||||||
loadData(1)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
// 盘点结果弹窗相关
|
|
||||||
const openResult = ref<boolean>(false);
|
|
||||||
const showResultModal = (applyId: number) => {
|
|
||||||
window.console.log("点击传参" + applyId);
|
|
||||||
openResult.value = true;
|
|
||||||
applyIdRef.value = applyId;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 盘点结果提交数据
|
|
||||||
const submitHandle = () => {
|
|
||||||
confirmLoading.value = true;
|
|
||||||
const handleData =handleResultRef.value.getTableData();
|
|
||||||
api.materialApi.apply.updateReviewResult(applyIdRef.value, handleData, () => {
|
|
||||||
openResult.value = false;
|
|
||||||
loadData(1)
|
|
||||||
});
|
|
||||||
confirmLoading.value = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
{
|
||||||
|
title: '创建时间',
|
||||||
|
dataIndex: 'createdTime',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
dataIndex: 'operation',
|
||||||
|
width: 400,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
//分页信息
|
||||||
|
const pagination = computed(() => {
|
||||||
|
return {
|
||||||
|
current: auditPage.value?.current,
|
||||||
|
pageSize: auditPage.value?.size,
|
||||||
|
total: auditPage.value?.total,
|
||||||
|
onChange: (page: number, pageSize: number) => {
|
||||||
|
loadData(page, pageSize)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// 新增申请保存
|
||||||
|
const doSave = (_data: material.AuditApplyInfo) => {
|
||||||
|
api.materialApi.apply.auditApply(_data, () => {
|
||||||
|
formDrawer.value?.close()
|
||||||
|
notification.success({
|
||||||
|
message: '操作成功',
|
||||||
|
description: '盘点申请保存成功,页面将自动刷新!',
|
||||||
|
onClose: () => {
|
||||||
|
loadData(1)
|
||||||
|
},
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 盘点作业弹窗相关
|
||||||
|
const open = ref<boolean>(false)
|
||||||
|
const applyIdRef = ref()
|
||||||
|
const showModal = (applyId: number) => {
|
||||||
|
open.value = true
|
||||||
|
applyIdRef.value = applyId
|
||||||
|
}
|
||||||
|
// 盘点作业提交数据
|
||||||
|
|
||||||
|
//关闭弹窗 提交数据
|
||||||
|
const handleOk = () => {
|
||||||
|
confirmLoading.value = true
|
||||||
|
if (scanFormRef.value) {
|
||||||
|
const data = scanFormRef.value.getApplyData()
|
||||||
|
api.materialApi.apply.saveScanData(applyIdRef.value, data, () => {
|
||||||
|
open.value = false
|
||||||
|
confirmLoading.value = false
|
||||||
|
loadData(1)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 盘点结果弹窗相关
|
||||||
|
const openResult = ref<boolean>(false)
|
||||||
|
const showResultModal = (applyId: number) => {
|
||||||
|
window.console.log('点击传参' + applyId)
|
||||||
|
openResult.value = true
|
||||||
|
applyIdRef.value = applyId
|
||||||
|
}
|
||||||
|
|
||||||
|
// 盘点结果提交数据
|
||||||
|
const submitHandle = () => {
|
||||||
|
confirmLoading.value = true
|
||||||
|
const handleData = handleResultRef.value.getTableData()
|
||||||
|
api.materialApi.apply.updateReviewResult(applyIdRef.value, handleData, () => {
|
||||||
|
openResult.value = false
|
||||||
|
loadData(1)
|
||||||
|
})
|
||||||
|
confirmLoading.value = false
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less">
|
<style lang="less">
|
||||||
.full-modal {
|
.full-modal {
|
||||||
.ant-modal {
|
.ant-modal {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
top: 0;
|
top: 0;
|
||||||
padding-bottom: 0;
|
padding-bottom: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ant-modal-content {
|
.ant-modal-content {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
height: calc(100vh);
|
height: calc(100vh);
|
||||||
}
|
}
|
||||||
|
|
||||||
.ant-modal-body {
|
.ant-modal-body {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user