作者 xiaoqiu

解决协会提出的bug

@@ -8,4 +8,4 @@ VITE_APP_ENV = 'development' @@ -8,4 +8,4 @@ VITE_APP_ENV = 'development'
8 VITE_APP_BASE_API = '/dev-api' 8 VITE_APP_BASE_API = '/dev-api'
9 9
10 # 开打新的tab的url前缀 10 # 开打新的tab的url前缀
11 -VITE_APP_TAB_URL_PREFIX = 'https://bxcxhd.gxbx.com.cn' 11 +VITE_APP_TAB_URL_PREFIX = 'http://192.168.2.152:6512'
  1 +<template>
  2 + <el-row :gutter="40" class="panel-group">
  3 + <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
  4 + <div class="card-panel" @click="handleSetLineChartData('newVisitis')">
  5 + <div class="card-panel-icon-wrapper icon-people">
  6 + <svg-icon icon-class="notaccepted" class-name="card-panel-icon" />
  7 + </div>
  8 + <div class="card-panel-description">
  9 + <div class="card-panel-text">待处理(个人车险)</div>
  10 + <count-to
  11 + :start-val="0"
  12 + :end-val="totalList[0]"
  13 + :duration="2600"
  14 + class="card-panel-num"
  15 + />
  16 + </div>
  17 + </div>
  18 + </el-col>
  19 + <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
  20 + <div class="card-panel" @click="handleSetLineChartData('messages')">
  21 + <div class="card-panel-icon-wrapper icon-message">
  22 + <svg-icon icon-class="undertaken" class-name="card-panel-icon" />
  23 + </div>
  24 + <div class="card-panel-description">
  25 + <div class="card-panel-text">已处理(个人车险)</div>
  26 + <count-to
  27 + :start-val="0"
  28 + :end-val="totalList[1]"
  29 + :duration="3000"
  30 + class="card-panel-num"
  31 + />
  32 + </div>
  33 + </div>
  34 + </el-col>
  35 + <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
  36 + <div class="card-panel" @click="handleSetLineChartData('purchases')">
  37 + <div class="card-panel-icon-wrapper icon-money">
  38 + <svg-icon icon-class="incomplete" class-name="card-panel-icon" />
  39 + </div>
  40 + <div class="card-panel-description">
  41 + <div class="card-panel-text">待处理(企业车险)</div>
  42 + <count-to
  43 + :start-val="0"
  44 + :end-val="totalList[2]"
  45 + :duration="3200"
  46 + class="card-panel-num"
  47 + />
  48 + </div>
  49 + </div>
  50 + </el-col>
  51 + <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
  52 + <div class="card-panel" @click="handleSetLineChartData('shoppings')">
  53 + <div class="card-panel-icon-wrapper icon-shopping">
  54 + <svg-icon icon-class="success" class-name="card-panel-icon" />
  55 + </div>
  56 + <div class="card-panel-description">
  57 + <div class="card-panel-text">已处理(企业车险)</div>
  58 + <count-to
  59 + :start-val="0"
  60 + :end-val="totalList[3]"
  61 + :duration="3600"
  62 + class="card-panel-num"
  63 + />
  64 + </div>
  65 + </div>
  66 + </el-col>
  67 + </el-row>
  68 +</template>
  69 +
  70 +<script setup>
  71 +import { CountTo } from "vue3-count-to";
  72 +defineProps({
  73 + totalList: {
  74 + type: Object,
  75 + default: () => {},
  76 + },
  77 +});
  78 +
  79 +const $emit = defineEmits(["handleSetLineChartData"]);
  80 +const handleSetLineChartData = (type) => {
  81 + $emit("handleSetLineChartData", type);
  82 +};
  83 +</script>
  84 +
  85 +<style lang="scss" scoped>
  86 +.panel-group {
  87 + margin-top: 18px;
  88 +
  89 + .card-panel-col {
  90 + margin-bottom: 32px;
  91 + }
  92 +
  93 + .card-panel {
  94 + height: 108px;
  95 + cursor: pointer;
  96 + font-size: 12px;
  97 + position: relative;
  98 + overflow: hidden;
  99 + color: #666;
  100 + background: #fff;
  101 + box-shadow: 4px 4px 40px rgba(0, 0, 0, 0.05);
  102 + border-color: rgba(0, 0, 0, 0.05);
  103 +
  104 + &:hover {
  105 + .card-panel-icon-wrapper {
  106 + color: #fff;
  107 + }
  108 +
  109 + .icon-people {
  110 + background: #7f36fe;
  111 + }
  112 +
  113 + .icon-message {
  114 + background: #36a3f7;
  115 + }
  116 +
  117 + .icon-money {
  118 + background: #f4516c;
  119 + }
  120 +
  121 + .icon-shopping {
  122 + background: #34bfa3;
  123 + }
  124 + }
  125 +
  126 + .icon-people {
  127 + color: #7f36fe;
  128 + }
  129 +
  130 + .icon-message {
  131 + color: #36a3f7;
  132 + }
  133 +
  134 + .icon-money {
  135 + color: #f4516c;
  136 + }
  137 +
  138 + .icon-shopping {
  139 + color: #34bfa3;
  140 + }
  141 +
  142 + .card-panel-icon-wrapper {
  143 + float: left;
  144 + margin: 14px 0 0 14px;
  145 + padding: 16px;
  146 + transition: all 0.38s ease-out;
  147 + border-radius: 6px;
  148 + }
  149 +
  150 + .card-panel-icon {
  151 + float: left;
  152 + font-size: 48px;
  153 + }
  154 +
  155 + .card-panel-description {
  156 + float: right;
  157 + font-weight: bold;
  158 + margin: 26px;
  159 + margin-left: 0px;
  160 +
  161 + .card-panel-text {
  162 + line-height: 18px;
  163 + color: rgba(0, 0, 0, 0.45);
  164 + font-size: 16px;
  165 + margin-bottom: 12px;
  166 + }
  167 +
  168 + .card-panel-num {
  169 + font-size: 20px;
  170 + }
  171 + }
  172 + }
  173 +}
  174 +
  175 +@media (max-width: 550px) {
  176 + .card-panel-description {
  177 + display: none;
  178 + }
  179 +
  180 + .card-panel-icon-wrapper {
  181 + float: none !important;
  182 + width: 100%;
  183 + height: 100%;
  184 + margin: 0 !important;
  185 +
  186 + .svg-icon {
  187 + display: block;
  188 + margin: 14px auto !important;
  189 + float: none !important;
  190 + }
  191 + }
  192 +}
  193 +</style>
