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>
|
||||
<a-button type="primary" @click="beiginScan">开始扫码</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"
|
||||
style="margin-top: 20px; margin-bottom: 20px;" />
|
||||
<a-row style="margin-bottom: 20px;">
|
||||
<a-col :span="12">
|
||||
<a-statistic title="扫码合计" :value="totalValue" style="margin-right: 50px" />
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-statistic title="已扫码" :value="remainderValue" />
|
||||
</a-col>
|
||||
</a-row>
|
||||
<!-- Esc键退出编辑功能 -->
|
||||
<vxe-table border stripe show-overflow ref="applyDetailTableRef" max-height="500" :column-config="{ resizable: true }"
|
||||
:keyboard-config="{ isEsc: true }" size="medium" empty-text="请先扫码物料体条码"
|
||||
:edit-config="{ trigger: 'click', mode: 'cell' }">
|
||||
|
||||
<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>
|
||||
<a-button type="primary" @click="beiginScan">开始扫码</a-button>
|
||||
<a-button type="primary" danger style="left: 20px">重新扫码</a-button>
|
||||
<a-input
|
||||
ref="snInput"
|
||||
v-model:value="value"
|
||||
bordered
|
||||
size="large"
|
||||
placeholder="输入条形码"
|
||||
style="margin-top: 20px; margin-bottom: 20px"
|
||||
@press-enter="autoInsertOneRow"
|
||||
/>
|
||||
<a-row style="margin-bottom: 20px">
|
||||
<a-col :span="12">
|
||||
<a-statistic title="扫码合计" :value="totalValue" style="margin-right: 50px" />
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-statistic title="已扫码" :value="remainderValue" />
|
||||
</a-col>
|
||||
</a-row>
|
||||
<!-- Esc键退出编辑功能 -->
|
||||
<vxe-table
|
||||
ref="applyDetailTableRef"
|
||||
border
|
||||
stripe
|
||||
show-overflow
|
||||
max-height="500"
|
||||
:column-config="{ resizable: true }"
|
||||
:keyboard-config="{ isEsc: true }"
|
||||
size="medium"
|
||||
empty-text="请先扫码物料体条码"
|
||||
:edit-config="{ trigger: 'click', mode: 'cell' }"
|
||||
>
|
||||
<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>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { VxeTableInstance } from 'vxe-table'
|
||||
import { useTemplateRef } from 'vue'
|
||||
import { api } from '@/api'
|
||||
import { message } from 'ant-design-vue';
|
||||
import { VxeTableInstance } from 'vxe-table'
|
||||
import { useTemplateRef } from 'vue'
|
||||
import { api } from '@/api'
|
||||
import { message } from 'ant-design-vue'
|
||||
|
||||
// 父组件数据交互
|
||||
const props = defineProps(
|
||||
{
|
||||
totalValue: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
applyId: {
|
||||
type: Number,
|
||||
required: false
|
||||
}
|
||||
}
|
||||
)
|
||||
// 父组件数据交互
|
||||
const props = defineProps({
|
||||
totalValue: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
applyId: {
|
||||
type: Number,
|
||||
required: false,
|
||||
default: 0,
|
||||
},
|
||||
})
|
||||
|
||||
//获取扫码的集合
|
||||
const getTableData = () => {
|
||||
const $table = applyDetailTableRef.value
|
||||
if ($table) {
|
||||
return $table.getTableData().fullData.map(item => ({
|
||||
assignRule: item.assignRule,
|
||||
materialId: item.id,
|
||||
barcode: item.barcode,
|
||||
code: item.code,
|
||||
date: item.times
|
||||
}))
|
||||
}
|
||||
}
|
||||
//获取扫码的集合
|
||||
const getTableData = () => {
|
||||
const $table = applyDetailTableRef.value
|
||||
if ($table) {
|
||||
return $table.getTableData().fullData.map((item) => ({
|
||||
assignRule: item.assignRule,
|
||||
materialId: item.id,
|
||||
barcode: item.barcode,
|
||||
code: item.code,
|
||||
date: item.times,
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
// 获取盘点审核的数据
|
||||
const getApplyData = () => {
|
||||
const $table = applyDetailTableRef.value
|
||||
if ($table) {
|
||||
return $table.getTableData().fullData.map(item => ({
|
||||
applyId: props.applyId,
|
||||
materialId: item.id,
|
||||
barcode: item.barcode
|
||||
}))
|
||||
// 获取盘点审核的数据
|
||||
const getApplyData = () => {
|
||||
const $table = applyDetailTableRef.value
|
||||
if ($table) {
|
||||
return $table.getTableData().fullData.map((item) => ({
|
||||
applyId: props.applyId,
|
||||
materialId: item.id,
|
||||
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
|
||||
}
|
||||
|
||||
//扫码的条形码字符串
|
||||
const value = ref('')
|
||||
const input = useTemplateRef('snInput');
|
||||
// 扫码点货的table对象
|
||||
const applyDetailTableRef = ref<VxeTableInstance<TableRowVO>>()
|
||||
|
||||
const snListCache = ref<string[]>([]) // 缓存扫码的条形码列表
|
||||
// 定义一个map缓存物料信息
|
||||
const materialMapCache = ref<Map<string, material.Material>>(new Map<string, material.Material>()) // 缓存物料信息,key是code
|
||||
// 移除table中的行
|
||||
const removeStep2Row = async (row: TableRowVO) => {
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求接口获取缓存数据
|
||||
*/
|
||||
const getCache = () => {
|
||||
function beiginScan() {
|
||||
// input.value?.focus()
|
||||
const el = input.value as HTMLInputElement | null
|
||||
if (el) {
|
||||
el.focus()
|
||||
}
|
||||
}
|
||||
|
||||
api.materialApi.material.all((data) => {
|
||||
data.forEach(item => {
|
||||
if (item.code) {
|
||||
materialMapCache.value.set(item.code, item) // 物料编码定义为6位
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
getCache();
|
||||
// 点击开始扫码按钮,自动新增一行 或者 扫码结束后也自动新增一行
|
||||
const autoInsertOneRow = async () => {
|
||||
const $table = applyDetailTableRef.value
|
||||
const sn = value.value.trim()
|
||||
|
||||
interface TableRowVO {
|
||||
id: number
|
||||
barcode: string
|
||||
assignRule: string
|
||||
name: string
|
||||
code: string
|
||||
spec: string
|
||||
type: string
|
||||
times: string
|
||||
}
|
||||
/**
|
||||
* 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
|
||||
}
|
||||
|
||||
// 扫码点货的table对象
|
||||
const applyDetailTableRef = ref<VxeTableInstance<TableRowVO>>()
|
||||
|
||||
// 移除table中的行
|
||||
const removeStep2Row = async (row: TableRowVO) => {
|
||||
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;
|
||||
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 = ''
|
||||
}
|
||||
}
|
||||
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 = ''
|
||||
}
|
||||
}
|
||||
</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>
|
||||
<page-container>
|
||||
<!-- 页面操作栏 -->
|
||||
<template #ops>
|
||||
<a-row>
|
||||
<a-col :span="18">
|
||||
<a-input-search v-model:value="searchKey" :placeholder="`请输入`" allow-clear enter-button
|
||||
@search="loadData()"></a-input-search>
|
||||
</a-col>
|
||||
<a-col :span="6">
|
||||
<a-button type="primary" style="margin-left: 10px" @click="formDrawer?.show()">
|
||||
<template #icon>
|
||||
<icon-font type="icon-plus" />
|
||||
</template>
|
||||
申请扫码
|
||||
</a-button>
|
||||
|
||||
</a-col>
|
||||
</a-row>
|
||||
</template>
|
||||
<!-- 页面表格内容 -->
|
||||
<div style="min-height: calc(100vh - 305px)">
|
||||
<!-- 表格行 -->
|
||||
<a-table :columns="columns" :data-source="auditPage?.records" bordered :pagination="pagination" :loading="loading"
|
||||
row-key="key">
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.dataIndex === 'auditType'">
|
||||
{{ record.auditType === 'ALL' ? '全部盘点' : '部分盘点' }}
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'reviewResult'">
|
||||
<template v-if="record.reviewResult === 'WAIT_SCAN'"> 待扫码</template>
|
||||
<template v-if="record.reviewResult === 'WAIT_SUBMIT'"> 待提交</template>
|
||||
<template v-if="record.reviewResult === 'WAIT_REVIEW'"> 待审核 </template>
|
||||
<template v-if="record.reviewResult === 'PASS'"> 审核通过</template>
|
||||
<template v-if="record.reviewResult === 'REJECT'"> 退回</template>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'operation'">
|
||||
<a-button type="link" @click="showModal(record.id)" v-if="record.reviewResult === 'WAIT_SCAN'
|
||||
|| record.reviewResult === 'REJECT'">
|
||||
<template #icon>
|
||||
<icon-font type="icon-edit" />
|
||||
</template>
|
||||
开始扫码
|
||||
</a-button>
|
||||
<a-button type="link" style="margin-left: 10px" @click="showResultModal(record.id)"
|
||||
v-if="record.reviewResult === 'WAIT_SUBMIT' || record.reviewResult === 'WAIT_SCAN'">
|
||||
<template #icon>
|
||||
<icon-font type="icon-plus" />
|
||||
</template>
|
||||
生成结果
|
||||
</a-button>
|
||||
<a-button type="link" style="margin-left: 10px" v-if="record.reviewResult === 'WAIT_REVIEW'">
|
||||
<template #icon>
|
||||
<icon-font type="icon-plus" />
|
||||
</template>
|
||||
审核
|
||||
</a-button>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
</a-table>
|
||||
</div>
|
||||
</page-container>
|
||||
|
||||
<!-- 新增申请抽屉 -->
|
||||
<form-drawer ref="formDrawer" v-model="applyForm" :form-items="items" :config="formConfig"
|
||||
:disabled-fields=disabledFields @ok="doSave" title="扫码盘点" />
|
||||
<!-- 盘点作业弹窗 -->
|
||||
<a-modal v-model:open="open" title="盘点作业" width="100%" wrap-class-name="full-modal" @ok="handleOk"
|
||||
:confirm-loading="confirmLoading">
|
||||
<scan-form ref="scanFormRef" :apply-id="applyIdRef" :total-value="88"></scan-form>
|
||||
</a-modal>
|
||||
<!-- 盘点结果弹窗 -->
|
||||
<a-modal v-model:open="openResult" title="盘点异常数据:" okText= "提交审核" @ok="submitHandle" width="80%" :confirm-loading="confirmLoading">
|
||||
<result-form ref="handleResultRef" :apply-id="applyIdRef"></result-form>
|
||||
</a-modal>
|
||||
|
||||
<page-container>
|
||||
<!-- 页面操作栏 -->
|
||||
<template #ops>
|
||||
<a-row>
|
||||
<a-col :span="18">
|
||||
<a-input-search
|
||||
v-model:value="searchKey"
|
||||
:placeholder="`请输入`"
|
||||
allow-clear
|
||||
enter-button
|
||||
@search="loadData()"
|
||||
></a-input-search>
|
||||
</a-col>
|
||||
<a-col :span="6">
|
||||
<a-button type="primary" style="margin-left: 10px" @click="formDrawer?.show()">
|
||||
<template #icon>
|
||||
<icon-font type="icon-plus" />
|
||||
</template>
|
||||
申请扫码
|
||||
</a-button>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</template>
|
||||
<!-- 页面表格内容 -->
|
||||
<div style="min-height: calc(100vh - 305px)">
|
||||
<!-- 表格行 -->
|
||||
<a-table
|
||||
:columns="columns"
|
||||
:data-source="auditPage?.records"
|
||||
bordered
|
||||
:pagination="pagination"
|
||||
:loading="loading"
|
||||
row-key="key"
|
||||
>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.dataIndex === 'auditType'">
|
||||
{{ record.auditType === 'ALL' ? '全部盘点' : '部分盘点' }}
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'reviewResult'">
|
||||
<template v-if="record.reviewResult === 'WAIT_SCAN'">待扫码</template>
|
||||
<template v-if="record.reviewResult === 'WAIT_SUBMIT'">待提交</template>
|
||||
<template v-if="record.reviewResult === 'WAIT_REVIEW'">待审核</template>
|
||||
<template v-if="record.reviewResult === 'PASS'">审核通过</template>
|
||||
<template v-if="record.reviewResult === 'REJECT'">退回</template>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'operation'">
|
||||
<a-button
|
||||
v-if="record.reviewResult === 'WAIT_SCAN' || record.reviewResult === 'REJECT'"
|
||||
type="link"
|
||||
@click="showModal(record.id)"
|
||||
>
|
||||
<template #icon>
|
||||
<icon-font type="icon-edit" />
|
||||
</template>
|
||||
开始扫码
|
||||
</a-button>
|
||||
<a-button
|
||||
v-if="record.reviewResult === 'WAIT_SUBMIT' || record.reviewResult === 'WAIT_SCAN'"
|
||||
type="link"
|
||||
style="margin-left: 10px"
|
||||
@click="showResultModal(record.id)"
|
||||
>
|
||||
<template #icon>
|
||||
<icon-font type="icon-plus" />
|
||||
</template>
|
||||
生成结果
|
||||
</a-button>
|
||||
<a-button v-if="record.reviewResult === 'WAIT_REVIEW'" type="link" style="margin-left: 10px">
|
||||
<template #icon>
|
||||
<icon-font type="icon-plus" />
|
||||
</template>
|
||||
审核
|
||||
</a-button>
|
||||
</template>
|
||||
</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>
|
||||
|
||||
<script setup lang="ts">
|
||||
import api from '@/api';
|
||||
import { IPage } from '@/api/api'
|
||||
import FormDrawer from '@/components/form-render/form-drawer.vue'
|
||||
import { config, formItems } from './form'
|
||||
import { notification } from 'ant-design-vue'
|
||||
import dayjs from 'dayjs';
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import scanForm from '../component/scan-form.vue'
|
||||
import resultForm from './result-form.vue'
|
||||
import api from '@/api'
|
||||
import { IPage } from '@/api/api'
|
||||
import FormDrawer from '@/components/form-render/form-drawer.vue'
|
||||
import { config, formItems } from './form'
|
||||
import { notification } from 'ant-design-vue'
|
||||
import dayjs from 'dayjs'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import scanForm from '../component/scan-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 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 auditPage = ref<IPage<material.ApplyForm>>()
|
||||
const loading = ref(false)
|
||||
|
||||
})
|
||||
//新增申请的下拉框选择对象
|
||||
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 loading = ref(false)
|
||||
//是否必填
|
||||
const disabledFields = computed(() => {
|
||||
return applyForm.value?.auditType === 'ALL' ? ['materials'] : []
|
||||
})
|
||||
|
||||
//新增申请的下拉框选择对象
|
||||
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 formDrawer = ref<typeof FormDrawer>()
|
||||
const formConfig = computed(() => {
|
||||
return config
|
||||
})
|
||||
//表单配置
|
||||
const items = computed(() => {
|
||||
return formItems(materialList.value, required, personList.value)
|
||||
})
|
||||
// 加载数据的方法
|
||||
const loadData = async (page = 1, size = 10) => {
|
||||
loading.value = true
|
||||
api.materialApi.apply.searchAuditPage(
|
||||
{
|
||||
page: page,
|
||||
size: size,
|
||||
reviewResults: ['WAIT_SUBMIT', 'WAIT_SCAN', 'WAIT_REVIEW', 'PASS'],
|
||||
},
|
||||
(data) => {
|
||||
auditPage.value = data
|
||||
loading.value = false
|
||||
},
|
||||
)
|
||||
}
|
||||
//初始加载
|
||||
loadData()
|
||||
|
||||
//是否必填
|
||||
const disabledFields = computed(() => {
|
||||
if (applyForm.value?.auditType !== 'ALL') {
|
||||
required.value = true
|
||||
}
|
||||
return applyForm.value?.auditType === 'ALL' ? ['materials'] : []
|
||||
})
|
||||
|
||||
//抽屉组件
|
||||
const formDrawer = ref<typeof FormDrawer>()
|
||||
const formConfig = computed(() => {
|
||||
return config
|
||||
})
|
||||
//表单配置
|
||||
const items = computed(() => {
|
||||
return formItems(materialList.value, required, personList.value)
|
||||
})
|
||||
// 加载数据的方法
|
||||
const loadData = async (page = 1, size = 10) => {
|
||||
loading.value = true
|
||||
api.materialApi.apply.searchAuditPage(
|
||||
{
|
||||
page: page,
|
||||
size: size,
|
||||
reviewResults: ['WAIT_SUBMIT', 'WAIT_SCAN', 'WAIT_REVIEW', 'PASS'],
|
||||
}, (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;
|
||||
}
|
||||
//表格列
|
||||
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
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
.full-modal {
|
||||
.ant-modal {
|
||||
max-width: 100%;
|
||||
top: 0;
|
||||
padding-bottom: 0;
|
||||
margin: 0;
|
||||
}
|
||||
.full-modal {
|
||||
.ant-modal {
|
||||
max-width: 100%;
|
||||
top: 0;
|
||||
padding-bottom: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.ant-modal-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: calc(100vh);
|
||||
}
|
||||
.ant-modal-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: calc(100vh);
|
||||
}
|
||||
|
||||
.ant-modal-body {
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
.ant-modal-body {
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
Loading…
x
Reference in New Issue
Block a user