import {NButton, NDataTable, NFormItem, NInput, NModal, NPageHeader, NSelect, NSpace, useDialog, useMessage} from 'naive-ui'
import {defineComponent, onMounted, reactive, ref} from 'vue'
import {useRoute, useRouter} from 'vue-router'
import {useTabsViewStore} from '@/store/modules/tabsView'
import SaveForm from "@components/save-form";
import Pagination from "@components/pagination";
import {appSendConfigPage, smsConfigDetail} from "@views/music-library/api";
import PushConfigEdit from "@views/message/message-config/sms/modal/push-config-edit";
export default defineComponent({
name: 'wechat-config',
setup(props, ctx) {
const route = useRoute()
const router = useRouter()
const dialog = useDialog()
const message = useMessage()
const state = reactive({
loading: false,
appId: null as any,
pagination: {
page: 1,
rows: 10,
pageTotal: 0
},
searchForm: {
keyword: null, //关键字
status: null // 状态
},
name: null as any,
smsConfigId: null as any,
dataList: [],
showEdit: false,
editMode: 'add',
editRowData: {} as any,
})
const tabsViewStore = useTabsViewStore()
const gotoBack = () => {
tabsViewStore.closeCurrentTab(route)
router.push({
path: '/message/messageConfig'
})
}
onMounted(async () => {
state.smsConfigId = route.query.id;
console.log('1111111111', state.smsConfigId)
if (state.smsConfigId) {
const {data} = await smsConfigDetail(state.smsConfigId)
if (data) {
state.name = data.name
}
getList()
}
})
const saveForm = ref()
const onSearch = () => {
saveForm.value?.submit()
}
const onBtnReset = () => {
saveForm.value?.reset()
}
const onSubmit = () => {
state.pagination.page = 1
getList()
}
const getList = async () => {
if (!state.smsConfigId) {
return
}
try {
state.loading = true
const {data} = await appSendConfigPage({
...state.pagination,
...state.searchForm,
})
state.pagination.pageTotal = Number(data.total)
state.dataList = data.rows || []
} catch {
}
state.loading = false
}
const columns = (): any => {
return [
{
title: '编号',
key: 'id'
},
{
title: '平台名称',
key: 'name'
},
{
title: '应用',
key: 'name'
},
{
title: '客户端',
key: 'accessUrl'
},
{
title: '接入地址',
key: 'accessUrl'
},
{
title: '离线保留时长',
key: 'accessUrl'
},
{
title: '推送环境',
key: 'accessUrl'
},
{
title: '接入key',
key: 'accessUrl'
},
{
title: '接入秘匙',
key: 'accessUrl'
},
{
title: 'Android拓展参数',
key: 'accessUrl'
},
{
title: '状态',
key: 'status'
},
// {
// title: '操作',
// key: 'operation',
// fixed: 'right',
// render(row: any) {
// return (
//