提交
This commit is contained in:
@@ -1,22 +1,9 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="组织id" prop="deptId">
|
||||
<el-input v-model="queryParams.deptId" placeholder="请输入组织id" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="文件名" prop="fileName">
|
||||
<el-input v-model="queryParams.fileName" placeholder="请输入文件名" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="文件路径" prop="fileUrl">
|
||||
<el-input v-model="queryParams.fileUrl" placeholder="请输入文件路径" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="上传时间" prop="uploadTime">
|
||||
<el-date-picker clearable v-model="queryParams.uploadTime" type="date" value-format="yyyy-MM-dd" placeholder="请选择上传时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="上传人员" prop="uploadUser">
|
||||
<el-input v-model="queryParams.uploadUser" placeholder="请输入上传人员" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
@@ -25,24 +12,16 @@
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['system:file:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate" v-hasPermi="['system:file:edit']">修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete" v-hasPermi="['system:file:remove']">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['system:file:export']">导出</el-button>
|
||||
<el-upload ref="upload" v-hasPermi="['sch:file:upload']" class="upload-demo" :headers="upload.headers" :action="upload.url" multiple :limit="5" :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :show-file-list="false">
|
||||
<el-button size="mini" type="primary">上传</el-button>
|
||||
</el-upload>
|
||||
<!-- <el-button type="primary" plain icon="el-icon-upload" size="mini" @click="handleAdd" v-hasPermi="['sch:file:upload']">上传</el-button> -->
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="fileList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="${comment}" align="center" prop="fileId" />
|
||||
<el-table-column label="组织id" align="center" prop="deptId" />
|
||||
<el-table v-loading="loading" :data="tableList">
|
||||
<el-table-column type="index" width="55" align="center" />
|
||||
<el-table-column label="文件名" align="center" prop="fileName" />
|
||||
<el-table-column label="文件路径" align="center" prop="fileUrl" />
|
||||
<el-table-column label="上传时间" align="center" prop="uploadTime" width="180">
|
||||
@@ -53,44 +32,20 @@
|
||||
<el-table-column label="上传人员" align="center" prop="uploadUser" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:file:edit']">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['system:file:remove']">删除</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-download" @click="handleDownload(scope.row)" v-hasPermi="['sch:file:download']">下载</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['sch:file:remove']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
|
||||
|
||||
<!-- 添加或修改文件对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="组织id" prop="deptId">
|
||||
<el-input v-model="form.deptId" placeholder="请输入组织id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="文件名" prop="fileName">
|
||||
<el-input v-model="form.fileName" placeholder="请输入文件名" />
|
||||
</el-form-item>
|
||||
<el-form-item label="文件路径" prop="fileUrl">
|
||||
<el-input v-model="form.fileUrl" placeholder="请输入文件路径" />
|
||||
</el-form-item>
|
||||
<el-form-item label="上传时间" prop="uploadTime">
|
||||
<el-date-picker clearable v-model="form.uploadTime" type="date" value-format="yyyy-MM-dd" placeholder="请选择上传时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="上传人员" prop="uploadUser">
|
||||
<el-input v-model="form.uploadUser" placeholder="请输入上传人员" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listFile, getFile, delFile, addFile, updateFile } from "@/api/sch/file";
|
||||
import { listFile, delFile, } from "@/api/sch/file";
|
||||
import { getToken } from '@/utils/auth'
|
||||
|
||||
export default {
|
||||
name: "File",
|
||||
@@ -108,27 +63,21 @@ export default {
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 文件表格数据
|
||||
fileList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
tableList: [],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
deptId: null,
|
||||
fileName: null,
|
||||
fileUrl: null,
|
||||
uploadTime: null,
|
||||
uploadUser: null
|
||||
fileName: null
|
||||
},
|
||||
upload: {
|
||||
// 是否禁用上传
|
||||
isUploading: false,
|
||||
// 设置上传的请求头部
|
||||
headers: { Authorization: 'Bearer ' + getToken() },
|
||||
// 上传的地址
|
||||
url: process.env.VUE_APP_BASE_API + '/sch/file/upload',
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
@@ -139,28 +88,12 @@ export default {
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listFile(this.queryParams).then(response => {
|
||||
this.fileList = response.rows;
|
||||
this.tableList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
fileId: null,
|
||||
deptId: null,
|
||||
fileName: null,
|
||||
fileUrl: null,
|
||||
uploadTime: null,
|
||||
uploadUser: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
@@ -171,63 +104,33 @@ export default {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.fileId)
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
|
||||
// 文件上传中处理
|
||||
handleFileUploadProgress(event, file, fileList) {
|
||||
this.upload.isUploading = true;
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加文件";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const fileId = row.fileId || this.ids
|
||||
getFile(fileId).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改文件";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.fileId != null) {
|
||||
updateFile(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addFile(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
// 文件上传成功处理
|
||||
handleFileSuccess(response, file, fileList) {
|
||||
this.upload.isUploading = false;
|
||||
this.$refs.upload.clearFiles();
|
||||
this.$message.success('上传成功');
|
||||
this.getList();
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const fileIds = row.fileId || this.ids;
|
||||
this.$modal.confirm('是否确认删除文件编号为"' + fileIds + '"的数据项?').then(function () {
|
||||
return delFile(fileIds);
|
||||
this.$modal.confirm('是否确认删除文件名为"' + row.fileName + '"的数据项?').then(function () {
|
||||
return delFile(row);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
this.$message.success('删除成功');
|
||||
}).catch(() => { });
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('system/file/export', {
|
||||
...this.queryParams
|
||||
}, `file_${new Date().getTime()}.xlsx`)
|
||||
handleDownload(row) {
|
||||
this.download('sch/file/download', {
|
||||
...row
|
||||
}, row.fileName)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
115
src/views/sch/rules/components/RuleDialogForm.vue
Normal file
115
src/views/sch/rules/components/RuleDialogForm.vue
Normal file
@@ -0,0 +1,115 @@
|
||||
<template>
|
||||
<el-dialog title="驾校信息" :close-on-click-modal="false" append-to-body :visible.sync="visible" width="600px" @close="closeDialog">
|
||||
<div>
|
||||
<el-form ref="dialogForm" :model="dialogForm" :rules="dataRule" label-position="top" @keyup.enter.native="dialogFormSubmit()">
|
||||
<el-form-item label="制度名" prop="ruleName">
|
||||
<el-input v-model="dialogForm.ruleName" placeholder="请输入制度名" />
|
||||
</el-form-item>
|
||||
<el-form-item label="实施时间" prop="implementTime">
|
||||
<el-date-picker clearable v-model="dialogForm.implementTime" type="date" value-format="yyyy-MM-dd" placeholder="请选择实施时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="到期时间" prop="dueTime">
|
||||
<el-date-picker clearable v-model="dialogForm.dueTime" type="date" value-format="yyyy-MM-dd" placeholder="请选择到期时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="制度内容" prop="ruleContent">
|
||||
<editor v-model="dialogForm.ruleContent" :min-height="192" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button plain @click="(visible=false)">取消</el-button>
|
||||
<el-button v-jclick type="primary" :disabled="!canSubmit" @click="dialogFormSubmit()">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { addRules, updateRules } from "@/api/sch/rules";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
canSubmit: true,
|
||||
dialogForm: {
|
||||
ruleId: undefined,
|
||||
ruleName: undefined,
|
||||
implementTime: undefined,
|
||||
dueTime: undefined,
|
||||
ruleContent: undefined
|
||||
},
|
||||
dataRule: {
|
||||
ruleName: [{ required: true, message: '制度名不能为空', trigger: 'blur' }],
|
||||
implementTime: [{ required: true, message: '实施时间不能为空', trigger: 'blur' }],
|
||||
ruleContent: [{ required: true, message: '制度内容不能为空', trigger: 'blur' }]
|
||||
}
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
init(info = undefined) {
|
||||
// debugger
|
||||
this.visible = true;
|
||||
this.$nextTick(() => {
|
||||
this.resetDialogForm();
|
||||
this.$refs['dialogForm'].resetFields();
|
||||
if (info) {
|
||||
this.dialogForm = this.deepClone(info);
|
||||
}
|
||||
});
|
||||
},
|
||||
resetDialogForm() {
|
||||
this.dialogForm = {
|
||||
ruleId: undefined,
|
||||
ruleName: undefined,
|
||||
implementTime: undefined,
|
||||
dueTime: undefined,
|
||||
ruleContent: undefined
|
||||
};
|
||||
},
|
||||
closeDialog() {
|
||||
this.$emit('update:dialogVisible', false);
|
||||
},
|
||||
// 表单提交
|
||||
dialogFormSubmit() {
|
||||
this.$refs.dialogForm.validate((valid) => {
|
||||
if (valid) {
|
||||
this.canSubmit = false;
|
||||
|
||||
if (this.dialogForm.ruleId) {
|
||||
// 校验完成,调接口
|
||||
updateRules(this.dialogForm)
|
||||
.then((resp) => {
|
||||
this.canSubmit = true;
|
||||
if (resp.code == 200) {
|
||||
this.$message.success('保存成功');
|
||||
this.$emit('refreshDataList');
|
||||
this.visible = false;
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
this.canSubmit = true;
|
||||
});
|
||||
} else {
|
||||
addRules(this.dialogForm)
|
||||
.then((resp) => {
|
||||
this.canSubmit = true;
|
||||
if (resp.code == 200) {
|
||||
this.$message.success('保存成功');
|
||||
this.$emit('refreshDataList');
|
||||
this.visible = false;
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
this.canSubmit = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
46
src/views/sch/rules/components/SearchForm.vue
Normal file
46
src/views/sch/rules/components/SearchForm.vue
Normal file
@@ -0,0 +1,46 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-form ref="searchForm" :model="searchForm" inline>
|
||||
<el-row>
|
||||
<el-form-item label="制度名" prop="ruleName">
|
||||
<el-input v-model="searchForm.ruleName" placeholder="请输入制度名" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label-width="0">
|
||||
<el-button type="primary" icon="el-icon-search" @click="$emit('search')">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import DMRadio from '@/components/DMRadio';
|
||||
export default {
|
||||
components: {
|
||||
DMRadio
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
searchForm: {},
|
||||
dateRange: []
|
||||
}
|
||||
|
||||
},
|
||||
created() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
resetQuery() {
|
||||
this.searchForm = {
|
||||
ruleName: undefined
|
||||
};
|
||||
this.dateRange = []
|
||||
this.$emit('search')
|
||||
},
|
||||
pickDateChange() {
|
||||
this.addDateRange(this.searchForm, this.dateRange)
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,42 +1,17 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="制度名" prop="ruleName">
|
||||
<el-input v-model="queryParams.ruleName" placeholder="请输入制度名" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="实施时间" prop="implementTime">
|
||||
<el-date-picker clearable v-model="queryParams.implementTime" type="date" value-format="yyyy-MM-dd" placeholder="请选择实施时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="到期时间" prop="dueTime">
|
||||
<el-date-picker clearable v-model="queryParams.dueTime" type="date" value-format="yyyy-MM-dd" placeholder="请选择到期时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- 搜索插件 -->
|
||||
<SearchForm v-show="showSearch" ref="SearchForm" @search="_getTableList" />
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['system:rules:add']">新增</el-button>
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAddAndUpdate(undefined)" v-hasPermi="['sch:rules:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate" v-hasPermi="['system:rules:edit']">修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete" v-hasPermi="['system:rules:remove']">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['system:rules:export']">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="_getTableList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="rulesList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="${comment}" align="center" prop="ruleId" />
|
||||
<el-table v-loading="loading" :data="tableList">
|
||||
<el-table-column type="index" width="55" align="center" />
|
||||
<el-table-column label="制度名" align="center" prop="ruleName" />
|
||||
<el-table-column label="实施时间" align="center" prop="implementTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
@@ -51,48 +26,30 @@
|
||||
<el-table-column label="制度内容" align="center" prop="ruleContent" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:rules:edit']">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['system:rules:remove']">删除</el-button>
|
||||
<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>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
|
||||
<pagination v-show="total>0" :total="total" :page.sync="searchForm.pageNum" :limit.sync="searchForm.pageSize" @pagination="_getTableList" />
|
||||
|
||||
<!-- 添加或修改规章制度对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="制度名" prop="ruleName">
|
||||
<el-input v-model="form.ruleName" placeholder="请输入制度名" />
|
||||
</el-form-item>
|
||||
<el-form-item label="实施时间" prop="implementTime">
|
||||
<el-date-picker clearable v-model="form.implementTime" type="date" value-format="yyyy-MM-dd" placeholder="请选择实施时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="到期时间" prop="dueTime">
|
||||
<el-date-picker clearable v-model="form.dueTime" type="date" value-format="yyyy-MM-dd" placeholder="请选择到期时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="制度内容">
|
||||
<editor v-model="form.ruleContent" :min-height="192" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否删除" prop="delFlag">
|
||||
<el-input v-model="form.delFlag" placeholder="请输入是否删除" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<RuleDialogForm v-if="dialogVisible" ref="ruleDialogForm" :dialog-visible="dialogVisible" @refreshDataList="_getTableList" />
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listRules, getRules, delRules, addRules, updateRules } from "@/api/sch/rules";
|
||||
import { listRules, getRules, delRules } from "@/api/sch/rules";
|
||||
import SearchForm from "./components/SearchForm.vue";
|
||||
import RuleDialogForm from "./components/RuleDialogForm.vue";
|
||||
|
||||
export default {
|
||||
name: "Rules",
|
||||
components: {
|
||||
SearchForm, RuleDialogForm
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
@@ -108,129 +65,47 @@ export default {
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 规章制度表格数据
|
||||
rulesList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
tableList: [],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
searchForm: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
ruleName: null,
|
||||
implementTime: null,
|
||||
dueTime: null,
|
||||
ruleContent: null,
|
||||
pageSize: 10
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
}
|
||||
dialogVisible: false
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this._getTableList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询规章制度列表 */
|
||||
getList() {
|
||||
_getTableList() {
|
||||
this.loading = true;
|
||||
listRules(this.queryParams).then(response => {
|
||||
this.rulesList = response.rows;
|
||||
const tempForm = this.$refs.SearchForm?.searchForm || {};
|
||||
const params = { ...this.searchForm, ...tempForm };
|
||||
listRules(params).then(response => {
|
||||
this.tableList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
ruleId: null,
|
||||
ruleName: null,
|
||||
implementTime: null,
|
||||
dueTime: null,
|
||||
ruleContent: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null,
|
||||
delFlag: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.ruleId)
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加规章制度";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const ruleId = row.ruleId || this.ids
|
||||
getRules(ruleId).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改规章制度";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.ruleId != null) {
|
||||
updateRules(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addRules(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
handleAddAndUpdate(info) {
|
||||
this.dialogVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.ruleDialogForm.init(info)
|
||||
})
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ruleIds = row.ruleId || this.ids;
|
||||
this.$modal.confirm('是否确认删除规章制度编号为"' + ruleIds + '"的数据项?').then(function () {
|
||||
this.$modal.confirm('是否确认删除规章制度名为"' + row.ruleName + '"的数据项?').then(function () {
|
||||
return delRules(ruleIds);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
this._getTableList();
|
||||
this.$message.success('删除成功');
|
||||
}).catch(() => { });
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('system/rules/export', {
|
||||
...this.queryParams
|
||||
}, `rules_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user