Commit da0ae5d8 by liimin

完善组件

1 parent 44a94b84
...@@ -59,10 +59,10 @@ ...@@ -59,10 +59,10 @@
> >
<gl-form-item label='选择用户:'> <gl-form-item label='选择用户:'>
<gl-select <gl-select
v-model="model.user" v-model="result.influenceScope"
placeholder="请选择用户" placeholder="请选择用户"
style="width:100%" style="width:100%"
name="user" name="influenceScope"
data-vv-as="用户" data-vv-as="用户"
v-validate="'required'" v-validate="'required'"
> >
...@@ -74,16 +74,16 @@ ...@@ -74,16 +74,16 @@
/> />
</gl-select> </gl-select>
<span <span
v-show="errorBags && errorBags.has('user')" v-show="errorBags && errorBags.has('influenceScope')"
class="error" class="error"
> >
{{ errorBags && errorBags.first('user') }} {{ errorBags && errorBags.first('influenceScope') }}
</span> </span>
</gl-form-item> </gl-form-item>
</gl-col> </gl-col>
<gl-col <gl-col
:span="24" :span="24"
v-if="!manufactureOnly && model.user==='LIST'" v-if="!manufactureOnly && result.influenceScope==='LIST'"
> >
<gl-form-item label='灰度用户:'> <gl-form-item label='灰度用户:'>
<gl-upload <gl-upload
...@@ -96,6 +96,7 @@ ...@@ -96,6 +96,7 @@
name="grayscaleUserList" name="grayscaleUserList"
data-vv-as="灰度用户" data-vv-as="灰度用户"
v-validate="'required'" v-validate="'required'"
:file-list="model.file_list"
multiple multiple
> >
<gl-button <gl-button
...@@ -136,7 +137,8 @@ export default { ...@@ -136,7 +137,8 @@ export default {
width: String, width: String,
manufactureOnly: Boolean, manufactureOnly: Boolean,
in_row: Boolean, in_row: Boolean,
uploadAction: String uploadAction: String,
default_value: Object
// errorBags: Object // errorBags: Object
}, },
watch: { watch: {
...@@ -179,37 +181,50 @@ export default { ...@@ -179,37 +181,50 @@ export default {
{ label: '指定用户(灰度)', value: 'LIST' } { label: '指定用户(灰度)', value: 'LIST' }
], ],
model: { model: {
user: '',
merchantId: '', merchantId: '',
manufacturerId: '' manufacturerId: '',
file_list: [] //文件列表
}, },
result: { result: {
manufacturers: null, manufacturers: null, //生产厂商
merchants: null, merchants: null, //商户渠道
grayscaleUserList: null grayscaleUserList: null, //灰度用户列表
influenceScope: '' //用户类型
} }
} }
}, },
methods: { methods: {
get_manufacturer_list() { get_manufacturer_list() {
if (manufacturer_list_back_up.length) { return new Promise((resolve, reject) => {
this.manufacturer_list = manufacturer_list_back_up if (manufacturer_list_back_up.length) {
return // this.manufacturer_list = manufacturer_list_back_up
} resolve(manufacturer_list_back_up)
manufacturers }
.req({}) manufacturers
.then(res => (manufacturer_list_back_up = this.manufacturer_list = res)) .req({})
.catch(err => this.error(err)) .then(res =>
// manufacturer_list_back_up = this.manufacturer_list = res
// this.model.manufacturerId = this.default_value.manufacturerId
resolve(res)
)
.catch(err => reject(err))
})
}, },
get_merchant_list() { get_merchant_list() {
if (merchant_list_back_up.length) { return new Promise((resolve, reject) => {
this.merchant_list = merchant_list_back_up if (merchant_list_back_up.length) {
return // this.merchant_list = merchant_list_back_up
} resolve(merchant_list_back_up)
merchants }
.req({ merchantType: 401, merchantStatus: 0 }) merchants
.then(res => (merchant_list_back_up = this.merchant_list = res)) .req({ merchantType: 401, merchantStatus: 0 })
.catch(err => this.error(err)) .then(
res => resolve(res)
// merchant_list_back_up = this.merchant_list = res
// this.model.merchantId = this.default_value.merchantId
)
.catch(err => reject(err))
})
}, },
// 上传灰度用户成功后调接口解析Excel // 上传灰度用户成功后调接口解析Excel
success_grayscaleuser(res) { success_grayscaleuser(res) {
...@@ -237,9 +252,26 @@ export default { ...@@ -237,9 +252,26 @@ export default {
this.model.grayscaleUserList = '' this.model.grayscaleUserList = ''
} }
}, },
mounted() { created() {
this.get_manufacturer_list() if (this.default_value) {
this.get_merchant_list() this.model.merchantId = this.default_value.merchantId
this.model.manufacturerId = this.default_value.manufacturerId
this.result.influenceScope = this.default_value.influenceScope
this.model.file_list = this.default_value.file_list
this.result.grayscaleUserList = this.default_value.grayscaleuser
/**
* file_list
* [{name: 'food.jpg', url: 'https://xxx.cdn.com/xxx.jpg'}]
*/
}
Promise.all([this.get_manufacturer_list(), this.get_merchant_list()]).then(
result => {
manufacturer_list_back_up = this.manufacturer_list = result[0]
this.model.manufacturerId = this.default_value.manufacturerId
merchant_list_back_up = this.merchant_list = result[1]
this.model.merchantId = this.default_value.merchantId
}
)
} }
} }
</script> </script>
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
:in_row='true' :in_row='true'
:value.sync="editForm.manufacturer" :value.sync="editForm.manufacturer"
:uploadAction="uploadAction" :uploadAction="uploadAction"
:default_value="default_value"
/> />
<!-- </gl-form-item> --> <!-- </gl-form-item> -->
</gl-col> </gl-col>
...@@ -295,6 +296,13 @@ export default { ...@@ -295,6 +296,13 @@ export default {
children: 'children', children: 'children',
label: 'label' label: 'label'
}, },
default_value: {
// merchantId: 19180001,
manufacturerId: 10012,
file_list: [{ name: 'food.jpg', url: 'https://xxx.cdn.com/xxx.jpg' }],
influenceScope: 'LIST',
grayscaleuser: ['11']
},
triModel: { triModel: {
pop: false, pop: false,
dialog: true dialog: true
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!