Commit d0b4ff7e by wuqian

入库单按钮操作

parent ba93e883
...@@ -21,7 +21,8 @@ ...@@ -21,7 +21,8 @@
"vue": "^3.4.19", "vue": "^3.4.19",
"vue-dompurify-html": "^5.1.0", "vue-dompurify-html": "^5.1.0",
"vue-router": "^4.3.0", "vue-router": "^4.3.0",
"vue-tsc": "^2.1.10" "vue-tsc": "^2.1.10",
"xlsx": "^0.18.5"
}, },
"devDependencies": { "devDependencies": {
"@types/splitpanes": "^2.2.6", "@types/splitpanes": "^2.2.6",
...@@ -2509,6 +2510,15 @@ ...@@ -2509,6 +2510,15 @@
"acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
} }
}, },
"node_modules/adler-32": {
"version": "1.3.1",
"resolved": "https://registry.npmmirror.com/adler-32/-/adler-32-1.3.1.tgz",
"integrity": "sha512-ynZ4w/nUUv5rrsR8UUGoe1VC9hZj6V5hU9Qw1HlMDJGEJw5S7TfTErWTjMys6M7vr0YWcPqs3qAr4ss0nDfP+A==",
"license": "Apache-2.0",
"engines": {
"node": ">=0.8"
}
},
"node_modules/ajv": { "node_modules/ajv": {
"version": "6.12.6", "version": "6.12.6",
"resolved": "https://registry.npmmirror.com/ajv/-/ajv-6.12.6.tgz", "resolved": "https://registry.npmmirror.com/ajv/-/ajv-6.12.6.tgz",
...@@ -2714,6 +2724,19 @@ ...@@ -2714,6 +2724,19 @@
} }
] ]
}, },
"node_modules/cfb": {
"version": "1.2.2",
"resolved": "https://registry.npmmirror.com/cfb/-/cfb-1.2.2.tgz",
"integrity": "sha512-KfdUZsSOw19/ObEWasvBP/Ac4reZvAGauZhs6S/gqNhXhI7cKwvlH7ulj+dOEYnca4bm4SGo8C1bTAQvnTjgQA==",
"license": "Apache-2.0",
"dependencies": {
"adler-32": "~1.3.0",
"crc-32": "~1.2.0"
},
"engines": {
"node": ">=0.8"
}
},
"node_modules/chalk": { "node_modules/chalk": {
"version": "4.1.2", "version": "4.1.2",
"resolved": "https://registry.npmmirror.com/chalk/-/chalk-4.1.2.tgz", "resolved": "https://registry.npmmirror.com/chalk/-/chalk-4.1.2.tgz",
...@@ -2754,6 +2777,15 @@ ...@@ -2754,6 +2777,15 @@
"fsevents": "~2.3.2" "fsevents": "~2.3.2"
} }
}, },
"node_modules/codepage": {
"version": "1.15.0",
"resolved": "https://registry.npmmirror.com/codepage/-/codepage-1.15.0.tgz",
"integrity": "sha512-3g6NUTPd/YtuuGrhMnOMRjFc+LJw/bnMp3+0r/Wcz3IXUuCosKRJvMphm5+Q+bvTVGcJJuRvVLuYba+WojaFaA==",
"license": "Apache-2.0",
"engines": {
"node": ">=0.8"
}
},
"node_modules/color-convert": { "node_modules/color-convert": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmmirror.com/color-convert/-/color-convert-2.0.1.tgz", "resolved": "https://registry.npmmirror.com/color-convert/-/color-convert-2.0.1.tgz",
...@@ -2800,6 +2832,18 @@ ...@@ -2800,6 +2832,18 @@
"integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==",
"dev": true "dev": true
}, },
"node_modules/crc-32": {
"version": "1.2.2",
"resolved": "https://registry.npmmirror.com/crc-32/-/crc-32-1.2.2.tgz",
"integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==",
"license": "Apache-2.0",
"bin": {
"crc32": "bin/crc32.njs"
},
"engines": {
"node": ">=0.8"
}
},
"node_modules/cross-spawn": { "node_modules/cross-spawn": {
"version": "7.0.3", "version": "7.0.3",
"resolved": "https://registry.npmmirror.com/cross-spawn/-/cross-spawn-7.0.3.tgz", "resolved": "https://registry.npmmirror.com/cross-spawn/-/cross-spawn-7.0.3.tgz",
...@@ -3498,6 +3542,15 @@ ...@@ -3498,6 +3542,15 @@
"node": ">= 6" "node": ">= 6"
} }
}, },
"node_modules/frac": {
"version": "1.1.2",
"resolved": "https://registry.npmmirror.com/frac/-/frac-1.1.2.tgz",
"integrity": "sha512-w/XBfkibaTl3YDqASwfDUqkna4Z2p9cFSr1aHDt0WoMTECnRfBOv2WArlZILlqgWlmdIlALXGpM2AOhEk5W3IA==",
"license": "Apache-2.0",
"engines": {
"node": ">=0.8"
}
},
"node_modules/fs.realpath": { "node_modules/fs.realpath": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmmirror.com/fs.realpath/-/fs.realpath-1.0.0.tgz", "resolved": "https://registry.npmmirror.com/fs.realpath/-/fs.realpath-1.0.0.tgz",
...@@ -4904,6 +4957,18 @@ ...@@ -4904,6 +4957,18 @@
"url": "https://github.com/sponsors/antoniandre" "url": "https://github.com/sponsors/antoniandre"
} }
}, },
"node_modules/ssf": {
"version": "0.11.2",
"resolved": "https://registry.npmmirror.com/ssf/-/ssf-0.11.2.tgz",
"integrity": "sha512-+idbmIXoYET47hH+d7dfm2epdOMUDjqcB4648sTZ+t2JwoyBFL/insLfB/racrDmsKB3diwsDA696pZMieAC5g==",
"license": "Apache-2.0",
"dependencies": {
"frac": "~1.1.2"
},
"engines": {
"node": ">=0.8"
}
},
"node_modules/ssr-window": { "node_modules/ssr-window": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/ssr-window/-/ssr-window-3.0.0.tgz", "resolved": "https://registry.npmjs.org/ssr-window/-/ssr-window-3.0.0.tgz",
...@@ -5501,12 +5566,51 @@ ...@@ -5501,12 +5566,51 @@
"resolved": "https://registry.npmjs.org/wildcard/-/wildcard-1.1.2.tgz", "resolved": "https://registry.npmjs.org/wildcard/-/wildcard-1.1.2.tgz",
"integrity": "sha512-DXukZJxpHA8LuotRwL0pP1+rS6CS7FF2qStDDE1C7DDg2rLud2PXRMuEDYIPhgEezwnlHNL4c+N6MfMTjCGTng==" "integrity": "sha512-DXukZJxpHA8LuotRwL0pP1+rS6CS7FF2qStDDE1C7DDg2rLud2PXRMuEDYIPhgEezwnlHNL4c+N6MfMTjCGTng=="
}, },
"node_modules/wmf": {
"version": "1.0.2",
"resolved": "https://registry.npmmirror.com/wmf/-/wmf-1.0.2.tgz",
"integrity": "sha512-/p9K7bEh0Dj6WbXg4JG0xvLQmIadrner1bi45VMJTfnbVHsc7yIajZyoSoK60/dtVBs12Fm6WkUI5/3WAVsNMw==",
"license": "Apache-2.0",
"engines": {
"node": ">=0.8"
}
},
"node_modules/word": {
"version": "0.3.0",
"resolved": "https://registry.npmmirror.com/word/-/word-0.3.0.tgz",
"integrity": "sha512-OELeY0Q61OXpdUfTp+oweA/vtLVg5VDOXh+3he3PNzLGG/y0oylSOC1xRVj0+l4vQ3tj/bB1HVHv1ocXkQceFA==",
"license": "Apache-2.0",
"engines": {
"node": ">=0.8"
}
},
"node_modules/wrappy": { "node_modules/wrappy": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmmirror.com/wrappy/-/wrappy-1.0.2.tgz", "resolved": "https://registry.npmmirror.com/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
"dev": true "dev": true
}, },
"node_modules/xlsx": {
"version": "0.18.5",
"resolved": "https://registry.npmmirror.com/xlsx/-/xlsx-0.18.5.tgz",
"integrity": "sha512-dmg3LCjBPHZnQp5/F/+nnTa+miPJxUXB6vtk42YjBBKayDNagxGEeIdWApkYPOf3Z3pm3k62Knjzp7lMeTEtFQ==",
"license": "Apache-2.0",
"dependencies": {
"adler-32": "~1.3.0",
"cfb": "~1.2.1",
"codepage": "~1.15.0",
"crc-32": "~1.2.1",
"ssf": "~0.11.2",
"wmf": "~1.0.1",
"word": "~0.3.0"
},
"bin": {
"xlsx": "bin/xlsx.njs"
},
"engines": {
"node": ">=0.8"
}
},
"node_modules/xml-name-validator": { "node_modules/xml-name-validator": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmmirror.com/xml-name-validator/-/xml-name-validator-4.0.0.tgz", "resolved": "https://registry.npmmirror.com/xml-name-validator/-/xml-name-validator-4.0.0.tgz",
......
...@@ -23,7 +23,8 @@ ...@@ -23,7 +23,8 @@
"vue": "^3.4.19", "vue": "^3.4.19",
"vue-dompurify-html": "^5.1.0", "vue-dompurify-html": "^5.1.0",
"vue-router": "^4.3.0", "vue-router": "^4.3.0",
"vue-tsc": "^2.1.10" "vue-tsc": "^2.1.10",
"xlsx": "^0.18.5"
}, },
"devDependencies": { "devDependencies": {
"@types/splitpanes": "^2.2.6", "@types/splitpanes": "^2.2.6",
......
...@@ -8,11 +8,11 @@ import { ...@@ -8,11 +8,11 @@ import {
InterskuList, InterskuList,
InterWarehouseList, InterWarehouseList,
ILocation, ILocation,
InRecordEditForm,
} from '@/types/api/warehouse' } from '@/types/api/warehouse'
export interface LogListData { export interface LogListData {
createTime: string createTime: string
description: string description: string
createdTime?: string | null
} }
export interface PrintData{ export interface PrintData{
code:string code:string
...@@ -274,8 +274,22 @@ export function warehouseInRecordListPageApi( ...@@ -274,8 +274,22 @@ export function warehouseInRecordListPageApi(
}, },
) )
} }
export function rejectInRecordApi({
export function addInRecordApi(form: InRecordEditForm) { ids,
rejectReason,
}: {
ids: string
rejectReason: string
}) {
return axios.post<never, BaseRespData<never>>(
'factory/warehouseInRecord/turnDown',
{
ids,
rejectReason,
},
)
}
export function addInRecordApi(form: InterWarehouseDetail) {
return axios.post<never, BaseRespData<never>>( return axios.post<never, BaseRespData<never>>(
'factory/warehouseInRecord/add', 'factory/warehouseInRecord/add',
{ {
...@@ -284,7 +298,7 @@ export function addInRecordApi(form: InRecordEditForm) { ...@@ -284,7 +298,7 @@ export function addInRecordApi(form: InRecordEditForm) {
) )
} }
export function updateInRecordApi(form: InRecordEditForm) { export function updateInRecordApi(form: InterWarehouseDetail) {
return axios.post<never, BaseRespData<never>>( return axios.post<never, BaseRespData<never>>(
'factory/warehouseInRecord/update', 'factory/warehouseInRecord/update',
{ {
...@@ -292,8 +306,8 @@ export function updateInRecordApi(form: InRecordEditForm) { ...@@ -292,8 +306,8 @@ export function updateInRecordApi(form: InRecordEditForm) {
}, },
) )
} }
export function getWarehouseInRecordDetailApi(id: number) { export function getWarehouseInRecordDetailApi(id: number | undefined) {
return axios.get<never, BaseRespData<InterWarehouseDetail[]>>( return axios.get<never, BaseRespData<InterWarehouseDetail>>(
'factory/warehouseInRecord/get', 'factory/warehouseInRecord/get',
{ {
params: { params: {
...@@ -302,7 +316,7 @@ export function getWarehouseInRecordDetailApi(id: number) { ...@@ -302,7 +316,7 @@ export function getWarehouseInRecordDetailApi(id: number) {
}, },
) )
} }
export function getBySkuApi(warehouseId: number, sku: string | null) { export function getBySkuApi(warehouseId: number | string, sku: string | null) {
return axios.get<never, BaseRespData<InterskuList[]>>( return axios.get<never, BaseRespData<InterskuList[]>>(
'customProductItem/getBySku', 'customProductItem/getBySku',
{ {
...@@ -314,7 +328,7 @@ export function getBySkuApi(warehouseId: number, sku: string | null) { ...@@ -314,7 +328,7 @@ export function getBySkuApi(warehouseId: number, sku: string | null) {
) )
} }
export function getByWareHouseIdAndCodeApi( export function getByWareHouseIdAndCodeApi(
wareHouseId: number, wareHouseId: number | string | undefined,
code: string | null, code: string | null,
) { ) {
return axios.get<never, BaseRespData<ILocation[]>>( return axios.get<never, BaseRespData<ILocation[]>>(
...@@ -339,8 +353,8 @@ export function getWarehouseListApi() { ...@@ -339,8 +353,8 @@ export function getWarehouseListApi() {
) )
} }
interface WarehouseParams { interface WarehouseParams {
id: number id?: number
dataVersion: number dataVersion?: number
} }
export function auditOrderApi(url: string, data: WarehouseParams[]) { export function auditOrderApi(url: string, data: WarehouseParams[]) {
return axios.post(url, data) return axios.post(url, data)
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import * as XLSX from 'xlsx'
import { ref, watch, defineProps, defineEmits, computed } from 'vue' import { ref, watch, defineProps, defineEmits, computed } from 'vue'
import { UploadFilled, Document, Close } from '@element-plus/icons-vue' import { UploadFilled, Document, Close } from '@element-plus/icons-vue'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
...@@ -55,8 +56,9 @@ interface FileItem { ...@@ -55,8 +56,9 @@ interface FileItem {
} }
const props = defineProps<{ const props = defineProps<{
modelValue: string modelValue: string
importType: string
}>() }>()
const emit = defineEmits(['update:modelValue']) const emit = defineEmits(['update:modelValue', 'imported'])
const fileList = ref<FileItem[]>([]) const fileList = ref<FileItem[]>([])
const fileInputRef = ref<HTMLInputElement | null>(null) const fileInputRef = ref<HTMLInputElement | null>(null)
...@@ -118,8 +120,27 @@ const onFileChange = async (e: Event) => { ...@@ -118,8 +120,27 @@ const onFileChange = async (e: Event) => {
ElMessage.error('文件大小不能超过50MB') ElMessage.error('文件大小不能超过50MB')
return return
} }
if (props.importType === 'local') {
// 本地解析
const reader = new FileReader()
reader.onload = (evt) => {
const data = evt.target?.result
const workbook = XLSX.read(data, { type: 'binary' })
const firstSheetName = workbook.SheetNames[0]
const worksheet = workbook.Sheets[firstSheetName]
const jsonData = XLSX.utils.sheet_to_json(worksheet)
//emit 路径和数据
emit('imported', { path: file.name, data: jsonData })
fileList.value = [{ path: file.name, filename: file.name }]
value.value = file.name || ''
ElMessage.success('导入成功')
}
reader.readAsBinaryString(file)
if (fileInputRef.value) fileInputRef.value.value = ''
return
}
// 走原有上传逻辑
await fileUpload(file) await fileUpload(file)
// 清空input
if (fileInputRef.value) fileInputRef.value.value = '' if (fileInputRef.value) fileInputRef.value.value = ''
} }
...@@ -132,7 +153,7 @@ const fileUpload = async (file: File) => { ...@@ -132,7 +153,7 @@ const fileUpload = async (file: File) => {
try { try {
const res = await uploadFileApi(formData) const res = await uploadFileApi(formData)
fileList.value = [{ path: res.message ?? '', filename }] fileList.value = [{ path: res.message ?? '', filename }]
value.value = res.message value.value = res.message ?? ''
ElMessage.success('导入成功') ElMessage.success('导入成功')
} catch (e) { } catch (e) {
ElMessage.error('上传失败') ElMessage.error('上传失败')
......
export interface warehouseSearchForm { export interface warehouseSearchForm {
status?: string billStatus?: string
batchNumber?: string batchNumber?: string
createTimeEnd?: string createTimeEnd?: string
createTimeStart?: string createTimeStart?: string
orderNumber?: string orderNumber?: string
sku?: string sku?: string
warehouseId?: number warehouseId?: number
id?: number
} }
export interface InterProductList { export interface InterProductList {
createTime?: string createTime?: string
...@@ -22,12 +23,13 @@ export interface InterProductList { ...@@ -22,12 +23,13 @@ export interface InterProductList {
warehouseSku?: string warehouseSku?: string
locationId?: number | null locationId?: number | null
locationCode?: string | null locationCode?: string | null
[propName: string]: string | number | boolean | undefined | unknown
} }
export interface InterWarehouseBase { export interface InterWarehouseBase {
id: number id?: number
factoryId?: number factoryId?: number
factoryCode?: string factoryCode?: string
warehouseId?: number warehouseId?: number | string
warehouseName?: string warehouseName?: string
inNo?: string inNo?: string
shipmentNumber?: string shipmentNumber?: string
...@@ -39,6 +41,7 @@ export interface InterWarehouseBase { ...@@ -39,6 +41,7 @@ export interface InterWarehouseBase {
dataVersion?: number dataVersion?: number
createTime?: string | null createTime?: string | null
updateTime?: string | null updateTime?: string | null
rejectReason?: string | null
} }
// 主表列表ts // 主表列表ts
export interface InterWarehousePage extends InterWarehouseBase {} export interface InterWarehousePage extends InterWarehouseBase {}
...@@ -47,12 +50,12 @@ export interface InterWarehouseDetail extends InterWarehouseBase { ...@@ -47,12 +50,12 @@ export interface InterWarehouseDetail extends InterWarehouseBase {
productList: InterProductList[] productList: InterProductList[]
} }
export interface InterWarehouseTree { export interface InterWarehouseTree {
id: number id?: number
code: string code?: string | null
name: string name?: string
countQuantity: string | null countQuantity?: string | null
children: null children: InterWarehouseTree[] | null
leaf: boolean leaf?: boolean
} }
export interface InterProductList { export interface InterProductList {
createTime?: string createTime?: string
...@@ -98,18 +101,3 @@ export interface ILocation { ...@@ -98,18 +101,3 @@ export interface ILocation {
locationId?: number | null locationId?: number | null
locationCode?: string | null locationCode?: string | null
} }
export interface InRecordEditForm {
id: number
factoryId?: number
factoryCode?: string
warehouseId?: number
warehouseName?: string
inNo?: string
shipmentNumber?: string
skuAmount?: string
total?: number
totalPrice?: number
billStatus?: string
remark?: string
productList?: InterProductList[]
}
...@@ -87,7 +87,14 @@ ...@@ -87,7 +87,14 @@
style="width: 160px" style="width: 160px"
/> />
</ElFormItem> </ElFormItem>
<ElFormItem style="margin-right: 10px" label="ID">
<ElInput
v-model="searchForm.id"
clearable
placeholder="请输入ID"
style="width: 160px"
/>
</ElFormItem>
<ElFormItem> <ElFormItem>
<ElButton type="primary" @click="search">查询</ElButton> <ElButton type="primary" @click="search">查询</ElButton>
</ElFormItem> </ElFormItem>
...@@ -97,22 +104,57 @@ ...@@ -97,22 +104,57 @@
</ElForm> </ElForm>
</div> </div>
<div class="btn-list"> <div class="btn-list">
<el-button type="primary" @click="addDialog(1)"> 新增 </el-button> <el-button
<el-button type="danger" @click="rejectOrder"> 驳回 </el-button> v-if="nodeCode === 'PENDING_SUBMIT'"
<el-button type="danger" @click="handleBatchDelete"> type="primary"
@click="addDialog(1, null)"
>
新增
</el-button>
<el-button
v-if="nodeCode === 'PENDING_AUDIT'"
type="danger"
@click="rejectedInRecord"
>
驳回
</el-button>
<el-button
v-if="nodeCode === 'PENDING_SUBMIT'"
type="danger"
@click="handleBatchDelete"
>
删除 删除
</el-button> </el-button>
<el-button type="warning" @click="importExcel"> 导入 </el-button> <el-button type="success" @click="handleExport"> 导出 </el-button>
<el-button type="success" @click="exportExcel"> 导出 </el-button> <el-button type="primary" @click="getPrintData">
<el-button type="primary" @click="exportExcel">
打印SKU标签 打印SKU标签
</el-button> </el-button>
<el-button type="warning" @click="exportExcel"> 审核 </el-button> <el-button
<el-button type="success" @click="exportExcel"> v-if="nodeCode === 'PENDING_AUDIT'"
type="warning"
@click="auditOrder('audit')"
>
审核
</el-button>
<el-button
v-if="nodeCode === 'PENDING_SUBMIT'"
type="success"
@click="auditOrder('submitAudit')"
>
提交审核 提交审核
</el-button> </el-button>
<el-button type="danger" @click="rejectOrder"> 作废 </el-button> <el-button
<el-button type="success" @click="auditOrder('archive')"> v-if="nodeCode === 'PENDING_AUDIT'"
type="danger"
@click="auditOrder('invalid')"
>
作废
</el-button>
<el-button
v-if="nodeCode === 'COMPLETED'"
type="success"
@click="auditOrder('archiving')"
>
归档 归档
</el-button> </el-button>
</div> </div>
...@@ -149,15 +191,14 @@ ...@@ -149,15 +191,14 @@
label="入库单号" label="入库单号"
show-overflow-tooltip show-overflow-tooltip
prop="inNo" prop="inNo"
width="110" width="130"
header-align="center" header-align="center"
align="center" align="center"
></ElTableColumn> ></ElTableColumn>
<ElTableColumn <ElTableColumn
label="单据状态" label="单据状态"
show-overflow-tooltip width="130"
prop="billStatus" prop="billStatus"
width="80"
header-align="center" header-align="center"
align="center" align="center"
></ElTableColumn> ></ElTableColumn>
...@@ -165,7 +206,7 @@ ...@@ -165,7 +206,7 @@
label="仓库名称" label="仓库名称"
show-overflow-tooltip show-overflow-tooltip
prop="warehouseName" prop="warehouseName"
min-width="100" width="130"
header-align="center" header-align="center"
align="center" align="center"
></ElTableColumn> ></ElTableColumn>
...@@ -173,7 +214,7 @@ ...@@ -173,7 +214,7 @@
label="工厂编号" label="工厂编号"
show-overflow-tooltip show-overflow-tooltip
prop="factoryCode" prop="factoryCode"
min-width="100" width="90"
header-align="center" header-align="center"
align="center" align="center"
></ElTableColumn> ></ElTableColumn>
...@@ -197,7 +238,7 @@ ...@@ -197,7 +238,7 @@
label="SKU数量" label="SKU数量"
header-align="center" header-align="center"
prop="skuAmount" prop="skuAmount"
width="130" width="90"
align="center" align="center"
show-overflow-tooltip show-overflow-tooltip
> >
...@@ -206,15 +247,21 @@ ...@@ -206,15 +247,21 @@
label="总数量" label="总数量"
header-align="center" header-align="center"
prop="total" prop="total"
width="120" width="90"
align="center" align="center"
show-overflow-tooltip show-overflow-tooltip
> >
</ElTableColumn> </ElTableColumn>
<ElTableColumn <ElTableColumn
label="驳回原因"
show-overflow-tooltip
prop="rejectReason"
header-align="center"
align="center"
></ElTableColumn>
<ElTableColumn
label="备注" label="备注"
show-overflow-tooltip show-overflow-tooltip
width="240"
prop="remark" prop="remark"
header-align="center" header-align="center"
align="center" align="center"
...@@ -261,14 +308,15 @@ ...@@ -261,14 +308,15 @@
<ElTableColumn <ElTableColumn
show-overflow-tooltip show-overflow-tooltip
align="center" align="center"
width="100"
label="SKU图片" label="SKU图片"
prop="factory_order_number" prop="factory_order_number"
> >
<template #default="{ row }"> <template #default="{ row }">
<ImageView <ImageView
:src="row.skuImage" :src="row.skuImage"
width="80px" width="40px"
height="80px" height="40px"
/> />
</template> </template>
</ElTableColumn> </ElTableColumn>
...@@ -295,12 +343,18 @@ ...@@ -295,12 +343,18 @@
<ElTableColumn <ElTableColumn
show-overflow-tooltip show-overflow-tooltip
align="center" align="center"
label="总成本(¥)" label="成本价(¥)"
prop="buyStored" prop="costPrice"
/> />
<ElTableColumn <ElTableColumn
show-overflow-tooltip show-overflow-tooltip
align="center" align="center"
label="总成本(¥)"
prop="totalPrice"
/>
<!-- <ElTableColumn
show-overflow-tooltip
align="center"
label="不良品数量" label="不良品数量"
prop="rejectsAmount" prop="rejectsAmount"
/> />
...@@ -309,7 +363,7 @@ ...@@ -309,7 +363,7 @@
align="center" align="center"
label="不良品原因" label="不良品原因"
prop="rejectsAeason" prop="rejectsAeason"
/> /> -->
<ElTableColumn <ElTableColumn
show-overflow-tooltip show-overflow-tooltip
align="center" align="center"
...@@ -332,7 +386,7 @@ ...@@ -332,7 +386,7 @@
</ElTable> </ElTable>
</div> </div>
<ElPagination <!-- <ElPagination
v-model:current-page="detailPager.page" v-model:current-page="detailPager.page"
v-model:page-size="detailPager.rows" v-model:page-size="detailPager.rows"
:page-sizes="[100, 200, 300, 400, 500]" :page-sizes="[100, 200, 300, 400, 500]"
...@@ -342,9 +396,9 @@ ...@@ -342,9 +396,9 @@
style="margin: 10px auto 0; text-align: right" style="margin: 10px auto 0; text-align: right"
@size-change="handleSizeChange" @size-change="handleSizeChange"
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
></ElPagination> ></ElPagination> -->
</el-tab-pane> </el-tab-pane>
<!-- <el-tab-pane name="1" label="操作日志"> <el-tab-pane name="1" label="操作日志">
<ul <ul
style=" style="
color: #333; color: #333;
...@@ -359,7 +413,7 @@ ...@@ -359,7 +413,7 @@
style="display: flex" style="display: flex"
> >
<span style="display: inline-block"> <span style="display: inline-block">
{{ item.createdTime }} {{ item.createdTime }}&emsp;&emsp;
</span> </span>
<span style="display: inline-block">{{ <span style="display: inline-block">{{
item.description item.description
...@@ -367,24 +421,6 @@ ...@@ -367,24 +421,6 @@
</li> </li>
</ul> </ul>
</el-tab-pane> </el-tab-pane>
<el-tab-pane name="2" label="物流轨迹">
<ul
v-if="logisticsData.length > 0"
style="
color: #333;
font-size: 12px;
height: 100%;
overflow: auto;
"
>
<li v-for="(item, index) in logisticsData" :key="index">
<span class="log-desc">
{{ item.time + ' ' + item.context }}
</span>
</li>
</ul>
<div v-else class="empty">{{ $t('暂无数据') }}</div>
</el-tab-pane> -->
</el-tabs> </el-tabs>
</template> </template>
</splitDiv> </splitDiv>
...@@ -398,22 +434,26 @@ ...@@ -398,22 +434,26 @@
:close-on-click-modal="false" :close-on-click-modal="false"
> >
<div class="import-dialog"> <div class="import-dialog">
<div class="import-header"> <!-- <div class="import-header">
<el-button type="primary" link @click="downloadTemplate"> <el-button type="primary" link @click="downloadTemplate">
<el-icon><Download /></el-icon> <el-icon><Download /></el-icon>
下载模板 下载模板
</el-button> </el-button>
</div> </div> -->
<div class="import-content"> <div class="import-content">
<UploadExcel v-model="importedFileUrl" /> <UploadExcel
v-model="importedFileUrl"
:import-type="'local'"
@imported="handleLocalImport"
/>
</div> </div>
</div> </div>
<template #footer> <!-- <template #footer>
<span class="dialog-footer"> <span class="dialog-footer">
<el-button @click="importDialogVisible = false">取消</el-button> <el-button @click="importDialogVisible = false">取消</el-button>
<el-button type="primary" @click="submitConfirmOrder">确认</el-button> <el-button type="primary" @click="packedData">确认</el-button>
</span> </span>
</template> </template> -->
</ElDialog> </ElDialog>
<ElDialog <ElDialog
v-model="newDialogVisible" v-model="newDialogVisible"
...@@ -432,6 +472,9 @@ ...@@ -432,6 +472,9 @@
<ElFormItem label="入库单号" prop="account"> <ElFormItem label="入库单号" prop="account">
<ElInput v-model="editForm.inNo" clearable disabled /> <ElInput v-model="editForm.inNo" clearable disabled />
</ElFormItem> </ElFormItem>
<ElFormItem label="工厂:" prop="factoryCode">
<span>{{ editForm.factoryCode }}</span>
</ElFormItem>
<ElFormItem label="仓库" prop="warehouseId" required> <ElFormItem label="仓库" prop="warehouseId" required>
<ElSelect <ElSelect
v-model="editForm.warehouseId" v-model="editForm.warehouseId"
...@@ -447,9 +490,6 @@ ...@@ -447,9 +490,6 @@
></ElOption> ></ElOption>
</ElSelect> </ElSelect>
</ElFormItem> </ElFormItem>
<ElFormItem label="工厂:" prop="factoryCode">
<span>{{ editForm.factoryCode }}</span>
</ElFormItem>
<ElFormItem label="备注" prop="remark" style="width: 45%"> <ElFormItem label="备注" prop="remark" style="width: 45%">
<ElInput <ElInput
v-model="editForm.remark" v-model="editForm.remark"
...@@ -520,21 +560,13 @@ ...@@ -520,21 +560,13 @@
label="总成本(¥)" label="总成本(¥)"
prop="totalPrice" prop="totalPrice"
/> />
<ElTableColumn
show-overflow-tooltip
align="center"
label="不良品数量"
prop="rejectsAmount"
/>
<ElTableColumn
show-overflow-tooltip
align="center"
label="不良品原因"
prop="rejectsAeason"
/>
<ElTableColumn align="center" label="库位" prop="loacationCode"> <ElTableColumn align="center" label="库位" prop="loacationCode">
<template #default="{ row }"> <template #default="{ row }">
<!-- +后有就正常展示,没有则通过搜索接口自己添加 --> <!-- +后有就正常展示,没有则通过搜索接口自己添加 -->
<!-- remote
:remote-method="(query) => handleLocationSearch(query, row)"
:loading="locationLoading"
@change="(val) => handleLocationChange(val, row)" -->
<span v-if="row.loacationCode">{{ row.loacationCode }}</span> <span v-if="row.loacationCode">{{ row.loacationCode }}</span>
<ElSelect <ElSelect
v-else v-else
...@@ -543,10 +575,6 @@ ...@@ -543,10 +575,6 @@
placeholder="请输入库位" placeholder="请输入库位"
style="width: 120px" style="width: 120px"
filterable filterable
remote
:remote-method="(query) => handleLocationSearch(query, row)"
:loading="locationLoading"
@change="(val) => handleLocationChange(val, row)"
> >
<ElOption <ElOption
v-for="item in locationList" v-for="item in locationList"
...@@ -633,7 +661,7 @@ ...@@ -633,7 +661,7 @@
label="操作" label="操作"
> >
<template #default="{ row }"> <template #default="{ row }">
<el-icon :size="32" color="#67C23A" <el-icon :size="32" color="#67C23A" class="cursor-pointer"
><CirclePlusFilled @click="skudblclick(row)" ><CirclePlusFilled @click="skudblclick(row)"
/></el-icon> /></el-icon>
</template> </template>
...@@ -691,51 +719,71 @@ ...@@ -691,51 +719,71 @@
</div> </div>
</template> </template>
</ElDialog> </ElDialog>
<ElDialog
v-model="exportVisible"
title="导出选项"
width="500px"
:close-on-click-modal="false"
>
<el-form :model="exportForm" label-width="80px">
<el-form-item label="" prop="resource">
<el-radio-group v-model="exportForm.resource">
<el-radio :label="0">导出本页</el-radio>
<el-radio :label="1">导出选中</el-radio>
<el-radio :label="2">全部</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="">
<el-checkbox v-model="exportForm.delivery"> 包含详情 </el-checkbox>
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="exportVisible = false">取消</el-button>
<el-button type="primary" @click="submitExportForm">确认</el-button>
</span>
</template>
</ElDialog>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ElMessage, ElRadioGroup, ElTree, TableColumnCtx } from 'element-plus' import { ElMessage, ElRadioGroup, ElTree } from 'element-plus'
import { Download, CirclePlusFilled } from '@element-plus/icons-vue' import { CirclePlusFilled } from '@element-plus/icons-vue'
import splitDiv from '@/components/splitDiv/splitDiv.vue' import splitDiv from '@/components/splitDiv/splitDiv.vue'
import { ElTable } from 'element-plus' import { ElTable } from 'element-plus'
import usePageList from '@/utils/hooks/usePageList' import usePageList from '@/utils/hooks/usePageList'
import { useValue } from '@/utils/hooks/useValue' import { useValue } from '@/utils/hooks/useValue'
import { import {
auditOrderApi, getInRecordStatusTree,
rejectOrderApi, warehouseInRecordListPageApi,
getLogListApi,
exportExcelApi,
} from '@/api/order'
import {
getOutRecordStatusTree,
warehouseOutRecordListPage,
getWarehouseInRecordDetailApi, getWarehouseInRecordDetailApi,
getBySkuApi, getBySkuApi,
getWarehouseListApi, getWarehouseListApi,
getByWareHouseIdAndCodeApi, getByWareHouseIdAndCodeApi,
addInRecordApi, addInRecordApi,
updateInRecordApi, updateInRecordApi,
deleteWarehouseOutRecordApi, deleteWarehouseInRecordApi,
auditOrderApi,
getInRecordLogApi,
rejectInRecordApi,
LogListData,
} from '@/api/warehouse' } from '@/api/warehouse'
import BigNumber from 'bignumber.js' import BigNumber from 'bignumber.js'
import { ref, onMounted, watch, nextTick } from 'vue' import { ref, onMounted, watch, nextTick } from 'vue'
import 'element-plus/dist/index.css' import 'element-plus/dist/index.css'
import { LogList } from '@/types/api/billOrder.ts'
import { import {
warehouseSearchForm, warehouseSearchForm,
InterWarehousePage, InterWarehousePage,
InterWarehouseDetail,
InterWarehouseTree, InterWarehouseTree,
InterProductList, InterProductList,
InterskuList, InterskuList,
InterWarehouseList, InterWarehouseList,
ILocation, ILocation,
InterWarehouseDetail,
} from '@/types/api/warehouse' } from '@/types/api/warehouse'
import ImageView from '@/components/ImageView.vue' import ImageView from '@/components/ImageView.vue'
import { showConfirm } from '@/utils/ui'
import UploadExcel from '@/components/UploadExcel.vue' import UploadExcel from '@/components/UploadExcel.vue'
import { debounce } from 'lodash-es' // import { debounce } from 'lodash-es'
// import UploadExcel from '@/components/INgoVopy.vue'
const warehouseList = ref<InterWarehouseList[]>([]) const warehouseList = ref<InterWarehouseList[]>([])
const pickerOptions = { const pickerOptions = {
shortcuts: [ shortcuts: [
...@@ -860,15 +908,17 @@ const [searchForm, resetSearchForm] = useValue<warehouseSearchForm>({}) ...@@ -860,15 +908,17 @@ const [searchForm, resetSearchForm] = useValue<warehouseSearchForm>({})
const tradingTime = ref<string[]>([]) const tradingTime = ref<string[]>([])
const selections = ref<InterWarehousePage[]>([]) const selections = ref<InterWarehousePage[]>([])
const detailList = ref<InterWarehouseDetail[]>([]) const detailList = ref<InterProductList[]>([])
const tabsValue = ref<string>('0') const tabsValue = ref<string>('0')
const singleTableRef = ref<InstanceType<typeof ElTable>>() const singleTableRef = ref<InstanceType<typeof ElTable>>()
const currentRow = ref<InterWarehousePage | null>(null) const currentRow = ref<InterWarehousePage | null>(null)
const logList = ref<LogList[]>([]) const logList = ref<LogListData[]>([])
const rules = { const rules = {
warehouseId: [{ required: true, message: '请选择仓库', trigger: 'change' }], warehouseId: [{ required: true, message: '请选择仓库', trigger: 'change' }],
} }
const nodeId = ref<number | string>(10) const nodeCode = ref<string>(
sessionStorage.getItem('InRecord_NodeCode') || 'all',
)
const treeRef = ref<InstanceType<typeof ElTree>>() const treeRef = ref<InstanceType<typeof ElTree>>()
const { const {
...@@ -881,10 +931,10 @@ const { ...@@ -881,10 +931,10 @@ const {
onPageSizeChange: handleSizeChange, onPageSizeChange: handleSizeChange,
} = usePageList({ } = usePageList({
query: (page, pageSize) => query: (page, pageSize) =>
warehouseOutRecordListPage( warehouseInRecordListPageApi(
{ {
...searchForm.value, ...searchForm.value,
billStatus: nodeId.value === -1 ? null : nodeId.value, billStatus: nodeCode.value == 'all' ? 'all' : nodeCode.value,
createTimeStart: tradingTime.value && tradingTime.value[0], createTimeStart: tradingTime.value && tradingTime.value[0],
createTimeEnd: tradingTime.value && tradingTime.value[1], createTimeEnd: tradingTime.value && tradingTime.value[1],
}, },
...@@ -897,29 +947,175 @@ const setCostPrice = (item: InterProductList) => { ...@@ -897,29 +947,175 @@ const setCostPrice = (item: InterProductList) => {
ElMessage.warning('商品成本价为空,请完善商品成本价') ElMessage.warning('商品成本价为空,请完善商品成本价')
return return
} }
const amount = new BigNumber(item.buyStored) if (item) {
.multipliedBy(item.costPrice) const buyStored = item.buyStored ?? 0
.toFixed(2) const costPrice = item.costPrice ?? 0
item.totalPrice = Number(amount) const amount = new BigNumber(buyStored).multipliedBy(costPrice).toFixed(2)
item.totalPrice = Number(amount)
}
} }
const getTreeNum = async () => { const getTreeNum = async () => {
try { try {
const res = await getOutRecordStatusTree() const res = await getInRecordStatusTree()
res.data = [{ code: -1, name: '全部', children: res.data }] res.data = [{ code: 'all', name: '全部', children: res.data }]
treeData.value = res.data treeData.value = res.data
await nextTick(() => { await nextTick(() => {
treeRef.value!.setCurrentKey(nodeId.value, true) treeRef.value!.setCurrentKey(nodeCode.value, true)
}) })
} catch (e) { } catch (e) {
console.error(e) console.error(e)
} }
} }
const getPrintData = () => {
if (selections.value.length === 0) {
return ElMessage.warning('请选择要操作的数据')
}
}
const excelFieldMap: Record<string, keyof InterProductList> = {
SKU图片: 'skuImage',
商品SKU: 'warehouseSku',
SKU名称: 'skuName',
入库数量: 'buyStored',
'成本价(¥)': 'costPrice',
'总成本(¥)': 'totalPrice',
库位: 'locationCode',
备注: 'remark',
}
const handleLocalImport = ({
path,
data,
}: {
path: string
data: InterProductList[]
}) => {
const result: InterProductList[] = data.map((item) => {
const obj = {} as InterProductList
Object.keys(excelFieldMap).forEach((excelKey) => {
const field = excelFieldMap[excelKey] as keyof InterProductList
const value = item[excelKey]
// // 类型转换和默认值
// if (['buyStored', 'costPrice', 'totalPrice'].includes(field)) {
// value = value == null || value === '' ? 0 : Number(value)
// } else {
// value = value == null ? '' : value
// }
obj[field] = value as InterProductList[typeof field]
})
return obj
})
otherPurchaseData.value = result
importedFileUrl.value = path
importDialogVisible.value = false
}
const exportVisible = ref(false)
const exportForm = ref({
delivery: false,
resource: '',
})
const handleExport = () => {
exportVisible.value = true
// exportForm.value.delivery = false
// exportForm.value.resource = ''
}
const submitExportForm = () => {
// if (exportForm.value.resource === '') {
// return ElMessage.error('请选择导出类型')
// }
// let purchaseIds = [],
// otherIds = [],
// total = 0,
// params = {}
// if (exportForm.value.resource === 0) {
// purchaseIds = userData.value
// .filter((el) => el.dataType === 0)
// .map((el) => el.id)
// .join(',')
// otherIds = userData.value
// .filter((el) => el.dataType === 1)
// .map((el) => el.id)
// .join(',')
// } else if (exportForm.value.resource === 1) {
// purchaseIds = selections.value
// .filter((el) => el.dataType === 0)
// .map((el) => el.id)
// .join(',')
// otherIds = selections.value
// .filter((el) => el.dataType === 1)
// .map((el) => el.id)
// .join(',')
// } else {
// purchaseIds = ''
// otherIds = ''
// // total = this.paginationOptions.total
// }
// params = {
// purchaseIds,
// otherIds,
// total,
// }
// if (exportForm.value.resource !== 2) {
// delete params.total
// } else {
// // params.billStatus = this.billStatus
// // params.type = this.treeType || ''
// // params.otherStatus = this.otherStatus
// if (
// this.treeLabel.indexOf(this.$t('待入库')) !== -1 ||
// this.treeLabel.indexOf(this.$t('已入库')) !== -1
// ) {
// params.purchaseAll = true
// params.otherAll = true
// }
// if (
// this.treeLabel.indexOf(this.$t('采购')) !== -1 ||
// this.treeLabel.indexOf(this.$t('生产')) !== -1
// ) {
// params.purchaseAll = true
// }
// if (this.treeLabel.indexOf(this.$t('其他')) !== -1) {
// params.otherAll = true
// }
// if (this.treeLabel.indexOf(this.$t('归档')) !== -1) {
// params.purchaseAll = true
// }
// if (this.treeLabel.indexOf(this.$t('作废')) !== -1) {
// params.purchaseAll = true
// params.otherAll = true
// }
// }
// const loading = this.$loading({
// background: 'rgba(0, 0, 0, 0.3)',
// })
// Axios.post(
// window.apiHostSetting.VUE_APP_API_URL +
// 'api/purchaseStoreBill/exportPurchaseExcel',
// {
// includeSku: exportForm.value.delivery,
// ...params,
// ...this.searchForm,
// },
// {
// headers: {
// 'jwt-token': localStorage.getItem('token'),
// },
// },
// )
// .then((res) => {
// console.log(filePath)
// window.open(filePath + res.data.message)
// exportVisible.value = false
// })
// .finally(() => {
// loading.close()
// })
}
const getWarehouseList = async () => { const getWarehouseList = async () => {
try { try {
const res = await getWarehouseListApi() const res = await getWarehouseListApi()
warehouseList.value = res.data warehouseList.value = res.data
await nextTick(() => { await nextTick(() => {
treeRef.value!.setCurrentKey(nodeId.value, true) treeRef.value!.setCurrentKey(nodeCode.value, true)
}) })
} catch (e) { } catch (e) {
console.error(e) console.error(e)
...@@ -938,7 +1134,6 @@ const selectbySku = async () => { ...@@ -938,7 +1134,6 @@ const selectbySku = async () => {
try { try {
const res = await getBySkuApi(editForm.value.warehouseId, selectSku.value) const res = await getBySkuApi(editForm.value.warehouseId, selectSku.value)
skuData.value = res.data || [] skuData.value = res.data || []
fetchLocationList('') //获取该仓库下的所有库位
} catch (e) { } catch (e) {
console.error(e) console.error(e)
} }
...@@ -952,7 +1147,7 @@ const skudblclick = (val: InterskuList) => { ...@@ -952,7 +1147,7 @@ const skudblclick = (val: InterskuList) => {
sku = '', sku = '',
skuName = '', skuName = '',
image = '', image = '',
locationId = '', locationId = 0,
} = val || {} } = val || {}
otherPurchaseData.value = [ otherPurchaseData.value = [
...otherPurchaseData.value, ...otherPurchaseData.value,
...@@ -962,8 +1157,8 @@ const skudblclick = (val: InterskuList) => { ...@@ -962,8 +1157,8 @@ const skudblclick = (val: InterskuList) => {
skuName, skuName,
productNo, productNo,
locationCode: locationCode ?? '', // 确保空值处理 locationCode: locationCode ?? '', // 确保空值处理
locationId: locationId ?? '', // 确保空值处理 locationId: locationId ?? 0, // 确保空值处理
costPrice: factoryPrice, ////添加时成本价字段是啥?要提交吗? costPrice: factoryPrice,
buyStored: null, buyStored: null,
totalPrice: null, totalPrice: null,
}, },
...@@ -987,30 +1182,26 @@ const tabsClick = async () => { ...@@ -987,30 +1182,26 @@ const tabsClick = async () => {
searchDetail() searchDetail()
} else if (tabsValue.value === '1') { } else if (tabsValue.value === '1') {
getLogList() getLogList()
} else {
getLogisticsData()
} }
} }
const [editForm, resetEditForm] = useValue({ const [editForm, resetEditForm] = useValue<InterWarehouseDetail>({
inNo: '', inNo: '',
warehouseId: '', warehouseId: '',
remark: '', remark: '',
factoryCode: '', factoryCode: '',
factoryId: '', factoryId: 0,
productList: [],
}) })
const newDialogVisible = ref(false) const newDialogVisible = ref(false)
const editFormRef = ref() const editFormRef = ref()
const editForm2 = ref({}) const editForm2 = ref({})
const formId = ref<number | undefined>(undefined) const formId = ref<number | undefined>(undefined)
const otherPurchaseData = ref<InterProductList[]>([]) const otherPurchaseData = ref<InterProductList[]>([])
const addDialog = async (i: number, v: InterWarehousePage) => { const addDialog = async (i: number, v: InterWarehousePage | null) => {
if (i === 2) { if (i === 2) {
if (v) formId.value = v.id if (v) formId.value = v.id
// getProduct(v.id) if (v) getProduct(v.id)
if (!formId.value) return ElMessage('请勾选至少一条记录') if (!formId.value) return ElMessage('请勾选至少一条记录')
// v.inWarehouseId = v.warehouseId
// v.inType = v.type
// v.handleUserId = v.makerUserId
editForm.value = JSON.parse(JSON.stringify(v)) editForm.value = JSON.parse(JSON.stringify(v))
} else { } else {
await nextTick() await nextTick()
...@@ -1031,19 +1222,14 @@ const addDialog = async (i: number, v: InterWarehousePage) => { ...@@ -1031,19 +1222,14 @@ const addDialog = async (i: number, v: InterWarehousePage) => {
} }
newDialogVisible.value = true newDialogVisible.value = true
} }
// const getProduct = (id: number) => { const getProduct = async (id: number | undefined) => {
// let url = `otherInWarehouseProductDetails/getProductList?otherOutWarehouseId=${id}` try {
// get(url).then((res) => { const res = await getWarehouseInRecordDetailApi(id)
// if (res.code == 200) { otherPurchaseData.value = res.data?.productList || []
// otherPurchaseData.value = res.data; } catch (e) {
// productData.value = res.data; console.error(e)
// } else { }
// this.$alert(res.message, this.$t('错误提示'), { }
// dangerouslyUseHTMLString: true,
// })
// }
// })
// }
const handleSelectionChange = (v: InterWarehousePage[]) => { const handleSelectionChange = (v: InterWarehousePage[]) => {
selections.value = v selections.value = v
} }
...@@ -1052,34 +1238,50 @@ const productSelectionChange = (v: InterProductList[]) => { ...@@ -1052,34 +1238,50 @@ const productSelectionChange = (v: InterProductList[]) => {
otherWarehouseSelection.value = v otherWarehouseSelection.value = v
} }
const auditOrder = (key: string) => { const auditOrder = (key: string) => {
if (selections.value.length === 0) {
return ElMessage.warning('请选择要操作的数据')
}
let url = '' let url = ''
let text = '' let text = ''
switch (key) { switch (key) {
case 'pay': case 'invalid':
url = 'reconciliation/payment' url = 'factory/warehouseInRecord/invalid'
text = '确认付款' text = '作废'
break break
case 'archive': case 'archiving':
url = 'reconciliation/archiving' url = 'factory/warehouseInRecord/archive'
text = '确认归档' text = '归档'
break
case 'submitAudit':
url = 'factory/warehouseInRecord/submitAudit'
text = '提交审核'
break
case 'audit':
url = 'factory/warehouseInRecord/audit'
text = '审核'
break break
} }
const confimText =
if (selections.value.length === 0) { key === 'audit'
return ElMessage.warning('请选择要操作的数据') ? '确定进行审核?点“确定”将会直接更改库存数量,请在审核前确认数量是否正确。'
} : `确定对选中的信息进行${text}?`
ElMessageBox.confirm(`${text}对账单?`, '重要提示', { ElMessageBox.confirm(confimText, '重要提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
type: 'warning', type: 'warning',
}).then(async () => { }).then(async () => {
const ids = selections.value.map((el) => el.id).join(',') const data = selections.value.map(
await auditOrderApi(url, ids) ({ id, dataVersion }: InterWarehousePage) => ({
id,
dataVersion,
}),
)
await auditOrderApi(url, data)
ElMessage.success('操作成功') ElMessage.success('操作成功')
search() search()
await getTreeNum() await getTreeNum()
}) })
} }
const rejectOrder = () => { const rejectedInRecord = () => {
if (selections.value.length === 0) { if (selections.value.length === 0) {
return ElMessage.warning('请选择要操作的数据') return ElMessage.warning('请选择要操作的数据')
} }
...@@ -1091,10 +1293,12 @@ const rejectOrder = () => { ...@@ -1091,10 +1293,12 @@ const rejectOrder = () => {
customClass: 'reject', customClass: 'reject',
inputErrorMessage: '请输入驳回原因', inputErrorMessage: '请输入驳回原因',
inputPlaceholder: '驳回原因', inputPlaceholder: '驳回原因',
}).then(async ({ value }) => { }).then(async ({ value }: { value: string }) => {
const ids = selections.value.map((el) => el.id).join(',') const ids = selections.value
.map((el: InterWarehousePage) => el.id)
.join(',')
try { try {
await rejectOrderApi({ ids: ids, description: value, pass: 0 }) await rejectInRecordApi({ ids: ids, rejectReason: value })
ElMessage.success('操作成功') ElMessage.success('操作成功')
search() search()
await getTreeNum() await getTreeNum()
...@@ -1117,6 +1321,15 @@ watch( ...@@ -1117,6 +1321,15 @@ watch(
}, },
{ immediate: true }, { immediate: true },
) )
watch(
() => editForm.value.warehouseId,
(newVal: number | string | undefined) => {
if (newVal) {
fetchLocationList('')
}
},
)
const addOtherCurrency = async () => { const addOtherCurrency = async () => {
try { try {
await editFormRef.value?.validate() await editFormRef.value?.validate()
...@@ -1232,8 +1445,11 @@ const deleteOtherWarehousing = () => { ...@@ -1232,8 +1445,11 @@ const deleteOtherWarehousing = () => {
(item: InterProductList) => !idList.includes(item.warehouseSku), (item: InterProductList) => !idList.includes(item.warehouseSku),
) )
} }
const importDialogVisible = ref(false)
const importedFileUrl = ref('')
const importData = async () => { const importData = async () => {
if (!editForm.value.warehouseId) return ElMessage.error('请选择仓库') // if (!editForm.value.warehouseId) return ElMessage.error('请选择仓库')
importDialogVisible.value = true
} }
const handleBatchDelete = async () => { const handleBatchDelete = async () => {
if (!selections.value.length) { if (!selections.value.length) {
...@@ -1245,69 +1461,36 @@ const handleBatchDelete = async () => { ...@@ -1245,69 +1461,36 @@ const handleBatchDelete = async () => {
type: 'warning', type: 'warning',
}) })
const str = selections.value.map((el: InterWarehousePage) => el.id).join(',') const str = selections.value.map((el: InterWarehousePage) => el.id).join(',')
await deleteWarehouseOutRecordApi(str) await deleteWarehouseInRecordApi(str)
ElMessage.success('删除成功') ElMessage.success('删除成功')
await search() await search()
} }
const nodeClick = (data: InterWarehouseTree) => { const nodeClick = (data: InterWarehouseTree) => {
nodeId.value = data.code ?? '' nodeCode.value = data.code ?? ''
sessionStorage.setItem('InRecord_NodeCode', data.code ?? '')
search() search()
} }
const detailPager = ref({ // const detailPager = ref({
page: 1, // page: 1,
rows: 100, // rows: 100,
total: 0, // total: 0,
}) // })
const searchDetail = async () => { const searchDetail = async () => {
try { try {
const res = await getWarehouseInRecordDetailApi(currentRow.value?.id) const res = await getWarehouseInRecordDetailApi(currentRow.value?.id)
detailList.value = res.data.records || [] detailList.value = res.data?.productList || []
detailPager.value.total = res.data.total
} catch (e) { } catch (e) {
console.error(e) console.error(e)
} }
} }
const getLogList = async () => { const getLogList = async () => {
try { try {
const res = await getLogListApi(currentRow.value?.id) const res = await getInRecordLogApi(currentRow.value?.id)
logList.value = res.data logList.value = res.data
} catch (e) { } catch (e) {
console.error(e) console.error(e)
} }
} }
// const logisticsData = ref([])
const getLogisticsData = async () => {
// try {
// const res = await getLogisticsDataApi(currentRow.value?.id)
// logisticsData.value = res.data
// } catch (e) {
// console.error(e)
// }
}
const importDialogVisible = ref(false)
const importedFileUrl = ref('')
const importExcel = () => {
importDialogVisible.value = true
}
const downloadTemplate = () => {
// TODO: 实现下载模板功能
window.open('/api/template/download')
}
const exportExcel = async () => {
if (selections.value.length === 0) {
return ElMessage.warning('请选择要操作的数据')
}
const ids = selections.value.map((el) => el.id).join(',')
try {
const res = await exportExcelApi(ids)
window.open(res.data)
} catch (e) {
console.error(e)
}
}
const locationList = ref<ILocation[]>([]) const locationList = ref<ILocation[]>([])
const locationLoading = ref(false) const locationLoading = ref(false)
...@@ -1336,13 +1519,13 @@ const fetchLocationList = async (query: string) => { ...@@ -1336,13 +1519,13 @@ const fetchLocationList = async (query: string) => {
} }
} }
// 输入2秒后再调用接口(节流) // 输入2秒后再调用接口(节流)
const handleLocationSearch = debounce(fetchLocationList, 2000) // const handleLocationSearch = debounce(fetchLocationList, 2000)
const handleLocationChange = (val: number, row: InterProductList) => { // const handleLocationChange = (val: number, row: InterProductList) => {
const found = locationList.value.find( // const found = locationList.value.find(
(item: InterProductList) => item.locationId === val, // (item: InterProductList) => item.locationId === val,
) // )
row.locationCode = found ? found.locationCode : '' // row.locationCode = found ? found.locationCode : ''
} // }
onMounted(() => { onMounted(() => {
getTreeNum() getTreeNum()
getWarehouseList() getWarehouseList()
...@@ -1355,6 +1538,9 @@ onMounted(() => { ...@@ -1355,6 +1538,9 @@ onMounted(() => {
width: 500px; width: 500px;
text-align: center; text-align: center;
} }
.cursor-pointer {
cursor: pointer;
}
.header-filter-form { .header-filter-form {
:deep(.el-form-item) { :deep(.el-form-item) {
margin-right: 14px; margin-right: 14px;
......
...@@ -87,7 +87,14 @@ ...@@ -87,7 +87,14 @@
style="width: 160px" style="width: 160px"
/> />
</ElFormItem> </ElFormItem>
<ElFormItem style="margin-right: 10px" label="ID">
<ElInput
v-model="searchForm.id"
clearable
placeholder="请输入ID"
style="width: 160px"
/>
</ElFormItem>
<ElFormItem> <ElFormItem>
<ElButton type="primary" @click="search">查询</ElButton> <ElButton type="primary" @click="search">查询</ElButton>
</ElFormItem> </ElFormItem>
...@@ -100,14 +107,14 @@ ...@@ -100,14 +107,14 @@
<el-button <el-button
v-if="nodeCode === 'PENDING_SUBMIT'" v-if="nodeCode === 'PENDING_SUBMIT'"
type="primary" type="primary"
@click="addDialog(1)" @click="addDialog(1, null)"
> >
新增 新增
</el-button> </el-button>
<el-button <el-button
v-if="nodeCode === 'PENDING_AUDIT'" v-if="nodeCode === 'PENDING_AUDIT'"
type="danger" type="danger"
@click="auditOrder('rejected')" @click="rejectedInRecord"
> >
驳回 驳回
</el-button> </el-button>
...@@ -118,16 +125,9 @@ ...@@ -118,16 +125,9 @@
> >
删除 删除
</el-button> </el-button>
<el-button
v-if="nodeCode === 'PENDING_SUBMIT'"
type="warning"
@click="importExcel"
>
导入
</el-button>
<el-button type="success" @click="handleExport"> 导出 </el-button> <el-button type="success" @click="handleExport"> 导出 </el-button>
<el-button type="primary" @click="exportExcel"> <el-button type="primary" @click="printProductTag">
打印SKU标签 打印商品SKU标签
</el-button> </el-button>
<el-button <el-button
v-if="nodeCode === 'PENDING_AUDIT'" v-if="nodeCode === 'PENDING_AUDIT'"
...@@ -253,6 +253,13 @@ ...@@ -253,6 +253,13 @@
> >
</ElTableColumn> </ElTableColumn>
<ElTableColumn <ElTableColumn
label="驳回原因"
show-overflow-tooltip
prop="rejectReason"
header-align="center"
align="center"
></ElTableColumn>
<ElTableColumn
label="备注" label="备注"
show-overflow-tooltip show-overflow-tooltip
prop="remark" prop="remark"
...@@ -346,8 +353,8 @@ ...@@ -346,8 +353,8 @@
prop="totalPrice" prop="totalPrice"
/> />
<!-- <ElTableColumn <!-- <ElTableColumn
show-overflow-tooltip show-overflow-tooltip
align="center" align="center"
label="不良品数量" label="不良品数量"
prop="rejectsAmount" prop="rejectsAmount"
/> />
...@@ -406,7 +413,7 @@ ...@@ -406,7 +413,7 @@
style="display: flex" style="display: flex"
> >
<span style="display: inline-block"> <span style="display: inline-block">
{{ item.createdTime }} {{ item.createdTime }}&emsp;&emsp;
</span> </span>
<span style="display: inline-block">{{ <span style="display: inline-block">{{
item.description item.description
...@@ -427,22 +434,26 @@ ...@@ -427,22 +434,26 @@
:close-on-click-modal="false" :close-on-click-modal="false"
> >
<div class="import-dialog"> <div class="import-dialog">
<div class="import-header"> <!-- <div class="import-header">
<el-button type="primary" link @click="downloadTemplate"> <el-button type="primary" link @click="downloadTemplate">
<el-icon><Download /></el-icon> <el-icon><Download /></el-icon>
下载模板 下载模板
</el-button> </el-button>
</div> </div> -->
<div class="import-content"> <div class="import-content">
<UploadExcel v-model="importedFileUrl" /> <UploadExcel
v-model="importedFileUrl"
:import-type="'local'"
@imported="handleLocalImport"
/>
</div> </div>
</div> </div>
<template #footer> <!-- <template #footer>
<span class="dialog-footer"> <span class="dialog-footer">
<el-button @click="importDialogVisible = false">取消</el-button> <el-button @click="importDialogVisible = false">取消</el-button>
<el-button type="primary" @click="submitConfirmOrder">确认</el-button> <el-button type="primary" @click="packedData">确认</el-button>
</span> </span>
</template> </template> -->
</ElDialog> </ElDialog>
<ElDialog <ElDialog
v-model="newDialogVisible" v-model="newDialogVisible"
...@@ -552,6 +563,10 @@ ...@@ -552,6 +563,10 @@
<ElTableColumn align="center" label="库位" prop="loacationCode"> <ElTableColumn align="center" label="库位" prop="loacationCode">
<template #default="{ row }"> <template #default="{ row }">
<!-- +后有就正常展示,没有则通过搜索接口自己添加 --> <!-- +后有就正常展示,没有则通过搜索接口自己添加 -->
<!-- remote
:remote-method="(query) => handleLocationSearch(query, row)"
:loading="locationLoading"
@change="(val) => handleLocationChange(val, row)" -->
<span v-if="row.loacationCode">{{ row.loacationCode }}</span> <span v-if="row.loacationCode">{{ row.loacationCode }}</span>
<ElSelect <ElSelect
v-else v-else
...@@ -560,10 +575,6 @@ ...@@ -560,10 +575,6 @@
placeholder="请输入库位" placeholder="请输入库位"
style="width: 120px" style="width: 120px"
filterable filterable
remote
:remote-method="(query) => handleLocationSearch(query, row)"
:loading="locationLoading"
@change="(val) => handleLocationChange(val, row)"
> >
<ElOption <ElOption
v-for="item in locationList" v-for="item in locationList"
...@@ -733,16 +744,59 @@ ...@@ -733,16 +744,59 @@
</span> </span>
</template> </template>
</ElDialog> </ElDialog>
<el-dialog v-model="showPrintDialog" title="打印参数设置">
<el-table height="400px" :data="selections" border>
<el-table-column
width="60"
align="center"
type="index"
label="序号"
></el-table-column>
<el-table-column
align="center"
prop="skuName"
label="商品名称"
></el-table-column>
<el-table-column
align="center"
prop="warehouseSku"
label="商品SKU"
></el-table-column>
<el-table-column
align="center"
prop="locationCode"
label="库位编码"
></el-table-column>
<el-table-column
align="center"
prop="productNumber"
label="货号 "
></el-table-column>
<el-table-column align="center" prop="number" label="打印数量">
<template #default="{ row }">
<el-input
v-model="row.number"
oninput="value=value.replace(/[^\-?\d.]/g,'')"
placeholder="打印数量"
clearable
></el-input>
</template>
</el-table-column>
</el-table>
<template #footer>
<el-button @click="showPrintDialog = false">取消</el-button>
<el-button type="primary" @click="handlePrintProductTag">打印</el-button>
</template>
</el-dialog>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ElMessage, ElRadioGroup, ElTree, TableColumnCtx } from 'element-plus' import { ElMessage, ElRadioGroup, ElTree } from 'element-plus'
import { Download, CirclePlusFilled } from '@element-plus/icons-vue' import { CirclePlusFilled } from '@element-plus/icons-vue'
import splitDiv from '@/components/splitDiv/splitDiv.vue' import splitDiv from '@/components/splitDiv/splitDiv.vue'
import { ElTable } from 'element-plus' import { ElTable } from 'element-plus'
import usePageList from '@/utils/hooks/usePageList' import usePageList from '@/utils/hooks/usePageList'
import { useValue } from '@/utils/hooks/useValue' import { useValue } from '@/utils/hooks/useValue'
import { exportExcelApi } from '@/api/order'
import { import {
getInRecordStatusTree, getInRecordStatusTree,
warehouseInRecordListPageApi, warehouseInRecordListPageApi,
...@@ -755,11 +809,14 @@ import { ...@@ -755,11 +809,14 @@ import {
deleteWarehouseInRecordApi, deleteWarehouseInRecordApi,
auditOrderApi, auditOrderApi,
getInRecordLogApi, getInRecordLogApi,
rejectInRecordApi,
LogListData,
factoryWarehouseInventoryPrint,
} from '@/api/warehouse' } from '@/api/warehouse'
import { filePath } from '@/api/axios.ts'
import BigNumber from 'bignumber.js' import BigNumber from 'bignumber.js'
import { ref, onMounted, watch, nextTick } from 'vue' import { ref, onMounted, watch, nextTick } from 'vue'
import 'element-plus/dist/index.css' import 'element-plus/dist/index.css'
import { LogList } from '@/types/api/billOrder.ts'
import { import {
warehouseSearchForm, warehouseSearchForm,
InterWarehousePage, InterWarehousePage,
...@@ -768,12 +825,11 @@ import { ...@@ -768,12 +825,11 @@ import {
InterskuList, InterskuList,
InterWarehouseList, InterWarehouseList,
ILocation, ILocation,
InterWarehouseDetail,
} from '@/types/api/warehouse' } from '@/types/api/warehouse'
import ImageView from '@/components/ImageView.vue' import ImageView from '@/components/ImageView.vue'
import { showConfirm } from '@/utils/ui'
import UploadExcel from '@/components/UploadExcel.vue' import UploadExcel from '@/components/UploadExcel.vue'
import { debounce } from 'lodash-es' // import { debounce } from 'lodash-es'
// import UploadExcel from '@/components/INgoVopy.vue'
const warehouseList = ref<InterWarehouseList[]>([]) const warehouseList = ref<InterWarehouseList[]>([])
const pickerOptions = { const pickerOptions = {
shortcuts: [ shortcuts: [
...@@ -902,11 +958,13 @@ const detailList = ref<InterProductList[]>([]) ...@@ -902,11 +958,13 @@ const detailList = ref<InterProductList[]>([])
const tabsValue = ref<string>('0') const tabsValue = ref<string>('0')
const singleTableRef = ref<InstanceType<typeof ElTable>>() const singleTableRef = ref<InstanceType<typeof ElTable>>()
const currentRow = ref<InterWarehousePage | null>(null) const currentRow = ref<InterWarehousePage | null>(null)
const logList = ref<LogList[]>([]) const logList = ref<LogListData[]>([])
const rules = { const rules = {
warehouseId: [{ required: true, message: '请选择仓库', trigger: 'change' }], warehouseId: [{ required: true, message: '请选择仓库', trigger: 'change' }],
} }
const nodeCode = ref<string | null>('all') const nodeCode = ref<string>(
sessionStorage.getItem('InRecord_NodeCode') || 'all',
)
const treeRef = ref<InstanceType<typeof ElTree>>() const treeRef = ref<InstanceType<typeof ElTree>>()
const { const {
...@@ -935,10 +993,12 @@ const setCostPrice = (item: InterProductList) => { ...@@ -935,10 +993,12 @@ const setCostPrice = (item: InterProductList) => {
ElMessage.warning('商品成本价为空,请完善商品成本价') ElMessage.warning('商品成本价为空,请完善商品成本价')
return return
} }
const amount = new BigNumber(item.buyStored) if (item) {
.multipliedBy(item.costPrice) const buyStored = item.buyStored ?? 0
.toFixed(2) const costPrice = item.costPrice ?? 0
item.totalPrice = Number(amount) const amount = new BigNumber(buyStored).multipliedBy(costPrice).toFixed(2)
item.totalPrice = Number(amount)
}
} }
const getTreeNum = async () => { const getTreeNum = async () => {
try { try {
...@@ -952,6 +1012,74 @@ const getTreeNum = async () => { ...@@ -952,6 +1012,74 @@ const getTreeNum = async () => {
console.error(e) console.error(e)
} }
} }
const showPrintDialog = ref(false)
const printProductTag = async () => {
if (!selections.value.length) {
return ElMessage.warning('请选择要删除的数据')
}
showPrintDialog.value = true
// selections.value.forEach((el:InterWarehousePage) => {
// el.number = ''
// })
}
async function handlePrintProductTag() {
// const flag = selections.value.every((el:InterWarehousePage) => el.number && el.number != '0')
// if (!flag) {
// return ElMessage.warning('打印数量需大于0')
// }
// const list = selections.value.map((item:InterWarehousePage) => {
// return {
// skuName: item.skuName,
// warehouseSku: item.warehouseSku,
// supplierItemNo: item.productNumber,
// number: item.number,
// locationName: item.locationCode,
// }
// })
// const res = await factoryWarehouseInventoryPrint({
// list,
// code: 'PT002',
// })
// showPrintDialog.value = false
// window.open(filePath + res.message, '_blank')
}
const excelFieldMap: Record<string, keyof InterProductList> = {
SKU图片: 'skuImage',
商品SKU: 'warehouseSku',
SKU名称: 'skuName',
入库数量: 'buyStored',
'成本价(¥)': 'costPrice',
'总成本(¥)': 'totalPrice',
库位: 'locationCode',
备注: 'remark',
}
const handleLocalImport = ({
path,
data,
}: {
path: string
data: InterProductList[]
}) => {
const result: InterProductList[] = data.map((item) => {
const obj = {} as InterProductList
Object.keys(excelFieldMap).forEach((excelKey) => {
const field = excelFieldMap[excelKey] as keyof InterProductList
const value = item[excelKey]
// // 类型转换和默认值
// if (['buyStored', 'costPrice', 'totalPrice'].includes(field)) {
// value = value == null || value === '' ? 0 : Number(value)
// } else {
// value = value == null ? '' : value
// }
obj[field] = value as InterProductList[typeof field]
})
return obj
})
otherPurchaseData.value = result
importedFileUrl.value = path
importDialogVisible.value = false
}
const exportVisible = ref(false) const exportVisible = ref(false)
const exportForm = ref({ const exportForm = ref({
delivery: false, delivery: false,
...@@ -962,100 +1090,98 @@ const handleExport = () => { ...@@ -962,100 +1090,98 @@ const handleExport = () => {
// exportForm.value.delivery = false // exportForm.value.delivery = false
// exportForm.value.resource = '' // exportForm.value.resource = ''
} }
// const submitExportForm = () => { const submitExportForm = () => {
// if (exportForm.value.resource === '') { // if (exportForm.value.resource === '') {
// return ElMessage.error('请选择导出类型') // return ElMessage.error('请选择导出类型')
// } // }
// let purchaseIds = [], // let purchaseIds = [],
// otherIds = [], // otherIds = [],
// total = 0, // total = 0,
// params = {} // params = {}
// if (exportForm.value.resource === 0) { // if (exportForm.value.resource === 0) {
// purchaseIds = userData.value // purchaseIds = userData.value
// .filter((el) => el.dataType === 0) // .filter((el) => el.dataType === 0)
// .map((el) => el.id) // .map((el) => el.id)
// .join(',') // .join(',')
// otherIds = userData.value // otherIds = userData.value
// .filter((el) => el.dataType === 1) // .filter((el) => el.dataType === 1)
// .map((el) => el.id) // .map((el) => el.id)
// .join(',') // .join(',')
// } else if (exportForm.value.resource === 1) { // } else if (exportForm.value.resource === 1) {
// purchaseIds = selections.value // purchaseIds = selections.value
// .filter((el) => el.dataType === 0) // .filter((el) => el.dataType === 0)
// .map((el) => el.id) // .map((el) => el.id)
// .join(',') // .join(',')
// otherIds = selections.value // otherIds = selections.value
// .filter((el) => el.dataType === 1) // .filter((el) => el.dataType === 1)
// .map((el) => el.id) // .map((el) => el.id)
// .join(',') // .join(',')
// } else { // } else {
// purchaseIds = '' // purchaseIds = ''
// otherIds = '' // otherIds = ''
// // total = this.paginationOptions.total // // total = this.paginationOptions.total
// } // }
// params = { // params = {
// purchaseIds, // purchaseIds,
// otherIds, // otherIds,
// total, // total,
// } // }
// if (exportForm.value.resource !== 2) { // if (exportForm.value.resource !== 2) {
// delete params.total // delete params.total
// } else { // } else {
// // params.billStatus = this.billStatus // // params.billStatus = this.billStatus
// // params.type = this.treeType || '' // // params.type = this.treeType || ''
// // params.otherStatus = this.otherStatus // // params.otherStatus = this.otherStatus
// if ( // if (
// this.treeLabel.indexOf(this.$t('待入库')) !== -1 || // this.treeLabel.indexOf(this.$t('待入库')) !== -1 ||
// this.treeLabel.indexOf(this.$t('已入库')) !== -1 // this.treeLabel.indexOf(this.$t('已入库')) !== -1
// ) { // ) {
// params.purchaseAll = true // params.purchaseAll = true
// params.otherAll = true // params.otherAll = true
// } // }
// if ( // if (
// this.treeLabel.indexOf(this.$t('采购')) !== -1 || // this.treeLabel.indexOf(this.$t('采购')) !== -1 ||
// this.treeLabel.indexOf(this.$t('生产')) !== -1 // this.treeLabel.indexOf(this.$t('生产')) !== -1
// ) { // ) {
// params.purchaseAll = true // params.purchaseAll = true
// } // }
// if (this.treeLabel.indexOf(this.$t('其他')) !== -1) { // if (this.treeLabel.indexOf(this.$t('其他')) !== -1) {
// params.otherAll = true // params.otherAll = true
// } // }
// if (this.treeLabel.indexOf(this.$t('归档')) !== -1) { // if (this.treeLabel.indexOf(this.$t('归档')) !== -1) {
// params.purchaseAll = true // params.purchaseAll = true
// } // }
// if (this.treeLabel.indexOf(this.$t('作废')) !== -1) { // if (this.treeLabel.indexOf(this.$t('作废')) !== -1) {
// params.purchaseAll = true // params.purchaseAll = true
// params.otherAll = true // params.otherAll = true
// } // }
// } // }
// const loading = this.$loading({
// const loading = this.$loading({ // background: 'rgba(0, 0, 0, 0.3)',
// background: 'rgba(0, 0, 0, 0.3)', // })
// }) // Axios.post(
// Axios.post( // window.apiHostSetting.VUE_APP_API_URL +
// window.apiHostSetting.VUE_APP_API_URL + // 'api/purchaseStoreBill/exportPurchaseExcel',
// 'api/purchaseStoreBill/exportPurchaseExcel', // {
// { // includeSku: exportForm.value.delivery,
// includeSku: exportForm.value.delivery, // ...params,
// ...params, // ...this.searchForm,
// },
// ...this.searchForm, // {
// }, // headers: {
// { // 'jwt-token': localStorage.getItem('token'),
// headers: { // },
// 'jwt-token': localStorage.getItem('token'), // },
// }, // )
// }, // .then((res) => {
// ) // console.log(filePath)
// .then((res) => { // window.open(filePath + res.data.message)
// console.log(filePath) // exportVisible.value = false
// window.open(filePath + res.data.message) // })
// exportVisible.value = false // .finally(() => {
// }) // loading.close()
// .finally(() => { // })
// loading.close() }
// })
// }
const getWarehouseList = async () => { const getWarehouseList = async () => {
try { try {
const res = await getWarehouseListApi() const res = await getWarehouseListApi()
...@@ -1093,7 +1219,7 @@ const skudblclick = (val: InterskuList) => { ...@@ -1093,7 +1219,7 @@ const skudblclick = (val: InterskuList) => {
sku = '', sku = '',
skuName = '', skuName = '',
image = '', image = '',
locationId = '', locationId = 0,
} = val || {} } = val || {}
otherPurchaseData.value = [ otherPurchaseData.value = [
...otherPurchaseData.value, ...otherPurchaseData.value,
...@@ -1103,7 +1229,7 @@ const skudblclick = (val: InterskuList) => { ...@@ -1103,7 +1229,7 @@ const skudblclick = (val: InterskuList) => {
skuName, skuName,
productNo, productNo,
locationCode: locationCode ?? '', // 确保空值处理 locationCode: locationCode ?? '', // 确保空值处理
locationId: locationId ?? '', // 确保空值处理 locationId: locationId ?? 0, // 确保空值处理
costPrice: factoryPrice, costPrice: factoryPrice,
buyStored: null, buyStored: null,
totalPrice: null, totalPrice: null,
...@@ -1130,22 +1256,23 @@ const tabsClick = async () => { ...@@ -1130,22 +1256,23 @@ const tabsClick = async () => {
getLogList() getLogList()
} }
} }
const [editForm, resetEditForm] = useValue({ const [editForm, resetEditForm] = useValue<InterWarehouseDetail>({
inNo: '', inNo: '',
warehouseId: '', warehouseId: '',
remark: '', remark: '',
factoryCode: '', factoryCode: '',
factoryId: '', factoryId: 0,
productList: [],
}) })
const newDialogVisible = ref(false) const newDialogVisible = ref(false)
const editFormRef = ref() const editFormRef = ref()
const editForm2 = ref({}) const editForm2 = ref({})
const formId = ref<number | undefined>(undefined) const formId = ref<number | undefined>(undefined)
const otherPurchaseData = ref<InterProductList[]>([]) const otherPurchaseData = ref<InterProductList[]>([])
const addDialog = async (i: number, v: InterWarehousePage) => { const addDialog = async (i: number, v: InterWarehousePage | null) => {
if (i === 2) { if (i === 2) {
if (v) formId.value = v.id if (v) formId.value = v.id
getProduct(v.id) if (v) getProduct(v.id)
if (!formId.value) return ElMessage('请勾选至少一条记录') if (!formId.value) return ElMessage('请勾选至少一条记录')
editForm.value = JSON.parse(JSON.stringify(v)) editForm.value = JSON.parse(JSON.stringify(v))
} else { } else {
...@@ -1165,13 +1292,12 @@ const addDialog = async (i: number, v: InterWarehousePage) => { ...@@ -1165,13 +1292,12 @@ const addDialog = async (i: number, v: InterWarehousePage) => {
otherPurchaseData.value = [] otherPurchaseData.value = []
formId.value = undefined formId.value = undefined
} }
fetchLocationList('') //获取该仓库下的所有库位
newDialogVisible.value = true newDialogVisible.value = true
} }
const getProduct = async (id: number) => { const getProduct = async (id: number | undefined) => {
try { try {
const res = await getWarehouseInRecordDetailApi(id) const res = await getWarehouseInRecordDetailApi(id)
otherPurchaseData.value = res.data.productList || [] otherPurchaseData.value = res.data?.productList || []
} catch (e) { } catch (e) {
console.error(e) console.error(e)
} }
...@@ -1184,13 +1310,12 @@ const productSelectionChange = (v: InterProductList[]) => { ...@@ -1184,13 +1310,12 @@ const productSelectionChange = (v: InterProductList[]) => {
otherWarehouseSelection.value = v otherWarehouseSelection.value = v
} }
const auditOrder = (key: string) => { const auditOrder = (key: string) => {
if (selections.value.length === 0) {
return ElMessage.warning('请选择要操作的数据')
}
let url = '' let url = ''
let text = '' let text = ''
switch (key) { switch (key) {
case 'rejected':
url = 'factory/warehouseInRecord/turnDown'
text = '驳回'
break
case 'invalid': case 'invalid':
url = 'factory/warehouseInRecord/invalid' url = 'factory/warehouseInRecord/invalid'
text = '作废' text = '作废'
...@@ -1208,10 +1333,6 @@ const auditOrder = (key: string) => { ...@@ -1208,10 +1333,6 @@ const auditOrder = (key: string) => {
text = '审核' text = '审核'
break break
} }
if (selections.value.length === 0) {
return ElMessage.warning('请选择要操作的数据')
}
const confimText = const confimText =
key === 'audit' key === 'audit'
? '确定进行审核?点“确定”将会直接更改库存数量,请在审核前确认数量是否正确。' ? '确定进行审核?点“确定”将会直接更改库存数量,请在审核前确认数量是否正确。'
...@@ -1232,30 +1353,32 @@ const auditOrder = (key: string) => { ...@@ -1232,30 +1353,32 @@ const auditOrder = (key: string) => {
await getTreeNum() await getTreeNum()
}) })
} }
// const rejectOrder = () => { const rejectedInRecord = () => {
// if (selections.value.length === 0) { if (selections.value.length === 0) {
// return ElMessage.warning('请选择要操作的数据') return ElMessage.warning('请选择要操作的数据')
// } }
// ElMessageBox.prompt('请输入驳回原因', '提示', { ElMessageBox.prompt('请输入驳回原因', '提示', {
// confirmButtonText: '确定', confirmButtonText: '确定',
// cancelButtonText: '取消', cancelButtonText: '取消',
// type: 'warning', type: 'warning',
// inputPattern: /.+/, inputPattern: /.+/,
// customClass: 'reject', customClass: 'reject',
// inputErrorMessage: '请输入驳回原因', inputErrorMessage: '请输入驳回原因',
// inputPlaceholder: '驳回原因', inputPlaceholder: '驳回原因',
// }).then(async ({ value }) => { }).then(async ({ value }: { value: string }) => {
// const ids = selections.value.map((el) => el.id).join(',') const ids = selections.value
// try { .map((el: InterWarehousePage) => el.id)
// await rejectOrderApi({ ids: ids, description: value, pass: 0 }) .join(',')
// ElMessage.success('操作成功') try {
// search() await rejectInRecordApi({ ids: ids, rejectReason: value })
// await getTreeNum() ElMessage.success('操作成功')
// } catch (e) { search()
// console.error(e) await getTreeNum()
// } } catch (e) {
// }) console.error(e)
// } }
})
}
watch( watch(
() => tableData.value, () => tableData.value,
() => { () => {
...@@ -1270,6 +1393,15 @@ watch( ...@@ -1270,6 +1393,15 @@ watch(
}, },
{ immediate: true }, { immediate: true },
) )
watch(
() => editForm.value.warehouseId,
(newVal: number | string | undefined) => {
if (newVal) {
fetchLocationList('')
}
},
)
const addOtherCurrency = async () => { const addOtherCurrency = async () => {
try { try {
await editFormRef.value?.validate() await editFormRef.value?.validate()
...@@ -1385,8 +1517,11 @@ const deleteOtherWarehousing = () => { ...@@ -1385,8 +1517,11 @@ const deleteOtherWarehousing = () => {
(item: InterProductList) => !idList.includes(item.warehouseSku), (item: InterProductList) => !idList.includes(item.warehouseSku),
) )
} }
const importDialogVisible = ref(false)
const importedFileUrl = ref('')
const importData = async () => { const importData = async () => {
if (!editForm.value.warehouseId) return ElMessage.error('请选择仓库') // if (!editForm.value.warehouseId) return ElMessage.error('请选择仓库')
importDialogVisible.value = true
} }
const handleBatchDelete = async () => { const handleBatchDelete = async () => {
if (!selections.value.length) { if (!selections.value.length) {
...@@ -1404,18 +1539,18 @@ const handleBatchDelete = async () => { ...@@ -1404,18 +1539,18 @@ const handleBatchDelete = async () => {
} }
const nodeClick = (data: InterWarehouseTree) => { const nodeClick = (data: InterWarehouseTree) => {
nodeCode.value = data.code ?? '' nodeCode.value = data.code ?? ''
sessionStorage.setItem('InRecord_NodeCode', data.code ?? '')
search() search()
} }
const detailPager = ref({ // const detailPager = ref({
page: 1, // page: 1,
rows: 100, // rows: 100,
total: 0, // total: 0,
}) // })
const searchDetail = async () => { const searchDetail = async () => {
try { try {
const res = await getWarehouseInRecordDetailApi(currentRow.value?.id) const res = await getWarehouseInRecordDetailApi(currentRow.value?.id)
detailList.value = res.data.productList || [] detailList.value = res.data?.productList || []
// detailPager.value.total = res.data.total
} catch (e) { } catch (e) {
console.error(e) console.error(e)
} }
...@@ -1428,30 +1563,6 @@ const getLogList = async () => { ...@@ -1428,30 +1563,6 @@ const getLogList = async () => {
console.error(e) console.error(e)
} }
} }
const importDialogVisible = ref(false)
const importedFileUrl = ref('')
const importExcel = () => {
importDialogVisible.value = true
}
const downloadTemplate = () => {
// TODO: 实现下载模板功能
window.open('/api/template/download')
}
const exportExcel = async () => {
if (selections.value.length === 0) {
return ElMessage.warning('请选择要操作的数据')
}
const ids = selections.value.map((el) => el.id).join(',')
try {
const res = await exportExcelApi(ids)
window.open(res.data)
} catch (e) {
console.error(e)
}
}
const locationList = ref<ILocation[]>([]) const locationList = ref<ILocation[]>([])
const locationLoading = ref(false) const locationLoading = ref(false)
...@@ -1480,13 +1591,13 @@ const fetchLocationList = async (query: string) => { ...@@ -1480,13 +1591,13 @@ const fetchLocationList = async (query: string) => {
} }
} }
// 输入2秒后再调用接口(节流) // 输入2秒后再调用接口(节流)
const handleLocationSearch = debounce(fetchLocationList, 2000) // const handleLocationSearch = debounce(fetchLocationList, 2000)
const handleLocationChange = (val: number, row: InterProductList) => { // const handleLocationChange = (val: number, row: InterProductList) => {
const found = locationList.value.find( // const found = locationList.value.find(
(item: InterProductList) => item.locationId === val, // (item: InterProductList) => item.locationId === val,
) // )
row.locationCode = found ? found.locationCode : '' // row.locationCode = found ? found.locationCode : ''
} // }
onMounted(() => { onMounted(() => {
getTreeNum() getTreeNum()
getWarehouseList() getWarehouseList()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment