管理系统PC前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dm-manage-web/src/views/sch/rules/index.vue

112 lines
3.8 KiB

2 years ago
<template>
<div class="app-container">
2 years ago
<!-- 搜索插件 -->
<SearchForm v-show="showSearch" ref="SearchForm" @search="_getTableList" />
2 years ago
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
2 years ago
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAddAndUpdate(undefined)" v-hasPermi="['sch:rules:add']">新增</el-button>
2 years ago
</el-col>
2 years ago
<right-toolbar :showSearch.sync="showSearch" @queryTable="_getTableList"></right-toolbar>
2 years ago
</el-row>
2 years ago
<el-table v-loading="loading" :data="tableList">
<el-table-column type="index" width="55" align="center" />
2 years ago
<el-table-column label="制度名" align="center" prop="ruleName" />
<el-table-column label="实施时间" align="center" prop="implementTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.implementTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="到期时间" align="center" prop="dueTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.dueTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="制度内容" align="center" prop="ruleContent" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
2 years ago
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleAddAndUpdate(scope.row)" v-hasPermi="['sch:rules:edit']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['sch:rules:remove']">删除</el-button>
2 years ago
</template>
</el-table-column>
</el-table>
2 years ago
<pagination v-show="total>0" :total="total" :page.sync="searchForm.pageNum" :limit.sync="searchForm.pageSize" @pagination="_getTableList" />
2 years ago
<!-- 添加或修改规章制度对话框 -->
2 years ago
<RuleDialogForm v-if="dialogVisible" ref="ruleDialogForm" :dialog-visible="dialogVisible" @refreshDataList="_getTableList" />
2 years ago
</div>
</template>
<script>
2 years ago
import { listRules, getRules, delRules } from "@/api/sch/rules";
import SearchForm from "./components/SearchForm.vue";
import RuleDialogForm from "./components/RuleDialogForm.vue";
2 years ago
export default {
name: "Rules",
2 years ago
components: {
SearchForm, RuleDialogForm
},
2 years ago
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 规章制度表格数据
2 years ago
tableList: [],
2 years ago
// 查询参数
2 years ago
searchForm: {
2 years ago
pageNum: 1,
2 years ago
pageSize: 10
2 years ago
},
2 years ago
dialogVisible: false
2 years ago
};
},
created() {
2 years ago
this._getTableList();
2 years ago
},
methods: {
/** 查询规章制度列表 */
2 years ago
_getTableList() {
2 years ago
this.loading = true;
2 years ago
const tempForm = this.$refs.SearchForm?.searchForm || {};
const params = { ...this.searchForm, ...tempForm };
listRules(params).then(response => {
this.tableList = response.rows;
2 years ago
this.total = response.total;
this.loading = false;
});
},
/** 新增按钮操作 */
2 years ago
handleAddAndUpdate(info) {
this.dialogVisible = true
this.$nextTick(() => {
this.$refs.ruleDialogForm.init(info)
})
2 years ago
},
/** 删除按钮操作 */
handleDelete(row) {
const ruleIds = row.ruleId || this.ids;
2 years ago
this.$modal.confirm('是否确认删除规章制度名为"' + row.ruleName + '"的数据项?').then(function () {
2 years ago
return delRules(ruleIds);
}).then(() => {
2 years ago
this._getTableList();
this.$message.success('删除成功');
2 years ago
}).catch(() => { });
},
}
};
</script>