|
@@ -13,7 +13,12 @@
|
13
|
13
|
<div class="regulations" style="margin-bottom:20px;">
|
14
|
14
|
<label>选择模板</label>
|
15
|
15
|
<div>
|
16
|
|
- <el-select v-model="selectedTempId" class="select-cls" style="width:300px;" size="small" placeholder="请选择" filterable @change="onChangeTempId">
|
|
16
|
+ <el-select v-model="tempGroupId" class="select-cls" style="width:200px;" size="small" placeholder="请选择模板分组" filterable @change="onChangeTempGroupId">
|
|
17
|
+ <el-option v-for="tempGroup in tempGroupOptions" :key="tempGroup.group_id" :label="tempGroup.title" :value="tempGroup.group_id" />
|
|
18
|
+ </el-select>
|
|
19
|
+ </div>
|
|
20
|
+ <div style="margin-left:10px;">
|
|
21
|
+ <el-select v-model="selectedTempId" class="select-cls" style="width:200px;" size="small" placeholder="请选择模板" filterable @change="onChangeTempId">
|
17
|
22
|
<el-option v-for="temp in templateOptions" :key="temp.template_id" :label="temp.title" :value="temp.template_id" />
|
18
|
23
|
</el-select>
|
19
|
24
|
</div>
|
|
@@ -179,7 +184,7 @@ import { getIntegerNumber, isJSON } from '@/assets/js/common'
|
179
|
184
|
|
180
|
185
|
export default {
|
181
|
186
|
components: { selfChannel, selfCustomerservice, customerServiceCorpV2, datePicker, enterpriseTag, editCon, screenPay, pushGroupDialog },
|
182
|
|
- props: ['title', 'rule_id', 'isCopy', 'createTemplateId'],
|
|
187
|
+ props: ['title', 'rule_id', 'isCopy', 'createTempGroupId', 'createTemplateId'],
|
183
|
188
|
data () {
|
184
|
189
|
return {
|
185
|
190
|
loading: true,
|
|
@@ -217,8 +222,10 @@ export default {
|
217
|
222
|
oldParams: {}, // 复制对象的参数 => 用于新旧参数比较 判断用户是否做出修改
|
218
|
223
|
detailFromApi: Object.freeze({}), // 后端返回的详情完整数据
|
219
|
224
|
|
220
|
|
- selectedTempId: '',
|
221
|
|
- templateOptions: [],
|
|
225
|
+ tempGroupId: '', // 模板分组id
|
|
226
|
+ tempGroupOptions: [], // 模板分组选项
|
|
227
|
+ selectedTempId: '', // 已选模板id
|
|
228
|
+ templateOptions: [], // 模板选项
|
222
|
229
|
|
223
|
230
|
group_id: '',
|
224
|
231
|
groupOptions: [],
|
|
@@ -237,7 +244,7 @@ export default {
|
237
|
244
|
},
|
238
|
245
|
},
|
239
|
246
|
created () {
|
240
|
|
- this.handleGetTemplateOptions()
|
|
247
|
+ this.handleGetTempGroupOptions()
|
241
|
248
|
this.handleGetGroupOptions()
|
242
|
249
|
|
243
|
250
|
if (this.rule_id) {//详情
|
|
@@ -247,6 +254,10 @@ export default {
|
247
|
254
|
this.isShowEditCon = true;
|
248
|
255
|
}
|
249
|
256
|
|
|
257
|
+ if (this.createTempGroupId || String(this.createTempGroupId) === '0') {
|
|
258
|
+ this.tempGroupId = this.createTempGroupId
|
|
259
|
+ this.handleGetTemplateOptions()
|
|
260
|
+ }
|
250
|
261
|
if (this.createTemplateId) { // 根据指定模板创建
|
251
|
262
|
this.onChangeTempId(this.createTemplateId)
|
252
|
263
|
}
|
|
@@ -707,8 +718,28 @@ export default {
|
707
|
718
|
this.pushGroupVisible = false
|
708
|
719
|
},
|
709
|
720
|
|
|
721
|
+ async handleGetTempGroupOptions() {
|
|
722
|
+ const params = { status: 1, page: 1, page_size: 1000 }
|
|
723
|
+ const { data: res = {} } = await this.$axios.post(this.URL.BASEURL + this.URL.smartPushV3_tempGroupList, params)
|
|
724
|
+ if (res && res.errno == 0 && Array.isArray(res.rst.data)) {
|
|
725
|
+ this.tempGroupOptions = [
|
|
726
|
+ { group_id: 0, title: '未分组' },
|
|
727
|
+ ...res.rst.data
|
|
728
|
+ ]
|
|
729
|
+ } else if (res.errno != 4002) {
|
|
730
|
+ this.$message.warning(res.err)
|
|
731
|
+ this.tempGroupOptions = [];
|
|
732
|
+ }
|
|
733
|
+ },
|
|
734
|
+ onChangeTempGroupId(tempGroupId) {
|
|
735
|
+ this.selectedTempId = ''
|
|
736
|
+ this.templateOptions = []
|
|
737
|
+ this.tempGroupId = tempGroupId
|
|
738
|
+ this.handleGetTemplateOptions()
|
|
739
|
+ },
|
|
740
|
+
|
710
|
741
|
async handleGetTemplateOptions() {
|
711
|
|
- const params = { group_id: this.$route.query.group_id, status: 1, page: 1, page_size: 1000 }
|
|
742
|
+ const params = { group_id: this.tempGroupId, status: 1, page: 1, page_size: 1000 }
|
712
|
743
|
const { data: res = {} } = await this.$axios.get(this.URL.BASEURL + this.URL.smartPushV3_templateList, { params })
|
713
|
744
|
if (res && res.errno == 0 && Array.isArray(res.rst.data)) {
|
714
|
745
|
this.templateOptions = res.rst.data;
|