123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283 |
- <!--消息模板-->
- <template>
- <div class="app-container messageTemplate">
- <div class="page-container messageTemplatePage" v-if="pageType == 1">
- <div class="page-form-title-box">
- <el-form :model="queryParams" class="form-box" ref="queryForm"
- :inline="true" style="width:100%;">
- <el-form-item label="" prop="templateName">
- <el-input
- maxLength="30"
- v-model="queryParams.templateName"
- placeholder="请输入名称"
- clearable
- style="width: 200px"
- />
- </el-form-item>
- <el-form-item label="" prop="alarmType">
- <el-select v-model="queryParams.alarmType" clearable placeholder="请选择方式" style="width: 200px">
- <el-option
- v-for="dict in typeList"
- :key="dict.id"
- :label="dict.name"
- :value="dict.id"
- />
- </el-select>
- </el-form-item>
- <p class="page-inquire-common-style-button" @click="handleQuery">查询</p>
- <p class="page-reset-common-style-button" @click="resetQuery">重置</p>
- <p class="page-submit-common-style-button"
- style="float: right;"
- @click="tableButton(1)"
- v-hasPermiRouter="['iot:alertTemplate:add']"
- >新增</p>
- </el-form>
- </div>
- <div class="page-content-box">
- <el-table class="table-box" v-loading="loading" border :data="dataList">
- <el-table-column label="模板名称" align="left" width="200" prop="templateName" />
- <el-table-column label="方式" align="left" prop="alarmType" width="100" show-overflow-tooltip>
- <template slot-scope="scope">
- <p v-for="(item,index) in typeList" :key="index" v-show="item.id == scope.row.alarmType">{{item.name}}</p>
- </template>
- </el-table-column>
- <el-table-column label="类型" align="left" prop="category" width="160" show-overflow-tooltip>
- <template slot-scope="scope">
- {{scope.row.alarmType==1&&scope.row.category==1?'钉钉消息':(
- scope.row.alarmType==1&&scope.row.category==2?'钉钉群消息':(
- scope.row.alarmType==2?'企业微信':(
- scope.row.alarmType==3?'--':(
- scope.row.alarmType==4&&scope.row.category==1?'专业设备':(
- scope.row.alarmType==4&&scope.row.category==2?'云语音':(
- scope.row.alarmType==5&&scope.row.category==1?'专业设备':(
- scope.row.alarmType==5&&scope.row.category==2?'云短信':'')))))))
- }}
- </template>
- </el-table-column>
- <el-table-column label="内容" align="left" prop="content" show-overflow-tooltip/>
- <el-table-column label="状态" align="left" prop="state" width="100" show-overflow-tooltip>
- <template slot-scope="scope">
- <el-switch
- @click.native="tableButton(6,scope.row)"
- class="switch captcha-img"
- :active-value="true"
- :inactive-value="false"
- active-color="#0183FA"
- inactive-color="#999"
- v-model="scope.row.state"
- active-text="启用"
- inactive-text="停用"
- disabled
- ></el-switch>
- </template>
- </el-table-column>
- <el-table-column label="创建时间" align="left" prop="createTime" width="200" show-overflow-tooltip>
- <template slot-scope="scope">
- <span>{{ parseTime(scope.row.createTime,"{y}-{m}-{d} {h}:{i}") }}</span>
- </template>
- </el-table-column>
- <el-table-column label="操作" align="left" class-name="small-padding fixed-width" width="240" v-if="tableButtonType">
- <template slot-scope="scope">
- <div class="table-button-box">
- <p class="table-button-null"></p>
- <p class="table-button-p"
- @click="tableButton(2,scope.row)"
- v-hasPermiRouter="['iot:alertTemplate:detail']"
- >详情</p>
- <p class="table-button-p"
- @click="tableButton(3,scope.row)"
- v-hasPermiRouter="['iot:alertTemplate:edit']"
- >编辑</p>
- <p class="table-button-p"
- @click="tableButton(4,scope.row)"
- v-hasPermiRouter="['iot:alertTemplate:perms']"
- >调试</p>
- <p class="table-button-p"
- @click="tableButton(5,scope.row)"
- v-hasPermiRouter="['iot:alertTemplate:del']"
- >删除</p>
- <p class="table-button-null"></p>
- </div>
- </template>
- </el-table-column>
- </el-table>
- <pagination :page-sizes="[20, 30, 40, 50]"
- v-show="total>0"
- :total="total"
- :page.sync="queryParams.page"
- :limit.sync="queryParams.pageSize"
- @pagination="getList"
- />
- </div>
- </div>
- <addPage :propsData="propsData" v-if="pageType == 2"></addPage>
- </div>
- </template>
- <script>
- import { iotAlarmTemplateList,iotAlarmTemplateAdd,iotAlarmTemplateUpdate,iotAlarmSendCheck,iotAlarmTemplateDelete,iotAlarmTemplateChangeState } from "@/api/iotDevice/index";
- import addPage from "./addPage.vue";
- export default {
- name: 'index',
- components: {
- addPage
- },
- data(){
- return{
- tableButtonType:this.hasPermiDom(['iot:alertTemplate:detail','iot:alertTemplate:edit','iot:alertTemplate:perms','iot:alertTemplate:del',]),
- pageType:1,
- loading:false,
- typeList:[
- {name:"钉钉",id:1,},
- {name:"微信",id:2,},
- {name:"邮件",id:3,},
- {name:"电话",id:4,},
- {name:"短信",id:5,},
- ],
- queryParams:{
- page:1,
- pageSize:20,
- templateName:"",
- jobGroup:null,
- alarmType:null,
- },
- dataList:[],
- total:0,
- propsData:{},
- }
- },
- created(){
- },
- mounted(){
- this.getList();
- },
- methods:{
- handleQuery(){
- this.$set(this.queryParams,'page',1);
- this.getList();
- },
- resetQuery(){
- this.$set(this,'queryParams',{
- page:1,
- pageSize:20,
- templateName:"",
- alarmType:null,
- });
- this.getList();
- },
- dialogFormReset(){
- this.$set(this,'dialogForm',{
- });
- },
- //获取数据列表
- getList(){
- this.$set(this,'loading',true);
- iotAlarmTemplateList(this.queryParams).then(response => {
- this.$set(this,'loading',false);
- this.$set(this,'dataList',response.data.records);
- this.$set(this,'total',response.data.total);
- });
- },
- tableButton(type,row){
- let self = this;
- if(type == 1){
- this.$set(this,'pageType',2);
- this.$set(this,'propsData',{});
- }else if(type == 2){
- this.$set(this,'pageType',2);
- let obj = JSON.parse(JSON.stringify(row))
- obj.showType = true;
- this.$set(this,'propsData',obj);
- }else if(type == 3){
- this.$set(this,'pageType',2);
- let obj = JSON.parse(JSON.stringify(row))
- obj.showType = false;
- this.$set(this,'propsData',obj);
- }else if(type == 4){
- //调试
- this.$confirm('是否确认发送调试信息?', "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(function() {
- }).then(() => {
- iotAlarmSendCheck({templateId:row.templateId}).then(response => {
- self.msgSuccess(response.message)
- });
- }).catch(() => {});
- }else if(type == 5){
- this.$confirm('是否确认删除?', "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(function() {
- }).then(() => {
- iotAlarmTemplateDelete({templateId:row.templateId}).then(response => {
- self.msgSuccess(response.message)
- self.getList();
- });
- }).catch(() => {});
- }else if(type == 6){
- let text = row.state ? "停用" : "启用";
- this.$confirm('是否确认' + text + '?', "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(function() {
- }).then(() => {
- iotAlarmTemplateChangeState({templateId:row.templateId,state:!row.state,}).then(response => {
- self.msgSuccess(response.message)
- self.getList();
- });
- }).catch(() => {});
- }else if(type == 7){
- this.$set(this,'pageType',1);
- this.getList();
- }
- },
- },
- }
- </script>
- <style scoped lang="scss">
- .messageTemplate{
- .messageTemplatePage{
- }
- }
- </style>
- <style lang="scss">
- .messageTemplate{
- .messageTemplatePage{
- .switch .el-switch__label {
- position: absolute;
- display: none;
- color: #fff !important;
- }
- .switch .el-switch__label--right {
- z-index: 1;
- }
- .switch .el-switch__label--right span{
- margin-left: 10px;
- }
- .switch .el-switch__label--left {
- z-index: 1;
- }
- .switch .el-switch__label--left span{
- margin-left: 24px;
- }
- .switch .el-switch__label.is-active {
- display: block;
- }
- .switch.el-switch .el-switch__core,
- .el-switch .el-switch__label {
- width: 64px !important;
- margin: 0;
- }
- }
- }
- </style>
|