fix:销售发货,发货编号
This commit is contained in:
parent
0352195245
commit
b53eb289ee
|
@ -100,7 +100,7 @@
|
|||
</el-table-column>
|
||||
<el-table-column
|
||||
label="组合件信息"
|
||||
v-if="cate == 'good'"
|
||||
v-if="cate == 'good'&&project_code=='gzerp'"
|
||||
width="300"
|
||||
>
|
||||
<template #default="scope">
|
||||
|
@ -230,6 +230,7 @@
|
|||
:belongDeptId="belongDeptId"
|
||||
:belongDeptName="mioObj.belong_dept_name"
|
||||
:mioObj="mioObj"
|
||||
:tableDatas="tableDatas"
|
||||
:cate="cate"
|
||||
@success="handleSaveSuccess"
|
||||
@closed="dialog.save = false"
|
||||
|
@ -256,6 +257,7 @@
|
|||
<template #default>
|
||||
<scTable ref="wprTable" hidePagination :data="wprList">
|
||||
<el-table-column label="产品编号" prop="number" min-width="100px"></el-table-column>
|
||||
<el-table-column v-if="project_code=='bxerp'&&mioObj.type == 'sale_out'" label="发货编号" prop="number_out" min-width="100px"></el-table-column>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
fixed="right"
|
||||
|
@ -327,6 +329,7 @@ export default {
|
|||
wprList:[],
|
||||
selection: [],
|
||||
tableData:[],
|
||||
tableDatas:[],
|
||||
stateDict: {
|
||||
10: "创建中",
|
||||
20: "已提交",
|
||||
|
@ -386,7 +389,17 @@ export default {
|
|||
//添加
|
||||
table_add() {
|
||||
let that = this;
|
||||
console.log(this.mioType);
|
||||
console.log(this.$refs.table);
|
||||
console.log(this.$refs.table.tableData);
|
||||
let tableData = this.$refs.table.tableData;
|
||||
let datas = [];
|
||||
tableData.forEach(item => {
|
||||
let obj = {};
|
||||
obj.batch = item.batch;
|
||||
obj.count = Number(item.count);
|
||||
datas.push(obj);
|
||||
});
|
||||
that.tableDatas = datas;
|
||||
this.dialog.save = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.saveDialog.open("add", that.mioType);
|
||||
|
|
|
@ -162,13 +162,23 @@
|
|||
<el-input v-model="form.note" placeholder="出库单位"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="24" v-if="form.type == 'sale_out'&&project_code=='bxerp'">
|
||||
<el-form-item label="编号前缀">
|
||||
<el-input v-model="prefix" placeholder="编号前缀"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-button type="primary" @click="getNumber">获取编号</el-button>
|
||||
<el-col :md="12" :sm="24" v-if="digitNum!==null">
|
||||
<el-form-item label="流水位数">
|
||||
<el-input-number controls-position="right" precision="0" @change="digitChange" v-model="digitNum"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row v-if="mTracking==20&&form.count>0&&(form.type == 'pur_in'||form.type == 'other_in'||(form.type == 'sale_out'&&project_code=='bxerp'))">
|
||||
<el-col :md="12" :sm="24" v-for="i in form.count" :key="i">
|
||||
<el-form-item :label="'编号'+i" required>
|
||||
<template v-if="form.type == 'sale_out'&&project_code=='bxerp'">
|
||||
<el-input v-if="i==1" v-model="mioitems[0]" @change="firstNumberChange" placeholder="请输入编号" style="width:100%"/>
|
||||
<el-input v-else v-model="mioitems[i-1]" placeholder="请输入编号" disabled />
|
||||
<el-input v-model="mioitems[i-1]" placeholder="请输入编号" disabled />
|
||||
</template>
|
||||
<el-input v-else v-model="mioitems[i-1]" placeholder="请输入编号" :disabled="cate == 'mainso'" />
|
||||
</el-form-item>
|
||||
|
@ -225,6 +235,17 @@
|
|||
<el-button @click="visible = false">取消</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<el-dialog title="设置发货流水位数" v-model="showDigit">
|
||||
<h4>没有找到该前缀的发货编号,请完善发货流水号位数(填整数)</h4>
|
||||
<el-form :model="wprParams" label-width="80px">
|
||||
<el-form-item label="流水位数">
|
||||
<el-input-number controls-position="right" precision="0" v-model="digitNum"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="digitSure">确定</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
const defaultForm = {
|
||||
|
@ -241,6 +262,7 @@ export default {
|
|||
belongDeptId: { type: String, default: null },
|
||||
mgroup: { type: String, default: null },
|
||||
mioObj: { type: Object },
|
||||
tableDatas: { type: Array ,default:function(){return []}},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -280,6 +302,7 @@ export default {
|
|||
],
|
||||
},
|
||||
selectObj:{},
|
||||
showDigit:false,
|
||||
visible: false,
|
||||
isSaveing: false,
|
||||
materialOptions: [],
|
||||
|
@ -298,6 +321,7 @@ export default {
|
|||
wprList:[],
|
||||
prefix:'',
|
||||
project_code:'',
|
||||
digitNum:null,
|
||||
mtype:null,
|
||||
batchcount:null,
|
||||
mTracking:10,
|
||||
|
@ -316,12 +340,7 @@ export default {
|
|||
this.getMaterialOptions();
|
||||
this.getWarehouseOptions();
|
||||
},
|
||||
getnumberOutLast(){
|
||||
let that = this;
|
||||
that.$API.wpm.wpr.numberOutLast.req({prefix:that.prefix}).then((res) => {
|
||||
console.log(res);
|
||||
});
|
||||
},
|
||||
|
||||
getWarehouseOptions() {
|
||||
let that = this;
|
||||
this.$API.inm.warehouse.list.req({ page: 0 }).then((res) => {
|
||||
|
@ -561,13 +580,79 @@ export default {
|
|||
let that = this;
|
||||
that.mioitemw = [];
|
||||
let numbers = that.mioitems[0];
|
||||
for(let i=0;i<that.form.count;i++){
|
||||
that.mioitems[i] = Number(numbers)+i;
|
||||
let obj = {};
|
||||
obj.number = that.form.batch+'-'+(i+1);
|
||||
that.mioitemw.push(obj);
|
||||
if(that.type== 'sale_out'){
|
||||
let num = numbers.slice(-3)
|
||||
let str = numbers.slice(0,-3)
|
||||
console.log(str,num)
|
||||
for(let i=0;i<that.form.count;i++){
|
||||
let numb = Number(num)+i;
|
||||
that.mioitems[i] =str + numb;
|
||||
}
|
||||
}else{
|
||||
for(let i=0;i<that.form.count;i++){
|
||||
that.mioitems[i] = Number(numbers)+i;
|
||||
let obj = {};
|
||||
obj.number = that.form.batch+'-'+(i+1);
|
||||
that.mioitemw.push(obj);
|
||||
}
|
||||
}
|
||||
},
|
||||
getnumberOutLast(){
|
||||
let that = this;
|
||||
that.$API.wpm.wpr.numberOutLast.req({prefix:that.prefix}).then((res) => {
|
||||
console.log(res);
|
||||
});
|
||||
},
|
||||
//没有找到前缀的发货编号,从1开始编号时
|
||||
digitSure(){
|
||||
let that = this;
|
||||
that.showDigit = false;
|
||||
//根据前缀和流水位数获取编号
|
||||
for(let i=0;i<that.form.count;i++){
|
||||
let numb = i+1,str = '';
|
||||
numb+= '';
|
||||
let len = numb.length;
|
||||
for(let j=0;j<that.digitNum-len;j++){
|
||||
str+='0';
|
||||
}
|
||||
that.mioitems[i] =that.prefix + str + numb;
|
||||
}
|
||||
},
|
||||
//流水位数变化后重新获取编号
|
||||
digitChange(){
|
||||
let that = this;
|
||||
that.mioitems = [];
|
||||
console.log('that.digitNum',that.digitNum)
|
||||
that.digitSure();
|
||||
},
|
||||
|
||||
getNumber(){
|
||||
let that = this;
|
||||
that.mioitemw = [];
|
||||
let params0 = {};
|
||||
params0.prefix = that.prefix;
|
||||
that.$API.wpm.wpr.numberOutLast.req(params0).then((res) => {
|
||||
let numbers = '';
|
||||
if(res.number_out_last==null){//没有该前缀的发货编号
|
||||
that.number_out_last = null;
|
||||
that.showDigit = true;
|
||||
}else{//有该前缀的发货编号
|
||||
numbers = res.number_out_last;
|
||||
let num = numbers.slice(-3);
|
||||
let str = numbers.slice(0,-3);
|
||||
for(let i=0;i<that.form.count;i++){
|
||||
let numb = Number(num)+i+1;
|
||||
if(numb<10){
|
||||
numb = '00'+numb;
|
||||
}else if(numb<100){
|
||||
numb = '0'+numb;
|
||||
}
|
||||
that.mioitems[i] =str + numb;
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
},
|
||||
validateInput(i){
|
||||
this.mioitems[i] = this.mioitems[i].replace(/\D/g, '');
|
||||
},
|
||||
|
@ -599,12 +684,21 @@ export default {
|
|||
return;
|
||||
}
|
||||
}else if(that.form.type == 'sale_out'&&that.project_code=='bxerp'){
|
||||
let count = 0;
|
||||
if(that.tableDatas.length>0){
|
||||
that.tableDatas.forEach((item) => {
|
||||
if(item.batch==that.form.batch){
|
||||
count += item.count;
|
||||
}
|
||||
})
|
||||
}
|
||||
let mioitemw = [];
|
||||
that.mioitems.forEach((item,index) => {
|
||||
let index0 = count+index;
|
||||
mioitemw[index]={
|
||||
number: item ,
|
||||
number: that.wprList[index0]? that.wprList[index0].number:'' ,
|
||||
number_out : item,
|
||||
wpr:that.wprList[index]? that.wprList[index].id:null
|
||||
wpr:that.wprList[index0]? that.wprList[index0].id:null
|
||||
}
|
||||
})
|
||||
that.form.mioitemw = mioitemw.filter(item=>item.wpr!==null);
|
||||
|
|
|
@ -0,0 +1,259 @@
|
|||
<template>
|
||||
<el-container>
|
||||
<el-header>
|
||||
<div class="left-panel">
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="add('sale_out')"
|
||||
v-auth="'mio.sale'"
|
||||
>销售发货</el-button
|
||||
>
|
||||
<el-select
|
||||
v-model="query.state"
|
||||
clearable
|
||||
style="width: 120px; margin-left: 2px"
|
||||
placeholder="状态"
|
||||
@change="handleQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in stateOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="right-panel">
|
||||
<el-input
|
||||
v-model="query.search"
|
||||
placeholder="编号"
|
||||
clearable
|
||||
style="margin-right: 5px"
|
||||
></el-input>
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-search"
|
||||
@click="handleQuery"
|
||||
></el-button>
|
||||
</div>
|
||||
</el-header>
|
||||
<el-main class="nopadding">
|
||||
<scTable
|
||||
ref="table"
|
||||
:apiObj="apiObj"
|
||||
:params="params"
|
||||
:query="query"
|
||||
row-key="id"
|
||||
stripe
|
||||
>
|
||||
<el-table-column type="index" width="50" />
|
||||
<el-table-column
|
||||
label="记录编号"
|
||||
prop="number"
|
||||
></el-table-column>
|
||||
<el-table-column label="出/入库类型">
|
||||
<template #default="scope">
|
||||
{{ typeDict[scope.row.type] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="记录状态">
|
||||
<template #default="scope">
|
||||
{{ stateDict[scope.row.state] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="出/入库日期" prop="inout_date">
|
||||
</el-table-column>
|
||||
<el-table-column label="执行部门" prop="belong_dept_name">
|
||||
<template #default="scope">
|
||||
{{ scope.row.belong_dept_name }} - {{ scope.row.mgroup_name }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建人" prop="create_by_name">
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" prop="create_time">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
fixed="right"
|
||||
align="center"
|
||||
width="150px"
|
||||
>
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
@click="table_detail(scope.row)"
|
||||
>
|
||||
查看
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
@click="table_submit(scope.row)"
|
||||
v-auth="'mio.submit'"
|
||||
v-if="scope.row.state == 10"
|
||||
>
|
||||
提交
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="warning"
|
||||
@click="revert(scope.row)"
|
||||
v-auth="'mio.submit'"
|
||||
v-if="scope.row.state == 20"
|
||||
>
|
||||
撤销
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="danger"
|
||||
@click="table_del(scope.row)"
|
||||
v-auth="'mio.delete'"
|
||||
v-if="scope.row.state == 10"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</scTable>
|
||||
</el-main>
|
||||
</el-container>
|
||||
<save-dialog
|
||||
v-if="dialog.save"
|
||||
ref="saveDialog"
|
||||
@success="handleSaveSuccess"
|
||||
@closed="dialog.save = false"
|
||||
></save-dialog>
|
||||
<record-dialog
|
||||
ref="showDrawer"
|
||||
v-if="visibleDrawer"
|
||||
:type="type"
|
||||
:cate="cate"
|
||||
:mioId="mioId"
|
||||
@closed="visibleDrawer = false"
|
||||
>
|
||||
</record-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import saveDialog from "./sale_form.vue";
|
||||
import recordDialog from "./../inm/mioitem.vue";
|
||||
|
||||
export default {
|
||||
name: "mio",
|
||||
components: {
|
||||
saveDialog,
|
||||
recordDialog,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
stateDict: {
|
||||
10: "创建中",
|
||||
20: "已提交",
|
||||
},
|
||||
stateOptions: [
|
||||
{ id: 10, name: "创建中" },
|
||||
{ id: 20, name: "已提交" },
|
||||
],
|
||||
typeDict: {
|
||||
sale_out: "销售发货"
|
||||
},
|
||||
cateOptions: [
|
||||
{ id: "sale_out", name: "销售发货" },
|
||||
],
|
||||
dialog: {
|
||||
save: false,
|
||||
record: false,
|
||||
},
|
||||
query: {},
|
||||
params: {
|
||||
type__in: "sale_out",
|
||||
materials__type: 10,
|
||||
},
|
||||
form: {},
|
||||
apiObj: this.$API.inm.mio.list,
|
||||
selection: [],
|
||||
type: "",
|
||||
cate: "good",
|
||||
mioId: "",
|
||||
visibleDrawer: false,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
//添加
|
||||
add(type) {
|
||||
this.dialog.save = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.saveDialog.open("add", type);
|
||||
});
|
||||
},
|
||||
//编辑
|
||||
table_edit(row) {
|
||||
this.dialog.save = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.saveDialog.open("edit", type).setData(row);
|
||||
});
|
||||
},
|
||||
//查看
|
||||
table_detail(row) {
|
||||
this.type = row.type;
|
||||
this.mioId = row.id;
|
||||
this.visibleDrawer = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.showDrawer.open();
|
||||
});
|
||||
},
|
||||
//删除
|
||||
table_del(row) {
|
||||
this.$confirm(`确定删除吗?`, "提示", {
|
||||
type: "warning",
|
||||
})
|
||||
.then(() => {
|
||||
this.$API.inm.mio.delete
|
||||
.req(row.id)
|
||||
.then((res) => {
|
||||
this.$message.success("删除成功");
|
||||
this.$refs.table.refresh();
|
||||
return res;
|
||||
})
|
||||
.catch((err) => {
|
||||
return err;
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
revert(row) {
|
||||
this.$confirm(`确定撤销该操作吗?`, "提示", {
|
||||
type: "warning",
|
||||
})
|
||||
.then(() => {
|
||||
this.$API.inm.mio.revert
|
||||
.req(row.id)
|
||||
.then((res) => {
|
||||
this.$message.success("撤销成功");
|
||||
this.$refs.table.refresh();
|
||||
return res;
|
||||
})
|
||||
.catch((err) => {
|
||||
return err;
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
table_submit(row) {
|
||||
this.$API.inm.mio.submit.req(row.id).then((res) => {
|
||||
this.$message.success("提交成功");
|
||||
this.$refs.table.refresh();
|
||||
});
|
||||
},
|
||||
handleQuery() {
|
||||
this.$refs.table.queryData(this.query);
|
||||
},
|
||||
resetQuery() {
|
||||
this.query = {};
|
||||
},
|
||||
handleSaveSuccess() {
|
||||
this.$refs.table.refresh();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
|
@ -0,0 +1,348 @@
|
|||
<template>
|
||||
<el-dialog
|
||||
:title="titleMap[form.type]"
|
||||
v-model="visible"
|
||||
:size="1000"
|
||||
destroy-on-close
|
||||
@closed="$emit('closed')"
|
||||
>
|
||||
<el-form
|
||||
ref="dialogForm"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
label-width="120px"
|
||||
>
|
||||
<el-form-item label="编号">
|
||||
<el-input v-model="form.number" placeholder="编号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="出入库日期">
|
||||
<el-date-picker
|
||||
v-model="form.inout_date"
|
||||
type="date"
|
||||
placeholder="出入库日期"
|
||||
value-format="YYYY-MM-DD"
|
||||
style="width: 100%"
|
||||
>
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="采购订单" v-if="form.type == 'pur_in'">
|
||||
<el-select
|
||||
v-model="form.pu_order"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in puOrderOptions"
|
||||
:key="item.id"
|
||||
:label="item.number"
|
||||
:value="item.id"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="供应商"
|
||||
v-if="form.type == 'other_in' || form.type == 'pur_in'||form.type == 'pur_out'"
|
||||
>
|
||||
<el-select
|
||||
v-model="form.supplier"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in supplierOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="销售订单" v-if="form.type == 'sale_out'">
|
||||
<el-select v-model="form.order" clearable style="width: 100%">
|
||||
<el-option
|
||||
v-for="item in orderOptions"
|
||||
:key="item.id"
|
||||
:label="item.number"
|
||||
:value="item.id"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="客户名称" v-if="form.type == 'sale_out'">
|
||||
<el-select
|
||||
v-model="form.customer"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in customerOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="客户" v-if="form.type == 'other_out'">
|
||||
<el-select
|
||||
v-model="form.customer"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in customerOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="操作工段"
|
||||
v-if="form.type == 'do_in' || form.type == 'do_out'|| form.type == 'borrow_out' || form.type == 'return_in'"
|
||||
>
|
||||
<el-select
|
||||
v-model="form.mgroup"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
placeholder="为空时代表领料/入库到车间"
|
||||
@change="mgroupChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in mgroupOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="操作部门"
|
||||
v-if="form.type == 'do_in' || form.type == 'do_out' || form.type == 'borrow_out' || form.type == 'return_in'"
|
||||
>
|
||||
<el-select
|
||||
v-model="form.belong_dept"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
@change="getgetDeptUsers"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in deptOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item
|
||||
label="部门执行人"
|
||||
v-if="form.type == 'do_in' || form.type == 'do_out'|| form.type == 'borrow_out' || form.type == 'return_in'"
|
||||
>
|
||||
<el-select v-model="form.do_user" clearable style="width: 100%">
|
||||
<el-option
|
||||
v-for="item in userOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="仓库执行人"
|
||||
>
|
||||
<el-select
|
||||
v-model="form.mio_user"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in userOption"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button type="primary" :loading="isSaveing" @click="submit">
|
||||
保存
|
||||
</el-button>
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
const defaultForm = {
|
||||
state: 10,
|
||||
type: "do_in",
|
||||
};
|
||||
export default {
|
||||
emits: ["success", "closed"],
|
||||
props: {},
|
||||
data() {
|
||||
return {
|
||||
type: "do_in",
|
||||
loading: false,
|
||||
mode: "add",
|
||||
titleMap: {
|
||||
do_out: "生产领料",
|
||||
sale_out: "销售发货",
|
||||
pur_in: "采购入库",
|
||||
pur_out: "退货",
|
||||
do_in: "生产入库",
|
||||
other_in: "其他入库",
|
||||
other_out: "其他出库",
|
||||
borrow_out: "领用出库",
|
||||
return_in: "退还入库",
|
||||
},
|
||||
form: {},
|
||||
rules: {
|
||||
number: [
|
||||
{
|
||||
required: true,
|
||||
message: "请填写编号",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
},
|
||||
visible: false,
|
||||
isSaveing: false,
|
||||
options: [],
|
||||
setFiltersVisible: false,
|
||||
deptOptions: [],
|
||||
mgroupOptions: [],
|
||||
userOptions: [],
|
||||
userOption: [],
|
||||
orderOptions: [],
|
||||
puOrderOptions: [],
|
||||
supplierOptions: [],
|
||||
customerOptions: [],
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.form.inout_date = this.$TOOL.dateFormat2(new Date());
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
this.getDeptUser();
|
||||
var type = this.form.type;
|
||||
if (type == "pur_in") {
|
||||
this.getPuOrderOptions();
|
||||
this.getSupplierOptions();
|
||||
} else if (type == "sale_out") {
|
||||
this.getOrderOptions();
|
||||
this.getCustomerOptions();
|
||||
} else if (type == "do_in" || type == "do_out" || type == "borrow_out" || type == "return_in") {
|
||||
this.getDeptOptions();
|
||||
this.getmgroupOptions();
|
||||
this.getgetDeptUsers();
|
||||
} else if (type == "other_in") {
|
||||
this.getSupplierOptions();
|
||||
} else if (type == "other_out") {
|
||||
this.getCustomerOptions();
|
||||
}
|
||||
},
|
||||
mgroupChange(){
|
||||
let that = this;
|
||||
that.mgroupOptions.forEach(item=>{
|
||||
if(item.id == that.form.mgroup){
|
||||
this.form.belong_dept = item.belong_dept;
|
||||
}
|
||||
})
|
||||
},
|
||||
getmgroupOptions() {
|
||||
this.$API.mtm.mgroup.list.req({page: 0}).then(res=>{
|
||||
this.mgroupOptions = res;
|
||||
})
|
||||
},
|
||||
getSupplierOptions() {
|
||||
this.$API.pum.supplier.list.req({ page: 0 }).then((res) => {
|
||||
this.supplierOptions = res;
|
||||
});
|
||||
},
|
||||
getCustomerOptions() {
|
||||
this.$API.sam.customer.list.req({ page: 0 }).then((res) => {
|
||||
this.customerOptions = res;
|
||||
});
|
||||
},
|
||||
getDeptOptions() {
|
||||
this.$API.system.dept.list
|
||||
.req({ page: 0, type__in: "dept" })
|
||||
.then((res) => {
|
||||
this.deptOptions = res;
|
||||
});
|
||||
},
|
||||
getPuOrderOptions() {
|
||||
this.$API.pum.order.list
|
||||
.req({ page: 0, type__in: "20,30" })
|
||||
.then((res) => {
|
||||
this.puOrderOptions = res;
|
||||
});
|
||||
},
|
||||
getOrderOptions() {
|
||||
this.$API.sam.order.list
|
||||
.req({ page: 0, state__in: "20,30" })
|
||||
.then((res) => {
|
||||
this.orderOptions = res;
|
||||
});
|
||||
},
|
||||
getgetDeptUsers(){
|
||||
this.$API.system.user.list.req({ depts: this.form.belong_dept, page: 0 }).then((res) => {
|
||||
this.userOptions = res;
|
||||
});
|
||||
},
|
||||
getDeptUser() {
|
||||
this.$API.system.user.list
|
||||
.req({ posts__name: "库管", page: 0 })
|
||||
.then((res) => {
|
||||
this.userOption = res;
|
||||
});
|
||||
},
|
||||
//显示
|
||||
open(mode = "add", type = "") {
|
||||
this.mode = mode;
|
||||
this.form.type = type;
|
||||
this.init();
|
||||
this.visible = true;
|
||||
return this;
|
||||
},
|
||||
//提交
|
||||
submit() {
|
||||
this.$refs.dialogForm.validate(async (valid) => {
|
||||
if (valid) {
|
||||
this.isSaveing = true;
|
||||
try {
|
||||
var res;
|
||||
if (this.mode == "add") {
|
||||
res = await this.$API.inm.mio.create.req(this.form);
|
||||
} else if (this.mode == "edit") {
|
||||
res = await this.$API.inm.mio.update.req(
|
||||
this.form.id,
|
||||
this.form
|
||||
);
|
||||
}
|
||||
this.isSaveing = false;
|
||||
this.$emit("success", this.form, this.mode);
|
||||
this.visible = false;
|
||||
this.$message.success("操作成功");
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
//可以处理校验错误
|
||||
this.isSaveing = false;
|
||||
return err;
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
//表单注入数据
|
||||
setData(data) {
|
||||
Object.assign(this.form, data);
|
||||
},
|
||||
//设置过滤项
|
||||
setFilters(filters) {
|
||||
this.selectionFilters = filters;
|
||||
this.setFiltersVisible = true;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style></style>
|
|
@ -203,9 +203,11 @@
|
|||
<el-drawer v-model="wprVisibleDrawer" :size="'70%'">
|
||||
<template #header>
|
||||
<h4>关联产品</h4>
|
||||
<el-button type="primary" @click="wprNumberChange">发货编号</el-button>
|
||||
<el-button type="warning" @click="wprNumberClear">清空编号</el-button>
|
||||
</template>
|
||||
<template #default>
|
||||
<scTable ref="wprTable" hidePagination :data="wprList">
|
||||
<scTable ref="wprTable" hidePagination hideDo :data="wprList">
|
||||
<el-table-column label="产品编号" prop="number" min-width="100px"></el-table-column>
|
||||
<el-table-column label="记录数据" prop="oinfo">
|
||||
<template #default="scope">
|
||||
|
@ -224,6 +226,7 @@
|
|||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="对外编号" prop="number_out" min-width="100px"></el-table-column>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
fixed="right"
|
||||
|
@ -242,6 +245,17 @@
|
|||
</div>
|
||||
</template>
|
||||
</el-drawer>
|
||||
<el-dialog title="设置发货编号" v-model="showBatch">
|
||||
<el-form :model="wprParams" label-width="80px">
|
||||
<el-form-item label="编号前缀">
|
||||
<el-input v-model="prefix"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="getWprNum">确定</el-button>
|
||||
<el-button @click="showBatch=false">取消</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<el-drawer v-model="limitedWatch" title="工艺路线流程图" size="80%" @closeDialog="limitedWatch = false">
|
||||
<scDegra
|
||||
v-if="limitedWatch"
|
||||
|
@ -333,11 +347,13 @@ export default {
|
|||
page:0,
|
||||
wm: ""
|
||||
},
|
||||
prefix:'',
|
||||
number_out_last:'',
|
||||
route_code:"",
|
||||
showBatch: "",
|
||||
wmMaterial:'',
|
||||
cate_type:'',
|
||||
materialType: "wm",
|
||||
showBatch: false,
|
||||
limitedWatch:false,
|
||||
materialsVisible:false,
|
||||
visibleDrawer: false,
|
||||
|
@ -467,7 +483,11 @@ export default {
|
|||
that.ofrom_batch = row.batch;
|
||||
that.wprParams.wm = row.id;
|
||||
that.wprVisibleDrawer = true;
|
||||
this.$API.wpm.wpr.list.req(that.wprParams).then((res) => {
|
||||
that.getRowWpr();
|
||||
},
|
||||
getRowWpr(){
|
||||
let that = this;
|
||||
that.$API.wpm.wpr.list.req(that.wprParams).then((res) => {
|
||||
that.wprList = res;
|
||||
})
|
||||
},
|
||||
|
@ -479,6 +499,59 @@ export default {
|
|||
this.$refs.handoverDialog.open("add",row,20);
|
||||
});
|
||||
},
|
||||
wprNumberChange(){
|
||||
let that = this;
|
||||
that.showBatch = true;
|
||||
},
|
||||
wprNumberClear(){
|
||||
let that = this;
|
||||
let items = [];
|
||||
for(let i=0;i< that.wprList.length;i++){
|
||||
let obj = {};
|
||||
obj.id = that.wprList[i].id;
|
||||
obj.number_out = null;
|
||||
items.push(obj)
|
||||
}
|
||||
let params = {};
|
||||
params.items = items;
|
||||
that.$API.wpm.wpr.assginNumberOut.req(params).then((res) => {
|
||||
that.getRowWpr();
|
||||
})
|
||||
},
|
||||
getWprNum(){
|
||||
let that = this;
|
||||
let params0 = {};
|
||||
params0.prefix = that.prefix;
|
||||
that.$API.wpm.wpr.numberOutLast.req(params0).then((res) => {
|
||||
let number_out_last = '';
|
||||
if(res.number_out_last==null){
|
||||
number_out_last = that.prefix+'000';
|
||||
}else{
|
||||
number_out_last = res.number_out_last;
|
||||
}
|
||||
that.number_out_last = number_out_last;
|
||||
let num = number_out_last.slice(-3)
|
||||
let str = number_out_last.slice(0,-3)
|
||||
let items = [];
|
||||
for(let i=0;i< that.wprList.length;i++){
|
||||
let obj = {};
|
||||
let numb = Number(num)+i+1;
|
||||
if(numb<10){
|
||||
numb = '00'+numb;
|
||||
}else if(numb<100){
|
||||
numb = '0'+numb;
|
||||
}
|
||||
obj.id = that.wprList[i].id;
|
||||
obj.number_out = str+numb;
|
||||
items.push(obj)
|
||||
}
|
||||
let params = {};
|
||||
params.items = items;
|
||||
that.$API.wpm.wpr.assginNumberOut.req(params).then((res) => {
|
||||
that.getRowWpr();
|
||||
})
|
||||
})
|
||||
},
|
||||
//本地更新数据
|
||||
handleSaveSuccess(data, mode) {
|
||||
this.dialog.save = false;
|
||||
|
|
Loading…
Reference in New Issue