jsy-app/pages/work/user/otherDevice.vue

167 lines
3.6 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<custom-nav-bar :left="true" title="其它设备权限">
<template v-slot:right>
<view class="fixed">
<view align="right" class="iconfont icon-jia icon" v-hasPermi="['system:permission:add']"
@click="onAdd"></view>
</view>
</template>
</custom-nav-bar>
<view class="index-container">
<z-paging class="paging" ref="paging" use-virtual-list bg-color="#F6F3F3" :loading-more-enabled="false">
<template #top>
<view class="search">
<u-search placeholder="请输入设备编号" @search="onSearchValue" @custom="onSearchValue"
@clear="onSearchValue(null)" shape="square"></u-search>
</view>
</template>
<template #cell="{ item }">
<view class="item-container">
<view class="flex">
<view class="flex-text global-font-size-1">
<view class="flex-text-one">设备编号:</view>
<view>{{ item.deviceCode }}</view>
</view>
<view class="flex">
<u--text size="10" style="margin-left: 10px"
prefixIcon="../../../static/images/work/user/user-index-del-icon.png"
v-hasPermi="['system:permission:remove']" iconStyle="font-size: 10px;margin-right: 2px;"
text="删除" @click="onDeleteClick(item.id)"></u--text>
</view>
</view>
<view class="flex-text global-font-size-1" style="margin: 5px 0px">
<view class="flex-text-one">设备类型</view>
<view>{{ item.deviceTypeName }}</view>
</view>
</view>
</template>
</z-paging>
</view>
</template>
<script>
import plugin from "@/plugins";
import {
getUseDevicePermission,
getUnUseDeviceList,
addBatch,
delDeviceUserPermission
} from "@/api/system/deviceUserPermission";
export default {
data() {
return {
dataList: [],
query: {
landId: null,
deviceCode: null,
userId: null
}
};
},
onLoad(options) {
this.query.landId = options.landId;
this.query.userId = options.userId;
},
onShow() {
this.queryList();
},
methods: {
queryList() {
if (!this.query.landId) {
return;
}
this.dataList = [];
getUseDevicePermission(this.query).then(res => {
this.dataList = res.data;
this.$refs.paging.complete(this.dataList);
});
},
onSearchValue(e) {
this.query.deviceCode = e;
this.queryList();
},
onAdd() {
plugin.tab.navigateTo(
`/pages/work/user/selectOtherDevice?landId=${this.query.landId}&userId=${this.query.userId}`)
},
onDeleteClick(id) {
delDeviceUserPermission(id).then(res => {
this.queryList();
});
}
}
};
</script>
<style lang="scss" scoped>
.index-container {
background-color: #f6f3f3;
height: 100%;
.search {
background-color: white;
padding: 10px;
}
.title {
height: 50px;
display: flex;
padding: 15px 15px;
background: white;
align-items: center;
text {
font-size: 14px;
margin-right: 10px;
}
}
.button {
padding: 10px 20px;
display: flex;
background: white;
}
.item-container {
margin: 10px 10px;
padding: 10px 20px;
background: white;
height: 100%;
border-radius: 10px;
box-shadow: 1px 1px 2px 2px rgba(0, 0, 0, 0.05);
.flex-text {
display: flex;
align-items: center;
.flex-text-one {
color: #939393;
}
}
.icon {
margin-right: 5px;
}
.flex {
display: flex;
align-items: center;
justify-content: space-between;
}
}
}
.tips {
padding: 10px;
line-height: 20px;
font-size: 14px;
color: gray;
background-color: #fff;
border-top: 1px solid #eee;
}
::v-deep.zp-paging-container {
background: #f3f3f3 !important;
}
</style>