From 1d66f43353524889999bbd9ac0b331c557ff98f7 Mon Sep 17 00:00:00 2001 From: zhouwx <1175765986@qq.com> Date: 星期一, 30 六月 2025 17:29:22 +0800 Subject: [PATCH] 修改 --- src/views/build/conpanyFunctionConsult/qualityManage/rangeManage/catalogRange/index.vue | 242 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 242 insertions(+), 0 deletions(-) diff --git a/src/views/build/conpanyFunctionConsult/qualityManage/rangeManage/catalogRange/index.vue b/src/views/build/conpanyFunctionConsult/qualityManage/rangeManage/catalogRange/index.vue new file mode 100644 index 0000000..2d42ba2 --- /dev/null +++ b/src/views/build/conpanyFunctionConsult/qualityManage/rangeManage/catalogRange/index.vue @@ -0,0 +1,242 @@ +<template> + <div class="app-container"> + <div style="display: flex;justify-content: space-between"> + <el-form :inline="true" style="display: flex;align-items: center;flex-wrap: wrap;" > + <el-form-item> + <el-button + type="primary" + plain + icon="Plus" + @click="openDialog('add','',1)" + >新增</el-button> + </el-form-item> + <el-form-item v-if="isAdmin" label="企业:" > + <el-select + v-model="data.queryParams.companyName" + filterable + remote + @change="selectValue" + reserve-keyword + placeholder="请输入企业名称" + remote-show-suffix + :remote-method="getCompanyList" + :loading="loadingCompany" + style="width: 240px" + > + <el-option + v-for="item in data.companyList" + :key="item.id" + :label="item.name" + :value="item.name" + /> + </el-select> + </el-form-item> + <el-form-item > + <el-button v-if="isAdmin" type="primary" @click="getList">查询</el-button> + <el-button v-if="isAdmin" type="primary" plain @click="reset">重置</el-button> + </el-form-item> + </el-form> + </div> + <!-- 表格数据 --> + <el-table v-loading="loading" + :data="dataList" + :border="true" + row-key="id" + :default-expand-all="false" + :tree-props="{ children: 'children', hasChildren: 'hasChildren' }" + > + + <el-table-column label="目录名称" prop="label" align="center"></el-table-column> + <el-table-column label="操作" align="center" class-name="small-padding fixed-width" > + <template #default="scope"> + <el-button link type="primary" @click="openDialog('add',scope.row,2)">新增</el-button> + <el-button link type="primary" @click="openDialog('edit',scope.row,null)">编辑</el-button> + <el-button link type="danger" @click="handleDelete(scope.row)">删除</el-button> + </template> + </el-table-column> + </el-table> + <pagination + v-show="total > 0" + :total="total" + v-model:page="queryParams.pageNum" + v-model:limit="queryParams.pageSize" + @pagination="getList" + /> + <edit-dialog ref="dialogRef" @getList=getList></edit-dialog> + </div> +</template> + +<script setup> +import {getCurrentInstance, onMounted, onUnmounted, reactive, ref, toRefs} from "vue"; +import {ElMessage, ElMessageBox} from "element-plus"; +import {delCompany, getCompany} from "@/api/onlineEducation/company"; +import {delUser, getUser} from "@/api/onlineEducation/user"; +import Cookies from "js-cookie"; +import editDialog from './components/editDialog.vue' + +import { + delIndustryTemp, + getIndustryTemp, +} from "@/api/staffManage/staff"; +import useUserStore from "@/store/modules/user"; +import axios from "axios"; +import {getToken} from "@/utils/auth"; +const userStore = useUserStore() +const { proxy } = getCurrentInstance(); +const loading = ref(false); +const loadingCompany = ref(false) +const dialogRef = ref(); +const data = reactive({ + queryParams: { + pageNum: 1, + pageSize: 10, + companyId: null, + }, + total: 0, + dataList: [], + companyList: [], + industryList: [], + isAdmin: false, +}); + +const { queryParams, total, dataList,companyList,industryList, isAdmin } = toRefs(data); +const userInfo = ref() +onMounted(async ()=>{ + if(userStore.roles.includes('admin')){ + data.isAdmin = true + data.queryParams.companyId = null + await getCompanyList() + }else{ + data.isAdmin = false + data.queryParams.companyId = userStore.companyId + } + await getList() +}) + +onUnmounted(()=>{ + +}) + +const getList = async () => { + loading.value = true + // const res = await getIndustryTemp(data.queryParams) + // if(res.code == 200){ + // data.dataList = res.data.list || [] + // data.total = res.data.total + // }else{ + // ElMessage.warning(res.message) + // } + data.dataList = [ + { + parentId: 0, + id:1, + label: '1.1规范范围管理', + children: [ + { + parentId: 1, + id:2, + label: 'Level three 1-1-1', + children: [ + { + parentId: 2, + id:3, + label: 'Level three 1-1-1', + children: [ + { + parentId: 3, + id:4, + label: 'Level three 1-1-1', + }, + ], + }, + ], + }, + ], + }, + { + parentId: 0, + id:5, + label: '1.2收集需求', + }, + { + parentId: 0, + id:6, + label: '1.3定义范围', + }, + ] + loading.value = false +} + +const openDialog = (type, value,flag) => { + + dialogRef.value.openDialog(type, value, data.queryParams.companyId, data.isAdmin,flag); +} + +/** 重置新增的表单以及其他数据 */ +const reset= async()=> { + data.queryParams = { + pageNum: 1, + pageSize: 10, + companyId: null, + } + await getCompanyList() + await getList() +} +const handleDelete = (val) => { + ElMessageBox.confirm( + '确定删除此条数据?', + '提示', + { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + }) + .then( async() => { + const res = await delIndustryTemp({companyRosterId: val.id}) + if(res.code == 200){ + ElMessage.success('数据删除成功') + await getList() + }else{ + ElMessage.warning(res.message) + } + }) +} +const selectValue = (val) => { + data.companyList.forEach(item => { + if(item.name === val){ + data.queryParams.companyId = item.id + } + }) +} +const getCompanyList = async (val)=>{ + if(val){ + loadingCompany.value = true; + const queryParams = { + name: val + } + const res = await getCompany(queryParams) + if (res.code == 200) { + loadingCompany.value = false; + data.companyList = res.data.list + + } else { + ElMessage.warning(res.message) + } + }else { + loadingCompany.value = true; + const queryParams = { + pageSize: 10, + pageNum: 1, + } + const res = await getCompany(queryParams) + if (res.code == 200) { + loadingCompany.value = false; + data.companyList = res.data.list + + } else { + ElMessage.warning(res.message) + } + } +} + +</script> -- Gitblit v1.9.2