|
@@ -1,14 +1,14 @@
|
|
|
<template>
|
|
|
<div class="ya_bar">
|
|
|
- <h3>单位职责</h3>
|
|
|
- <el-button type="primary" @click="importDoc()"> 导入职责 </el-button>
|
|
|
- </div>
|
|
|
+ <h3>单位职责</h3>
|
|
|
+ <el-button type="primary" @click="importDoc()"> 导入职责 </el-button>
|
|
|
+ </div>
|
|
|
|
|
|
<el-card shadow="hover">
|
|
|
<template #header>
|
|
|
<el-row :gutter="10">
|
|
|
<el-col :span="1.5">
|
|
|
- <el-button type="primary" plain icon="Plus" @click="handleAdd()">新增</el-button>
|
|
|
+ <el-button type="primary" icon="Plus" @click="handleAdd()">新增</el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
|
<el-button type="danger" plain :disabled="multiple" icon="Delete" @click="handleDelete(null)"> 删除 </el-button>
|
|
@@ -27,8 +27,8 @@
|
|
|
<el-table-column label="职能说明" align="left" prop="content" :show-overflow-tooltip="true" />
|
|
|
<el-table-column label="操作" width="150" align="center">
|
|
|
<template #default="scope">
|
|
|
- <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)">编辑</el-button>
|
|
|
- <el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
|
|
|
+ <el-text v-hasPermi="['system:menu:Edit']" class="common-btn-text-primary" @click="handleUpdate(scope.row)">编辑</el-text>
|
|
|
+ <el-text v-hasPermi="['system:menu:Delete']" class="common-btn-text-danger" @click="handleDelete(scope.row)">删除</el-text>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -43,15 +43,15 @@
|
|
|
<!-- 添加或修改培训记录配置对话框 -->
|
|
|
<el-dialog ref="formDialogRef" v-model="visible" :title="title" width="500px" append-to-body>
|
|
|
<el-form ref="formRef" :model="form" :rules="rules" label-width="80px">
|
|
|
- <el-form-item label="单位名称" prop="dept_id">
|
|
|
+ <el-form-item label="单位名称:" prop="dept_id">
|
|
|
<el-select v-model="form.dept_id" placeholder="请选择单位">
|
|
|
<el-option v-for="item in depts" :key="item.deptId" :label="item.deptName" :value="item.deptId"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="职能说明" prop="content">
|
|
|
+ <el-form-item label="职能说明:" prop="content">
|
|
|
<el-input v-model="form.content" type="textarea" placeholder="请输入职能说明" :rows="5"></el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="排序" prop="dept_order">
|
|
|
+ <el-form-item label="排序:" prop="dept_order">
|
|
|
<el-input v-model="form.dept_order" placeholder="请输入排序" />
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
@@ -63,33 +63,26 @@
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
|
|
|
- <el-dialog ref="importFormDialogRef" v-model="showImportDlg" title="导入单位职责" width="500px" append-to-body>
|
|
|
- <el-form ref="importFormRef" :model="importForm" :rules="importRules">
|
|
|
- <FileUpload v-model="importForm.filename" :file-type="['xls', 'xlsx']" :limit="1" />
|
|
|
- </el-form>
|
|
|
- <template #footer>
|
|
|
- <div class="dialog-footer">
|
|
|
- <el-button type="primary" @click="submitImportForm">确 定</el-button>
|
|
|
- <el-button @click="cancelImport">取 消</el-button>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
+ <el-dialog ref="importFormDialogRef" v-model="showImportDlg" title="导入单位职责" width="500px" append-to-body>
|
|
|
+ <el-form ref="importFormRef" :model="importForm" :rules="importRules">
|
|
|
+ <FileUpload v-model="importForm.filename" :file-type="['xls', 'xlsx']" :limit="1" />
|
|
|
+ </el-form>
|
|
|
+ <template #footer>
|
|
|
+ <div class="dialog-footer">
|
|
|
+ <el-button type="primary" @click="submitImportForm">确 定</el-button>
|
|
|
+ <el-button @click="cancelImport">取 消</el-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
</el-dialog>
|
|
|
-
|
|
|
</template>
|
|
|
<script setup lang="ts">
|
|
|
-import {listDept} from '@/api/system/dept';
|
|
|
-import {
|
|
|
- getUnitList,
|
|
|
- addUnit,
|
|
|
- updateUnit,
|
|
|
- getUnitDetail,
|
|
|
- deleteUnit,
|
|
|
- importUnitXls
|
|
|
-} from '@/api/riskPrevention/planManage';
|
|
|
+import { listDept } from '@/api/system/dept';
|
|
|
+import { getUnitList, addUnit, updateUnit, getUnitDetail, deleteUnit, importUnitXls } from '@/api/riskPrevention/planManage';
|
|
|
import { to } from 'await-to-js';
|
|
|
import { ref } from 'vue';
|
|
|
|
|
|
const props = defineProps({
|
|
|
+ // eslint-disable-next-line vue/require-default-prop
|
|
|
id: String
|
|
|
});
|
|
|
|
|
@@ -126,7 +119,7 @@ const rules = reactive({
|
|
|
});
|
|
|
|
|
|
// 获取列表数据
|
|
|
-const getList = async() => {
|
|
|
+const getList = async () => {
|
|
|
loading.value = true;
|
|
|
const res = await listDept();
|
|
|
depts.value = res.data;
|
|
@@ -214,7 +207,7 @@ const handleDelete = async (row) => {
|
|
|
const deleteIds = row && row.id ? [row?.id] : ids.value;
|
|
|
const [err] = await to(proxy?.$modal.confirm('是否确认删除选择的单位职能记录?') as any);
|
|
|
if (!err) {
|
|
|
- await deleteUnit({ids: deleteIds});
|
|
|
+ await deleteUnit({ ids: deleteIds });
|
|
|
getList();
|
|
|
proxy?.$modal.msgSuccess('删除成功');
|
|
|
}
|
|
@@ -226,41 +219,40 @@ const formDialogRef = ref(null);
|
|
|
const importFormRef = ref<ElFormInstance>();
|
|
|
|
|
|
const importForm = ref({
|
|
|
- filename: ''
|
|
|
+ filename: ''
|
|
|
});
|
|
|
|
|
|
const importRules = reactive({
|
|
|
- filename: [{ required: true, message: '导入文件不能为空', trigger: 'blur' }]
|
|
|
+ filename: [{ required: true, message: '导入文件不能为空', trigger: 'blur' }]
|
|
|
});
|
|
|
|
|
|
const importDoc = () => {
|
|
|
- resetImportForm();
|
|
|
- showImportDlg.value = true;
|
|
|
-}
|
|
|
+ resetImportForm();
|
|
|
+ showImportDlg.value = true;
|
|
|
+};
|
|
|
|
|
|
const resetImportForm = () => {
|
|
|
importForm.value = {
|
|
|
- filename:''
|
|
|
- }
|
|
|
+ filename: ''
|
|
|
+ };
|
|
|
importFormRef.value?.resetFields();
|
|
|
importFormRef.value?.clearValidate();
|
|
|
-}
|
|
|
+};
|
|
|
|
|
|
/**提交按钮 */
|
|
|
const submitImportForm = () => {
|
|
|
importFormRef.value?.validate(async (valid) => {
|
|
|
if (valid) {
|
|
|
try {
|
|
|
- await importUnitXls({ ...importForm.value, plan_id: props.id })
|
|
|
- proxy?.$modal.msgSuccess('导入成功');
|
|
|
- showImportDlg.value = false;
|
|
|
- getList();
|
|
|
+ await importUnitXls({ ...importForm.value, plan_id: props.id });
|
|
|
+ proxy?.$modal.msgSuccess('导入成功');
|
|
|
+ showImportDlg.value = false;
|
|
|
+ getList();
|
|
|
} finally {
|
|
|
}
|
|
|
}
|
|
|
- })
|
|
|
-}
|
|
|
-
|
|
|
+ });
|
|
|
+};
|
|
|
|
|
|
/** 取消按钮 */
|
|
|
const cancelImport = () => {
|
|
@@ -271,10 +263,10 @@ const cancelImport = () => {
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
.ya_bar {
|
|
|
- display:flex;
|
|
|
- flex-direction: row;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: row;
|
|
|
flex-wrap: nowrap;
|
|
|
- justify-content:space-between;
|
|
|
+ justify-content: space-between;
|
|
|
align-items: center;
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|