|
@@ -1,23 +1,13 @@
|
|
<template>
|
|
<template>
|
|
<div>
|
|
<div>
|
|
- <el-button type="primary" size="small" @click="dialogTableVisible=true">新增明细</el-button>
|
|
|
|
- <el-dialog title="产品组明细" append-to-body :visible.sync="dialogTableVisible" width="30%">
|
|
|
|
- <el-form label-position="right" ref="form" :rules="rules" inline label-width="100px" :model="form" size="small">
|
|
|
|
- <el-form-item label="商品" prop="product">
|
|
|
|
- <el-select v-model="form.product" multiple placeholder="请选择商品">
|
|
|
|
- <el-option
|
|
|
|
- v-for="item in productList()"
|
|
|
|
- :key="item.itemid"
|
|
|
|
- :label="item.itemname"
|
|
|
|
- :value="item.itemid">
|
|
|
|
- </el-option>
|
|
|
|
- </el-select>
|
|
|
|
- </el-form-item>
|
|
|
|
- </el-form>
|
|
|
|
|
|
+ <el-button type="primary" size="small" @click="dialogTableVisible=true">新增商品</el-button>
|
|
|
|
+ <el-dialog title="产品组商品新增" append-to-body :visible.sync="dialogTableVisible" width="50%">
|
|
|
|
+ <table1 v-if="productList()" @checkboxCallBack="checkboxCallBack" :layout="tablecols" :data="productList()" :opwidth="200" :custom="false" :height="300" :checkbox="true">
|
|
|
|
+ </table1>
|
|
<span slot="footer" class="dialog-footer">
|
|
<span slot="footer" class="dialog-footer">
|
|
<div>
|
|
<div>
|
|
<el-button @click="dialogTableVisible = false" size="small">取 消</el-button>
|
|
<el-button @click="dialogTableVisible = false" size="small">取 消</el-button>
|
|
- <el-button type="primary" @click="submit" size="small">确 定</el-button>
|
|
|
|
|
|
+ <el-button type="primary" @click="submit" size="small" :disabled="product.length == 0">确 定</el-button>
|
|
</div>
|
|
</div>
|
|
</span>
|
|
</span>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
@@ -26,18 +16,13 @@
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import { log } from '@antv/g2plot/lib/utils'
|
|
import { log } from '@antv/g2plot/lib/utils'
|
|
|
|
+import table1 from '@/components/table/index'
|
|
export default {
|
|
export default {
|
|
data () {
|
|
data () {
|
|
return {
|
|
return {
|
|
dialogTableVisible:false,
|
|
dialogTableVisible:false,
|
|
- form: {
|
|
|
|
- product:[]
|
|
|
|
- },
|
|
|
|
- rules: {
|
|
|
|
- product: [
|
|
|
|
- { required: true, message: '请选择商品', trigger: 'blur' },
|
|
|
|
- ],
|
|
|
|
- }
|
|
|
|
|
|
+ product:[],
|
|
|
|
+ tablecols:[]
|
|
}
|
|
}
|
|
},
|
|
},
|
|
inject: ['productList'],
|
|
inject: ['productList'],
|
|
@@ -45,39 +30,39 @@ export default {
|
|
watch: {
|
|
watch: {
|
|
|
|
|
|
},
|
|
},
|
|
|
|
+ components:{table1},
|
|
created() {
|
|
created() {
|
|
-
|
|
|
|
|
|
+ this.tablecols = this.tool.tabelCol(this.$route.name).addProductTable.tablecols
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- submit() {
|
|
|
|
- this.$refs.form.validate(async val => {
|
|
|
|
- if(val) {
|
|
|
|
- this.form.product = this.form.product.map(item => {
|
|
|
|
- return {
|
|
|
|
- sa_itemgroupmxid:0,
|
|
|
|
- itemid:item
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- let res = await this.$api.requested({
|
|
|
|
- "accesstoken": "69f1a508bad99ddffdce4bc3c919a0d0",
|
|
|
|
- "id": "20220923110303",
|
|
|
|
- "version":1,
|
|
|
|
- "content": {
|
|
|
|
- "sa_itemgroupid":this.id,
|
|
|
|
- "itemclassinfos":this.form.product
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- this.tool.showMessage(res,() => {
|
|
|
|
- this.dialogTableVisible = false
|
|
|
|
- this.$emit('onSuccess')
|
|
|
|
- })
|
|
|
|
|
|
+ async submit() {
|
|
|
|
+ if(this.product.length == 0) return
|
|
|
|
+ this.product = this.product.map(item => {
|
|
|
|
+ return {
|
|
|
|
+ sa_itemgroupmxid:0,
|
|
|
|
+ itemid:item.itemid
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ let res = await this.$api.requested({
|
|
|
|
+ "accesstoken": "69f1a508bad99ddffdce4bc3c919a0d0",
|
|
|
|
+ "id": "20220923110303",
|
|
|
|
+ "version":1,
|
|
|
|
+ "content": {
|
|
|
|
+ "sa_itemgroupid":this.id,
|
|
|
|
+ "itemclassinfos":this.product
|
|
}
|
|
}
|
|
- })
|
|
|
|
|
|
+ })
|
|
|
|
+ this.tool.showMessage(res,() => {
|
|
|
|
+ this.dialogTableVisible = false
|
|
|
|
+ this.$emit('onSuccess')
|
|
|
|
+ })
|
|
},
|
|
},
|
|
handleClose(tag) {
|
|
handleClose(tag) {
|
|
this.form.tag.splice(this.form.tag.indexOf(tag), 1);
|
|
this.form.tag.splice(this.form.tag.indexOf(tag), 1);
|
|
},
|
|
},
|
|
-
|
|
|
|
|
|
+ checkboxCallBack(data) {
|
|
|
|
+ this.product = data
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -93,13 +78,4 @@ export default {
|
|
/deep/.el-form-item__content {
|
|
/deep/.el-form-item__content {
|
|
width: calc(100% - 100px) !important;
|
|
width: calc(100% - 100px) !important;
|
|
}
|
|
}
|
|
-/deep/.el-select {
|
|
|
|
- width: 100% !important;
|
|
|
|
-}
|
|
|
|
-/deep/.el-form-item {
|
|
|
|
- width: 100% !important;
|
|
|
|
-}
|
|
|
|
-/deep/.el-input{
|
|
|
|
- width: 100% !important;
|
|
|
|
-}
|
|
|
|
</style>
|
|
</style>
|