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

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

Loading…
Cancel
Save