|
|
@@ -1,55 +1,73 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
<!-- 项目关联-->
|
|
|
- <el-dialog v-model='showRelation'
|
|
|
- append-to-body
|
|
|
- center
|
|
|
- title="关联子项目"
|
|
|
- width="65%"
|
|
|
- @close="close"
|
|
|
+ <el-dialog
|
|
|
+ v-model="showRelationLocal"
|
|
|
+ append-to-body
|
|
|
+ center
|
|
|
+ title="关联子项目"
|
|
|
+ width="65%"
|
|
|
+ @close="close"
|
|
|
>
|
|
|
- <avue-crud ref="crud"
|
|
|
- v-model="form"
|
|
|
- v-model:page="page"
|
|
|
- :before-open="beforeOpen"
|
|
|
- :data="data"
|
|
|
- :option="option"
|
|
|
- :permission="permissionList"
|
|
|
- :table-loading="loading"
|
|
|
- class="curd"
|
|
|
- @row-del="rowDel"
|
|
|
- @current-change="currentChange"
|
|
|
- @size-change="sizeChange"
|
|
|
- @refresh-change="refreshChange"
|
|
|
- @on-load="onLoad">
|
|
|
+ <avue-crud
|
|
|
+ ref="crud"
|
|
|
+ v-model="form"
|
|
|
+ v-model:page="page"
|
|
|
+ :before-open="beforeOpen"
|
|
|
+ :data="data"
|
|
|
+ :option="option"
|
|
|
+ :permission="permissionList"
|
|
|
+ :table-loading="loading"
|
|
|
+ class="curd"
|
|
|
+ @row-del="rowDel"
|
|
|
+ @current-change="currentChange"
|
|
|
+ @size-change="sizeChange"
|
|
|
+ @refresh-change="refreshChange"
|
|
|
+ @on-load="onLoad"
|
|
|
+ >
|
|
|
</avue-crud>
|
|
|
</el-dialog>
|
|
|
<!-- 新增关联项目-->
|
|
|
- <el-dialog v-model='showAdd'
|
|
|
- append-to-body
|
|
|
- center
|
|
|
- title="新增关联项目"
|
|
|
- width="65%">
|
|
|
+ <el-dialog
|
|
|
+ v-model="showAdd"
|
|
|
+ append-to-body
|
|
|
+ center
|
|
|
+ title="新增关联项目"
|
|
|
+ width="65%"
|
|
|
+ >
|
|
|
<div class="flex flex-col">
|
|
|
<el-input
|
|
|
- v-model="keyWords"
|
|
|
- clearable
|
|
|
- placeholder="项目信息快速搜索"
|
|
|
- prefix-icon="Search"
|
|
|
- @keydown="searchPro"
|
|
|
+ v-model="keyWords"
|
|
|
+ clearable
|
|
|
+ placeholder="项目信息快速搜索"
|
|
|
+ prefix-icon="Search"
|
|
|
+ @keydown="searchPro"
|
|
|
/>
|
|
|
</div>
|
|
|
- <div class="hide-scrollbar full-width" style="height: 30vh;overflow-x: scroll">
|
|
|
+ <div
|
|
|
+ class="hide-scrollbar full-width"
|
|
|
+ style="height: 30vh; overflow-x: scroll"
|
|
|
+ >
|
|
|
<!-- <div v-if='attaches.length === 0' class='full-width flex flex-center '>-->
|
|
|
<!-- <el-empty image-size='100'/>-->
|
|
|
<!-- </div>-->
|
|
|
<div class="flex flex-justify-between mt-20 flex-center">
|
|
|
- <span class="bold font-15 grey ml-5 ">搜索结果</span>
|
|
|
+ <span class="bold font-15 grey ml-5">搜索结果</span>
|
|
|
</div>
|
|
|
- <el-divider/>
|
|
|
- <div class="flex flex-center flex-justify-between mt-5" v-for="item in proList" :key="item.id">
|
|
|
+ <el-divider />
|
|
|
+ <div
|
|
|
+ class="flex flex-center flex-justify-between mt-5"
|
|
|
+ v-for="item in proList"
|
|
|
+ :key="item.id"
|
|
|
+ >
|
|
|
<span class="bold">{{ item.name }}</span>
|
|
|
- <baseButton icon="Lock" title="关联" type="0" width="60" @click="connectProject(item)"/>
|
|
|
+ <baseButton
|
|
|
+ icon="Lock"
|
|
|
+ title="关联"
|
|
|
+ type="0"
|
|
|
+ width="60"
|
|
|
+ @click="connectProject(item)"
|
|
|
+ />
|
|
|
</div>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
@@ -68,18 +86,23 @@ export default {
|
|
|
type: Boolean,
|
|
|
default: false
|
|
|
},
|
|
|
- projectId: ''
|
|
|
+ projectId: {
|
|
|
+ type: String,
|
|
|
+ default: ''
|
|
|
+ }
|
|
|
},
|
|
|
watch: {
|
|
|
showRelation: {
|
|
|
- handler (val) {
|
|
|
+ handler(val) {
|
|
|
console.log(val)
|
|
|
+ this.showRelationLocal = val
|
|
|
},
|
|
|
immediate: true
|
|
|
}
|
|
|
},
|
|
|
- data () {
|
|
|
+ data() {
|
|
|
return {
|
|
|
+ showRelationLocal: false,
|
|
|
showAdd: false,
|
|
|
data: [],
|
|
|
form: {},
|
|
|
@@ -106,7 +129,8 @@ export default {
|
|
|
prop: 'name',
|
|
|
addDisplay: false,
|
|
|
editDisplay: false
|
|
|
- }]
|
|
|
+ }
|
|
|
+ ]
|
|
|
},
|
|
|
page: {
|
|
|
size: 10,
|
|
|
@@ -118,34 +142,33 @@ 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.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
|
|
|
- })
|
|
|
+ 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'
|
|
|
- }
|
|
|
- )
|
|
|
- .then((res) => {
|
|
|
+ ElMessageBox.confirm('点击确定将解除项目绑定关系?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
console.log(res)
|
|
|
this.$api.project.removeContact({ id: this.form.id }).then(res => {
|
|
|
if (res.code === 200) {
|
|
|
@@ -156,8 +179,7 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
- .catch(() => {
|
|
|
- })
|
|
|
+ .catch(() => {})
|
|
|
} else if (type === 'view') {
|
|
|
this.$router.push({
|
|
|
path: '/home/pro_detail',
|
|
|
@@ -165,44 +187,47 @@ export default {
|
|
|
})
|
|
|
} else if (type === 'add') {
|
|
|
this.showAdd = true
|
|
|
- this.showRelation = false
|
|
|
+ this.showRelationLocal = 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 () {
|
|
|
+ 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.filter(sub => sub.id !== this.projectId)
|
|
|
- }
|
|
|
- })
|
|
|
+ this.$api.project
|
|
|
+ .projectList(this.page.current, this.page.size, data)
|
|
|
+ .then(res => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.proList = res.data.records.filter(
|
|
|
+ sub => sub.id !== this.projectId
|
|
|
+ )
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
- connectProject (item) {
|
|
|
+ connectProject(item) {
|
|
|
const params = {
|
|
|
projectId: this.projectId,
|
|
|
childrenIdList: [item.id]
|
|
|
@@ -221,6 +246,4 @@ export default {
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
-<style scoped>
|
|
|
-
|
|
|
-</style>
|
|
|
+<style scoped></style>
|