|
@@ -1,9 +1,6 @@
|
|
|
<template>
|
|
|
<div class="app-container">
|
|
|
<div class="table">
|
|
|
- <div class="search">
|
|
|
- <el-button class="success" icon="el-icon-plus" @click="handleCreate">新增</el-button>
|
|
|
- </div>
|
|
|
<el-table
|
|
|
:key="table.tableKey"
|
|
|
v-loading="table.listLoading"
|
|
@@ -47,8 +44,8 @@
|
|
|
<el-form ref="temp" :rules="temp.rules" :model="temp" label-position="right" label-width="110px" style="width: 100%;margin:0 auto">
|
|
|
<el-row>
|
|
|
<el-col :span="24">
|
|
|
- <el-form-item label="消息名称:" prop="messageName">
|
|
|
- <span>{{temp.messageName}}</span>
|
|
|
+ <el-form-item label="消息名称:" prop="message">
|
|
|
+ <span>{{temp.message}}</span>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
@@ -178,6 +175,7 @@
|
|
|
<el-row :gutter="5">
|
|
|
<el-col :span="6">
|
|
|
<el-table
|
|
|
+ ref="setUpTable1"
|
|
|
:key="setUp.tableKey1"
|
|
|
v-loading="setUp.listLoading1"
|
|
|
element-loading-text="给我一点时间"
|
|
@@ -190,7 +188,7 @@
|
|
|
:cell-style="cellStyle"
|
|
|
class="elTable table-fixed"
|
|
|
@selection-change="handleSelectionChange1"
|
|
|
- :height="450"
|
|
|
+ :height="350"
|
|
|
>
|
|
|
<el-table-column type="selection" align="center" width="50" />
|
|
|
<el-table-column label="角色名" min-width="100px" align="center" prop="rolename" />
|
|
@@ -198,6 +196,7 @@
|
|
|
</el-col>
|
|
|
<el-col :span="18">
|
|
|
<el-table
|
|
|
+ ref="setUpTable2"
|
|
|
:key="setUp.tableKey2"
|
|
|
v-loading="setUp.listLoading2"
|
|
|
element-loading-text="给我一点时间"
|
|
@@ -210,7 +209,7 @@
|
|
|
:cell-style="cellStyle"
|
|
|
class="elTable table-fixed"
|
|
|
@selection-change="handleSelectionChange2"
|
|
|
- :height="450"
|
|
|
+ :height="350"
|
|
|
>
|
|
|
<el-table-column type="selection" align="center" width="50" />
|
|
|
<el-table-column label="用户名称" min-width="130px" align="center" prop="username" />
|
|
@@ -396,13 +395,13 @@
|
|
|
{ id: '3', name: '每月' },
|
|
|
],//周期类型
|
|
|
weekList:[
|
|
|
- { id: 'w1', name: '周一' },
|
|
|
- { id: 'w2', name: '周二' },
|
|
|
- { id: 'w3', name: '周三' },
|
|
|
- { id: 'w4', name: '周四' },
|
|
|
- { id: 'w5', name: '周五' },
|
|
|
- { id: 'w6', name: '周六' },
|
|
|
- { id: 'w7', name: '周日' },
|
|
|
+ { id: '1', name: '周一' },
|
|
|
+ { id: '2', name: '周二' },
|
|
|
+ { id: '3', name: '周三' },
|
|
|
+ { id: '4', name: '周四' },
|
|
|
+ { id: '5', name: '周五' },
|
|
|
+ { id: '6', name: '周六' },
|
|
|
+ { id: '7', name: '周日' },
|
|
|
],//周
|
|
|
monthList:[],//月
|
|
|
mechanism: '0',
|
|
@@ -427,7 +426,6 @@
|
|
|
pastureid: Cookies.get('pastureid')
|
|
|
}
|
|
|
},
|
|
|
- selectList1:[],
|
|
|
// 用户
|
|
|
tableKey2: 0,
|
|
|
list2: [],
|
|
@@ -440,7 +438,6 @@
|
|
|
roleid:''
|
|
|
}
|
|
|
},
|
|
|
- selectList2:[],
|
|
|
temp:{}
|
|
|
},
|
|
|
see:{
|
|
@@ -459,6 +456,8 @@
|
|
|
add:'新增',
|
|
|
see:'查看'
|
|
|
},
|
|
|
+ selectList1:[],
|
|
|
+ selectList2:[],
|
|
|
isokDisable:false,
|
|
|
rowStyle: { maxHeight: 30 + 'px', height: 30 + 'px' },
|
|
|
cellStyle: { padding: 0 + 'px' }
|
|
@@ -468,13 +467,12 @@
|
|
|
this.monthList = []
|
|
|
for(let i=1;i<=31;i++){
|
|
|
let obj = {}
|
|
|
- obj.id = 'd'+i
|
|
|
+ obj.id = i
|
|
|
obj.name = i+'日'
|
|
|
this.monthList.push(obj)
|
|
|
}
|
|
|
this.getList()
|
|
|
},
|
|
|
-
|
|
|
methods: {
|
|
|
getList() {
|
|
|
this.table.listLoading = true
|
|
@@ -505,45 +503,56 @@
|
|
|
this.setUp.dialogFormVisible = true
|
|
|
this.activeName = 'first'
|
|
|
this.setUp.temp = Object.assign({}, row)
|
|
|
- this.temp.messageName = row.data.type_name //消息名称
|
|
|
+ this.temp.messageName = row.data.message //消息名称
|
|
|
this.temp.triggerCondition = row.trigger //触发条件
|
|
|
+
|
|
|
+
|
|
|
+ // 立即
|
|
|
this.temp.sendingMethod = String(row.data.remind_type) //发送方式
|
|
|
- // if(this.temp.sendingMethod == '2'){
|
|
|
- // this.formatMinutes(row.data.interval_time) //延时
|
|
|
- // }
|
|
|
- // this.temp.sendTime = row.data.push_time //发送时间
|
|
|
- // if(row.data.push_limit == 1){//发送机制
|
|
|
- // this.temp.sendingMechanism = '1'
|
|
|
- // }else if(row.data.push_limit == 0){
|
|
|
- // this.temp.sendingMechanism = '3'
|
|
|
- // }else{
|
|
|
- // this.temp.sendingMechanism = '2'
|
|
|
- // }
|
|
|
- // this.temp.numberCycles = row.data.push_limit //循环次数
|
|
|
- // if(this.temp.sendingMechanism !== '1' && this.temp.sendingMechanism !== ''){
|
|
|
- // this.formatMinutes(row.data.interval_time) //间隔周期
|
|
|
- // }
|
|
|
- // data.cycle_type = this.temp.sendingMechanism //循环类型
|
|
|
- // data.date_type = this.temp.cycleType //周期类型
|
|
|
- // if(this.temp.cycleType == '1'){
|
|
|
- // data.push_date = ''
|
|
|
- // }else if(this.temp.cycleType == '2'){
|
|
|
- // data.push_date = this.temp.week
|
|
|
- // }else{
|
|
|
- // data.push_date = this.temp.month
|
|
|
- // }
|
|
|
- // 周期类型?
|
|
|
- if(row.data.date_type == 1){
|
|
|
- this.temp.cycleType == '1'
|
|
|
- }else if(row.data.date_type == 2){
|
|
|
- this.temp.cycleType == '2'
|
|
|
- row.data.push_date = this.temp.week
|
|
|
- }else{
|
|
|
- this.temp.cycleType == '3'
|
|
|
- row.data.push_date = this.temp.month
|
|
|
+ if(this.temp.sendingMethod == '1'){
|
|
|
+ this.temp.sendingMechanism = String(row.data.cycle_type) //发送机制
|
|
|
+ if(this.temp.sendingMechanism == '2'){
|
|
|
+ this.temp.numberCycles = row.data.push_limit //循环次数
|
|
|
+ if(this.temp.sendingMechanism !== '1' && this.temp.sendingMechanism !== ''){
|
|
|
+ this.formatMinutes(row.data.interval_time) //间隔周期
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(this.temp.sendingMechanism == '3'){
|
|
|
+ if(this.temp.sendingMechanism !== '1' && this.temp.sendingMechanism !== ''){
|
|
|
+ this.formatMinutes(row.data.interval_time) //间隔周期
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 延时
|
|
|
+ if(this.temp.sendingMethod == '2'){
|
|
|
+ this.temp.sendingMethod = String(row.data.remind_type) //发送方式
|
|
|
+ if(this.temp.sendingMethod == '2'){
|
|
|
+ this.formatMinutes(row.data.interval_time) //延时
|
|
|
+ }
|
|
|
+ this.temp.sendTime = row.data.push_time //发送时间
|
|
|
+ this.temp.push_limit = String(row.data.push_time) //发送机制
|
|
|
+ if(this.temp.push_limit == '2'){
|
|
|
+ this.temp.numberCycles = row.data.push_limit //循环次数
|
|
|
+ if(this.temp.sendingMechanism !== '1' && this.temp.sendingMechanism !== ''){
|
|
|
+ this.formatMinutes(row.data.interval_time) //间隔周期
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(this.temp.push_limit == '3'){
|
|
|
+ if(this.temp.sendingMechanism !== '1' && this.temp.sendingMechanism !== ''){
|
|
|
+ this.formatMinutes(row.data.interval_time) //间隔周期
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 指定周期
|
|
|
+ if(this.temp.sendingMethod == '3'){
|
|
|
+ this.temp.cycleType = String(row.data.date_type) //周期类型
|
|
|
+ if(this.temp.cycleType == '2'){
|
|
|
+ this.temp.week = row.data.push_date
|
|
|
+ }
|
|
|
+ if(this.temp.cycleType == '3'){
|
|
|
+ this.temp.month = row.data.push_date
|
|
|
+ }
|
|
|
}
|
|
|
- // this.temp.cycleType = row.data.push_limit //周期类型
|
|
|
- this.temp.sendTime = row.data.push_time //发送时间
|
|
|
this.getList1()
|
|
|
},
|
|
|
formatMinutes(minutes) {
|
|
@@ -581,17 +590,16 @@
|
|
|
},
|
|
|
handleSelectionChange1(val) {
|
|
|
console.log('勾选数据', val)
|
|
|
- this.setUp.selectList1 = []
|
|
|
+ this.selectList1 = []
|
|
|
for(let i=0;i<val.length;i++){
|
|
|
- this.setUp.selectList1.push(val[i].id)
|
|
|
+ this.selectList1.push(val[i].id)
|
|
|
}
|
|
|
- this.setUp.data2.parammaps.roleid = this.setUp.selectList1.join(',')
|
|
|
- console.log(this.setUp.data2.parammaps.roleid)
|
|
|
+ this.setUp.data2.parammaps.roleid = this.selectList1.join(',')
|
|
|
this.getList2()
|
|
|
},
|
|
|
handleSelectionChange2(val) {
|
|
|
- console.log('勾选数据', val)
|
|
|
- this.setUp.selectList2 = val
|
|
|
+ this.selectList2 = val.map(item=>item.username)
|
|
|
+ console.log('勾选数据', this.selectList2)
|
|
|
},
|
|
|
|
|
|
handleGenerateQRcode(){
|
|
@@ -607,7 +615,19 @@
|
|
|
postJson(url,this.setUp.data1).then(response => {
|
|
|
if (response.data.list !== null) {
|
|
|
this.setUp.list1 = response.data.list
|
|
|
- this.setUp.data2.parammaps.roleid = ''
|
|
|
+ if(this.selectList1.length== 0){
|
|
|
+ this.setUp.data2.parammaps.roleid = response.data.list[0]['id']
|
|
|
+ this.selectList1.push(response.data.list[0]['id'])
|
|
|
+ }
|
|
|
+ this.selectList1.forEach(key => {
|
|
|
+ this.setUp.list1.forEach(row => {
|
|
|
+ if (row.id == key) {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.setUpTable1.toggleRowSelection(row, true);
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
this.getList2()
|
|
|
} else {
|
|
|
this.setUp.list1 = []
|
|
@@ -623,12 +643,23 @@
|
|
|
postJson(url,this.setUp.data2).then(response => {
|
|
|
if (response.data.list !== null) {
|
|
|
this.setUp.list2 = response.data.list
|
|
|
- if(this.setUp.selectList1.length > 0){
|
|
|
- this.$set(this.setUp,'selectList2',response.data.list)
|
|
|
- }
|
|
|
+ this.selectList2 = []
|
|
|
+ response.data.list.forEach(key => {
|
|
|
+ this.selectList2.push(key.username)
|
|
|
+ })
|
|
|
+ this.selectList2.forEach(key => {
|
|
|
+ this.setUp.list2.forEach(row => {
|
|
|
+ if (row.username == key) {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.setUpTable2.toggleRowSelection(row, true);
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
} else {
|
|
|
this.setUp.list2 = []
|
|
|
}
|
|
|
+ console.log(this.selectList2,'this.selectList2')
|
|
|
setTimeout(() => {
|
|
|
this.setUp.listLoading2 = false
|
|
|
}, 100)
|
|
@@ -687,7 +718,27 @@
|
|
|
// delayed1 延时
|
|
|
// sendTime 发送时间
|
|
|
// numberCycles 循环次数
|
|
|
+ // 发送方式-立即
|
|
|
if(this.temp.sendingMethod == '1'){
|
|
|
+ data.sys_name = 'tmrWatch'
|
|
|
+ data.pasture_id = this.setUp.temp.pastureid
|
|
|
+ data.service_id = this.setUp.temp.service_id
|
|
|
+ data.type_name = this.temp.messageName
|
|
|
+ data.template_id = 'BtkN1rWKOJtKP0C64lGxIrPzLRFsYFas-4gupX2-pFo'
|
|
|
+ data.id = this.setUp.temp.id
|
|
|
+ data.user = this.selectList2
|
|
|
+ data.remind_type = parseInt(this.temp.sendingMethod) //发送方式123
|
|
|
+ data.cycle_type = parseInt(this.temp.sendingMechanism) //发送机制123
|
|
|
+ if(this.temp.sendingMechanism == 2){
|
|
|
+ data.push_limit = this.temp.numberCycles //循环次数
|
|
|
+ data.interval_time = intervalPeriodTime //间隔周期
|
|
|
+ }
|
|
|
+ if(this.temp.sendingMechanism == 3){
|
|
|
+ data.interval_time = intervalPeriodTime //间隔周期
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 发送方式-延时
|
|
|
+ if(this.temp.sendingMethod == '2'){
|
|
|
data.id = this.setUp.temp.id
|
|
|
data.user = this.setUp.temp.user
|
|
|
data.sys_name = 'tmrWatch'
|
|
@@ -695,54 +746,35 @@
|
|
|
data.template_id = 'BtkN1rWKOJtKP0C64lGxIrPzLRFsYFas-4gupX2-pFo'
|
|
|
data.pastureid = Cookies.get('pastureid')
|
|
|
data.remind_type = parseInt(this.temp.sendingMethod) //发送方式123
|
|
|
+ data.delay_time = delayedTime //延时
|
|
|
+ data.push_time = this.temp.sendTime //发送时间
|
|
|
data.cycle_type = parseInt(this.temp.sendingMechanism) //发送机制123
|
|
|
if(this.temp.sendingMechanism == 2){
|
|
|
data.push_limit = this.temp.numberCycles //循环次数
|
|
|
- // data.
|
|
|
+ data.interval_time = intervalPeriodTime
|
|
|
+ }
|
|
|
+ if(this.temp.sendingMechanism == 3){
|
|
|
+ data.interval_time = intervalPeriodTime //间隔周期
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 发送方式-指定周期
|
|
|
+ if(this.temp.sendingMethod == '3'){
|
|
|
+ data.id = this.setUp.temp.id
|
|
|
+ data.user = this.setUp.temp.user
|
|
|
+ data.sys_name = 'tmrWatch'
|
|
|
+ data.type_name = this.temp.messageName
|
|
|
+ data.template_id = 'BtkN1rWKOJtKP0C64lGxIrPzLRFsYFas-4gupX2-pFo'
|
|
|
+ data.pastureid = Cookies.get('pastureid')
|
|
|
+ data.remind_type = parseInt(this.temp.sendingMethod) //发送方式123
|
|
|
+ data.cycle_type = '4'//发送机制
|
|
|
+ data.date_type = parseInt(this.temp.cycleType) //周期类型
|
|
|
+ data.push_time = this.temp.sendTime //发送时间
|
|
|
+ if(this.temp.cycleType == 2){
|
|
|
+ data.push_date = this.temp.week
|
|
|
+ }else{
|
|
|
+ data.push_date = this.temp.month
|
|
|
}
|
|
|
}
|
|
|
- // data.remind_type = parseInt(this.temp.sendingMethod)
|
|
|
- // let dateTime = 0
|
|
|
- // let delayed1 = 0
|
|
|
- // let delayed2 = 0
|
|
|
- // let delayed3 = 0
|
|
|
-
|
|
|
- // if(this.temp.delayed1 !== ''){
|
|
|
- // delayed1 = parseInt(this.temp.delayed1)*24*60
|
|
|
- // }else {
|
|
|
- // delayed1 = 0
|
|
|
- // }
|
|
|
- // if(this.temp.delayed2 !== ''){
|
|
|
- // delayed2 = parseInt(this.temp.delayed2)*60
|
|
|
- // }else {
|
|
|
- // delayed2 = 0
|
|
|
- // }
|
|
|
- // if(this.temp.delayed3 !== ''){
|
|
|
- // delayed3 = parseInt(this.temp.delayed3)
|
|
|
- // }else{
|
|
|
- // delayed2 = 0
|
|
|
- // }
|
|
|
- // dateTime = delayed1+ delayed2 + delayed3
|
|
|
- // if(this.temp.cycleType == '1'){
|
|
|
- // data.push_date = 0
|
|
|
- // }else if(this.temp.cycleType == '2'){
|
|
|
- // data.push_date = this.temp.week
|
|
|
- // }else{
|
|
|
- // data.push_date = this.temp.month
|
|
|
- // }
|
|
|
- // data.push_time = this.temp.sendTime
|
|
|
- // data.interval_time = dateTime
|
|
|
- // if(this.temp.sendingMechanism == '1'){
|
|
|
- // data.push_limit = 1
|
|
|
- // }else if(this.temp.sendingMechanism == '2'){
|
|
|
- // data.push_limit = this.temp.numberCycles
|
|
|
- // }else{
|
|
|
- // data.push_limit = 0
|
|
|
- // }
|
|
|
-
|
|
|
- // data.cycle_type = this.temp.sendingMechanism //循环类型
|
|
|
- // data.date_type = this.temp.cycleType //周期类型
|
|
|
-
|
|
|
postJson(url,data).then(response => {
|
|
|
if(response.code == 200){
|
|
|
console.log('成功')
|
|
@@ -752,11 +784,6 @@
|
|
|
console.log('失败')
|
|
|
}
|
|
|
})
|
|
|
- },
|
|
|
- handleCreate(){
|
|
|
- this.setUp.dialogStatus = 'add'
|
|
|
- this.setUp.dialogFormVisible = true
|
|
|
- this.activeName = 'first'
|
|
|
}
|
|
|
}
|
|
|
}
|