|
@@ -160,24 +160,56 @@
|
|
highlight-current-row
|
|
highlight-current-row
|
|
stripe
|
|
stripe
|
|
style="margin-bottom: 20px">
|
|
style="margin-bottom: 20px">
|
|
- <el-table-column align="center" label="大类" prop="mainName" min-width="120">
|
|
|
|
|
|
+ <el-table-column align="center" label="大类" prop="mainId" min-width="120">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- {{scope.row.mainName}}
|
|
|
|
|
|
+ <el-select
|
|
|
|
+ size="small"
|
|
|
|
+ v-model="scope.row.mainId"
|
|
|
|
+ filterable
|
|
|
|
+ placeholder="请选择"
|
|
|
|
+ :disabled="scope.row.goodsCode != ''"
|
|
|
|
+ @change="scope.row.mainName = mainList.find(o => o.categoryId == scope.row.mainId).name">
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="item in mainList"
|
|
|
|
+ :key="item.categoryId"
|
|
|
|
+ :label="item.name"
|
|
|
|
+ :value="item.categoryId">
|
|
|
|
+ </el-option>
|
|
|
|
+ </el-select>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
- <el-table-column align="center" label="小类" prop="smallName" min-width="120">
|
|
|
|
|
|
+ <el-table-column align="center" label="小类" prop="smallId" min-width="120">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- {{scope.row.smallName}}
|
|
|
|
|
|
+ <el-select
|
|
|
|
+ size="small"
|
|
|
|
+ v-model="scope.row.smallId"
|
|
|
|
+ filterable
|
|
|
|
+ placeholder="请选择"
|
|
|
|
+ :disabled="scope.row.goodsCode != ''"
|
|
|
|
+ @change="scope.row.smallName = mainList.find(o => o.categoryId == scope.row.mainId).children.find(o => o.categoryId == scope.row.smallId).name">
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="item in scope.row.mainId ? mainList.find(o => o.categoryId == scope.row.mainId).children : []"
|
|
|
|
+ :key="item.categoryId"
|
|
|
|
+ :label="item.name"
|
|
|
|
+ :value="item.categoryId">
|
|
|
|
+ </el-option>
|
|
|
|
+ </el-select>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
- <el-table-column align="center" label="商品名称" prop="goodsName" min-width="120">
|
|
|
|
|
|
+ <el-table-column align="center" label="商品名称" prop="specValue" min-width="180">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- {{scope.row.goodsName}}
|
|
|
|
|
|
+ <el-input size="small" v-model="scope.row.specValue" :disabled="scope.row.goodsCode != ''"></el-input>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
- <el-table-column align="center" label="规格型号" prop="goodsCode" min-width="120">
|
|
|
|
|
|
+ <el-table-column align="center" label="规格型号" prop="goodsCode" min-width="180">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- <el-select size="small" v-model="scope.row.goodsCode" filterable placeholder="请选择" @change="changeSpec(scope.$index, scope.row)">
|
|
|
|
|
|
+ <el-select
|
|
|
|
+ size="small"
|
|
|
|
+ v-model="scope.row.goodsCode"
|
|
|
|
+ filterable
|
|
|
|
+ clearable
|
|
|
|
+ placeholder="请选择"
|
|
|
|
+ @change="changeSpec(scope.$index, scope.row)">
|
|
<el-option
|
|
<el-option
|
|
v-for="item in goodsSpecList"
|
|
v-for="item in goodsSpecList"
|
|
:key="item.id"
|
|
:key="item.id"
|
|
@@ -348,7 +380,7 @@
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import { getToken } from '@/utils/auth'
|
|
import { getToken } from '@/utils/auth'
|
|
-import { getClassifyList, getFreightList, addGoods, editGoods, getGoodsDetail, getModuleList, getTagList, getBrand, getGoodsSpecList } from '@/api/goods'
|
|
|
|
|
|
+import { getClassifyList, getFreightList, addGoods, editGoods, getGoodsDetail, getModuleList, getTagList, getBrand, getGoodsSpecList, getMainList } from '@/api/goods'
|
|
import { getTypeList } from "@/api/workOrder/settlementStandardInstall";
|
|
import { getTypeList } from "@/api/workOrder/settlementStandardInstall";
|
|
import { quillEditor } from 'vue-quill-editor'
|
|
import { quillEditor } from 'vue-quill-editor'
|
|
import 'quill/dist/quill.core.css'
|
|
import 'quill/dist/quill.core.css'
|
|
@@ -496,6 +528,8 @@ export default {
|
|
tagList: [],
|
|
tagList: [],
|
|
|
|
|
|
showImageListUpload2: false,
|
|
showImageListUpload2: false,
|
|
|
|
+
|
|
|
|
+ mainList: [],
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
|
|
@@ -519,6 +553,7 @@ export default {
|
|
this.getTypeList();
|
|
this.getTypeList();
|
|
this.getBrand();
|
|
this.getBrand();
|
|
this.getGoodsSpecList();
|
|
this.getGoodsSpecList();
|
|
|
|
+ this.getMainList();
|
|
|
|
|
|
if (this.isEdit) {
|
|
if (this.isEdit) {
|
|
this.getGoodsDetail(id);
|
|
this.getGoodsDetail(id);
|
|
@@ -622,6 +657,16 @@ export default {
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
|
|
|
|
+ // 获取大类列表
|
|
|
|
+ getMainList() {
|
|
|
|
+ getMainList({
|
|
|
|
+ type: 2,
|
|
|
|
+ status: true
|
|
|
|
+ }).then(res => {
|
|
|
|
+ this.mainList = res.data;
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+
|
|
// 获取详情
|
|
// 获取详情
|
|
getGoodsDetail(goodsId) {
|
|
getGoodsDetail(goodsId) {
|
|
getGoodsDetail({ goodsId }).then(res => {
|
|
getGoodsDetail({ goodsId }).then(res => {
|
|
@@ -651,7 +696,6 @@ export default {
|
|
status: data.status,
|
|
status: data.status,
|
|
}
|
|
}
|
|
data.goodsSpecs.forEach(item => {
|
|
data.goodsSpecs.forEach(item => {
|
|
- item.goodsName = item.goodsMaterialName;
|
|
|
|
item.stockQty = item.goodsMaterialStock;
|
|
item.stockQty = item.goodsMaterialStock;
|
|
})
|
|
})
|
|
this.specList = data.goodsSpecs;
|
|
this.specList = data.goodsSpecs;
|
|
@@ -690,7 +734,7 @@ export default {
|
|
mainName: '', // 大类名称
|
|
mainName: '', // 大类名称
|
|
smallId: '', // 小类id
|
|
smallId: '', // 小类id
|
|
smallName: '', // 小类名称
|
|
smallName: '', // 小类名称
|
|
- goodsName: '', // 商品名称
|
|
|
|
|
|
+ specValue: '', // 商品名称
|
|
specsName: '', // 规格名称
|
|
specsName: '', // 规格名称
|
|
unit: '', // 单位
|
|
unit: '', // 单位
|
|
price: '', // 销售价格
|
|
price: '', // 销售价格
|
|
@@ -714,17 +758,17 @@ export default {
|
|
|
|
|
|
// 选择规格型号
|
|
// 选择规格型号
|
|
changeSpec(index, row) {
|
|
changeSpec(index, row) {
|
|
- let item = this.goodsSpecList.find(o => o.id == row.goodsCode);
|
|
|
|
- this.specList[index].goodsCode = item.id;
|
|
|
|
- this.specList[index].mainId = item.mainId;
|
|
|
|
- this.specList[index].mainName = item.mainName;
|
|
|
|
- this.specList[index].smallId = item.smallId;
|
|
|
|
- this.specList[index].smallName = item.smallName;
|
|
|
|
- this.specList[index].goodsName = item.goodsName;
|
|
|
|
- this.specList[index].specsName = item.specsName;
|
|
|
|
- this.specList[index].unit = item.unit;
|
|
|
|
- this.specList[index].costAmount = item.costAmount;
|
|
|
|
- this.specList[index].stockQty = item.stockQty;
|
|
|
|
|
|
+ let item = this.goodsSpecList.find(o => o.id == row.goodsCode) || {};
|
|
|
|
+ this.specList[index].goodsCode = item.id || '';
|
|
|
|
+ this.specList[index].mainId = item.mainId || '';
|
|
|
|
+ this.specList[index].mainName = item.mainName || '';
|
|
|
|
+ this.specList[index].smallId = item.smallId || '';
|
|
|
|
+ this.specList[index].smallName = item.smallName || '';
|
|
|
|
+ this.specList[index].specValue = item.goodsName || '';
|
|
|
|
+ this.specList[index].specsName = item.specsName || '';
|
|
|
|
+ this.specList[index].unit = item.unit || '';
|
|
|
|
+ this.specList[index].costAmount = item.costAmount || '';
|
|
|
|
+ this.specList[index].stockQty = item.stockQty || '';
|
|
},
|
|
},
|
|
|
|
|
|
// 点击 提交表单
|
|
// 点击 提交表单
|