@@ -6,7 +6,9 @@ @@ -6,7 +6,9 @@
6 <svg-icon icon-class="notaccepted" class-name="card-panel-icon" /> 6 <svg-icon icon-class="notaccepted" class-name="card-panel-icon" />
7 </div> 7 </div>
8 <div class="card-panel-description"> 8 <div class="card-panel-description">
9 - <div class="card-panel-text">未承接</div> 9 + <div class="card-panel-text">
  10 + {{ type === 0 ? "未承接" : "待处理个人" }}
  11 + </div>
10 <count-to 12 <count-to
11 :start-val="0" 13 :start-val="0"
12 :end-val="totalList[0]" 14 :end-val="totalList[0]"
@@ -22,7 +24,15 @@ @@ -22,7 +24,15 @@
22 <svg-icon icon-class="undertaken" class-name="card-panel-icon" /> 24 <svg-icon icon-class="undertaken" class-name="card-panel-icon" />
23 </div> 25 </div>
24 <div class="card-panel-description"> 26 <div class="card-panel-description">
25 - <div class="card-panel-text">已承接</div> 27 + <div class="card-panel-text">
  28 + {{
  29 + type === 0
  30 + ? "已承接"
  31 + : companyemployee
  32 + ? "已完成个人"
  33 + : "已处理个人"
  34 + }}
  35 + </div>
26 <count-to 36 <count-to
27 :start-val="0" 37 :start-val="0"
28 :end-val="totalList[1]" 38 :end-val="totalList[1]"
@@ -38,7 +48,9 @@ @@ -38,7 +48,9 @@
38 <svg-icon icon-class="incomplete" class-name="card-panel-icon" /> 48 <svg-icon icon-class="incomplete" class-name="card-panel-icon" />
39 </div> 49 </div>
40 <div class="card-panel-description"> 50 <div class="card-panel-description">
41 - <div class="card-panel-text">未完成</div> 51 + <div class="card-panel-text">
  52 + {{ type == 0 ? "未完成" : "待处理企业" }}
  53 + </div>
42 <count-to 54 <count-to
43 :start-val="0" 55 :start-val="0"
44 :end-val="totalList[2]" 56 :end-val="totalList[2]"
@@ -54,7 +66,15 @@ @@ -54,7 +66,15 @@
54 <svg-icon icon-class="success" class-name="card-panel-icon" /> 66 <svg-icon icon-class="success" class-name="card-panel-icon" />
55 </div> 67 </div>
56 <div class="card-panel-description"> 68 <div class="card-panel-description">
57 - <div class="card-panel-text">已完成</div> 69 + <div class="card-panel-text">
  70 + {{
  71 + type == 0
  72 + ? "已完成"
  73 + : companyemployee
  74 + ? "已完成企业"
  75 + : "已处理企业"
  76 + }}
  77 + </div>
58 <count-to 78 <count-to
59 :start-val="0" 79 :start-val="0"
60 :end-val="totalList[3]" 80 :end-val="totalList[3]"
@@ -68,17 +88,37 @@ @@ -68,17 +88,37 @@
68 </template> 88 </template>
69 89
70 <script setup> 90 <script setup>
  91 +import { useRouter } from "vue-router";
