zhangh пре 3 година
родитељ
комит
57a18888fe
1 измењених фајлова са 24 додато и 14 уклоњено
  1. 24 14
      src/views/system/user.vue

+ 24 - 14
src/views/system/user.vue

@@ -81,11 +81,20 @@
                 @change="hetongChange(key)"
               >
                 <el-option
-                  v-for="item in fromss.projectAndUserList[key].dataInfo"
+                  v-for="(item,index) in fromss.projectAndUserList[key].dataInfo"
                   :key="item.id"
                   :label="item.contractName"
                   :value="item.id"
                 >
+                  <span style="float: left">{{ item.contractName }}</span>
+                  <el-button
+                    @click.stop="deleteProject(key,type,index)"
+                    style="float: right;margin-right:5px;margin-top:3px;"
+                    type="danger"
+                    size="mini"
+                    icon="el-icon-delete"
+                    circle
+                  ></el-button>
                 </el-option>
               </el-select>
               <el-input
@@ -1103,21 +1112,22 @@ export default {
       this.findProjectAndContractList(row.id)  //编辑获取参建项目
       this.$refs.crud.rowEdit(row, index)
     },
-    deleteProject (key, type) {//删除参建项目按钮
+    deleteProject (key, type, index) {//删除参建项目按钮
       if (type == 'add') {
-        this.fromss.projectAndUserList[key].dataInfo.forEach(val => {
-          if (val.id == this.fromss.projectAndUserList[key].contractId) {
-            if (this.fromss.projectAndUserList[key].dataInfo.length == 1) {
-              this.fromss.projectAndUserList.splice(this.fromss.projectAndUserList[key], 1)
-            } else {
-              this.fromss.projectAndUserList[key].roleName = this.fromss.projectAndUserList[key].dataInfo[1].roleName
-              this.fromss.projectAndUserList[key].contractName = this.fromss.projectAndUserList[key].dataInfo[1].id
-              this.fromss.projectAndUserList[key].contractId = this.fromss.projectAndUserList[key].dataInfo[1].id
-              this.fromss.projectAndUserList[key].dataInfo.splice(val, 1)
-            }
-          }
-        })
+        // this.fromss.projectAndUserList[key].dataInfo.forEach(val => {
+        //   if (val.id == this.fromss.projectAndUserList[key].contractId) {
+        //     if (this.fromss.projectAndUserList[key].dataInfo.length == 1) {
+        //       this.fromss.projectAndUserList.splice(this.fromss.projectAndUserList[key], 1)
+        //     } else {
+        //       this.fromss.projectAndUserList[key].roleName = this.fromss.projectAndUserList[key].dataInfo[1].roleName
+        //       this.fromss.projectAndUserList[key].contractName = this.fromss.projectAndUserList[key].dataInfo[1].id
+        //       this.fromss.projectAndUserList[key].contractId = this.fromss.projectAndUserList[key].dataInfo[1].id
+        //       this.fromss.projectAndUserList[key].dataInfo.splice(val, 1)
+        //     }
+        //   }
+        // })
 
+        this.fromss.projectAndUserList[key].dataInfo[index]
       } else {
         this.removeUsersByIds(this.fromss.projectAndUserList[key].contractName)
       }