|
@@ -1,127 +1,143 @@
|
|
|
<template>
|
|
|
- <div class="app-container">
|
|
|
- <transition name="fade">
|
|
|
- <div v-show="showSearch" class="mb-[10px]">
|
|
|
- <el-form ref="queryFormRef" :model="queryForm" :inline="true">
|
|
|
- <el-form-item label="单位名称" prop="unitId">
|
|
|
- <el-select v-model="queryForm.unitId" placeholder="全部" clearable>
|
|
|
- <el-option v-for="item in unitList" :key="item.deptId" :label="item.deptName" :value="item.deptId"></el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="联系人" prop="contactName">
|
|
|
- <el-input v-model="queryForm.contactName" placeholder="请输入联系人" clearable @keyup.enter="handleQuery" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item>
|
|
|
- <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item>
|
|
|
- <el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
- </div>
|
|
|
- </transition>
|
|
|
-
|
|
|
- <el-row :gutter="10" class="mb8">
|
|
|
- <el-col :span="1.5">
|
|
|
- <el-button type="primary" plain icon="Plus" @click="handleAdd">新增</el-button>
|
|
|
+ <div class="app-container">
|
|
|
+ <transition name="fade">
|
|
|
+ <div v-show="showSearch">
|
|
|
+ <el-form ref="queryFormRef" :model="queryForm">
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <!-- 第一行 -->
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="单位名称:" prop="unitId">
|
|
|
+ <el-select v-model="queryForm.unitId" placeholder="全部" clearable>
|
|
|
+ <el-option v-for="item in unitList" :key="item.deptId" :label="item.deptName" :value="item.deptId"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="1.5">
|
|
|
- <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete(selectedRow)">删除</el-button>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="联系人:" prop="contactName">
|
|
|
+ <el-input v-model="queryForm.contactName" placeholder="请输入联系人" clearable @keyup.enter="handleQuery" />
|
|
|
+ </el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="1.5">
|
|
|
- <el-button type="default" plain icon="Delete" @click="handleImport">导入</el-button>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" @click="handleQuery">搜索</el-button>
|
|
|
+ <el-button @click="resetQuery">重置</el-button>
|
|
|
+ </el-form-item>
|
|
|
</el-col>
|
|
|
- <right-toolbar v-model:showSearch="showSearch" @query-table="getList"></right-toolbar>
|
|
|
- </el-row>
|
|
|
-
|
|
|
- <!-- 表格组件 -->
|
|
|
- <el-table v-loading="loading" :data="resultList" @selection-change="handleSelectionChange">
|
|
|
- <el-table-column type="selection" width="55" align="center" />
|
|
|
- <el-table-column label="单位名称" prop="unitName" />
|
|
|
- <el-table-column label="联系人" prop="contactName" />
|
|
|
- <el-table-column label="职务" prop="position" />
|
|
|
- <el-table-column label="粤政易手机号码" prop="phone" />
|
|
|
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
- <template #default="scope">
|
|
|
- <el-tooltip content="修改" placement="top">
|
|
|
- <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"></el-button>
|
|
|
- </el-tooltip>
|
|
|
- <el-tooltip content="删除" placement="top">
|
|
|
- <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"></el-button>
|
|
|
- </el-tooltip>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
-
|
|
|
- <pagination v-show="total > 0" v-model:page="queryForm.page" v-model:limit="queryForm.pageSize" :total="total" @pagination="getList" />
|
|
|
- </div>
|
|
|
-
|
|
|
- <!-- 新增/修改弹窗 -->
|
|
|
- <el-dialog v-model="addDialog.visible" :title="addDialog.title" width="500px" append-to-body>
|
|
|
- <el-form ref="addFormRef" :model="addForm" :rules="rules" label-width="120px">
|
|
|
- <el-form-item label="单位名称" prop="unitId">
|
|
|
- <el-select v-model="addForm.unitId" placeholder="请选择单位" clearable>
|
|
|
- <el-option v-for="item in unitList" :key="item.deptId" :label="item.deptName" :value="item.deptId"></el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="联系人" prop="contactName">
|
|
|
- <el-input v-model="addForm.contactName" placeholder="请输入联系人" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="职务" prop="position">
|
|
|
- <el-input v-model="addForm.position" placeholder="请输入职务" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="粤政易手机号码" prop="phone">
|
|
|
- <el-input v-model="addForm.phone" placeholder="请输入粤政易手机号码" />
|
|
|
- </el-form-item>
|
|
|
+ </el-row>
|
|
|
</el-form>
|
|
|
- <template #footer>
|
|
|
- <div class="dialog-footer">
|
|
|
- <el-button :loading="buttonLoading" type="primary" @click="submitForm">确定</el-button>
|
|
|
- <el-button @click="cancel">取消</el-button>
|
|
|
- </div>
|
|
|
+ </div>
|
|
|
+ </transition>
|
|
|
+
|
|
|
+ <el-row :gutter="10" class="mb8">
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button type="primary" icon="Plus" @click="handleAdd">新增</el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete(selectedRow)">删除</el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button type="warning" plain icon="Download" @click="handleImport">导入</el-button>
|
|
|
+ </el-col>
|
|
|
+ <!-- <right-toolbar v-model:showSearch="showSearch" @query-table="getList"></right-toolbar>-->
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <!-- 表格组件 -->
|
|
|
+ <el-table v-loading="loading" :data="resultList" @selection-change="handleSelectionChange">
|
|
|
+ <el-table-column type="selection" width="55" align="center" />
|
|
|
+ <el-table-column label="单位名称" prop="unitName" />
|
|
|
+ <el-table-column label="联系人" prop="contactName" />
|
|
|
+ <el-table-column label="职务" prop="position" />
|
|
|
+ <el-table-column label="粤政易手机号码" prop="phone" />
|
|
|
+ <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-text v-hasPermi="['system:menu:edit']" class="common-btn-text-primary" @click="handleUpdate(scope.row)">修改</el-text>
|
|
|
+ <el-text v-hasPermi="['system:menu:remove']" class="common-btn-text-danger" @click="handleDelete(scope.row)">删除</el-text>
|
|
|
</template>
|
|
|
- </el-dialog>
|
|
|
-
|
|
|
- <el-dialog 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-table-column>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <pagination v-show="total > 0" v-model:page="queryForm.page" v-model:limit="queryForm.pageSize" :total="total" @pagination="getList" />
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 新增/修改弹窗 -->
|
|
|
+ <div v-show="addDialog.visible" class="common-dialog">
|
|
|
+ <div class="common-dialog-content">
|
|
|
+ <div class="common-dialog-title-box">
|
|
|
+ <i class="common-dialog-title-icon" />
|
|
|
+ <div>{{ addDialog.title }}</div>
|
|
|
+ </div>
|
|
|
+ <div class="common-dialog-box">
|
|
|
+ <el-form ref="addFormRef" :model="addForm" :rules="rules" label-width="120px">
|
|
|
+ <el-form-item label="单位名称:" prop="unitId">
|
|
|
+ <el-select v-model="addForm.unitId" placeholder="请选择单位" clearable style="width: 468px !important">
|
|
|
+ <el-option v-for="item in unitList" :key="item.deptId" :label="item.deptName" :value="item.deptId"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="联系人:" prop="contactName">
|
|
|
+ <el-input v-model="addForm.contactName" placeholder="请输入联系人" style="width: 468px !important" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="职务:" prop="position">
|
|
|
+ <el-input v-model="addForm.position" placeholder="请输入职务" style="width: 468px !important" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="粤政易手机号码:" prop="phone">
|
|
|
+ <el-input v-model="addForm.phone" placeholder="请输入粤政易手机号码" style="width: 468px !important" />
|
|
|
+ </el-form-item>
|
|
|
</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>
|
|
|
+ </div>
|
|
|
+ <div class="common-dialog-footer" style="display: flex; justify-content: center">
|
|
|
+ <el-button type="primary" @click="submitForm">确 定</el-button>
|
|
|
+ <el-button @click="cancel">取 消</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <el-dialog 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 { ref, reactive, onMounted } from 'vue';
|
|
|
import { listDept } from '@/api/system/dept';
|
|
|
-import { getPlanContactList, getPlanContactInfo, updatePlanContact, deletePlanContact, addPlanContact, importPlanContact } from '@/api/riskPrevention/planManage';
|
|
|
+import {
|
|
|
+ getPlanContactList,
|
|
|
+ getPlanContactInfo,
|
|
|
+ updatePlanContact,
|
|
|
+ deletePlanContact,
|
|
|
+ addPlanContact,
|
|
|
+ importPlanContact
|
|
|
+} from '@/api/riskPrevention/planManage';
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
import { to } from 'await-to-js';
|
|
|
|
|
|
interface QueryForm {
|
|
|
- page: number;
|
|
|
- pageSize: number;
|
|
|
- unitId?: string;
|
|
|
- contactName?: string;
|
|
|
+ page: number;
|
|
|
+ pageSize: number;
|
|
|
+ unitId?: string;
|
|
|
+ contactName?: string;
|
|
|
}
|
|
|
|
|
|
interface resultVO {
|
|
|
- id: string;
|
|
|
- unitName: string;
|
|
|
- contactName: string;
|
|
|
- position: string;
|
|
|
- phone: string;
|
|
|
+ id: string;
|
|
|
+ unitName: string;
|
|
|
+ contactName: string;
|
|
|
+ position: string;
|
|
|
+ phone: string;
|
|
|
}
|
|
|
|
|
|
const queryForm = reactive<QueryForm>({
|
|
|
- page: 1,
|
|
|
- pageSize: 10,
|
|
|
- unitId: '',
|
|
|
- contactName: ''
|
|
|
+ page: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ unitId: '',
|
|
|
+ contactName: ''
|
|
|
});
|
|
|
|
|
|
const resultList = ref<resultVO[]>([]);
|
|
@@ -135,35 +151,34 @@ const selectedRow = ref<resultVO | null>(null);
|
|
|
const unitList = ref([]);
|
|
|
|
|
|
const addDialog = reactive({
|
|
|
- visible: false,
|
|
|
- title: ''
|
|
|
+ visible: false,
|
|
|
+ title: ''
|
|
|
});
|
|
|
|
|
|
const getList = async () => {
|
|
|
- loading.value = true;
|
|
|
- const res = await getPlanContactList(queryForm);
|
|
|
- loading.value = false;
|
|
|
- resultList.value = res.data;
|
|
|
- total.value = res.total;
|
|
|
+ loading.value = true;
|
|
|
+ const res = await getPlanContactList(queryForm);
|
|
|
+ loading.value = false;
|
|
|
+ resultList.value = res.data;
|
|
|
+ total.value = res.total;
|
|
|
};
|
|
|
|
|
|
-
|
|
|
-onMounted(async()=>{
|
|
|
- const res = await listDept();
|
|
|
- unitList.value = res.data;
|
|
|
- getList();
|
|
|
-})
|
|
|
+onMounted(async () => {
|
|
|
+ const res = await listDept();
|
|
|
+ unitList.value = res.data;
|
|
|
+ getList();
|
|
|
+});
|
|
|
|
|
|
const handleQuery = () => {
|
|
|
- queryForm.page = 1;
|
|
|
- getList();
|
|
|
+ queryForm.page = 1;
|
|
|
+ getList();
|
|
|
};
|
|
|
|
|
|
const resetQuery = () => {
|
|
|
- queryForm.page = 1;
|
|
|
- queryForm.unitId = '';
|
|
|
- queryForm.contactName = '';
|
|
|
- handleQuery();
|
|
|
+ queryForm.page = 1;
|
|
|
+ queryForm.unitId = '';
|
|
|
+ queryForm.contactName = '';
|
|
|
+ handleQuery();
|
|
|
};
|
|
|
|
|
|
const handleSelectionChange = (selection: resultVO[]) => {
|
|
@@ -179,8 +194,7 @@ const handleAdd = () => {
|
|
|
addDialog.title = '添加人员';
|
|
|
};
|
|
|
|
|
|
-
|
|
|
-const handleUpdate = async(row: resultVO) => {
|
|
|
+const handleUpdate = async (row: resultVO) => {
|
|
|
if (row) {
|
|
|
resetForm();
|
|
|
const res = await getPlanContactInfo(row.id);
|
|
@@ -200,9 +214,9 @@ const handleDelete = async (row) => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-const handleImport = async() => {
|
|
|
- resetImportForm();
|
|
|
- showImportDlg.value = true;
|
|
|
+const handleImport = async () => {
|
|
|
+ resetImportForm();
|
|
|
+ showImportDlg.value = true;
|
|
|
};
|
|
|
|
|
|
//////////////////
|
|
@@ -211,50 +225,50 @@ const addFormRef = ref(null);
|
|
|
const buttonLoading = ref(false);
|
|
|
|
|
|
let addForm = ref({
|
|
|
- id: '',
|
|
|
- unitId: '',
|
|
|
- contactName: '',
|
|
|
- phone: '',
|
|
|
- position: ''
|
|
|
+ id: '',
|
|
|
+ unitId: '',
|
|
|
+ contactName: '',
|
|
|
+ phone: '',
|
|
|
+ position: ''
|
|
|
});
|
|
|
|
|
|
const rules = reactive({
|
|
|
- unitId: [{ required: true, message: '单位名称', trigger: 'blur' }],
|
|
|
- contactName: [{ required: true, message: '联系人', trigger: 'blur' }],
|
|
|
- position: [{ required: true, message: '职务', trigger: 'blur' }],
|
|
|
- phone: [{ required: true, message: '粤政易手机号码', trigger: 'blur' }]
|
|
|
+ unitId: [{ required: true, message: '单位名称', trigger: 'blur' }],
|
|
|
+ contactName: [{ required: true, message: '联系人', trigger: 'blur' }],
|
|
|
+ position: [{ required: true, message: '职务', trigger: 'blur' }],
|
|
|
+ phone: [{ required: true, message: '粤政易手机号码', trigger: 'blur' }]
|
|
|
});
|
|
|
|
|
|
const resetForm = () => {
|
|
|
- addForm.value = {
|
|
|
- id: '',
|
|
|
- unitId: '',
|
|
|
- contactName: '',
|
|
|
- phone: '',
|
|
|
- position: ''
|
|
|
- };
|
|
|
- addFormRef.value?.resetFields();
|
|
|
+ addForm.value = {
|
|
|
+ id: '',
|
|
|
+ unitId: '',
|
|
|
+ contactName: '',
|
|
|
+ phone: '',
|
|
|
+ position: ''
|
|
|
+ };
|
|
|
+ addFormRef.value?.resetFields();
|
|
|
};
|
|
|
|
|
|
const submitForm = () => {
|
|
|
- addFormRef.value?.validate(async (valid) => {
|
|
|
- if (valid) {
|
|
|
- try {
|
|
|
- buttonLoading.value = true;
|
|
|
- addForm.value.id ? await updatePlanContact(addForm.value) : await addPlanContact(addForm.value);
|
|
|
- proxy?.$modal.msgSuccess(addForm.value.id ? '修改成功' : '新增成功');
|
|
|
- addDialog.visible = false;
|
|
|
- getList();
|
|
|
- } finally {
|
|
|
- buttonLoading.value = false;
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
+ addFormRef.value?.validate(async (valid) => {
|
|
|
+ if (valid) {
|
|
|
+ try {
|
|
|
+ buttonLoading.value = true;
|
|
|
+ addForm.value.id ? await updatePlanContact(addForm.value) : await addPlanContact(addForm.value);
|
|
|
+ proxy?.$modal.msgSuccess(addForm.value.id ? '修改成功' : '新增成功');
|
|
|
+ addDialog.visible = false;
|
|
|
+ getList();
|
|
|
+ } finally {
|
|
|
+ buttonLoading.value = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
};
|
|
|
|
|
|
const cancel = () => {
|
|
|
- resetForm();
|
|
|
- addDialog.visible = false;
|
|
|
+ resetForm();
|
|
|
+ addDialog.visible = false;
|
|
|
};
|
|
|
|
|
|
//////////////////
|
|
@@ -263,43 +277,43 @@ const showImportDlg = ref(false);
|
|
|
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 resetImportForm = () => {
|
|
|
importForm.value = {
|
|
|
- filename:''
|
|
|
- }
|
|
|
+ filename: ''
|
|
|
+ };
|
|
|
importFormRef.value?.resetFields();
|
|
|
importFormRef.value?.clearValidate();
|
|
|
-}
|
|
|
+};
|
|
|
|
|
|
/**提交按钮 */
|
|
|
const submitImportForm = () => {
|
|
|
importFormRef.value?.validate(async (valid) => {
|
|
|
if (valid) {
|
|
|
- importPlanContact({ ...importForm.value })
|
|
|
+ importPlanContact({ ...importForm.value })
|
|
|
.then((res) => {
|
|
|
- if (res.code === 200) {
|
|
|
- proxy?.$modal.msgSuccess('导入成功');
|
|
|
- showImportDlg.value = false;
|
|
|
- getList();
|
|
|
- }
|
|
|
- }).catch((err)=>{
|
|
|
- proxy?.$modal.msgError(err);
|
|
|
+ if (res.code === 200) {
|
|
|
+ proxy?.$modal.msgSuccess('导入成功');
|
|
|
+ showImportDlg.value = false;
|
|
|
+ getList();
|
|
|
+ }
|
|
|
})
|
|
|
+ .catch((err) => {
|
|
|
+ proxy?.$modal.msgError(err);
|
|
|
+ });
|
|
|
}
|
|
|
- })
|
|
|
-}
|
|
|
+ });
|
|
|
+};
|
|
|
|
|
|
/** 取消按钮 */
|
|
|
const cancelImport = () => {
|
|
|
resetImportForm();
|
|
|
showImportDlg.value = false;
|
|
|
};
|
|
|
-
|
|
|
-</script>
|
|
|
+</script>
|