<template>
|
|
<view class="template-job tn-safe-area-inset-bottom tn-skeleton">
|
|
<!-- 顶部自定义导航 -->
|
<!-- <view class=""> -->
|
|
<tn-nav-bar fixed alpha customBack>
|
<view slot="right" class='tn-custom-nav-bar__back' @click="gosave">
|
|
<text style="margin-right: 20px;">新增</text>
|
<!-- <text class='tn-icon tn-icon-add'></text> -->
|
</view>
|
<view slot="back" class='tn-custom-nav-bar__back' @click="goBack">
|
<text class='tn-icon tn-icon-left'></text>
|
<text>返回</text>
|
</view>
|
<text class="page-title">部门管理</text>
|
</tn-nav-bar>
|
<!-- </view> -->
|
|
|
<view class="page-wrap u-skeleton">
|
<data-list :width="width" class="data-list" ref="list" @load="handleLoad" @refresh="handleRefresh"
|
style="margin-top: 100px;">
|
|
<view v-for="(item, index) in list" :key="index">
|
|
<view>
|
<tn-button class="modal-btn" backgroundColor="#01BEFF" size="sm"
|
@click="itemClick(item,index)">删除</tn-button>
|
<view style="display: flex;margin-top: 10px;">
|
<!-- <u-checkbox-group v-model="item.checked" placement="column" @change="checkboxChange(item)">
|
<u-checkbox :customStyle="{marginTop: '5px'}">
|
</u-checkbox>
|
</u-checkbox-group> -->
|
<view style="margin-left: 23px;margin-bottom: 10px;font-size: 20px;">编号:{{item.id}}</view>
|
</view>
|
|
<view style="display: flex;">
|
|
<!-- <view style="margin-left: 23px;margin-bottom: 10px;color: #5e5e5e;">编号:{{item.objectid}}
|
</view> -->
|
<view style="margin-left: 23px;margin-bottom: 10px;color: #5e5e5e;">名称:{{item.name}}</view>
|
</view>
|
|
<!-- <view style="margin-left: 23px;margin-bottom: 10px;color: #5e5e5e;">
|
坐标:X{{item.px}};Y{{item.py}};F{{item.pfloor}}</view>
|
<view style="margin-left: 23px;margin-bottom: 10px;color: #5e5e5e;">
|
经纬:{{item.lat}};{{item.lng}};{{item.gao}}</view> -->
|
<view style="margin-left: 23px;margin-bottom: 10px;color: #ffaa00;">时间:{{item.addtime}}</view>
|
<u-line style="margin-left: 14px;"></u-line>
|
</view>
|
</view>
|
</data-list>
|
</view>
|
|
<tn-popup v-model="showpopup" mode="bottom" closeBtn>
|
<view class="page-wrap u-skeleton">
|
<!-- <view class="item-wrap"> -->
|
<tn-form>
|
<tn-form-item label="名称:">
|
<tn-input v-model="form.name" inputAlign="right" placeholder="请输入名称"></tn-input>
|
</tn-form-item>
|
|
</tn-form>
|
<!-- </view> -->
|
<button style="margin-top: 20px;" type="primary" @click="submitForm">保存</button>
|
</view>
|
</tn-popup>
|
<tn-skeleton :show="showSkeleton"></tn-skeleton>
|
<successCom ref="refSuccess"></successCom>
|
</view>
|
</template>
|
|
<script>
|
import successCom from '@/components/success.vue'
|
import {
|
deleteBumen,
|
saveBumen,
|
moreprocessingWarn,
|
findbumenpage
|
} from '@/config/api.js';
|
import {
|
minLogin
|
} from '@/js/minLogin.js'
|
import {
|
pagesAlarm
|
} from '@/js/pages/alarm.js'
|
export default {
|
mixins: [minLogin, pagesAlarm],
|
components: {
|
successCom
|
},
|
data() {
|
return {
|
form: {
|
name: '',
|
company: '',
|
},
|
showpopup: false,
|
show: false,
|
width: '90%',
|
checkboxValue1: [],
|
warnindex: 0,
|
warlist: {},
|
keyword: '',
|
pageNo: 1,
|
pageSize: 10,
|
imgStyle: {
|
width: '100px',
|
height: '1000px',
|
borderRadius: '50%'
|
},
|
showSkeleton: true,
|
options: [{
|
text: '删除',
|
style: {
|
backgroundColor: '#F93737',
|
}
|
}, ],
|
boxKey: 0,
|
scrollHeight: 500,
|
topheight: 0,
|
paddingTop: 60,
|
emitDate: 'indexHome',
|
show: false,
|
time: '',
|
list: [],
|
total: 0,
|
options1: [{
|
text: '删除',
|
style: {
|
backgroundColor: '#F93737'
|
}
|
}]
|
}
|
},
|
|
computed: {
|
countList() {
|
let num = 0;
|
for (let i in this.list) {
|
num += this.list[i].fQty;
|
}
|
return num;
|
}
|
},
|
|
mounted() {
|
this.topheight = this.vuex_custom_bar_height + 15
|
setTimeout(() => {
|
this.showSkeleton = false
|
}, 1000)
|
this.scrollHeight = this.screenHeight - 282;
|
|
setTimeout(() => {
|
this.paddingTop = this.vuex_padding_top
|
this.paddingTop += 5
|
}, 400)
|
},
|
onLoad() {
|
|
},
|
onUnload() {},
|
methods: {
|
submitForm() {
|
this.form.company = this.company
|
saveBumen(this.form).then((res) => {
|
if (res.data == 1) {
|
this.showpopup = false
|
this.handleRefresh({
|
page: 1,
|
size: this.pageSize
|
}, () => {
|
// 可以在这里处理加载完成后的逻辑
|
});
|
} else {
|
this.$refs.refSuccess.showBox({
|
type: 'error',
|
txt: res.data
|
});
|
}
|
})
|
},
|
gosave() {
|
this.showpopup = true
|
},
|
goBack() {
|
this.$emit('tobumen', 4);
|
// uni.reLaunch({
|
// url: '/pages/index/person'
|
// });
|
},
|
// 模拟请求加载数据
|
handleLoad(data, callback) {
|
const params = {
|
current: data.page,
|
size: data.size,
|
company: this.company,
|
juese:uni.getStorageSync('juese'),
|
}
|
if (this.vuex_is_login) {
|
findbumenpage(params).then((res) => {
|
if (res.code == 0) {
|
let list = [];
|
setTimeout(() => {
|
let list = res.data.map(item => ({
|
...item,
|
checked: false // 初始化checked属性为false
|
}));
|
this.list = [...this.list, ...list];
|
callback({
|
list: this.list,
|
total: res.data.length
|
});
|
}, 1500);
|
}
|
})
|
} else {
|
callback({
|
list: [],
|
total: 0
|
});
|
}
|
},
|
handleSearch(data, callback) {
|
const params = {
|
current: 1,
|
size: 10,
|
objectid: this.keyword,
|
company: this.company,
|
juese:uni.getStorageSync('juese'),
|
}
|
if (this.vuex_is_login) {
|
findbumenpage(params).then((res) => {
|
this.list = []
|
if (res.code == 0) {
|
let list = [];
|
setTimeout(() => {
|
let list = [];
|
for (var i = 0; i < res.data.length; i++) {
|
list.push(res.data[i]);
|
}
|
this.list = [...this.list, ...list];
|
callback({
|
list: this.list,
|
total: res.data.length
|
});
|
}, 1500);
|
}
|
})
|
}
|
},
|
// 模拟请求数据刷新
|
handleRefresh(data, callback) {
|
const params = {
|
current: data.page,
|
size: data.size,
|
objectid: data.objectid,
|
company: this.company,
|
juese:uni.getStorageSync('juese'),
|
}
|
if (this.vuex_is_login) {
|
findbumenpage(params).then((res) => {
|
if (res.code == 0) {
|
let list = [];
|
setTimeout(() => {
|
let list = [];
|
for (var i = 0; i < res.data.length; i++) {
|
list.push(res.data[i]);
|
}
|
this.list = []
|
this.list = [...this.list, ...list];
|
callback({
|
list: this.list,
|
total: res.data.length
|
});
|
}, 1500);
|
}
|
})
|
}
|
},
|
itemClick(item, index) {
|
// 删除部门
|
|
const params = {
|
id: item.id,
|
|
}
|
deleteBumen(params).then((res) => {
|
this.handleRefresh({
|
page: 1,
|
size: this.pageSize
|
}, () => {
|
// 可以在这里处理加载完成后的逻辑
|
});
|
})
|
// this.lock = true
|
// this.warlist = item
|
// this.warnindex = index
|
},
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.modal-btn {
|
position: absolute;
|
|
left: 80%;
|
// margin-top: 40px;
|
// display: flex;
|
// align-items: center;
|
// justify-content: center;
|
// box-sizing: border-box;
|
// width: 120rpx;
|
// height: 40rpx;
|
// background: rgba(103, 149, 255, 0.2);
|
}
|
|
.page-wrap {
|
height: 100%;
|
padding-top: 45px;
|
padding-left: 30rpx;
|
padding-right: 30rpx;
|
|
.test-view {
|
height: 300rpx;
|
}
|
|
.navbar-content {
|
width: 100%;
|
display: flex;
|
padding: 30rpx;
|
align-items: center;
|
justify-content: space-between;
|
}
|
|
.u-icon {
|
margin-left: 30rpx;
|
}
|
|
.item-wrap {
|
display: flex;
|
margin: 10rpx;
|
padding: 30rpx;
|
align-items: center;
|
border-radius: 16rpx;
|
box-shadow: 0rpx 8rpx 16rpx rgba(0, 0, 0, 0.11);
|
|
.avatar {
|
width: 150rpx;
|
height: 150rpx;
|
margin-right: 30rpx;
|
border-radius: 16rpx;
|
background-color: #c0c0c0;
|
}
|
|
.item {
|
// width: 100rpx;
|
height: 30rpx;
|
margin-bottom: 10rpx;
|
border-radius: 16rpx;
|
background-color: #c8c7cc;
|
}
|
|
}
|
}
|
</style>
|