123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430 |
- <template>
- <div class="snapshot-info-ssp-config-container layout-padding">
- <div class="layout-padding-auto layout-padding-view pd20">
- <vxe-grid v-bind="gridOptions" ref="gridRef">
- <template #form>
- <el-form :model="state.queryParams" ref="ruleFormRef" inline @submit.native.prevent :disabled="gridOptions.loading">
- <el-form-item label="审批状态" prop="State">
- <el-radio-group v-model="state.queryParams.State" @change="handleQuery">
- <el-radio v-for="item in bulletinState" :label="item.value" :value="item.key" :key="item.key"></el-radio>
- </el-radio-group>
- </el-form-item>
- <el-form-item label="标题" prop="Title">
- <el-input v-model="state.queryParams.Title" 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="drawer = true" class="default-button"> <SvgIcon name="ele-Search" class="mr5" />更多查询</el-button>
- </el-form-item>
- </el-form>
- </template>
- <template #toolbar_buttons>
- <el-button type="primary" @click="onAdd" v-auth="'snapshot:info:sspConfig:add'"> <SvgIcon name="ele-Plus" class="mr5" />新增 </el-button>
- </template>
- <template #action="{ row }">
- <el-button link type="primary" @click="onEdit(row)" v-if="[0, 3].includes(row.bulletinState)" v-auth="'snapshot:info:sspConfig:edit'">
- 编辑
- </el-button>
- <el-button link type="danger" @click="onDelete(row)" v-if="[0].includes(row.bulletinState)" v-auth="'snapshot:info:sspConfig:delete'">
- 删除
- </el-button>
- <el-button
- link
- type="primary"
- @click="onCommit(row)"
- v-if="[0, 3].includes(row.bulletinState)"
- title="提交审批"
- v-auth="'snapshot:info:sspConfig:commit'"
- >
- 提交
- </el-button>
- <el-button
- link
- type="primary"
- @click="onShelfFn(row)"
- v-if="[2].includes(row.bulletinState) && !row.isArrive"
- v-auth="'snapshot:info:sspConfig:onShelf'"
- >
- 上架
- </el-button>
- <el-button
- link
- type="primary"
- @click="offShelfFn(row)"
- v-if="[2].includes(row.bulletinState) && row.isArrive"
- v-auth="'snapshot:info:sspConfig:offShelf'"
- >
- 下架
- </el-button>
- <el-button link type="primary" @click="onDetail(row)" v-if="[1, 2].includes(row.bulletinState)"> 查看详情 </el-button>
- </template>
- <template #pager>
- <pagination
- @pagination="queryList"
- :total="state.total"
- v-model:current-page="state.queryParams.PageIndex"
- v-model:page-size="state.queryParams.PageSize"
- :disabled="state.loading"
- />
- </template>
- </vxe-grid>
- </div>
- <!-- 更多查询 -->
- <el-drawer v-model="drawer" title="更多查询" size="500px">
- <el-form :model="state.queryParams" ref="drawerRuleFormRef" @submit.native.prevent label-width="100px" :disabled="gridOptions.loading">
- <el-form-item label="类别名称" prop="SnapshotBulletinTypeName">
- <el-input
- v-model="state.queryParams.SnapshotBulletinTypeName"
- placeholder="请填写类别名称"
- clearable
- @keyup.enter="handleQuery"
- class="keyword-input"
- />
- </el-form-item>
- <el-form-item label="文档编号" prop="No">
- <el-input v-model="state.queryParams.No" placeholder="请填写文档编号" clearable @keyup.enter="handleQuery" />
- </el-form-item>
- <el-form-item label="部门名称" prop="DepartmentName">
- <el-input v-model="state.queryParams.DepartmentName" placeholder="请填写部门名称" clearable @keyup.enter="handleQuery" />
- </el-form-item>
- <el-form-item label="发布人" prop="CreatorName">
- <el-input v-model="state.queryParams.CreatorName" placeholder="请填写发布人" clearable @keyup.enter="handleQuery" />
- </el-form-item>
- <el-form-item label="发布时间" prop="fbTime">
- <el-date-picker
- v-model="state.queryParams.fbTime"
- type="datetimerange"
- unlink-panels
- range-separator="至"
- start-placeholder="开始时间"
- end-placeholder="结束时间"
- :shortcuts="shortcuts"
- @change="handleQuery"
- value-format="YYYY-MM-DD[T]HH:mm:ss"
- :default-time="defaultTimeStartEnd"
- />
- </el-form-item>
- </el-form>
- <template #footer>
- <el-button type="primary" @click="handleQuery" :loading="state.loading"> <SvgIcon name="ele-Search" class="mr5" />查询 </el-button>
- <el-button @click="resetQuery(drawerRuleFormRef)" class="default-button"> <SvgIcon name="ele-Refresh" class="mr5" />重置 </el-button>
- </template>
- </el-drawer>
- <!-- 新增 -->
- <config-add ref="configAddRef" @updateList="queryList" />
- <!-- 修改 -->
- <config-edit ref="configEditRef" @updateList="queryList" />
- <!-- 详情 -->
- <config-detail ref="configDetailRef" @updateList="queryList" />
- </div>
- </template>
- <script lang="tsx" setup name="snapshotInfoSspConfig">
- import { defineAsyncComponent, onMounted, reactive, ref } from 'vue';
- import { ElMessage, ElMessageBox, FormInstance } from 'element-plus';
- import {
- delSnapshotBulletin,
- getSnapshotBulletinBaseData,
- getSnapshotBulletinExport,
- getSnapshotBulletinList,
- shelfSnapshotBulletin,
- submitSnapshotBulletin,
- } from '@/api/snapshot/info';
- import { defaultTimeStartEnd, shortcuts } from '@/utils/constants';
- import Other from '@/utils/other';
- // 引入组件
- const pagination = defineAsyncComponent(() => import('@/components/ProTable/components/Pagination.vue')); // 分页
- const ConfigAdd = defineAsyncComponent(() => import('@/views/snapshot/info/sspConfig/components/Config-add.vue')); // 新增
- const ConfigEdit = defineAsyncComponent(() => import('@/views/snapshot/info/sspConfig/components/Config-edit.vue')); // 编辑
- const ConfigDetail = defineAsyncComponent(() => import('@/views/snapshot/info/sspConfig/components/Config-detail.vue')); // 详情
- // 定义变量内容
- const state = reactive<any>({
- loading: false,
- queryParams: {
- // 查询参数
- PageIndex: 1,
- PageSize: 20,
- State: 0, // 审核状态 默认草稿
- SnapshotBulletinTypeName: null, // 类型名称
- Title: null, // 标题
- No: null, // 文档编号
- DepartmentName: null, // 部门名称
- CreatorName: null, // 发布人
- fbTime: [], // 发布时间
- BeginCreationTime: null,
- EndCreationTime: null,
- },
- total: 0, // 总条数
- });
- const requestParams = ref<EmptyObjectType>({});
- const gridOptions = reactive<any>({
- loading: false,
- border: true,
- showOverflow: true,
- columnConfig: {
- resizable: true,
- },
- scrollY: {
- enabled: true,
- gt: 100,
- },
- toolbarConfig: {
- zoom: true,
- custom: true,
- refresh: {
- queryMethod: () => {
- handleQuery();
- },
- },
- slots: {
- buttons: 'toolbar_buttons',
- },
- tools: [{ toolRender: { name: 'exportCurrent' } }, { toolRender: { name: 'exportAll' } }],
- },
- params: {
- exportMethod: getSnapshotBulletinExport,
- exportParams: requestParams,
- },
- customConfig: {
- storage: true,
- },
- id: 'snapshotConfigClue',
- rowConfig: { isHover: true, height: 30, isCurrent: true, useKey: true },
- height: 'auto',
- columns: [
- {
- field: 'snapshotBulletinTypeName',
- title: '类别名称',
- width: 150,
- },
- {
- field: 'title',
- title: '标题',
- minWidth: 200,
- slots: {
- default: ({ row }) => {
- return (
- <el-button link type="primary" onClick={() => onDetail(row)}>
- {row.title}
- </el-button>
- );
- },
- },
- },
- {
- field: 'no',
- title: '文档编码',
- width: 100,
- },
- {
- field: 'readedNum',
- title: '阅读次数',
- width: 100,
- },
- {
- field: 'departmentName',
- title: '部门名称',
- width: 140,
- },
- {
- field: 'creatorName',
- title: '发布人',
- width: 120,
- },
- {
- field: 'bulletinTime',
- title: '发布时间',
- width: 160,
- formatter: 'formatDate',
- },
- {
- field: 'isOpen',
- title: '是否公开',
- width: 100,
- slots: {
- default: ({ row }) => {
- return row.isOpen ? '是' : '否';
- },
- },
- },
- {
- field: 'isOpenWebsite',
- title: '网站公开',
- width: 100,
- slots: {
- default: ({ row }) => {
- return row.isOpenWebsite ? '是' : '否';
- },
- },
- },
- {
- field: 'isWeChat',
- title: '微信公开',
- width: 100,
- slots: {
- default: ({ row }) => {
- return row.isWeChat ? '是' : '否';
- },
- },
- },
- {
- field: 'isWeibo',
- title: '微博公开',
- width: 100,
- slots: {
- default: ({ row }) => {
- return row.isWeibo ? '是' : '否';
- },
- },
- },
- {
- field: 'bulletinStateText',
- title: '审批状态',
- width: 100,
- },
- { title: '操作', width: 200, fixed: 'right', showOverflow: false, align: 'center', slots: { default: 'action' } },
- ],
- data: [],
- });
- /** 搜索按钮操作 节流操作 */
- const handleQuery = () => {
- state.queryParams.PageIndex = 1;
- queryList();
- };
- // 获取参数列表
- const queryList = () => {
- state.loading = true;
- gridOptions.loading = true;
- requestParams.value = Other.deepClone(state.queryParams);
- requestParams.value.BeginCreationTime = state.queryParams.fbTime === null ? null : state.queryParams.fbTime[0]; // 受理时间
- requestParams.value.EndCreationTime = state.queryParams.fbTime === null ? null : state.queryParams.fbTime[1];
- Reflect.deleteProperty(requestParams.value, 'fbTime'); // 删除无用的参数
- getSnapshotBulletinList(requestParams.value)
- .then((res) => {
- state.loading = false;
- gridOptions.data = res.result.items ?? [];
- state.total = res.result.total ?? 0;
- gridOptions.loading = false;
- })
- .finally(() => {
- state.loading = false;
- gridOptions.loading = false;
- });
- };
- // 重置表单
- const drawerRuleFormRef = ref<RefType>();
- const ruleFormRef = ref<any>(null); // 表单ref
- const drawer = ref(false);
- const resetQuery = (formEl: FormInstance | undefined) => {
- if (!formEl) return;
- formEl.resetFields();
- ruleFormRef.value?.resetFields();
- queryList();
- };
- // 新增
- const configAddRef = ref<RefType>();
- const onAdd = () => {
- configAddRef.value.openDialog();
- };
- // 编辑
- const configEditRef = ref<RefType>();
- const onEdit = (row: any) => {
- configEditRef.value.openDialog(row.id);
- };
- // 删除
- const onDelete = (row: any) => {
- ElMessageBox.confirm(`您确定要删除:【${row.title}】,是否继续?`, '提示', {
- confirmButtonText: '确认',
- cancelButtonText: '取消',
- type: 'warning',
- draggable: true,
- cancelButtonClass: 'default-button',
- autofocus: false,
- })
- .then(() => {
- delSnapshotBulletin(row.id).then(() => {
- ElMessage.success('操作成功');
- queryList();
- });
- })
- .catch(() => {});
- };
- // 提交
- const onCommit = (row: any) => {
- ElMessageBox.confirm(`您确定要提交审批:【${row.title}】,是否继续?`, '提示', {
- confirmButtonText: '确认',
- cancelButtonText: '取消',
- type: 'warning',
- draggable: true,
- cancelButtonClass: 'default-button',
- autofocus: false,
- })
- .then(() => {
- submitSnapshotBulletin({ id: row.id }).then(() => {
- ElMessage.success('操作成功');
- queryList();
- });
- })
- .catch(() => {});
- };
- // 上架
- const onShelfFn = (row: any) => {
- ElMessageBox.confirm(`您确定要上架:【${row.title}】,是否继续?`, '提示', {
- confirmButtonText: '确认',
- cancelButtonText: '取消',
- type: 'warning',
- draggable: true,
- cancelButtonClass: 'default-button',
- autofocus: false,
- })
- .then(() => {
- shelfSnapshotBulletin({ id: row.id, isArrive: true }).then(() => {
- ElMessage.success('操作成功');
- queryList();
- });
- })
- .catch(() => {});
- };
- // 下架
- const offShelfFn = (row: any) => {
- ElMessageBox.confirm(`您确定要下架:【${row.title}】,是否继续?`, '提示', {
- confirmButtonText: '确认',
- cancelButtonText: '取消',
- type: 'warning',
- draggable: true,
- cancelButtonClass: 'default-button',
- autofocus: false,
- })
- .then(() => {
- shelfSnapshotBulletin({ id: row.id, isArrive: false }).then(() => {
- ElMessage.success('操作成功');
- queryList();
- });
- })
- .catch(() => {});
- };
- // 查看详情
- const configDetailRef = ref<RefType>();
- const onDetail = (row: any) => {
- configDetailRef.value.openDialog(row.id);
- };
- // 获取基础信息
- const bulletinState = ref<EmptyArrayType>([]);
- const getBaseInfo = async () => {
- try {
- const { result } = await getSnapshotBulletinBaseData();
- bulletinState.value = result.bulletinState;
- } catch (e) {
- console.log(e);
- }
- };
- // 页面加载时
- onMounted(() => {
- queryList();
- getBaseInfo();
- });
- </script>
|