diff --git a/app.js b/app.js index 8ac0a31..03bd8c1 100644 --- a/app.js +++ b/app.js @@ -1,36 +1,51 @@ // app.js +import {getStaffbasicinfo} from "./utils/api"; +import {getOwnedRolesOfStaffId} from "./utils/statisticsApi"; + App({ onLaunch: function (options) { //获取设备顶部窗口的高度(不同设备窗口高度不一样,根据这个来设置自定义导航栏的高度) //这个最初我是在组件中获取,但是出现了一个问题,当第一次进入小程序时导航栏会把 //页面内容盖住一部分,当打开调试重新进入时就没有问题,这个问题弄得我是莫名其妙 //虽然最后解决了,但是花费了不少时间 - let code = [1011,1017,1025,1047,1124,1001,1038,1041,1089,1090,1104,1131,1187]; + let code = [1011, 1017, 1025, 1047, 1124, 1001, 1038, 1041, 1089, 1090, 1104, 1131, 1187]; if (code.includes(options.scene)) { console.log(options.scene); - this.globalData.share = true - }else{ + this.globalData.share = true + } else { this.globalData.share = false } const menuButtonInfo = wx.getMenuButtonBoundingClientRect() wx.getSystemInfo({ - success: (res) => { - this.globalData.height = res.statusBarHeight - this.globalData.deviceInfo.statusHeight = res.statusBarHeight - this.globalData.deviceInfo.navigationHeight = menuButtonInfo.height + (menuButtonInfo.top - res.statusBarHeight) * 2 - } + success: (res) => { + this.globalData.height = res.statusBarHeight + this.globalData.deviceInfo.statusHeight = res.statusBarHeight + this.globalData.deviceInfo.navigationHeight = menuButtonInfo.height + (menuButtonInfo.top - res.statusBarHeight) * 2 + } }) wx.hideTabBar() - }, - globalData: { - userInfo: null, - selected:0, - deviceInfo: { - statusHeight: 19, - navigationHeight: 40 - }, - user:{}, - share:false, - questionnaireUrl:'' - } + getStaffbasicinfo().then(res=>{ + this.globalData.user = res.data + getOwnedRolesOfStaffId(res.data.id).then(res2 => { + this.globalData.roleList = res2.data + }) + }).catch(err=>{ + console.log(err); + wx.redirectTo({ + url: '/pages/login/login', + }) + }) + }, + globalData: { + userInfo: null, + selected: 0, + deviceInfo: { + statusHeight: 19, + navigationHeight: 40 + }, + user: {}, + share: false, + questionnaireUrl: '', + roleList: [] + } }) diff --git a/app.json b/app.json index 480f468..2a494dd 100644 --- a/app.json +++ b/app.json @@ -158,6 +158,5 @@ "provider": "wx4418e3e031e551be" } }, - "style": "v2", "sitemapLocation": "sitemap.json" } \ No newline at end of file diff --git a/components/CommonDemandDispatchOrder/CommonDemandDispatchOrder.js b/components/CommonDemandDispatchOrder/CommonDemandDispatchOrder.js index 801d0d7..0ca25de 100644 --- a/components/CommonDemandDispatchOrder/CommonDemandDispatchOrder.js +++ b/components/CommonDemandDispatchOrder/CommonDemandDispatchOrder.js @@ -1,9 +1,14 @@ import { + agencygridtree, dictlist, listServerOrg, userdemandAssign, } from "../../utils/statisticsApi"; +const App = getApp() const config = require('../../utils/config') Component({ + options: { + styleIsolation: 'shared', + }, properties: { visible: { type: Boolean, @@ -25,27 +30,60 @@ Component({ form: { serviceType: "", serverId: "", + noticeApproches: [] }, serviceOptions: [], serviceIndex: -1, serviceOptiondIndex: -1, serviceOptiondList: [], + visible2: false, + orgField: {label: 'agencyName', value: 'agencyId', children: 'subAgencyList'}, + orgName: "", + orgOptions: [], }, ready: function () { dictlist({ dictType: "user_demand_service_type", + }).then((res) => { + this.setData({ + serviceOptions: res.data + }) }) - .then((res) => { - this.setData({ - serviceOptions: res.data - }) + if (!this.agencyId) { + this.setData({ + agencyId: App.globalData.user.agencyId }) - + } + this.getOrgTreeList() }, methods: { - + getOrgTreeList() { + let params = { + agencyId: this.data.agencyId, + purpose: "query" + } + agencygridtree(params).then(res => { + this.setData({ + orgOptions: res.data.subAgencyList + }) + }) + }, + onChange1(e) { + console.log(e) + let noticeApproches = this.data.form.noticeApproches + let index = noticeApproches.indexOf(e.detail.value) + if (index === -1) { + noticeApproches.push(e.detail.value) + } else { + noticeApproches.splice(index, 1) + } + this.setData({ + "form.noticeApproches": noticeApproches + }) + console.log(noticeApproches) + }, close() { this.triggerEvent('close') }, @@ -85,5 +123,27 @@ Component({ }) }) }, + onOpen2() { + this.setData({visible2: true}) + }, + onClose2() { + this.setData({visible2: false}) + console.log('onClose2') + }, + onConfirm2(e) { + let data = e.detail + console.log('onConfirm2', e.detail) + + let params = data.cols[data.cols.length - 1][data.selectedIndex[data.selectedIndex.length - 1]] + this.setData({ + "form.deptId": params.agencyId, + "form.deptName": params.agencyName, + "form.orgType": params.level + }) + this.setData({orgName: data.displayValue.join('-')}) + }, + change1(e) { + console.log(e) + } } }); diff --git a/components/CommonDemandDispatchOrder/CommonDemandDispatchOrder.json b/components/CommonDemandDispatchOrder/CommonDemandDispatchOrder.json index f8d4727..5e2e55b 100644 --- a/components/CommonDemandDispatchOrder/CommonDemandDispatchOrder.json +++ b/components/CommonDemandDispatchOrder/CommonDemandDispatchOrder.json @@ -2,10 +2,8 @@ "component": true, "usingComponents": { "wux-popup": "../dist/popup/index", - "wux-selectable": "../dist/selectable/index", - "wux-textarea": "../dist/textarea/index", - "wux-upload": "../dist/upload/index", - "wux-cell": "../dist/cell/index", + "wux-checkbox-group": "../dist/checkbox-group/index", + "wux-checkbox": "../dist/checkbox/index", "wux-calendar": "../dist/calendar/index", "wux-cascader": "../dist/cascader/index" } diff --git a/components/CommonDemandDispatchOrder/CommonDemandDispatchOrder.wxml b/components/CommonDemandDispatchOrder/CommonDemandDispatchOrder.wxml index 5888a5c..de3e27e 100644 --- a/components/CommonDemandDispatchOrder/CommonDemandDispatchOrder.wxml +++ b/components/CommonDemandDispatchOrder/CommonDemandDispatchOrder.wxml @@ -1,7 +1,7 @@ 需求派单 - + 需求类别: @@ -35,6 +35,31 @@ + + + + + + + + + + + 服务范围: + + {{orgName?orgName:'请选择'}} + + + @@ -44,25 +69,15 @@ - - + diff --git a/components/CommonDemandDispatchOrder/CommonDemandDispatchOrder.wxss b/components/CommonDemandDispatchOrder/CommonDemandDispatchOrder.wxss index 02b59e1..75b472c 100644 --- a/components/CommonDemandDispatchOrder/CommonDemandDispatchOrder.wxss +++ b/components/CommonDemandDispatchOrder/CommonDemandDispatchOrder.wxss @@ -29,10 +29,11 @@ } -.popup-content { +.popup-content2 { max-height: 60vh; + background: none!important; } -.popup-content .card { +.popup-content2 .card { border-radius: 20px; padding: 30rpx; box-sizing: border-box; @@ -118,4 +119,13 @@ } .btn-gray { background: #D9D9D9; +} +.checkbox .wux-cell-group__hd { + padding-left: 0; + font-size: 32rpx; + font-weight: 500; + color: #333333; +} +.checkbox { + text-align: left; } \ No newline at end of file diff --git a/components/DemandDispatchOrder/DemandDispatchOrder.json b/components/DemandDispatchOrder/DemandDispatchOrder.json index f8d4727..f9e0a1f 100644 --- a/components/DemandDispatchOrder/DemandDispatchOrder.json +++ b/components/DemandDispatchOrder/DemandDispatchOrder.json @@ -1,12 +1,6 @@ { "component": true, "usingComponents": { - "wux-popup": "../dist/popup/index", - "wux-selectable": "../dist/selectable/index", - "wux-textarea": "../dist/textarea/index", - "wux-upload": "../dist/upload/index", - "wux-cell": "../dist/cell/index", - "wux-calendar": "../dist/calendar/index", - "wux-cascader": "../dist/cascader/index" + "wux-popup": "../dist/popup/index" } } \ No newline at end of file diff --git a/components/DemandDispatchOrder/DemandDispatchOrder.wxml b/components/DemandDispatchOrder/DemandDispatchOrder.wxml index 4fd1cc2..fd121a4 100644 --- a/components/DemandDispatchOrder/DemandDispatchOrder.wxml +++ b/components/DemandDispatchOrder/DemandDispatchOrder.wxml @@ -48,25 +48,3 @@ - - - - diff --git a/components/ResourceScheduling/ResourceScheduling.js b/components/ResourceScheduling/ResourceScheduling.js index a2633b3..cd19e8c 100644 --- a/components/ResourceScheduling/ResourceScheduling.js +++ b/components/ResourceScheduling/ResourceScheduling.js @@ -73,6 +73,7 @@ Component({ ready: function () { this.typeChange() console.log(App.globalData.user.agencyId) + this.getList(); }, methods: { close() { diff --git a/components/custom-tab-bar/index.js b/components/custom-tab-bar/index.js index 9a1cc36..6052f25 100644 --- a/components/custom-tab-bar/index.js +++ b/components/custom-tab-bar/index.js @@ -1,50 +1,77 @@ +import {getStaffbasicinfo} from "../../utils/api"; + const app = getApp() +import {getOwnedRolesOfStaffId} from '../../utils/statisticsApi.js' + Component({ - data: { - selected: 0, - color: "#999", - selectedColor: "#3A80E7", - "list": [ - { - "pagePath": "/pages/index/index", - "text": "消息", - "iconPath": "/images/home/message.png", - "selectedIconPath": "/images/home/messageSelected.png" + data: { + selected: 0, + color: "#999", + selectedColor: "#3A80E7", + "list": [ + { + "pagePath": "/pages/index/index", + "text": "消息", + "iconPath": "/images/home/message.png", + "selectedIconPath": "/images/home/messageSelected.png", + show: true + }, + { + "pagePath": "/pages/work/work", + "text": "工作", + "iconPath": "/images/home/work.png", + "selectedIconPath": "/images/home/workSelected.png", + show: true + + }, + { + "pagePath": "/pages/statistics/statistics", + "text": "数据", + "iconPath": "/images/home/information.png", + "selectedIconPath": "/images/home/informationSelected.png", + show: false + + }, + { + "pagePath": "/pages/mine/mine", + "text": "我的", + "iconPath": "/images/home/mine.png", + "selectedIconPath": "/images/home/mineSelected.png", + show: true + } + ], }, - { - "pagePath": "/pages/work/work", - "text": "工作", - "iconPath": "/images/home/work.png", - "selectedIconPath": "/images/home/workSelected.png" + attached() { }, - { - "pagePath": "/pages/statistics/statistics", - "text": "统计", - "iconPath": "/images/home/information.png", - "selectedIconPath": "/images/home/informationSelected.png" + ready: function () { + this.setData({ + selected: app.globalData.selected + }) + // secretary 书记 + console.log( app.globalData.roleList.filter(item => item.roleKey === 'secretary')) + if(app.globalData.roleList.length <= 0) { + + getStaffbasicinfo().then(res=>{ + getOwnedRolesOfStaffId(res.data.id).then(res2 => { + this.setData({ + "list[2].show": res2.data.filter(item => item.roleKey === 'secretary').length > 0 + }) + }) + }) + } else { + this.setData({ + "list[2].show": app.globalData.roleList.filter(item => item.roleKey === 'secretary').length > 0 + }) + } + console.log(app.globalData.roleList, 'userss') }, - { - "pagePath": "/pages/mine/mine", - "text": "我的", - "iconPath": "/images/home/mine.png", - "selectedIconPath": "/images/home/mineSelected.png" + methods: { + switchTab(e) { + console.log(e); + const data = e.currentTarget.dataset; + const url = data.path; + app.globalData.selected = data.index; + wx.switchTab({url}) + } } - ] - }, - attached() { - }, - ready: function() { - this.setData({ - selected: app.globalData.selected - }) - }, - methods: { - switchTab(e) { - console.log(e); - const data = e.currentTarget.dataset; - const url = data.path; - app.globalData.selected = data.index; - wx.switchTab({url}) - } - } }) \ No newline at end of file diff --git a/components/custom-tab-bar/index.wxml b/components/custom-tab-bar/index.wxml index cb23700..712ebfe 100644 --- a/components/custom-tab-bar/index.wxml +++ b/components/custom-tab-bar/index.wxml @@ -1,7 +1,7 @@ - +