|
|
@@ -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>
|
|
|
|