浏览代码

部分自测及优化

刘洋 1 年之前
父节点
当前提交
a3600bcb2e

+ 1 - 1
src/api/my-workbenches.js

@@ -8,6 +8,6 @@ export const getMyMessages = (data) =>
 
 export const getMyWaits = (data) =>
   request({
-    url: 'api/admin/flow/task/list',
+    url: '/api/admin/flow/task/list',
     params: data,
   });

+ 2 - 0
src/directives/index.js

@@ -1,7 +1,9 @@
 import copy from './copy';
+import perm from './perm';
 
 export default {
   install(Vue) {
     Vue.directive('copy', copy);
+    Vue.directive('perm', perm);
   },
 };

+ 1 - 1
src/directives/perm.js

@@ -3,7 +3,7 @@ const perm = (el, binding) => {
   const userStore = useUserStore();
   const { value } = binding;
   if (!!value) {
-    if (!userStore.finePermissionIds.includes(value)) {
+    if (!userStore.finePermissionIds.includes(String(value))) {
       el.parentNode && el.parentNode.removeChild(el);
     }
   } else {

+ 6 - 0
src/hooks/useFetchTable.js

@@ -64,6 +64,12 @@ export default function useFetchTable(apiFn, options = {}, immediately = true) {
       fetchData();
     }
   );
+  watch(
+    () => pagination.pageSize,
+    () => {
+      search();
+    }
+  );
 
   return {
     loading,

+ 56 - 10
src/layout/index.vue

@@ -36,17 +36,39 @@
           <div class="header-right flex items-center">
             <t-dropdown
               class="m-r-20px"
-              :options="colorOptions"
               trigger="hover"
+              placement="bottom"
               @click="colorChoose"
             >
               <t-button theme="default" variant="outline" shape="square">
                 <t-icon
                   name="palette"
-                  size="24"
+                  size="26"
                   color="#fff"
                   :style="{ background: themeColor, borderRadius: '2px' }"
               /></t-button>
+              <t-dropdown-menu>
+                <t-dropdown-item
+                  v-for="item in colorOptions"
+                  :key="item.value"
+                  :value="item.value"
+                >
+                  <div
+                    class="color-grid"
+                    :class="{ 'active-color-grid': themeColor === item.value }"
+                  >
+                    <div
+                      class="color-grid-center"
+                      :style="{
+                        backgroundColor: item.value,
+                        width: '100%',
+                        height: '100%',
+                        borderRadius: '2px',
+                      }"
+                    ></div>
+                  </div>
+                </t-dropdown-item>
+              </t-dropdown-menu>
             </t-dropdown>
             <t-dropdown
               trigger="hover"
@@ -106,20 +128,31 @@ onMounted(() => {
 });
 const colorOptions = ref([
   {
-    content: '默认主题',
     value: '#0052d9',
   },
   {
-    content: '天蓝主题',
-    value: '#2fa4e7',
+    value: '#0091ff',
   },
   {
-    content: '橙色主题',
-    value: '#e78b24',
+    value: '#35c1db',
   },
   {
-    content: '红色主题',
-    value: '#dd4814',
+    value: '#5dbe8a',
+  },
+  {
+    value: '#f4b84a',
+  },
+  {
+    value: '#f29e55',
+  },
+  {
+    value: '#ac6ef6',
+  },
+  {
+    value: '#7969f3',
+  },
+  {
+    value: '#e65857',
   },
 ]);
 const userOptions = ref([
@@ -148,7 +181,20 @@ const colorChoose = (data) => {
   setTheme(hex);
 };
 </script>
-
+<style lang="less">
+.color-grid {
+  margin-left: auto;
+  margin-right: auto;
+  width: 54px;
+  height: 24px;
+  border-radius: 2px;
+  padding: 2px;
+  border: 1px solid transparent;
+  &.active-color-grid {
+    border-color: #ccc;
+  }
+}
+</style>
 <style lang="less" scoped>
 .app-layout {
   .right-view {

+ 1 - 0
src/router/modules/sop.js

@@ -59,6 +59,7 @@ export default {
           meta: {
             title: '研究生SOP管理', //后端菜单暂时没有提供,等待需求落定
             sort: 2,
+            alias: 'cloudMark',
           },
         },
         {

+ 5 - 5
src/utils/request.js

@@ -63,7 +63,7 @@ function createService() {
       if (response.data.code && response.data.code !== 200) {
         Message.error({
           content: response.data.message,
-          icon: () => h(IconFaceFrownFill),
+          // icon: () => h(IconFaceFrownFill),
         });
       }
       if (response.config.download && response.config.responseType === 'blob') {
@@ -93,10 +93,10 @@ function createService() {
       if (error.response) {
         switch (error.response.status) {
           case 404:
-            err(`${error?.config?.url} 服务器资源不存在`);
+            err(`服务器资源不存在`);
             break;
           case 500:
-            err(`${error?.config?.url} 服务器内部错误`);
+            err(`服务器内部错误`);
             break;
           case 401:
             err('登录状态已过期或没有权限');
@@ -105,7 +105,7 @@ function createService() {
             }
             break;
           case 403:
-            err(`${error?.config?.url} 没有权限访问该资源`);
+            err(`没有权限访问该资源`);
             break;
           default:
             err(JSON.stringify(error?.response || '未知错误'));
@@ -140,7 +140,7 @@ function createRequest(service) {
     };
     const configDefault = {
       method: 'post',
-      timeout: 380000,
+      timeout: 120000,
       baseURL: env.VITE_HTTP_PROXY === 'Y' ? '' : env.VITE_APP_BASE_URL,
       data: {},
     };

+ 2 - 2
src/views/login/index.vue

@@ -94,8 +94,8 @@ const route = useRoute();
 const router = useRouter();
 
 const formData = reactive({
-  loginName: 'liuyang',
-  password: '123456',
+  loginName: '',
+  password: '',
 });
 const rules = {
   loginName: [

+ 2 - 5
src/views/my-workbenches/workbenches/message-reminder/message-list.vue

@@ -1,10 +1,6 @@
 <template>
   <div class="message-list">
-    <div
-      class="message-item cursor-pointer"
-      v-for="item in tableData"
-      :key="item.id"
-    >
+    <div class="message-item" v-for="item in tableData" :key="item.id">
       <div class="m-head">
         <span class="m-title">{{ item.messageType }}</span>
         <t-tag theme="danger" variant="light" v-if="!item.readStatus"
@@ -66,6 +62,7 @@ const { tableData, loading, pagination, onChange } = defineProps([
     border-radius: 4px;
     background-color: #fff;
     padding: 0 15px;
+    margin-bottom: 10px;
     .m-head {
       height: 55px;
       border-bottom: 1px solid #e5e5e5;

+ 4 - 4
src/views/my-workbenches/workbenches/my-waits/index.vue

@@ -45,14 +45,14 @@
 </template>
 
 <script setup name="MyTasks">
-import { reactive, computed, ref } from 'vue';
+import { reactive, ref } from 'vue';
 import useFetchTable from '@/hooks/useFetchTable';
 import { getMyWaits } from '@/api/my-workbenches';
 import { WAIT_HANDLE_TYPE } from '@/config/constants';
 import { dictToOptionList } from '@/utils/tool';
 import TaskList from './waits-list.vue';
 const params = reactive({
-  types: '',
+  type: '',
   serviceId: '',
   customName: '',
   flowTaskTypeEnum: 'ALL',
@@ -72,9 +72,9 @@ const tabChange = () => {
 };
 const fields = ref([
   {
-    prop: 'types',
+    prop: 'type',
     label: '待办类型',
-    type: 'multipleSelect',
+    type: 'select',
     labelWidth: 100,
     colSpan: 5,
     options: dictToOptionList(WAIT_HANDLE_TYPE),

+ 8 - 2
src/views/my-workbenches/workbenches/my-waits/waits-list.vue

@@ -13,7 +13,7 @@
         <template v-else>
           <t-tag theme="danger" variant="light">已超时</t-tag>
           <t-tag class="m-l-5px" theme="danger" variant="light"
-            >超时时长:{{ diffTime <= 30 ? '30天' : '大于30天' }}</t-tag
+            >超时时长:{{ item.diffTime <= 30 ? '30天' : '大于30天' }}</t-tag
           >
         </template>
       </div>
@@ -22,7 +22,7 @@
         <div class="m-info flex items-center">
           <p>发起人:{{ item.createRealName }}</p>
           <p>服务单元: {{ item.serviceName }} </p>
-          <p>客户类型:{{ item.customType }}</p>
+          <p>客户类型:{{ CUSTOMER_TYPE[item.customType] }}</p>
           <p>客户名称:{{ item.customName }}</p>
         </div>
       </div>
@@ -44,6 +44,7 @@
 </template>
 
 <script setup name="MyTaskList">
+import { CUSTOMER_TYPE } from '@/config/constants';
 const { tableData, loading, pagination, onChange } = defineProps([
   'tableData',
   'loading',
@@ -71,6 +72,11 @@ const { tableData, loading, pagination, onChange } = defineProps([
     border-radius: 4px;
     background-color: #fff;
     padding: 0 15px;
+    margin-bottom: 10px;
+    transition: all 0.3s;
+    &:hover {
+      background-color: #f3f3f3;
+    }
     .m-head {
       height: 55px;
       border-bottom: 1px solid #e5e5e5;

+ 34 - 0
src/views/my-workbenches/workbenches/notice/index.vue

@@ -21,6 +21,7 @@
             :tableData="tableData"
             :pagination="pagination"
             :onChange="onChange"
+            @open="open"
           ></NoticeList>
         </t-tab-panel>
         <t-tab-panel value="false" label="未读">
@@ -29,6 +30,7 @@
             :tableData="tableData"
             :pagination="pagination"
             :onChange="onChange"
+            @open="open"
           ></NoticeList>
         </t-tab-panel>
         <t-tab-panel value="true" label="已读">
@@ -37,10 +39,23 @@
             :tableData="tableData"
             :pagination="pagination"
             :onChange="onChange"
+            @open="open"
           ></NoticeList>
         </t-tab-panel>
       </t-tabs>
     </div>
+    <t-drawer
+      v-model:visible="visible"
+      header="通知公告"
+      :footer="false"
+      size="700px"
+    >
+      <h2 class="text-center notice-title">{{ curNotice.title }}</h2>
+      <div class="text-center notice-subtitle"
+        >发布时间:{{ dateFormat(curNotice.sendTime, 'yyyy-MM-dd') }}</div
+      >
+      <p class="notice-content">{{ curNotice.content }}</p>
+    </t-drawer>
   </div>
 </template>
 
@@ -50,6 +65,12 @@ import useFetchTable from '@/hooks/useFetchTable';
 import { getMyMessages } from '@/api/my-workbenches';
 import NoticeList from './notice-list.vue';
 import { omit } from 'lodash';
+import { dateFormat } from '@/utils/tool';
+const curNotice = ref({});
+const visible = ref(false);
+const open = (notice) => {
+  curNotice.value = notice;
+};
 const params = reactive({
   types: ['SYSTEM'],
   title: '',
@@ -121,5 +142,18 @@ const fields = ref([
       overflow: auto;
     }
   }
+  .notice-title {
+    color: #333;
+    font-size: 20px;
+  }
+  .notice-subtitle {
+    font-size: 13px;
+    margin-top: 6px;
+  }
+  .notice-content {
+    font-size: 14px;
+    margin-top: 10px;
+    text-indent: 2em;
+  }
 }
 </style>

+ 12 - 1
src/views/my-workbenches/workbenches/notice/notice-list.vue

@@ -13,7 +13,13 @@
         total: pagination.total,
         current: pagination.pageNumber,
       }"
-    ></t-table>
+    >
+      <template #title="{ row }">
+        <t-link theme="primary" hover="color" @click="open(row)">
+          {{ row.title }}
+        </t-link>
+      </template>
+    </t-table>
   </div>
 </template>
 
@@ -22,6 +28,7 @@ const columns = [
   {
     colKey: 'title',
     title: '通知标题',
+    cell: 'title',
   },
   {
     colKey: 'sendTime',
@@ -34,6 +41,10 @@ const { tableData, loading, pagination, onChange } = defineProps([
   'pagination',
   'onChange',
 ]);
+const emit = defineEmits(['open']);
+const open = (row) => {
+  emit('open', row);
+};
 </script>
 
 <style lang="less" scoped></style>

+ 78 - 32
src/views/user/auth-manage/role-manage/add-role.vue

@@ -6,37 +6,54 @@
       </t-form-item>
       <t-form-item label="绑定权限">
         <!-- <t-tree-select v-model="formData.d" :data="treeData" multiple /> -->
-        <t-table
-          row-key="id"
-          :columns="columns"
-          :data="treeFlatArr"
-          bordered
-          v-loading="loading"
-        >
-          <template #page="{ row }">
-            <t-checkbox v-model="row.hasRole"></t-checkbox>
-          </template>
-          <template #conditions="{ row }">
-            <div v-for="item in row.conditions" :key="item.id">
-              <t-checkbox v-model="item.hasRole">{{ item.name }}</t-checkbox>
-            </div>
-          </template>
-          <template #buttons="{ row }">
-            <div v-for="item in row.buttons" :key="item.id">
-              <t-checkbox v-model="item.hasRole">{{ item.name }}</t-checkbox>
-            </div>
-          </template>
-          <template #lists="{ row }">
-            <div v-for="item in row.lists" :key="item.id">
-              <t-checkbox v-model="item.hasRole">{{ item.name }}</t-checkbox>
-            </div>
-          </template>
-          <template #links="{ row }">
-            <div v-for="item in row.links" :key="item.id">
-              <t-checkbox v-model="item.hasRole">{{ item.name }}</t-checkbox>
-            </div>
-          </template>
-        </t-table>
+        <div>
+          <div>
+            <t-button theme="primary" @click="allCheckHandler(true)"
+              >全选</t-button
+            >
+            <t-button
+              theme="primary"
+              variant="outline"
+              @click="allCheckHandler(false)"
+              class="m-l-10px"
+              >全不选</t-button
+            >
+          </div>
+          <t-table
+            row-key="id"
+            :columns="columns"
+            :data="treeFlatArr"
+            bordered
+            v-loading="loading"
+          >
+            <template #page="{ row }">
+              <t-checkbox
+                v-model="row.hasRole"
+                @change="pageRoleChange(row)"
+              ></t-checkbox>
+            </template>
+            <template #conditions="{ row }">
+              <div v-for="item in row.conditions" :key="item.id">
+                <t-checkbox v-model="item.hasRole">{{ item.name }}</t-checkbox>
+              </div>
+            </template>
+            <template #buttons="{ row }">
+              <div v-for="item in row.buttons" :key="item.id">
+                <t-checkbox v-model="item.hasRole">{{ item.name }}</t-checkbox>
+              </div>
+            </template>
+            <template #lists="{ row }">
+              <div v-for="item in row.lists" :key="item.id">
+                <t-checkbox v-model="item.hasRole">{{ item.name }}</t-checkbox>
+              </div>
+            </template>
+            <template #links="{ row }">
+              <div v-for="item in row.links" :key="item.id">
+                <t-checkbox v-model="item.hasRole">{{ item.name }}</t-checkbox>
+              </div>
+            </template>
+          </t-table>
+        </div>
       </t-form-item>
     </t-form>
     <s-button
@@ -48,7 +65,7 @@
   </div>
 </template>
 <script setup name="AddRole">
-import { ref, computed, reactive } from 'vue';
+import { ref, computed, reactive, watch } from 'vue';
 import { getAllMenuResource, addRole, getRoleDetail } from '@/api/user';
 import { useRequest } from 'vue-request';
 import { useRoute, useRouter } from 'vue-router';
@@ -71,6 +88,35 @@ const rules = {
 let loading = ref(false);
 let treeFlatArr = ref([]);
 
+const allCheckHandler = (bool) => {
+  setAllCheckStatus(treeFlatArr.value, bool);
+};
+const setAllCheckStatus = (data, bool) => {
+  for (let i = 0; i < data.length; i++) {
+    data[i].hasRole = bool;
+    setAllCheckStatus(data[i].children || [], bool);
+    setAllCheckStatus(data[i].conditions || [], bool);
+    setAllCheckStatus(data[i].buttons || [], bool);
+    setAllCheckStatus(data[i].lists || [], bool);
+    setAllCheckStatus(data[i].links || [], bool);
+  }
+};
+const setAllCheckStatusInArr = (arr, bool) => {
+  for (let i = 0; i < arr.length; i++) {
+    arr[i].hasRole = bool;
+  }
+};
+const setPageRangeSubCheckStatus = (row, bool) => {
+  setAllCheckStatusInArr(row.children || [], bool);
+  setAllCheckStatusInArr(row.conditions || [], bool);
+  setAllCheckStatusInArr(row.buttons || [], bool);
+  setAllCheckStatusInArr(row.lists || [], bool);
+  setAllCheckStatusInArr(row.links || [], bool);
+};
+const pageRoleChange = (row) => {
+  console.log('rrr', row);
+  setPageRangeSubCheckStatus(row, row.hasRole);
+};
 const getDetail = async () => {
   let id = route.query.id;
   loading.value = true;

+ 1 - 1
src/views/user/auth-manage/user-manage/index.vue

@@ -83,7 +83,7 @@ const columns = [
             修改
           </t-link>
           <t-link
-            theme="primary"
+            theme={row.enable ? 'danger' : 'success'}
             hover="color"
             onClick={(e) => {
               e.stopPropagation();

+ 2 - 1
src/views/user/org-struct-manage/struct-manage/index.vue

@@ -3,6 +3,7 @@
     <div class="flex-1 page-wrap">
       <div class="btn-group">
         <t-button
+          v-perm="112"
           theme="success"
           @click="
             curRow = null;
@@ -69,7 +70,7 @@ const columns = [
             修改
           </t-link>
           <t-link
-            theme="primary"
+            theme={row.enable ? 'danger' : 'success'}
             hover="color"
             onClick={(e) => {
               e.stopPropagation();