1
This commit is contained in:
parent
0706a48664
commit
5aa1741c72
|
|
@ -52,3 +52,12 @@ export function createOrderOut(data){
|
|||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
//修改出库通知单
|
||||
export function updateOrderOut(data){
|
||||
return request({
|
||||
url: '/app/pms/updateOrderOut',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -230,6 +230,9 @@
|
|||
<template v-if="col.prop === 'goodsStatus'">
|
||||
{{scope.row.goodsStatus=='1'?'禁用':'启用'}}
|
||||
</template>
|
||||
<template v-else-if="col.prop === 'goodsUnit'">
|
||||
<dict-tag :options="dict.type.goods_unit" :value="scope.row.goodsUnit"/>
|
||||
</template>
|
||||
<template v-else-if="col.type === 'number'">
|
||||
<span class="number-column">{{ scope.row[col.prop] }}</span>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -22,18 +22,13 @@
|
|||
<template slot-scope="{ item }">
|
||||
<div class="material-item">
|
||||
<div class="material-code">{{ item.goodsId }}</div>
|
||||
<div class="material-desc">{{ item.goodsName }}</div>
|
||||
<div class="material-desc">{{ item.goodsDesc }}</div>
|
||||
<div class="material-divider"></div>
|
||||
</div>
|
||||
</template>
|
||||
</el-autocomplete>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="物料名称" prop="goodsName">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.goodsName" readonly placeholder="物料名称" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="物料描述" prop="goodsDesc">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.goodsDesc" readonly placeholder="物料描述" />
|
||||
|
|
@ -122,7 +117,6 @@ export default {
|
|||
mockData.push({
|
||||
value: item.goodsId,
|
||||
goodsId: item.goodsId,
|
||||
goodsName: item.goodsName,
|
||||
goodsDesc: item.goodsDesc
|
||||
});
|
||||
});
|
||||
|
|
@ -140,7 +134,6 @@ export default {
|
|||
// console.log("item",item );
|
||||
// this.$set(this.tableData[index], 'goodsId', item.goodsId);
|
||||
// this.$set(this.tableData[index], 'goodsDesc', item.goodsDesc);
|
||||
// this.$set(this.tableData[index], 'goodsName', item.goodsName);
|
||||
// this.$set(this.tableData[index], 'remainNum', item.remainNum);
|
||||
// },
|
||||
|
||||
|
|
@ -167,7 +160,7 @@ export default {
|
|||
this.$emit('update:visible', false);
|
||||
this.resetForm();
|
||||
},
|
||||
// 选择物料后,更新 goodsName 和 goodsDesc
|
||||
// 选择物料后,更新 goodsDesc
|
||||
handleMaterialSelect(index,item){
|
||||
console.log("handleMaterialSelect",index);
|
||||
const selectedItem = this.tableData[index];
|
||||
|
|
@ -175,14 +168,12 @@ export default {
|
|||
// 模拟API返回的数据
|
||||
// const selectedMaterial = {
|
||||
// goodsId: selectedItem.goodsId,
|
||||
// goodsName: '物料名称示例', // 需要从接口获取实际物料名称
|
||||
// goodsDesc: '物料描述示例' // 需要从接口获取实际物料描述
|
||||
// };
|
||||
|
||||
this.$set(this.tableData, index, {
|
||||
...selectedItem,
|
||||
goodsId: item.goodsId, // 更新物料编码
|
||||
goodsName: item.goodsName, // 更新物料名称
|
||||
goodsDesc: item.goodsDesc, // 更新物料描述
|
||||
remainNum: item.remainNum, // 更新库存数量
|
||||
goodsNum: item.remainNum
|
||||
|
|
|
|||
|
|
@ -82,6 +82,16 @@
|
|||
v-hasPermi="['app:pmsOrderOut:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleImport"
|
||||
v-hasPermi="['app:pmsOrderOut:import']"
|
||||
>导入</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
|
|
@ -134,24 +144,6 @@
|
|||
</el-table-column>
|
||||
<el-table-column label="操作人" align="center" prop="createBy" />
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['app:pmsOrderOut:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['app:pmsOrderOut:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
|
|
@ -165,31 +157,25 @@
|
|||
<!-- 添加或修改出库单对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-table v-model="form.goodsList" :data="form.goodsList" style="width: 100%">
|
||||
<el-table-column label="物料号" prop="goodsId">
|
||||
<el-table :data="tableData" style="width: 100%">
|
||||
<el-table-column label="物料编码" width="280">
|
||||
<template slot-scope="scope">
|
||||
<el-autocomplete
|
||||
:value="queryGoods"
|
||||
v-model="scope.row.goodsId"
|
||||
:fetch-suggestions="searchGoods"
|
||||
placeholder="请输入物料号"
|
||||
@select="handleSelectGoods(scope.row)"
|
||||
:debounce="300"
|
||||
></el-autocomplete>
|
||||
:trigger-on-focus="false"
|
||||
placeholder="请输入物料编码或名称"
|
||||
clearable
|
||||
@select="handleMaterialSelect(scope.$index,$event)"
|
||||
>
|
||||
<template slot-scope="{ item }">
|
||||
<div class="material-item">
|
||||
<div class="material-code">{{ item.goodsId }}</div>
|
||||
<div class="material-divider"></div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="物料名称" prop="goodsName">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.goodsName" disabled placeholder="物料名称" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="库存数量" prop="stockQty">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.stockQty" disabled placeholder="库存数量" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="出库数量" prop="goodsNum">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.goodsNum" placeholder="请输入出库数量" />
|
||||
</el-autocomplete>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="物料描述" prop="goodsDesc">
|
||||
|
|
@ -197,6 +183,16 @@
|
|||
<el-input v-model="scope.row.goodsDesc" placeholder="请输入物料描述" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="库存数量" prop="stockNum">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.stockNum" disabled placeholder="库存数量" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="出库数量" prop="goodsNum">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.goodsNum" placeholder="请输入出库数量" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
|
|
@ -209,13 +205,32 @@
|
|||
:visible.sync="dialogVisible"
|
||||
@submit="handleDialogSubmit"
|
||||
/>
|
||||
|
||||
<!-- 导入 -->
|
||||
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
|
||||
<el-upload ref="upload" :limit="1" accept=".xlsx, .xls" :headers="upload.headers" :action="upload.url" :disabled="upload.isUploading" :on-progress="handleFileUploadProgress"
|
||||
:on-success="handleFileSuccess" :auto-upload="false" drag>
|
||||
<i class="el-icon-upload"></i>
|
||||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||||
<div class="el-upload__tip text-center" slot="tip">
|
||||
<span>仅允许导入xls、xlsx格式文件。</span>
|
||||
<el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate">下载模板</el-link>
|
||||
</div>
|
||||
</el-upload>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitFileForm">确 定</el-button>
|
||||
<el-button @click="upload.open = false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listPmsOrderOut, getPmsOrderOut, delPmsOrderOut, addPmsOrderOut, updatePmsOrderOut,createOrderOut } from "@/api/system/pmsOrderOut";
|
||||
import { listPmsOrderOut, getPmsOrderOut, delPmsOrderOut, addPmsOrderOut, updatePmsOrderOut,createOrderOut,updateOrderOut } from "@/api/system/pmsOrderOut";
|
||||
import {createOutRequestByPmsOrders} from "@/api/system/task";
|
||||
import OutboundDialog from './components/OutboundDialog'
|
||||
import {getToken} from "@/utils/auth";
|
||||
import { queryListByGoodsId } from "@/api/system/stock";
|
||||
export default {
|
||||
name: "PmsOrderOut",
|
||||
components: {
|
||||
|
|
@ -225,6 +240,14 @@ export default {
|
|||
data() {
|
||||
|
||||
return {
|
||||
queryGoods: "",
|
||||
upload: {
|
||||
open: false,
|
||||
title: '上传文件',
|
||||
headers: { Authorization: 'Bearer ' + getToken() },
|
||||
url: process.env.VUE_APP_BASE_API + '/app/pmsOrderOut/importData', // 确保这里填写正确的上传URL
|
||||
isUploading: false
|
||||
},
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
|
|
@ -255,11 +278,17 @@ export default {
|
|||
isLock: null
|
||||
},
|
||||
// 表单参数
|
||||
form: {
|
||||
goodsList: [
|
||||
{ goodsId: '11', goodsName: '11', stockQty: '11', goodsNum: '', goodsDesc: '' }
|
||||
]
|
||||
},
|
||||
form: {},
|
||||
// tableData:[],
|
||||
tableData: [
|
||||
{
|
||||
stockId: Date.now(),
|
||||
goodsId: '',
|
||||
goodsDesc: '',
|
||||
goodsNum: 1, // 统一使用 goodsNum
|
||||
remainNum: 0
|
||||
}
|
||||
],
|
||||
// 表单校验
|
||||
rules: {
|
||||
recordId: [
|
||||
|
|
@ -365,6 +394,8 @@ export default {
|
|||
const recordId = row.recordId || this.ids
|
||||
getPmsOrderOut(recordId).then(response => {
|
||||
this.form = response.data;
|
||||
this.tableData = [this.form]
|
||||
console.log(this.tableData)
|
||||
this.open = true;
|
||||
this.title = "修改出库单";
|
||||
});
|
||||
|
|
@ -378,6 +409,7 @@ export default {
|
|||
goodsId: element.goodsId,
|
||||
goodsNum: element.goodsNum,
|
||||
goodsDesc: element.goodsDesc,
|
||||
remainNum: element.remainNum,
|
||||
inner: true
|
||||
});
|
||||
});
|
||||
|
|
@ -390,21 +422,26 @@ export default {
|
|||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
|
||||
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.recordId != null) {
|
||||
updatePmsOrderOut(this.form).then(response => {
|
||||
this.form = this.tableData[0]
|
||||
console.log(this.form)
|
||||
updateOrderOut(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addPmsOrderOut(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
// else {
|
||||
// addPmsOrderOut(this.form).then(response => {
|
||||
// this.$modal.msgSuccess("新增成功");
|
||||
// this.open = false;
|
||||
// this.getList();
|
||||
// });
|
||||
// }
|
||||
}
|
||||
});
|
||||
},
|
||||
|
|
@ -463,34 +500,82 @@ export default {
|
|||
this.download('app/pmsOrderOut/export', {
|
||||
...this.queryParams
|
||||
}, `pmsOrderOut_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
},
|
||||
// 模糊搜索物料
|
||||
searchGoods(queryString, cb) {
|
||||
// 这里可以调用 API 或从本地数据中筛选匹配的物料
|
||||
const goodsData = [
|
||||
{ goodsId: '123', goodsName: '物料A', stockQty: 100 },
|
||||
{ goodsId: '456', goodsName: '物料B', stockQty: 200 },
|
||||
{ goodsId: '789', goodsName: '物料C', stockQty: 50 },
|
||||
];
|
||||
const results = goodsData.filter(item => item.goodsId.includes(queryString));
|
||||
cb(results);
|
||||
handleImport() {
|
||||
this.upload.title = '导入';
|
||||
this.upload.open = true;
|
||||
},
|
||||
/** 下载模板操作 */
|
||||
importTemplate() {
|
||||
this.download('/app/pmsOrderOut/importTemplate', {}, `app_pmsOrderOut_${new Date().getTime()}.xlsx`);
|
||||
},
|
||||
// 文件上传中处理
|
||||
handleFileUploadProgress(event, file, fileList) {
|
||||
this.upload.isUploading = true;
|
||||
},
|
||||
// 文件上传成功处理
|
||||
handleFileSuccess(response, file, fileList) {
|
||||
this.upload.open = false;
|
||||
this.upload.isUploading = false;
|
||||
this.$refs.upload.clearFiles();
|
||||
this.$alert(
|
||||
"<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
|
||||
response.msg +
|
||||
'</div>',
|
||||
'导入结果',
|
||||
{ dangerouslyUseHTMLString: true },
|
||||
);
|
||||
this.getList();
|
||||
},
|
||||
// 提交上传文件
|
||||
submitFileForm() {
|
||||
this.$refs.upload.submit();
|
||||
},
|
||||
// 搜索物料
|
||||
async searchGoods(query, callback) {
|
||||
if (query.length < 2) {
|
||||
callback([]);
|
||||
return;
|
||||
}
|
||||
|
||||
const queryParams = {
|
||||
goodsId: query
|
||||
};
|
||||
let mockData = [];
|
||||
await queryListByGoodsId(queryParams).then(response => {
|
||||
if(response.code === 200){
|
||||
console.log(response.data)
|
||||
response.data.forEach(item => {
|
||||
mockData.push({
|
||||
// value: item.goodsId,
|
||||
goodsId: item.goodsId,
|
||||
goodsDesc: item.goodsDesc
|
||||
});
|
||||
});
|
||||
mockData = response.data;
|
||||
}
|
||||
});
|
||||
callback(mockData);
|
||||
|
||||
},
|
||||
|
||||
// 选择物料后填充物料名称和库存数量
|
||||
handleSelectGoods(row) {
|
||||
// 查找并填充物料名称和库存数量
|
||||
const selectedGoods = [
|
||||
{ goodsId: '123', goodsName: '物料A', stockQty: 100 },
|
||||
{ goodsId: '456', goodsName: '物料B', stockQty: 200 },
|
||||
{ goodsId: '789', goodsName: '物料C', stockQty: 50 },
|
||||
].find(item => item.goodsId === row.goodsId);
|
||||
// 选择物料后,更新 goodsDesc
|
||||
handleMaterialSelect(index,item){
|
||||
console.log("handleMaterialSelect",index);
|
||||
const selectedItem = this.tableData[index];
|
||||
console.log("selectedItem",selectedItem);
|
||||
|
||||
if (selectedGoods) {
|
||||
row.goodsName = selectedGoods.goodsName;
|
||||
row.stockQty = selectedGoods.stockQty;
|
||||
this.$set(this.tableData, index, {
|
||||
...selectedItem,
|
||||
goodsId: item.goodsId, // 更新物料编码
|
||||
goodsDesc: item.goodsDesc, // 更新物料描述
|
||||
remainNum: item.remainNum, // 更新库存数量
|
||||
goodsNum: item.remainNum
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user