123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- <template>
- <div class="auxiliary-citizen-container layout-pd">
- <el-card shadow="never">
- <el-form :model="state.queryParams" ref="ruleFormRef" inline @submit.native.prevent>
- <el-form-item label="市民联系方式" prop="PhoneNumber">
- <el-input
- v-model="state.queryParams.PhoneNumber"
- placeholder="请输入市民联系方式"
- clearable
- @keyup.enter="handleQuery"
- class="keyword-input"
- />
- </el-form-item>
- <el-form-item label="市民标签" prop="Label">
- <el-input v-model="state.queryParams.Label" placeholder="请输入市民标签" clearable @keyup.enter="handleQuery" class="keyword-input" />
- </el-form-item>
- <el-form-item>
- <el-button type="primary" @click="handleQuery" :loading="state.loading"> <SvgIcon name="ele-Search" class="mr5" />查询 </el-button>
- <el-button @click="resetQuery(ruleFormRef)" class="default-button"> <SvgIcon name="ele-Refresh" class="mr5" />重置 </el-button>
- </el-form-item>
- </el-form>
- </el-card>
- <el-card shadow="never">
- <!-- <div class="mb20">
- <el-button type="primary" @click="onLexiconDelete" v-waves v-auth="'auxiliary:citizen:delete'" :disabled="!multipleSelection.length">
- <SvgIcon name="ele-Delete" class="mr5" />删除
- </el-button>
- </div>-->
- <!-- 表格 -->
- <ProTable
- ref="proTableRef"
- :columns="columns"
- :data="state.tableData"
- @updateTable="queryList"
- :loading="state.loading"
- :total="state.total"
- v-model:page-index="state.queryParams.PageIndex"
- v-model:page-size="state.queryParams.PageSize"
- >
- <!-- 表格操作 -->
- <template #operation="{ row }">
- <el-button link type="primary" @click="onTagsRecord(row)" v-auth="'auxiliary:citizen:tag'" title="查看市民标签记录"> 标签记录 </el-button>
- <el-button link type="primary" @click="onTagsEdit(row)" v-auth="'auxiliary:citizen:edit'" title="编辑市民画像"> 编辑 </el-button>
- </template>
- </ProTable>
- </el-card>
- <!-- 标签记录 -->
- <tags-record ref="tagsRecordRef" />
- <!-- 编辑市民画像 -->
- <tags-edit ref="TagsEditRef" @updateList="queryList" />
- </div>
- </template>
- <script lang="tsx" setup name="auxiliaryCitizen">
- import { defineAsyncComponent, onMounted, reactive, ref } from 'vue';
- import { ElButton, ElMessage, ElMessageBox, FormInstance } from 'element-plus';
- import { formatDate } from '@/utils/formatTime';
- import { citizenDelete, citizenList } from '@/api/auxiliary/citizen';
- // 引入组件
- const TagsRecord = defineAsyncComponent(() => import('@/views/auxiliary/citizen/components/Tags-record.vue')); // 标签记录
- const TagsEdit = defineAsyncComponent(() => import('@/views/auxiliary/citizen/components/Tags-edit.vue')); // 标签编辑
- const proTableRef = ref<RefType>(); // 表格ref
- // 表格配置项
- const columns = ref<any[]>([
- { prop: 'phoneNumber', label: '市民联系方式', width: 200 },
- { prop: 'label', label: '市民标签', width: 300 },
- { prop: 'creatorName', label: '创建人' },
- {
- prop: 'creationTime',
- label: '创建时间',
- width: 170,
- render: (scope) => {
- return <span>{formatDate(scope.row.creationTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
- },
- },
- { prop: 'lastModificationName', label: '更新人' },
- {
- prop: 'lastModificationTime',
- label: '更新时间',
- width: 170,
- render: (scope) => {
- return <span>{formatDate(scope.row.lastModificationTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
- },
- },
- { prop: 'operation', label: '操作', fixed: 'right', width: 140, align: 'center' },
- ]);
- // 定义变量内容
- const state = reactive({
- loading: false, // 加载状态
- queryParams: {
- // 查询参数
- PageIndex: 1,
- PageSize: 10,
- PhoneNumber: null,
- Label: null,
- },
- total: 0, // 总条数
- tableData: [], // 表格数据
- });
- const ruleFormRef = ref<RefType>(null); // 表单ref
- /** 搜索按钮操作 */
- const handleQuery = () => {
- state.queryParams.PageIndex = 1;
- queryList();
- };
- // 获取列表
- const queryList = () => {
- state.loading = true;
- citizenList(state.queryParams)
- .then((res) => {
- 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);
- };
- // 页面加载时
- onMounted(() => {
- queryList();
- });
- </script>
|