index.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <template>
  2. <div class="quality-lexicon-container layout-pd">
  3. <el-card shadow="never">
  4. <el-form :model="state.queryParams" ref="ruleFormRef" :inline="true" @submit.native.prevent>
  5. <el-form-item label="标题" prop="Title">
  6. <el-input v-model="state.queryParams.Title" placeholder="请输入重复性事件标题" clearable @keyup.enter="queryList" style="width: 250px" />
  7. </el-form-item>
  8. <el-form-item label="关键词" prop="KeyWords">
  9. <el-input v-model="state.queryParams.KeyWords" placeholder="请输入关键词" clearable @keyup.enter="queryList" style="width: 250px" />
  10. </el-form-item>
  11. <el-form-item>
  12. <el-button type="primary" @click="queryList" :loading="state.loading"> <SvgIcon name="ele-Search" class="mr5" />查询 </el-button>
  13. <el-button @click="resetQuery(ruleFormRef)" v-waves class="default-button"> <SvgIcon name="ele-Refresh" class="mr5" />重置 </el-button>
  14. </el-form-item>
  15. </el-form>
  16. </el-card>
  17. <el-card shadow="never">
  18. <el-table :data="state.tableData" v-loading="state.loading" row-key="id" ref="multipleTableRef" @selection-change="handleSelectionChange">
  19. <el-table-column type="selection" width="55" />
  20. <el-table-column prop="title" label="重复事件标题" show-overflow-tooltip width="400"></el-table-column>
  21. <el-table-column prop="keyWords" label="关键词" show-overflow-tooltip width="300"></el-table-column>
  22. <el-table-column prop="creatorName" label="创建人" show-overflow-tooltip></el-table-column>
  23. <el-table-column label="创建时间" show-overflow-tooltip width="170">
  24. <template #default="{ row }">
  25. <span>{{ formatDate(row.creationTime, 'YYYY-mm-dd HH:MM:SS') }}</span>
  26. </template>
  27. </el-table-column>
  28. <el-table-column prop="lastModificationName" label="更新人" show-overflow-tooltip></el-table-column>
  29. <el-table-column prop="lastModificationTime" label="更新时间" show-overflow-tooltip width="170">
  30. <template #default="{ row }">
  31. <span>{{ formatDate(row.lastModificationTime, 'YYYY-mm-dd HH:MM:SS') }}</span>
  32. </template>
  33. </el-table-column>
  34. <el-table-column label="操作" width="140" fixed="right" align="center">
  35. <template #default="{ row }">
  36. <el-button link type="primary" @click="onTagsRecord(row)" v-auth="'business:repeatEvent:detail'" title="查看重复性详情">
  37. 事件详情
  38. </el-button>
  39. <el-button link type="primary" @click="onTagsEdit(row)" v-auth="'business:repeatEvent:edit'" title="编辑重复性事件"> 编辑 </el-button>
  40. </template>
  41. </el-table-column>
  42. <template #empty>
  43. <Empty />
  44. </template>
  45. </el-table>
  46. <!-- 分页 -->
  47. <pagination
  48. :total="state.total"
  49. v-model:page="state.queryParams.PageIndex"
  50. v-model:limit="state.queryParams.PageSize"
  51. @pagination="queryList"
  52. />
  53. </el-card>
  54. <!-- 标签记录 -->
  55. <tags-record ref="tagsRecordRef" />
  56. <!-- 编辑市民画像 -->
  57. <tags-edit ref="TagsEditRef" @updateList="queryList" />
  58. </div>
  59. </template>
  60. <script lang="ts" setup name="businessRepeatEvent">
  61. import { reactive, ref, onMounted, defineAsyncComponent } from 'vue';
  62. import { ElMessage, ElMessageBox, FormInstance } from 'element-plus';
  63. import { formatDate } from '/@/utils/formatTime';
  64. import { auth } from '/@/utils/authFunction';
  65. import { citizenDelete } from '/@/api/business/citizen';
  66. import { repeatEventList } from '/@/api/business/repeatEvent';
  67. // 引入组件
  68. const TagsRecord = defineAsyncComponent(() => import('/@/views/business/citizen/components/Tags-record.vue')); // 标签记录
  69. const TagsEdit = defineAsyncComponent(() => import('/@/views/business/citizen/components/Tags-edit.vue')); // 标签编辑
  70. // 定义变量内容
  71. const state = reactive<any>({
  72. loading: false, // 加载状态
  73. queryParams: {
  74. // 查询参数
  75. PageIndex: 1,
  76. PageSize: 10,
  77. Title: null,
  78. Keyword: null,
  79. },
  80. total: 0, // 总条数
  81. tableData: [], // 表格数据
  82. });
  83. const ruleFormRef = ref<RefType>(null); // 表单ref
  84. // 获取参数列表
  85. const queryList = () => {
  86. state.loading = true;
  87. if (!auth('business:repeatEvent:query')) ElMessage.error('抱歉,您没有权限获取重复性事件列表!');
  88. else {
  89. repeatEventList(state.queryParams)
  90. .then((res: any) => {
  91. state.loading = false;
  92. state.tableData = res.result.items ?? [];
  93. state.total = res.result.total ?? 0;
  94. })
  95. .finally(() => {
  96. state.loading = false;
  97. });
  98. }
  99. };
  100. // 重置表单
  101. const resetQuery = (formEl: FormInstance | undefined) => {
  102. if (!formEl) return;
  103. formEl.resetFields();
  104. queryList();
  105. };
  106. // 标签记录
  107. const tagsRecordRef = ref<RefType>();
  108. const onTagsRecord = (row: any) => {
  109. tagsRecordRef.value.openDialog(row);
  110. };
  111. // 编辑标签
  112. const TagsEditRef = ref<RefType>();
  113. const onTagsEdit = (row: any) => {
  114. TagsEditRef.value.openDialog(row);
  115. };
  116. // 表格多选
  117. const multipleTableRef = ref<RefType>();
  118. const multipleSelection = ref<any>([]);
  119. const handleSelectionChange = (val: any[]) => {
  120. multipleSelection.value = val;
  121. };
  122. // 删除参数
  123. const onLexiconDelete = () => {
  124. const names = multipleSelection.value.map((item: any) => item.name).join('、');
  125. const ids = multipleSelection.value.map((item: any) => item.id);
  126. ElMessageBox.confirm(`您确定要删除:【${names}】市民画像,是否继续?`, '提示', {
  127. confirmButtonText: '确认',
  128. cancelButtonText: '取消',
  129. type: 'warning',
  130. draggable: true,
  131. cancelButtonClass: 'default-button',
  132. autofocus: false,
  133. })
  134. .then(() => {
  135. citizenDelete({ ids }).then(() => {
  136. ElMessage.success('操作成功');
  137. queryList();
  138. });
  139. })
  140. .catch(() => {});
  141. };
  142. // 页面加载时
  143. onMounted(() => {
  144. queryList();
  145. });
  146. </script>
  147. <style lang="scss" scoped>
  148. .quality-lexicon-container {
  149. }
  150. </style>