This commit is contained in:
15066119699 2025-03-13 09:16:04 +08:00
parent b2920ee8cb
commit a5e190a98d
3 changed files with 188 additions and 74 deletions

View File

@ -49,4 +49,12 @@ export function createOrderIn(data){
method: 'post', method: 'post',
data: data data: data
}) })
} }
//新增出库通知单
export function updateOrderIn(data){
return request({
url: '/app/pms/updateOrderIn',
method: 'post',
data: data
})
}

View File

@ -31,12 +31,12 @@
</el-table-column> </el-table-column>
<el-table-column label="物料条码" prop="goodsCode"> <el-table-column label="物料条码" prop="goodsCode">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.goodsCode" placeholder="物料条码" /> <el-input v-model="scope.row.goodsCode" placeholder="物料条码" />
</template> </template>
</el-table-column> </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="物料描述" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="入库数量" width="150"> <el-table-column label="入库数量" width="150">
@ -113,7 +113,7 @@ export default {
if(response.code === 200){ if(response.code === 200){
response.data.forEach(item => { response.data.forEach(item => {
mockData.push({ mockData.push({
value: item.goodsId, value: item.goodsId,
goodsId: item.goodsId, goodsId: item.goodsId,
goodsDesc: item.goodsDesc, goodsDesc: item.goodsDesc,
goodsCode: item.goodsCode, goodsCode: item.goodsCode,
@ -123,7 +123,7 @@ export default {
} }
}); });
callback(mockData); callback(mockData);
}, },
// //
@ -182,9 +182,9 @@ export default {
handleSubmit() { handleSubmit() {
// //
const invalidRow = this.tableData.find(item => const invalidRow = this.tableData.find(item =>
!item.goodsId || !item.goodsId ||
!item.goodsDesc || !item.goodsDesc ||
item.goodsNum < 1 item.goodsNum < 1
); );
if (invalidRow) { if (invalidRow) {

View File

@ -84,6 +84,16 @@
v-hasPermi="['app:pmsOrderIn:export']" v-hasPermi="['app:pmsOrderIn: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>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
@ -113,24 +123,6 @@
<dict-tag :options="dict.type.in_order_status" :value="scope.row.orderStatus"/> <dict-tag :options="dict.type.in_order_status" :value="scope.row.orderStatus"/>
</template> </template>
</el-table-column> </el-table-column>
<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:pmsOrderIn:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['app:pmsOrderIn:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table> </el-table>
<pagination <pagination
@ -141,56 +133,87 @@
@pagination="getList" @pagination="getList"
/> />
<!-- 添加或修改请填写功能名称对话框 --> <!-- 出库弹窗 -->
<el-dialog :title="title" :visible.sync="open" width="500px" 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-form-item label="客户ID" prop="customerId"> <el-table :data="tableData" style="width: 100%">
<el-input v-model="form.customerId" placeholder="请输入客户ID" /> <el-table-column label="物料编码" width="280">
</el-form-item> <template slot-scope="scope">
<el-form-item label="订单号" prop="orderId"> <el-autocomplete
<el-input v-model="form.orderId" placeholder="请输入订单号" /> :value="queryGoods"
</el-form-item> v-model="scope.row.goodsId"
<el-form-item label="物料号" prop="goodsId"> :fetch-suggestions="searchMaterials"
<el-input v-model="form.goodsId" placeholder="请输入物料号" /> :trigger-on-focus="false"
</el-form-item> placeholder="请输入物料编码或名称"
<el-form-item label="数量" prop="goodsNum"> clearable
<el-input v-model="form.goodsNum" placeholder="请输入数量" /> @select="handleMaterialSelect(scope.$index,$event)"
</el-form-item> >
<el-form-item label="物料条码" prop="goodsCode"> <template slot-scope="{ item }">
<el-input v-model="form.goodsCode" placeholder="请输入物料条码" /> <div class="material-item">
</el-form-item> <div class="material-code">{{ item.goodsId }}</div>
<el-form-item label="物料描述" prop="goodsDesc"> <div class="material-desc">{{ item.goodsDesc }}</div>
<el-input v-model="form.goodsDesc" placeholder="请输入物料描述" /> <div class="material-divider"></div>
</el-form-item> </div>
<el-form-item label="物料单位" prop="unit"> </template>
<el-input v-model="form.unit" placeholder="请输入物料单位" /> </el-autocomplete>
</el-form-item> </template>
<el-form-item label="备注" prop="remark"> </el-table-column>
<el-input v-model="form.remark" placeholder="请输入物料单位" /> <el-table-column label="物料条码" prop="goodsCode">
</el-form-item> <template slot-scope="scope">
<!-- <el-form-item label="预留1" prop="spare1"> <el-input v-model="scope.row.goodsCode" placeholder="物料条码" />
<el-input v-model="form.spare1" placeholder="请输入预留1" /> </template>
</el-form-item> </el-table-column>
<el-form-item label="预留2" prop="spare2"> <el-table-column label="物料描述" prop="goodsDesc">
<el-input v-model="form.spare2" placeholder="请输入预留2" /> <template slot-scope="scope">
</el-form-item> --> <el-input v-model="scope.row.goodsDesc" readonly placeholder="物料描述" />
</template>
</el-table-column>
<el-table-column label="入库数量" width="150">
<template slot-scope="scope">
<el-input-number
v-model="scope.row.goodsNum"
:min="1"
controls-position="right"
placeholder="请输入数量"
/>
</template>
</el-table-column>
</el-table>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button> <el-button @click="cancel"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
<!-- 出库弹窗 -->
<inbound-dialog <inbound-dialog
: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 { listIn, getIn, delIn, addIn, updateIn,createOrderIn } from "@/api/system/pmsOrderIn"; import { listIn, getIn, delIn, addIn, updateIn,createOrderIn,updateOrderIn } from "@/api/system/pmsOrderIn";
import InboundDialog from './components/InboundDialog' import InboundDialog from './components/InboundDialog'
import { queryListByGoodsId } from "@/api/system/goods";
import {getToken} from "@/utils/auth";
export default { export default {
name: "In", name: "In",
@ -200,6 +223,14 @@ export default {
dicts: ["in_order_type", "in_order_status"], dicts: ["in_order_type", "in_order_status"],
data() { data() {
return { return {
queryGoods: "",
upload: {
open: false,
title: '上传文件',
headers: { Authorization: 'Bearer ' + getToken() },
url: process.env.VUE_APP_BASE_API + '/app/pmsOrderIn/importData', // URL
isUploading: false
},
// //
loading: true, loading: true,
// //
@ -237,6 +268,14 @@ export default {
}, },
// //
form: {}, form: {},
tableData: [
{
stockId: Date.now(),
goodsId: '',
goodsDesc: '',
goodsNum: 1, // 使 goodsNum
}
],
// //
rules: { rules: {
orderType: [ orderType: [
@ -290,6 +329,7 @@ export default {
// //
reset() { reset() {
this.form = { this.form = {
id:null,
listId: null, listId: null,
orderType: null, orderType: null,
customerId: null, customerId: null,
@ -317,16 +357,10 @@ export default {
}, },
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.listId) this.ids = selection.map(item => item.id)
this.single = selection.length!==1 this.single = selection.length!==1
this.multiple = !selection.length this.multiple = !selection.length
}, },
/** 新增按钮操作 */
// handleAdd() {
// this.reset();
// this.open = true;
// this.title = "";
// },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.dialogVisible = true this.dialogVisible = true
@ -337,8 +371,9 @@ export default {
const ids = row.id || this.ids const ids = row.id || this.ids
getIn(ids).then(response => { getIn(ids).then(response => {
this.form = response.data; this.form = response.data;
this.tableData = [this.form]
this.open = true; this.open = true;
this.title = "修改【请填写功能名称】"; this.title = "修改入库单";
}); });
}, },
handleDialogSubmit(data){ handleDialogSubmit(data){
@ -365,18 +400,20 @@ export default {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
if (this.form.id != null) { if (this.form.id != null) {
updateIn(this.form).then(response => { this.form = this.tableData[0]
updateOrderIn(this.form).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.open = false; this.open = false;
this.getList(); this.getList();
}); });
} else {
addIn(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
} }
// else {
// addIn(this.form).then(response => {
// this.$modal.msgSuccess("");
// this.open = false;
// this.getList();
// });
// }
} }
}); });
}, },
@ -395,6 +432,75 @@ export default {
this.download('app/pmsOrderIn/export', { this.download('app/pmsOrderIn/export', {
...this.queryParams ...this.queryParams
}, `pmsOrderIn_${new Date().getTime()}.xlsx`) }, `pmsOrderIn_${new Date().getTime()}.xlsx`)
},
handleImport() {
this.upload.title = '导入';
this.upload.open = true;
},
/** 下载模板操作 */
importTemplate() {
this.download('/app/pmsOrderIn/importTemplate', {}, `app_pmsOrderIn_${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 searchMaterials(query, callback) {
if (query.length < 2) {
callback([]);
return;
}
const queryParams = {
goodsId: query
};
let mockData = [];
await queryListByGoodsId(queryParams).then(response => {
if(response.code === 200){
response.data.forEach(item => {
mockData.push({
value: item.goodsId,
goodsId: item.goodsId,
goodsDesc: item.goodsDesc,
goodsCode: item.goodsCode,
});
});
mockData = response.data;
}
});
callback(mockData);
},
// goodsName goodsDesc
handleMaterialSelect(index,item){
console.log("handleMaterialSelect",index);
const selectedItem = this.tableData[index];
console.log("selectedItem",selectedItem);
this.$set(this.tableData, index, {
...selectedItem,
goodsId: item.goodsId, //
goodsDesc: item.goodsDesc, //
goodsCode: item.goodsCode, //
});
} }
} }
}; };