123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343 |
- <template>
- <view class="page">
- <view class="billall">
- <u-cell-group class="toptemplate">
- <u-cell :title="mytitle" @click="floorchange">
- <u-icon slot="icon" size="40" color="#fff" name="map"></u-icon>
- <u-icon slot="right-icon" size="40" color="#fff" name="search"></u-icon>
- </u-cell>
- </u-cell-group>
- <view class="topbill">
- <view class="topbilledit" @click="xunjianchange">
- <view class="changetime1">
- {{xjlx}}
- </view>
- <view class="changetime2">
- <u-icon name="arrow-down-fill" color="#999" size="20"></u-icon>
- </view>
- </view>
- <view class="topbilledit" @click="typechange">
- <view class="changetime1">
- {{xjry}}
- </view>
- <view class="changetime2">
- <u-icon name="arrow-down-fill" color="#666666" size="20"></u-icon>
- </view>
- </view>
- </view>
- <view class="u-listdata">
- <view style="padding:16rpx 0 16rpx 32rpx">
- 共有 <span style="color: red">{{totalnumber}}</span>条记录
- </view>
- <u-list @scrolltolower="scrolltolower" :pagingEnabled='true'>
- <u-list-item v-for="(item, index) in indexList" :key="index">
- <view class="companylist">
- <h3>{{item.position}}</h3>
- <view class="Currentamount">
- 巡检类型: 安保
- </view>
- <view class="Currentamount">
- 巡检人员: {{item.circuitPerson.realName}}
- </view>
- <view class="Currentamount">
- 联系电话:¥{{item.circuitPerson.mobile}}
- </view>
- <view class="Currentamount">
- 巡检时间: {{item.circuitTime}}
- </view>
- </view>
- </u-list-item>
- </u-list>
- </view>
- </view>
- <u-picker :show="showtypexunjian" :itemHeight="80" :columns="columnstypexunjian" keyName="dictLabel"
- @confirm="confirmxunjian" @cancel='cancelxunjian'>
- </u-picker>
- <u-picker :show="showtype" :itemHeight="80" :columns="columnstype" keyName="realName" @confirm="confirmtype"
- @cancel='canceltype'>
- </u-picker>
- <u-picker :show="showfloor" :itemHeight="80" ref="uPicker" :loading="loading" @confirm="confirmfloor"
- @cancel='cancelfloor' :columns="columns" keyName="orgName" @change="changeHandler"></u-picker>
- <u-notify ref="uNotify" :show="showdct" message="服务器请求失败"></u-notify>
- </view>
- </template>
- <script>
- import cellGroup from '../../../uni_modules/uview-ui/libs/config/props/cellGroup';
- export default {
- components: {},
- data() {
- const currentDate = this.getDate({
- format: 'yyyy-mm'
- })
- return {
- totalnumber: 0,
- showtypexunjian: false,
- setyesno: true,
- indexList: [],
- xjlx: '巡检类型',
- dataList: [],
- dataForm: {
- buildingId: "",
- storeyId: "",
- circuitType: "",
- circuitPersonId: "",
- page: 1,
- limit: 10,
- },
- showtype: false,
- showdct: false,
- mytitle: '',
- alldata: [],
- showfloor: false,
- loading: false,
- columns: [],
- columnData: [],
- pd: true,
- xjry: '巡检人员',
- showPicker: false,
- myday: currentDate,
- columnstypexunjian: [],
- columnstype: [],
- }
- },
- //监听页面加载,其参数为上个页面传递的数据,参数类型为 Object(用于页面传参
- onLoad() {
- let getDictDataList = uni.getStorageSync('getDictDataList');
- for (let i = 0; i < getDictDataList.length; i++) {
- if (getDictDataList[i].dictType == 'ReviewType') {
- let pushdata = {
- dictLabel: "全部",
- dictValue: "",
- }
- getDictDataList[i].dataList.unshift(pushdata)
- this.columnstypexunjian = [getDictDataList[i].dataList]
- }
- }
- this.getUserList();
- this.getfloor();
- // this.loadmore();
- },
- //监听页面初次渲染完成。注意如果渲染速度快,会在页面进入动画完成前触发
- onReady() {
- // 微信小程序需要用此写法
- },
- //监听页面隐藏
- onHide() {},
- //监听窗口尺寸变化
- onResize() {},
- //监听页面卸载
- onUnload() {},
- //监听用户下拉动作,一般用于下拉刷新
- onPullDownRefresh() {},
- methods: {
- getUserList() {
- this.$api.get('/user/list', {
- page: 1,
- limit: 999,
- })
- .then(res => {
- let pushdata = {
- realName: "全部",
- id: "",
- };
- this.columnstype = [res.data.data];
- this.columnstype[0].unshift(pushdata)
- })
- },
- scrolltolower() {
- if (this.pd) {
- this.getalldata();
- } else {
- return
- }
- },
- xunjianchange() {
- this.showtypexunjian = true;
- },
- cancelxunjian() {
- this.showtypexunjian = false;
- },
- confirmxunjian(e) {
- this.xjlx = e.value[0].dictLabel;
- this.dataForm.circuitType = e.value[0].dictValue;
- this.indexList = [];
- this.dataForm.page = 1;
- this.getalldata();
- this.showtypexunjian = false;
- },
- getalldata() {
- this.$api.get('/circuitrecord/page', this.dataForm)
- .then(res => {
- this.totalnumber = res.data.data.total;
- if (res.data.data.list.length != 0) {
- this.indexList.push(...res.data.data.list);
- this.dataForm.page = this.dataForm.page + 1;
- this.pd = true;
- } else {
- uni.showToast({
- title: '暂无更多数据了',
- icon: 'none',
- duration: 1500
- })
- this.pd = false;
- }
- })
- },
- canceltype() {
- this.showtype = false;
- },
- confirmtype(e) {
- this.showtype = false;
- this.xjry = e.value[0].realName;
- this.dataForm.circuitPersonId = e.value[0].id;
- this.indexList = [];
- this.dataForm.page = 1;
- this.getalldata();
- },
- typechange() {
- this.showtype = true;
- },
- getDate(type) {
- const date = new Date();
- let year = date.getFullYear();
- let month = date.getMonth() + 1;
- if (type === 'start') {
- year = year - 60;
- } else if (type === 'end') {
- year = year + 2;
- }
- month = month > 9 ? month : '0' + month;
- return `${year}-${month}`;
- },
- getfloor() {
- this.$api.get('/control/getOrgStructureTree/', {})
- .then(res => {
- if (res.data.code == 0) {
- this.mytitle = res.data.data[0].orgName;
- this.alldata = res.data.data[0].childrenList;
- this.columns = [
- res.data.data[0].childrenList,
- res.data.data[0].childrenList[0].childrenList
- ]
- let allfloor = [];
- for (let i = 0; i < res.data.data[0].childrenList.length; i++) {
- allfloor.push(res.data.data[0].childrenList[i].childrenList)
- }
- this.columnData = allfloor;
- this.indexList = [];
- this.dataForm.page = 1;
- this.getalldata();
- } else {
- this.showdct = true
- }
- })
- },
- floorchange() {
- this.showfloor = true;
- },
- changeHandler(e) {
- const {
- columnIndex,
- index,
- // 微信小程序无法将picker实例传出来,只能通过ref操作
- picker = this.$refs.uPicker
- } = e
- if (columnIndex === 0) {
- this.loading = true
- picker.setColumnValues(1, this.columnData[index])
- this.loading = false
- }
- // this.getalldata();
- },
- confirmfloor(e) {
- this.mytitle = e.value[0].orgName + e.value[1].orgName;
- this.dataForm.buildingId = e.value[0].orgId;
- this.dataForm.storeyId = e.value[1].orgId;
- this.showfloor = false;
- this.indexList = [];
- this.dataForm.page = 1;
- this.getalldata();
- },
- cancelfloor() {
- this.showfloor = false;
- },
- }
- }
- </script>
- <style lang="scss">
- .billall {
- height: 100%;
- display: flex;
- flex-direction: column;
- }
- .u-listdata {
- height: 400px;
- flex: 1;
- display: flex;
- flex-direction: column;
- }
- .companylist {
- margin: 0 32rpx 24rpx;
- background: #fff;
- padding: 24rpx 32rpx;
- border-radius: 8rpx;
- position: relative;
- h3 {
- margin-bottom: 16rpx;
- }
- .Currentamount {
- margin-bottom: 8rpx;
- color: #999;
- span {
- color: #FA5555;
- padding-left: 9rpx;
- }
- }
- }
- .topbill {
- display: flex;
- justify-content: space-around;
- align-items: center;
- height: 100rpx;
- background-color: #fff;
- .topbilledit {
- display: flex;
- justify-content: space-around;
- align-items: center;
- .changetime1 {
- padding-right: 10rpx;
- }
- }
- }
- </style>
|