71 import { CountTo } from "vue3-count-to"; 92 import { CountTo } from "vue3-count-to";
72 -defineProps({ 93 +const props = defineProps({
73 totalList: { 94 totalList: {
74 type: Object, 95 type: Object,
75 default: () => {}, 96 default: () => {},
76 }, 97 },
  98 + type: {
  99 + type: Number,
  100 + default: 0,
  101 + },
  102 + companyemployee: {
  103 + type: Boolean,
  104 + default: false,
  105 + },
77 }); 106 });
78 -  
79 -const $emit = defineEmits(["handleSetLineChartData"]);  
80 -const handleSetLineChartData = (type) => {  
81 - $emit("handleSetLineChartData", type); 107 +const router = useRouter();
  108 +const handleSetLineChartData = (typeValue) => {
  109 + let obj = {
  110 + newVisitis: "/policy/pending",
  111 + messages: props.companyemployee ? "/policy/ended" : "/policy/processed",
  112 + purchases: "/buinessPolicy/businessPending",
  113 + shoppings: props.companyemployee
  114 + ? "/buinessPolicy/businessEnded"
  115 + : "/buinessPolicy/businessProcessed",
  116 + };
  117 + if (props.type !== 0) {
  118 + router.push({
  119 + path: obj[typeValue],
  120 + });
  121 + }
82 }; 122 };
83 </script> 123 </script>
84 124
@@ -46,7 +46,7 @@ @@ -46,7 +46,7 @@
46 </div> 46 </div>
47 </el-card> 47 </el-card>
48 </el-col> 48 </el-col>
49 - <el-col :span="18" :xs="24"> 49 + <el-col v-if="checkRole(['admin', 'companyadmin'])" :span="18" :xs="24">
50 <!-- 个人车险 --> 50 <!-- 个人车险 -->
51 <div style="font-weight: 500">{{ peopleCompany }}个人车险统计</div> 51 <div style="font-weight: 500">{{ peopleCompany }}个人车险统计</div>
52 <div 52 <div
@@ -115,21 +115,36 @@ @@ -115,21 +115,36 @@
115 <div ref="chartRef" style="width: 100%; height: 400px"></div> 115 <div ref="chartRef" style="width: 100%; height: 400px"></div>
116 </div> 116 </div>
117 </el-col> 117 </el-col>
  118 + <el-col v-else :span="18" :xs="24">
  119 + <PanelGroup
  120 + :totalList="PanelGroupList"
  121 + :type="1"
  122 + :companyemployee="checkRole(['companyemployee'])"
  123 + />
  124 + </el-col>
118 </el-row> 125 </el-row>
119 </div> 126 </div>
120 </template> 127 </template>
121 128
122 <script setup> 129 <script setup>
  130 +import { queryMyList, queryProcessedList, queryEndedList } from "@/api/policy";
123 import useUserStore from "@/store/modules/user"; 131 import useUserStore from "@/store/modules/user";
124 import { getUserProfile } from "@/api/system/user"; 132 import { getUserProfile } from "@/api/system/user";
125 import { getStatistics } from "@/api/index"; 133 import { getStatistics } from "@/api/index";
126 import PanelGroup from "@/components/PanelGroup"; 134 import PanelGroup from "@/components/PanelGroup";
127 import { listDept } from "@/api/system/dept"; 135 import { listDept } from "@/api/system/dept";
128 import { onMounted } from "vue"; 136 import { onMounted } from "vue";
  137 +import { checkRole } from "@/utils/permission"; // 权限判断函数
129 const { proxy } = getCurrentInstance(); 138 const { proxy } = getCurrentInstance();
130 const userStore = useUserStore(); 139 const userStore = useUserStore();
131 const chartRef = ref(null); 140 const chartRef = ref(null);
132 const listData = ref([]); 141 const listData = ref([]);
  142 +const PanelGroupList = ref({
  143 + 0: 0,
  144 + 1: 0,
  145 + 2: 0,
  146 + 3: 0,
  147 +});
