1
This commit is contained in:
parent
b2920ee8cb
commit
a5e190a98d
|
|
@ -49,4 +49,12 @@ export function createOrderIn(data){
|
|||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
}
|
||||
//新增出库通知单
|
||||
export function updateOrderIn(data){
|
||||
return request({
|
||||
url: '/app/pms/updateOrderIn',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,12 +31,12 @@
|
|||
</el-table-column>
|
||||
<el-table-column label="物料条码" prop="goodsCode">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.goodsCode" placeholder="物料条码" />
|
||||
<el-input v-model="scope.row.goodsCode" placeholder="物料条码" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="物料描述" prop="goodsDesc">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.goodsDesc" readonly placeholder="物料描述" />
|
||||
<el-input v-model="scope.row.goodsDesc" readonly placeholder="物料描述" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="入库数量" width="150">
|
||||
|
|
@ -113,7 +113,7 @@ export default {
|
|||
if(response.code === 200){
|
||||
response.data.forEach(item => {
|
||||
mockData.push({
|
||||
value: item.goodsId,
|
||||
value: item.goodsId,
|
||||
goodsId: item.goodsId,
|
||||
goodsDesc: item.goodsDesc,
|
||||
goodsCode: item.goodsCode,
|
||||
|
|
@ -123,7 +123,7 @@ export default {
|
|||
}
|
||||
});
|
||||
callback(mockData);
|
||||
|
||||
|
||||
},
|
||||
|
||||
// 选择物料
|
||||
|
|
@ -182,9 +182,9 @@ export default {
|
|||
handleSubmit() {
|
||||
// 验证数据
|
||||
const invalidRow = this.tableData.find(item =>
|
||||
!item.goodsId ||
|
||||
!item.goodsId ||
|
||||
!item.goodsDesc ||
|
||||
item.goodsNum < 1
|
||||
item.goodsNum < 1
|
||||
);
|
||||
|
||||
if (invalidRow) {
|
||||
|
|
|
|||
|
|
@ -84,6 +84,16 @@
|
|||
v-hasPermi="['app:pmsOrderIn: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>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
|
|
@ -113,24 +123,6 @@
|
|||
<dict-tag :options="dict.type.in_order_status" :value="scope.row.orderStatus"/>
|
||||
</template>
|
||||
</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>
|
||||
|
||||
<pagination
|
||||
|
|
@ -141,56 +133,87 @@
|
|||
@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-item label="客户ID" prop="customerId">
|
||||
<el-input v-model="form.customerId" placeholder="请输入客户ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="订单号" prop="orderId">
|
||||
<el-input v-model="form.orderId" placeholder="请输入订单号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="物料号" prop="goodsId">
|
||||
<el-input v-model="form.goodsId" placeholder="请输入物料号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="数量" prop="goodsNum">
|
||||
<el-input v-model="form.goodsNum" placeholder="请输入数量" />
|
||||
</el-form-item>
|
||||
<el-form-item label="物料条码" prop="goodsCode">
|
||||
<el-input v-model="form.goodsCode" placeholder="请输入物料条码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="物料描述" prop="goodsDesc">
|
||||
<el-input v-model="form.goodsDesc" placeholder="请输入物料描述" />
|
||||
</el-form-item>
|
||||
<el-form-item label="物料单位" prop="unit">
|
||||
<el-input v-model="form.unit" placeholder="请输入物料单位" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入物料单位" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="预留1" prop="spare1">
|
||||
<el-input v-model="form.spare1" placeholder="请输入预留1" />
|
||||
</el-form-item>
|
||||
<el-form-item label="预留2" prop="spare2">
|
||||
<el-input v-model="form.spare2" placeholder="请输入预留2" />
|
||||
</el-form-item> -->
|
||||
<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="searchMaterials"
|
||||
: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-desc">{{ item.goodsDesc }}</div>
|
||||
<div class="material-divider"></div>
|
||||
</div>
|
||||
</template>
|
||||
</el-autocomplete>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="物料条码" prop="goodsCode">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.goodsCode" placeholder="物料条码" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="物料描述" prop="goodsDesc">
|
||||
<template slot-scope="scope">
|
||||
<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>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!-- 出库弹窗 -->
|
||||
<inbound-dialog
|
||||
: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 { 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 { queryListByGoodsId } from "@/api/system/goods";
|
||||
import {getToken} from "@/utils/auth";
|
||||
|
||||
export default {
|
||||
name: "In",
|
||||
|
|
@ -200,6 +223,14 @@ export default {
|
|||
dicts: ["in_order_type", "in_order_status"],
|
||||
data() {
|
||||
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,
|
||||
// 选中数组
|
||||
|
|
@ -237,6 +268,14 @@ export default {
|
|||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
tableData: [
|
||||
{
|
||||
stockId: Date.now(),
|
||||
goodsId: '',
|
||||
goodsDesc: '',
|
||||
goodsNum: 1, // 统一使用 goodsNum
|
||||
}
|
||||
],
|
||||
// 表单校验
|
||||
rules: {
|
||||
orderType: [
|
||||
|
|
@ -290,6 +329,7 @@ export default {
|
|||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id:null,
|
||||
listId: null,
|
||||
orderType: null,
|
||||
customerId: null,
|
||||
|
|
@ -317,16 +357,10 @@ export default {
|
|||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.listId)
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
// handleAdd() {
|
||||
// this.reset();
|
||||
// this.open = true;
|
||||
// this.title = "添加【请填写功能名称】";
|
||||
// },
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.dialogVisible = true
|
||||
|
|
@ -337,8 +371,9 @@ export default {
|
|||
const ids = row.id || this.ids
|
||||
getIn(ids).then(response => {
|
||||
this.form = response.data;
|
||||
this.tableData = [this.form]
|
||||
this.open = true;
|
||||
this.title = "修改【请填写功能名称】";
|
||||
this.title = "修改入库单";
|
||||
});
|
||||
},
|
||||
handleDialogSubmit(data){
|
||||
|
|
@ -365,18 +400,20 @@ export default {
|
|||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updateIn(this.form).then(response => {
|
||||
this.form = this.tableData[0]
|
||||
updateOrderIn(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();
|
||||
});
|
||||
}
|
||||
// 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.queryParams
|
||||
}, `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, // 更新物料条码
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user