duy преди 1 месец
родител
ревизия
38d28c14c4
променени са 2 файла, в които са добавени 155 реда и са изтрити 11 реда
  1. 4 2
      src/views/manager/projectinfo/list.vue
  2. 151 9
      src/views/manager/wbsinfo.vue

+ 4 - 2
src/views/manager/projectinfo/list.vue

@@ -966,7 +966,7 @@ export default {
 }
 .custom-ellipse-tag1{
    border-radius: 15px !important;
-  padding: 0 8px !important;
+  padding: 8px 8px !important;
   margin-right: 8px !important;
   height: 24px;
   line-height: 24px;
@@ -992,7 +992,9 @@ export default {
 .custom-tag-type-5 {
   background-color: #EC489A !important; /* 征拆 - 粉色 */
 }
-
+.custom-tag-type-6 {
+  background-color: blue !important; /* 征拆 - 粉色 */
+}
 /* 图标样式 */
 .custom-ellipse-tag .el-icon-success {
   margin-right: 4px;

+ 151 - 9
src/views/manager/wbsinfo.vue

@@ -20,8 +20,27 @@
       @refresh-change="refreshChange"
       @on-load="onLoad"
     >
-      <template slot="menuLeft">
-        <el-button
+
+      <template slot="menuRight">
+          <el-button
+          type="primary"
+          size="small"
+          icon="el-icon-delete"
+          plain
+      
+          @click="handleAdd"
+        >新增
+        </el-button>
+               <el-button
+          type="warning"
+          size="small"
+          icon="el-icon-sort"
+          plain
+     
+          @click="handleSort"
+        >排序
+        </el-button>
+            <el-button
           type="danger"
           size="small"
           icon="el-icon-delete"
@@ -30,8 +49,6 @@
           @click="handleDelete"
         >删 除
         </el-button>
-      </template>
-      <template slot="menuRight">
         <!-- 新增元素按钮 -->
         <el-button
           size="small"
@@ -62,6 +79,44 @@
           @click="toEdit(row,index)"
         >编辑wbs库</el-button>
       </template>
+       <template
+            slot-scope="{row}"
+            slot="wbsType"
+          >
+            <!-- <el-tag>{{ row.wbsType }}</el-tag> -->
+                <el-tag
+                  size="small"
+                  v-for="item in generateTagItems(row.wbsType)"
+                  :key="item.label"
+                  :type="item.type"
+                  effect="dark"
+                  class="mr-3 custom-ellipse-tag"
+                  :class="`custom-tag-type-${item.type}`"
+                  >
+                 
+                  {{ item.label }}
+                </el-tag>
+        
+          </template>
+          <template slot-scope="{row}" slot="projectInfoList">
+          
+                    <el-tooltip 
+                    v-for="item in row.projectInfoList" 
+                    :key="item.id"
+                    :content="item.projectName"
+                    placement="top"
+                    :disabled="item.projectName.length <= 10"
+                  >
+                    <el-tag  
+                      size="small" 
+                      type="info"   
+                      class="custom-ellipse-tag1 ellipsis-tag"
+                      
+                    >
+                      {{item.projectName}}
+                    </el-tag>
+                  </el-tooltip>
+          </template>
     </avue-crud>
   </basic-container>
 </template>
@@ -69,6 +124,7 @@
 <script>
 import { getList, getDetail, add, update, remove } from "@/api/manager/wbsinfo";
 import { mapGetters } from "vuex";
+  import { getDictionary } from "@/api/system/dict";
 
 export default {
   data () {
@@ -87,11 +143,12 @@ export default {
         height: 'auto',
         calcHeight: 30,
         tip: false,
-        searchShow: true,
         searchMenuSpan: 6,
+ 
         border: true,
         index: true,
         viewBtn: true,
+          addBtn: false,
         selection: true,
         dialogClickModal: false,
         column: [
@@ -100,10 +157,17 @@ export default {
             prop: "createTime",
             editDetail: true,
             addDisabled: true,
+               hide: true,
+      
           },
           {
             label: "wbs名称",
             prop: "wbsName",
+            search: true,
+            width: 180,
+        
+       
+       
             rules: [{
               required: true,
               message: "请输入wbs名称",
@@ -112,6 +176,14 @@ export default {
           },
           {
             label: "划分类型",
+            slot: true,
+              search: true,
+              width: 120,
+        
+          
+           
+           
+           
             type: "select",
             dicUrl: "/api/blade-system/dict/dictionary?code=wbs_type",
             props: {
@@ -124,11 +196,14 @@ export default {
               required: true,
               message: "请选择划分类型",
               trigger: "blur"
-            }]
+            }],
+           
           },
           {
             label: "是否启用",
             prop: "status",
+            hide: true,
+      
             rules: [{
               required: true,
               message: "是否启用",
@@ -146,10 +221,33 @@ export default {
               }
             ],
           },
+           {
+            label: "引用项目",
+            prop: "projectInfoList",
+            display: false,
+          
+        
+       
+       
+           slot:true,
+          },
+   
         ]
       },
       data: [],
+      search:{
+        wbsName: '',
+        wbsType: '',
+        projectId:''
+      },
+       wbsTypeList:[],
+       proJectList:[],
+
     };
+  },
+  created () {
+  
+
   },
   computed: {
     ...mapGetters(["permission"]),
@@ -170,7 +268,34 @@ export default {
     }
   },
   methods: {
-    //点击元素库
+  generateTagItems(wbsTypes){
+       const typeToLabelMap = {
+        1: '质检',
+        2: '试验',
+        3: '日志',
+        4: '计量',
+        5: '征拆',
+        6: '底层节点',
+       
+    };
+      let tagItems = [];
+         // 如果 wbsTypes 不是数组,则将其转换为数组
+    if (!Array.isArray(wbsTypes)) {
+        wbsTypes = [wbsTypes];
+    }
+      wbsTypes.forEach(type => {
+        // 检查type是否在映射关系中存在
+        if (typeToLabelMap.hasOwnProperty(type)) {
+            // 如果存在,则创建一个新的对象并添加到tagItems数组中
+            tagItems.push({
+                type: type,
+                label: typeToLabelMap[type]
+            });
+        }
+    });
+     return tagItems;
+  },
+      //点击元素库
     handleElement(){
       console.log('元素库');
       this.$router.push({
@@ -220,6 +345,10 @@ export default {
           });
         });
     },
+    handleAdd(row) {
+      
+        this.$refs.crud.rowAdd();
+      },
     handleDelete () {
       if (this.selectionList.length === 0) {
         this.$message.warning("请选择至少一条数据");
@@ -301,10 +430,23 @@ export default {
     //点击参数库
     handleParameter(){
        this.$router.push('/wbs/parameter');
-    }
+    },
+    //排序
+    handleSort(){
+
+    },
   }
 };
 </script>
 
-<style>
+<style scoped lang="scss">
+.search-box{
+  display: flex;
+  .search-item{
+    margin-right: 10px;
+    margin-left: 10px;
+  }
+ 
+}
+
 </style>