Преглед изворни кода

修改资产分类 添加首页菜单

liuyanpeng пре 1 година
родитељ
комит
51684a8717

+ 5 - 0
src/client/MenuWidget.vue

@@ -26,6 +26,11 @@
         </div>
 
         <ul class="nav menu-nav side-menu">
+          <li>
+            <a href="#/desktop/dashboard">
+              <i class="fa fa-home" /> <span>首页</span>
+            </a>
+          </li>
           <template v-for="rootNode in rootNodes">
             <li
               v-if="rootNode.show"

+ 4 - 4
src/index.js

@@ -74,9 +74,9 @@ import CreateIdentity  from '../src/identity/CreateIdentity.vue';
 import SamlLogin  from './client/SamlLogin.vue';
 import CasLogin  from './client/CasLogin.vue';
 import PrinterConfiguration from '../src/printer/PrinterConfiguration.vue';
-import window1 from './window/Window.vue';
-import TabFormEdit1 from './window/tabFormView/TabFormEdit.vue';
-import TabFormView1 from './window/tabFormView/TabFormView.vue';
+import Window1 from './window1/Window.vue';
+import TabFormEdit1 from './window1/tabFormView/TabFormEdit.vue';
+import TabFormView1 from './window1/tabFormView/TabFormView.vue';
 
 export {
   App,
@@ -141,7 +141,7 @@ export {
   IdentityManager,
   CreateIdentity,
   PrinterConfiguration,
-  window1,
+  Window1,
   TabFormEdit1,
   TabFormView1,
 };

+ 89 - 28
src/window1/tabGridView/AddAssets.vue

@@ -25,8 +25,15 @@
             </a-radio-button>
           </a-radio-group>
           <div style="display: flex; align-items: center">
-            <a-input />
-            <span style="margin-left: 8px; width: 100px">类目搜索</span>
+            <a-select
+              v-model:value="searchName"
+              show-search
+              :allow-clear="true"
+              :options="options"
+              placeholder="请选择分类"
+              style="width: 380px"
+            />
+            <span style="margin: 0 16px 0 8px">类目搜索</span>
           </div>
         </div>
       </a-layout-header>
@@ -64,22 +71,22 @@
                   class="list-item"
                 >
                   <div class="left fl">
-                    {{ item.parent }}
+                    <span class="parent_name">{{ item.parent }}</span>
                     <span class="jt_icon"> > </span>
                   </div>
                   <div class="right fl">
                     <ul>
-                      <template v-if="item.children">
+                      <template v-if="item.children && item.children.length">
                         <li
                           v-for="(asset, index1) in item.children"
                           :key="index1"
                           @click="selectAsset(asset)"
                         >
-                          {{ asset }}
+                          {{ asset.text }}
                         </li>
                       </template>
                       <template v-else>
-                        <li />
+                        <li><span>&nbsp;</span></li>
                       </template>
                     </ul>
                   </div>
@@ -109,6 +116,8 @@ const list = ref([]);
 const openKeys = ref([]);
 const selectedKeys1 = ref([]);
 const menuList = ref([]);
+const searchName = ref([]);
+const options = ref([]);
 
 const emit = defineEmits(['getStepInfo', 'getAllName']);
 const props = defineProps({
@@ -129,8 +138,11 @@ const selectedKeys = ref([]);
 // 菜单一级目录
 const assetItems = ref([]);
 
-// 所有资产分类数据
-const assetCategorys = ref([]);
+// 通用资产分类数据
+const assetCommonCategorys = ref([]);
+
+// 明细资产分类数据
+const assetDetailCategorys = ref([]);
 
 const secondMenu = ref([]);
 
@@ -144,23 +156,20 @@ const allName = ref('');
 const addNewAssets = () => {
   step.value = '1';
   emit('getStepInfo', '1');
-  getAssetCategorys();
+  getCommonAssetCategorys();
+  getDetailAssetCategorys();
 };
 
 // 当通用资产切换类别时获取对应的子分类
 const changeAssets = key => {
-  const thirdMenu = [];
   secondMenu.value = [];
-  assetCategorys.value.forEach(item => {
+  assetCommonCategorys.value.forEach(item => {
     if (item.id === key) {
       if (item.children && item.children.length > 0) {
         item.children.forEach((child, index) => {
           if (child.children && child.children.length > 0) {
-            child.children.forEach(child1 => {
-              thirdMenu.push(child1.text);
-            });
             secondMenu.value.push({ parent: child.text });
-            secondMenu.value[index].children = thirdMenu;
+            secondMenu.value[index].children = child.children;
           } else {
             secondMenu.value.push({ parent: child.text });
           }
@@ -168,6 +177,9 @@ const changeAssets = key => {
       }
     }
   });
+  const parentDiv = document.querySelector('.item-list');
+  const childDiv = parentDiv.querySelector('.ul_list');
+  childDiv.scrollIntoView({ behavior: 'smooth', block: 'start' });
 };
 
 // 处理明细资产分类数据
@@ -199,7 +211,7 @@ const changeDetailAsset = key => {
   let listMenu = [];
   assetName.value = '';
   allName.value = '';
-  assetCategorys.value.forEach(item => {
+  assetDetailCategorys.value.forEach(item => {
     if (item.children && item.children.length) {
       item.children.forEach(child => {
         if (child.id === key) {
@@ -219,24 +231,28 @@ const changeDetailAsset = key => {
   isFirst.value = false;
 };
 
+// 获取通用所选资产
+const selectAsset = record => {
+  console.log(record, '通用资产所选数据------');
+  emit('getStepInfo', step.value, record.text, record);
+};
+
 // 获取明细所选资产
-const getAssetName = name => {
+const getAssetName = (name,record) => {
   if (name) {
     allName.value = '';
     allName.value = assetName.value + '->' + name;
   }
-  emit('getStepInfo', step.value, allName.value);
-};
-
-// 获取当前所选资产
-const selectAsset = asset => {
-  emit('getStepInfo', step.value, asset);
+  console.log(record, '明细资产所选数据------');
+  emit('getStepInfo', step.value, allName.value, record);
 };
 
-// 获取分类数据
-const getAssetCategorys = () => {
+// 获取通用分类数据
+const getCommonAssetCategorys = () => {
   $.ajax({
-    url: Common.getApiURL('AssetCategoryResource/listRootSubAssetCategorys'),
+    url: Common.getApiURL(
+      'AssetCategoryResource/listAssetCategorysByCategory?type=CommonlyUsedClassifications',
+    ),
     type: 'get',
 
     dataType: 'json',
@@ -254,8 +270,32 @@ const getAssetCategorys = () => {
           assetItems.value[index].title = item.text;
         });
         selectedKeys.value.push(data.datas[0].id);
-        assetCategorys.value = data.datas;
+        assetCommonCategorys.value = data.datas;
         changeAssets(data.datas[0].id);
+      } else {
+        message.warning(data.errorMessage);
+      }
+    },
+    error: function (XMLHttpRequest, textStatus, errorThrown) {
+      Common.processException(XMLHttpRequest, textStatus, errorThrown);
+    },
+  });
+};
+// 获取明细分类数据
+const getDetailAssetCategorys = () => {
+  $.ajax({
+    url: Common.getApiURL(
+      'AssetCategoryResource/listAssetCategorysByCategory?type=ItemizedClassification',
+    ),
+    type: 'get',
+
+    dataType: 'json',
+    beforeSend: function (request) {
+      Common.addTokenToRequest(request);
+    },
+    success: function (data) {
+      if (data.errorCode === 0 && data.datas.length > 0) {
+        assetDetailCategorys.value = data.datas;
         getDetailData(data.datas);
       } else {
         message.warning(data.errorMessage);
@@ -376,9 +416,16 @@ watch(
   line-height: 40px;
 }
 .ul_list li .left {
-  width: 130px;
+  width: 160px;
   padding: 0 10px 0 16px;
   color: #777;
+  display: flex;
+}
+.left > .parent_name {
+  width: 150px;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
 }
 .ul_list li .right {
   width: 440px;
@@ -406,4 +453,18 @@ watch(
   height: 430px;
   overflow: auto;
 }
+:deep(.ant-menu-light .ant-menu-submenu-selected > .ant-menu-submenu-title) {
+  color: #277fd0;
+}
+:deep(.ant-menu-item) {
+  height: 24px;
+  line-height: 24px;
+  border-radius: 4px;
+  /* text-align: center;
+  padding-left: 12px !important; */
+}
+:deep(.ant-menu-item-selected) {
+  color: #fff;
+  background-color: #3e9aef !important;
+}
 </style>

+ 10 - 5
src/window1/tabGridView/AssetList.vue

@@ -1,7 +1,7 @@
 <template>
   <div>
     <div class="asset_list">
-      <ul>
+      <ul class="name_list">
         <li
           v-for="(item, index) in treeData"
           :key="index"
@@ -14,7 +14,7 @@
       </ul>
     </div>
     <div class="asset_list">
-      <ul>
+      <ul class="name_list">
         <li
           v-for="(item, index) in menu1"
           :key="index"
@@ -27,7 +27,7 @@
       </ul>
     </div>
     <div class="asset_list">
-      <ul>
+      <ul class="name_list">
         <li
           v-for="(item, index) in menu2"
           :key="index"
@@ -90,7 +90,7 @@ const setCurrentIndex = (index, record, flag) => {
   if (assetName2.value && assetName3.value) {
     name = `${assetName1.value}->${assetName2.value}->${assetName3.value}`;
   }
-  emits('getAssetName', name);
+  emits('getAssetName', name, record);
 };
 const clearData = () => {
   menu1.value = [];
@@ -107,6 +107,9 @@ watch(
   (newVal, oldVal) => {
     if (newVal !== oldVal || newVal.length === 0) {
       clearData();
+      const parentDiv = document.querySelector('.asset_list');
+      const childDiv = parentDiv.querySelector('.name_list');
+      childDiv.scrollIntoView({ behavior: 'smooth', block: 'start' });
     }
   },
 );
@@ -115,15 +118,17 @@ watch(
 <style scoped>
 .asset_list {
   width: 33.3%;
-  height: 91%;
+  height: 430px;
   float: left;
   border-right: 1px solid #ccc;
   -webkit-box-sizing: border-box;
   -moz-box-sizing: border-box;
   box-sizing: border-box;
   overflow-x: hidden;
+  overflow: auto;
 }
 .asset_list > ul {
+  height: 430px;
   padding: 0;
   margin: 0;
   list-style: none;

+ 0 - 6
src/window1/tabGridView/GridColumnDef.vue

@@ -184,12 +184,6 @@ ul label {
     cursor: pointer;
 }
 .table_style{
-  margin-left: 4px;
   cursor: pointer;
-  padding: 1px 6px;
-}
-.table_style:hover{
-  border: 1px solid #ddd;
-  border-radius: 4px;
 }
 </style>

+ 1 - 1
src/window1/tabGridView/SubMenu.vue

@@ -4,7 +4,7 @@
       <template #title>{{ item.name }}</template>
       <sub-menu :key="item.key" :menu-info="item.children" />
     </a-sub-menu>
-    <a-menu-item v-else :key="item.key" @click="getAsset(item)">
+    <a-menu-item v-else :key="item.id" @click="getAsset(item)">
       {{ item.name }}
     </a-menu-item>
   </template>

+ 36 - 11
src/window1/tabGridView/TabGridEdit.vue

@@ -130,13 +130,18 @@
                 }}
               </span>
             </a-breadcrumb-item>
-
-            <GridColumnDef
-              :window-no="windowNo"
-              :tab-index="tabIndex"
-              :tab-grid-fields="tabGridFields"
-              @property-changed="propertyChanged($event)"
-            />
+            <a-breadcrumb-item>
+              <GridColumnDef
+                :window-no="windowNo"
+                :tab-index="tabIndex"
+                :tab-grid-fields="tabGridFields"
+                @property-changed="propertyChanged($event)"
+              />
+            </a-breadcrumb-item>
+            <a-breadcrumb-item>
+              <idcard-two-tone />
+              <span> 添加验收人 </span>
+            </a-breadcrumb-item>
           </a-breadcrumb>
           <a-breadcrumb v-if="nowTab === 'running'" separator="|">
             <a-breadcrumb-item>
@@ -422,6 +427,7 @@ import { Notify, Uuid } from 'pc-component-v3';
 import WindowTab from './WindowTab.vue';
 import AddAssets from './AddAssets.vue';
 
+import { message } from 'ant-design-vue';
 import {
   PlusCircleTwoTone,
   PlusSquareTwoTone,
@@ -432,6 +438,7 @@ import {
   AppstoreTwoTone,
   CheckSquareTwoTone,
   CloseCircleTwoTone,
+  IdcardTwoTone,
 } from '@ant-design/icons-vue';
 
 export default {
@@ -453,6 +460,7 @@ export default {
     AppstoreTwoTone,
     CheckSquareTwoTone,
     CloseCircleTwoTone,
+    IdcardTwoTone,
     AddAssets,
   },
   props: {
@@ -469,8 +477,9 @@ export default {
       window: {},
       tabIndex: null,
       step: '0',
-      nowTab: 'waiting',
-      nowAsset: '',
+      nowTab: 'waiting', // 当前是哪个阶段
+      nowAsset: '', // 所选资产分类名称
+      selectCategory:null, //所选资产分类数据
       tab: {},
       tabGridFields: [],
       modelDatas: [],
@@ -788,9 +797,10 @@ export default {
     },
 
     // 获取新增步骤信息
-    getStepInfo: function (step, selected) {
+    getStepInfo: function (step, selected,record) {
       this.step = step;
       this.nowAsset = selected;
+      this.selectCategory = record;
     },
 
     // 取消创建资产
@@ -799,7 +809,16 @@ export default {
       // this.step = '0';
     },
     // 确认创建资产
-    confirmCreate: function () {},
+    confirmCreate: function () {
+      if(!this.selectCategory){
+        message.warning('请您先选择资产分类!');
+        return;
+      }
+      if(this.selectCategory.children && this.selectCategory.children.length){
+        message.warning('请您选择最后一级的资产分类!');
+        return;
+      }
+    },
     /**
      * 删除草稿数据
      * @author GuoZhiBo 20211008
@@ -2090,4 +2109,10 @@ export default {
   padding-right: 8px;
   padding-left: 8px;
 }
+:deep(.ant-breadcrumb-link > .btn-group) {
+  margin-top: -2px;
+}
+:deep(.ant-pagination-options-quick-jumper) {
+  margin-right: -18px !important;
+}
 </style>

+ 4 - 1
src/window1/tabView/TabButton.vue

@@ -994,11 +994,14 @@ export default {
 .floatTop {
   z-index: 1002;
 }
-:deep(.btn-group > .btn:first-child) {
+:deep(.btn-group) {
   margin: -2px;
 }
 .tab_button {
   color: black;
   margin-left: 4px;
 }
+:deep(.ant-breadcrumb-link :first-child){
+  color: #4ca4f7;
+}
 </style>