2 changed files with 24 additions and 251 deletions
@ -1,204 +0,0 @@ |
|||||
<template> |
|
||||
<div> |
|
||||
<el-table :data="tableData" row-key="id" v-loading="tableLoading" border |
|
||||
:header-cell-style="{background:'#2195FE',color:'#FFFFFF'}" style="width: 100%" class="resi-table"> |
|
||||
<el-table-column label="序号" type="index" align="center" width="50"> |
|
||||
</el-table-column> |
|
||||
<el-table-column prop="name" label="党员中心户" align="center" width="100"> |
|
||||
<template slot-scope="scope"> |
|
||||
<el-select v-model="scope.row.partyResiId" placeholder="请选择"> |
|
||||
<el-option v-for="item in optionsParty" :key="item.value" :label="item.name" |
|
||||
:value="item.value"> |
|
||||
</el-option> |
|
||||
</el-select> |
|
||||
</template> |
|
||||
</el-table-column> |
|
||||
<el-table-column prop="mobile" label="联系家庭" align="center" min-width="160"> |
|
||||
<template slot-scope="scope"> |
|
||||
<el-select v-model="scope.row.houseIds" multiple placeholder="请选择"> |
|
||||
<el-option v-for="item in options" :key="item.id" :label="item.name" :value="item.id"> |
|
||||
</el-option> |
|
||||
</el-select> |
|
||||
</template> |
|
||||
</el-table-column> |
|
||||
<el-table-column fixed="right" label="操作" align="center" width="200"> |
|
||||
<template slot-scope="scope"> |
|
||||
<el-button @click="edit(scope.row)" v-if="scope.row.id" type="text" size="small" |
|
||||
class="btn-color-look">修改</el-button> |
|
||||
<el-button @click="del(scope.row)" v-if="scope.row.id" type="text" size="small" |
|
||||
class="btn-color-look">删除</el-button> |
|
||||
<el-button @click="save(scope.row)" v-if="!scope.row.id" type="text" size="small" |
|
||||
class="btn-color-look">保存</el-button> |
|
||||
<el-button @click="cancel(scope.row)" v-if="!scope.row.id" type="text" size="small" |
|
||||
class="btn-color-look">取消</el-button> |
|
||||
</template> |
|
||||
</el-table-column> |
|
||||
</el-table> |
|
||||
</div> |
|
||||
</template> |
|
||||
<script> |
|
||||
import axios from 'axios' |
|
||||
import { |
|
||||
mapGetters |
|
||||
} from 'vuex' |
|
||||
export default { |
|
||||
data() { |
|
||||
return { |
|
||||
tableLoading: false, |
|
||||
tableData: [], |
|
||||
addData: { |
|
||||
id: "", |
|
||||
partyResiId: "", |
|
||||
houseIds: [] |
|
||||
}, |
|
||||
options: [], |
|
||||
optionsParty: [], |
|
||||
searchH: 0, |
|
||||
agencyId: "", |
|
||||
partyOrgId: "", |
|
||||
groupmemberShow: false, |
|
||||
} |
|
||||
}, |
|
||||
props: {}, |
|
||||
computed: { |
|
||||
// ...mapGetters(['clientHeight', 'iframeHeight']), |
|
||||
// tableHeight() { |
|
||||
// const h = this.clientHeight - this.searchH - 490 + this.iframeHeigh |
|
||||
// const _h = this.clientHeight - 490 - this.searchH |
|
||||
// return this.$store.state.inIframe ? h : _h |
|
||||
// } |
|
||||
}, |
|
||||
components: {}, |
|
||||
methods: { |
|
||||
initForm(agencyId, id) { |
|
||||
this.agencyId = agencyId, |
|
||||
this.partyOrgId = id; |
|
||||
// this.tableLoading = true |
|
||||
this.getTableData(); |
|
||||
this.getOption() |
|
||||
this.getOptionParty() |
|
||||
// this.getGridList('query') |
|
||||
}, |
|
||||
// 查询列表 |
|
||||
async getTableData() { |
|
||||
this.tableLoading = true |
|
||||
let params = { |
|
||||
icPartyOrgId: this.partyOrgId |
|
||||
} |
|
||||
await this.$http.get('/resi/partymember/icPartyMemberCenter/selectList', { |
|
||||
params: params |
|
||||
}).then(({ |
|
||||
data: res |
|
||||
}) => { |
|
||||
console.log(res) |
|
||||
if (res.code !== 0) { |
|
||||
return this.$message.error(res.internalMsg ? res.internalMsg : res.msg ? res.msg : |
|
||||
'查询失败') |
|
||||
} else { |
|
||||
this.tableData = res.data.map(item => ({ |
|
||||
id: item.id, |
|
||||
partyResiId: item.partyResiId, |
|
||||
houseIds: item.houseIds.split(",") |
|
||||
})) |
|
||||
this.tableData.push({ |
|
||||
id: "", |
|
||||
partyResiId: "", |
|
||||
houseIds: [] |
|
||||
}) |
|
||||
} |
|
||||
}).catch(() => {}) |
|
||||
this.tableLoading = false |
|
||||
}, |
|
||||
getOptionParty() { |
|
||||
let query = { |
|
||||
agencyId: this.agencyId |
|
||||
} |
|
||||
this.$http.post('/epmetuser/icresiuser/userListByAgency', query).then(({ |
|
||||
data: res |
|
||||
}) => { |
|
||||
this.optionsParty = res.data |
|
||||
}).catch(() => {}) |
|
||||
}, |
|
||||
getOption() { |
|
||||
let query = { |
|
||||
agencyId: this.agencyId |
|
||||
} |
|
||||
this.$http.post('/gov/org/ichouse/getPartyHouseList', query).then(({ |
|
||||
data: res |
|
||||
}) => { |
|
||||
this.options = res.data |
|
||||
}).catch(() => {}) |
|
||||
}, |
|
||||
selectUser(partyResiId) { |
|
||||
this.groupmemberShow = true; |
|
||||
this.$nextTick(() => { |
|
||||
this.$refs.ref_groupmember.initForm(this.agencyId, this.partyOrgId, partyResiId) |
|
||||
}) |
|
||||
}, |
|
||||
groupmemberCancle() { |
|
||||
this.groupmemberShow = false; |
|
||||
}, |
|
||||
choose(query) { |
|
||||
this.tableData.push({ |
|
||||
name: query.name, |
|
||||
partyResiId: query.value |
|
||||
}) |
|
||||
}, |
|
||||
save(row) { |
|
||||
let arr = [...this.tableData]; |
|
||||
arr.splice(arr.length - 1, 1); |
|
||||
if (JSON.stringify(arr).indexOf(row.partyResiId) > -1) { |
|
||||
return this.$message.error("这条数据已经存在") |
|
||||
} else { |
|
||||
let houseIds = row.houseIds.join(",") |
|
||||
let query = { |
|
||||
icPartyOrgId: this.partyOrgId, |
|
||||
partyResiId: row.partyResiId, |
|
||||
houseIds: houseIds |
|
||||
} |
|
||||
this.$http.post('/resi/partymember/icPartyMemberCenter/save', query).then(({ |
|
||||
data: res |
|
||||
}) => { |
|
||||
this.getTableData() |
|
||||
}).catch(() => {}) |
|
||||
} |
|
||||
}, |
|
||||
edit(row) { |
|
||||
console.log(row) |
|
||||
let houseIds = row.houseIds.join(",") |
|
||||
let query = { |
|
||||
id: row.id, |
|
||||
icPartyOrgId: this.partyOrgId, |
|
||||
partyResiId: row.partyResiId, |
|
||||
houseIds: houseIds |
|
||||
} |
|
||||
this.$http.post('/resi/partymember/icPartyMemberCenter/update', query).then(({ |
|
||||
data: res |
|
||||
}) => { |
|
||||
this.getTableData() |
|
||||
}).catch(() => {}) |
|
||||
}, |
|
||||
del(row) { |
|
||||
let query = [row.id] |
|
||||
this.$http.post('/resi/partymember/icPartyMemberCenter/delete', query).then(({ |
|
||||
data: res |
|
||||
}) => { |
|
||||
this.getTableData() |
|
||||
}).catch(() => {}) |
|
||||
}, |
|
||||
cancel(row) { |
|
||||
this.getTableData() |
|
||||
} |
|
||||
}, |
|
||||
} |
|
||||
</script> |
|
||||
<style lang="scss" scoped> |
|
||||
@import "@/assets/scss/modules/visual/communityManage.scss"; |
|
||||
</style> |
|
||||
<style lang="scss" scoped> |
|
||||
.div_btn { |
|
||||
display: flex; |
|
||||
align-items: center; |
|
||||
justify-content: center; |
|
||||
} |
|
||||
</style> |
|
Loading…
Reference in new issue