From fe38ca49f63d6074b82645314ab9e82a44ff2b57 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=88=98=E7=AB=8B=E6=A0=87?= <2658037827@qq.com>
Date: Mon, 18 Dec 2023 17:07:55 +0800
Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=B4=BE=E5=8D=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app.wxss | 9 +-
.../CommonDemandDispatchOrder.js | 143 +++++---
.../CommonDemandDispatchOrder.json | 12 +-
.../CommonDemandDispatchOrder.wxml | 105 +++---
.../CommonDemandDispatchOrder.wxss | 15 +-
.../DemandDispatchOrder.wxml | 24 +-
.../DemandDispatchOrder.wxss | 18 +
components/DispatchOrder/DispatchOrder.js | 147 ++++----
components/DispatchOrder/DispatchOrder.json | 15 +-
components/DispatchOrder/DispatchOrder.wxml | 126 ++++---
components/DispatchOrder/DispatchOrder.wxss | 18 +
.../ResourceScheduling/ResourceScheduling.js | 9 -
components/dist/cascader-view/index.js | 320 ------------------
components/dist/cascader-view/index.json | 5 -
components/dist/cascader-view/index.wxml | 0
components/dist/cascader-view/index.wxss | 0
.../pages/demand/detail/detail.wxss | 2 +-
.../statistics/pages/event/detail/detail.wxss | 2 +-
utils/statisticsApi.js | 5 +
19 files changed, 378 insertions(+), 597 deletions(-)
delete mode 100644 components/dist/cascader-view/index.js
delete mode 100644 components/dist/cascader-view/index.json
delete mode 100644 components/dist/cascader-view/index.wxml
delete mode 100644 components/dist/cascader-view/index.wxss
diff --git a/app.wxss b/app.wxss
index 06c6fc9..d7dda98 100644
--- a/app.wxss
+++ b/app.wxss
@@ -7,4 +7,11 @@
justify-content: space-between;
padding: 200rpx 0;
box-sizing: border-box;
-}
+}
+page {
+ --calendar-range-edge-background-color: #3E92FF;
+ --calendar-range-middle-color: #81B5FB;
+ --button-danger-background-color: linear-gradient(87deg, #81B5FB 0%, #3E92FF 100%);
+ --button-danger-border-color: 'none';
+ --calendar-selected-day-background-color: #3E92FF;
+}
diff --git a/components/CommonDemandDispatchOrder/CommonDemandDispatchOrder.js b/components/CommonDemandDispatchOrder/CommonDemandDispatchOrder.js
index 0ca25de..defa953 100644
--- a/components/CommonDemandDispatchOrder/CommonDemandDispatchOrder.js
+++ b/components/CommonDemandDispatchOrder/CommonDemandDispatchOrder.js
@@ -1,14 +1,11 @@
import {
- agencygridtree,
- dictlist, listServerOrg, userdemandAssign,
+ agencygridtree, commonDemand,
+ dictlist, listServerOrg,
} from "../../utils/statisticsApi";
const App = getApp()
const config = require('../../utils/config')
Component({
- options: {
- styleIsolation: 'shared',
- },
properties: {
visible: {
type: Boolean,
@@ -30,16 +27,21 @@ Component({
form: {
serviceType: "",
serverId: "",
- noticeApproches: []
+ noticeApproches: [],
+ serviceScopeList: []
},
serviceOptions: [],
serviceIndex: -1,
serviceOptiondIndex: -1,
serviceOptiondList: [],
visible2: false,
- orgField: {label: 'agencyName', value: 'agencyId', children: 'subAgencyList'},
+ orgField: {text: 'agencyName', value: 'agencyId', children: 'subAgencyList'},
orgName: "",
orgOptions: [],
+ showService: false,
+ fieldValue: '',
+ cascaderValue: '',
+ showDate: false
},
ready: function () {
@@ -59,56 +61,85 @@ Component({
},
methods: {
+ onShowService() {
+ this.setData({
+ showService: true,
+ });
+ console.log(111, this.data.showService)
+ },
+
+ onCloseService() {
+ this.setData({
+ showService: false,
+ });
+ },
+
+ onFinishService(e) {
+ const {selectedOptions, value} = e.detail;
+ const fieldValue = selectedOptions
+ .map((option) => option.agencyName || option.agencyName)
+ .join('/');
+ let serviceScopeList = selectedOptions[selectedOptions.length - 1]
+ this.setData({
+ fieldValue,
+ showService: false,
+ cascaderValue: value,
+ "form.serviceScopeList": [
+ {
+ objectId: serviceScopeList.agencyId,
+ objectName: serviceScopeList.agencyName,
+ objectType: serviceScopeList.level
+ }
+ ]
+ })
+ },
getOrgTreeList() {
let params = {
agencyId: this.data.agencyId,
purpose: "query"
}
agencygridtree(params).then(res => {
+ let org = this.deleteChildren(res.data.subAgencyList)
this.setData({
- orgOptions: res.data.subAgencyList
+ orgOptions: org
})
})
},
- 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)
- }
+ noticeApprochesChange(e) {
this.setData({
- "form.noticeApproches": noticeApproches
+ "form.noticeApproches": e.detail
})
- console.log(noticeApproches)
},
- close() {
- this.triggerEvent('close')
+ onShowDate() {
+ this.setData({showDate: true});
},
- sure() {
- userdemandAssign({
- ...this.data.form,
- demandRecId: this.data.detail.demandRecId
- }).then(res => {
- wx.showToast({
- icon: 'success',
- title: '操作成功'
- })
- this.close()
- })
+ onCloseDate() {
+ this.setData({showDate: false});
+ },
+ formatDate(date) {
+ date = new Date(date);
+ return `${date.getFullYear()}-${date.getMonth() + 1 > 10 ? date.getMonth() + 1 : '0' + (date.getMonth() + 1)}-${date.getDate() > 10 ? date.getDate() : '0' + date.getDate()}`;
},
+ onConfirmDate(event) {
+ const [start, end] = event.detail;
+ this.setData({
+ showDate: false,
+ date: `${this.formatDate(start)} ~ ${this.formatDate(end)}`,
+ "form.serviceTimeStart": `${this.formatDate(start)} 00:00:00`,
+ "form.serviceTimeEnd": `${this.formatDate(end)} 00:00:00`,
+ });
+ },
+
serviceOptiondListChange(e) {
this.setData({
serviceOptiondIndex: e.detail.value,
- "form.serverId": this.data.serviceOptiondList[e.detail.value].id
+ "form.serverOrgId": this.data.serviceOptiondList[e.detail.value].id
})
},
getServiceuserList(e) {
this.setData({
serviceIndex: e.detail.value,
- "form.serviceType": this.data.serviceOptions[e.detail.value].value
+ "form.serverOrgType": this.data.serviceOptions[e.detail.value].value
})
let params = {
serviceTypeId: this.data.detail.categoryCode[1],//上级ID
@@ -123,27 +154,35 @@ Component({
})
})
},
- onOpen2() {
- this.setData({visible2: true})
- },
- onClose2() {
- this.setData({visible2: false})
- console.log('onClose2')
+ deleteChildren(node) {
+ node.forEach(item => {
+ if ('subAgencyList' in item && !item.subAgencyList) {
+ delete item.subAgencyList
+ } else if ('subAgencyList' in item && item.subAgencyList.length) {
+ this.deleteChildren(item.subAgencyList)
+ }
+ })
+ return node
},
- 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
+ close() {
+ this.triggerEvent('close')
+ },
+ sure() {
+ commonDemand({
+ ...this.data.detail,
+ assignFlag: 1,
+ assignInfo: {
+ ...this.data.form,
+ }
+ // demandRecId: this.data.detail.demandRecId
+ }).then(res => {
+ wx.showToast({
+ icon: 'success',
+ title: '操作成功'
+ })
+ this.close()
})
- this.setData({orgName: data.displayValue.join('-')})
},
- change1(e) {
- console.log(e)
- }
}
});
diff --git a/components/CommonDemandDispatchOrder/CommonDemandDispatchOrder.json b/components/CommonDemandDispatchOrder/CommonDemandDispatchOrder.json
index 5e2e55b..37dc147 100644
--- a/components/CommonDemandDispatchOrder/CommonDemandDispatchOrder.json
+++ b/components/CommonDemandDispatchOrder/CommonDemandDispatchOrder.json
@@ -1,10 +1,12 @@
{
"component": true,
"usingComponents": {
- "wux-popup": "../dist/popup/index",
- "wux-checkbox-group": "../dist/checkbox-group/index",
- "wux-checkbox": "../dist/checkbox/index",
- "wux-calendar": "../dist/calendar/index",
- "wux-cascader": "../dist/cascader/index"
+ "van-cascader": "@vant/weapp/cascader/index",
+ "van-popup": "@vant/weapp/popup/index",
+ "van-field": "@vant/weapp/field/index",
+ "van-checkbox": "@vant/weapp/checkbox/index",
+ "van-checkbox-group": "@vant/weapp/checkbox-group/index",
+ "van-calendar": "@vant/weapp/calendar/index",
+ "van-icon": "@vant/weapp/icon/index"
}
}
\ No newline at end of file
diff --git a/components/CommonDemandDispatchOrder/CommonDemandDispatchOrder.wxml b/components/CommonDemandDispatchOrder/CommonDemandDispatchOrder.wxml
index de3e27e..1581f38 100644
--- a/components/CommonDemandDispatchOrder/CommonDemandDispatchOrder.wxml
+++ b/components/CommonDemandDispatchOrder/CommonDemandDispatchOrder.wxml
@@ -1,4 +1,4 @@
-
+
-
- 服务方类型:
-
-
- {{serviceIndex >= 0 ? serviceOptions[serviceIndex].label : '请选择服务方类型'}}
-
+
+
+ 服务方类型:
+
+ {{serviceIndex >= 0 ? serviceOptions[serviceIndex].label : '请选择'}}
+
+
-
+
+
+
+ 服务方:
+
+ {{serviceOptiondIndex >= 0 ? serviceOptiondList[serviceOptiondIndex].label : '请选择'}}
+
+
+
+
+
- 服务方:
+ 通知服务方:
-
- {{serviceOptiondIndex >= 0 ? serviceOptiondList[serviceOptiondIndex].label : '请选择服务方'}}
-
+
+
+ 短信通知
+
+ 公众号通知
+
+
-
-
-
-
-
-
-
-
+
+ 服务范围:
+
+ {{fieldValue ? fieldValue : '请选择'}}
+
+
-
- 服务范围:
-
- {{orgName?orgName:'请选择'}}
-
+
+ 服务时间:
+
+ {{date ? date : '请选择'}}
+
+
+
@@ -68,16 +75,24 @@
确定
-
-
+
+
+
+
+
+
diff --git a/components/CommonDemandDispatchOrder/CommonDemandDispatchOrder.wxss b/components/CommonDemandDispatchOrder/CommonDemandDispatchOrder.wxss
index 75b472c..258f1ea 100644
--- a/components/CommonDemandDispatchOrder/CommonDemandDispatchOrder.wxss
+++ b/components/CommonDemandDispatchOrder/CommonDemandDispatchOrder.wxss
@@ -58,7 +58,9 @@
align-items: center;
justify-content: space-between;
}
-
+.label-width {
+ min-width: 160rpx;
+}
.items .value {
width: calc(100% - 160rpx);
overflow: hidden;
@@ -128,4 +130,15 @@
}
.checkbox {
text-align: left;
+}
+.gray {
+ color: #999;
+}
+.text-right {
+ text-align: right;
+}
+.flex {
+ display: flex!important;
+ justify-content: flex-end;
+ align-items: center;
}
\ No newline at end of file
diff --git a/components/DemandDispatchOrder/DemandDispatchOrder.wxml b/components/DemandDispatchOrder/DemandDispatchOrder.wxml
index fd121a4..22cee70 100644
--- a/components/DemandDispatchOrder/DemandDispatchOrder.wxml
+++ b/components/DemandDispatchOrder/DemandDispatchOrder.wxml
@@ -23,22 +23,22 @@
-
- 服务方类型:
-
-
+
+
+ 服务方类型:
+
{{serviceIndex >= 0 ? serviceOptions[serviceIndex].label : '请选择服务方类型'}}
-
+
-
-
- 服务方:
-
-
+
+
+
+ 服务方:
+
{{serviceOptiondIndex >= 0 ? serviceOptiondList[serviceOptiondIndex].label : '请选择服务方'}}
-
+
-
+
diff --git a/components/DemandDispatchOrder/DemandDispatchOrder.wxss b/components/DemandDispatchOrder/DemandDispatchOrder.wxss
index 02b59e1..2a229e8 100644
--- a/components/DemandDispatchOrder/DemandDispatchOrder.wxss
+++ b/components/DemandDispatchOrder/DemandDispatchOrder.wxss
@@ -118,4 +118,22 @@
}
.btn-gray {
background: #D9D9D9;
+}
+
+
+
+.gray {
+ color: #999;
+}
+.text-right {
+ text-align: right;
+}
+.flex {
+ display: flex!important;
+ justify-content: flex-end;
+ align-items: center;
+}
+
+.label-width {
+ min-width: 160rpx;
}
\ No newline at end of file
diff --git a/components/DispatchOrder/DispatchOrder.js b/components/DispatchOrder/DispatchOrder.js
index f0c4ab4..e629d11 100644
--- a/components/DispatchOrder/DispatchOrder.js
+++ b/components/DispatchOrder/DispatchOrder.js
@@ -33,11 +33,7 @@ Component({
fileList: [],
timeLimit: [],
- header: {
- 'Content-type': 'application/json;charset=UTF-8',
- 'Authorization': wx.getStorageSync('token')
- },
- url: `${config.BASEURL()}oss/file/uploadvariedfile`,
+ operationType: ["5"],
form: {
operationType: "5", //处理方式[0:已回复 5、指派 6、完成并回复]
content: "",//转办意见
@@ -54,8 +50,8 @@ Component({
visible1: false,
visible2: false,
- catField: {label: 'categoryName', value: 'id', children: 'children'},
- orgField: {label: 'agencyName', value: 'agencyId', children: 'subAgencyList'},
+ catField: {text: 'categoryName', value: 'id', children: 'children'},
+ orgField: {text: 'agencyName', value: 'agencyId', children: 'subAgencyList'},
orgName: "",
category: ""
},
@@ -63,6 +59,13 @@ Component({
},
methods: {
+ operationTypeChange(e) {
+ console.log(e.detail)
+ this.setData({
+ operationType: e.detail,
+ "form.operationType": e.detail[0]
+ })
+ },
onOpen1() {
this.setData({visible1: true})
},
@@ -73,12 +76,13 @@ Component({
onConfirm1(e) {
console.log('onConfirm1', e.detail)
let data = e.detail
- let params = data.cols[data.cols.length - 1][data.selectedIndex[data.selectedIndex.length - 1]]
+ let params = data.selectedOptions[data.selectedOptions.length - 1]
this.setData({
"form.categoryId": params.id,
- "form.categoryList": {...params, children: null}
+ "form.categoryList": {...params, children: null},
+ visible1: false
})
- this.setData({category: data.displayValue.join('-')})
+ this.setData({category: data.selectedOptions.map(item => item.categoryName).join('/')})
},
setContent(e) {
console.log(e, 'eee')
@@ -95,15 +99,15 @@ Component({
},
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]]
+ let params = data.selectedOptions[data.selectedOptions.length - 1]
this.setData({
"form.deptId": params.agencyId,
"form.deptName": params.agencyName,
- "form.orgType": params.level
+ "form.orgType": params.level,
+ visible2: false
})
- this.setData({orgName: data.displayValue.join('-')})
+ this.setData({orgName: data.selectedOptions.map(item => item.agencyName).join('/')})
},
@@ -134,7 +138,7 @@ Component({
}
agencygridtree(params).then(res => {
this.setData({
- orgOptions: res.data.subAgencyList
+ orgOptions: this.deleteChildren(res.data.subAgencyList, 'subAgencyList')
})
})
},
@@ -153,94 +157,89 @@ Component({
});
}
},
+
getCategoryList() {
let params = {};
getCategoryTree(params).then(res => {
let treeDataNew = this.deepTree(res.data, "children");
console.log(treeDataNew, 'treeDataNew')
this.setData({
- casOptions: treeDataNew
+ casOptions: this.deleteChildren(treeDataNew, "children")
});
})
-
},
+ deleteChildren(node, key) {
+ node.forEach(item => {
+ if (key in item && !item[key]) {
+ delete item[key]
+ } else if (key in item && item[key].length) {
+ this.deleteChildren(item[key], key)
+ }
+ })
+ return node
+ },
+
close() {
this.triggerEvent('close')
},
openCalendar1() {
-
- this.selectComponent('#wux-calendar').open({
- // $wuxCalendar('#wux-calendar1').open({
- value: this.data.value1,
- onChange: (values, displayValues) => {
- console.log('onChange', values, displayValues)
- this.setData({
- value1: displayValues,
- })
- },
+ this.setData({
+ showDate: true
})
},
- onChange(e) {
- console.log('onChange', e)
- const {file, fileList} = e.detail
- if (file.status === 'uploading') {
- this.setData({
- progress: 0,
- })
- wx.showLoading()
- } else if (file.status === 'done') {
- this.setData({
- imageUrl: file.url,
- })
- }
-
- // Controlled state should set fileList
- this.setData({fileList})
- },
- onSuccess(e) {
- console.log('onSuccess', e)
- },
- onFail(e) {
- console.log('onFail', e)
+ onCloseDate() {
+ this.setData({showDate: false});
},
- onComplete(e) {
- console.log('onComplete', e)
- wx.hideLoading()
+ formatDate(date) {
+ date = new Date(date);
+ return `${date.getFullYear()}-${date.getMonth() + 1 > 10 ? date.getMonth() + 1 : '0' + (date.getMonth() + 1)}-${date.getDate() > 10 ? date.getDate() : '0' + date.getDate()}`;
},
- onProgress(e) {
- console.log('onProgress', e)
+ onConfirmDate(event) {
+ console.log(event)
+ const date = event.detail;
this.setData({
- progress: e.detail.file.progress,
- })
+ showDate: false,
+ "form.timeLimit": `${this.formatDate(date)} 00:00:00`,
+ });
},
- onPreview(e) {
- console.log('onPreview', e)
- const {file, fileList} = e.detail
- wx.previewImage({
- current: file.url,
- urls: fileList.map((n) => n.url),
- })
- },
- onRemove(e) {
- const {file, fileList} = e.detail
- wx.showModal({
- content: '确定删除?',
+
+ afterRead(event) {
+ const {file} = event.detail;
+ // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
+ wx.uploadFile({
+ url: `${config.BASEURL()}oss/file/uploadvariedfile`,
+ name: 'file',
+ header: {
+ 'Content-type': 'application/json;charset=UTF-8',
+ 'Authorization': wx.getStorageSync('token')
+ },
+ filePath: file.url,
success: (res) => {
- if (res.confirm) {
- this.setData({
- fileList: fileList.filter((n) => n.uid !== file.uid),
- })
- }
+ let data = JSON.parse(res.data)
+ const fileList = this.data.fileList;
+ fileList.push({...file, url: data.data.url});
+ console.log(fileList)
+ this.setData({fileList});
},
+ });
+ },
+ deleteFile(e) {
+ console.log(e)
+ let index = e.detail.index
+ let fileList = this.data.fileList
+ fileList.splice(index, 1)
+ this.setData({
+ fileList
})
},
+
sure() {
let params = {
...this.data.form,
files: this.data.fileList,
icEventId: this.data.id,
status: "processing",
- timeLimit: this.data.value1 && this.data.value1.length ? this.data.value1[0] : ""
+ // timeLimit: this.data.value1 && this.data.value1.length ? this.data.value1[0] : ""
}
icEventOldReply(params).then(res => {
wx.showToast({
diff --git a/components/DispatchOrder/DispatchOrder.json b/components/DispatchOrder/DispatchOrder.json
index f8d4727..245b41f 100644
--- a/components/DispatchOrder/DispatchOrder.json
+++ b/components/DispatchOrder/DispatchOrder.json
@@ -1,12 +1,13 @@
{
"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"
+ "van-cascader": "@vant/weapp/cascader/index",
+ "van-popup": "@vant/weapp/popup/index",
+ "van-field": "@vant/weapp/field/index",
+ "van-radio": "@vant/weapp/checkbox/index",
+ "van-radio-group": "@vant/weapp/checkbox-group/index",
+ "van-calendar": "@vant/weapp/calendar/index",
+ "van-icon": "@vant/weapp/icon/index",
+ "van-uploader": "@vant/weapp/uploader/index"
}
}
\ No newline at end of file
diff --git a/components/DispatchOrder/DispatchOrder.wxml b/components/DispatchOrder/DispatchOrder.wxml
index dccfa13..5545fdc 100644
--- a/components/DispatchOrder/DispatchOrder.wxml
+++ b/components/DispatchOrder/DispatchOrder.wxml
@@ -1,4 +1,4 @@
-
+
+
+
处理方式:
- 指派
-
-
+
+
+ 指派
+
+
+
+
+
+
-
- 事件分类:
-
- {{category?category:'请选择'}}
+
+ 事件分类:
+
+ {{category ? category : '请选择'}}
+
-
- 处理部门:
-
- {{orgName?orgName:'请选择'}}
-
+
+ 处理部门:
+
+ {{orgName ? orgName : '请选择'}}
+
-
转办意见:
-
-
-
+
@@ -63,29 +65,18 @@
图片/附件:
-
- +
-
+
+
-
+
+ 办结时限:
+
+ {{form.timeLimit ? form.timeLimit : '请选择'}}
+
+
+
@@ -94,26 +85,33 @@
确定
-
-
+
+
+
+
+
+
+
+
-
-
diff --git a/components/DispatchOrder/DispatchOrder.wxss b/components/DispatchOrder/DispatchOrder.wxss
index fd0fc28..05425e8 100644
--- a/components/DispatchOrder/DispatchOrder.wxss
+++ b/components/DispatchOrder/DispatchOrder.wxss
@@ -118,4 +118,22 @@
}
.btn-gray {
background: #D9D9D9;
+}
+
+
+
+.gray {
+ color: #999;
+}
+.text-right {
+ text-align: right;
+}
+.flex {
+ display: flex!important;
+ justify-content: flex-end;
+ align-items: center;
+}
+
+.label-width {
+ min-width: 160rpx;
}
\ No newline at end of file
diff --git a/components/ResourceScheduling/ResourceScheduling.js b/components/ResourceScheduling/ResourceScheduling.js
index cd19e8c..330aea2 100644
--- a/components/ResourceScheduling/ResourceScheduling.js
+++ b/components/ResourceScheduling/ResourceScheduling.js
@@ -14,14 +14,6 @@ Component({
type: Boolean,
value: false
},
- agencyId: {
- type: String,
- value: '',
- observer: function (val) {
- this.typeChange()
- this.getList()
- }
- },
},
data: {
options: [
@@ -72,7 +64,6 @@ Component({
},
ready: function () {
this.typeChange()
- console.log(App.globalData.user.agencyId)
this.getList();
},
methods: {
diff --git a/components/dist/cascader-view/index.js b/components/dist/cascader-view/index.js
deleted file mode 100644
index d66cd94..0000000
--- a/components/dist/cascader-view/index.js
+++ /dev/null
@@ -1,320 +0,0 @@
-import baseComponent from '../helpers/baseComponent'
-import classNames from '../helpers/classNames'
-import styleToCssString from '../helpers/styleToCssString'
-import arrayTreeFilter from '../helpers/arrayTreeFilter'
-
-const WUX_CASCADER_VIEW = 'wux-cascader-view'
-const defaultFieldNames = {
- label: 'label',
- value: 'value',
- children: 'children',
- disabled: 'disabled',
-}
-
-baseComponent({
- externalClasses: ['wux-scroll-view-class'],
- properties: {
- prefixCls: {
- type: String,
- value: 'wux-cascader-view',
- },
- defaultValue: {
- type: Array,
- value: [],
- },
- value: {
- type: Array,
- value: [],
- },
- controlled: {
- type: Boolean,
- value: false,
- },
- options: {
- type: Array,
- value: [],
- },
- full: {
- type: Boolean,
- value: false,
- },
- placeholder: {
- type: String,
- value: '请选择',
- },
- height: {
- type: [String, Number],
- value: 'auto',
- },
- defaultFieldNames: {
- type: Object,
- value: defaultFieldNames,
- },
- skipAnimation: {
- type: Boolean,
- value: false,
- },
- },
- data: {
- activeOptions: [],
- activeIndex: 0,
- bodyStyle: '',
- activeValue: [],
- showOptions: [],
- fieldNames: undefined,
- scrollViewStyle: '',
- },
- computed: {
- classes: ['prefixCls, full', function(prefixCls, full) {
- const wrap = classNames(prefixCls)
- const hd = `${prefixCls}__hd`
- const bd = `${prefixCls}__bd`
- const innerScroll = classNames(`${prefixCls}__inner-scroll`, {
- [`${prefixCls}__inner-scroll--full`]: full,
- })
- const scrollView = `${prefixCls}__scroll-view`
- const ft = `${prefixCls}__ft`
-
- return {
- wrap,
- hd,
- bd,
- innerScroll,
- scrollView,
- ft,
- }
- }],
- },
- observers: {
- value(newVal) {
- if (this.data.controlled) {
- this.setData({ activeValue: newVal })
- this.getCurrentOptions(newVal)
- }
- },
- options() {
- this.getCurrentOptions(this.data.activeValue)
- },
- height(newVal) {
- this.updateStyle(newVal)
- },
- },
- methods: {
- getActiveOptions(activeValue) {
- const { options } = this.data
- const value = this.getFieldName('value')
- const childrenKeyName = this.getFieldName('children')
-
- return arrayTreeFilter(options, (option, level) => option[value] === activeValue[level], { childrenKeyName })
- },
- getShowOptions(activeValue) {
- const { options } = this.data
- const children = this.getFieldName('children')
- const result = this.getActiveOptions(activeValue).map((activeOption) => activeOption[children]).filter((activeOption) => !!activeOption)
-
- return [options, ...result]
- },
- getMenus(activeValue = [], hasChildren) {
- const { placeholder } = this.data
- const activeOptions = this.getActiveOptions(activeValue)
-
- if (hasChildren) {
- const value = this.getFieldName('value')
- const label = this.getFieldName('label')
-
- activeOptions.push({
- [value]: WUX_CASCADER_VIEW,
- [label]: placeholder,
- })
- }
-
- return activeOptions
- },
- getNextActiveValue(value, optionIndex) {
- let { activeValue } = this.data
-
- activeValue = activeValue.slice(0, optionIndex + 1)
- activeValue[optionIndex] = value
-
- return activeValue
- },
- updated(currentOptions, optionIndex, condition, callback) {
- const value = this.getFieldName('value')
- const children = this.getFieldName('children')
- const hasChildren = currentOptions && currentOptions[children] && currentOptions[children].length > 0
- const activeValue = this.getNextActiveValue(currentOptions[value], optionIndex)
- const activeOptions = this.getMenus(activeValue, hasChildren)
- const activeIndex = activeOptions.length - 1
- const showOptions = this.getShowOptions(activeValue)
- const props = {
- activeValue,
- activeOptions,
- activeIndex,
- showOptions,
- }
-
- // 判断 hasChildren 计算需要更新的数据
- if (hasChildren || (activeValue.length === showOptions.length && (optionIndex = Math.max(0, optionIndex - 1)))) {
- props.bodyStyle = this.getTransform(optionIndex + 1)
- props.showOptions = showOptions
- }
-
- // 判断是否需要 setData 更新数据
- if (condition) {
- this.setCascaderView(props)
- }
-
- // 回调函数
- if (typeof callback === 'function') {
- callback.call(this, currentOptions, activeValue)
- }
- },
- /**
- * 更新级联数据
- * @param {Array} activeValue 当前选中值
- */
- getCurrentOptions(activeValue = this.data.activeValue) {
- const optionIndex = Math.max(0, activeValue.length - 1)
- const activeOptions = this.getActiveOptions(activeValue)
- const currentOptions = activeOptions[optionIndex]
-
- if (currentOptions) {
- this.updated(currentOptions, optionIndex, true)
- } else {
- const value = this.getFieldName('value')
- const label = this.getFieldName('label')
-
- activeOptions.push({
- [value]: WUX_CASCADER_VIEW,
- [label]: this.data.placeholder,
- })
-
- const showOptions = this.getShowOptions(activeValue)
- const activeIndex = activeOptions.length - 1
- const props = {
- showOptions,
- activeOptions,
- activeIndex,
- bodyStyle: '',
- }
-
- this.setCascaderView(props)
- }
- },
- setCascaderView(props) {
- const { activeOptions, ...restProps } = props
- this.setData({ activeOptions }, () => {
- if (this.data.activeIndex !== restProps.activeIndex) {
- this.triggerEvent('tabsChange', { index: restProps.activeIndex })
- }
- this.setData(restProps)
- })
- },
- getTransform(index, animating = !this.data.skipAnimation) {
- const pt = this.data.full ? 2 : 1
- const i = this.data.full ? index : index - 1
- const bodyStyle = styleToCssString({
- transition: animating ? 'transform .3s' : 'none',
- transform: `translate(${-50 * pt * Math.max(0, i)}%)`,
- })
- return bodyStyle
- },
- /**
- * 点击菜单时的回调函数
- */
- onTabsChange(e) {
- const activeIndex = parseInt(e.detail.key)
- const bodyStyle = this.getTransform(activeIndex)
-
- if (
- this.data.bodyStyle !== bodyStyle ||
- this.data.activeIndex !== activeIndex
- ) {
- this.setData({
- bodyStyle,
- activeIndex,
- })
-
- this.triggerEvent('tabsChange', { index: activeIndex })
- }
- },
- /**
- * 点击选项时的回调函数
- */
- onItemSelect(e) {
- const { optionIndex } = e.currentTarget.dataset
- const { index } = e.detail
- const { showOptions } = this.data
- const item = showOptions[optionIndex][index]
-
- // updated
- this.updated(item, optionIndex, !this.data.controlled, this.onChange)
- },
- /**
- * 选择完成时的回调函数
- */
- onChange(currentOptions = {}, activeValue = []) {
- const values = this.getValue(activeValue)
-
- // 判断是否异步加载
- if (currentOptions && currentOptions.isLeaf === false && !currentOptions.children) {
- this.triggerEvent('change', { ...values })
- this.triggerEvent('load', { value: values.value, options: values.options })
- return
- }
-
- // 正常加载
- this.triggerEvent('change', { ...values })
- },
- getValue(activeValue = this.data.activeValue) {
- const optionIndex = Math.max(0, activeValue.length - 1)
- const activeOptions = this.getActiveOptions(activeValue)
- const currentOptions = activeOptions[optionIndex]
- const valueKeyName = this.getFieldName('value')
- const childrenKeyName = this.getFieldName('children')
- const hasChildren = currentOptions && currentOptions[childrenKeyName] && currentOptions[childrenKeyName].length > 0
- const options = activeOptions.filter((n) => n[valueKeyName] !== WUX_CASCADER_VIEW)
- const value = options.map((n) => n[valueKeyName])
-
- if (currentOptions && currentOptions.isLeaf === false && !currentOptions.children) {
- return {
- value,
- options,
- done: false,
- }
- }
-
- return {
- value,
- options,
- done: !hasChildren,
- }
- },
- getFieldName(name) {
- const { defaultFieldNames, fieldNames } = this.data
- return typeof fieldNames !== 'undefined'
- ? fieldNames[name]
- : defaultFieldNames[name]
- },
- updateStyle(height) {
- const scrollViewStyle = styleToCssString({
- height,
- minHeight: height,
- })
- if (this.data.scrollViewStyle !== scrollViewStyle) {
- this.setData({
- scrollViewStyle,
- })
- }
- },
- },
- attached() {
- const { defaultValue, value, controlled, height } = this.data
- const activeValue = controlled ? value : defaultValue
- const fieldNames = Object.assign({}, defaultFieldNames, this.data.defaultFieldNames)
-
- this.setData({ activeValue, fieldNames })
- this.getCurrentOptions(activeValue)
- this.updateStyle(height)
- },
-})
\ No newline at end of file
diff --git a/components/dist/cascader-view/index.json b/components/dist/cascader-view/index.json
deleted file mode 100644
index 78013bd..0000000
--- a/components/dist/cascader-view/index.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "component": true,
- "usingComponents": {
- }
-}
\ No newline at end of file
diff --git a/components/dist/cascader-view/index.wxml b/components/dist/cascader-view/index.wxml
deleted file mode 100644
index e69de29..0000000
diff --git a/components/dist/cascader-view/index.wxss b/components/dist/cascader-view/index.wxss
deleted file mode 100644
index e69de29..0000000
diff --git a/subpages/statistics/pages/demand/detail/detail.wxss b/subpages/statistics/pages/demand/detail/detail.wxss
index 2c0268c..6483ff0 100644
--- a/subpages/statistics/pages/demand/detail/detail.wxss
+++ b/subpages/statistics/pages/demand/detail/detail.wxss
@@ -173,7 +173,7 @@ page {
width: 100%;
left: 0;
box-sizing: border-box;
- z-index: 999;
+ z-index: 10;
}
.btn {
width: 240rpx;
diff --git a/subpages/statistics/pages/event/detail/detail.wxss b/subpages/statistics/pages/event/detail/detail.wxss
index 8b88881..d43b2da 100644
--- a/subpages/statistics/pages/event/detail/detail.wxss
+++ b/subpages/statistics/pages/event/detail/detail.wxss
@@ -159,7 +159,7 @@ page {
width: 100%;
left: 0;
box-sizing: border-box;
- z-index: 999;
+ z-index: 10;
}
.btn {
width: 240rpx;
diff --git a/utils/statisticsApi.js b/utils/statisticsApi.js
index f7edb63..6c5a491 100644
--- a/utils/statisticsApi.js
+++ b/utils/statisticsApi.js
@@ -240,6 +240,11 @@ export function userdemandAssign(params) {
return request.post('governance/userdemand/assign',params)
}
+// 共性需求派单
+export function commonDemand(params) {
+ return request.post('governance/commonDemand/update',params)
+}
+
// 获取服务方
export function listServerOrg(params) {
return request.post('actual/base/serviceitem/listServerOrg',params)