|
@@ -17,6 +17,7 @@
|
|
|
<search-supplier
|
|
|
:value="ruleForm.supplier_code"
|
|
|
:placeholder="'请选择公司'"
|
|
|
+ :names="supplier_name"
|
|
|
@searchChange="selectSupplier"
|
|
|
/>
|
|
|
</el-form-item>
|
|
@@ -39,6 +40,7 @@
|
|
|
<search-supplier
|
|
|
:value="ruleForm.supplier_in_code"
|
|
|
:placeholder="'请选择公司'"
|
|
|
+ :names="supplier_in_name"
|
|
|
@searchChange="selectSupplierIn"
|
|
|
/>
|
|
|
</el-form-item>
|
|
@@ -79,31 +81,46 @@
|
|
|
:data="ruleForm.product_go"
|
|
|
border
|
|
|
:size="'mini'"
|
|
|
+ row-key="key"
|
|
|
max-height="400px"
|
|
|
>
|
|
|
- <el-table-column
|
|
|
- show-overflow-tooltip
|
|
|
- :prop="item.prop"
|
|
|
- :label="item.label"
|
|
|
- :width="item.width"
|
|
|
- :min-width="item.minWidth"
|
|
|
- v-for="(item, index) in columns"
|
|
|
- :key="item.prop + index"
|
|
|
- >
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-form-item
|
|
|
- :prop="'list.' + scope.$index + '.' + scope.row.id"
|
|
|
- :size="'mini'"
|
|
|
- >
|
|
|
- <el-input
|
|
|
+ <template v-for="(item, index) in columns">
|
|
|
+ <el-table-column
|
|
|
+ v-if="item.prop !== 'allot_num'"
|
|
|
+ show-overflow-tooltip
|
|
|
+ :prop="item.prop"
|
|
|
+ :label="item.label"
|
|
|
+ :width="item.width"
|
|
|
+ :min-width="item.minWidth"
|
|
|
+ :key="item.prop + index"
|
|
|
+ >
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ :prop="item.prop"
|
|
|
+ :label="item.label"
|
|
|
+ :width="item.width"
|
|
|
+ :min-width="item.minWidth"
|
|
|
+ :key="item.prop + index"
|
|
|
+ v-else
|
|
|
+ >
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-form-item
|
|
|
+ :prop="'list.' + scope.$index + '.' + scope.row.id"
|
|
|
:size="'mini'"
|
|
|
- v-model="scope.row[item.prop]"
|
|
|
- v-if="scope.row.edit && item.prop === 'allot_num'"
|
|
|
- ></el-input>
|
|
|
- <span v-else>{{ scope.row[item.prop] }}</span>
|
|
|
- </el-form-item>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ :size="'mini'"
|
|
|
+ v-model="scope.row[item.prop]"
|
|
|
+ v-if="scope.row.edit"
|
|
|
+ ></el-input>
|
|
|
+ <span v-else class="spscope">{{
|
|
|
+ scope.row[item.prop]
|
|
|
+ }}</span>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </template>
|
|
|
+
|
|
|
<el-table-column fixed="right" label="操作" width="80">
|
|
|
<template slot-scope="scope">
|
|
|
<el-tooltip
|
|
@@ -172,9 +189,11 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
showGoodsModel: false,
|
|
|
- id: "",
|
|
|
+ // id: "",
|
|
|
supplier_code: "",
|
|
|
stock_in_code: "",
|
|
|
+ supplier_name: "",
|
|
|
+ supplier_in_name: "",
|
|
|
isDisabled: true,
|
|
|
isDisabledIn: true,
|
|
|
loading: false,
|
|
@@ -229,46 +248,106 @@ export default {
|
|
|
trigger: "change",
|
|
|
},
|
|
|
],
|
|
|
+ type_code: [
|
|
|
+ {
|
|
|
+ required: false,
|
|
|
+ message: "",
|
|
|
+ trigger: "blur",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ good_name: [
|
|
|
+ {
|
|
|
+ required: false,
|
|
|
+ message: "",
|
|
|
+ trigger: "blur",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ usable_stock: [
|
|
|
+ {
|
|
|
+ required: false,
|
|
|
+ message: "",
|
|
|
+ trigger: "blur",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ allot_num: [
|
|
|
+ {
|
|
|
+ required: false,
|
|
|
+ message: "",
|
|
|
+ trigger: "blur",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ unit: [
|
|
|
+ {
|
|
|
+ required: false,
|
|
|
+ message: "",
|
|
|
+ trigger: "blur",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ color: [
|
|
|
+ {
|
|
|
+ required: false,
|
|
|
+ message: "",
|
|
|
+ trigger: "blur",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+
|
|
|
+ material: [
|
|
|
+ {
|
|
|
+ required: false,
|
|
|
+ message: "",
|
|
|
+ trigger: "blur",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ brand: [
|
|
|
+ {
|
|
|
+ required: false,
|
|
|
+ message: "",
|
|
|
+ trigger: "blur",
|
|
|
+ },
|
|
|
+ ],
|
|
|
},
|
|
|
columns: [
|
|
|
{
|
|
|
- prop: "good_code",
|
|
|
+ prop: "type_code",
|
|
|
label: "商品编码",
|
|
|
width: "150",
|
|
|
},
|
|
|
{
|
|
|
prop: "good_name",
|
|
|
label: "商品名称",
|
|
|
- minWidth: "170",
|
|
|
+ minWidth: "180",
|
|
|
},
|
|
|
{
|
|
|
prop: "usable_stock",
|
|
|
label: "可用库存数",
|
|
|
- width: "110",
|
|
|
+ width: "100",
|
|
|
},
|
|
|
{
|
|
|
prop: "allot_num",
|
|
|
label: "调拨数量",
|
|
|
- width: "130",
|
|
|
+ width: "140",
|
|
|
},
|
|
|
|
|
|
- {
|
|
|
- prop: "unit",
|
|
|
- label: "单位",
|
|
|
- width: "45",
|
|
|
- },
|
|
|
- {
|
|
|
- prop: "color",
|
|
|
- label: "商品颜色",
|
|
|
- },
|
|
|
- {
|
|
|
- prop: "material",
|
|
|
- label: "商品材质",
|
|
|
- },
|
|
|
- {
|
|
|
- prop: "brand",
|
|
|
- label: "品牌",
|
|
|
- },
|
|
|
+ // {
|
|
|
+ // prop: "unit",
|
|
|
+ // label: "单位",
|
|
|
+ // width: "45",
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // prop: "color",
|
|
|
+ // label: "商品颜色",
|
|
|
+ // width: "70",
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // prop: "material",
|
|
|
+ // label: "商品材质",
|
|
|
+ // width: "70",
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // prop: "brand",
|
|
|
+ // label: "品牌",
|
|
|
+ // width: "70",
|
|
|
+ // },
|
|
|
],
|
|
|
tableData: [],
|
|
|
};
|
|
@@ -288,22 +367,10 @@ export default {
|
|
|
},
|
|
|
mounted() {
|
|
|
console.log("asd");
|
|
|
- this.id = this.$route.query.id;
|
|
|
- // this.getValue();
|
|
|
+ // this.id = this.$route.query.id;
|
|
|
this.initForm();
|
|
|
},
|
|
|
methods: {
|
|
|
- async getValue() {
|
|
|
- const res = await asyncRequest.detail({ id: this.id });
|
|
|
- if (res && res.code === 0 && res.data) {
|
|
|
- // this.ruleForm = res.data;
|
|
|
- // this.ruleForm.role_id = this.ruleForm.role;
|
|
|
- } else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
- await this.logout();
|
|
|
- } else {
|
|
|
- this.$message.warning(res.message);
|
|
|
- }
|
|
|
- },
|
|
|
// 删除行操作
|
|
|
deleteRow(index, rows) {
|
|
|
// console.log(index, rows);
|
|
@@ -317,6 +384,13 @@ export default {
|
|
|
this.$message.warning("请选择出库仓库!");
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
+ let index = this.ruleForm.product_go.findIndex((v) => v.edit);
|
|
|
+ if (index !== -1) {
|
|
|
+ this.$message.warning("当前已有商品正在编辑!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
this.showGoodsModel = true;
|
|
|
},
|
|
|
|
|
@@ -328,13 +402,9 @@ export default {
|
|
|
this.rulesThis = this.rules;
|
|
|
await this.resetForm();
|
|
|
} else {
|
|
|
- if (this.isDetail) {
|
|
|
- this.rulesThis = {};
|
|
|
- } else {
|
|
|
- this.rulesThis = this.rules;
|
|
|
- }
|
|
|
+ this.rulesThis = this.rules;
|
|
|
await this.resetForm();
|
|
|
- // await this.initData()
|
|
|
+ await this.initData();
|
|
|
}
|
|
|
this.loading = false;
|
|
|
},
|
|
@@ -342,8 +412,24 @@ export default {
|
|
|
async initData() {
|
|
|
const res = await asyncRequest.detail({ id: this.id });
|
|
|
if (res && res.code === 0 && res.data) {
|
|
|
- this.ruleForm = res.data;
|
|
|
- this.ruleForm.role_id = this.ruleForm.role;
|
|
|
+ const { item, wsm_in, wsm_out, wsm_in_name, wsm_out_name } = res.data;
|
|
|
+ this.supplier_code = wsm_out;
|
|
|
+ this.stock_in_code = wsm_in;
|
|
|
+ this.supplier_name = wsm_out_name;
|
|
|
+ this.supplier_in_name = wsm_in_name;
|
|
|
+ this.ruleForm = {
|
|
|
+ supplier_code: [], //出库供应商code
|
|
|
+ stock_code: [wsm_out], //出库仓库code
|
|
|
+ supplier_in_code: [], //入库供应商code
|
|
|
+ stock_in_code: [wsm_in], //入库仓库code
|
|
|
+ product_go: item, //出库商品
|
|
|
+ };
|
|
|
+ this.ruleForm.product_go.map((v) => {
|
|
|
+ v.usable_stock = v.usable_num;
|
|
|
+ v.type_code = v.good_type_code;
|
|
|
+ v.edit=f
|
|
|
+ return v;
|
|
|
+ });
|
|
|
} else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
await this.logout();
|
|
|
} else {
|
|
@@ -374,10 +460,43 @@ export default {
|
|
|
this.$message.warning("出入库仓库不能相同!");
|
|
|
return;
|
|
|
}
|
|
|
+ let index = -1,
|
|
|
+ isok = true,
|
|
|
+ ishas = true,
|
|
|
+ good = [];
|
|
|
+ this.ruleForm.product_go.forEach((v, i) => {
|
|
|
+ let goodModel = {
|
|
|
+ good_code: v.type_code,
|
|
|
+ allot_num: v.allot_num,
|
|
|
+ };
|
|
|
+
|
|
|
+ if (v.edit && index === -1) {
|
|
|
+ index = i;
|
|
|
+ }
|
|
|
+ let stock = parseInt(v.usable_stock),
|
|
|
+ num = parseInt(v.allot_num);
|
|
|
+ if (stock === 0) {
|
|
|
+ ishas = false;
|
|
|
+ }
|
|
|
+ if (num > stock) {
|
|
|
+ isok = false;
|
|
|
+ }
|
|
|
+ good.push(goodModel);
|
|
|
+ });
|
|
|
+ if (index !== -1) {
|
|
|
+ this.$message.warning("当前已有商品正在编辑!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!ishas) {
|
|
|
+ this.$message.warning("部分商品已无可用库存数,无法进行调拨操作!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!isok) {
|
|
|
+ this.$message.warning("部分商品调拨数量已大于可用库存数!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
this.loading = true;
|
|
|
- // const { username, name, mobile, email, role_id, status } = JSON.parse(
|
|
|
- // JSON.stringify(this.ruleForm)
|
|
|
- // );
|
|
|
|
|
|
const { stock_code, stock_in_code } = JSON.parse(
|
|
|
JSON.stringify(this.ruleForm)
|
|
@@ -388,14 +507,8 @@ export default {
|
|
|
id: this.id,
|
|
|
wsm_out: stock_code.toString(), //出库仓库
|
|
|
wsm_in: stock_in_code.toString(), //入库仓库
|
|
|
- good: [
|
|
|
- {
|
|
|
- good_code: "GD-GY199803100001",
|
|
|
- allot_num: 100,
|
|
|
- },
|
|
|
- ],
|
|
|
+ good: good,
|
|
|
};
|
|
|
- // console.log(model);
|
|
|
let res = {};
|
|
|
if (this.id === "add") {
|
|
|
delete model["id"];
|
|
@@ -404,15 +517,19 @@ export default {
|
|
|
res = await asyncRequest.update(model);
|
|
|
}
|
|
|
this.loading = false;
|
|
|
+ console.log("----------------!!!!!!!!!!!!!!!!!!!!----------------");
|
|
|
if (res && res.code === 0) {
|
|
|
const title = this.id === "add" ? "添加成功" : "修改成功";
|
|
|
this.$notify.success({
|
|
|
title,
|
|
|
message: "",
|
|
|
});
|
|
|
- this.showModelThis = false;
|
|
|
- // 刷新
|
|
|
- this.$emit("refresh");
|
|
|
+
|
|
|
+ if (this.id === "add") {
|
|
|
+ this.showModelThis = false;
|
|
|
+ // 刷新
|
|
|
+ this.$emit("refresh");
|
|
|
+ }
|
|
|
} else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
await this.logout();
|
|
|
} else {
|
|
@@ -446,7 +563,7 @@ export default {
|
|
|
editRow(rowIndex) {
|
|
|
let index = this.ruleForm.product_go.findIndex((v) => v.edit);
|
|
|
if (index !== -1) {
|
|
|
- this.$message.warning("请保存其他行!");
|
|
|
+ this.$message.warning("请完成其他行的编辑!");
|
|
|
return;
|
|
|
} else {
|
|
|
this.ruleForm.product_go[rowIndex].edit = true;
|
|
@@ -459,7 +576,7 @@ export default {
|
|
|
addList = JSON.parse(JSON.stringify(e)),
|
|
|
newList = [].concat(...oldList);
|
|
|
addList.forEach((v1, index) => {
|
|
|
- let oldindex = oldList.findIndex((v2) => v1.good_code === v2.good_code);
|
|
|
+ let oldindex = oldList.findIndex((v2) => v1.type_code === v2.type_code);
|
|
|
if (oldindex === -1) {
|
|
|
addList[index].allot_num = addList[index].usable_stock;
|
|
|
addList[index].edit = false;
|
|
@@ -529,7 +646,8 @@ export default {
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
-.allot {
|
|
|
+.allot,
|
|
|
+.allotDetail {
|
|
|
.label-title-model {
|
|
|
line-height: 30px;
|
|
|
width: 100%;
|
|
@@ -542,6 +660,23 @@ export default {
|
|
|
.product_go {
|
|
|
.el-form-item--mini.el-form-item {
|
|
|
margin: 0 !important;
|
|
|
+ .spscope {
|
|
|
+ word-break: break-all !important;
|
|
|
+ line-height: 23px !important;
|
|
|
+ padding: 0 !important;
|
|
|
+ margin: 0 !important;
|
|
|
+ list-style: none !important;
|
|
|
+ font-style: normal !important;
|
|
|
+ text-decoration: none !important;
|
|
|
+ border: none !important;
|
|
|
+ display: inline-block !important;
|
|
|
+ font-weight: 500 !important;
|
|
|
+ font-family: "Microsoft Yahei", sans-serif !important;
|
|
|
+ -webkit-tap-highlight-color: transparent !important;
|
|
|
+ -webkit-font-smoothing: antialiased !important;
|
|
|
+ color: #606266 !important;
|
|
|
+ font-size: 12px !important;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|