mirror of
https://gitee.com/log4j/pig-ui.git
synced 2024-12-23 05:40:20 +08:00
🐛 Fixing a bug. 新增消息管理和标签管理
This commit is contained in:
parent
c4cebf4fe5
commit
39e61bf929
@ -19,7 +19,7 @@ import request from '/@/utils/request';
|
||||
|
||||
export function getPage(query) {
|
||||
return request({
|
||||
url: '/mp/wx-account-tag/page',
|
||||
url: '/admin/wx-account-tag/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
@ -27,16 +27,16 @@ export function getPage(query) {
|
||||
|
||||
export function addObj(obj) {
|
||||
return request({
|
||||
url: '/mp/wx-account-tag',
|
||||
url: '/admin/wx-account-tag',
|
||||
method: 'post',
|
||||
data: obj
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
export function delObj(obj) {
|
||||
export function delObjs(obj) {
|
||||
return request({
|
||||
url: '/mp/wx-account-tag',
|
||||
url: '/admin/wx-account-tag',
|
||||
method: 'delete',
|
||||
data: obj
|
||||
})
|
||||
@ -44,7 +44,7 @@ export function delObj(obj) {
|
||||
|
||||
export function putObj(obj) {
|
||||
return request({
|
||||
url: '/mp/wx-account-tag',
|
||||
url: '/admin/wx-account-tag',
|
||||
method: 'put',
|
||||
data: obj
|
||||
})
|
||||
@ -52,14 +52,14 @@ export function putObj(obj) {
|
||||
|
||||
export function sync(appId) {
|
||||
return request({
|
||||
url: '/mp/wx-account-tag/sync/' + appId,
|
||||
url: '/admin/wx-account-tag/sync/' + appId,
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
|
||||
export function list(appId) {
|
||||
return request({
|
||||
url: '/mp/wx-account-tag/list/',
|
||||
url: '/admin/wx-account-tag/list/',
|
||||
method: 'get',
|
||||
params: { 'wxAccountAppid': appId }
|
||||
})
|
||||
|
@ -19,7 +19,7 @@ import request from '/@/utils/request';
|
||||
|
||||
export function fetchList(query) {
|
||||
return request({
|
||||
url: '/mp/wx-fans-msg/page',
|
||||
url: '/admin/wx-fans-msg/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
@ -27,7 +27,7 @@ export function fetchList(query) {
|
||||
|
||||
export function addObj(obj) {
|
||||
return request({
|
||||
url: '/mp/wx-fans-msg',
|
||||
url: '/admin/wx-fans-msg',
|
||||
method: 'post',
|
||||
data: obj
|
||||
})
|
||||
@ -35,21 +35,21 @@ export function addObj(obj) {
|
||||
|
||||
export function getObj(id) {
|
||||
return request({
|
||||
url: '/mp/wxfansmsg/' + id,
|
||||
url: '/admin/wxfansmsg/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function delObj(id) {
|
||||
export function delObjs(id) {
|
||||
return request({
|
||||
url: '/mp/wxfansmsg/' + id,
|
||||
url: '/admin/wxfansmsg/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
export function putObj(obj) {
|
||||
return request({
|
||||
url: '/mp/wxfansmsg',
|
||||
url: '/admin/wxfansmsg',
|
||||
method: 'put',
|
||||
data: obj
|
||||
})
|
||||
@ -57,7 +57,7 @@ export function putObj(obj) {
|
||||
|
||||
export function fetchResList(query) {
|
||||
return request({
|
||||
url: '/mp/wx-fans-msg/page',
|
||||
url: '/admin/wx-fans-msg/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
@ -65,7 +65,7 @@ export function fetchResList(query) {
|
||||
|
||||
export function addResObj(obj) {
|
||||
return request({
|
||||
url: '/mp/wx-fans-msg',
|
||||
url: '/admin/wx-fans-msg',
|
||||
method: 'post',
|
||||
data: obj
|
||||
})
|
||||
@ -73,7 +73,7 @@ export function addResObj(obj) {
|
||||
|
||||
export function delResObj(id) {
|
||||
return request({
|
||||
url: '/mp/wx-fans-msg/' + id,
|
||||
url: '/admin/wx-fans-msg/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
95
src/views/mp/wx-account-tag/form.vue
Normal file
95
src/views/mp/wx-account-tag/form.vue
Normal file
@ -0,0 +1,95 @@
|
||||
<template>
|
||||
<el-dialog v-model="visible" :close-on-click-modal="false"
|
||||
:title="form.id ? $t('common.editBtn') : $t('common.addBtn')" draggable>
|
||||
<el-form ref="dataFormRef" v-loading="loading" :model="form" :rules="dataRules" formDialogRef label-width="90px">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item :label="t('wxAccountTag.tag')" prop="tag">
|
||||
<el-input v-model="form.tag" :placeholder="t('wxAccountTag.inputTagTip')"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="visible = false">{{ $t('common.cancelButtonText') }}</el-button>
|
||||
<el-button type="primary" @click="onSubmit">{{ $t('common.confirmButtonText') }}</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="WxAccountTagDialog" setup>
|
||||
// 定义子组件向父组件传值/事件
|
||||
const emit = defineEmits(['refresh']);
|
||||
import {useMessage} from "/@/hooks/message";
|
||||
import {addObj, putObj} from '/@/api/mp/wx-account-tag'
|
||||
import {useI18n} from "vue-i18n"
|
||||
|
||||
const {t} = useI18n();
|
||||
|
||||
// 定义变量内容
|
||||
const dataFormRef = ref();
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
// 定义字典
|
||||
|
||||
// 提交表单数据
|
||||
const form = reactive({
|
||||
id: '',
|
||||
tag: '',
|
||||
});
|
||||
|
||||
// 定义校验规则
|
||||
const dataRules = ref({})
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (id: string) => {
|
||||
visible.value = true
|
||||
form.id = ''
|
||||
|
||||
// 重置表单数据
|
||||
if (dataFormRef.value) {
|
||||
dataFormRef.value.resetFields()
|
||||
}
|
||||
};
|
||||
|
||||
// 提交
|
||||
const onSubmit = () => {
|
||||
dataFormRef.value.validate((valid: boolean) => {
|
||||
if (!valid) {
|
||||
return false
|
||||
}
|
||||
// 更新
|
||||
if (form.id) {
|
||||
loading.value = true
|
||||
putObj(form).then(() => {
|
||||
useMessage().success(t('common.editSuccessText'))
|
||||
visible.value = false // 关闭弹窗
|
||||
emit('refresh')
|
||||
}).catch((err: any) => {
|
||||
useMessage().error(err.msg)
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
} else {
|
||||
loading.value = true
|
||||
addObj(form).then(() => {
|
||||
useMessage().success(t('common.addSuccessText'))
|
||||
visible.value = false // 关闭弹窗
|
||||
emit('refresh')
|
||||
}).catch((err: any) => {
|
||||
useMessage().error(err.msg)
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
openDialog
|
||||
});
|
||||
</script>
|
18
src/views/mp/wx-account-tag/i18n/en.ts
Normal file
18
src/views/mp/wx-account-tag/i18n/en.ts
Normal file
@ -0,0 +1,18 @@
|
||||
export default {
|
||||
wxAccountTag: {
|
||||
index: 'index',
|
||||
importwxAccountTagTip: 'import WxAccountTag',
|
||||
id: 'id',
|
||||
tag: 'tag',
|
||||
wxAccountId: 'wxAccountId',
|
||||
wxAccountName: 'wxAccountName',
|
||||
wxAccountAppid: 'wxAccountAppid',
|
||||
tagId: 'tagId',
|
||||
inputIdTip: 'input id',
|
||||
inputTagTip: 'input tag',
|
||||
inputWxAccountIdTip: 'input wxAccountId',
|
||||
inputWxAccountNameTip: 'input wxAccountName',
|
||||
inputWxAccountAppidTip: 'input wxAccountAppid',
|
||||
inputTagIdTip: 'input tagId',
|
||||
}
|
||||
}
|
18
src/views/mp/wx-account-tag/i18n/zh-cn.ts
Normal file
18
src/views/mp/wx-account-tag/i18n/zh-cn.ts
Normal file
@ -0,0 +1,18 @@
|
||||
export default {
|
||||
wxAccountTag: {
|
||||
index: '序号',
|
||||
importwxAccountTagTip: '导入标签管理',
|
||||
id: '主键',
|
||||
tag: '标签',
|
||||
wxAccountId: '微信账号ID',
|
||||
wxAccountName: '微信账号名称',
|
||||
wxAccountAppid: 'appID',
|
||||
tagId: '标签ID',
|
||||
inputIdTip: '请输入主键',
|
||||
inputTagTip: '请输入标签',
|
||||
inputWxAccountIdTip: '请输入微信账号ID',
|
||||
inputWxAccountNameTip: '请输入微信账号名称',
|
||||
inputWxAccountAppidTip: '请输入appID',
|
||||
inputTagIdTip: '请输入标签ID',
|
||||
}
|
||||
}
|
160
src/views/mp/wx-account-tag/index.vue
Normal file
160
src/views/mp/wx-account-tag/index.vue
Normal file
@ -0,0 +1,160 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<el-card class="layout-padding-auto">
|
||||
<el-row v-show="showSearch" class="mb8">
|
||||
<el-form ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
|
||||
<el-form-item :label="$t('wxAccountTag.tag')" prop="tag">
|
||||
<el-input v-model="state.queryForm.tag" :placeholder="t('wxAccountTag.inputTagTip')"
|
||||
style="max-width: 180px"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('wxAccountTag.wxAccountAppid')" prop="wxAccountAppid">
|
||||
<el-select v-model="state.queryForm.wxAccountAppid" :placeholder="t('wxAccountTag.inputWxAccountAppidTip')" clearable class="w100">
|
||||
<el-option v-for="item in accountList" :key="item.appid" :label="item.name" :value="item.appid"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item class="ml2">
|
||||
<el-button formDialogRef icon="search" type="primary" @click="getDataList">
|
||||
{{ $t('common.queryBtn') }}
|
||||
</el-button>
|
||||
<el-button formDialogRef icon="Refresh" @click="resetQuery">{{ $t('common.resetBtn') }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button v-auth="'mp_wxAccountTag_add'" class="ml10" formDialogRef icon="folder-add" type="primary"
|
||||
@click="formDialogRef.openDialog()">
|
||||
{{ $t('common.addBtn') }}
|
||||
</el-button>
|
||||
<el-button v-auth="'mp_wxAccountTag_export'" class="ml10" formDialogRef icon="Download" type="primary"
|
||||
@click="exportExcel">
|
||||
{{ $t('common.exportBtn') }}
|
||||
</el-button>
|
||||
<el-button v-auth="'mp_wxAccountTag_del'" :disabled="multiple" class="ml10" formDialogRef icon="Delete"
|
||||
type="primary" @click="handleDelete(selectObjs)">
|
||||
{{ $t('common.delBtn') }}
|
||||
</el-button>
|
||||
<right-toolbar v-model:showSearch="showSearch" class="ml10" style="float: right;margin-right: 20px"
|
||||
@queryTable="getDataList"></right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table v-loading="state.loading" :data="state.dataList" style="width: 100%"
|
||||
@selection-change="handleSelectionChange" @sort-change="sortChangeHandle">
|
||||
<el-table-column align="center" type="selection" width="60"/>
|
||||
<el-table-column :label="t('wxAccountTag.index')" type="index" width="80"/>
|
||||
<el-table-column :label="t('wxAccountTag.tag')" prop="tag" show-overflow-tooltip/>
|
||||
<el-table-column :label="t('wxAccountTag.wxAccountId')" prop="wxAccountId" show-overflow-tooltip/>
|
||||
<el-table-column :label="t('wxAccountTag.wxAccountName')" prop="wxAccountName" show-overflow-tooltip/>
|
||||
<el-table-column :label="t('wxAccountTag.wxAccountAppid')" prop="wxAccountAppid" show-overflow-tooltip/>
|
||||
<el-table-column :label="t('wxAccountTag.tagId')" prop="tagId" show-overflow-tooltip/>
|
||||
<el-table-column :label="$t('common.action')" width="150">
|
||||
<template #default="scope">
|
||||
<el-button v-auth="'mp_wxAccountTag_edit'" text type="primary"
|
||||
@click="formDialogRef.openDialog(scope.row.id)">{{ $t('common.editBtn') }}
|
||||
</el-button>
|
||||
<el-button v-auth="'sys_wxAccountTag_del'" text type="primary" @click="handleDelete([scope.row.id])">{{
|
||||
$t('common.delBtn')
|
||||
}}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination v-bind="state.pagination" @size-change="sizeChangeHandle" @current-change="currentChangeHandle"/>
|
||||
</el-card>
|
||||
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog ref="formDialogRef" @refresh="getDataList(false)"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="systemWxAccountTag" setup>
|
||||
import {BasicTableProps, useTable} from "/@/hooks/table";
|
||||
import {delObjs, getPage} from "/@/api/mp/wx-account-tag";
|
||||
import {useMessage, useMessageBox} from "/@/hooks/message";
|
||||
import {useI18n} from "vue-i18n";
|
||||
import {fetchAccountList} from "/@/api/mp/wx-account";
|
||||
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
const {t} = useI18n()
|
||||
// 定义查询字典
|
||||
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref()
|
||||
// 搜索变量
|
||||
const queryRef = ref()
|
||||
const showSearch = ref(true)
|
||||
// 多选变量
|
||||
const selectObjs = ref([]) as any
|
||||
const multiple = ref(true)
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
pageList: getPage,
|
||||
createdIsNeed: false
|
||||
})
|
||||
|
||||
const accountList = ref([])
|
||||
|
||||
const getAccountList = () => {
|
||||
fetchAccountList().then(res => {
|
||||
accountList.value = res.data
|
||||
if(accountList.value.length > 0){
|
||||
state.queryForm.wxAccountAppid = accountList.value[0].appid
|
||||
getDataList()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getAccountList()
|
||||
})
|
||||
|
||||
watch(() => state.queryForm.wxAccountAppid,() => {
|
||||
getDataList()
|
||||
})
|
||||
|
||||
// table hook
|
||||
const {
|
||||
getDataList,
|
||||
currentChangeHandle,
|
||||
sizeChangeHandle,
|
||||
sortChangeHandle,
|
||||
downBlobFile
|
||||
} = useTable(state)
|
||||
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
// 清空搜索条件
|
||||
queryRef.value.resetFields()
|
||||
// 清空多选
|
||||
selectObjs.value = []
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile('/mp/wxAccountTag/export', state.queryForm, 'wxAccountTag.xlsx')
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
const handleSelectionChange = (objs: any) => {
|
||||
objs.forEach((val: any) => {
|
||||
selectObjs.value.push(val.id)
|
||||
});
|
||||
multiple.value = !objs.length
|
||||
}
|
||||
|
||||
// 删除操作
|
||||
const handleDelete = (ids: string[]) => {
|
||||
useMessageBox().confirm(t('common.delConfirmText'))
|
||||
.then(() => {
|
||||
delObjs(ids).then(() => {
|
||||
getDataList(false);
|
||||
useMessage().success(t('common.delSuccessText'));
|
||||
}).catch((err: any) => {
|
||||
useMessage().error(err.msg)
|
||||
})
|
||||
})
|
||||
};
|
||||
</script>
|
315
src/views/mp/wx-fans-msg/form.vue
Normal file
315
src/views/mp/wx-fans-msg/form.vue
Normal file
@ -0,0 +1,315 @@
|
||||
<template>
|
||||
<el-dialog :title="form.id ? $t('common.editBtn') : $t('common.addBtn')" v-model="visible"
|
||||
:close-on-click-modal="false" draggable>
|
||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="90px" v-loading="loading">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item :label="t('wx-fans-msg.appName')" prop="appName">
|
||||
<el-input v-model="form.appName" :placeholder="t('wx-fans-msg.inputAppNameTip')"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item :label="t('wx-fans-msg.appLogo')" prop="appLogo">
|
||||
<el-input v-model="form.appLogo" :placeholder="t('wx-fans-msg.inputAppLogoTip')"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item :label="t('wx-fans-msg.wxUserId')" prop="wxUserId">
|
||||
<el-input v-model="form.wxUserId" :placeholder="t('wx-fans-msg.inputWxUserIdTip')"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item :label="t('wx-fans-msg.nickName')" prop="nickName">
|
||||
<el-input v-model="form.nickName" :placeholder="t('wx-fans-msg.inputNickNameTip')"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item :label="t('wx-fans-msg.headimgUrl')" prop="headimgUrl">
|
||||
<el-input v-model="form.headimgUrl" :placeholder="t('wx-fans-msg.inputHeadimgUrlTip')"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item :label="t('wx-fans-msg.type')" prop="type">
|
||||
<el-radio-group v-model="form.type">
|
||||
<el-radio label="消息分类" border>消息分类</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item :label="t('wx-fans-msg.repType')" prop="repType">
|
||||
<el-radio-group v-model="form.repType">
|
||||
<el-radio :label="item.value" v-for="(item, index) in repType" border :key="index">{{ item.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item :label="t('wx-fans-msg.repEvent')" prop="repEvent">
|
||||
<el-radio-group v-model="form.repEvent">
|
||||
<el-radio label="事件类型" border>事件类型</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item :label="t('wx-fans-msg.repContent')" prop="repContent">
|
||||
<el-input type="textarea" v-model="form.repContent" :placeholder="t('wx-fans-msg.inputRepContentTip')"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item :label="t('wx-fans-msg.repMediaId')" prop="repMediaId">
|
||||
<el-input v-model="form.repMediaId" :placeholder="t('wx-fans-msg.inputRepMediaIdTip')"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item :label="t('wx-fans-msg.repName')" prop="repName">
|
||||
<el-input v-model="form.repName" :placeholder="t('wx-fans-msg.inputRepNameTip')"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item :label="t('wx-fans-msg.repDesc')" prop="repDesc">
|
||||
<el-input v-model="form.repDesc" :placeholder="t('wx-fans-msg.inputRepDescTip')"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item :label="t('wx-fans-msg.repUrl')" prop="repUrl">
|
||||
<el-input v-model="form.repUrl" :placeholder="t('wx-fans-msg.inputRepUrlTip')"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item :label="t('wx-fans-msg.repHqUrl')" prop="repHqUrl">
|
||||
<el-input v-model="form.repHqUrl" :placeholder="t('wx-fans-msg.inputRepHqUrlTip')"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item :label="t('wx-fans-msg.content')" prop="content">
|
||||
<el-input v-model="form.content" :placeholder="t('wx-fans-msg.inputContentTip')"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item :label="t('wx-fans-msg.repThumbMediaId')" prop="repThumbMediaId">
|
||||
<el-input v-model="form.repThumbMediaId" :placeholder="t('wx-fans-msg.inputRepThumbMediaIdTip')"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item :label="t('wx-fans-msg.repThumbUrl')" prop="repThumbUrl">
|
||||
<el-input v-model="form.repThumbUrl" :placeholder="t('wx-fans-msg.inputRepThumbUrlTip')"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item :label="t('wx-fans-msg.repLocationX')" prop="repLocationX">
|
||||
<el-input v-model="form.repLocationX" :placeholder="t('wx-fans-msg.inputRepLocationXTip')"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item :label="t('wx-fans-msg.repLocationY')" prop="repLocationY">
|
||||
<el-input v-model="form.repLocationY" :placeholder="t('wx-fans-msg.inputRepLocationYTip')"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item :label="t('wx-fans-msg.repScale')" prop="repScale">
|
||||
<el-input v-model="form.repScale" :placeholder="t('wx-fans-msg.inputRepScaleTip')"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item :label="t('wx-fans-msg.readFlag')" prop="readFlag">
|
||||
<el-radio-group v-model="form.readFlag">
|
||||
<el-radio :label="item.value" v-for="(item, index) in response_type" border :key="index">{{ item.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item :label="t('wx-fans-msg.appId')" prop="appId">
|
||||
<el-input v-model="form.appId" :placeholder="t('wx-fans-msg.inputAppIdTip')"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item :label="t('wx-fans-msg.openId')" prop="openId">
|
||||
<el-input v-model="form.openId" :placeholder="t('wx-fans-msg.inputOpenIdTip')"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item :label="t('wx-fans-msg.remark')" prop="remark">
|
||||
<el-input v-model="form.remark" :placeholder="t('wx-fans-msg.inputRemarkTip')"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item :label="t('wx-fans-msg.delFlag')" prop="delFlag">
|
||||
<el-input v-model="form.delFlag" :placeholder="t('wx-fans-msg.inputDelFlagTip')"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item :label="t('wx-fans-msg.createTime')" prop="createTime">
|
||||
<el-input v-model="form.createTime" :placeholder="t('wx-fans-msg.inputCreateTimeTip')"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item :label="t('wx-fans-msg.updateTime')" prop="updateTime">
|
||||
<el-input v-model="form.updateTime" :placeholder="t('wx-fans-msg.inputUpdateTimeTip')"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item :label="t('wx-fans-msg.tenantId')" prop="tenantId">
|
||||
<el-input v-model="form.tenantId" :placeholder="t('wx-fans-msg.inputTenantIdTip')"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="visible = false">{{ $t('common.cancelButtonText') }}</el-button>
|
||||
<el-button type="primary" @click="onSubmit">{{ $t('common.confirmButtonText') }}</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-drawer>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="WxMsgDialog">
|
||||
// 定义子组件向父组件传值/事件
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
const emit = defineEmits(['refresh']);
|
||||
import { useMessage } from "/@/hooks/message";
|
||||
import { getObj, addObj, putObj } from '/@/api/mp/wx-fans-msg'
|
||||
import { useI18n } from "vue-i18n"
|
||||
import { rule } from '/@/utils/validate';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
// 定义变量内容
|
||||
const dataFormRef = ref();
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
// 定义字典
|
||||
const { response_type } = useDict('response_type')
|
||||
|
||||
// 提交表单数据
|
||||
const form = reactive({
|
||||
id: '',
|
||||
appName: '',
|
||||
appLogo: '',
|
||||
wxUserId: '',
|
||||
nickName: '',
|
||||
headimgUrl: '',
|
||||
type: '',
|
||||
repType: '',
|
||||
repEvent: '',
|
||||
repContent: '',
|
||||
repMediaId: '',
|
||||
repName: '',
|
||||
repDesc: '',
|
||||
repUrl: '',
|
||||
repHqUrl: '',
|
||||
content: '',
|
||||
repThumbMediaId: '',
|
||||
repThumbUrl: '',
|
||||
repLocationX: '',
|
||||
repLocationY: '',
|
||||
repScale: '',
|
||||
readFlag: '',
|
||||
appId: '',
|
||||
openId: '',
|
||||
remark: '',
|
||||
delFlag: '',
|
||||
createTime: '',
|
||||
updateTime: '',
|
||||
tenantId: '',
|
||||
});
|
||||
|
||||
// 定义校验规则
|
||||
const dataRules = ref({
|
||||
})
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (id: string) => {
|
||||
visible.value = true
|
||||
form.id = ''
|
||||
|
||||
// 重置表单数据
|
||||
if (dataFormRef.value) {
|
||||
dataFormRef.value.resetFields()
|
||||
}
|
||||
|
||||
// 获取wxMsg信息
|
||||
if (id) {
|
||||
form.id = id
|
||||
getwxMsgData(id)
|
||||
}
|
||||
};
|
||||
|
||||
// 提交
|
||||
const onSubmit = () => {
|
||||
dataFormRef.value.validate((valid: boolean) => {
|
||||
if (!valid) {
|
||||
return false
|
||||
}
|
||||
// 更新
|
||||
if (form.id) {
|
||||
loading.value = true
|
||||
putObj(form).then(() => {
|
||||
useMessage().success(t('common.editSuccessText'))
|
||||
visible.value = false // 关闭弹窗
|
||||
emit('refresh')
|
||||
}).catch((err: any) => {
|
||||
useMessage().error(err.msg)
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
} else {
|
||||
loading.value = true
|
||||
addObj(form).then(() => {
|
||||
useMessage().success(t('common.addSuccessText'))
|
||||
visible.value = false // 关闭弹窗
|
||||
emit('refresh')
|
||||
}).catch((err: any) => {
|
||||
useMessage().error(err.msg)
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 初始化表单数据
|
||||
const getwxMsgData = (id: string) => {
|
||||
// 获取数据
|
||||
loading.value = true
|
||||
getObj(id).then((res: any) => {
|
||||
Object.assign(form, res.data)
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
};
|
||||
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
openDialog
|
||||
});
|
||||
</script>
|
64
src/views/mp/wx-fans-msg/i18n/en.ts
Normal file
64
src/views/mp/wx-fans-msg/i18n/en.ts
Normal file
@ -0,0 +1,64 @@
|
||||
export default {
|
||||
wxFansMsg: {
|
||||
index: 'index',
|
||||
importwxMsgTip: 'import WxMsg',
|
||||
id: 'id',
|
||||
appName: 'appName',
|
||||
appLogo: 'appLogo',
|
||||
wxUserId: 'wxUserId',
|
||||
nickName: 'nickName',
|
||||
headimgUrl: 'headimgUrl',
|
||||
type: 'type',
|
||||
repType: 'repType',
|
||||
repEvent: 'repEvent',
|
||||
repContent: 'repContent',
|
||||
repMediaId: 'repMediaId',
|
||||
repName: 'repName',
|
||||
repDesc: 'repDesc',
|
||||
repUrl: 'repUrl',
|
||||
repHqUrl: 'repHqUrl',
|
||||
content: 'content',
|
||||
repThumbMediaId: 'repThumbMediaId',
|
||||
repThumbUrl: 'repThumbUrl',
|
||||
repLocationX: 'repLocationX',
|
||||
repLocationY: 'repLocationY',
|
||||
repScale: 'repScale',
|
||||
readFlag: 'readFlag',
|
||||
appId: 'appId',
|
||||
openId: 'openId',
|
||||
remark: 'remark',
|
||||
delFlag: 'delFlag',
|
||||
createTime: 'createTime',
|
||||
updateTime: 'updateTime',
|
||||
tenantId: 'tenantId',
|
||||
inputIdTip: 'input id',
|
||||
inputAppNameTip: 'input appName',
|
||||
inputAppLogoTip: 'input appLogo',
|
||||
inputWxUserIdTip: 'input wxUserId',
|
||||
inputNickNameTip: 'input nickName',
|
||||
inputHeadimgUrlTip: 'input headimgUrl',
|
||||
inputTypeTip: 'input type',
|
||||
inputRepTypeTip: 'input repType',
|
||||
inputRepEventTip: 'input repEvent',
|
||||
inputRepContentTip: 'input repContent',
|
||||
inputRepMediaIdTip: 'input repMediaId',
|
||||
inputRepNameTip: 'input repName',
|
||||
inputRepDescTip: 'input repDesc',
|
||||
inputRepUrlTip: 'input repUrl',
|
||||
inputRepHqUrlTip: 'input repHqUrl',
|
||||
inputContentTip: 'input content',
|
||||
inputRepThumbMediaIdTip: 'input repThumbMediaId',
|
||||
inputRepThumbUrlTip: 'input repThumbUrl',
|
||||
inputRepLocationXTip: 'input repLocationX',
|
||||
inputRepLocationYTip: 'input repLocationY',
|
||||
inputRepScaleTip: 'input repScale',
|
||||
inputReadFlagTip: 'input readFlag',
|
||||
inputAppIdTip: 'input appId',
|
||||
inputOpenIdTip: 'input openId',
|
||||
inputRemarkTip: 'input remark',
|
||||
inputDelFlagTip: 'input delFlag',
|
||||
inputCreateTimeTip: 'input createTime',
|
||||
inputUpdateTimeTip: 'input updateTime',
|
||||
inputTenantIdTip: 'input tenantId',
|
||||
}
|
||||
}
|
64
src/views/mp/wx-fans-msg/i18n/zh-cn.ts
Normal file
64
src/views/mp/wx-fans-msg/i18n/zh-cn.ts
Normal file
@ -0,0 +1,64 @@
|
||||
export default {
|
||||
wxFansMsg: {
|
||||
index: '序号',
|
||||
importwxMsgTip: '导入微信消息',
|
||||
id: '主键',
|
||||
appName: '公众号名称',
|
||||
appLogo: '公众号logo',
|
||||
wxUserId: '微信用户ID',
|
||||
nickName: '微信用户昵称',
|
||||
headimgUrl: '微信用户头像',
|
||||
type: '消息分类',
|
||||
repType: '消息类型',
|
||||
repEvent: '事件类型',
|
||||
repContent: '回复类型文本保存文字、地理位置信息',
|
||||
repMediaId: '回复类型',
|
||||
repName: '回复的素材名、视频和音乐的标题',
|
||||
repDesc: '视频和音乐的描述',
|
||||
repUrl: '链接',
|
||||
repHqUrl: '高质量链接',
|
||||
content: '图文消息的内容',
|
||||
repThumbMediaId: '缩略图的媒体id',
|
||||
repThumbUrl: '缩略图url',
|
||||
repLocationX: '地理位置维度',
|
||||
repLocationY: '地理位置经度',
|
||||
repScale: '地图缩放大小',
|
||||
readFlag: '已读标记',
|
||||
appId: '公众号ID',
|
||||
openId: '微信唯一标识',
|
||||
remark: '备注',
|
||||
delFlag: '逻辑删除标记(0:显示;1:隐藏)',
|
||||
createTime: '创建时间',
|
||||
updateTime: '更新时间',
|
||||
tenantId: '租户ID',
|
||||
inputIdTip: '请输入主键',
|
||||
inputAppNameTip: '请输入公众号名称',
|
||||
inputAppLogoTip: '请输入公众号logo',
|
||||
inputWxUserIdTip: '请输入微信用户ID',
|
||||
inputNickNameTip: '请输入微信用户昵称',
|
||||
inputHeadimgUrlTip: '请输入微信用户头像',
|
||||
inputTypeTip: '请输入消息分类',
|
||||
inputRepTypeTip: '请输入消息类型',
|
||||
inputRepEventTip: '请输入事件类型',
|
||||
inputRepContentTip: '请输入回复类型文本保存文字、地理位置信息',
|
||||
inputRepMediaIdTip: '请输入回复类型',
|
||||
inputRepNameTip: '请输入回复的素材名、视频和音乐的标题',
|
||||
inputRepDescTip: '请输入视频和音乐的描述',
|
||||
inputRepUrlTip: '请输入链接',
|
||||
inputRepHqUrlTip: '请输入高质量链接',
|
||||
inputContentTip: '请输入图文消息的内容',
|
||||
inputRepThumbMediaIdTip: '请输入缩略图的媒体id',
|
||||
inputRepThumbUrlTip: '请输入缩略图url',
|
||||
inputRepLocationXTip: '请输入地理位置维度',
|
||||
inputRepLocationYTip: '请输入地理位置经度',
|
||||
inputRepScaleTip: '请输入地图缩放大小',
|
||||
inputReadFlagTip: '请输入已读标记(1:是;0:否)',
|
||||
inputAppIdTip: '请输入公众号ID',
|
||||
inputOpenIdTip: '请输入微信唯一标识',
|
||||
inputRemarkTip: '请输入备注',
|
||||
inputDelFlagTip: '请输入逻辑删除标记(0:显示;1:隐藏)',
|
||||
inputCreateTimeTip: '请输入创建时间',
|
||||
inputUpdateTimeTip: '请输入更新时间',
|
||||
inputTenantIdTip: '请输入租户ID',
|
||||
}
|
||||
}
|
164
src/views/mp/wx-fans-msg/index.vue
Normal file
164
src/views/mp/wx-fans-msg/index.vue
Normal file
@ -0,0 +1,164 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<el-card class="layout-padding-auto">
|
||||
<el-row v-show="showSearch" class="mb8">
|
||||
<el-form ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
|
||||
<el-form-item :label="$t('wxFansMsg.appName')" prop="wxAccountAppid">
|
||||
<el-select v-model="state.queryForm.wxAccountAppid" :placeholder="$t('fans.appName')" clearable class="w100">
|
||||
<el-option v-for="item in accountList" :key="item.appid" :label="item.name" :value="item.appid"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('wxFansMsg.nickName')" prop="nickName">
|
||||
<el-input v-model="state.queryForm.nickName" :placeholder="t('wxFansMsg.inputNickNameTip')"
|
||||
style="max-width: 180px"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('wxFansMsg.repType')" prop="repType">
|
||||
<el-select v-model="state.queryForm.repType" :placeholder="$t('wxFansMsg.repType')" clearable class="w100">
|
||||
<el-option v-for="item in repType" :key="item.value" :label="item.label" :value="item.value"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item class="ml2">
|
||||
<el-button formDialogRef icon="search" type="primary" @click="getDataList">
|
||||
{{ $t('common.queryBtn') }}
|
||||
</el-button>
|
||||
<el-button formDialogRef icon="Refresh" @click="resetQuery">{{ $t('common.resetBtn') }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button v-auth="'mp_wxFansMsg_export'" class="ml10" formDialogRef icon="Download" type="primary"
|
||||
@click="exportExcel">
|
||||
{{ $t('common.exportBtn') }}
|
||||
</el-button>
|
||||
<el-button v-auth="'mp_wxmsg_del'" :disabled="multiple" class="ml10" formDialogRef icon="Delete"
|
||||
type="primary" @click="handleDelete(selectObjs)">
|
||||
{{ $t('common.delBtn') }}
|
||||
</el-button>
|
||||
<right-toolbar v-model:showSearch="showSearch" class="ml10" style="float: right;margin-right: 20px"
|
||||
@queryTable="getDataList"></right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table v-loading="state.loading" :data="state.dataList" style="width: 100%"
|
||||
@selection-change="handleSelectionChange" @sort-change="sortChangeHandle">
|
||||
<el-table-column align="center" type="selection" width="60"/>
|
||||
<el-table-column :label="t('wxFansMsg.index')" type="index" width="80"/>
|
||||
<el-table-column :label="t('wxFansMsg.appName')" prop="appName" show-overflow-tooltip/>
|
||||
<el-table-column :label="t('wxFansMsg.wxUserId')" prop="wxUserId" show-overflow-tooltip/>
|
||||
<el-table-column :label="t('wxFansMsg.nickName')" prop="nickName" show-overflow-tooltip/>
|
||||
<el-table-column :label="t('wxFansMsg.repMediaId')" prop="repMediaId" show-overflow-tooltip/>
|
||||
<el-table-column :label="t('wxFansMsg.content')" prop="content" show-overflow-tooltip/>
|
||||
<el-table-column :label="t('wxFansMsg.readFlag')" prop="readFlag" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<dict-tag :options="response_type" :value="scope.row.readFlag"></dict-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('wxFansMsg.createTime')" prop="createTime" show-overflow-tooltip/>
|
||||
<el-table-column :label="$t('common.action')" width="150">
|
||||
<template #default="scope">
|
||||
<el-button v-auth="'mp_wxFansMsg_edit'" text type="primary"
|
||||
@click="formDialogRef.openDialog(scope.row.id)">{{ $t('common.editBtn') }}
|
||||
</el-button>
|
||||
<el-button v-auth="'sys_wxFansMsg_del'" text type="primary" @click="handleDelete([scope.row.id])">{{
|
||||
$t('common.delBtn')
|
||||
}}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination v-bind="state.pagination" @size-change="sizeChangeHandle" @current-change="currentChangeHandle"/>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="systemWxMsg" setup>
|
||||
import {BasicTableProps, useTable} from "/@/hooks/table";
|
||||
import {delObjs, fetchList} from "/@/api/mp/wx-fans-msg";
|
||||
import {useMessage, useMessageBox} from "/@/hooks/message";
|
||||
import {useDict} from '/@/hooks/dict';
|
||||
import {useI18n} from "vue-i18n";
|
||||
import {fetchAccountList} from "/@/api/mp/wx-account";
|
||||
|
||||
const {t} = useI18n()
|
||||
// 定义查询字典
|
||||
|
||||
const {response_type,repType} = useDict('response_type','repType')
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref()
|
||||
// 搜索变量
|
||||
const queryRef = ref()
|
||||
const showSearch = ref(true)
|
||||
// 多选变量
|
||||
const selectObjs = ref([]) as any
|
||||
const multiple = ref(true)
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
pageList: fetchList
|
||||
})
|
||||
|
||||
// table hook
|
||||
const {
|
||||
getDataList,
|
||||
currentChangeHandle,
|
||||
sizeChangeHandle,
|
||||
sortChangeHandle,
|
||||
downBlobFile
|
||||
} = useTable(state)
|
||||
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
// 清空搜索条件
|
||||
queryRef.value.resetFields()
|
||||
// 清空多选
|
||||
selectObjs.value = []
|
||||
getDataList()
|
||||
}
|
||||
|
||||
const accountList = ref([])
|
||||
|
||||
const getAccountList = () => {
|
||||
fetchAccountList().then(res => {
|
||||
accountList.value = res.data
|
||||
if(accountList.value.length > 0){
|
||||
state.queryForm.wxAccountAppid = accountList.value[0].appid
|
||||
getDataList()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
watch(() => state.queryForm.wxAccountAppid,() => {
|
||||
getDataList()
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
getAccountList()
|
||||
})
|
||||
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile('/mp/wxFansMsg/export', state.queryForm, 'wxFansMsg.xlsx')
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
const handleSelectionChange = (objs: any) => {
|
||||
objs.forEach((val: any) => {
|
||||
selectObjs.value.push(val.id)
|
||||
});
|
||||
multiple.value = !objs.length
|
||||
}
|
||||
|
||||
// 删除操作
|
||||
const handleDelete = (ids: string[]) => {
|
||||
useMessageBox().confirm(t('common.delConfirmText'))
|
||||
.then(() => {
|
||||
delObjs(ids).then(() => {
|
||||
getDataList(false);
|
||||
useMessage().success(t('common.delSuccessText'));
|
||||
}).catch((err: any) => {
|
||||
useMessage().error(err.msg)
|
||||
})
|
||||
})
|
||||
};
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user