2024-01-06 17:44:23 +08:00
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<layout-card>
|
|
|
|
<el-row :gutter="12">
|
|
|
|
<el-col :span="5">
|
|
|
|
<layout-department-tree
|
|
|
|
:department-id="DEPARTMENT_ID"
|
|
|
|
@node-click="
|
|
|
|
router.push({
|
|
|
|
path: '/enterprise_management/post',
|
|
|
|
query: {
|
|
|
|
DEPARTMENT_ID: $event.id,
|
|
|
|
DEPARTMENT_NAME: $event.name,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
"
|
|
|
|
/>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="19">
|
|
|
|
<layout-table
|
|
|
|
v-model:pagination="pagination"
|
2024-02-21 09:42:49 +08:00
|
|
|
:data="list"
|
2024-01-06 17:44:23 +08:00
|
|
|
@get-data="fnGetDataTransfer"
|
|
|
|
>
|
|
|
|
<el-table-column label="序号" width="70">
|
2024-02-21 09:42:49 +08:00
|
|
|
<template #default="{ $index }">
|
2024-01-06 17:44:23 +08:00
|
|
|
{{ serialNumber(pagination, $index) }}
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
<el-table-column post prop="DEPARTMENT_NAME" label="机构" />
|
|
|
|
<el-table-column post prop="NAME" label="岗位" />
|
|
|
|
<el-table-column label="状态" width="100">
|
2024-02-21 09:42:49 +08:00
|
|
|
<template #default="{ row }">
|
2024-01-06 17:44:23 +08:00
|
|
|
<span v-if="row.STATUS === '0'">启用</span>
|
|
|
|
<span v-if="row.STATUS === '1'">禁用</span>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
<el-table-column label="照片">
|
2024-02-21 09:42:49 +08:00
|
|
|
<template #default="{ row }">
|
2024-01-09 16:20:28 +08:00
|
|
|
<layout-tooltip-img :imgs="row.imgs" />
|
2024-01-06 17:44:23 +08:00
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
<el-table-column label="操作" width="100">
|
2024-02-21 09:42:49 +08:00
|
|
|
<template #default="{ row }">
|
2024-01-06 17:44:23 +08:00
|
|
|
<el-button
|
2024-02-21 09:42:49 +08:00
|
|
|
v-if="buttonJurisdiction.edit"
|
2024-01-06 17:44:23 +08:00
|
|
|
type="primary"
|
|
|
|
text
|
|
|
|
link
|
|
|
|
@click="fnAddOrEdit(row.POST_ID, 'edit')"
|
|
|
|
>
|
|
|
|
编辑
|
|
|
|
</el-button>
|
|
|
|
<el-button
|
2024-02-21 09:42:49 +08:00
|
|
|
v-if="buttonJurisdiction.del"
|
2024-01-06 17:44:23 +08:00
|
|
|
type="primary"
|
|
|
|
text
|
|
|
|
link
|
|
|
|
@click="fnDelete(row.POST_ID, row.NAME)"
|
|
|
|
>
|
|
|
|
删除
|
|
|
|
</el-button>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
<template #button>
|
|
|
|
<el-button
|
|
|
|
v-if="buttonJurisdiction.add"
|
2024-02-21 09:42:49 +08:00
|
|
|
type="primary"
|
2024-01-06 17:44:23 +08:00
|
|
|
@click="fnAddOrEdit('', 'add')"
|
|
|
|
>
|
|
|
|
新增
|
|
|
|
</el-button>
|
|
|
|
</template>
|
|
|
|
</layout-table>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
</layout-card>
|
|
|
|
<add
|
|
|
|
v-model:visible="data.addOrEditDialog.visible"
|
|
|
|
v-model:form="data.addOrEditDialog.form"
|
|
|
|
:type="data.addOrEditDialog.type"
|
|
|
|
:department-name="DEPARTMENT_NAME"
|
|
|
|
:department-id="DEPARTMENT_ID"
|
|
|
|
@get-data="fnResetPaginationTransfer"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
import { addingPrefixToFile, serialNumber } from "@/assets/js/utils.js";
|
|
|
|
import useListData from "@/assets/js/useListData.js";
|
|
|
|
import {
|
|
|
|
getPostView,
|
|
|
|
getPostList,
|
|
|
|
setPostDelete,
|
|
|
|
} from "@/request/enterprise_management.js";
|
|
|
|
import { nextTick, reactive, ref } from "vue";
|
|
|
|
import LayoutDepartmentTree from "@/components/department_tree/index.vue";
|
|
|
|
import useButtonJurisdiction from "@/assets/js/useButtonJurisdiction.js";
|
|
|
|
import { useUserStore } from "@/pinia/user.js";
|
|
|
|
import { onBeforeRouteUpdate, useRoute, useRouter } from "vue-router";
|
|
|
|
import { debounce } from "throttle-debounce";
|
|
|
|
import { ElMessage, ElMessageBox } from "element-plus";
|
|
|
|
import Add from "./components/add.vue";
|
2024-01-09 16:20:28 +08:00
|
|
|
import LayoutTooltipImg from "@/components/tooltip_img/index.vue";
|
2024-01-06 17:44:23 +08:00
|
|
|
|
|
|
|
const userStore = useUserStore();
|
|
|
|
const router = useRouter();
|
|
|
|
const route = useRoute();
|
|
|
|
const departmentIdDefault = userStore.getUserInfo.DEPARTMENT_ID;
|
|
|
|
const departmentNameDefault = userStore.getUserInfo.DEPARTMENT_NAME;
|
|
|
|
const DEPARTMENT_ID = ref(route.query.DEPARTMENT_ID || departmentIdDefault);
|
|
|
|
const DEPARTMENT_NAME = ref(
|
|
|
|
route.query.DEPARTMENT_NAME || departmentNameDefault
|
|
|
|
);
|
|
|
|
const { list, pagination, fnGetData, fnResetPagination } = useListData(
|
|
|
|
getPostList,
|
|
|
|
{
|
2024-01-24 18:08:04 +08:00
|
|
|
otherParams: { DEPARTMENT_ID: DEPARTMENT_ID.value },
|
2024-01-06 17:44:23 +08:00
|
|
|
}
|
|
|
|
);
|
|
|
|
const data = reactive({
|
|
|
|
addOrEditDialog: {
|
|
|
|
visible: false,
|
|
|
|
type: "",
|
|
|
|
form: {
|
|
|
|
NAME: "",
|
|
|
|
DESCR: "",
|
|
|
|
STATUS: "0",
|
|
|
|
files: [],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
const buttonJurisdiction = await useButtonJurisdiction("post");
|
|
|
|
const fnGetDataTransfer = () => {
|
|
|
|
fnGetData({
|
|
|
|
DEPARTMENT_ID: DEPARTMENT_ID.value,
|
|
|
|
});
|
|
|
|
};
|
|
|
|
const fnResetPaginationTransfer = () => {
|
|
|
|
fnResetPagination({
|
|
|
|
DEPARTMENT_ID: DEPARTMENT_ID.value,
|
|
|
|
});
|
|
|
|
};
|
|
|
|
onBeforeRouteUpdate((to) => {
|
|
|
|
DEPARTMENT_ID.value = to.query.DEPARTMENT_ID || departmentIdDefault;
|
|
|
|
DEPARTMENT_NAME.value = to.query.DEPARTMENT_NAME || departmentNameDefault;
|
|
|
|
fnResetPaginationTransfer();
|
|
|
|
});
|
|
|
|
const fnAddOrEdit = async (POST_ID, type) => {
|
|
|
|
data.addOrEditDialog.visible = true;
|
|
|
|
await nextTick();
|
|
|
|
data.addOrEditDialog.type = type;
|
|
|
|
if (type === "edit") {
|
|
|
|
const resData = await getPostView({
|
|
|
|
POST_ID,
|
|
|
|
});
|
|
|
|
data.addOrEditDialog.form = resData.pd;
|
|
|
|
data.addOrEditDialog.form.files = addingPrefixToFile(resData.imgs);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
const fnDelete = debounce(
|
|
|
|
1000,
|
|
|
|
async (POST_ID, NAME) => {
|
|
|
|
await ElMessageBox.confirm(`确定要删除【${NAME}】吗?`, {
|
|
|
|
type: "warning",
|
|
|
|
});
|
|
|
|
await setPostDelete({ POST_ID });
|
|
|
|
ElMessage.success("删除成功");
|
|
|
|
fnResetPaginationTransfer();
|
|
|
|
},
|
|
|
|
{ atBegin: true }
|
|
|
|
);
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="scss"></style>
|