6 changed files with 1616 additions and 563 deletions
@ -0,0 +1,242 @@ |
|||||
|
<template> |
||||
|
<div> |
||||
|
<div class="div_search"> |
||||
|
<el-form :rules="dataRule" :inline="true"> |
||||
|
<el-form-item label="所属组织" prop="deptName"> |
||||
|
<el-cascader |
||||
|
style="width:350px" |
||||
|
placeholder="请选择所属组织" |
||||
|
:options="agencytree" |
||||
|
v-model="agencyId" |
||||
|
:props="{ expandTrigger: 'hover', label: 'orgName', value: 'orgId', children: 'subOrgList' }" |
||||
|
clearable/> |
||||
|
</el-form-item> |
||||
|
<el-form-item> |
||||
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="loadTree()">加载动力主轴</el-button> |
||||
|
</el-form-item> |
||||
|
</el-form> |
||||
|
</div> |
||||
|
<div class="div_main"> |
||||
|
<div :style="{height:rowHeight}" |
||||
|
class="div_tree"> |
||||
|
<el-input placeholder="输入关键字进行过滤" |
||||
|
v-model="filterText"> |
||||
|
</el-input> |
||||
|
<el-scrollbar :style="{height:treeHeight}" |
||||
|
class="scrollar"> |
||||
|
<el-tree ref="ref_tree" |
||||
|
v-loading="treeLoading" |
||||
|
class="filter_tree" |
||||
|
:data="treeData" |
||||
|
:props="defaultProps" |
||||
|
:highlight-current="true" |
||||
|
node-key="id" |
||||
|
:expand-on-click-node="false" |
||||
|
default-expand-all |
||||
|
:filter-node-method="filterNode" |
||||
|
@node-click="handleNodeClick"> |
||||
|
</el-tree> |
||||
|
</el-scrollbar> |
||||
|
</div> |
||||
|
<div :style="{height:rowHeight}" |
||||
|
class="div_table"> |
||||
|
<kernelhousehold-table :axisStructId="axisStructId" ref="ref_communityTable"></kernelhousehold-table> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import CDialog from '@c/CDialog' |
||||
|
import kernelhouseholdTable from './kernelhouseholdTable' |
||||
|
import { requestPost } from "@/js/dai/request"; |
||||
|
import { mapGetters } from 'vuex' |
||||
|
export default { |
||||
|
data () { |
||||
|
return { |
||||
|
agencytree: [], // 所属组织 |
||||
|
agencyId: '', |
||||
|
filterText: '', |
||||
|
treeLoading: false, |
||||
|
treeData: [], |
||||
|
defaultProps: { |
||||
|
children: 'children', |
||||
|
label: 'name' |
||||
|
}, |
||||
|
selTreeObj: {}, |
||||
|
centerPoint: [], |
||||
|
axisStructId: '' // 动力主轴节点id |
||||
|
} |
||||
|
}, |
||||
|
async mounted () { |
||||
|
// this.treeLoading = true |
||||
|
// await this.loadTree() |
||||
|
await this.getAgencyTree() |
||||
|
// this.treeLoading = false |
||||
|
}, |
||||
|
computed: { |
||||
|
rowHeight () { |
||||
|
return this.$store.state.inIframe ? this.clientHeight - 230 + this.iframeHeight + 'px' : this.clientHeight - 230 + 'px' |
||||
|
}, |
||||
|
treeHeight () { |
||||
|
return this.$store.state.inIframe ? this.clientHeight - 310 + this.iframeHeight + 'px' : this.clientHeight - 310 + 'px' |
||||
|
}, |
||||
|
...mapGetters(['clientHeight', 'iframeHeight']), |
||||
|
|
||||
|
dataRule () { |
||||
|
return { |
||||
|
deptName:[ |
||||
|
{ required: true, message: "请选择", trigger: "blur" } |
||||
|
] |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
methods: { |
||||
|
async loadTree () { |
||||
|
this.axisStructId = '' |
||||
|
if (this.agencyId.length === 0 || !this.agencyId) { |
||||
|
return this.$message.error('请选择所属组织') |
||||
|
} |
||||
|
this.treeLoading = true |
||||
|
const url = "/pli/power/data/axis/structTree" |
||||
|
let params = { |
||||
|
agencyId: this.agencyId[this.agencyId.length-1] |
||||
|
} |
||||
|
const { data, code, msg } = await requestPost(url, params) |
||||
|
this.treeLoading = false |
||||
|
if (code === 0) { |
||||
|
this.treeData = data |
||||
|
} else { |
||||
|
this.$message.error(msg) |
||||
|
} |
||||
|
}, |
||||
|
handleNodeClick (obj) { |
||||
|
this.axisStructId = obj.id |
||||
|
}, |
||||
|
filterNode (value, data) { |
||||
|
if (!value) return true; |
||||
|
return data.name.indexOf(value) !== -1; |
||||
|
}, |
||||
|
// 获取组织列表 |
||||
|
async getAgencyTree(){ |
||||
|
const url = '/data/aggregator/org/agencytree' |
||||
|
|
||||
|
let params = { |
||||
|
agencyId:this.agencyId, |
||||
|
client:'gov' |
||||
|
} |
||||
|
|
||||
|
const { data, code, msg } = await requestPost(url,params) |
||||
|
|
||||
|
if (code === 0) { |
||||
|
let _data |
||||
|
if (data) { |
||||
|
_data = this.removeByOrgType(data, 'agency') |
||||
|
if (_data) { |
||||
|
this.agencytree = this.removeEmptySubOrgList(_data) |
||||
|
} |
||||
|
} |
||||
|
} else { |
||||
|
this.$message.error(msg) |
||||
|
} |
||||
|
}, |
||||
|
removeByOrgType (orgArray, orgType) { |
||||
|
if (orgArray && orgArray.length > 0) { |
||||
|
for (let p = orgArray.length - 1; p >= 0; p--) { |
||||
|
let orgInfo = orgArray[p] |
||||
|
if (orgInfo) { |
||||
|
if (orgInfo.orgType !== orgType) { |
||||
|
orgArray.splice(p, 1) |
||||
|
} else { |
||||
|
this.removeByOrgType(orgInfo.subOrgList, orgType) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
return orgArray |
||||
|
}, |
||||
|
removeEmptySubOrgList (orgArray) { |
||||
|
orgArray.forEach((orgInfo) => { |
||||
|
if (orgInfo && orgInfo.subOrgList) { |
||||
|
if (orgInfo.subOrgList.length === 0) { |
||||
|
orgInfo.subOrgList = undefined |
||||
|
} else { |
||||
|
this.removeEmptySubOrgList(orgInfo.subOrgList) |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
return orgArray; |
||||
|
} |
||||
|
}, |
||||
|
watch: { |
||||
|
filterText (val) { |
||||
|
this.$refs.ref_tree.filter(val); |
||||
|
} |
||||
|
}, |
||||
|
components: { |
||||
|
kernelhouseholdTable, CDialog |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
<style lang="scss" scoped > |
||||
|
.div_search { |
||||
|
width: calc(100% - 5px); |
||||
|
background: #ffffff; |
||||
|
border-radius: 4px; |
||||
|
padding: 30px 20px 5px; |
||||
|
box-shadow: 0px 2px 12px 0px rgba(0, 0, 0, 0.1); |
||||
|
} |
||||
|
.div_main { |
||||
|
margin-top: 10px; |
||||
|
display: flex; |
||||
|
} |
||||
|
.scrollar { |
||||
|
margin-top: 10px; |
||||
|
} |
||||
|
|
||||
|
.div_tree { |
||||
|
flex: 0 0 280px; |
||||
|
background-color: #ffffff; |
||||
|
border-radius: 5px; |
||||
|
padding: 10px; |
||||
|
overflow-y: hidden; |
||||
|
} |
||||
|
.filter_tree { |
||||
|
overflow-x: auto; |
||||
|
} |
||||
|
|
||||
|
.div_table { |
||||
|
margin-left: 15px; |
||||
|
// flex: 1; |
||||
|
width: calc(100% - 300px); |
||||
|
background-color: #ffffff; |
||||
|
border-radius: 5px; |
||||
|
padding: 10px; |
||||
|
} |
||||
|
|
||||
|
.div_btn { |
||||
|
margin-top: 20px; |
||||
|
} |
||||
|
|
||||
|
.row { |
||||
|
padding: 10px; |
||||
|
} |
||||
|
</style> |
||||
|
|
||||
|
<style> |
||||
|
/* .aui-content > .el-tabs > .el-tabs__content { |
||||
|
padding: 0px; |
||||
|
} */ |
||||
|
|
||||
|
.el-tree-node:focus > .el-tree-node__content { |
||||
|
/* background-color: #ccc !important; */ |
||||
|
color: #2195fe; |
||||
|
} |
||||
|
</style> |
||||
|
<style lang="scss" scoped> |
||||
|
.div_tree { |
||||
|
/deep/ .el-scrollbar__wrap { |
||||
|
overflow-x: hidden !important; |
||||
|
} |
||||
|
} |
||||
|
</style> |
@ -0,0 +1,180 @@ |
|||||
|
<template> |
||||
|
<div> |
||||
|
<div class="dialog-h-content scroll-h"> |
||||
|
<div> |
||||
|
<div class="div_search"> |
||||
|
<div class="resi-cell"> |
||||
|
<div class="resi-cell-label">房屋</div> |
||||
|
<div class="resi-cell-value"> |
||||
|
<el-input v-model="keyword" |
||||
|
style="width:350px" |
||||
|
class="resi-cell-input" |
||||
|
size="small" |
||||
|
clearable |
||||
|
placeholder="请输入“小区名称,楼号,如:亿联小区,1号楼"> |
||||
|
</el-input> |
||||
|
</div> |
||||
|
</div> |
||||
|
<el-button style="margin-left:10px" |
||||
|
class="diy-button--search" |
||||
|
size="small" |
||||
|
@click="handleSearch">查询</el-button> |
||||
|
</div> |
||||
|
<div class="div_table"> |
||||
|
<el-table ref="ref_table" |
||||
|
:data="tableData" |
||||
|
border |
||||
|
:height="tableHeight" |
||||
|
v-loading="tableLoading" |
||||
|
:header-cell-style="{background:'#2195FE',color:'#FFFFFF'}" |
||||
|
style="width: 100%" |
||||
|
@selection-change="selectionChange"> |
||||
|
<el-table-column type="selection" |
||||
|
width="55"> |
||||
|
</el-table-column> |
||||
|
<el-table-column prop="houseName" |
||||
|
label="房屋名称"> |
||||
|
</el-table-column> |
||||
|
<el-table-column prop="neighborHoodName" |
||||
|
label="所属小区"> |
||||
|
</el-table-column> |
||||
|
<el-table-column prop="buildingName" |
||||
|
label="所属楼栋"> |
||||
|
</el-table-column> |
||||
|
<el-table-column prop="ownerName" |
||||
|
label="房主姓名"> |
||||
|
</el-table-column> |
||||
|
<el-table-column prop="ownerPhone" |
||||
|
label="房主电话"> |
||||
|
</el-table-column> |
||||
|
</el-table> |
||||
|
<div> |
||||
|
<el-pagination @size-change="handleSizeChange" |
||||
|
@current-change="handleCurrentChange" |
||||
|
:current-page.sync="pageNo" |
||||
|
:page-sizes="[20, 50, 100, 200]" |
||||
|
:page-size="pageSize" |
||||
|
layout="sizes, prev, pager, next, total" |
||||
|
:total="total"> |
||||
|
</el-pagination> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="div_btn"> |
||||
|
<el-button size="small" |
||||
|
@click="handleCancle">取 消</el-button> |
||||
|
<el-button size="small" |
||||
|
type="primary" |
||||
|
:disabled="btnDisable" |
||||
|
@click="handleComfirm">确 定</el-button> |
||||
|
</div> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { mapGetters } from 'vuex' |
||||
|
import { requestPost } from "@/js/dai/request"; |
||||
|
export default { |
||||
|
data () { |
||||
|
return { |
||||
|
btnDisable: false, |
||||
|
keyword: '', |
||||
|
// 列表相关 |
||||
|
tableData: [], |
||||
|
tableLoading: false, |
||||
|
selection: [], |
||||
|
total: 0, |
||||
|
pageSize: 20, |
||||
|
pageNo: 0, |
||||
|
} |
||||
|
}, |
||||
|
props: { |
||||
|
axisStructId: { // 动力主轴id |
||||
|
type: String, |
||||
|
default: '' |
||||
|
} |
||||
|
}, |
||||
|
computed: { |
||||
|
tableHeight () { |
||||
|
return this.$store.state.inIframe ? this.clientHeight - 410 + this.iframeHeight : this.clientHeight - 410 |
||||
|
}, |
||||
|
...mapGetters(['clientHeight', 'iframeHeight']) |
||||
|
}, |
||||
|
components: {}, |
||||
|
// mounted () { |
||||
|
// this.tableLoading = true |
||||
|
// this.loadTable() |
||||
|
// }, |
||||
|
methods: { |
||||
|
// 搜索 |
||||
|
handleSearch() { |
||||
|
this.tableLoading = true |
||||
|
this.loadTable() |
||||
|
}, |
||||
|
selectionChange (selection) { |
||||
|
this.selection = [] |
||||
|
selection.forEach(element => { |
||||
|
this.selection.push(element.houseId) |
||||
|
}); |
||||
|
}, |
||||
|
handleSizeChange (val) { |
||||
|
this.pageSize = val |
||||
|
this.pageNo = 1 |
||||
|
this.loadTable() |
||||
|
}, |
||||
|
handleCurrentChange (val) { |
||||
|
this.pageNo = val |
||||
|
this.loadTable() |
||||
|
}, |
||||
|
// 确定 |
||||
|
async handleComfirm () { |
||||
|
if (this.selection.length === 0 || !this.selection) { |
||||
|
return this.$message.error('请选择房屋') |
||||
|
} |
||||
|
const url = "/pli/power/kernelHousehold/bind"; |
||||
|
let params = { |
||||
|
axisStructId: this.axisStructId, |
||||
|
houseIdList: this.selection |
||||
|
} |
||||
|
const { data, code, msg } = await requestPost(url, params); |
||||
|
this.tableLoading = false |
||||
|
if (code === 0) { |
||||
|
this.$emit('dialogOk') |
||||
|
} |
||||
|
}, |
||||
|
// 取消 |
||||
|
handleCancle () { |
||||
|
this.$emit('dialogCancle') |
||||
|
}, |
||||
|
// 查询列表 |
||||
|
async loadTable () { |
||||
|
const url = "/gov/org/house/search"; |
||||
|
let params = { |
||||
|
keyword: this.keyword, |
||||
|
pageSize: this.pageSize, |
||||
|
pageNo: this.pageNo |
||||
|
} |
||||
|
const { data, code, msg } = await requestPost(url, params); |
||||
|
this.tableLoading = false |
||||
|
if (code === 0) { |
||||
|
this.total = data.total || 0; |
||||
|
this.tableData = data.list ? data.list.map((item) => { return item }) : [] |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
} |
||||
|
</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> |
||||
|
|
||||
|
|
||||
|
|
@ -0,0 +1,222 @@ |
|||||
|
<template> |
||||
|
<div> |
||||
|
<div class="div_search"> |
||||
|
<div class="resi-cell"> |
||||
|
<div class="resi-cell-label">房主姓名</div> |
||||
|
<div class="resi-cell-value"> |
||||
|
<el-input v-model="ownerName" |
||||
|
class="resi-cell-input" |
||||
|
size="small" |
||||
|
clearable |
||||
|
placeholder="请输入内容"> |
||||
|
</el-input> |
||||
|
</div> |
||||
|
</div> |
||||
|
<el-button style="margin-left:10px" |
||||
|
class="diy-button--search" |
||||
|
size="small" |
||||
|
@click="handleSearch">查询</el-button> |
||||
|
</div> |
||||
|
<div class="div_btn"> |
||||
|
<el-button style="" |
||||
|
class="diy-button--add" |
||||
|
size="small" |
||||
|
@click="handleAdd">绑定</el-button> |
||||
|
</div> |
||||
|
<div class="div_table"> |
||||
|
<el-table ref="ref_table" |
||||
|
:data="tableData" |
||||
|
border |
||||
|
:height="tableHeight" |
||||
|
v-loading="tableLoading" |
||||
|
:header-cell-style="{background:'#2195FE',color:'#FFFFFF'}" |
||||
|
style="width: 100%"> |
||||
|
<el-table-column prop="ownerName" |
||||
|
label="姓名" |
||||
|
width="100"> |
||||
|
</el-table-column> |
||||
|
<el-table-column prop="address" |
||||
|
label="地址"> |
||||
|
</el-table-column> |
||||
|
<el-table-column label="操作" |
||||
|
fixed="right" |
||||
|
width="80" |
||||
|
header-align="center" |
||||
|
align="center" |
||||
|
class="operate"> |
||||
|
<template slot-scope="scope"> |
||||
|
<el-button type="text" |
||||
|
class="div-table-button--delete" |
||||
|
size="small" |
||||
|
@click="handleDelete(scope.row.id)">删除</el-button> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
</el-table> |
||||
|
<div> |
||||
|
<el-pagination @size-change="handleSizeChange" |
||||
|
@current-change="handleCurrentChange" |
||||
|
:current-page.sync="pageNo" |
||||
|
:page-sizes="[20, 50, 100, 200]" |
||||
|
:page-size="pageSize" |
||||
|
layout="sizes, prev, pager, next, total" |
||||
|
:total="total"> |
||||
|
</el-pagination> |
||||
|
</div> |
||||
|
</div> |
||||
|
<!-- 修改弹出框 --> |
||||
|
<el-dialog :visible.sync="formShow" |
||||
|
:close-on-click-modal="false" |
||||
|
:close-on-press-escape="false" |
||||
|
:title="formTitle" |
||||
|
width="850px" |
||||
|
top="5vh" |
||||
|
class="dialog-h" |
||||
|
@closed="diaClose"> |
||||
|
<kernelhousehold-form ref="ref_form" |
||||
|
@dialogCancle="addFormCancle" |
||||
|
@dialogOk="addFormOk" |
||||
|
:axisStructId="axisStructId"></kernelhousehold-form> |
||||
|
</el-dialog> |
||||
|
|
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
|
||||
|
import KernelhouseholdForm from './kernelhouseholdForm' |
||||
|
import { requestPost } from "@/js/dai/request"; |
||||
|
import { mapGetters } from 'vuex' |
||||
|
export default { |
||||
|
data () { |
||||
|
return { |
||||
|
total: 0, |
||||
|
pageSize: 20, |
||||
|
pageNo: 0, |
||||
|
tableLoading: false, |
||||
|
ownerName: '', |
||||
|
tableData: [], |
||||
|
//form相关 |
||||
|
formShow: false, |
||||
|
formTitle: '绑定' |
||||
|
} |
||||
|
}, |
||||
|
components: { |
||||
|
KernelhouseholdForm |
||||
|
}, |
||||
|
computed: { |
||||
|
tableHeight () { |
||||
|
return this.$store.state.inIframe ? this.clientHeight - 410 + this.iframeHeight : this.clientHeight - 410 |
||||
|
}, |
||||
|
...mapGetters(['clientHeight', 'iframeHeight']) |
||||
|
}, |
||||
|
methods: { |
||||
|
async loadTable () { |
||||
|
this.tableLoading = true |
||||
|
const url = "/pli/power/kernelHousehold/page" |
||||
|
let params = { |
||||
|
pageSize: this.pageSize, |
||||
|
pageNo: this.pageNo, |
||||
|
axisStructId: this.axisStructId, |
||||
|
ownerName: this.ownerName |
||||
|
} |
||||
|
const { data, code, msg, total } = await requestPost(url, params) |
||||
|
if (code === 0) { |
||||
|
this.total = data.total || 0; |
||||
|
this.tableData = data.list ? data.list.map((item) => { return item }) : [] |
||||
|
} else { |
||||
|
this.$message.error(msg) |
||||
|
} |
||||
|
this.tableLoading = false |
||||
|
}, |
||||
|
// 删除 |
||||
|
async handleDelete (id) { |
||||
|
this.$confirm("确认删除?", "提示", { |
||||
|
confirmButtonText: "确定", |
||||
|
cancelButtonText: "取消", |
||||
|
type: "warning" |
||||
|
}).then(() => { |
||||
|
this.deleteKernelhousehold(id) |
||||
|
}).catch(err => { |
||||
|
console.log('取消删除') |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
async deleteKernelhousehold (id) { |
||||
|
const url = "/pli/power/kernelHousehold/delete" |
||||
|
const { data, code, msg } = await requestPost(url, [id]) |
||||
|
if (code === 0) { |
||||
|
this.$message({ |
||||
|
type: "success", |
||||
|
message: "删除成功" |
||||
|
}); |
||||
|
this.loadTable() |
||||
|
} else { |
||||
|
this.$message.error(msg) |
||||
|
} |
||||
|
}, |
||||
|
handleSizeChange (val) { |
||||
|
this.pageSize = val |
||||
|
this.pageNo = 1 |
||||
|
this.loadTable() |
||||
|
}, |
||||
|
handleCurrentChange (val) { |
||||
|
this.pageNo = val |
||||
|
this.loadTable() |
||||
|
}, |
||||
|
handleSearch () { |
||||
|
if (!this.axisStructId) { |
||||
|
return this.$message.error('请选择动力主轴节点') |
||||
|
} |
||||
|
this.loadTable() |
||||
|
}, |
||||
|
diaClose () { |
||||
|
// this.$refs.ref_form.resetData() |
||||
|
this.formShow = false |
||||
|
}, |
||||
|
handleAdd () { |
||||
|
if (this.axisStructId) { |
||||
|
this.formShow = true |
||||
|
} else { |
||||
|
return this.$message.error('请选择动力主轴节点') |
||||
|
} |
||||
|
}, |
||||
|
addFormCancle () { |
||||
|
this.formShow = false |
||||
|
}, |
||||
|
addFormOk () { |
||||
|
this.formShow = false |
||||
|
this.loadTable() |
||||
|
}, |
||||
|
}, |
||||
|
props: { |
||||
|
axisStructId: { |
||||
|
type: String, |
||||
|
default: '', |
||||
|
} |
||||
|
}, |
||||
|
watch: { |
||||
|
axisStructId (newName) { |
||||
|
if (newName) { |
||||
|
this.pageSize = 20 |
||||
|
this.pageNo = 1 |
||||
|
this.loadTable() |
||||
|
} else { |
||||
|
this.pageSize = 20 |
||||
|
this.pageNo = 0 |
||||
|
this.total = 0; |
||||
|
this.tableData = [] |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
} |
||||
|
</script> |
||||
|
<style lang="scss" scoped > |
||||
|
@import "@/assets/scss/modules/visual/communityManage.scss"; |
||||
|
</style> |
||||
|
|
||||
|
<style > |
||||
|
.el-message.is-closable .el-message__content { |
||||
|
line-height: 20px; |
||||
|
} |
||||
|
</style> |
||||
|
|
@ -0,0 +1,527 @@ |
|||||
|
<template> |
||||
|
<el-dialog :visible.sync="visible" :title="!dataForm.id ? $t('add') : $t('update')" :close-on-click-modal="false" :close-on-press-escape="false"> |
||||
|
<el-form class="form" |
||||
|
:model="dataForm" |
||||
|
:rules="dataRule" |
||||
|
ref="dataForm" |
||||
|
@keyup.enter.native="dataFormSubmitHandle()" |
||||
|
:label-width="$i18n.locale === 'en-US' ? '120px' : '80px'"> |
||||
|
<el-form-item prop="categoryCode" label="类别"> |
||||
|
<el-select v-model="dataForm.categoryCode" @change="handelChange" placeholder="请选择类别"> |
||||
|
<el-option |
||||
|
v-for="item in structCategoryArr" |
||||
|
:key="item.categoryCode" |
||||
|
:label="item.categoryName" |
||||
|
:value="item.categoryCode"> |
||||
|
</el-option> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
<el-form-item prop="name" label="名称"> |
||||
|
<el-input v-model="dataForm.name" placeholder="请输入名称" style="width:250px"></el-input> |
||||
|
</el-form-item> |
||||
|
<!-- 下拉框组织的参数 --> |
||||
|
<el-form-item prop="orgId" label="所属组织" v-if="orgListSwitch"> |
||||
|
<el-cascader |
||||
|
v-model="dataForm.orgId" |
||||
|
:options="agencytree" |
||||
|
placeholder="请选择所属组织" |
||||
|
:props="{ expandTrigger: 'hover', label: 'orgName', value: 'orgId', children: 'subOrgList' }" |
||||
|
></el-cascader> |
||||
|
</el-form-item> |
||||
|
<!-- 网格党支部下拉框 --> |
||||
|
<el-form-item prop="pid" label="所属上级" v-if="GridPartyBranchSwitch"> |
||||
|
<el-select v-model="dataForm.pid" placeholder="请选择所属上级"> |
||||
|
<el-option |
||||
|
v-for="item in GridPartyBranchList" |
||||
|
:key="item.id" |
||||
|
:label="item.name" |
||||
|
:value="item.id"> |
||||
|
</el-option> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
<!-- 党委下拉框 --> |
||||
|
<el-form-item prop="pid" label="所属上级" v-if="partyCommSwitch"> |
||||
|
<el-select v-model="dataForm.pid" placeholder="请选择所属上级"> |
||||
|
<el-option |
||||
|
v-for="item in PartyCommList" |
||||
|
:key="item.id" |
||||
|
:label="item.name" |
||||
|
:value="item.id"> |
||||
|
</el-option> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="排序"> |
||||
|
<el-input-number v-model="dataForm.sort" :min="0" :max="10" label="请输入排序"></el-input-number> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="活动坐标" |
||||
|
prop="longitude" |
||||
|
style="display: block"> |
||||
|
<div class="item_width_1"> |
||||
|
|
||||
|
<div class="div_map"> |
||||
|
<div id="app"> |
||||
|
|
||||
|
</div> |
||||
|
<div style="display: none" id="mapSeach_id" class="div_searchmap"> |
||||
|
<el-input class="item_width_4" |
||||
|
maxlength="50" |
||||
|
size="mini" |
||||
|
placeholder="请输入关键字" |
||||
|
v-model="keyWords"> |
||||
|
</el-input> |
||||
|
<el-button style="margin-left: 10px" |
||||
|
type="primary" |
||||
|
size="mini" |
||||
|
@click="handleSearchMap">查询</el-button> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div id="lon_lat_id" style="margin-top: 10px; display: none"> |
||||
|
<span>经度</span> |
||||
|
<el-input class="item_width_3" |
||||
|
maxlength="50" |
||||
|
placeholder="请输入经度" |
||||
|
v-model="dataForm.longitude"> |
||||
|
</el-input> |
||||
|
<span style="margin-left: 20px">纬度</span> |
||||
|
<el-input class="item_width_3" |
||||
|
maxlength="50" |
||||
|
placeholder="请输入纬度" |
||||
|
v-model="dataForm.latitude"> |
||||
|
</el-input> |
||||
|
</div> |
||||
|
</div> |
||||
|
</el-form-item> |
||||
|
</el-form> |
||||
|
<template slot="footer"> |
||||
|
<el-button @click="visible = false">{{ $t('cancel') }}</el-button> |
||||
|
<el-button type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button> |
||||
|
</template> |
||||
|
</el-dialog> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
var map |
||||
|
var search |
||||
|
var markers |
||||
|
var infoWindowList |
||||
|
var geocoder // 新建一个正逆地址解析类 |
||||
|
import debounce from 'lodash/debounce' |
||||
|
import { requestPost } from "@/js/dai/request"; |
||||
|
export default { |
||||
|
data () { |
||||
|
return { |
||||
|
visible: false, |
||||
|
keyWords: '', |
||||
|
dataForm: { |
||||
|
id:'', |
||||
|
name:'', |
||||
|
agencyId:'', |
||||
|
agencyName:'', |
||||
|
orgId: '', |
||||
|
agencyType:'', |
||||
|
pid:'', |
||||
|
categoryCode:'', |
||||
|
sort:'', |
||||
|
address: '', //详细地址 |
||||
|
longitude: 36.0722275, //经度 |
||||
|
latitude: 120.38945519 //纬度 |
||||
|
}, |
||||
|
structCategoryArr: [], // 查询动力主轴标签类别 |
||||
|
leaderCategoryArr: [], // 查询动力主轴负责人标签类别 |
||||
|
agencytree: [], // 绑定组织列表 |
||||
|
GridPartyBranchList:[], // 上级网格党支部列表 |
||||
|
PartyCommList:[], // 党委列表 |
||||
|
orgListSwitch:false, // 组织列表开关 |
||||
|
GridPartyBranchSwitch:false, // 上级网格党支部列表 |
||||
|
partyCommSwitch:false, // 党委下拉框列表开关 |
||||
|
} |
||||
|
}, |
||||
|
computed: { |
||||
|
dataRule () { |
||||
|
return { |
||||
|
categoryCode:[ |
||||
|
{ required: true, message: "上级部门不能为空", trigger: "blur" } |
||||
|
], |
||||
|
name:[ |
||||
|
{ required: true, message: "上级部门不能为空", trigger: "blur" } |
||||
|
], |
||||
|
orgId:[ |
||||
|
{ required: true, message: "上级部门不能为空", trigger: "blur" } |
||||
|
], |
||||
|
pid:[ |
||||
|
{ required: true, message: "上级部门不能为空", trigger: "blur" } |
||||
|
], |
||||
|
longitude: [ |
||||
|
{ required: true, message: '坐标不能为空', trigger: 'blur' } |
||||
|
] |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
mounted () { |
||||
|
setTimeout(() => { |
||||
|
this.initMap() |
||||
|
}, 500); |
||||
|
}, |
||||
|
methods: { |
||||
|
init () { |
||||
|
this.visible = true; |
||||
|
this.getTagCategoryArr() |
||||
|
this.getAgencyTree() |
||||
|
this.$nextTick(() => { |
||||
|
this.$refs['dataForm'].resetFields() |
||||
|
if (this.dataForm.id) { |
||||
|
this.getInfo() |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
// 获取动力主轴标签 |
||||
|
async getTagCategoryArr(){ |
||||
|
const url = '/pli/power/axisTag/listSimpleAll' |
||||
|
let params = {} |
||||
|
const { data, code, msg } = await requestPost(url, params) |
||||
|
if (code === 0) { |
||||
|
data.forEach((item) => { |
||||
|
if (item.tagCategory === 'struct') { |
||||
|
this.structCategoryArr = item.tagList |
||||
|
} |
||||
|
if (item.tagCategory === 'leader') { |
||||
|
this.leaderCategoryArr = item.tagList |
||||
|
} |
||||
|
}) |
||||
|
} else { |
||||
|
this.$message.error(msg) |
||||
|
} |
||||
|
}, |
||||
|
// 获取组织列表 |
||||
|
async getAgencyTree(){ |
||||
|
const url = '/data/aggregator/org/agencytree' |
||||
|
|
||||
|
let params = { |
||||
|
agencyId: localStorage.getItem('agencyId'), |
||||
|
client:'gov' |
||||
|
} |
||||
|
const { data, code, msg } = await requestPost(url,params) |
||||
|
if (code === 0) { |
||||
|
let _data |
||||
|
if (data) { |
||||
|
_data = this.removeByOrgType(data, 'agency') |
||||
|
if (_data) { |
||||
|
this.agencytree = this.removeEmptySubOrgList(_data) |
||||
|
} |
||||
|
} |
||||
|
} else { |
||||
|
this.$message.error(msg) |
||||
|
} |
||||
|
}, |
||||
|
removeByOrgType (orgArray, orgType) { |
||||
|
if (orgArray && orgArray.length > 0) { |
||||
|
for (let p = orgArray.length - 1; p >= 0; p--) { |
||||
|
let orgInfo = orgArray[p] |
||||
|
if (orgInfo) { |
||||
|
if (orgInfo.orgType !== orgType) { |
||||
|
orgArray.splice(p, 1) |
||||
|
} else { |
||||
|
this.removeByOrgType(orgInfo.subOrgList, orgType) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
return orgArray |
||||
|
}, |
||||
|
removeEmptySubOrgList (orgArray) { |
||||
|
orgArray.forEach((orgInfo) => { |
||||
|
if (orgInfo && orgInfo.subOrgList) { |
||||
|
if (orgInfo.subOrgList.length === 0) { |
||||
|
orgInfo.subOrgList = undefined |
||||
|
} else { |
||||
|
this.removeEmptySubOrgList(orgInfo.subOrgList) |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
return orgArray; |
||||
|
}, |
||||
|
// 获取信息 |
||||
|
getInfo () { |
||||
|
this.$http.post(`/pli/power/axisStruct/queryModifyById/${this.dataForm.id}`).then(({ data: res }) => { |
||||
|
if (res.code !== 0) { |
||||
|
return this.$message.error(res.msg); |
||||
|
} |
||||
|
this.dataForm = { |
||||
|
...this.dataForm, |
||||
|
...res.data |
||||
|
} |
||||
|
if(this.dataForm.categoryCode === 'community_party') { |
||||
|
this.orgListSwitch = true |
||||
|
this.GridPartyBranchSwitch = false |
||||
|
this.partyCommSwitch = false |
||||
|
} |
||||
|
if(this.dataForm.categoryCode === 'grid_party') { |
||||
|
this.orgListSwitch = false |
||||
|
this.GridPartyBranchSwitch = false |
||||
|
this.partyCommSwitch = true |
||||
|
this.getPartyCommList() |
||||
|
} |
||||
|
if(this.dataForm.categoryCode === 'group_party') { |
||||
|
this.GridPartyBranchSwitch = true |
||||
|
this.partyCommSwitch = false |
||||
|
this.getGridPartyBranchList() |
||||
|
} |
||||
|
}).catch(() => {}) |
||||
|
}, |
||||
|
// 获取上级网格党支部 |
||||
|
async getGridPartyBranchList(){ |
||||
|
const url = '/pli/power/axisStruct/GridPartyBranchList' |
||||
|
|
||||
|
let params = {} |
||||
|
|
||||
|
const { data, code, msg } = await requestPost(url,params) |
||||
|
|
||||
|
if (code === 0) { |
||||
|
this.GridPartyBranchList = data |
||||
|
} else { |
||||
|
this.$message.error(msg) |
||||
|
} |
||||
|
}, |
||||
|
// 获取上级组织党委 |
||||
|
async getPartyCommList(){ |
||||
|
const url = '/pli/power/axisStruct/getPartyCommList' |
||||
|
|
||||
|
let params = {} |
||||
|
|
||||
|
const { data, code, msg } = await requestPost(url,params) |
||||
|
|
||||
|
if (code === 0) { |
||||
|
this.PartyCommList = data |
||||
|
} else { |
||||
|
this.$message.error(msg) |
||||
|
} |
||||
|
}, |
||||
|
// 动力主轴选中后的操作 |
||||
|
handelChange(val){ |
||||
|
this.dataForm.categoryCode = val |
||||
|
if (val === 'community_party') { |
||||
|
this.orgListSwitch = true |
||||
|
this.GridPartyBranchSwitch = false |
||||
|
this.partyCommSwitch = false |
||||
|
this.dataForm.pid = 0 |
||||
|
} |
||||
|
if(val === 'grid_party') { |
||||
|
this.orgListSwitch = false |
||||
|
this.GridPartyBranchSwitch = false |
||||
|
this.partyCommSwitch = true |
||||
|
this.getPartyCommList() |
||||
|
this.dataForm.pid = '' |
||||
|
} |
||||
|
if(val === 'group_party') { |
||||
|
this.GridPartyBranchSwitch = true |
||||
|
this.partyCommSwitch = false |
||||
|
this.dataForm.pid = '' |
||||
|
this.getGridPartyBranchList() |
||||
|
} |
||||
|
}, |
||||
|
// 地图初始化函数,本例取名为init,开发者可根据实际情况定义 |
||||
|
initMap () { |
||||
|
if (document.getElementById('app')) { |
||||
|
document.getElementById('mapSeach_id').style.display = "block" |
||||
|
document.getElementById('lon_lat_id').style.display = "block" |
||||
|
} |
||||
|
|
||||
|
// 定义地图中心点坐标 |
||||
|
var center = new window.TMap.LatLng(36.0722275, 120.38945519) |
||||
|
// 定义map变量,调用 TMap.Map() 构造函数创建地图 |
||||
|
map = new window.TMap.Map(document.getElementById('app'), { |
||||
|
center: center, // 设置地图中心点坐标 |
||||
|
zoom: 17.2, // 设置地图缩放级别 |
||||
|
pitch: 43.5, // 设置俯仰角 |
||||
|
rotation: 45 // 设置地图旋转角度 |
||||
|
}) |
||||
|
|
||||
|
search = new window.TMap.service.Search({ pageSize: 10 }) |
||||
|
// 新建一个地点搜索类 |
||||
|
markers = new TMap.MultiMarker({ |
||||
|
map: map, |
||||
|
geometries: [] |
||||
|
}) |
||||
|
infoWindowList = Array(10) |
||||
|
|
||||
|
geocoder = new TMap.service.Geocoder(); // 新建一个正逆地址解析类 |
||||
|
|
||||
|
// 监听地图平移结束 |
||||
|
map.on('panend', () => { |
||||
|
this.handleMoveCenter() |
||||
|
}) |
||||
|
this.handleMoveCenter() |
||||
|
this.convert() |
||||
|
}, |
||||
|
|
||||
|
setMarker (lat, lng) { |
||||
|
markers.setGeometries([]) |
||||
|
markers.add([ |
||||
|
{ |
||||
|
id: '4', |
||||
|
styleId: 'marker', |
||||
|
position: new TMap.LatLng(lat, lng), |
||||
|
properties: { |
||||
|
title: 'marker4' |
||||
|
} |
||||
|
} |
||||
|
]) |
||||
|
}, |
||||
|
|
||||
|
handleSearchMap () { |
||||
|
infoWindowList.forEach((infoWindow) => { |
||||
|
infoWindow.close() |
||||
|
}) |
||||
|
infoWindowList.length = 0 |
||||
|
markers.setGeometries([]) |
||||
|
// 在地图显示范围内以给定的关键字搜索地点 |
||||
|
search |
||||
|
.searchRectangle({ |
||||
|
keyword: this.keyWords, |
||||
|
bounds: map.getBounds() |
||||
|
}) |
||||
|
.then((result) => { |
||||
|
let { data } = result |
||||
|
if (Array.isArray(data) && data.length > 0) { |
||||
|
const { |
||||
|
location: { lat, lng } |
||||
|
} = data[0] |
||||
|
|
||||
|
|
||||
|
map.setCenter(new TMap.LatLng(lat, lng)) |
||||
|
this.setMarker(lat, lng) |
||||
|
this.dataForm.latitude = lat |
||||
|
this.dataForm.longitude = lng |
||||
|
this.convert() |
||||
|
} else { |
||||
|
this.$message.error('未检索到相关位置坐标') |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
handleMoveCenter () { |
||||
|
//修改地图中心点 |
||||
|
const center = map.getCenter() |
||||
|
const lat = center.getLat() |
||||
|
const lng = center.getLng() |
||||
|
this.dataForm.latitude = lat |
||||
|
this.dataForm.longitude = lng |
||||
|
this.setMarker(lat, lng) |
||||
|
this.convert(lat, lng) |
||||
|
}, |
||||
|
|
||||
|
convert (lat, lng) { |
||||
|
markers.setGeometries([]); |
||||
|
// var input = document.getElementById('location').value.split(','); |
||||
|
let location |
||||
|
if (lat && lng) { |
||||
|
location = new TMap.LatLng(lat, lng); |
||||
|
} else { |
||||
|
location = new TMap.LatLng(this.dataForm.latitude, this.dataForm.longitude); |
||||
|
} |
||||
|
// map.setCenter(location); |
||||
|
markers.updateGeometries([ |
||||
|
{ |
||||
|
id: 'main', // 点标注数据数组 |
||||
|
position: location, |
||||
|
}, |
||||
|
]); |
||||
|
geocoder |
||||
|
.getAddress({ location: location }) // 将给定的坐标位置转换为地址 |
||||
|
.then((result) => { |
||||
|
this.dataForm.address = result.result.address |
||||
|
// 显示搜索到的地址 |
||||
|
}); |
||||
|
}, |
||||
|
// 表单提交 |
||||
|
dataFormSubmitHandle: debounce(function () { |
||||
|
this.$refs['dataForm'].validate((valid) => { |
||||
|
if (!valid) { |
||||
|
return false |
||||
|
} |
||||
|
if(this.dataForm.id) { // 修改 |
||||
|
this.submitModifyOrg() |
||||
|
} else { // 新增 |
||||
|
this.submitAddNewOrg() |
||||
|
} |
||||
|
}) |
||||
|
}, 1000, { 'leading': true, 'trailing': false }), |
||||
|
// 修改 |
||||
|
async submitModifyOrg(){ |
||||
|
this.dataForm.agencyId = this.dataForm.orgId[this.dataForm.orgId.length - 1] |
||||
|
const url = '/pli/power/axisStruct/modifyOrg' |
||||
|
const { data, code, msg } = await requestPost(url,this.dataForm) |
||||
|
if (code === 0) { |
||||
|
this.$message({ |
||||
|
message: this.$t('prompt.success'), |
||||
|
type: 'success', |
||||
|
duration: 500, |
||||
|
onClose: () => { |
||||
|
this.visible = false |
||||
|
this.$emit('refreshDataList') |
||||
|
} |
||||
|
}) |
||||
|
} else { |
||||
|
return this.$message.error(msg) |
||||
|
} |
||||
|
}, |
||||
|
// 新增 |
||||
|
async submitAddNewOrg(){ |
||||
|
const url = '/pli/power/axisStruct/addOrg' |
||||
|
this.dataForm.agencyId = this.dataForm.orgId[this.dataForm.orgId.length - 1] |
||||
|
const { data, code, msg } = await requestPost(url,this.dataForm) |
||||
|
if (code === 0) { |
||||
|
this.$message({ |
||||
|
message: this.$t('prompt.success'), |
||||
|
type: 'success', |
||||
|
duration: 500, |
||||
|
onClose: () => { |
||||
|
this.visible = false |
||||
|
this.$emit('refreshDataList') |
||||
|
} |
||||
|
}) |
||||
|
} else { |
||||
|
return this.$message.error(msg) |
||||
|
} |
||||
|
}, |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
<style lang="scss" scoped > |
||||
|
@import "@/assets/scss/modules/visual/communityManageForm.scss"; |
||||
|
</style> |
||||
|
<style lang="scss" scoped> |
||||
|
.item_width_1 { |
||||
|
width: 560px; |
||||
|
|
||||
|
/deep/.tox .tox-dialog { |
||||
|
z-index: 20000; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
.div_map { |
||||
|
position: relative; |
||||
|
} |
||||
|
.div_searchmap { |
||||
|
z-index: 5000; |
||||
|
position: absolute; |
||||
|
top: 5px; |
||||
|
left: 5px; |
||||
|
} |
||||
|
|
||||
|
.tinymce_view { |
||||
|
height: 400px; |
||||
|
overflow: auto; |
||||
|
} |
||||
|
.text_p { |
||||
|
margin: 0; |
||||
|
padding: 0 10px; |
||||
|
border: 1px solid #d9d9d9; |
||||
|
border-radius: 5px; |
||||
|
> p { |
||||
|
margin: 0; |
||||
|
} |
||||
|
} |
||||
|
</style> |
@ -0,0 +1,275 @@ |
|||||
|
<template> |
||||
|
<el-dialog :visible.sync="visible" title="负责人" :close-on-click-modal="false" :close-on-press-escape="false" @closed="leaderClosed"> |
||||
|
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()" :label-width="$i18n.locale === 'en-US' ? '120px' : '80px'"> |
||||
|
<el-form-item label="类别" label-width="110px" v-if="structLevel || structLevel === 0"> |
||||
|
{{ leaderCategoryCodeArr[structLevel].categoryName }} |
||||
|
</el-form-item> |
||||
|
<el-form-item label="名称" prop="name" label-width="110px"> |
||||
|
<el-input style="width:250px" v-model="dataForm.name" placeholder="负责任人名称"></el-input> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="性别" prop="gender" label-width="110px"> |
||||
|
<el-select style="width:250px" v-model="dataForm.gender" clearable placeholder="性别"> |
||||
|
<el-option |
||||
|
v-for="item in gender" |
||||
|
:key="item.dictValue" |
||||
|
:label="item.dictName" |
||||
|
:value="item.dictValue" |
||||
|
> |
||||
|
</el-option> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="联系方式" prop="mobile" label-width="110px"> |
||||
|
<el-input style="width:250px" v-model="dataForm.mobile" placeholder="联系方式"></el-input> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="简介" prop="interoduction" label-width="110px"> |
||||
|
<el-input style="width:250px" v-model="dataForm.interoduction" placeholder="简介"></el-input> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="头像" prop="avatar" label-width="110px"> |
||||
|
<el-input style="width:250px" v-model="dataForm.avatar" placeholder="头像"></el-input> |
||||
|
</el-form-item> |
||||
|
<!-- <el-form-item label="头像" prop="avatar" label-width="110px"> |
||||
|
<el-upload class="avatar-uploader" |
||||
|
:action="uploadUlr" |
||||
|
:show-file-list="false" |
||||
|
:on-success="(response, file, fileList) => handleImgSuccess('avatar', response, file, fileList)" |
||||
|
:before-upload="beforeImgUpload"> |
||||
|
<img v-if="dataForm.avatar" |
||||
|
:src="dataForm.avatar" |
||||
|
style="width:70px;height:70px" |
||||
|
class="function-icon"> |
||||
|
<i v-else class="el-icon-plus avatar-uploader-icon"></i> |
||||
|
</el-upload> |
||||
|
</el-form-item> --> |
||||
|
</el-form> |
||||
|
<template slot="footer"> |
||||
|
<el-button @click="visible = false">{{ $t('cancel') }}</el-button> |
||||
|
<el-button type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button> |
||||
|
</template> |
||||
|
</el-dialog> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import debounce from 'lodash/debounce' |
||||
|
import { requestPost } from "@/js/dai/request"; |
||||
|
export default { |
||||
|
data () { |
||||
|
return { |
||||
|
uploadUlr: window.SITE_CONFIG['apiURL'] + '/oss/file/uploadqrcodeV2', |
||||
|
visible: false, |
||||
|
dataForm: { |
||||
|
name: '', |
||||
|
gender: '', |
||||
|
mobile: '', |
||||
|
interoduction: '', |
||||
|
categoryCode: '', |
||||
|
avatar: '', |
||||
|
structReferenceId: '', // 动力主轴节点ID |
||||
|
// customerId: localStorage.getItem('customerId'), |
||||
|
leaderId: '' |
||||
|
}, |
||||
|
leaderCategoryCodeArr: '', // 动力主轴节点级别 |
||||
|
gender: [ |
||||
|
{ dictValue: '男', dictName: '男' }, |
||||
|
{ dictValue: '女', dictName: '女' } |
||||
|
], |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
props: { |
||||
|
leaderVisible: { |
||||
|
type: Boolean, |
||||
|
default: false |
||||
|
}, |
||||
|
axisStructId: { |
||||
|
type: String, |
||||
|
default: '' |
||||
|
}, |
||||
|
leaderId: { |
||||
|
type: String, |
||||
|
default: '' |
||||
|
}, |
||||
|
structLevel: { |
||||
|
type: Number, |
||||
|
default: null |
||||
|
}, |
||||
|
}, |
||||
|
created(){ |
||||
|
this.getTagCategoryArr() |
||||
|
}, |
||||
|
watch: { |
||||
|
leaderVisible(newName){ |
||||
|
this.visible = newName |
||||
|
}, |
||||
|
axisStructId (newName) { |
||||
|
this.dataForm.structReferenceId = newName |
||||
|
}, |
||||
|
leaderId(newName) { |
||||
|
if (newName) { |
||||
|
this.dataForm.leaderId = newName |
||||
|
this.getInfo() |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
computed: { |
||||
|
dataRule () { |
||||
|
return { |
||||
|
name: [ |
||||
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
||||
|
], |
||||
|
gender: [ |
||||
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
||||
|
], |
||||
|
mobile: [ |
||||
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
||||
|
], |
||||
|
interoduction: [ |
||||
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
||||
|
], |
||||
|
avatar: [ |
||||
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
||||
|
] |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
methods: { |
||||
|
handleImgSuccess (type, res, file) { |
||||
|
if (res.code === 0 && res.msg === 'success') { |
||||
|
|
||||
|
console.log('type', type) |
||||
|
console.log('res.data.url', res.data.url) |
||||
|
|
||||
|
} else { |
||||
|
this.$message.error(res.msg) |
||||
|
} |
||||
|
}, |
||||
|
beforeImgUpload (file) { |
||||
|
// const isPNG = file.type === 'image/png' |
||||
|
const isLt1M = file.size / 1024 / 1024 < 1 |
||||
|
|
||||
|
// if (!isPNG) { |
||||
|
// this.$message.error('上传图片只能是 PNG 格式!') |
||||
|
// } |
||||
|
if (!isLt1M) { |
||||
|
this.$message.error('上传图片大小不能超过 1MB!') |
||||
|
} |
||||
|
// return isPNG && isLt1M |
||||
|
return isLt1M |
||||
|
}, |
||||
|
// 获取信息 |
||||
|
async getInfo () { |
||||
|
// this.$http.get(`/pli/power/axisLeader/getLeaderDetai/${this.dataForm.structReferenceId}`).then(({ data: res }) => { |
||||
|
// if (res.code !== 0) { |
||||
|
// return this.$message.error(res.msg) |
||||
|
// } |
||||
|
// this.dataForm = { |
||||
|
// ...this.dataForm, |
||||
|
// ...res.data |
||||
|
// } |
||||
|
// }).catch(() => {}) |
||||
|
const url = `/pli/power/axisLeader/getLeaderDetail/${this.dataForm.structReferenceId}` |
||||
|
const { data, code, msg } = await requestPost(url) |
||||
|
if (code === 0) { |
||||
|
this.dataForm = { |
||||
|
...this.dataForm, |
||||
|
...data |
||||
|
} |
||||
|
} else { |
||||
|
this.$message.error(msg) |
||||
|
} |
||||
|
}, |
||||
|
// 表单提交 |
||||
|
dataFormSubmitHandle: debounce(function () { |
||||
|
this.$refs['dataForm'].validate((valid) => { |
||||
|
if (!valid) { |
||||
|
return false |
||||
|
} |
||||
|
if (this.leaderId) { |
||||
|
this.updateLeader() |
||||
|
} else { |
||||
|
this.addLeader() |
||||
|
} |
||||
|
}) |
||||
|
}, 1000, { 'leading': true, 'trailing': false }), |
||||
|
leaderClosed () { |
||||
|
this.visible = false |
||||
|
this.$emit('refreshDataListleader') |
||||
|
}, |
||||
|
async addLeader() { |
||||
|
this.dataForm.categoryCode = this.leaderCategoryCodeArr[this.structLevel].categoryCode |
||||
|
const url = '/pli/power/axisLeader/save/' |
||||
|
const { data, code, msg } = await requestPost(url, this.dataForm) |
||||
|
if (code === 0) { |
||||
|
this.$message({ |
||||
|
message: this.$t('prompt.success'), |
||||
|
type: 'success', |
||||
|
duration: 500, |
||||
|
onClose: () => { |
||||
|
this.visible = false |
||||
|
this.$emit('refreshDataListleader') |
||||
|
} |
||||
|
}) |
||||
|
} else { |
||||
|
this.$message.error(msg) |
||||
|
} |
||||
|
}, |
||||
|
async updateLeader() { |
||||
|
this.dataForm.categoryCode = this.leaderCategoryCodeArr[this.structLevel].categoryCode |
||||
|
const url = '/pli/power/axisLeader/update' |
||||
|
const { data, code, msg } = await requestPost(url, this.dataForm) |
||||
|
if (code === 0) { |
||||
|
this.$message({ |
||||
|
message: this.$t('prompt.success'), |
||||
|
type: 'success', |
||||
|
duration: 500, |
||||
|
onClose: () => { |
||||
|
this.visible = false |
||||
|
this.$emit('refreshDataListleader') |
||||
|
} |
||||
|
}) |
||||
|
} else { |
||||
|
this.$message.error(msg) |
||||
|
} |
||||
|
}, |
||||
|
// 获取动力主轴标签 |
||||
|
async getTagCategoryArr(){ |
||||
|
const url = '/pli/power/axisTag/listSimple/leader' |
||||
|
let params = {} |
||||
|
const { data, code, msg } = await requestPost(url, params) |
||||
|
|
||||
|
if (code === 0) { |
||||
|
this.leaderCategoryCodeArr = data |
||||
|
} else { |
||||
|
this.$message.error(msg) |
||||
|
} |
||||
|
}, |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
<style lang="scss" scoped> |
||||
|
.avatar-uploader { |
||||
|
::v-deep |
||||
|
.el-upload { |
||||
|
cursor: pointer; |
||||
|
position: relative; |
||||
|
overflow: hidden; |
||||
|
} |
||||
|
.el-upload:hover { |
||||
|
border-color: #409EFF; |
||||
|
} |
||||
|
.avatar { |
||||
|
width: 70px; |
||||
|
height: 70px; |
||||
|
display: block; |
||||
|
} |
||||
|
.avatar-uploader-icon { |
||||
|
border: 1px dashed #d9d9d9; |
||||
|
border-radius: 6px; |
||||
|
font-size: 28px; |
||||
|
color: #8c939d; |
||||
|
width: 70px; |
||||
|
height: 70px; |
||||
|
line-height: 70px; |
||||
|
text-align: center; |
||||
|
} |
||||
|
} |
||||
|
</style> |
Loading…
Reference in new issue