Commit fb737ac7 by wuqian

基本页面搭建

parent 4a56b804
...@@ -33,6 +33,7 @@ declare module 'vue' { ...@@ -33,6 +33,7 @@ declare module 'vue' {
ElMenuItem: typeof import('element-plus/es')['ElMenuItem'] ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
ElOption: typeof import('element-plus/es')['ElOption'] ElOption: typeof import('element-plus/es')['ElOption']
ElPagination: typeof import('element-plus/es')['ElPagination'] ElPagination: typeof import('element-plus/es')['ElPagination']
ElPopover: typeof import('element-plus/es')['ElPopover']
ElRadio: typeof import('element-plus/es')['ElRadio'] ElRadio: typeof import('element-plus/es')['ElRadio']
ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup'] ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
ElRow: typeof import('element-plus/es')['ElRow'] ElRow: typeof import('element-plus/es')['ElRow']
...@@ -57,6 +58,7 @@ declare module 'vue' { ...@@ -57,6 +58,7 @@ declare module 'vue' {
SplitDiv: typeof import('./src/components/splitDiv/splitDiv.vue')['default'] SplitDiv: typeof import('./src/components/splitDiv/splitDiv.vue')['default']
TableRightMenu: typeof import('./src/components/TableRightMenu.vue')['default'] TableRightMenu: typeof import('./src/components/TableRightMenu.vue')['default']
TableView: typeof import('./src/components/TableView.vue')['default'] TableView: typeof import('./src/components/TableView.vue')['default']
UploadExcel: typeof import('./src/components/UploadExcel.vue')['default']
UploadImage: typeof import('./src/components/UploadImage.vue')['default'] UploadImage: typeof import('./src/components/UploadImage.vue')['default']
WangEditor: typeof import('./src/components/WangEditor.vue')['default'] WangEditor: typeof import('./src/components/WangEditor.vue')['default']
} }
......
...@@ -97,7 +97,7 @@ export function deleteWarehouseInventory(ids: string) { ...@@ -97,7 +97,7 @@ export function deleteWarehouseInventory(ids: string) {
} }
// 入库单 // 入库单
export function warehouseInRecordListPage( export function warehouseInRecordListPageApi(
data: warehouseSearchForm, data: warehouseSearchForm,
currentPage: number, currentPage: number,
pageSize: number, pageSize: number,
...@@ -121,7 +121,7 @@ export function updateInRecordApi(form: InRecordEditForm) { ...@@ -121,7 +121,7 @@ export function updateInRecordApi(form: InRecordEditForm) {
...form, ...form,
}) })
} }
export function getWarehouseInRecordDetail(id: number) { export function getWarehouseInRecordDetailApi(id: number) {
return axios.get<never, BaseRespData<never>>( return axios.get<never, BaseRespData<never>>(
'factory/warehouseInRecord/get', 'factory/warehouseInRecord/get',
{ {
...@@ -131,7 +131,7 @@ export function getWarehouseInRecordDetail(id: number) { ...@@ -131,7 +131,7 @@ export function getWarehouseInRecordDetail(id: number) {
}, },
) )
} }
export function getBySku(warehouseId: number, sku: string | null) { export function getBySkuApi(warehouseId: number, sku: string | null) {
return axios.get<never, BaseRespData<InterskuList[]>>( return axios.get<never, BaseRespData<InterskuList[]>>(
'customProductItem/getBySku', 'customProductItem/getBySku',
{ {
...@@ -142,7 +142,7 @@ export function getBySku(warehouseId: number, sku: string | null) { ...@@ -142,7 +142,7 @@ export function getBySku(warehouseId: number, sku: string | null) {
}, },
) )
} }
export function getByWareHouseIdAndCode(wareHouseId: number, code: string | null) { export function getByWareHouseIdAndCodeApi(wareHouseId: number, code: string | null) {
return axios.get<never, BaseRespData<ILocation[]>>( return axios.get<never, BaseRespData<ILocation[]>>(
'factoryWarehouseLocation/getByWareHouseIdAndCode', 'factoryWarehouseLocation/getByWareHouseIdAndCode',
{ {
...@@ -153,7 +153,7 @@ export function getByWareHouseIdAndCode(wareHouseId: number, code: string | null ...@@ -153,7 +153,7 @@ export function getByWareHouseIdAndCode(wareHouseId: number, code: string | null
}, },
) )
} }
export function getWarehouseStatusTree() { export function getInRecordStatusTree() {
return axios.get<never, BaseRespData<InterWarehouseTree[]>>( return axios.get<never, BaseRespData<InterWarehouseTree[]>>(
'factory/warehouseInRecord/status_tree', 'factory/warehouseInRecord/status_tree',
) )
...@@ -163,3 +163,39 @@ export function getWarehouseListApi() { ...@@ -163,3 +163,39 @@ export function getWarehouseListApi() {
'factoryWarehouseInfo/getAll', 'factoryWarehouseInfo/getAll',
) )
} }
export function deleteWarehouseInRecordApi(ids: string) {
return axios.get<never, BaseRespData<never>>(
'factory/warehouseInRecord/delete',
{
params: { ids },
},
)
}
// 出库单
export function getOutRecordStatusTree() {
return axios.get<never, BaseRespData<InterWarehouseTree[]>>(
'factory/warehouseOutRecord/status_tree',
)
}
export function warehouseOutRecordListPage(
data: warehouseSearchForm,
currentPage: number,
pageSize: number,
) {
return axios.post<never, BasePaginationData<InterWarehousePage>>(
'factory/warehouseOutRecord/list_page',
{
...data,
currentPage,
pageSize,
},
)
}
export function deleteWarehouseOutRecordApi(ids: string) {
return axios.get<never, BaseRespData<never>>(
'factory/warehouseOutRecord/delete',
{
params: { ids },
},
)
}
\ No newline at end of file
...@@ -9,14 +9,17 @@ ...@@ -9,14 +9,17 @@
:highlight-current="true" :highlight-current="true"
node-key="code" node-key="code"
:data="treeData" :data="treeData"
:props="{ children: 'children', label: 'remark' }" :props="{ children: 'children', label: 'name' }"
@node-click="nodeClick" @node-click="nodeClick"
> >
<template #default="{ data }"> <template #default="{ data }">
<div class="tree-node"> <div class="tree-node">
<div class="tree-node-label">{{ data.remark }}</div> <div class="tree-node-label">{{ data.name }}</div>
<div v-if="data.count || data.count === 0" class="tree-node-count"> <div
{{ `(${data.count})` }} v-if="data.countQuantity || data.countQuantity === 0"
class="tree-node-count"
>
{{ `(${data.countQuantity})` }}
</div> </div>
</div> </div>
</template> </template>
...@@ -28,9 +31,25 @@ ...@@ -28,9 +31,25 @@
<template #top> <template #top>
<div class="header-filter-form"> <div class="header-filter-form">
<ElForm :model="searchForm" inline> <ElForm :model="searchForm" inline>
<ElFormItem label="账期"> <ElFormItem label="采购仓库">
<ElSelect
v-model="searchForm.warehouseId"
clearable
placeholder="请选择仓库"
style="width: 160px"
>
<ElOption
v-for="item in warehouseList"
:key="item.id"
:label="item.name"
:value="item.id"
></ElOption>
</ElSelect>
</ElFormItem>
<ElFormItem label="入库时间">
<el-date-picker <el-date-picker
v-model="dateRange" v-model="tradingTime"
:shortcuts="pickerOptions.shortcuts"
:default-time="[ :default-time="[
new Date(0, 0, 0, 0, 0, 0), new Date(0, 0, 0, 0, 0, 0),
new Date(0, 0, 0, 23, 59, 59), new Date(0, 0, 0, 23, 59, 59),
...@@ -44,28 +63,27 @@ ...@@ -44,28 +63,27 @@
value-format="YYYY-MM-DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss"
/> />
</ElFormItem> </ElFormItem>
<ElFormItem label="单号">
<ElFormItem label="对账单号">
<ElInput <ElInput
v-model="searchForm.recNumber" v-model="searchForm.orderNumber"
clearable clearable
placeholder="对账单号" placeholder="请输入入库单号"
style="width: 160px" style="width: 160px"
/> />
</ElFormItem> </ElFormItem>
<ElFormItem label="货单号"> <ElFormItem label="货单号">
<ElInput <ElInput
v-model="searchForm.billNumber" v-model="searchForm.batchNumber"
clearable clearable
placeholder="货单号" placeholder="请输入交货单号"
style="width: 160px" style="width: 160px"
/> />
</ElFormItem> </ElFormItem>
<ElFormItem style="margin-right: 10px" label="订单号"> <ElFormItem style="margin-right: 10px" label="SKU">
<ElInput <ElInput
v-model="searchForm.orderNumber" v-model="searchForm.sku"
clearable clearable
placeholder="订单号" placeholder="请输入SKU"
style="width: 160px" style="width: 160px"
/> />
</ElFormItem> </ElFormItem>
...@@ -79,26 +97,22 @@ ...@@ -79,26 +97,22 @@
</ElForm> </ElForm>
</div> </div>
<div class="btn-list"> <div class="btn-list">
<el-button <el-button type="primary" @click="addDialog(1)"> 新增 </el-button>
v-if="nodeId === 10" <el-button type="danger" @click="rejectOrder"> 驳回 </el-button>
type="primary" <el-button type="danger" @click="handleBatchDelete">
@click="confirmOrder" 删除
>
确认对账单
</el-button>
<el-button
v-if="nodeId === 10"
type="warning"
@click="rejectOrder"
>
驳回
</el-button> </el-button>
<el-button type="warning" @click="importExcel"> 导入 </el-button>
<el-button type="success" @click="exportExcel"> 导出 </el-button> <el-button type="success" @click="exportExcel"> 导出 </el-button>
<el-button <el-button type="primary" @click="exportExcel">
v-if="nodeId === 30" 打印SKU标签
type="danger" </el-button>
@click="auditOrder('archive')" <el-button type="warning" @click="exportExcel"> 审核 </el-button>
> <el-button type="success" @click="exportExcel">
提交审核
</el-button>
<el-button type="danger" @click="rejectOrder"> 作废 </el-button>
<el-button type="success" @click="auditOrder('archive')">
归档 归档
</el-button> </el-button>
</div> </div>
...@@ -110,8 +124,6 @@ ...@@ -110,8 +124,6 @@
ref="singleTableRef" ref="singleTableRef"
highlight-current-row highlight-current-row
:data="tableData" :data="tableData"
show-summary
:summary-method="getSummaries"
default-expand-all default-expand-all
size="small" size="small"
style="width: 100%; height: 100%" style="width: 100%; height: 100%"
...@@ -134,164 +146,91 @@ ...@@ -134,164 +146,91 @@
align="center" align="center"
></ElTableColumn> ></ElTableColumn>
<ElTableColumn <ElTableColumn
label="编码" label="入库单号"
show-overflow-tooltip show-overflow-tooltip
prop="name" prop="inNo"
width="200" width="110"
header-align="center" header-align="center"
align="center" align="center"
></ElTableColumn> ></ElTableColumn>
<!-- <ElTableColumn
label="客户"
show-overflow-tooltip
prop="user_mark"
width="200"
header-align="center"
align="center"
></ElTableColumn> -->
<ElTableColumn <ElTableColumn
label="对账单号" label="单据状态"
show-overflow-tooltip show-overflow-tooltip
prop="rec_number" prop="billStatus"
min-width="200" width="80"
header-align="center" header-align="center"
align="center" align="center"
></ElTableColumn> ></ElTableColumn>
<ElTableColumn
<!-- <ElTableColumn label="仓库名称"
label="订单号"
show-overflow-tooltip
prop="order_number"
width="200"
header-align="center"
align="center"
></ElTableColumn> -->
<!-- <ElTableColumn
label="ERP总价格"
show-overflow-tooltip
width="130"
prop="erp_total_amount"
header-align="center"
align="center"
></ElTableColumn> -->
<el-table-column
label="账期"
header-align="center"
align="center"
min-width="340"
>
<template #default="scope">
{{ scope.row.start_time }} - {{ scope.row.end_time }}
</template>
</el-table-column>
<el-table-column
label="商品总价格(¥)"
header-align="center"
prop="product_total_amount"
width="130"
align="center"
show-overflow-tooltip
>
</el-table-column>
<!-- <el-table-column
label="ERP总价格"
header-align="center"
prop="erp_total_amount"
width="120"
align="center"
show-overflow-tooltip
>
</el-table-column> -->
<el-table-column
label="物流总价(¥)"
header-align="center"
prop="carriage_total_amount"
width="130"
align="center"
show-overflow-tooltip show-overflow-tooltip
></el-table-column> prop="warehouseName"
<el-table-column min-width="100"
label="应付金额(¥)"
header-align="center" header-align="center"
width="130"
align="center"
show-overflow-tooltip
>
<template #default="{ row }">
<span>{{
row.carriage_total_amount + row.product_total_amount
}}</span>
</template>
</el-table-column>
<el-table-column
label="实付金额(¥)"
header-align="center"
prop="actual_amount"
width="130"
align="center" align="center"
></ElTableColumn>
<ElTableColumn
label="工厂编号"
show-overflow-tooltip show-overflow-tooltip
></el-table-column> prop="factoryCode"
<el-table-column min-width="100"
label="水单"
header-align="center" header-align="center"
prop="water_list"
width="100"
align="center" align="center"
show-overflow-tooltip ></ElTableColumn>
>
<template #default="{ row }">
<ImageView :src="row.water_list" />
</template>
</el-table-column>
<ElTableColumn <ElTableColumn
label="发货数量(件)" label="物流单号"
show-overflow-tooltip show-overflow-tooltip
width="100" prop="shipmentNumber"
prop="carriage_total_amount" width="200"
header-align="center" header-align="center"
align="center" align="center"
></ElTableColumn> ></ElTableColumn>
<ElTableColumn <ElTableColumn
label="总发货数量(件)" label="总金额(¥)"
show-overflow-tooltip show-overflow-tooltip
prop="num" width="120"
width="130" prop="totalPrice"
header-align="center" header-align="center"
align="center" align="center"
></ElTableColumn> ></ElTableColumn>
<ElTableColumn <ElTableColumn
label="质检通过数量(件)" label="SKU数量"
show-overflow-tooltip
prop="pass_num"
width="130"
header-align="center" header-align="center"
prop="skuAmount"
width="130"
align="center" align="center"
></ElTableColumn>
<!-- <ElTableColumn
label="ERP状态"
show-overflow-tooltip show-overflow-tooltip
width="130" >
prop="erp_status" </ElTableColumn>
<ElTableColumn
label="总数量"
header-align="center" header-align="center"
prop="total"
width="120"
align="center" align="center"
></ElTableColumn> --> show-overflow-tooltip
>
</ElTableColumn>
<ElTableColumn <ElTableColumn
label="质检未通过数量(件)" label="备注"
show-overflow-tooltip show-overflow-tooltip
width="140" width="240"
prop="not_pass_num" prop="remark"
header-align="center" header-align="center"
align="center" align="center"
></ElTableColumn> ></ElTableColumn>
<ElTableColumn <ElTableColumn
label="创建时间" width="100"
show-overflow-tooltip
width="200"
prop="create_time"
header-align="center"
align="center" align="center"
></ElTableColumn> header-align="center"
label="操作"
>
<template #default="{ row }">
<ElButton type="primary" link @click="addDialog(2, row)"
>编辑
</ElButton>
</template>
</ElTableColumn>
</ElTable> </ElTable>
</div> </div>
<ElPagination <ElPagination
...@@ -309,39 +248,7 @@ ...@@ -309,39 +248,7 @@
</template> </template>
<template #bottom> <template #bottom>
<el-tabs v-model="tabsValue" @tab-click="tabsClick"> <el-tabs v-model="tabsValue" @tab-click="tabsClick">
<el-tab-pane name="0" label="发货单详情"> <el-tab-pane name="0" label="入库商品">
<el-form :model="detailForm" inline>
<el-form-item label="发货单号">
<el-input
v-model="detailForm.billNumber"
placeholder="请输入发货单号"
clearable
style="width: 130px"
/>
</el-form-item>
<el-form-item label="订单号">
<el-input
v-model="detailForm.orderNumber"
placeholder="请输入订单号"
clearable
style="width: 130px"
/>
</el-form-item>
<el-form-item label="生产单号">
<el-input
v-model="detailForm.subOrderNumber"
placeholder="请输入订单号"
clearable
style="width: 130px"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="searchDetail"
>查询</el-button
>
</el-form-item>
</el-form>
<div class="table-wrap"> <div class="table-wrap">
<ElTable size="small" :data="detailList" height="100%" border> <ElTable size="small" :data="detailList" height="100%" border>
<ElTableColumn <ElTableColumn
...@@ -354,77 +261,74 @@ ...@@ -354,77 +261,74 @@
<ElTableColumn <ElTableColumn
show-overflow-tooltip show-overflow-tooltip
align="center" align="center"
label="单号" label="SKU图片"
prop="factory_order_number" prop="factory_order_number"
/> >
<!-- <ElTableColumn <template #default="{ row }">
show-overflow-tooltip <ImageView
align="center" :src="row.skuImage"
label="ERP单号" width="80px"
prop="erp_order_number" height="80px"
/> --> />
</template>
</ElTableColumn>
<ElTableColumn <ElTableColumn
show-overflow-tooltip show-overflow-tooltip
align="center" align="center"
label="发货单号" label="商品SKU"
prop="bill_number" prop="warehouseSku"
/> />
<ElTableColumn <ElTableColumn
show-overflow-tooltip show-overflow-tooltip
align="center" align="center"
label="发货数(件)" label="SKU名称"
prop="num" prop="skuName"
/> />
<ElTableColumn <ElTableColumn
show-overflow-tooltip show-overflow-tooltip
align="center" align="center"
label="质检通过(件)" label="入库数量"
prop="pass_num" prop="buyStored"
/> />
<ElTableColumn <ElTableColumn
show-overflow-tooltip show-overflow-tooltip
align="center" align="center"
label="质检不通过(件)" label="总成本(¥)"
prop="not_pass_num" prop="buyStored"
/> />
<!-- <ElTableColumn
show-overflow-tooltip
align="center"
label="ERP价格"
prop="erp_price"
/> -->
<ElTableColumn <ElTableColumn
show-overflow-tooltip show-overflow-tooltip
align="center" align="center"
label="成本价(¥)" label="不良品数量"
prop="price" prop="rejectsAmount"
/> />
<ElTableColumn <ElTableColumn
show-overflow-tooltip show-overflow-tooltip
align="center" align="center"
label="物流价格(¥)" label="不良品原因"
prop="carriage_amount" prop="rejectsAeason"
/> />
<ElTableColumn <ElTableColumn
show-overflow-tooltip show-overflow-tooltip
align="center" align="center"
label="发货时间" width="240"
prop="shipment_time" label="备注"
prop="remark"
/> />
<ElTableColumn <ElTableColumn
width="100" show-overflow-tooltip
align="center" align="center"
header-align="center" label="创建时间"
label="操作" prop="createTime"
> />
<template #default="{ row }"> <ElTableColumn
<ElButton type="primary" link @click="onDetail(row)" show-overflow-tooltip
>查看详情 align="center"
</ElButton> label="更新时间"
</template> prop="updateTime"
</ElTableColumn> />
</ElTable> </ElTable>
</div> </div>
...@@ -440,7 +344,7 @@ ...@@ -440,7 +344,7 @@
@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;
...@@ -455,125 +359,515 @@ ...@@ -455,125 +359,515 @@
style="display: flex" style="display: flex"
> >
<span style="display: inline-block"> <span style="display: inline-block">
{{ item.create_time }} {{ item.createdTime }}
</span> </span>
<span style="margin: 0 5px 0 20px">{{
item.employee_account
}}</span>
<span style="display: inline-block">{{ <span style="display: inline-block">{{
item.description item.description
}}</span> }}</span>
</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>
</div> </div>
</div> </div>
</div> </div>
<ElDrawer
v-model="shipmentOrderDetailDrawerVisible"
title="发货单详情"
size="50%"
>
<shipmentOrderDetailInfo :detail="shipmentOrderDetail" />
</ElDrawer>
<ElDialog <ElDialog
v-model="confirmOrderVisible" v-model="importDialogVisible"
title="确认对账单" title="导入"
width="500px" width="500px"
:close-on-click-modal="false" :close-on-click-modal="false"
> >
<ElForm ref="auditFormRef" :model="auditForm" label-width="80px"> <div class="import-dialog">
<ElFormItem <div class="import-header">
label="意见" <el-button type="primary" link @click="downloadTemplate">
prop="pass" <el-icon><Download /></el-icon>
:rules="[{ required: true, message: '请选择' }]" 下载模板
> </el-button>
<ElRadioGroup v-model="auditForm.pass"> </div>
<ElRadio :label="1">通过</ElRadio> <div class="import-content">
<ElRadio :label="0">不通过</ElRadio> <UploadExcel v-model="importedFileUrl" />
</ElRadioGroup> </div>
</ElFormItem> </div>
<ElFormItem
label="审核意见"
prop="description"
:rules="
auditForm.pass === 0
? [{ required: true, message: '请输入审核意见' }]
: []
"
>
<ElInput v-model="auditForm.description" type="textarea" />
</ElFormItem>
</ElForm>
<template #footer> <template #footer>
<span class="dialog-footer"> <span class="dialog-footer">
<el-button @click="confirmOrderVisible = false">取消</el-button> <el-button @click="importDialogVisible = false">取消</el-button>
<el-button type="primary" @click="submitConfirmOrder">确认</el-button> <el-button type="primary" @click="submitConfirmOrder">确认</el-button>
</span> </span>
</template> </template>
</ElDialog> </ElDialog>
<ElDialog
v-model="newDialogVisible"
:title="formId ? '编辑' : '新增'"
width="80%"
:close-on-click-modal="false"
>
<div class="dialog-form">
<ElForm
ref="editFormRef"
:model="editForm"
:rules="rules"
inline
label-width="90px"
>
<ElFormItem label="入库单号" prop="account">
<ElInput v-model="editForm.inNo" clearable disabled />
</ElFormItem>
<ElFormItem label="仓库" prop="warehouseId" required>
<ElSelect
v-model="editForm.warehouseId"
clearable
placeholder="请选择仓库"
style="width: 160px"
>
<ElOption
v-for="item in warehouseList"
:key="item.id"
:label="item.name"
:value="item.id"
></ElOption>
</ElSelect>
</ElFormItem>
<ElFormItem label="工厂:" prop="factoryCode">
<span>{{ editForm.factoryCode }}</span>
</ElFormItem>
<ElFormItem label="备注" prop="remark" style="width: 45%">
<ElInput
v-model="editForm.remark"
placeholder="请输入备注"
clearable
/>
</ElFormItem>
</ElForm>
<ElTable
size="small"
:data="otherPurchaseData"
height="500px"
border
@selection-change="productSelectionChange"
>
<ElTableColumn
type="selection"
width="70"
header-align="center"
align="center"
></ElTableColumn>
<ElTableColumn
show-overflow-tooltip
align="center"
width="100"
label="SKU图片"
prop="skuImage"
>
<template #default="{ row }">
<ImageView :src="row.skuImage" width="40px" height="40px" />
</template>
</ElTableColumn>
<ElTableColumn
show-overflow-tooltip
align="center"
label="商品SKU"
prop="warehouseSku"
/>
<ElTableColumn
show-overflow-tooltip
align="center"
label="SKU名称"
prop="skuName"
/>
<ElTableColumn align="center" label="入库数量" prop="buyStored">
<template #default="{ row }">
<el-input
v-model.number="row.buyStored"
placeholder="入库数量"
style="width: 120px"
clearable
size="small"
@input="setCostPrice(row)"
></el-input>
</template>
</ElTableColumn>
<ElTableColumn
width="100"
align="center"
label="成本价(¥)"
prop="costPrice"
/>
<ElTableColumn
align="center"
width="100"
label="总成本(¥)"
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">
<template #default="{ row }">
<!-- +后有就正常展示,没有则通过搜索接口自己添加 -->
<span v-if="row.loacationCode">{{ row.loacationCode }}</span>
<ElSelect
v-else
v-model="row.locationId"
clearable
placeholder="请输入库位"
style="width: 120px"
filterable
remote
:remote-method="(query) => handleLocationSearch(query, row)"
:loading="locationLoading"
@change="(val) => handleLocationChange(val, row)"
>
<ElOption
v-for="item in locationList"
:key="item.locationId"
:label="item.locationCode"
:value="item.locationId"
></ElOption>
</ElSelect>
</template>
</ElTableColumn>
<ElTableColumn
show-overflow-tooltip
align="center"
width="240"
label="备注"
prop="remark"
/>
</ElTable>
</div>
<template #footer>
<div class="product-dialog-footer">
<div>
<el-input
v-model="selectSku"
placeholder="商品SKU"
style="width: 200px; margin: 0 10px"
clearable
size="small"
></el-input>
<el-popover placement="top-start" width="900" trigger="click">
<div v-if="skuData.length > 0" style="height: 50vh">
<ElTable size="small" :data="skuData" height="100%" border>
<ElTableColumn
show-overflow-tooltip
width="60"
align="center"
label="序号"
type="index"
/>
<ElTableColumn
show-overflow-tooltip
align="center"
label="SKU图片"
width="100"
prop="image"
>
<template #default="{ row }">
<ImageView :src="row.image" width="40px" height="40px" />
</template>
</ElTableColumn>
<ElTableColumn
show-overflow-tooltip
align="center"
label="商品SKU"
width="200"
prop="skuName"
/>
<ElTableColumn
show-overflow-tooltip
align="center"
width="200"
label="SKU名称"
prop="sku"
/>
<ElTableColumn
show-overflow-tooltip
align="center"
label="成本价(¥)"
width="100"
prop="factoryPrice"
/>
<ElTableColumn
show-overflow-tooltip
align="center"
label="库位"
prop="loacationCode"
/>
<ElTableColumn
width="100"
align="center"
header-align="center"
label="操作"
>
<template #default="{ row }">
<el-icon :size="32" color="#67C23A"
><CirclePlusFilled @click="skudblclick(row)"
/></el-icon>
</template>
</ElTableColumn>
</ElTable>
</div>
<template #reference>
<el-button
type="primary"
size="small"
style="width: 90px"
@click="selectbySku()"
>
查询
</el-button>
</template>
</el-popover>
<el-button
style="margin-left: 6px"
type="success"
size="small"
@click="addPurchase"
>
批量新增
</el-button>
<el-button
type="danger"
style="margin-left: 10px"
size="small"
@click="deleteOtherWarehousing()"
>
删除
</el-button>
<el-button
type="primary"
style="margin-left: 10px"
size="small"
@click="importData"
>
导入
</el-button>
</div>
<div>
<el-button
size="small"
style="margin-left: 10px"
@click="newDialogVisible = false"
>
取消
</el-button>
<el-button type="primary" size="small" @click="addOtherCurrency()">
保存
</el-button>
</div>
</div>
</template>
</ElDialog>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ElMessage, ElRadioGroup, ElTree, TableColumnCtx } from 'element-plus' import { ElMessage, ElRadioGroup, ElTree, TableColumnCtx } from 'element-plus'
import { Download, 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 {
customJomallReconciliation,
getReconciliationAmount,
getShipmentDetailsById,
auditOrderApi, auditOrderApi,
getShipmentOrderDetailById,
confirmOrderApi,
rejectOrderApi, rejectOrderApi,
getLogListApi, getLogListApi,
exportExcelApi, exportExcelApi,
} from '@/api/order' } from '@/api/order'
import {
getOutRecordStatusTree,
warehouseOutRecordListPage,
getWarehouseInRecordDetailApi,
getBySkuApi,
getWarehouseListApi,
getByWareHouseIdAndCodeApi,
addInRecordApi,
updateInRecordApi,
deleteWarehouseOutRecordApi,
} from '@/api/warehouse'
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 {
CountStatus, warehouseSearchForm,
AccountStatementNote, InterWarehousePage,
ItemList, InterWarehouseDetail,
LogList, InterWarehouseTree,
AccountStatementNoteSearchForm, InterProductList,
} from '@/types/api/billOrder.ts' InterskuList,
import { DetailForm, ShipmentOrderDetailData } from '@/types/api/deliveryNote' InterWarehouseList,
import shipmentOrderDetailInfo from '@/components/ShipmentOrderDetail.vue' ILocation,
} from '@/types/api/warehouse'
import ImageView from '@/components/ImageView.vue' import ImageView from '@/components/ImageView.vue'
import { showConfirm } from '@/utils/ui' import { showConfirm } from '@/utils/ui'
// import { getUserMarkList } from '@/api/auth.ts' import UploadExcel from '@/components/UploadExcel.vue'
import { debounce } from 'lodash-es'
interface Tree { // import UploadExcel from '@/components/INgoVopy.vue'
remark?: string const warehouseList = ref<InterWarehouseList[]>([])
count?: number const pickerOptions = {
code?: string shortcuts: [
children?: Tree[] {
text: '今日',
value: () => {
const start = new Date(new Date(getStartTime()).getTime())
const end = new Date()
return [start, end]
},
},
{
text: '昨天',
value: () => {
const start = new Date()
const end = new Date(new Date(getStartTime()).getTime() - 1)
start.setTime(end.getTime() - 3600 * 1000 * 24 * 1 + 1)
return [start, end]
},
},
{
text: '最近7天',
value: () => {
const end = new Date()
const start = new Date(getStartTime())
start.setTime(start.getTime() - 3600 * 1000 * 24 * 6)
return [start, end]
},
},
{
text: '最近14天',
value: () => {
const end = new Date()
const start = new Date(getStartTime())
start.setTime(start.getTime() - 3600 * 1000 * 24 * 13)
return [start, end]
},
},
{
text: '最近30天',
value: () => {
const end = new Date()
const start = new Date(getStartTime())
start.setTime(start.getTime() - 3600 * 1000 * 24 * 29)
return [start, end]
},
},
{
text: '本星期',
value: () => {
const end = new Date()
const start = new Date()
const nowDay = new Date().getDay() - 1
start.setTime(
new Date(getStartTime()).getTime() - 3600 * 1000 * 24 * nowDay,
)
return [start, end]
},
},
{
text: '上星期',
value: () => {
const end = new Date()
const start = new Date()
const nowDay = new Date().getDay() - 1
end.setTime(
new Date(getStartTime()).getTime() - 3600 * 1000 * 24 * nowDay - 1,
)
start.setTime(end.getTime() - 3600 * 1000 * 24 * 7 + 1)
return [start, end]
},
},
{
text: '这个月',
value: () => {
const end = new Date()
const start = new Date()
const nowDate = new Date().getDate() - 1
start.setTime(
new Date(getStartTime()).getTime() - 3600 * 1000 * 24 * nowDate,
)
return [start, end]
},
},
{
text: '上个月',
value: () => {
const date = new Date()
let year = date.getFullYear()
let month = date.getMonth()
const end = new Date(
new Date(`${year}-${month + 1}-1 00:00:00`).getTime() - 1,
)
if (month === 0) {
month = 12
year = year - 1
}
const start = new Date(
new Date(`${year}-${month}-1 00:00:00`).getTime(),
)
return [start, end]
},
},
{
text: '历史',
value: () => {
return ['', '']
},
},
],
} }
interface SummaryMethodProps<T = AccountStatementNote> { function getStartTime() {
columns: TableColumnCtx<T>[] const date = new Date()
data: T[] const year = date.getFullYear()
const month = date.getMonth() + 1
const day = date.getDate()
return `${year}-${month}-${day} 00:00:00`
} }
// const nameSpaceList = ref<string[]>([]) const selectSku = ref('')
const treeData = ref<CountStatus[]>() const treeData = ref<InterWarehouseTree[]>()
const [searchForm, resetSearchForm] = useValue<AccountStatementNoteSearchForm>( const [searchForm, resetSearchForm] = useValue<warehouseSearchForm>({})
{},
)
const dateRange = ref<string[]>([]) const tradingTime = ref<string[]>([])
const selections = ref<AccountStatementNote[]>([]) const selections = ref<InterWarehousePage[]>([])
const detailList = ref<ItemList[]>([]) const detailList = ref<InterWarehouseDetail[]>([])
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<AccountStatementNote | null>(null) const currentRow = ref<InterWarehousePage | null>(null)
const logList = ref<LogList[]>([]) const logList = ref<LogList[]>([])
const rules = {
warehouseId: [{ required: true, message: '请选择仓库', trigger: 'change' }],
}
const nodeId = ref<number | string>(10) const nodeId = ref<number | string>(10)
const treeRef = ref<InstanceType<typeof ElTree>>() const treeRef = ref<InstanceType<typeof ElTree>>()
...@@ -587,36 +881,31 @@ const { ...@@ -587,36 +881,31 @@ const {
onPageSizeChange: handleSizeChange, onPageSizeChange: handleSizeChange,
} = usePageList({ } = usePageList({
query: (page, pageSize) => query: (page, pageSize) =>
customJomallReconciliation( warehouseOutRecordListPage(
{ {
...searchForm.value, ...searchForm.value,
status: nodeId.value === -1 ? null : nodeId.value, // status: nodeId.value === -1 ? null : nodeId.value,
start_time: dateRange.value && dateRange.value[0], createTimeStart: tradingTime.value && tradingTime.value[0],
end_time: dateRange.value && dateRange.value[1], createTimeEnd: tradingTime.value && tradingTime.value[1],
}, },
page, page,
pageSize, pageSize,
).then((res) => res.data) as never, ).then((res) => res.data) as never,
}) })
const setCostPrice = (item: InterProductList) => {
onMounted(() => { if (!item.costPrice) {
// getNameSpaceList() ElMessage.warning('商品成本价为空,请完善商品成本价')
}) return
}
// const dialogVisible = ref<boolean>(false) const amount = new BigNumber(item.buyStored)
.multipliedBy(item.costPrice)
// const getNameSpaceList = async () => { .toFixed(2)
// try { item.totalPrice = Number(amount)
// const res = await getUserMarkList() }
// nameSpaceList.value = res.data
// } catch (e) {
// // showError(e)
// }
// }
const getTreeNum = async () => { const getTreeNum = async () => {
try { try {
const res = await getReconciliationAmount() const res = await getOutRecordStatusTree()
res.data = [{ code: -1, remark: '全部', children: res.data }] res.data = [{ code: -1, 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(nodeId.value, true)
...@@ -625,14 +914,68 @@ const getTreeNum = async () => { ...@@ -625,14 +914,68 @@ const getTreeNum = async () => {
console.error(e) console.error(e)
} }
} }
const rowClick = (row: AccountStatementNote) => { const getWarehouseList = async () => {
try {
const res = await getWarehouseListApi()
warehouseList.value = res.data
await nextTick(() => {
treeRef.value!.setCurrentKey(nodeId.value, true)
})
} catch (e) {
console.error(e)
}
}
const rowClick = (row: InterWarehousePage) => {
if (!row) { if (!row) {
currentRow.value = null currentRow.value = null
} }
currentRow.value = row currentRow.value = row
tabsClick() tabsClick()
} }
const skuData = ref<InterskuList[]>([])
const selectbySku = async () => {
if (!editForm.value.warehouseId) return ElMessage.error('请选择仓库')
try {
const res = await getBySkuApi(editForm.value.warehouseId, selectSku.value)
skuData.value = res.data || []
fetchLocationList('') //获取该仓库下的所有库位
} catch (e) {
console.error(e)
}
}
const skudblclick = (val: InterskuList) => {
// 使用可选链和空值合并运算符处理可能的null值
const {
locationCode = '',
factoryPrice = 0,
productNo = '',
sku = '',
skuName = '',
image = '',
locationId = '',
} = val || {}
otherPurchaseData.value = [
...otherPurchaseData.value,
{
skuImage: image,
warehouseSku: sku,
skuName,
productNo,
locationCode: locationCode ?? '', // 确保空值处理
locationId: locationId ?? '', // 确保空值处理
costPrice: factoryPrice, ////添加时成本价字段是啥?要提交吗?
buyStored: null,
totalPrice: null,
},
]
// 使用filter代替forEach+splice,时间复杂度从O(n^2)降到O(n)
const skuSet = new Set(
otherPurchaseData.value.map((item: InterProductList) => item.warehouseSku),
)
skuData.value = skuData.value.filter(
(item: InterskuList) => !skuSet.has(item.sku),
)
}
const tabsClick = async () => { const tabsClick = async () => {
if (!currentRow.value) { if (!currentRow.value) {
detailList.value = [] detailList.value = []
...@@ -642,49 +985,72 @@ const tabsClick = async () => { ...@@ -642,49 +985,72 @@ const tabsClick = async () => {
await nextTick() await nextTick()
if (tabsValue.value === '0') { if (tabsValue.value === '0') {
searchDetail() searchDetail()
} else { } else if (tabsValue.value === '1') {
getLogList() getLogList()
} else {
getLogisticsData()
} }
} }
const handleSelectionChange = (v: AccountStatementNote[]) => { const [editForm, resetEditForm] = useValue({
inNo: '',
warehouseId: '',
remark: '',
factoryCode: '',
factoryId: '',
})
const newDialogVisible = ref(false)
const editFormRef = ref()
const editForm2 = ref({})
const formId = ref<number | undefined>(undefined)
const otherPurchaseData = ref<InterProductList[]>([])
const addDialog = async (i: number, v: InterWarehousePage) => {
if (i === 2) {
if (v) formId.value = v.id
// getProduct(v.id)
if (!formId.value) return ElMessage('请勾选至少一条记录')
// v.inWarehouseId = v.warehouseId
// v.inType = v.type
// v.handleUserId = v.makerUserId
editForm.value = JSON.parse(JSON.stringify(v))
} else {
await nextTick()
editForm.value = JSON.parse(JSON.stringify(editForm2.value))
resetEditForm()
const userJson = localStorage.getItem('user')
if (userJson) {
try {
const userData = JSON.parse(userJson)
editForm.value.factoryCode = userData.factoryCode || ''
editForm.value.factoryId = userData.factoryId || 0
} catch {
// ignore
}
}
otherPurchaseData.value = []
formId.value = undefined
}
newDialogVisible.value = true
}
// const getProduct = (id: number) => {
// let url = `otherInWarehouseProductDetails/getProductList?otherOutWarehouseId=${id}`
// get(url).then((res) => {
// if (res.code == 200) {
// otherPurchaseData.value = res.data;
// productData.value = res.data;
// } else {
// this.$alert(res.message, this.$t('错误提示'), {
// dangerouslyUseHTMLString: true,
// })
// }
// })
// }
const handleSelectionChange = (v: InterWarehousePage[]) => {
selections.value = v selections.value = v
} }
const getSummaries = (param: SummaryMethodProps) => { const otherWarehouseSelection = ref<InterProductList[]>([])
const { columns, data } = param const productSelectionChange = (v: InterProductList[]) => {
const sums: string[] = [] otherWarehouseSelection.value = v
columns.forEach(
(column: TableColumnCtx<AccountStatementNote>, index: number) => {
if (index === 0) {
sums[index] = '合计'
return
}
const values = data.map((item: AccountStatementNote) => {
return Number(item[column.property as keyof AccountStatementNote])
})
if (!values.every((value: number) => !isNaN(value))) {
return
}
sums[index] = values
.reduce((prev: number, curr: number) => {
const value = Number(curr)
if (!isNaN(value)) {
return prev + curr
} else {
return prev
}
}, 0)
.toString()
},
)
return sums
} }
const confirmOrderVisible = ref<boolean>(false)
const auditForm = ref({
pass: 1,
description: '',
})
const auditFormRef = ref()
const auditOrder = (key: string) => { const auditOrder = (key: string) => {
let url = '' let url = ''
let text = '' let text = ''
...@@ -737,63 +1103,6 @@ const rejectOrder = () => { ...@@ -737,63 +1103,6 @@ const rejectOrder = () => {
} }
}) })
} }
const confirmOrder = async () => {
if (selections.value.length === 0) {
return ElMessage.warning('请选择要操作的数据')
}
try {
await showConfirm('是否确认对账单?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
} catch {
return
}
const ids = selections.value.map((el) => el.id).join(',')
try {
await confirmOrderApi({
ids,
})
confirmOrderVisible.value = false
ElMessage.success('操作成功')
search()
await getTreeNum()
} catch (e) {
console.error(e)
}
// confirmOrderVisible.value = true
// auditForm.value = {
// pass: 1,
// description: '',
// }
// await nextTick()
// auditFormRef.value!.clearValidate()
}
const submitConfirmOrder = async () => {
try {
await auditFormRef.value?.validate()
} catch {
return
}
const ids = selections.value.map((el) => el.id).join(',')
await confirmOrderApi({
...auditForm.value,
pass: auditForm.value.pass === 0 ? 0 : undefined,
description:
auditForm.value.description === ''
? undefined
: auditForm.value.description,
ids,
})
confirmOrderVisible.value = false
ElMessage.success('操作成功')
search()
await getTreeNum()
if (singleTableRef.value) {
singleTableRef.value!.setCurrentRow(currentRow.value)
}
}
watch( watch(
() => tableData.value, () => tableData.value,
() => { () => {
...@@ -808,22 +1117,142 @@ watch( ...@@ -808,22 +1117,142 @@ watch(
}, },
{ immediate: true }, { immediate: true },
) )
const nodeClick = (data: Tree) => { const addOtherCurrency = async () => {
nodeId.value = data.code ?? '' try {
search() await editFormRef.value?.validate()
} catch {
return
}
const arr = otherPurchaseData.value
if (arr.length === 0) {
ElMessage.error('请至少选择一条数据')
return
}
for (let i = 0; i < arr.length; i++) {
if (!arr[i].buyStored) {
ElMessage.error('请输入入库数量')
return
}
if (!arr[i].locationId) {
ElMessage.error('请选择库位')
return
}
}
// 看新增后要不要打印标签
// try {
// if (!editId.value) {
// await addUserApi({
// ...editForm.value,
// supperMark: Number(editForm.value.supperMark),
// status: Number(editForm.value.status),
// })
// } else {
// await updateUserApi({
// ...editForm.value,
// supperMark: Number(editForm.value.supperMark),
// status: Number(editForm.value.status),
// })
// }
// ElMessage({
// message: '保存成功',
// type: 'success',
// offset: window.innerHeight / 2,
// })
// newDialogVisible.value = false
// search()
// } catch (e) {
// return
// }
if (!formId.value) {
addSection()
} else {
upSection()
}
} }
const shipmentOrderDetailDrawerVisible = ref(false) const addSection = async () => {
const shipmentOrderDetail = ref({} as ShipmentOrderDetailData) const params = { ...editForm.value }
const onDetail = async (row: ItemList) => { params.productList = otherPurchaseData.value
try { try {
const res = await getShipmentOrderDetailById(row.shipment_id) await addInRecordApi(params)
shipmentOrderDetail.value = res.data ElMessage.success('保存成功')
shipmentOrderDetailDrawerVisible.value = true newDialogVisible.value = false
search()
await getTreeNum()
} catch (e) { } catch (e) {
console.error(e) console.error(e)
} }
// post(url, params).then((res: any) => {
// if (res.code === 200) {
// otherDialogVisible.value = false;
// ElConfirm('保存成功,是否打印标签?', '提示', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning',
// })
// .then(() => {
// if (res.message) {
// getPrintData(res.message, true);
// } else {
// ElMessage.warning('入口单号为空,无法打印');
// }
// })
// .catch((e: any) => {
// console.error(e);
// });
// getList();
// getStatusAmount();
// } else {
// ElAlert(res.message, '错误提示', {
// dangerouslyUseHTMLString: true,
// });
// }
// });
}
const upSection = async () => {
const params = { ...editForm.value }
params.productList = otherPurchaseData.value
try {
await updateInRecordApi(params)
newDialogVisible.value = false
ElMessage.success('修改成功')
search()
await getTreeNum()
} catch (e) {
console.error(e)
}
}
const addPurchase = async () => {
if (!editForm.value.warehouseId) return ElMessage.error('请选择仓库')
}
const deleteOtherWarehousing = () => {
const arr = otherWarehouseSelection.value
if (arr.length === 0) return
const idList = arr.map((v: InterProductList) => v.warehouseSku)
otherPurchaseData.value = otherPurchaseData.value.filter(
(item: InterProductList) => !idList.includes(item.warehouseSku),
)
}
const importData = async () => {
if (!editForm.value.warehouseId) return ElMessage.error('请选择仓库')
}
const handleBatchDelete = async () => {
if (!selections.value.length) {
return ElMessage.warning('请选择要删除的数据')
}
await ElMessageBox.confirm('确定要删除吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
const str = selections.value.map((el: InterWarehousePage) => el.id).join(',')
await deleteWarehouseOutRecordApi(str)
ElMessage.success('删除成功')
await search()
}
const nodeClick = (data: InterWarehouseTree) => {
nodeId.value = data.code ?? ''
search()
} }
const detailForm = ref({} as DetailForm)
const detailPager = ref({ const detailPager = ref({
page: 1, page: 1,
rows: 100, rows: 100,
...@@ -831,15 +1260,9 @@ const detailPager = ref({ ...@@ -831,15 +1260,9 @@ const detailPager = ref({
}) })
const searchDetail = async () => { const searchDetail = async () => {
try { try {
const res = await getShipmentDetailsById({ const res = await getWarehouseInRecordDetailApi(currentRow.value?.id)
...detailForm.value,
page: detailPager.value.page,
rows: detailPager.value.rows,
infoId: currentRow.value?.id,
})
detailList.value = res.data.records || [] detailList.value = res.data.records || []
detailPager.value.total = res.data.total detailPager.value.total = res.data.total
// logList.value = res.data.logList || []
} catch (e) { } catch (e) {
console.error(e) console.error(e)
} }
...@@ -848,11 +1271,31 @@ const getLogList = async () => { ...@@ -848,11 +1271,31 @@ const getLogList = async () => {
try { try {
const res = await getLogListApi(currentRow.value?.id) const res = await getLogListApi(currentRow.value?.id)
logList.value = res.data logList.value = res.data
// logList.value = res.data.logList || []
} 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 () => { const exportExcel = async () => {
if (selections.value.length === 0) { if (selections.value.length === 0) {
return ElMessage.warning('请选择要操作的数据') return ElMessage.warning('请选择要操作的数据')
...@@ -865,19 +1308,64 @@ const exportExcel = async () => { ...@@ -865,19 +1308,64 @@ const exportExcel = async () => {
console.error(e) console.error(e)
} }
} }
const locationList = ref<ILocation[]>([])
const locationLoading = ref(false)
const fetchLocationList = async (query: string) => {
// if (!query) {
// locationList.value = []
// return
// }
locationLoading.value = true
try {
const res = await getByWareHouseIdAndCodeApi(
editForm.value.warehouseId,
query,
)
const result = res.data || []
locationList.value = result.map((item: ILocation) => {
return {
locationId: item.id,
locationCode: item.locationCode,
}
})
} catch (e) {
locationList.value = []
} finally {
locationLoading.value = false
}
}
// 输入2秒后再调用接口(节流)
const handleLocationSearch = debounce(fetchLocationList, 2000)
const handleLocationChange = (val: number, row: InterProductList) => {
const found = locationList.value.find(
(item: InterProductList) => item.locationId === val,
)
row.locationCode = found ? found.locationCode : ''
}
onMounted(() => { onMounted(() => {
getTreeNum() getTreeNum()
getWarehouseList()
}) })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.dialog-footer {
display: inline-block;
width: 500px;
text-align: center;
}
.header-filter-form { .header-filter-form {
:deep(.el-form-item) { :deep(.el-form-item) {
margin-right: 14px; margin-right: 14px;
margin-bottom: 10px; margin-bottom: 10px;
} }
} }
.product-dialog-footer {
display: flex;
justify-content: space-between;
margin: 8px 0;
}
$border: solid 1px #ddd; $border: solid 1px #ddd;
.send-order-list { .send-order-list {
...@@ -917,10 +1405,6 @@ $border: solid 1px #ddd; ...@@ -917,10 +1405,6 @@ $border: solid 1px #ddd;
width: 100px; width: 100px;
} }
.dialog-footer {
text-align: center;
}
.delivery-note-list { .delivery-note-list {
:deep(.vertical-align-top) { :deep(.vertical-align-top) {
vertical-align: top; vertical-align: top;
...@@ -1060,4 +1544,42 @@ $border: solid 1px #ddd; ...@@ -1060,4 +1544,42 @@ $border: solid 1px #ddd;
height: 100%; height: 100%;
} }
} }
.import-dialog {
.import-header {
display: flex;
justify-content: flex-end;
}
.import-content {
padding: 20px 0;
}
}
.import-success {
text-align: center;
padding: 20px 0;
.success-icon {
font-size: 48px;
margin-bottom: 16px;
}
.success-text {
font-size: 16px;
color: #67c23a;
margin-bottom: 16px;
}
.file-link {
a {
color: #409eff;
text-decoration: none;
&:hover {
text-decoration: underline;
}
}
}
}
</style> </style>
...@@ -99,7 +99,9 @@ ...@@ -99,7 +99,9 @@
<div class="btn-list"> <div class="btn-list">
<el-button type="primary" @click="addDialog(1)"> 新增 </el-button> <el-button type="primary" @click="addDialog(1)"> 新增 </el-button>
<el-button type="danger" @click="rejectOrder"> 驳回 </el-button> <el-button type="danger" @click="rejectOrder"> 驳回 </el-button>
<el-button type="danger" @click="rejectOrder"> 删除 </el-button> <el-button type="danger" @click="handleBatchDelete">
删除
</el-button>
<el-button type="warning" @click="importExcel"> 导入 </el-button> <el-button type="warning" @click="importExcel"> 导入 </el-button>
<el-button type="success" @click="exportExcel"> 导出 </el-button> <el-button type="success" @click="exportExcel"> 导出 </el-button>
<el-button type="primary" @click="exportExcel"> <el-button type="primary" @click="exportExcel">
...@@ -498,11 +500,11 @@ ...@@ -498,11 +500,11 @@
<template #default="{ row }"> <template #default="{ row }">
<el-input <el-input
v-model.number="row.buyStored" v-model.number="row.buyStored"
@input="setCostPrice(row)"
placeholder="入库数量" placeholder="入库数量"
style="width: 120px" style="width: 120px"
clearable clearable
size="small" size="small"
@input="setCostPrice(row)"
></el-input> ></el-input>
</template> </template>
</ElTableColumn> </ElTableColumn>
...@@ -631,7 +633,7 @@ ...@@ -631,7 +633,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>
...@@ -705,14 +707,15 @@ import { ...@@ -705,14 +707,15 @@ import {
exportExcelApi, exportExcelApi,
} from '@/api/order' } from '@/api/order'
import { import {
getWarehouseStatusTree, getInRecordStatusTree,
warehouseInRecordListPage, warehouseInRecordListPageApi,
getWarehouseInRecordDetail, getWarehouseInRecordDetailApi,
getBySku, getBySkuApi,
getWarehouseListApi, getWarehouseListApi,
getByWareHouseIdAndCode, getByWareHouseIdAndCodeApi,
addInRecordApi, addInRecordApi,
updateInRecordApi, updateInRecordApi,
deleteWarehouseInRecordApi,
} 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'
...@@ -851,12 +854,6 @@ function getStartTime() { ...@@ -851,12 +854,6 @@ function getStartTime() {
const day = date.getDate() const day = date.getDate()
return `${year}-${month}-${day} 00:00:00` return `${year}-${month}-${day} 00:00:00`
} }
interface Tree {
remark?: string
count?: number
code?: string
children?: Tree[]
}
const selectSku = ref('') const selectSku = ref('')
const treeData = ref<InterWarehouseTree[]>() const treeData = ref<InterWarehouseTree[]>()
const [searchForm, resetSearchForm] = useValue<warehouseSearchForm>({}) const [searchForm, resetSearchForm] = useValue<warehouseSearchForm>({})
...@@ -884,7 +881,7 @@ const { ...@@ -884,7 +881,7 @@ const {
onPageSizeChange: handleSizeChange, onPageSizeChange: handleSizeChange,
} = usePageList({ } = usePageList({
query: (page, pageSize) => query: (page, pageSize) =>
warehouseInRecordListPage( warehouseInRecordListPageApi(
{ {
...searchForm.value, ...searchForm.value,
// status: nodeId.value === -1 ? null : nodeId.value, // status: nodeId.value === -1 ? null : nodeId.value,
...@@ -907,7 +904,7 @@ const setCostPrice = (item: InterProductList) => { ...@@ -907,7 +904,7 @@ const setCostPrice = (item: InterProductList) => {
} }
const getTreeNum = async () => { const getTreeNum = async () => {
try { try {
const res = await getWarehouseStatusTree() const res = await getInRecordStatusTree()
res.data = [{ code: -1, name: '全部', children: res.data }] res.data = [{ code: -1, name: '全部', children: res.data }]
treeData.value = res.data treeData.value = res.data
await nextTick(() => { await nextTick(() => {
...@@ -939,7 +936,7 @@ const skuData = ref<InterskuList[]>([]) ...@@ -939,7 +936,7 @@ const skuData = ref<InterskuList[]>([])
const selectbySku = async () => { const selectbySku = async () => {
if (!editForm.value.warehouseId) return ElMessage.error('请选择仓库') if (!editForm.value.warehouseId) return ElMessage.error('请选择仓库')
try { try {
const res = await getBySku(editForm.value.warehouseId, selectSku.value) const res = await getBySkuApi(editForm.value.warehouseId, selectSku.value)
skuData.value = res.data || [] skuData.value = res.data || []
fetchLocationList('') //获取该仓库下的所有库位 fetchLocationList('') //获取该仓库下的所有库位
} catch (e) { } catch (e) {
...@@ -1039,7 +1036,6 @@ const addDialog = async (i: number, v: InterWarehousePage) => { ...@@ -1039,7 +1036,6 @@ const addDialog = async (i: number, v: InterWarehousePage) => {
// get(url).then((res) => { // get(url).then((res) => {
// if (res.code == 200) { // if (res.code == 200) {
// otherPurchaseData.value = res.data; // otherPurchaseData.value = res.data;
// productData.value = res.data;
// } else { // } else {
// this.$alert(res.message, this.$t('错误提示'), { // this.$alert(res.message, this.$t('错误提示'), {
// dangerouslyUseHTMLString: true, // dangerouslyUseHTMLString: true,
...@@ -1050,9 +1046,9 @@ const addDialog = async (i: number, v: InterWarehousePage) => { ...@@ -1050,9 +1046,9 @@ const addDialog = async (i: number, v: InterWarehousePage) => {
const handleSelectionChange = (v: InterWarehousePage[]) => { const handleSelectionChange = (v: InterWarehousePage[]) => {
selections.value = v selections.value = v
} }
const productSelection = ref<InterProductList[]>([]) const otherWarehouseSelection = ref<InterProductList[]>([])
const productSelectionChange = (v: InterProductList[]) => { const productSelectionChange = (v: InterProductList[]) => {
productSelection.value = v otherWarehouseSelection.value = v
} }
const auditOrder = (key: string) => { const auditOrder = (key: string) => {
let url = '' let url = ''
...@@ -1224,12 +1220,35 @@ const upSection = async () => { ...@@ -1224,12 +1220,35 @@ const upSection = async () => {
console.error(e) console.error(e)
} }
} }
const addPurchase = async () => {} const addPurchase = async () => {
const deleteOtherWarehousing = async () => {} if (!editForm.value.warehouseId) return ElMessage.error('请选择仓库')
}
const deleteOtherWarehousing = () => {
const arr = otherWarehouseSelection.value
if (arr.length === 0) return
const idList = arr.map((v: InterProductList) => v.warehouseSku)
otherPurchaseData.value = otherPurchaseData.value.filter(
(item: InterProductList) => !idList.includes(item.warehouseSku),
)
}
const importData = async () => { const importData = async () => {
if (!editForm.value.warehouseId) return ElMessage.error('请选择仓库') if (!editForm.value.warehouseId) return ElMessage.error('请选择仓库')
} }
const nodeClick = (data: Tree) => { const handleBatchDelete = async () => {
if (!selections.value.length) {
return ElMessage.warning('请选择要删除的数据')
}
await ElMessageBox.confirm('确定要删除吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
const str = selections.value.map((el: InterWarehousePage) => el.id).join(',')
await deleteWarehouseInRecordApi(str)
ElMessage.success('删除成功')
await search()
}
const nodeClick = (data: InterWarehouseTree) => {
nodeId.value = data.code ?? '' nodeId.value = data.code ?? ''
search() search()
} }
...@@ -1240,7 +1259,7 @@ const detailPager = ref({ ...@@ -1240,7 +1259,7 @@ const detailPager = ref({
}) })
const searchDetail = async () => { const searchDetail = async () => {
try { try {
const res = await getWarehouseInRecordDetail(currentRow.value?.id) const res = await getWarehouseInRecordDetailApi(currentRow.value?.id)
detailList.value = res.data.records || [] detailList.value = res.data.records || []
detailPager.value.total = res.data.total detailPager.value.total = res.data.total
} catch (e) { } catch (e) {
...@@ -1255,7 +1274,7 @@ const getLogList = async () => { ...@@ -1255,7 +1274,7 @@ const getLogList = async () => {
console.error(e) console.error(e)
} }
} }
const logisticsData = ref([]) // const logisticsData = ref([])
const getLogisticsData = async () => { const getLogisticsData = async () => {
// try { // try {
// const res = await getLogisticsDataApi(currentRow.value?.id) // const res = await getLogisticsDataApi(currentRow.value?.id)
...@@ -1298,7 +1317,10 @@ const fetchLocationList = async (query: string) => { ...@@ -1298,7 +1317,10 @@ const fetchLocationList = async (query: string) => {
// } // }
locationLoading.value = true locationLoading.value = true
try { try {
const res = await getByWareHouseIdAndCode(editForm.value.warehouseId, query) const res = await getByWareHouseIdAndCodeApi(
editForm.value.warehouseId,
query,
)
const result = res.data || [] const result = res.data || []
locationList.value = result.map((item: ILocation) => { locationList.value = result.map((item: ILocation) => {
return { return {
...@@ -1332,6 +1354,9 @@ onMounted(() => { ...@@ -1332,6 +1354,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;
......
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