pull/17/head
李嫚嫚 2 months ago
parent 163ee83e2d
commit 1345f361e0

@ -1,65 +1,93 @@
<template>
<!-- 组件的HTML模板 -->
<div class="mod-config">
<!-- 搜索表单 -->
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<!-- 输入框用于输入搜索关键词 -->
<el-form-item>
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
</el-form-item>
<!-- 操作按钮 -->
<el-form-item>
<!-- 查询按钮触发数据列表的获取 -->
<el-button @click="getDataList()"></el-button>
<!-- 新增按钮根据权限显示 -->
<el-button v-if="isAuth('wx:wxaccount:save')" type="primary" @click="addOrUpdateHandle()"></el-button>
<!-- 批量删除按钮根据权限和选中项显示 -->
<el-button v-if="isAuth('wx:wxaccount:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0"></el-button>
</el-form-item>
</el-form>
<!-- 数据表格 -->
<el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" style="width: 100%;">
<!-- 多选框 -->
<el-table-column type="selection" header-align="center" align="center" width="50">
</el-table-column>
<!-- 展示appid -->
<el-table-column prop="appid" header-align="center" align="center" label="appid">
</el-table-column>
<!-- 展示公众号名称 -->
<el-table-column prop="name" header-align="center" align="center" label="公众号名称">
</el-table-column>
<!-- 展示公众号类型通过formatter格式化显示 -->
<el-table-column prop="type" header-align="center" align="center" label="类型" :formatter="accountTypeFormat">
</el-table-column>
<!-- 展示是否认证 -->
<el-table-column prop="verified" header-align="center" align="center" label="是否认证">
<!-- 使用插槽自定义显示内容 -->
<span slot-scope="scope">{{scope.row.verified?"是":"否"}}</span>
</el-table-column>
<!-- 操作列 -->
<el-table-column fixed="right" header-align="center" align="center" width="150" label="操作">
<!-- 使用插槽添加按钮 -->
<template slot-scope="scope">
<el-button type="text" size="small" @click="accessInfo(scope.row)"></el-button>
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row)"></el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.row.appid)"></el-button>
</template>
</el-table-column>
</el-table>
<!-- 弹窗, 新增 / 修改 -->
<!-- 新增/修改弹窗 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
<!-- 接入信息弹窗 -->
<account-access v-if="accountAccessVisible" ref="accountAccessDialog"></account-access>
</div>
</template>
<script>
//
import AddOrUpdate from './account/wx-account-add-or-update'
import AccountAccess from './account/wx-account-access-info'
import { mapState } from 'vuex'
export default {
data() {
return {
//
dataForm: {
key: ''
},
//
dataList: [],
//
dataListLoading: false,
//
dataListSelections: [],
// /
addOrUpdateVisible: false,
accountAccessVisible:false
//
accountAccessVisible: false
}
},
//
components: {
AddOrUpdate,AccountAccess
AddOrUpdate,
AccountAccess
},
// Vuex
computed: mapState({
ACCOUNT_TYPES: state=>state.wxAccount.ACCOUNT_TYPES
ACCOUNT_TYPES: state => state.wxAccount.ACCOUNT_TYPES
}),
//
activated() {
this.getDataList()
},
@ -67,53 +95,55 @@ export default {
//
getDataList() {
this.dataListLoading = true
// HTTP
this.$http({
url: this.$http.adornUrl('/manage/wxAccount/list'),
url: this.$http.adornUrl('/manage/wxAccount/list'), // URL
method: 'get',
params: this.$http.adornParams({
params: this.$http.adornParams({ //
'key': this.dataForm.key
})
}).then(({ data }) => {
if (data && data.code === 200) {
this.dataList = data.list
this.$store.commit('wxAccount/updateAccountList', data.list)
this.dataList = data.list //
this.$store.commit('wxAccount/updateAccountList', data.list) // Vuex
} else {
this.dataList = []
this.dataList = [] //
}
this.dataListLoading = false
this.dataListLoading = false //
})
},
//
//
selectionChangeHandle(val) {
this.dataListSelections = val
},
// /
// /
addOrUpdateHandle(item) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(item)
this.$refs.addOrUpdate.init(item) //
})
},
accessInfo(item){
//
accessInfo(item) {
this.accountAccessVisible = true
this.$nextTick(() => {
this.$refs.accountAccessDialog.init(item)
this.$refs.accountAccessDialog.init(item) //
})
},
//
//
deleteHandle(appid) {
var ids = appid ? [appid] : this.dataListSelections.map(item => {
return item.appid
})
// appid
var ids = appid ? [appid] : this.dataListSelections.map(item => item.appid)
this.$confirm(`确定对[appid=${ids.join(',')}]进行[${appid ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
// HTTP
this.$http({
url: this.$http.adornUrl('/manage/wxAccount/delete'),
method: 'post',
data: this.$http.adornData(ids, false)
data: this.$http.adornData(ids, false) //
}).then(({ data }) => {
if (data && data.code === 200) {
this.$message({
@ -121,18 +151,19 @@ export default {
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
this.getDataList() //
}
})
} else {
this.$message.error(data.msg)
this.$message.error(data.msg) //
}
})
})
},
//
accountTypeFormat(row, column, cellValue) {
return this.ACCOUNT_TYPES[cellValue];
return this.ACCOUNT_TYPES[cellValue]
}
}
}
</script>
</script>
Loading…
Cancel
Save