scorpio преди 2 години
родител
ревизия
feadf94cb8
променени са 3 файла, в които са добавени 60 реда и са изтрити 56 реда
  1. 4 3
      src/views/home/component/dash.vue
  2. 4 1
      src/views/home/component/pro_left.vue
  3. 52 52
      src/views/home/component/pro_relation.vue

+ 4 - 3
src/views/home/component/dash.vue

@@ -262,7 +262,7 @@ export default {
       projectForm: {
         name: '',
         totalAmount: '',
-        projectType: '',
+        projectType: '1602565634250186753',
         tags: '',
         introduction: ''
       },
@@ -302,6 +302,7 @@ export default {
       }
       this.onLoad(Object.assign(this.owerQuery, this.projectStageQuery))
     })
+    this.getTypeList()
   },
   unmounted () {
     sessionStorage.removeItem('selectList')
@@ -343,7 +344,7 @@ export default {
       } else if (type === 'view') {
         this.$router.push({
           path: '/home/pro_detail',
-          query: { id: this.form.id, projectStage: this.form.projectStage }
+          query: { id: this.form.id, projectStage: this.form.project_stage }
         })
       }
     },
@@ -361,7 +362,7 @@ export default {
       getLazyList(tree.id).then(res => {
         this.loading = false
         resolve(res.data.data.childrenList.map(e => {
-          e.projectStage = e.projectStage.toString()
+          e.project_stage = e.project_stage.toString()
           return e
         }))
       })

+ 4 - 1
src/views/home/component/pro_left.vue

@@ -42,7 +42,7 @@
         </div>
       </div>
     </div>
-    <pro-relation :showRelation="showRelation" :projectId="data.id" @close="showRelation = false"/>
+    <pro-relation :showRelation="showRelation" :projectId="data.id" @close="showRelation = false" @success='updateLot'/>
   </div>
 </template>
 
@@ -153,6 +153,9 @@ export default {
         }
       })
     },
+    updateLot (count) {
+      this.data.lot = count
+    },
     change (index) {
       this.active = index
       this.$emit('change', index)

+ 52 - 52
src/views/home/component/pro_relation.vue

@@ -57,12 +57,12 @@
 </template>
 
 <script>
-import baseButton from "@/components/base-button.vue";
-import {ElMessageBox} from 'element-plus'
+import baseButton from '@/components/base-button.vue'
+import { ElMessageBox } from 'element-plus'
 
 export default {
-  name: "pro_relation",
-  components: {baseButton},
+  name: 'pro_relation',
+  components: { baseButton },
   props: {
     showRelation: {
       type: Boolean,
@@ -72,13 +72,13 @@ export default {
   },
   watch: {
     showRelation: {
-      handler(val) {
+      handler (val) {
         console.log(val)
       },
       immediate: true
-    },
+    }
   },
-  data() {
+  data () {
     return {
       showAdd: false,
       data: [],
@@ -106,7 +106,7 @@ export default {
             prop: 'name',
             addDisplay: false,
             editDisplay: false
-          },]
+          }]
       },
       page: {
         size: 10,
@@ -118,92 +118,92 @@ export default {
     }
   },
   methods: {
-    close() {
+    close () {
       this.$emit('close')
     },
-    onLoad(query = {}) {
+    onLoad (query = {}) {
       this.loading = true
-      this.$api.project.childrenList({parentId: this.projectId}).then(res => {
+      this.$api.project.childrenList({ parentId: this.projectId }).then(res => {
         this.loading = false
         if (res.code === 200) {
           this.data = res.data.childrenList
           this.page.total = res.data.total
+          this.$emit('success', this.page.total)
         }
       }).finally(() => {
         this.loading = false
       })
     },
-    beforeOpen(done, type) {
+    beforeOpen (done, type) {
       if (['edit'].includes(type)) {
         ElMessageBox.confirm(
-            '点击确定将解除项目绑定关系?',
-            '提示',
-            {
-              confirmButtonText: '确定',
-              cancelButtonText: '取消',
-              type: 'warning',
-            }
+          '点击确定将解除项目绑定关系?',
+          '提示',
+          {
+            confirmButtonText: '确定',
+            cancelButtonText: '取消',
+            type: 'warning'
+          }
         )
-            .then((res) => {
-              console.log(res)
-              this.$api.project.removeContact({id: this.form.id}).then(res => {
-                if (res.code === 200) {
-                  this.onLoad()
-                  this.$message.success(res.msg)
-                } else {
-                  this.$message.error(res.msg)
-                }
-              })
-            })
-            .catch(() => {
+          .then((res) => {
+            console.log(res)
+            this.$api.project.removeContact({ id: this.form.id }).then(res => {
+              if (res.code === 200) {
+                this.onLoad()
+                this.$message.success(res.msg)
+              } else {
+                this.$message.error(res.msg)
+              }
             })
-
+          })
+          .catch(() => {
+          })
       } else if (type === 'view') {
         this.$router.push({
           path: '/home/pro_detail',
-          query: {id: this.form.id}
+          query: { id: this.form.id }
         })
       } else if (type === 'add') {
         this.showAdd = true
         this.showRelation = false
       }
     },
-    currentChange(currentPage) {
+    currentChange (currentPage) {
       this.page.current = currentPage
     },
-    sizeChange(pageSize) {
+    sizeChange (pageSize) {
       this.page.size = pageSize
     },
-    refreshChange() {
+    refreshChange () {
       this.onLoad()
     },
-    rowDel(row) {
+    rowDel (row) {
       this.$confirm('确定删除选择的项目?', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning'
       })
-          .then(() => {
-            this.$api.project.projectRemove({ids: row.id}).then(res => {
-              if (res.code === 200) {
-                this.$message.success(res.msg)
-                this.onLoad()
-              } else {
-                this.$message.error(res.msg)
-              }
-            })
+        .then(() => {
+          this.$api.project.projectRemove({ ids: row.id }).then(res => {
+            if (res.code === 200) {
+              this.$message.success(res.msg)
+              this.onLoad()
+            } else {
+              this.$message.error(res.msg)
+            }
           })
+        })
     },
-    searchPro() {
-      const data = {projectName: this.keyWords}
+    searchPro () {
+      const data = { projectName: this.keyWords }
       this.$api.project.projectList(this.page.current, this.page.size, data).then(res => {
         if (res.code === 200) {
-          this.proList = res.data.records
+          this.proList = res.data.records.filter(sub => sub.id !== this.projectId)
         }
       })
     },
-    connectProject(item) {
-      let params = {
+    connectProject (item) {
+      const params = {
         projectId: this.projectId,
         childrenIdList: [item.id]
       }
@@ -217,7 +217,7 @@ export default {
         }
       })
     }
-  },
+  }
 }
 </script>