| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <el-form :inline="true" label-width="100px" :model="form"> |
| | | <el-form :inline="true" class="evenly-distributed-labels" :model="form" ref="form" label-position="left" label-width="80px"> |
| | | <el-form-item label="政策名称"> |
| | | <el-input placeholder="请输入" ></el-input> |
| | | <el-input placeholder="请输入" v-model="form.docTitle"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="政策类型"> |
| | | <el-select placeholder="请选择" style="width: 200px;"> |
| | | <el-select placeholder="请选择" style="width: 200px;" v-model="form.docType"> |
| | | <el-option v-for="item in policyList" :label="item.label" :value="item.value"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="状态"> |
| | | <el-select placeholder="请选择" style="width: 200px;"> |
| | | <el-select placeholder="请选择" style="width: 200px;" v-model="form.docStatus"> |
| | | <el-option v-for="item in statusList" :label="item.label" :value="item.value"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | <el-button type="primary" plain icon="Plus" @click="handleAdd()" v-hasPermi="['system:dept:add']">新增</el-button> |
| | | </el-col> |
| | | </el-row> |
| | | <el-table :data="deptList"> |
| | | <el-table-column label="政策名称"></el-table-column> |
| | | <el-table-column label="政策类型"></el-table-column> |
| | | <el-table-column label="创建时间"></el-table-column> |
| | | <el-table-column label="创建人" width="200"></el-table-column> |
| | | <el-table-column label="状态" width="200"></el-table-column> |
| | | <el-table-column label="操作"></el-table-column> |
| | | <el-table :data="tableData" v-loading="loading" border> |
| | | <el-table-column label="政策名称" prop="docTitle"></el-table-column> |
| | | <el-table-column label="政策类型" prop="docType"> |
| | | <template #default="scope"> |
| | | {{ policyType[scope.row.docType] }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="创建时间" prop="createTime"></el-table-column> |
| | | <el-table-column label="创建人" width="200" prop="createBy"></el-table-column> |
| | | <el-table-column label="状态" width="200" prop="docStatus"> |
| | | <template #default="scope"> |
| | | <el-switch v-if="scope.row.docId" v-model="scope.row.docStatus" :active-value="0" :inactive-value="1" @change="changeStatus(scope.row)"></el-switch> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="操作"> |
| | | <template #default="scope"> |
| | | <el-link type="primary" @click="handleAdd(scope.row)">编辑</el-link> |
| | | <el-divider direction="vertical" /> |
| | | <el-link type="error" @click="delData(scope.row)">删除</el-link> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <pagination v-show="queryParams.total > 0" :total="queryParams.total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" /> |
| | | <addNews ref="addnews"></addNews> |
| | | <pagination v-show="queryParams.total > 0" :total="queryParams.total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="pageChange" /> |
| | | <addNews ref="addnews" :policyList="policyList" @upload="getList"></addNews> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { docList } from '@/api/system/company/company' |
| | | import { docList,updDoc, delDoc } from '@/api/system/company/company' |
| | | import addNews from './components/addNews' |
| | | import { ElMessageBox } from 'element-plus' |
| | | import { policyType } from '@/utils/mapList/index' |
| | | export default { |
| | | components: { |
| | | addNews |
| | |
| | | pageNum: 1, |
| | | pageSize: 10 |
| | | }, |
| | | tableData: [] |
| | | tableData: [], |
| | | loading: false, |
| | | form: {}, |
| | | policyType |
| | | } |
| | | }, |
| | | mounted() { |
| | | created() { |
| | | this.loading = true |
| | | this.getList() |
| | | }, |
| | | methods: { |
| | | pageChange(e) { |
| | | this.queryParams.pageNum = e.page |
| | | this.queryParams.pageSize = e.limit |
| | | this.getList() |
| | | }, |
| | | // 获取列表 |
| | | getList() { |
| | | docList(this.queryParams).then(res => { |
| | | docList({...this.queryParams, ...this.form}).then(res => { |
| | | this.tableData = res.rows |
| | | this.queryParams.total = res.total |
| | | this.loading = false |
| | | }) |
| | | }, |
| | | // 搜索 |
| | |
| | | this.queryParams.pageNum = 1 |
| | | this.getList() |
| | | }, |
| | | handleAdd() { |
| | | this.$refs.addnews.openDialog() |
| | | handleAdd(row) { |
| | | this.$refs.addnews.openDialog(row) |
| | | }, |
| | | changeStatus(row) { |
| | | if(this.loading){ |
| | | return |
| | | } |
| | | updDoc(row).then(val => { |
| | | this.$message.success('修改成功') |
| | | this.getList() |
| | | }) |
| | | }, |
| | | delData(row) { |
| | | ElMessageBox({ |
| | | type: 'warning', |
| | | message: '确认删除该政策?', |
| | | title: '提示', |
| | | cancelButtonText: '取消', |
| | | |
| | | }).then(val => { |
| | | delDoc({delId: row.docId}).then(val => { |
| | | this.$message.success('删除成功') |
| | | this.getList() |
| | | }) |
| | | }) |
| | | }, |
| | | resetQuery() { |
| | | this.form = {} |
| | | this.queryParams.pageNum = 1 |
| | | this.$refs.form.resetFields() |
| | | this.getList() |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | </script> |
| | | <style scoped lang="scss"> |
| | | .evenly-distributed-labels { |
| | | :deep(){ |
| | | .el-form-item__label { |
| | | position: relative; /* 设置相对定位作为星号的定位基准 */ |
| | | text-align: justify; |
| | | text-align-last: justify; /* 确保最后一行也两端对齐 */ |
| | | padding-left: 10px; /* 为星号预留空间 */ |
| | | display: inline-block; |
| | | } |
| | | } |
| | | } |
| | | </style> |