123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- <template>
- <div class="quality-lexicon-container layout-pd">
- <el-card shadow="never">
- <el-form :model="state.queryParams" ref="ruleFormRef" :inline="true" @submit.native.prevent>
- <el-form-item label="标题" prop="Title">
- <el-input v-model="state.queryParams.Title" placeholder="请输入重复性事件标题" clearable @keyup.enter="queryList" style="width: 250px" />
- </el-form-item>
- <el-form-item label="关键词" prop="KeyWords">
- <el-input v-model="state.queryParams.KeyWords" placeholder="请输入关键词" clearable @keyup.enter="queryList" style="width: 250px" />
- </el-form-item>
- <el-form-item>
- <el-button type="primary" @click="queryList" :loading="state.loading"> <SvgIcon name="ele-Search" class="mr5" />查询 </el-button>
- <el-button @click="resetQuery(ruleFormRef)" v-waves class="default-button"> <SvgIcon name="ele-Refresh" class="mr5" />重置 </el-button>
- </el-form-item>
- </el-form>
- </el-card>
- <el-card shadow="never">
- <el-table :data="state.tableData" v-loading="state.loading" row-key="id" ref="multipleTableRef" @selection-change="handleSelectionChange">
- <el-table-column type="selection" width="55" />
- <el-table-column prop="title" label="重复事件标题" show-overflow-tooltip width="400"></el-table-column>
- <el-table-column prop="keyWords" label="关键词" show-overflow-tooltip width="300"></el-table-column>
- <el-table-column prop="creatorName" label="创建人" show-overflow-tooltip></el-table-column>
- <el-table-column label="创建时间" show-overflow-tooltip width="170">
- <template #default="{ row }">
- <span>{{ formatDate(row.creationTime, 'YYYY-mm-dd HH:MM:SS') }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="lastModificationName" label="更新人" show-overflow-tooltip></el-table-column>
- <el-table-column prop="lastModificationTime" label="更新时间" show-overflow-tooltip width="170">
- <template #default="{ row }">
- <span>{{ formatDate(row.lastModificationTime, 'YYYY-mm-dd HH:MM:SS') }}</span>
- </template>
- </el-table-column>
- <el-table-column label="操作" width="140" fixed="right" align="center">
- <template #default="{ row }">
- <el-button link type="primary" @click="onTagsRecord(row)" v-auth="'business:repeatEvent:detail'" title="查看重复性详情">
- 事件详情
- </el-button>
- <el-button link type="primary" @click="onTagsEdit(row)" v-auth="'business:repeatEvent:edit'" title="编辑重复性事件"> 编辑 </el-button>
- </template>
- </el-table-column>
- <template #empty>
- <Empty />
- </template>
- </el-table>
- <!-- 分页 -->
- <pagination
- :total="state.total"
- v-model:page="state.queryParams.PageIndex"
- v-model:limit="state.queryParams.PageSize"
- @pagination="queryList"
- />
- </el-card>
- <!-- 标签记录 -->
- <tags-record ref="tagsRecordRef" />
- <!-- 编辑市民画像 -->
- <tags-edit ref="TagsEditRef" @updateList="queryList" />
- </div>
- </template>
- <script lang="ts" setup name="businessRepeatEvent">
- import { reactive, ref, onMounted, defineAsyncComponent } from 'vue';
- import { ElMessage, ElMessageBox, FormInstance } from 'element-plus';
- import { formatDate } from '/@/utils/formatTime';
- import { auth } from '/@/utils/authFunction';
- import { citizenDelete } from '/@/api/business/citizen';
- import { repeatEventList } from '/@/api/business/repeatEvent';
- // 引入组件
- const TagsRecord = defineAsyncComponent(() => import('/@/views/business/citizen/components/Tags-record.vue')); // 标签记录
- const TagsEdit = defineAsyncComponent(() => import('/@/views/business/citizen/components/Tags-edit.vue')); // 标签编辑
- // 定义变量内容
- const state = reactive<any>({
- loading: false, // 加载状态
- queryParams: {
- // 查询参数
- PageIndex: 1,
- PageSize: 10,
- Title: null,
- Keyword: null,
- },
- total: 0, // 总条数
- tableData: [], // 表格数据
- });
- const ruleFormRef = ref<RefType>(null); // 表单ref
- // 获取参数列表
- const queryList = () => {
- state.loading = true;
- if (!auth('business:repeatEvent:query')) ElMessage.error('抱歉,您没有权限获取重复性事件列表!');
- else {
- repeatEventList(state.queryParams)
- .then((res: any) => {
- state.loading = false;
- state.tableData = res.result.items ?? [];
- state.total = res.result.total ?? 0;
- })
- .finally(() => {
- state.loading = false;
- });
- }
- };
- // 重置表单
- const resetQuery = (formEl: FormInstance | undefined) => {
- if (!formEl) return;
- formEl.resetFields();
- queryList();
- };
- // 标签记录
- const tagsRecordRef = ref<RefType>();
- const onTagsRecord = (row: any) => {
- tagsRecordRef.value.openDialog(row);
- };
- // 编辑标签
- const TagsEditRef = ref<RefType>();
- const onTagsEdit = (row: any) => {
- TagsEditRef.value.openDialog(row);
- };
- // 表格多选
- const multipleTableRef = ref<RefType>();
- const multipleSelection = ref<any>([]);
- const handleSelectionChange = (val: any[]) => {
- multipleSelection.value = val;
- };
- // 删除参数
- const onLexiconDelete = () => {
- const names = multipleSelection.value.map((item: any) => item.name).join('、');
- const ids = multipleSelection.value.map((item: any) => item.id);
- ElMessageBox.confirm(`您确定要删除:【${names}】市民画像,是否继续?`, '提示', {
- confirmButtonText: '确认',
- cancelButtonText: '取消',
- type: 'warning',
- draggable: true,
- cancelButtonClass: 'default-button',
- autofocus: false,
- })
- .then(() => {
- citizenDelete({ ids }).then(() => {
- ElMessage.success('操作成功');
- queryList();
- });
- })
- .catch(() => {});
- };
- // 页面加载时
- onMounted(() => {
- queryList();
- });
- </script>
- <style lang="scss" scoped>
- .quality-lexicon-container {
- }
- </style>
|