|
@@ -27,7 +27,7 @@
|
|
|
v-model="floorId"
|
|
|
caption="所属楼层:"
|
|
|
@change="chageFloor"
|
|
|
- :hideClear='true'
|
|
|
+ :hideClear='false'
|
|
|
:selectdata="dataFloor"
|
|
|
:placeholder="'请选择'"
|
|
|
class="search-select"
|
|
@@ -41,7 +41,7 @@
|
|
|
<searchTree @getTreeId="getTreeId" :treeData="treeData"/>
|
|
|
</div>
|
|
|
<div class="checkbox">
|
|
|
- <a-table :pagination="false" row-key='sbjbm' :columns="typeEdit==1?columnsSys:columnsLocal" :data-source="tableData" :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange,onSelect:onSelect }" :scroll="{ y: 340 }" :loading="loading"/>
|
|
|
+ <a-table :pagination="false" row-key='id' :columns="typeEdit==1?columnsSys:columnsLocal" :data-source="tableData" :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange,onSelect:onSelect }" :scroll="{ y: 340 }" :loading="loading"/>
|
|
|
<a-pagination v-if="total>0" v-model="page" :total="total" show-less-items style="margin-left: auto;" @change="handleTableChange"/>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -52,7 +52,7 @@
|
|
|
</div>
|
|
|
|
|
|
<div class="list-box">
|
|
|
- <p v-for="(item,index) in selectList" :key="index" class="list">{{item.sbjc}}
|
|
|
+ <p v-for="(item,index) in selectList" :key="index" class="list">{{item.sbjc||item.wzjc}}
|
|
|
<a-icon type="close" class="icon" @click="deleteItem(item,index)"/>
|
|
|
</p>
|
|
|
</div>
|
|
@@ -64,13 +64,13 @@
|
|
|
|
|
|
<script>
|
|
|
import searchTree from "@/components/edit/search_tree";
|
|
|
- import {queryGlsmsasset ,getQuerySmsxt,getPlazaFloor,getQuerySmsxtBy} from "@/api/editer";
|
|
|
+ import {queryGlsmsasset ,getQuerySmsxt,getPlazaFloor,getQuerySmsxtBy,queryWzfldl,queryWzflByDl,queryGlsmsLocation} from "@/api/editer";
|
|
|
export default {
|
|
|
name: "edit-dialog",
|
|
|
components: {searchTree},
|
|
|
props:{
|
|
|
typeEdit:Number , //用于区分是设备 还是 位置
|
|
|
- getmajorId:Number, //专业Id
|
|
|
+ getmajorId:String, //专业Id
|
|
|
sysNum:Number //设备总数
|
|
|
},
|
|
|
data() {
|
|
@@ -98,7 +98,7 @@
|
|
|
},
|
|
|
{
|
|
|
title: '设备内码',
|
|
|
- dataIndex: 'sbxh',
|
|
|
+ dataIndex: 'sbjbm',
|
|
|
key: 'sbjbm',
|
|
|
width: '25%',
|
|
|
},
|
|
@@ -106,15 +106,15 @@
|
|
|
columnsLocal : [
|
|
|
{
|
|
|
title: '位置名称',
|
|
|
- dataIndex: 'name',
|
|
|
- key: 'name',
|
|
|
+ dataIndex: 'wzjc',
|
|
|
+ key: 'wzjc',
|
|
|
width: '75%',
|
|
|
- scopedSlots: { customRender: 'name' },
|
|
|
+ scopedSlots: { customRender: 'wzjc' },
|
|
|
},
|
|
|
{
|
|
|
title: '位置内码',
|
|
|
- dataIndex: 'code',
|
|
|
- key: 'code',
|
|
|
+ dataIndex: 'location',
|
|
|
+ key: 'location',
|
|
|
width: '25%',
|
|
|
},
|
|
|
],
|
|
@@ -131,8 +131,14 @@
|
|
|
majorId(){
|
|
|
return this.getmajorId||''
|
|
|
}
|
|
|
-
|
|
|
},
|
|
|
+ watch:{
|
|
|
+ floorId(val){
|
|
|
+ if(val==''){
|
|
|
+ this.queryGlsmsasset();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
showModal() {
|
|
|
this.visible = true;
|
|
@@ -155,6 +161,7 @@
|
|
|
console.log(val)
|
|
|
},
|
|
|
handleMajor(val) {
|
|
|
+ this.tableData = [];
|
|
|
this.getQuerySmsxtBy(val.id)
|
|
|
},
|
|
|
chageFloor(data) {
|
|
@@ -179,27 +186,48 @@
|
|
|
plazaId: '1000423',//广场id 必填
|
|
|
page: this.page,//页数
|
|
|
size: this.size,//条数
|
|
|
- type: this.typeEdit,//类型
|
|
|
}
|
|
|
- if (this.keyword) {
|
|
|
- data.keyword = `${this.keyword}:brand`
|
|
|
+ if( this.keyword){
|
|
|
+ data.keyword = this.typeEdit==1? `${this.keyword}:brand`:`${this.keyword}:wzjc`
|
|
|
}
|
|
|
- let paramData = {classstructureid: this.classstructureid,floor:this.floorId};
|
|
|
- let paramDataLocal = {locfl: this.locfl,floor:this.floorId};
|
|
|
+ let paramData = {classstructureid: this.classstructureid,gname:this.floorId};
|
|
|
+ let paramDataLocal = {locfl: this.locfl,gname:this.floorId};
|
|
|
this.loading = true;
|
|
|
- queryGlsmsasset(data,this.typeEdit==1?paramData:paramDataLocal).then(res => {
|
|
|
- this.loading = false;
|
|
|
- if(res.result == 'success'){
|
|
|
- this.total = res.count;
|
|
|
- if(res.data){
|
|
|
- this.tableData = res.data;
|
|
|
- }else if(res.count == 0){
|
|
|
- this.tableData = [];
|
|
|
+ if(this.typeEdit==1){
|
|
|
+ queryGlsmsasset(data,paramData).then(res => {
|
|
|
+ this.loading = false;
|
|
|
+ if(res.data.result == 'success'){
|
|
|
+ this.total = res.data.count;
|
|
|
+ if(res.data.data){
|
|
|
+ let data = res.data.data;
|
|
|
+ data.map(item=>{
|
|
|
+ item.id = item.sbjbm
|
|
|
+ })
|
|
|
+ this.tableData = data;
|
|
|
+
|
|
|
+ }else if(res.data.count == 0){
|
|
|
+ this.tableData = [];
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ this.$message.error('数据请求失败')
|
|
|
}
|
|
|
- }else{
|
|
|
- this.$message.error('数据请求失败')
|
|
|
- }
|
|
|
- })
|
|
|
+ })
|
|
|
+ }else if(this.typeEdit==2){
|
|
|
+ queryGlsmsLocation(data,paramDataLocal).then(res => {
|
|
|
+ this.loading = false;
|
|
|
+ if(res.data.result == 'success'){
|
|
|
+ this.total = res.data.count;
|
|
|
+ if(res.data.data){
|
|
|
+ this.tableData = res.data.data;
|
|
|
+ }else if(res.data.count == 0){
|
|
|
+ this.tableData = [];
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ this.$message.error('数据请求失败')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
},
|
|
|
//分页切换点击
|
|
|
handleTableChange(page, pageSize) {
|
|
@@ -209,7 +237,7 @@
|
|
|
onSelect(record, selected, selectedRows, nativeEvent){
|
|
|
if(!selected && this.selectList.length>0){
|
|
|
this.selectList.map((item,index)=>{
|
|
|
- if( item.sbjbm == record.sbjbm){
|
|
|
+ if( item.id == record.id){
|
|
|
this.selectList.splice(index,1);
|
|
|
}
|
|
|
})
|
|
@@ -230,7 +258,7 @@
|
|
|
|
|
|
this.selectList = this.selectList.reduce (function(item,next){
|
|
|
|
|
|
- obj[next.sbjbm] ? ' ' : obj[next.sbjbm] = true && item.push(next)
|
|
|
+ obj[next.id] ? ' ' : obj[next.id] = true && item.push(next)
|
|
|
|
|
|
return item;
|
|
|
|
|
@@ -238,7 +266,7 @@
|
|
|
},
|
|
|
//右侧删除
|
|
|
deleteItem(item,index){
|
|
|
- this.selectedRowKeys.splice(this.selectedRowKeys.indexOf(item.sbjbm),1);
|
|
|
+ this.selectedRowKeys.splice(this.selectedRowKeys.indexOf(item.id),1);
|
|
|
this.selectList.splice(index,1);
|
|
|
},
|
|
|
//右侧清空
|
|
@@ -255,60 +283,101 @@
|
|
|
if(res.result == 'success'){
|
|
|
let data = res.data;
|
|
|
data.map(item=>{
|
|
|
- item.id = item.code;
|
|
|
+ item.id = item.gname;
|
|
|
})
|
|
|
this.dataFloor = data;
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- //获取专业
|
|
|
+ //获取设备大类和位置大类
|
|
|
getQuerySmsxt(){
|
|
|
- getQuerySmsxt({}).then(res =>{
|
|
|
- if(res.result == 'success'){
|
|
|
- if(res.data){
|
|
|
- let data = res.data;
|
|
|
- data.map(item=>{
|
|
|
- item.id = item.smsxt;
|
|
|
- item.name = item.smsxtname;
|
|
|
- })
|
|
|
- this.majorList = data;
|
|
|
- }
|
|
|
+ if (this.typeEdit==1){
|
|
|
+ getQuerySmsxt({}).then(res =>{
|
|
|
+ if(res.result == 'success'){
|
|
|
+ if(res.data){
|
|
|
+ let data = res.data;
|
|
|
+ data.map(item=>{
|
|
|
+ item.id = item.code;
|
|
|
+ item.name = item.name;
|
|
|
+ })
|
|
|
+ this.majorList = data;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }else if(this.typeEdit ==2){
|
|
|
+ queryWzfldl({}).then(res =>{
|
|
|
+ if(res.result == 'success'){
|
|
|
+ if(res.data){
|
|
|
+ let data = res.data;
|
|
|
+ data.map(item=>{
|
|
|
+ item.id = item.dl;
|
|
|
+ item.name = item.dl;
|
|
|
+ })
|
|
|
+ this.majorList = data;
|
|
|
+ }
|
|
|
}
|
|
|
- })
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
},
|
|
|
+ // 获取设备大类下的分类和位置大类下的分类
|
|
|
getQuerySmsxtBy(smsxt){
|
|
|
+ if(this.typeEdit==1){
|
|
|
let data = {
|
|
|
smsxt:smsxt
|
|
|
}
|
|
|
- getQuerySmsxtBy(data,{}).then(res =>{
|
|
|
- if(res.result == 'success') {
|
|
|
- if(res.data){
|
|
|
- let data = res.data;
|
|
|
- (function recursion(newObj) {
|
|
|
- newObj.map(item=>{
|
|
|
- item.label = item.name;
|
|
|
- if(item.children){
|
|
|
- recursion(item.children);
|
|
|
- }
|
|
|
- })
|
|
|
- })(data)
|
|
|
-
|
|
|
- this.treeData = data;
|
|
|
+ getQuerySmsxtBy(data,{}).then(res =>{
|
|
|
+ if(res.result == 'success') {
|
|
|
+ if(res.data){
|
|
|
+ let data = res.data;
|
|
|
+ (function recursion(newObj) {
|
|
|
+ newObj.map(item=>{
|
|
|
+ item.label = item.gcxxhxtname || item.classqc;
|
|
|
+ item.id = item.gcxxhxtnum || item.id;
|
|
|
+ item.children = item.data;
|
|
|
+ if(item.children){
|
|
|
+ recursion(item.children);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })(data)
|
|
|
+
|
|
|
+ this.treeData = data;
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ this.$message.error('获取失败');
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }else if(this.typeEdit==2){
|
|
|
+ let data = {
|
|
|
+ dl:smsxt
|
|
|
}
|
|
|
- }else{
|
|
|
- this.$message.error('获取失败');
|
|
|
+ queryWzflByDl(data,{}).then(res =>{
|
|
|
+ if(res.result == 'success') {
|
|
|
+ if(res.data){
|
|
|
+ let data = res.data;
|
|
|
+ (function recursion(newObj) {
|
|
|
+ newObj.map(item=>{
|
|
|
+ item.label = item.name;
|
|
|
+ if(item.children){
|
|
|
+ recursion(item.children);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })(data)
|
|
|
+
|
|
|
+ this.treeData = data;
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ this.$message.error('获取失败');
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
- })
|
|
|
+
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
this.getQuerySmsxt();
|
|
|
//如果有专业就带过来
|
|
|
- if(this.majorId){
|
|
|
- this.getQuerySmsxtBy(this.majorId)
|
|
|
- }else{
|
|
|
- this.getQuerySmsxtBy('');
|
|
|
- }
|
|
|
+ this.getQuerySmsxtBy(this.majorId)
|
|
|
|
|
|
|
|
|
|