133 const peopleTotalList = ref({ 148 const peopleTotalList = ref({
134 0: 0, 149 0: 0,
135 1: 0, 150 1: 0,
@@ -152,7 +167,7 @@ const deptOptions = ref([]); @@ -152,7 +167,7 @@ const deptOptions = ref([]);
152 const queryParamsPeople = reactive({ 167 const queryParamsPeople = reactive({
153 deptIds: [""], 168 deptIds: [""],
154 type: 1, 169 type: 1,
155 - registrationType: 0, 170 + registrationType: "0",
156 startTime: proxy.parseTime( 171 startTime: proxy.parseTime(
157 new Date().setFullYear(new Date().getFullYear() - 1) 172 new Date().setFullYear(new Date().getFullYear() - 1)
158 ), 173 ),
@@ -162,7 +177,7 @@ const queryParamsPeople = reactive({ @@ -162,7 +177,7 @@ const queryParamsPeople = reactive({
162 const queryParamsBusiness = reactive({ 177 const queryParamsBusiness = reactive({
163 deptIds: [""], 178 deptIds: [""],
164 type: 1, 179 type: 1,
165 - registrationType: 1, 180 + registrationType: "1",
166 startTime: proxy.parseTime( 181 startTime: proxy.parseTime(
167 new Date().setFullYear(new Date().getFullYear() - 1) 182 new Date().setFullYear(new Date().getFullYear() - 1)
168 ), 183 ),
@@ -184,12 +199,16 @@ const state = reactive({ @@ -184,12 +199,16 @@ const state = reactive({
184 }); 199 });
185 200
186 onMounted(() => { 201 onMounted(() => {
187 - getList();  
188 - getPeopleList();  
189 - getBusinessList();  
190 - if (proxy.$auth.hasRoleOr(["admin", "associationemployee"])) { 202 + if (proxy.$auth.hasRoleOr(["admin"])) {
191 getDeptList(); 203 getDeptList();
192 } 204 }
  205 + if (proxy.$auth.hasRoleOr(["admin", "companyadmin"])) {
  206 + getList();
  207 + getPeopleList();
  208 + getBusinessList();
  209 + } else {
  210 + getAllList();
  211 + }
193 }); 212 });
194 213
195 /** 查询部门列表 */ 214 /** 查询部门列表 */
@@ -247,6 +266,35 @@ const getList = async () => { @@ -247,6 +266,35 @@ const getList = async () => {
247 init(); 266 init();
248 }; 267 };
249 268
  269 +// 获取员工统计数据
  270 +const getAllList = async () => {
  271 + if (proxy.$auth.hasRoleOr(["associationemployee"])) {
  272 + const [personData, companyData, personProcessedData, companyProcessedData] =
  273 + await Promise.all([
  274 + queryMyList({ pageNum: 1, pageSize: 1, type: 0 }),
  275 + queryMyList({ pageNum: 1, pageSize: 1, type: 1 }),
  276 + queryProcessedList({ pageNum: 1, pageSize: 1, type: 0 }),
  277 + queryProcessedList({ pageNum: 1, pageSize: 1, type: 1 }),
  278 + ]);
  279 + PanelGroupList.value[0] = personData.data.total;
  280 + PanelGroupList.value[1] = personProcessedData.total;
  281 + PanelGroupList.value[2] = companyData.data.total;
  282 + PanelGroupList.value[3] = companyProcessedData.total;
  283 + } else if (proxy.$auth.hasRoleOr(["companyemployee"])) {
  284 + const [personData, companyData, personProcessedData, companyProcessedData] =
  285 + await Promise.all([
  286 + queryMyList({ pageNum: 1, pageSize: 1, type: 0 }),
  287 + queryMyList({ pageNum: 1, pageSize: 1, type: 1 }),
  288 + queryEndedList({ pageNum: 1, pageSize: 1, type: 0 }),
  289 + queryEndedList({ pageNum: 1, pageSize: 1, type: 1 }),
  290 + ]);
  291 + PanelGroupList.value[0] = personData.data.total;
  292 + PanelGroupList.value[1] = personProcessedData.total;
  293 + PanelGroupList.value[2] = companyData.data.total;
  294 + PanelGroupList.value[3] = companyProcessedData.total;
  295 + }
  296 +};
  297 +
250 // 获个人车险统计 298 // 获个人车险统计
251 const getPeopleList = async () => { 299 const getPeopleList = async () => {
252 peopleTotalList.value = { 300 peopleTotalList.value = {
@@ -265,6 +313,7 @@ const getPeopleList = async () => { @@ -265,6 +313,7 @@ const getPeopleList = async () => {
265 item.completed, 313 item.completed,
266 ]; 314 ];
267 }); 315 });
  316 + console.log(newArr);
268 const arrList = [[], [], [], []]; 317 const arrList = [[], [], [], []];
269 for (let i = 0; i < 4; i++) { 318 for (let i = 0; i < 4; i++) {
270 for (let j = 0; j < 13; j++) { 319 for (let j = 0; j < 13; j++) {
@@ -272,6 +321,7 @@ const getPeopleList = async () => { @@ -272,6 +321,7 @@ const getPeopleList = async () => {
272 peopleTotalList.value[i] += newArr[j][i]; 321 peopleTotalList.value[i] += newArr[j][i];
273 } 322 }
274 } 323 }
  324 + console.log(peopleTotalList.value);
275 peopleCompany.value = data[0]?.statisticsVo[0]?.deptName; 325 peopleCompany.value = data[0]?.statisticsVo[0]?.deptName;
276 }; 326 };
277 327
1 <template> 1 <template>
2 - <div class="app-container">  
3 - <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch">  
4 - <el-form-item label="部门名称" prop="deptName">  
5 - <el-input  
6 - v-model="queryParams.deptName"  
7 - placeholder="请输入部门名称"  
8 - clearable  
9 - style="width: 200px"  
10 - @keyup.enter="handleQuery"  
11 - />  
12 - </el-form-item>  
13 - <el-form-item label="状态" prop="status">  
14 - <el-select v-model="queryParams.status" placeholder="部门状态" clearable style="width: 200px">  
15 - <el-option  
16 - v-for="dict in sys_normal_disable"  
17 - :key="dict.value"  
18 - :label="dict.label"  
19 - :value="dict.value"  
20 - />  
21 - </el-select>  
22 - </el-form-item>  
23 - <el-form-item>  
24 - <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>  
25 - <el-button icon="Refresh" @click="resetQuery">重置</el-button>  
26 - </el-form-item>  
27 - </el-form> 2 + <div class="app-container">
  3 + <el-form
  4 + :model="queryParams"
  5 + ref="queryRef"
  6 + :inline="true"
  7 + v-show="showSearch"
  8 + >
  9 + <el-form-item label="部门名称" prop="deptName">
  10 + <el-input
  11 + v-model="queryParams.deptName"
  12 + placeholder="请输入部门名称"
  13 + clearable
  14 + style="width: 200px"
  15 + @keyup.enter="handleQuery"
  16 + />
  17 + </el-form-item>
  18 + <el-form-item label="状态" prop="status">
  19 + <el-select
  20 + v-model="queryParams.status"
  21 + placeholder="部门状态"
  22 + clearable
  23 + style="width: 200px"
  24 + >
  25 + <el-option
  26 + v-for="dict in sys_normal_disable"
  27 + :key="dict.value"
  28 + :label="dict.label"
  29 + :value="dict.value"
  30 + />
  31 + </el-select>
  32 + </el-form-item>
  33 + <el-form-item>
  34 + <el-button type="primary" icon="Search" @click="handleQuery"
  35 + >搜索</el-button
  36 + >
  37 + <el-button icon="Refresh" @click="resetQuery">重置</el-button>
  38 + </el-form-item>
  39 + </el-form>
28 40
29 - <el-row :gutter="10" class="mb8">  
30 - <el-col :span="1.5">  
31 - <el-button  
32 - type="primary"  
33 - plain  
34 - icon="Plus"  
35 - @click="handleAdd"  
36 - v-hasPermi="['system:dept:add']"  
37 - >新增</el-button>  
38 - </el-col>  
39 - <el-col :span="1.5">  
40 - <el-button  
41 - type="info"  
42 - plain  
43 - icon="Sort"  
44 - @click="toggleExpandAll"  
45 - >展开/折叠</el-button>  
46 - </el-col>  
47 - <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>  
48 - </el-row> 41 + <el-row :gutter="10" class="mb8">
  42 + <el-col :span="1.5">
  43 + <el-button
  44 + type="primary"
  45 + plain
  46 + icon="Plus"
  47 + @click="handleAdd"
  48 + v-hasPermi="['system:dept:add']"
  49 + >新增</el-button
  50 + >
  51 + </el-col>
  52 + <el-col :span="1.5">
  53 + <el-button type="info" plain icon="Sort" @click="toggleExpandAll"
  54 + >展开/折叠</el-button
  55 + >
  56 + </el-col>
  57 + <right-toolbar
  58 + v-model:showSearch="showSearch"
  59 + @queryTable="getList"
  60 + ></right-toolbar>
  61 + </el-row>
49 62
50 - <el-table  
51 - v-if="refreshTable"  
52 - v-loading="loading"  
53 - :data="deptList"  
54 - row-key="deptId"  
55 - :default-expand-all="isExpandAll"  
56 - :tree-props="{ children: 'children', hasChildren: 'hasChildren' }" 63 + <el-table
  64 + v-if="refreshTable"
  65 + v-loading="loading"
  66 + :data="deptList"
  67 + row-key="deptId"
  68 + :default-expand-all="isExpandAll"
  69 + :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
  70 + >
  71 + <el-table-column
  72 + prop="deptName"
  73 + label="部门名称"
  74 + width="260"
  75 + ></el-table-column>
  76 + <el-table-column
  77 + prop="deptId"
  78 + label="部门编号"
  79 + width="80"
  80 + ></el-table-column>
  81 + <el-table-column
  82 + prop="orderNum"
  83 + label="排序"
  84 + width="200"
  85 + ></el-table-column>
  86 + <el-table-column prop="status" label="状态" width="100">
  87 + <template #default="scope">
  88 + <dict-tag :options="sys_normal_disable" :value="scope.row.status" />
  89 + </template>
  90 + </el-table-column>
  91 + <el-table-column
  92 + label="创建时间"
  93 + align="center"
  94 + prop="createTime"
  95 + width="200"
  96 + >
  97 + <template #default="scope">
  98 + <span>{{ parseTime(scope.row.createTime) }}</span>
  99 + </template>
  100 + </el-table-column>
  101 + <el-table-column
  102 + label="操作"
  103 + align="center"
  104 + class-name="small-padding fixed-width"
57 > 105 >
58 - <el-table-column prop="deptName" label="部门名称" width="260"></el-table-column>  
59 - <el-table-column prop="orderNum" label="排序" width="200"></el-table-column>  
60 - <el-table-column prop="status" label="状态" width="100">  
61 - <template #default="scope">  
62 - <dict-tag :options="sys_normal_disable" :value="scope.row.status" />  
63 - </template>  
64 - </el-table-column>  
65 - <el-table-column label="创建时间" align="center" prop="createTime" width="200">  
66 - <template #default="scope">  
67 - <span>{{ parseTime(scope.row.createTime) }}</span>  
68 - </template>  
69 - </el-table-column>  
70 - <el-table-column label="操作" align="center" class-name="small-padding fixed-width">  
71 - <template #default="scope">  
72 - <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:dept:edit']">修改</el-button>  
73 - <el-button link type="primary" icon="Plus" @click="handleAdd(scope.row)" v-hasPermi="['system:dept:add']">新增</el-button>  
74 - <el-button v-if="scope.row.parentId != 0" link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['system:dept:remove']">删除</el-button>  
75 - </template>  
76 - </el-table-column>  
77 - </el-table> 106 + <template #default="scope">
  107 + <el-button
  108 + link
  109 + type="primary"
  110 + icon="Edit"
  111 + @click="handleUpdate(scope.row)"
  112 + v-hasPermi="['system:dept:edit']"
  113 + >修改</el-button
  114 + >
  115 + <el-button
  116 + link
  117 + type="primary"
  118 + icon="Plus"
  119 + @click="handleAdd(scope.row)"
  120 + v-hasPermi="['system:dept:add']"
  121 + >新增</el-button
  122 + >
  123 + <el-button
  124 + v-if="scope.row.parentId != 0"
  125 + link
  126 + type="primary"
  127 + icon="Delete"
  128 + @click="handleDelete(scope.row)"
  129 + v-hasPermi="['system:dept:remove']"
  130 + >删除</el-button
  131 + >
  132 + </template>
  133 + </el-table-column>
  134 + </el-table>
78 135
79 - <!-- 添加或修改部门对话框 -->  
80 - <el-dialog :title="title" v-model="open" width="600px" append-to-body>  
81 - <el-form ref="deptRef" :model="form" :rules="rules" label-width="80px">  
82 - <el-row>  
83 - <el-col :span="24" v-if="form.parentId !== 0">  
84 - <el-form-item label="上级部门" prop="parentId">  
85 - <el-tree-select  
86 - v-model="form.parentId"  
87 - :data="deptOptions"  
88 - :props="{ value: 'deptId', label: 'deptName', children: 'children' }"  
89 - value-key="deptId"  
90 - placeholder="选择上级部门"  
91 - check-strictly  
92 - />  
93 - </el-form-item>  
94 - </el-col>  
95 - <el-col :span="12">  
96 - <el-form-item label="部门名称" prop="deptName">  
97 - <el-input v-model="form.deptName" placeholder="请输入部门名称" />  
98 - </el-form-item>  
99 - </el-col>  
100 - <el-col :span="12">  
101 - <el-form-item label="显示排序" prop="orderNum">  
102 - <el-input-number v-model="form.orderNum" controls-position="right" :min="0" />  
103 - </el-form-item>  
104 - </el-col>  
105 - <el-col :span="12">  
106 - <el-form-item label="负责人" prop="leader">  
107 - <el-input v-model="form.leader" placeholder="请输入负责人" maxlength="20" />  
108 - </el-form-item>  
109 - </el-col>  
110 - <el-col :span="12">  
111 - <el-form-item label="联系电话" prop="phone">  
112 - <el-input v-model="form.phone" placeholder="请输入联系电话" maxlength="11" />  
113 - </el-form-item>  
114 - </el-col>  
115 - <el-col :span="12">  
116 - <el-form-item label="邮箱" prop="email">  
117 - <el-input v-model="form.email" placeholder="请输入邮箱" maxlength="50" />  
118 - </el-form-item>  
119 - </el-col>  
120 - <el-col :span="12">  
121 - <el-form-item label="部门状态">  
122 - <el-radio-group v-model="form.status">  
123 - <el-radio  
124 - v-for="dict in sys_normal_disable"  
125 - :key="dict.value"  
126 - :label="dict.value"  
127 - >{{ dict.label }}</el-radio>  
128 - </el-radio-group>  
129 - </el-form-item>  
130 - </el-col>  
131 - </el-row>  
132 - </el-form>  
133 - <template #footer>  
134 - <div class="dialog-footer">  
135 - <el-button type="primary" @click="submitForm">确 定</el-button>  
136 - <el-button @click="cancel">取 消</el-button>  
137 - </div>  
138 - </template>  
139 - </el-dialog>  
140 - </div> 136 + <!-- 添加或修改部门对话框 -->
  137 + <el-dialog :title="title" v-model="open" width="600px" append-to-body>
  138 + <el-form ref="deptRef" :model="form" :rules="rules" label-width="80px">
  139 + <el-row>
  140 + <el-col :span="24" v-if="form.parentId !== 0">
  141 + <el-form-item label="上级部门" prop="parentId">
  142 + <el-tree-select
  143 + v-model="form.parentId"
  144 + :data="deptOptions"
  145 + :props="{
  146 + value: 'deptId',
  147 + label: 'deptName',
  148 + children: 'children',
  149 + }"
  150 + value-key="deptId"
  151 + placeholder="选择上级部门"
  152 + check-strictly
  153 + />
  154 + </el-form-item>
  155 + </el-col>
  156 + <el-col :span="12">
  157 + <el-form-item label="部门名称" prop="deptName">
  158 + <el-input v-model="form.deptName" placeholder="请输入部门名称" />
  159 + </el-form-item>
  160 + </el-col>
  161 + <el-col :span="12">
  162 + <el-form-item label="显示排序" prop="orderNum">
  163 + <el-input-number
  164 + v-model="form.orderNum"
  165 + controls-position="right"
  166 + :min="0"
  167 + />
  168 + </el-form-item>
  169 + </el-col>
  170 + <el-col :span="12">
  171 + <el-form-item label="负责人" prop="leader">
  172 + <el-input
  173 + v-model="form.leader"
  174 + placeholder="请输入负责人"
  175 + maxlength="20"
  176 + />
  177 + </el-form-item>
  178 + </el-col>
  179 + <el-col :span="12">
  180 + <el-form-item label="联系电话" prop="phone">
  181 + <el-input
  182 + v-model="form.phone"
  183 + placeholder="请输入联系电话"
  184 + maxlength="11"
  185 + />
  186 + </el-form-item>
  187 + </el-col>
  188 + <el-col :span="12">
  189 + <el-form-item label="邮箱" prop="email">
  190 + <el-input
  191 + v-model="form.email"
  192 + placeholder="请输入邮箱"
  193 + maxlength="50"
  194 + />
  195 + </el-form-item>
  196 + </el-col>
  197 + <el-col :span="12">
  198 + <el-form-item label="部门状态">
  199 + <el-radio-group v-model="form.status">
  200 + <el-radio
  201 + v-for="dict in sys_normal_disable"
  202 + :key="dict.value"
  203 + :label="dict.value"
  204 + >{{ dict.label }}</el-radio
  205 + >
  206 + </el-radio-group>
  207 + </el-form-item>
  208 + </el-col>
  209 + </el-row>
  210 + </el-form>
  211 + <template #footer>
  212 + <div class="dialog-footer">
  213 + <el-button type="primary" @click="submitForm">确 定</el-button>
  214 + <el-button @click="cancel">取 消</el-button>
  215 + </div>
  216 + </template>
  217 + </el-dialog>
  218 + </div>
141 </template> 219 </template>
142 220
143 <script setup name="Dept"> 221 <script setup name="Dept">
144 -import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from "@/api/system/dept"; 222 +import {
  223 + listDept,
  224 + getDept,
  225 + delDept,
  226 + addDept,
  227 + updateDept,
  228 + listDeptExcludeChild,
  229 +} from "@/api/system/dept";
145 230
146 const { proxy } = getCurrentInstance(); 231 const { proxy } = getCurrentInstance();
147 const { sys_normal_disable } = proxy.useDict("sys_normal_disable"); 232 const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
@@ -159,14 +244,32 @@ const data = reactive({ @@ -159,14 +244,32 @@ const data = reactive({
159 form: {}, 244 form: {},
160 queryParams: { 245 queryParams: {
161 deptName: undefined, 246 deptName: undefined,
162 - status: undefined 247 + status: undefined,
163 }, 248 },
164 rules: { 249 rules: {
165 - parentId: [{ required: true, message: "上级部门不能为空", trigger: "blur" }],  
166 - deptName: [{ required: true, message: "部门名称不能为空", trigger: "blur" }],  
167 - orderNum: [{ required: true, message: "显示排序不能为空", trigger: "blur" }],  
168 - email: [{ type: "email", message: "请输入正确的邮箱地址", trigger: ["blur", "change"] }],  
169 - phone: [{ pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "请输入正确的手机号码", trigger: "blur" }] 250 + parentId: [
  251 + { required: true, message: "上级部门不能为空", trigger: "blur" },
  252 + ],
  253 + deptName: [
  254 + { required: true, message: "部门名称不能为空", trigger: "blur" },
  255 + ],
  256 + orderNum: [
  257 + { required: true, message: "显示排序不能为空", trigger: "blur" },
  258 + ],
  259 + email: [
  260 + {
  261 + type: "email",
  262 + message: "请输入正确的邮箱地址",
  263 + trigger: ["blur", "change"],
  264 + },
  265 + ],
  266 + phone: [
  267 + {
  268 + pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
  269 + message: "请输入正确的手机号码",
  270 + trigger: "blur",
  271 + },
  272 + ],
170 }, 273 },
171 }); 274 });
172 275
@@ -175,7 +278,7 @@ const { queryParams, form, rules } = toRefs(data); @@ -175,7 +278,7 @@ const { queryParams, form, rules } = toRefs(data);
175 /** 查询部门列表 */ 278 /** 查询部门列表 */
176 function getList() { 279 function getList() {
177 loading.value = true; 280 loading.value = true;
178 - listDept(queryParams.value).then(response => { 281 + listDept(queryParams.value).then((response) => {
179 deptList.value = proxy.handleTree(response.data, "deptId"); 282 deptList.value = proxy.handleTree(response.data, "deptId");
180 loading.value = false; 283 loading.value = false;
181 }); 284 });
@@ -195,7 +298,7 @@ function reset() { @@ -195,7 +298,7 @@ function reset() {
195 leader: undefined, 298 leader: undefined,
196 phone: undefined, 299 phone: undefined,
197 email: undefined, 300 email: undefined,
198 - status: "0" 301 + status: "0",
199 }; 302 };
200 proxy.resetForm("deptRef"); 303 proxy.resetForm("deptRef");
201 } 304 }
@@ -211,7 +314,7 @@ function resetQuery() { @@ -211,7 +314,7 @@ function resetQuery() {
211 /** 新增按钮操作 */ 314 /** 新增按钮操作 */
212 function handleAdd(row) { 315 function handleAdd(row) {
213 reset(); 316 reset();
214 - listDept().then(response => { 317 + listDept().then((response) => {
215 deptOptions.value = proxy.handleTree(response.data, "deptId"); 318 deptOptions.value = proxy.handleTree(response.data, "deptId");
216 }); 319 });
217 if (row != undefined) { 320 if (row != undefined) {
@@ -231,10 +334,10 @@ function toggleExpandAll() { @@ -231,10 +334,10 @@ function toggleExpandAll() {
231 /** 修改按钮操作 */ 334 /** 修改按钮操作 */
232 function handleUpdate(row) { 335 function handleUpdate(row) {
233 reset(); 336 reset();
234 - listDeptExcludeChild(row.deptId).then(response => { 337 + listDeptExcludeChild(row.deptId).then((response) => {
235 deptOptions.value = proxy.handleTree(response.data, "deptId"); 338 deptOptions.value = proxy.handleTree(response.data, "deptId");
236 }); 339 });
237 - getDept(row.deptId).then(response => { 340 + getDept(row.deptId).then((response) => {
238 form.value = response.data; 341 form.value = response.data;
239 open.value = true; 342 open.value = true;
240 title.value = "修改部门"; 343 title.value = "修改部门";
@@ -242,16 +345,16 @@ function handleUpdate(row) { @@ -242,16 +345,16 @@ function handleUpdate(row) {
242 } 345 }
243 /** 提交按钮 */ 346 /** 提交按钮 */
244 function submitForm() { 347 function submitForm() {
245 - proxy.$refs["deptRef"].validate(valid => { 348 + proxy.$refs["deptRef"].validate((valid) => {
246 if (valid) { 349 if (valid) {
247 if (form.value.deptId != undefined) { 350 if (form.value.deptId != undefined) {
248 - updateDept(form.value).then(response => { 351 + updateDept(form.value).then((response) => {
249 proxy.$modal.msgSuccess("修改成功"); 352 proxy.$modal.msgSuccess("修改成功");
250 open.value = false; 353 open.value = false;
251 getList(); 354 getList();
252 }); 355 });
253 } else { 356 } else {
254 - addDept(form.value).then(response => { 357 + addDept(form.value).then((response) => {
255 proxy.$modal.msgSuccess("新增成功"); 358 proxy.$modal.msgSuccess("新增成功");
256 open.value = false; 359 open.value = false;
257 getList(); 360 getList();
@@ -262,12 +365,16 @@ function submitForm() { @@ -262,12 +365,16 @@ function submitForm() {
262 } 365 }
263 /** 删除按钮操作 */ 366 /** 删除按钮操作 */
264 function handleDelete(row) { 367 function handleDelete(row) {
265 - proxy.$modal.confirm('是否确认删除名称为"' + row.deptName + '"的数据项?').then(function() {  
266 - return delDept(row.deptId);  
267 - }).then(() => {  
268 - getList();  
269 - proxy.$modal.msgSuccess("删除成功");  
270 - }).catch(() => {}); 368 + proxy.$modal
  369 + .confirm('是否确认删除名称为"' + row.deptName + '"的数据项?')
  370 + .then(function () {
  371 + return delDept(row.deptId);
  372 + })
  373 + .then(() => {
  374 + getList();
  375 + proxy.$modal.msgSuccess("删除成功");
  376 + })
  377 + .catch(() => {});
271 } 378 }
272 379
273 getList(); 380 getList();
@@ -153,10 +153,10 @@ @@ -153,10 +153,10 @@
153 > 153 >
154 <el-table-column type="selection" width="50" align="center" /> 154 <el-table-column type="selection" width="50" align="center" />
155 <el-table-column 155 <el-table-column
156 - label="用户编号" 156 + label="号"
157 align="center" 157 align="center"
158 - key="userId"  
159 - prop="userId" 158 + type="index"
  159 + width="55"
160 v-if="columns[0].visible" 160 v-if="columns[0].visible"
161 /> 161 />
162 <el-table-column 162 <el-table-column
@@ -393,7 +393,7 @@ @@ -393,7 +393,7 @@
393 </el-row> 393 </el-row>
394 <el-row> 394 <el-row>
395 <el-col :span="12"> 395 <el-col :span="12">
396 - <el-form-item label="岗位"> 396 + <el-form-item label="岗位" prop="postIds">
397 <el-select v-model="form.postIds" multiple placeholder="请选择"> 397 <el-select v-model="form.postIds" multiple placeholder="请选择">
398 <el-option 398 <el-option
399 v-for="item in postOptions" 399 v-for="item in postOptions"
@@ -406,7 +406,7 @@ @@ -406,7 +406,7 @@
406 </el-form-item> 406 </el-form-item>
407 </el-col> 407 </el-col>
408 <el-col :span="12"> 408 <el-col :span="12">
409 - <el-form-item label="角色"> 409 + <el-form-item label="角色" prop="roleIds">
410 <el-select v-model="form.roleIds" multiple placeholder="请选择"> 410 <el-select v-model="form.roleIds" multiple placeholder="请选择">
411 <el-option 411 <el-option
412 v-for="item in roleOptions" 412 v-for="item in roleOptions"
@@ -572,6 +572,9 @@ const data = reactive({ @@ -572,6 +572,9 @@ const data = reactive({
572 nickName: [ 572 nickName: [
573 { required: true, message: "用户姓名不能为空", trigger: "blur" }, 573 { required: true, message: "用户姓名不能为空", trigger: "blur" },
574 ], 574 ],
  575 + deptId: [{ required: true, message: "部门不能为空", trigger: "change" }],
  576 + roleIds: [{ required: true, message: "角色不能为空", trigger: "change" }],
  577 + postIds: [{ required: true, message: "岗位不能为空", trigger: "change" }],
575 password: [ 578 password: [
576 { required: true, message: "用户密码不能为空", trigger: "blur" }, 579 { required: true, message: "用户密码不能为空", trigger: "blur" },
577 { 580 {
@@ -589,6 +592,7 @@ const data = reactive({ @@ -589,6 +592,7 @@ const data = reactive({
589 }, 592 },
590 ], 593 ],
591 phonenumber: [ 594 phonenumber: [
  595 + { required: true, message: "手机号不能为空", trigger: "blur" },
592 { 596 {
593 pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, 597 pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
594 message: "请输入正确的手机号码", 598 message: "请输入正确的手机号码",