This commit is contained in:
15066119699 2025-03-11 21:17:13 +08:00
parent 0706a48664
commit 5aa1741c72
4 changed files with 185 additions and 97 deletions

View File

@ -52,3 +52,12 @@ export function createOrderOut(data){
data: data data: data
}) })
} }
//修改出库通知单
export function updateOrderOut(data){
return request({
url: '/app/pms/updateOrderOut',
method: 'post',
data: data
})
}

View File

@ -230,6 +230,9 @@
<template v-if="col.prop === 'goodsStatus'"> <template v-if="col.prop === 'goodsStatus'">
{{scope.row.goodsStatus=='1'?'禁用':'启用'}} {{scope.row.goodsStatus=='1'?'禁用':'启用'}}
</template> </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'"> <template v-else-if="col.type === 'number'">
<span class="number-column">{{ scope.row[col.prop] }}</span> <span class="number-column">{{ scope.row[col.prop] }}</span>
</template> </template>

View File

@ -22,18 +22,13 @@
<template slot-scope="{ item }"> <template slot-scope="{ item }">
<div class="material-item"> <div class="material-item">
<div class="material-code">{{ item.goodsId }}</div> <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 class="material-divider"></div>
</div> </div>
</template> </template>
</el-autocomplete> </el-autocomplete>
</template> </template>
</el-table-column> </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"> <el-table-column label="物料描述" prop="goodsDesc">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.goodsDesc" readonly placeholder="物料描述" /> <el-input v-model="scope.row.goodsDesc" readonly placeholder="物料描述" />
@ -122,7 +117,6 @@ export default {
mockData.push({ mockData.push({
value: item.goodsId, value: item.goodsId,
goodsId: item.goodsId, goodsId: item.goodsId,
goodsName: item.goodsName,
goodsDesc: item.goodsDesc goodsDesc: item.goodsDesc
}); });
}); });
@ -140,7 +134,6 @@ export default {
// console.log("item",item ); // console.log("item",item );
// this.$set(this.tableData[index], 'goodsId', item.goodsId); // this.$set(this.tableData[index], 'goodsId', item.goodsId);
// this.$set(this.tableData[index], 'goodsDesc', item.goodsDesc); // this.$set(this.tableData[index], 'goodsDesc', item.goodsDesc);
// this.$set(this.tableData[index], 'goodsName', item.goodsName);
// this.$set(this.tableData[index], 'remainNum', item.remainNum); // this.$set(this.tableData[index], 'remainNum', item.remainNum);
// }, // },
@ -167,7 +160,7 @@ export default {
this.$emit('update:visible', false); this.$emit('update:visible', false);
this.resetForm(); this.resetForm();
}, },
// goodsName goodsDesc // goodsDesc
handleMaterialSelect(index,item){ handleMaterialSelect(index,item){
console.log("handleMaterialSelect",index); console.log("handleMaterialSelect",index);
const selectedItem = this.tableData[index]; const selectedItem = this.tableData[index];
@ -175,14 +168,12 @@ export default {
// API // API
// const selectedMaterial = { // const selectedMaterial = {
// goodsId: selectedItem.goodsId, // goodsId: selectedItem.goodsId,
// goodsName: '', //
// goodsDesc: '' // // goodsDesc: '' //
// }; // };
this.$set(this.tableData, index, { this.$set(this.tableData, index, {
...selectedItem, ...selectedItem,
goodsId: item.goodsId, // goodsId: item.goodsId, //
goodsName: item.goodsName, //
goodsDesc: item.goodsDesc, // goodsDesc: item.goodsDesc, //
remainNum: item.remainNum, // remainNum: item.remainNum, //
goodsNum: item.remainNum goodsNum: item.remainNum

View File

@ -82,6 +82,16 @@
v-hasPermi="['app:pmsOrderOut:export']" v-hasPermi="['app:pmsOrderOut:export']"
>导出</el-button> >导出</el-button>
</el-col> </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-col :span="1.5">
<el-button <el-button
type="warning" type="warning"
@ -134,24 +144,6 @@
</el-table-column> </el-table-column>
<el-table-column label="操作人" align="center" prop="createBy" /> <el-table-column label="操作人" align="center" prop="createBy" />
<el-table-column label="创建时间" align="center" prop="createTime" /> <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> </el-table>
<pagination <pagination
@ -165,31 +157,25 @@
<!-- 添加或修改出库单对话框 --> <!-- 添加或修改出库单对话框 -->
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <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 :data="tableData" style="width: 100%">
<el-table-column label="物料号" prop="goodsId"> <el-table-column label="物料编码" width="280">
<template slot-scope="scope"> <template slot-scope="scope">
<el-autocomplete <el-autocomplete
:value="queryGoods"
v-model="scope.row.goodsId" v-model="scope.row.goodsId"
:fetch-suggestions="searchGoods" :fetch-suggestions="searchGoods"
placeholder="请输入物料号" :trigger-on-focus="false"
@select="handleSelectGoods(scope.row)" placeholder="请输入物料编码或名称"
:debounce="300" clearable
></el-autocomplete> @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> </template>
</el-table-column> </el-autocomplete>
<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="请输入出库数量" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="物料描述" prop="goodsDesc"> <el-table-column label="物料描述" prop="goodsDesc">
@ -197,6 +183,16 @@
<el-input v-model="scope.row.goodsDesc" placeholder="请输入物料描述" /> <el-input v-model="scope.row.goodsDesc" placeholder="请输入物料描述" />
</template> </template>
</el-table-column> </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-table>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
@ -209,13 +205,32 @@
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
@submit="handleDialogSubmit" @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>仅允许导入xlsxlsx格式文件</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> </div>
</template> </template>
<script> <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 {createOutRequestByPmsOrders} from "@/api/system/task";
import OutboundDialog from './components/OutboundDialog' import OutboundDialog from './components/OutboundDialog'
import {getToken} from "@/utils/auth";
import { queryListByGoodsId } from "@/api/system/stock";
export default { export default {
name: "PmsOrderOut", name: "PmsOrderOut",
components: { components: {
@ -225,6 +240,14 @@ export default {
data() { data() {
return { 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, loading: true,
// //
@ -255,11 +278,17 @@ export default {
isLock: null isLock: null
}, },
// //
form: { form: {},
goodsList: [ // tableData:[],
{ goodsId: '11', goodsName: '11', stockQty: '11', goodsNum: '', goodsDesc: '' } tableData: [
] {
}, stockId: Date.now(),
goodsId: '',
goodsDesc: '',
goodsNum: 1, // 使 goodsNum
remainNum: 0
}
],
// //
rules: { rules: {
recordId: [ recordId: [
@ -365,6 +394,8 @@ export default {
const recordId = row.recordId || this.ids const recordId = row.recordId || this.ids
getPmsOrderOut(recordId).then(response => { getPmsOrderOut(recordId).then(response => {
this.form = response.data; this.form = response.data;
this.tableData = [this.form]
console.log(this.tableData)
this.open = true; this.open = true;
this.title = "修改出库单"; this.title = "修改出库单";
}); });
@ -378,6 +409,7 @@ export default {
goodsId: element.goodsId, goodsId: element.goodsId,
goodsNum: element.goodsNum, goodsNum: element.goodsNum,
goodsDesc: element.goodsDesc, goodsDesc: element.goodsDesc,
remainNum: element.remainNum,
inner: true inner: true
}); });
}); });
@ -390,21 +422,26 @@ export default {
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
if (this.form.recordId != null) { 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.$modal.msgSuccess("修改成功");
this.open = false; this.open = false;
this.getList(); 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.download('app/pmsOrderOut/export', {
...this.queryParams ...this.queryParams
}, `pmsOrderOut_${new Date().getTime()}.xlsx`) }, `pmsOrderOut_${new Date().getTime()}.xlsx`)
}
}, },
// handleImport() {
searchGoods(queryString, cb) { this.upload.title = '导入';
// API this.upload.open = true;
const goodsData = [ },
{ goodsId: '123', goodsName: '物料A', stockQty: 100 }, /** 下载模板操作 */
{ goodsId: '456', goodsName: '物料B', stockQty: 200 }, importTemplate() {
{ goodsId: '789', goodsName: '物料C', stockQty: 50 }, this.download('/app/pmsOrderOut/importTemplate', {}, `app_pmsOrderOut_${new Date().getTime()}.xlsx`);
]; },
const results = goodsData.filter(item => item.goodsId.includes(queryString)); //
cb(results); 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) { // goodsDesc
// handleMaterialSelect(index,item){
const selectedGoods = [ console.log("handleMaterialSelect",index);
{ goodsId: '123', goodsName: '物料A', stockQty: 100 }, const selectedItem = this.tableData[index];
{ goodsId: '456', goodsName: '物料B', stockQty: 200 }, console.log("selectedItem",selectedItem);
{ goodsId: '789', goodsName: '物料C', stockQty: 50 },
].find(item => item.goodsId === row.goodsId);
if (selectedGoods) { this.$set(this.tableData, index, {
row.goodsName = selectedGoods.goodsName; ...selectedItem,
row.stockQty = selectedGoods.stockQty; goodsId: item.goodsId, //
goodsDesc: item.goodsDesc, //
remainNum: item.remainNum, //
goodsNum: item.remainNum
});
} }
}, },
}; };
</script> </script>