123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209 |
- <template>
- <view class="billall">
- <u-cell-group>
- <u-cell :title="mytitle" value="修改" :isLink="true" @click="floorchange">
- <u-icon slot="icon" size="40" name="map"></u-icon>
- </u-cell>
- </u-cell-group>
- <view class="topbill">
- <view class="topbilledit">
- <view class="changetime1">
- <picker mode="date" :value="myday" fields="month" @change="dateChange">
- <view class="selestDate">{{myday}}</view>
- </picker>
- </view>
- <view class="changetime2">
- <u-icon name="arrow-down-fill" color="#666666" size="20"></u-icon>
- </view>
- </view>
- <view class="topbilledit" @click="typechange">
- <view class="changetime1">
- {{mytype}}
- </view>
- <view class="changetime2">
- <u-icon name="arrow-down-fill" color="#666666" size="20"></u-icon>
- </view>
- </view>
- </view>
- <u-picker :show="showtype" :columns="columnstype" keyName="label" @confirm="confirmtype" @cancel='canceltype'>
- </u-picker>
- <!--
- <mx-date-picker :show="showPicker" type="range" :value="dayrange" :show-tips="true" :begin-text="'开始日期'" :end-text="'结束日期'" :show-seconds="true" @confirm="ed" @cancel="ec" /> -->
- <u-picker :show="showfloor" 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 MxDatePicker from "@/components/mx-datepicker/mx-datepicker.vue";
- export default {
- components: {
- // MxDatePicker
- },
- data() {
- const currentDate = this.getDate({
- format: 'yyyy-mm'
- })
- return {
- showtype: false,
- showdct: false,
- mytitle: '',
- alldata: [],
- showfloor: false,
- loading: false,
- columns: [],
- columnData: [],
- myday: '',
- mytype: '全部',
- showPicker: false,
- myday: currentDate,
- columnstype: [
- [{
- label: '全部',
- id: ''
- }, {
- label: '未结清',
- id: 0
- },
- {
- label: '已结清',
- id: 1
- }
- ]
- ],
- // dayrange: ['2019/01/01','2019/01/06'],
- }
- },
- //监听页面加载,其参数为上个页面传递的数据,参数类型为 Object(用于页面传参
- onLoad() {
- this.getfloor();
- },
- //监听页面初次渲染完成。注意如果渲染速度快,会在页面进入动画完成前触发
- onReady() {
- // 微信小程序需要用此写法
- },
- //监听页面隐藏
- onHide() {},
- //监听窗口尺寸变化
- onResize() {},
- //监听页面卸载
- onUnload() {},
- //监听用户下拉动作,一般用于下拉刷新
- onPullDownRefresh() {},
- methods: {
- canceltype() {
- this.showtype = false;
- },
- confirmtype(e) {
- // console.log('111111111111111111',e.value[0])
- this.showtype = false;
- this.mytype=e.value[0].label
- },
- typechange() {
- this.showtype = true;
- },
- dateChange(e) {
- this.myday = e.target.value;
- },
- 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;
- // day = day > 9 ? day : '0' + day;
- 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;
- //console.log('111111111111111111', 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)
- }
- // console.log('111111111111111111',allfloor)
- this.columnData = allfloor
- } 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
- }
- },
- confirmfloor(e) {
- console.log('222222', e.value)
- this.mytitle = e.value[0].orgName + e.value[1].orgName;
- this.showfloor = false;
- },
- cancelfloor() {
- this.showfloor = false;
- },
- }
- }
- </script>
- <style>
- .billall {}
- .topbill {
- display: flex;
- justify-content: space-around;
- align-items: center;
- height: 100rpx;
- background-color: #e6e6e6;
- }
- .topbilledit {
- display: flex;
- justify-content: space-around;
- align-items: center;
- }
- .changetime1 {
- padding-right: 10rpx;
- }
- </style>
|