北尚诉办前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

150 lines
6.9 KiB

<template>
<el-card shadow="never" class="aui-card--fill">
<div class="mod-message__smslog}">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataListSearch()">
<el-form-item label="手机号" prop="mobile">
<el-input v-model="dataForm.mobile" placeholder="手机号" clearable @keyup.native="btKeyUpMobile"></el-input>
</el-form-item>
<el-form-item label="发送状态" prop="status">
<el-select v-model="dataForm.status" placeholder="发送状态" clearable>
<el-option v-for="item in statusArr" :key="item.dictValue" :label="item.dictName" :value="item.dictValue" >
</el-option>
</el-select>
</el-form-item>
<el-form-item v-if=false label="平台类型" prop="platform">
<el-select v-model="dataForm.platform" placeholder="平台类型" clearable>
<el-option v-for="item in platformArr" :key="item.dictValue" :label="item.dictName" :value="item.dictValue" >
</el-option>
</el-select>
</el-form-item>
<el-form-item label="模板类型" prop="templateType">
<el-select v-model="dataForm.templateType" placeholder="模板类型" clearable>
<el-option v-for="item in paramNameArr" :key="item.dictValue" :label="item.dictName" :value="item.dictValue" >
</el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="getDataListSearch()">{{ $t('query') }}</el-button>
</el-form-item>
<el-form-item>
<!-- <el-button v-if="$hasPermission('message:smslog:save')" type="primary" @click="addOrUpdateHandle()">{{ $t('add') }}</el-button> -->
<el-button v-if=false type="success" @click="addOrUpdateHandle()">{{ $t('add') }}</el-button>
</el-form-item>
<el-form-item>
<el-button v-if=false type="danger" @click="deleteHandle()">{{ $t('deleteBatch') }}</el-button>
</el-form-item>
</el-form>
<el-table v-loading="dataListLoading" :data="dataList" border @selection-change="dataListSelectionChangeHandle" style="width: 100%;">
<el-table-column v-if=false type="selection" header-align="center" align="center" width="50"></el-table-column>
<el-table-column type="index" label="序号" header-align="center" align="center" width="50"></el-table-column>
<el-table-column prop="platform" label="平台类型" header-align="center" align="center" :formatter="showPlatform"></el-table-column>
<el-table-column prop="mobile" label="手机号" header-align="center" align="center" width="120"></el-table-column>
<el-table-column prop="status" label="发送状态" header-align="center" align="center" :formatter="showStatus"></el-table-column>
<el-table-column prop="templateTypeName" label="模板类型" header-align="center" align="center" min-width="150" show-overflow-tooltip></el-table-column>
<el-table-column prop="params1" label="参数1" header-align="center" align="center"></el-table-column>
<el-table-column prop="params2" label="参数2" header-align="center" align="center"></el-table-column>
<el-table-column prop="params3" label="参数3" header-align="center" align="center"></el-table-column>
<el-table-column prop="params4" label="参数4" header-align="center" align="center"></el-table-column>
<el-table-column prop="createdTime" label="发送时间" header-align="center" align="center" width="180"></el-table-column>
<el-table-column v-if=false prop="updatedTime" label="更新时间" header-align="center" align="center" width="180"></el-table-column>
<el-table-column v-if=false :label="$t('handle')" fixed="right" header-align="center" align="center" width="150">
<template slot-scope="scope">
<el-button type="text" size="small" @click="smslogDetailHandle(scope.row.id)">查看</el-button>
<el-button v-if="$hasPermission('message:smslog:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">{{ $t('update') }}</el-button>
<el-button v-if="$hasPermission('message:smslog:delete')" type="text" size="small" @click="deleteHandle(scope.row.id)">{{ $t('delete') }}</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
:current-page="page"
:page-sizes="[10, 20, 50, 100]"
:page-size="limit"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="pageSizeChangeHandle"
@current-change="pageCurrentChangeHandle">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
<!--查看-->
<smslog-detail v-if="smslogDetailVisible" ref="smslogDetail" @refreshDataList="getDataList"></smslog-detail>
</div>
</el-card>
</template>
<script>
import mixinViewModule from '@/mixins/view-module'
import AddOrUpdate from './smslog-add-or-update'
import smslogDetail from './smslog-detail'
export default {
mixins: [mixinViewModule],
data () {
return {
mixinViewModuleOptions: {
getDataListURL: '/message/smslog/page',
getDataListIsPage: true,
deleteURL: '/message/smslog',
deleteIsBatch: true
},
dataForm: {
id: ''
},
statusArr: [
{ dictValue: 1, dictName: '成功' },
{ dictValue: 0, dictName: '失败' }
],
platformArr: [
{ dictValue: 1, dictName: '阿里云' },
{ dictValue: 2, dictName: '腾讯云' }
],
paramNameArr: [],
smslogDetailVisible: false
}
},
components: {
AddOrUpdate,
smslogDetail
},
created () {
this.getParamListInfo('sms_template_type')
},
methods: {
showStatus (row, column) {
if (row.status === 0) {
return '失败'
} else {
return '成功'
}
},
showPlatform (row, column) {
if (row.platform === 1) {
return '阿里云'
} else {
return '腾讯云'
}
},
// 获取参数名称code下拉信息
getParamListInfo (dictType) {
this.$http.get(`/sys/dict/listSimple/` + dictType).then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
if (dictType === 'sms_template_type') {
this.paramNameArr = res.data
}
}).catch(() => {})
},
smslogDetailHandle (smslogId) {
this.smslogDetailVisible = true
this.$nextTick(() => {
this.$refs.smslogDetail.dataForm.id = smslogId
this.$refs.smslogDetail.init()
})
},
btKeyUpMobile (e) {
      e.target.value = e.target.value.replace(/[`~!#$%^&*()_\+=<>?:"{}|~!#¥%……&*()={}|《》?:“”【】、;‘’,。、]/g, '')
      this.dataForm.mobile= e.target.value
    }
}
}
</script>