Browse Source

Merge branch 'dev_pli_power_axis' of http://git.elinkit.com.cn:7070/r/epmet-oper-gov into dev_pli_power_axis

origin/bugfix_relocation
ZhaoTongYao 3 years ago
parent
commit
b5fd082db2
  1. 8
      src/views/modules/plugins/power/kernelhouseholdTable.vue
  2. 157
      src/views/modules/plugins/power/poweraxis-add-or-update.vue
  3. 124
      src/views/modules/plugins/power/poweraxis.vue
  4. 472
      src/views/modules/plugins/power/poweraxisForm.vue
  5. 212
      src/views/modules/plugins/power/poweraxis_add_leader.vue
  6. 127
      src/views/modules/plugins/power/poweraxistag-add-or-update.vue
  7. 82
      src/views/modules/plugins/power/poweraxistag.vue
  8. 242
      src/views/modules/plugins/power/servicestation.vue
  9. 303
      src/views/modules/plugins/power/servicestationForm.vue
  10. 240
      src/views/modules/plugins/power/servicestationTable.vue

8
src/views/modules/plugins/power/kernelhouseholdTable.vue

@ -84,7 +84,7 @@
<script>
import KernelhouseholdForm from './kernelhouseholdForm'
import { requestPost } from "@/js/dai/request";
import { requestPost, requestGet } from "@/js/dai/request";
import { mapGetters } from 'vuex'
export default {
data () {
@ -114,12 +114,12 @@ export default {
this.tableLoading = true
const url = "/pli/power/kernelHousehold/page"
let params = {
pageSize: this.pageSize,
pageNo: this.pageNo,
limit: this.pageSize,
page: this.pageNo,
axisStructId: this.axisStructId,
ownerName: this.ownerName
}
const { data, code, msg, total } = await requestPost(url, params)
const { data, code, msg, total } = await requestGet(url, params)
if (code === 0) {
this.total = data.total || 0;
this.tableData = data.list ? data.list.map((item) => { return item }) : []

157
src/views/modules/plugins/power/poweraxis-add-or-update.vue

@ -20,35 +20,23 @@
<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-form-item prop="agencyId" label="所属组织" v-if="orgListSwitch">
<el-cascader
v-model="dataForm.orgId"
v-model="dataForm.agencyId"
:options="agencytree"
placeholder="请选择所属组织"
:props="{ expandTrigger: 'hover', label: 'orgName', value: 'orgId', children: 'subOrgList' }"
></el-cascader>
:props="{ expandTrigger: 'hover', emitPath: false, label: 'orgName', value: 'orgId', children: 'subOrgList' }"
:show-all-levels="false"
clearable />
</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 prop="pid" label="所属上级" v-if="!orgListSwitch">
<el-cascader
placeholder="请选择所属上级"
:options="parentStructTree"
v-model="dataForm.pid"
:props="{ expandTrigger: 'hover', emitPath: false, label: 'name', value: 'id', children: 'children' }"
:show-all-levels="false"
clearable />
</el-form-item>
<el-form-item label="排序">
<el-input-number v-model="dataForm.sort" :min="0" :max="10" label="请输入排序"></el-input-number>
@ -81,12 +69,14 @@
<el-input class="item_width_3"
maxlength="50"
placeholder="请输入经度"
:readonly="true"
v-model="dataForm.longitude">
</el-input>
<span style="margin-left: 20px">纬度</span>
<el-input class="item_width_3"
maxlength="50"
placeholder="请输入纬度"
:readonly="true"
v-model="dataForm.latitude">
</el-input>
</div>
@ -118,8 +108,8 @@ export default {
name:'',
agencyId:'',
agencyName:'',
orgId: '',
agencyType:'',
structLevel: null,
pid:'',
categoryCode:'',
sort:'',
@ -130,27 +120,24 @@ export default {
structCategoryArr: [], //
leaderCategoryArr: [], //
agencytree: [], //
GridPartyBranchList:[], //
PartyCommList:[], //
orgListSwitch:false, //
GridPartyBranchSwitch:false, //
partyCommSwitch:false, //
parentStructTree: [], //
orgListSwitch: false, //
}
},
computed: {
dataRule () {
return {
categoryCode:[
{ required: true, message: "上级部门不能为空", trigger: "blur" }
{ required: true, message: "类别不能为空", trigger: "blur" }
],
name:[
{ required: true, message: "上级部门不能为空", trigger: "blur" }
{ required: true, message: "名称不能为空", trigger: "blur" }
],
orgId:[
{ required: true, message: "上级部门不能为空", trigger: "blur" }
agencyId:[
{ required: true, message: "所属组织不能为空", trigger: "blur" }
],
pid:[
{ required: true, message: "上级部门不能为空", trigger: "blur" }
{ required: true, message: "所属上级不能为空", trigger: "blur" }
],
longitude: [
{ required: true, message: '坐标不能为空', trigger: 'blur' }
@ -241,6 +228,18 @@ export default {
})
return orgArray;
},
removeEmptyStructTree (structArray) {
structArray.forEach((structInfo) => {
if (structInfo && structInfo.children) {
if (structInfo.children.length === 0) {
structInfo.children = undefined
} else {
this.removeEmptyStructTree(structInfo.children)
}
}
})
return structArray;
},
//
getInfo () {
this.$http.post(`/pli/power/axisStruct/queryModifyById/${this.dataForm.id}`).then(({ data: res }) => {
@ -251,48 +250,26 @@ export default {
...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
this.structCategoryArr.forEach((item) => {
if(item.categoryCode === this.dataForm.categoryCode){
this.dataForm.structLevel = item.structLevel
}
})
if(this.dataForm.structLevel === 0) {
this.orgListSwitch = true
} else {
this.$message.error(msg)
this.orgListSwitch = false
this.getParentStructTree(this.dataForm.structLevel)
}
}).catch(() => {})
},
//
async getPartyCommList(){
const url = '/pli/power/axisStruct/getPartyCommList'
//
async getParentStructTree(structLevel){
const url = `/pli/power/axisStruct/bylevel/${structLevel}/parenttree`
let params = {}
const { data, code, msg } = await requestPost(url,params)
if (code === 0) {
this.PartyCommList = data
this.parentStructTree = this.removeEmptyStructTree(data)
} else {
this.$message.error(msg)
}
@ -300,24 +277,18 @@ export default {
//
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()
this.structCategoryArr.forEach((item) => {
if(item.categoryCode === val){
this.dataForm.structLevel = item.structLevel
}
})
if (this.dataForm.structLevel === 0) {
this.orgListSwitch = true
this.dataForm.pid = '0'
} else {
this.orgListSwitch = false
this.dataForm.pid = ''
this.getParentStructTree(this.dataForm.structLevel)
}
},
// init
@ -449,8 +420,7 @@ export default {
}, 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 url = '/pli/power/axisStruct/update'
const { data, code, msg } = await requestPost(url,this.dataForm)
if (code === 0) {
this.$message({
@ -468,8 +438,7 @@ export default {
},
//
async submitAddNewOrg(){
const url = '/pli/power/axisStruct/addOrg'
this.dataForm.agencyId = this.dataForm.orgId[this.dataForm.orgId.length - 1]
const url = '/pli/power/axisStruct/save'
const { data, code, msg } = await requestPost(url,this.dataForm)
if (code === 0) {
this.$message({

124
src/views/modules/plugins/power/poweraxis.vue

@ -26,7 +26,7 @@
<el-button style=""
class="diy-button--add"
size="small"
@click="addOrUpdateHandle()">{{ $t('add') }}</el-button>
@click="handleAdd()">{{ $t('add') }}</el-button>
</div>
<!-- 列表表格 -->
<el-table
@ -39,21 +39,45 @@
:header-cell-style="{background:'#2195FE',color:'#FFFFFF'}">
<el-table-column prop="name" label="动力主轴"></el-table-column>
<el-table-column prop="categoryCode" :formatter="categoryCodeFormatter" label="类别" ></el-table-column>
<el-table-column prop="leaderName" label="负责人"></el-table-column>
<el-table-column prop="leaderMobile" label="联系方式" ></el-table-column>
<el-table-column prop="createdTime" label="创建时间" ></el-table-column>
<el-table-column prop="leaderName" label="负责人" width="100"></el-table-column>
<el-table-column prop="leaderMobile" label="联系方式" width="110"></el-table-column>
<el-table-column prop="createdTime" label="创建时间" width="160"></el-table-column>
<el-table-column label="操作" align="center" width="300">
<template slot-scope="scope">
<el-button size="mini" type="danger" icon="el-icon-edit" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
<!-- <el-button size="mini" type="danger" icon="el-icon-edit" @click="addOrUpdateHandle(scope.row.id)">修改</el-button> -->
<el-button size="mini" type="danger" icon="el-icon-edit" @click="handleEdit(scope.row.id)">修改</el-button>
<el-button size="mini" type="warning" icon="el-icon-edit" @click="deleteHandle_my(scope.row.id)">删除</el-button>
<el-button size="mini" type="primary" icon="el-icon-user" @click="addLeader(scope.row.id, scope.row.leaderId, scope.row.structLevel)">负责人</el-button>
<el-button size="mini" type="primary" icon="el-icon-user" @click="add_edit_Leader(scope.row.id, scope.row.leaderId, scope.row.structLevel)">负责人</el-button>
</template>
</el-table-column>
</el-table>
</div>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
<add-leader :axisStructId="axisStructId" :structLevel="structLevel" :leaderId="leaderId" :leaderVisible="leaderVisible" ref="poweraxisAddLeader" @refreshDataListleader="getDataList"></add-leader>
<!-- 弹窗, 新增 / 修改 -->
<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">
<poweraxis-form ref="ref_form"
@dialogCancle="addFormCancle"
@dialogOk="addFormOk"></poweraxis-form>
</el-dialog>
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
<el-dialog :visible.sync="leaderVisible"
:close-on-click-modal="false"
:close-on-press-escape="false"
:title="formTitle"
width="850px"
top="5vh"
class="dialog-h"
@closed="leaderDiaClose">
<add-leader ref="ref_leader"
@leaderCancle="addleaderCancle"
@leaderOk="addleaderOk"></add-leader>
</el-dialog>
</div>
</template>
@ -62,6 +86,7 @@ import { requestPost } from "@/js/dai/request";
import { handleTree } from "@/utils/treeSelect";
import Treeselect from "@riophae/vue-treeselect";
import AddOrUpdate from './poweraxis-add-or-update'
import poweraxisForm from './poweraxisForm'
import mixinViewModule from '@/mixins/view-module'
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import AddLeader from './poweraxis_add_leader.vue';
@ -70,7 +95,8 @@ export default {
components: {
Treeselect,
AddOrUpdate,
AddLeader
AddLeader,
poweraxisForm
},
data(){
return{
@ -91,30 +117,59 @@ export default {
leaderVisible: false,
axisStructId: '', // id
structLevel: null, //
leaderId: ''
leaderId: '',
dataListLoading: false,
//form
formShow: false,
formTitle: '新增小区',
}
},
created(){
this.getDataList()
this.getAgencyTree()
this.getTagCategoryArr()
async created(){
this.dataListLoading = true
await this.getDataList()
await this.getAgencyTree()
await this.getTagCategoryArr()
this.dataListLoading = false
},
mounted(){
this.customerId = localStorage.getItem('customerId')
this.agencyId = localStorage.getItem('agencyId')
},
methods:{
handleEdit (id) {
this.formTitle = '修改'
this.formShow = true
this.$nextTick(() => {
this.$refs.ref_form.initForm('edit', id)
})
},
handleAdd () {
this.formTitle = '新增'
this.formShow = true
this.$nextTick(() => {
this.$refs.ref_form.initForm('add')
})
},
addFormCancle () {
this.formShow = false
},
addFormOk () {
this.formShow = false
this.getDataList()
},
diaClose () {
// this.$refs.ref_form.resetData()
this.formShow = false
},
//
async getAgencyTree(){
const url = '/data/aggregator/org/agencytree'
let params = {
agencyId:this.agencyId,
agencyId: localStorage.getItem('agencyId'),
client:'gov'
}
const { data, code, msg } = await requestPost(url,params)
if (code === 0) {
let _data
if (data) {
@ -218,16 +273,33 @@ export default {
}
},
//
addLeader(axisStructId, leaderId, structLevel) {
add_edit_Leader(axisStructId, leaderId, structLevel) {
this.leaderVisible = true
this.axisStructId = axisStructId
this.structLevel = structLevel
this.leaderId = leaderId
let agencyObj = {
axisStructId: axisStructId,
structLevel: structLevel,
leaderId: leaderId,
}
this.$nextTick(() => {
this.$refs.ref_leader.initForm(agencyObj)
})
},
addleaderOk() {
this.leaderVisible = false
this.axisStructId = ''
this.getDataList()
},
addleaderCancle() {
this.leaderVisible = false
},
leaderDiaClose() {
this.leaderVisible = false
},
getDataListLeader() {
this.leaderVisible = false
this.axisStructId = ''
this.getDataList()
//
handleCancle () {
console.log('取消::::')
// this.resetData()
// this.$emit('dialogCancle')
}
}
}

472
src/views/modules/plugins/power/poweraxisForm.vue

@ -0,0 +1,472 @@
<template>
<div>
<div class="dialog-h-content scroll-h">
<div v-show="!propertyFormShow">
<el-form ref="ref_form"
:inline="true"
:model="dataForm"
:rules="dataRule"
:disabled="formType === 'detail'"
class="form">
<el-form-item prop="categoryCode" label="类别" label-width="150px">
<el-select class="item_width_1" v-model="dataForm.categoryCode" @change="handelChange" placeholder="请选择类别" clearable>
<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 label="名称"
prop="name"
label-width="150px"
style="display: block">
<el-input class="item_width_1"
maxlength="50"
show-word-limit
placeholder="请输入名称"
v-model="dataForm.name">
</el-input>
</el-form-item>
<!-- 下拉框组织的参数 -->
<el-form-item abel-width="150px" prop="agencyId" label="所属组织" v-if="orgListSwitch" label-width="150px">
<el-cascader
class="item_width_1"
v-model="dataForm.agencyId"
:options="agencytree"
placeholder="请选择所属组织"
:props="{ expandTrigger: 'hover', emitPath: false, label: 'orgName', value: 'orgId', children: 'subOrgList' }"
:show-all-levels="false"
clearable />
</el-form-item>
<el-form-item abel-width="150px" prop="pid" label="所属上级" v-if="!orgListSwitch" label-width="150px">
<el-cascader
class="item_width_1"
placeholder="请选择所属上级"
:options="parentStructTree"
v-model="dataForm.pid"
:props="{ expandTrigger: 'hover', emitPath: false, label: 'name', value: 'id', children: 'children' }"
:show-all-levels="false"
clearable />
</el-form-item>
<el-form-item abel-width="150px" label="排序" label-width="150px">
<el-input-number v-model="dataForm.sort" :min="0" :max="10" label="请输入排序"></el-input-number>
</el-form-item>
<el-form-item label="输入位置查坐标"
prop="longitude"
label-width="150px"
style="display: block">
<div style="width:500px">
<el-input class="item_width_4"
maxlength="50"
placeholder="请输入关键字"
v-model="keyWords">
</el-input>
<el-button style="margin-left: 10px"
type="primary"
size="small"
@click="handleSearchMap">查询</el-button>
<div id="app"
class="div_map"></div>
<div style="margin-top: 10px">
<span>经度</span>
<el-input class="item_width_3"
maxlength="50"
placeholder="请输入经度"
:readonly="true"
v-model="dataForm.longitude">
</el-input>
<span style="margin-left: 20px">纬度</span>
<el-input class="item_width_3"
maxlength="50"
placeholder="请输入纬度"
:readonly="true"
v-model="dataForm.latitude">
</el-input>
</div>
</div>
</el-form-item>
</el-form>
</div>
</div>
<div class="div_btn">
<el-button size="small"
@click="handleCancle"> </el-button>
<el-button size="small"
v-if="formType != 'detail'"
type="primary"
:disabled="btnDisable"
@click="handleComfirm"> </el-button>
</div>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
import { Loading } from 'element-ui' // Loading
import { requestPost } from '@/js/dai/request'
var map
var search
var markers
var infoWindowList
let loading //
export default {
data () {
return {
formType: 'add', // addeditdetail
btnDisable: false,
dataForm: {
id:'',
name:'',
agencyId:'',
structLevel: null,
pid:'',
categoryCode:'',
sort:'',
longitude: '', //
latitude: ''//
},
propertyFormShow: false,
keyWords: '',
structCategoryArr: [], //
leaderCategoryArr: [], //
agencytree: [], //
parentStructTree: [], //
orgListSwitch: false, //
}
},
components: {},
mounted () {
this.initMap()
},
methods: {
initForm (type, id) {
this.$refs.ref_form.resetFields();
this.formType = type
this.getTagCategoryArr()
this.getAgencyTree()
if (this.formType === 'edit') {
this.getInfo(id)
}
},
//
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;
},
removeEmptyStructTree (structArray) {
structArray.forEach((structInfo) => {
if (structInfo && structInfo.children) {
if (structInfo.children.length === 0) {
structInfo.children = undefined
} else {
this.removeEmptyStructTree(structInfo.children)
}
}
})
return structArray;
},
//
getInfo (id) {
this.$http.post(`/pli/power/axisStruct/queryModifyById/${id}`).then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
}
this.dataForm = {
...this.dataForm,
...res.data
}
map.setCenter(new TMap.LatLng(this.dataForm.latitude, this.dataForm.longitude))
this.setMarker(this.dataForm.latitude, this.dataForm.longitude)
this.structCategoryArr.forEach((item) => {
if(item.categoryCode === this.dataForm.categoryCode){
this.dataForm.structLevel = item.structLevel
if(this.dataForm.structLevel === 0) {
this.orgListSwitch = true
} else {
this.orgListSwitch = false
this.getParentStructTree(this.dataForm.structLevel)
}
}
})
}).catch(() => {})
},
//
async getParentStructTree(structLevel){
const url = `/pli/power/axisStruct/bylevel/${structLevel}/parenttree`
let params = {}
const { data, code, msg } = await requestPost(url,params)
if (code === 0) {
this.parentStructTree = this.removeEmptyStructTree(data)
} else {
this.$message.error(msg)
}
},
//
handelChange(val){
this.dataForm.categoryCode = val
this.structCategoryArr.forEach((item) => {
if(item.categoryCode === val){
this.dataForm.structLevel = item.structLevel
}
})
if (this.dataForm.structLevel === 0) {
this.orgListSwitch = true
this.dataForm.pid = '0'
} else {
this.orgListSwitch = false
this.dataForm.pid = ''
this.getParentStructTree(this.dataForm.structLevel)
}
},
//
async handleComfirm () {
//
this.btnDisable = true
setTimeout(() => {
this.btnDisable = false
}, 10000)
this.$refs['ref_form'].validate((valid, messageObj) => {
if (!valid) {
app.util.validateRule(messageObj)
this.btnDisable = false
} else {
this.addCommunity()
}
})
},
async addCommunity () {
let url = ''
if (this.formType === 'add') {
this.dataForm.id = ''
url = '/pli/power/axisStruct/save'
} else {
url = '/pli/power/axisStruct/update'
}
const { data, code, msg } = await requestPost(url, this.dataForm)
if (code === 0) {
this.$message({
type: 'success',
message: '操作成功'
})
// this.resetData()
this.$emit('dialogOk')
this.btnDisable = false
} else {
this.btnDisable = false
this.$message.error(msg)
}
},
//
handleCancle () {
// this.resetData()
this.$emit('dialogCancle')
},
resetData () {
this.keyWords = ''
this.dataForm = {
id:'',
name:'',
agencyId:'',
structLevel: null,
pid:'',
categoryCode:'',
sort:'',
longitude: '', //
latitude: ''//
}
this.propertyFormShow = false
this.keyWords= ''
this.structCategoryArr = [] //
this.leaderCategoryArr = [] //
this.agencytree = [] //
this.parentStructTree = [] //
},
//
startLoading () {
loading = Loading.service({
lock: true, //
text: '正在加载……', //
background: 'rgba(0,0,0,.7)' //
})
},
//
endLoading () {
// clearTimeout(timer);
if (loading) {
loading.close()
}
},
// init
initMap () {
//
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)
//
map.on('panend', () => {
this.handleMoveCenter()
})
this.handleMoveCenter()
},
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
} 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)
}
},
computed: {
dataRule () {
return {
categoryCode:[
{ required: true, message: "类别不能为空", trigger: "blur" }
],
name:[
{ required: true, message: "名称不能为空", trigger: "blur" }
],
agencyId:[
{ required: true, message: "所属组织不能为空", trigger: "blur" }
],
pid:[
{ required: true, message: "所属上级不能为空", trigger: "blur" }
],
longitude: [
{ required: true, message: '坐标不能为空', trigger: 'blur' }
]
}
}
},
props: {}
}
</script>
<style lang="scss" scoped >
@import "@/assets/scss/modules/visual/communityManageForm.scss";
</style>

212
src/views/modules/plugins/power/poweraxis_add_leader.vue

@ -1,51 +1,65 @@
<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>
<div>
<div class="dialog-h-content scroll-h">
<div>
<el-form ref="ref_leader"
:inline="true"
:model="dataForm"
:rules="dataRule"
:disabled="formType === 'detail'"
class="form">
<el-form-item label="类别" label-width="150px" v-if="structLevel || structLevel === 0">
<el-input class="item_width_1" :readonly="true" v-model="categoryName"></el-input>
</el-form-item>
<el-form-item label="名称" prop="name" label-width="150px">
<el-input class="item_width_1" v-model="dataForm.name" placeholder="负责任人名称"></el-input>
</el-form-item>
<el-form-item label="性别" prop="gender" label-width="150px">
<el-select class="item_width_1" 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="150px">
<el-input class="item_width_1" v-model="dataForm.mobile" placeholder="联系方式"></el-input>
</el-form-item>
<el-form-item label="简介" prop="interoduction" label-width="150px">
<el-input class="item_width_1" 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="150px">
<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>
<div class="div_btn">
<el-button size="small"
@click="handleCancle"> </el-button>
<el-button size="small"
v-if="formType != 'detail'"
type="primary"
:disabled="btnDisable"
@click="dataFormSubmitHandle"> </el-button>
</div>
</div>
</div>
</div>
</template>
<script>
@ -54,8 +68,9 @@ import { requestPost } from "@/js/dai/request";
export default {
data () {
return {
btnDisable: false,
formType: 'add', // addeditdetail
uploadUlr: window.SITE_CONFIG['apiURL'] + '/oss/file/uploadqrcodeV2',
visible: false,
dataForm: {
name: '',
gender: '',
@ -64,51 +79,21 @@ export default {
categoryCode: '',
avatar: '',
structReferenceId: '', // ID
// customerId: localStorage.getItem('customerId'),
leaderId: ''
},
structLevel: '',
leaderCategoryCodeArr: '', //
categoryName: '',
gender: [
{ dictValue: '', dictName: '男' },
{ dictValue: '', dictName: '女' }
{ dictValue: '1', dictName: '男' },
{ dictValue: '2', 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 () {
@ -125,13 +110,23 @@ export default {
interoduction: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
avatar: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
]
// avatar: [
// { required: true, message: this.$t('validate.required'), trigger: 'blur' }
// ]
}
}
},
methods: {
initForm(agencyObj) {
this.$refs.ref_leader.resetFields();
this.dataForm.structReferenceId = agencyObj.axisStructId
this.dataForm.leaderId = agencyObj.leaderId
this.structLevel = agencyObj.structLevel
this.getTagCategoryArr()
if (this.dataForm.leaderId) {
this.getInfo()
}
},
handleImgSuccess (type, res, file) {
if (res.code === 0 && res.msg === 'success') {
@ -178,21 +173,24 @@ export default {
}
},
//
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 dataFormSubmitHandle () {
//
this.btnDisable = true
setTimeout(() => {
this.btnDisable = false
}, 10000)
this.$refs['ref_leader'].validate((valid, messageObj) => {
if (!valid) {
app.util.validateRule(messageObj)
this.btnDisable = false
} else {
if (this.dataForm.leaderId) {
this.updateLeader()
} else {
this.addLeader()
}
}
})
},
async addLeader() {
this.dataForm.categoryCode = this.leaderCategoryCodeArr[this.structLevel].categoryCode
@ -204,8 +202,7 @@ export default {
type: 'success',
duration: 500,
onClose: () => {
this.visible = false
this.$emit('refreshDataListleader')
this.$emit('leaderOk')
}
})
} else {
@ -222,8 +219,7 @@ export default {
type: 'success',
duration: 500,
onClose: () => {
this.visible = false
this.$emit('refreshDataListleader')
this.$emit('leaderOk')
}
})
} else {
@ -241,6 +237,11 @@ export default {
} else {
this.$message.error(msg)
}
this.categoryName = this.leaderCategoryCodeArr[this.structLevel].categoryName
},
//
handleCancle () {
this.$emit('leaderCancle')
},
}
}
@ -273,3 +274,6 @@ export default {
}
}
</style>
<style lang="scss" scoped >
@import "@/assets/scss/modules/visual/communityManageForm.scss";
</style>

127
src/views/modules/plugins/power/poweraxistag-add-or-update.vue

@ -0,0 +1,127 @@
<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 :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()" :label-width="$i18n.locale === 'en-US' ? '120px' : '80px'">
<el-form-item label="类别" prop="tagCategory">
<el-radio-group v-model="dataForm.tagCategory" size="small">
<el-radio-button label="struct">动力主轴</el-radio-button>
<el-radio-button label="leader">负责人</el-radio-button>
<el-radio-button label="param">默认参数</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item label="类别编码" prop="categoryCode">
<el-input v-model="dataForm.categoryCode" placeholder="标签类别编码"></el-input>
</el-form-item>
<el-form-item label="类别属性" prop="categoryName">
<el-input v-model="dataForm.categoryName" placeholder="标签类别属性"></el-input>
</el-form-item>
<el-form-item label="节点等级" prop="structLevel">
<el-radio-group v-model="dataForm.structLevel" size="small">
<el-radio-button label="0">一级</el-radio-button>
<el-radio-button label="1">二级</el-radio-button>
<el-radio-button label="2">三级</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item label="禁用" prop="forbiddenFlag">
<el-switch
v-model="dataForm.forbiddenFlag"
active-color="#ff4949"
inactive-color="#13ce66"
active-value="1"
inactive-value="0"
active-text="禁用"
inactive-text="正常">
</el-switch>
</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'
export default {
data () {
return {
visible: false,
dataForm: {
id: '',
tagCategory: '',
categoryCode: '',
categoryName: '',
structLevel: 0,
forbiddenFlag: '0'
}
}
},
computed: {
dataRule () {
return {
tagCategory: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
categoryCode: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
categoryName: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
structLevel: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
forbiddenFlag: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
]
}
}
},
methods: {
init () {
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.getInfo()
}
})
},
//
getInfo () {
this.$http.get(`/pli/power/axisTag/${this.dataForm.id}`).then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.dataForm = {
...this.dataForm,
...res.data
}
}).catch(() => {})
},
//
dataFormSubmitHandle: debounce(function () {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false
}
this.$http['post'](
!this.dataForm.id ? '/pli/power/axisTag/save' : '/pli/power/axisTag/update', this.dataForm).then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.$message({
message: this.$t('prompt.success'),
type: 'success',
duration: 500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
}).catch(() => {})
})
}, 1000, { 'leading': true, 'trailing': false })
}
}
</script>

82
src/views/modules/plugins/power/poweraxistag.vue

@ -0,0 +1,82 @@
<template>
<el-card shadow="never" class="aui-card--fill">
<div class="mod-axis__powerAxisTag}">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-button @click="getDataList()">{{ $t('query') }}</el-button>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="addOrUpdateHandle()">{{ $t('add') }}</el-button>
</el-form-item>
<el-form-item>
<el-button type="danger" @click="deleteHandle()">{{ $t('deleteBatch') }}</el-button>
</el-form-item>
</el-form>
<el-table v-loading="dataListLoading" :data="dataList" border @selection-change="dataListSelectionChangeHandle" style="width: 100%">
<el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
<el-table-column prop="tagCategory" label="类别" header-align="center" align="center">
<template slot-scope="scope">
<el-tag size="mini" v-if="scope.row.tagCategory ==='struct'">动力主轴</el-tag>
<el-tag size="mini" v-if="scope.row.tagCategory ==='leader'" type="success">负责人</el-tag>
<el-tag size="mini" v-if="scope.row.tagCategory ==='param'" type="info">默认参数</el-tag>
</template>
</el-table-column>
<el-table-column prop="categoryCode" label="类别编码" header-align="center" align="center"></el-table-column>
<el-table-column prop="categoryName" label="类别属性" header-align="center" align="center"></el-table-column>
<el-table-column prop="structLevel" label="节点等级" header-align="center" align="center">
<template slot-scope="scope">
{{ scope.row.structLevel === 0 ? '一级' : scope.row.structLevel === 1 ? '二级' : '三级' }}
</template>
</el-table-column>
<el-table-column prop="forbiddenFlag" label="禁用状态" header-align="center" align="center">
<template slot-scope="scope">
<el-tag size="mini" v-if="scope.row.forbiddenFlag === '0'" type="success">正常</el-tag>
<el-tag size="mini" v-else type="danger">禁用</el-tag>
</template>
</el-table-column>
<el-table-column prop="updatedTime" label="更新时间" header-align="center" align="center"></el-table-column>
<el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="150">
<template slot-scope="scope">
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">{{ $t('update') }}</el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">{{ $t('delete') }}</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
:current-page="page"
:page-sizes="[10, 20, 50, 100]"
:page-size="limit"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="pageSizeChangeHandle"
@current-change="pageCurrentChangeHandle">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</el-card>
</template>
<script>
import mixinViewModule from '@/mixins/view-module'
import AddOrUpdate from './poweraxistag-add-or-update'
export default {
mixins: [mixinViewModule],
data () {
return {
mixinViewModuleOptions: {
getDataListURL: '/pli/power/axisTag/page',
getDataListIsPage: true,
deleteURL: '/pli/power/axisTag/delete',
deleteIsBatch: true
},
dataForm: {
id: ''
}
}
},
components: {
AddOrUpdate
}
}
</script>

242
src/views/modules/plugins/power/servicestation.vue

@ -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">
<servicestation-table :axisStructId="axisStructId" ref="ref_communityTable"></servicestation-table>
</div>
</div>
</div>
</template>
<script>
import CDialog from '@c/CDialog'
import servicestationTable from './servicestationTable'
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: {
servicestationTable, 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>

303
src/views/modules/plugins/power/servicestationForm.vue

@ -0,0 +1,303 @@
<template>
<div>
<div class="dialog-h-content scroll-h">
<el-form ref="ref_form"
:inline="true"
:model="dataForm"
:rules="dataRule"
:disabled="formType === 'detail'"
class="form">
<el-form-item label="服务站名称"
prop="name"
label-width="150px"
style="display: block">
<el-input class="item_width_1"
maxlength="50"
show-word-limit
placeholder="请输入服务站名称"
v-model="dataForm.name">
</el-input>
</el-form-item>
<el-form-item label="服务站地址"
prop="address"
label-width="150px"
style="display: block">
<el-input class="item_width_1"
maxlength="50"
show-word-limit
placeholder="请输入服务站地址"
v-model="dataForm.address">
</el-input>
</el-form-item>
<el-form-item label="服务站坐标"
prop="longitude"
label-width="150px"
style="display: block">
<div style="width:500px">
<el-input class="item_width_4"
maxlength="50"
placeholder="请输入关键字"
v-model="keyWords">
</el-input>
<el-button style="margin-left: 10px"
type="primary"
size="small"
@click="handleSearchMap">查询</el-button>
<div id="app"
class="div_map"></div>
<div style="margin-top: 10px">
<span>经度</span>
<el-input class="item_width_3"
maxlength="50"
placeholder="请输入经度"
:readonly="true"
v-model="dataForm.longitude">
</el-input>
<span style="margin-left: 20px">纬度</span>
<el-input class="item_width_3"
maxlength="50"
placeholder="请输入纬度"
:readonly="true"
v-model="dataForm.latitude">
</el-input>
</div>
</div>
</el-form-item>
<el-form-item label-width="150px" label="排序">
<el-input-number v-model="dataForm.sort" :min="0" :max="10" label="请输入排序"></el-input-number>
</el-form-item>
</el-form>
</div>
<div class="div_btn">
<el-button size="small"
@click="handleCancle"> </el-button>
<el-button size="small"
v-if="formType != 'detail'"
type="primary"
:disabled="btnDisable"
@click="handleComfirm"> </el-button>
</div>
</div>
</template>
<script>
import { requestPost } from '@/js/dai/request'
var map
var search
var markers
var infoWindowList
let loading //
export default {
data () {
return {
formType: 'add', // addeditdetail
btnDisable: false,
dataForm: {
structReferenceId: '', //ID
name: '', //
address: '', //
longitude: '', //
latitude: '', //
sort: '', //
},
keyWords: ''
}
},
components: {},
mounted () {
this.initMap()
},
methods: {
async initForm (type, row, agencyObj) {
this.$refs.ref_form.resetFields();
this.agencyObj = agencyObj
this.formType = type
console.log(row)
if (row) {
this.dataForm = JSON.parse(JSON.stringify(row))
map.setCenter(new TMap.LatLng(this.dataForm.latitude, this.dataForm.longitude))
this.setMarker(this.dataForm.latitude, this.dataForm.longitude)
}
// else {
// map.setCenter(new TMap.LatLng(agencyObj.latitude, agencyObj.longitude))
// }
},
// init
initMap () {
//
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)
//
map.on('panend', () => {
this.handleMoveCenter()
})
this.handleMoveCenter()
},
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
} 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)
},
async handleComfirm () {
this.btnDisable = true
setTimeout(() => {
this.btnDisable = false
}, 10000)
this.$refs['ref_form'].validate((valid, messageObj) => {
if (!valid) {
app.util.validateRule(messageObj)
this.btnDisable = false
} else {
this.addCommunity()
}
})
},
async addCommunity () {
let url = ''
this.dataForm.structReferenceId = this.axisStructId
if (this.formType === 'add') {
url = '/pli/power/serviceStation/save'
} else {
url = '/pli/power/serviceStation/update'
}
const { data, code, msg } = await requestPost(url, this.dataForm)
if (code === 0) {
this.$message({
type: 'success',
message: '操作成功'
})
this.resetData()
this.$emit('dialogOk')
this.btnDisable = false
} else {
this.btnDisable = false
this.$message.error(msg)
}
},
handleCancle () {
this.resetData()
this.$emit('dialogCancle')
},
resetData () {
this.keyWords = ''
this.dataForm = {
name: '', //
address: '', //
longitude: '', //
latitude: '' //
}
}
},
computed: {
dataRule () {
return {
name: [
{ required: true, message: '服务站名称不能为空', trigger: 'blur' },
{
min: 1,
max: 50,
message: '服务站名称长度在 1 到 50个字符',
trigger: 'blur'
}
],
address: [
{ required: true, message: '详细地址不能为空', trigger: 'blur' }
],
longitude: [
{ required: true, message: '坐标不能为空', trigger: 'blur' }
]
}
},
propertyRule () {
name: [
{ required: true, message: '物业名称不能为空', trigger: 'blur' }
// { min: 1, max: 50, message: ' 1 50', trigger: 'blur' }
]
}
},
props: {
axisStructId: { // id
type: String,
default: ''
}
},
}
</script>
<style lang="scss" scoped >
@import "@/assets/scss/modules/visual/communityManageForm.scss";
</style>

240
src/views/modules/plugins/power/servicestationTable.vue

@ -0,0 +1,240 @@
<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="name"
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="name"
label="服务站名称"
width="150">
</el-table-column>
<el-table-column prop="address"
label="服务站地址">
</el-table-column>
<el-table-column prop="createdTime"
label="创建时间">
</el-table-column>
<el-table-column label="操作"
fixed="right"
width="120"
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>
<el-button type="text"
class="div-table-button--edit"
size="small"
@click="handleEdit(scope.row)">修改</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">
<servicestation-form ref="ref_form"
@dialogCancle="addFormCancle"
@dialogOk="addFormOk"
:axisStructId="axisStructId"></servicestation-form>
</el-dialog>
</div>
</template>
<script>
import ServicestationForm from './servicestationForm'
import { requestPost, requestGet } from "@/js/dai/request";
import { mapGetters } from 'vuex'
export default {
data () {
return {
total: 0,
pageSize: 20,
pageNo: 0,
tableLoading: false,
name: '',
tableData: [],
//form
formShow: false,
formTitle: '添加'
}
},
components: {
ServicestationForm
},
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/serviceStation/page"
let params = {
limit: this.pageSize,
page: this.pageNo,
axisStructId: this.axisStructId,
name: this.name
}
const { data, code, msg, total } = await requestGet(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/serviceStation/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
this.$nextTick(() => {
this.$refs.ref_form.initForm('add', null, {})
})
} else {
return this.$message.error('请选择动力主轴节点')
}
},
//
handleEdit (row) {
this.formTitle = '修改'
this.formShow = true
this.$nextTick(() => {
this.$refs.ref_form.initForm('edit', row, {})
})
},
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>
Loading…
Cancel
Save