书写道路运输单位选择自定义级联,修改道路运输与港口等bug

main
jinna 3 years ago
parent 65f7e3b2c9
commit 59cf31786d
  1. 15
      pages.json
  2. 30
      pages/bus/busDataInfo/form.vue
  3. 13
      pages/portShipping/pilotStation/form.vue
  4. 467
      pages/roadTransport/transportData/form.vue

@ -219,16 +219,13 @@
"style": {
"navigationBarTitleText": "引航站"
}
},
{
"path": "pages/portShipping/pilotStation/form",
"style": {
"navigationBarTitleText": "引航站报送"
}
}
,{
"path" : "pages/bus/busDataInfo/form-copy",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
],
"globalStyle": {
"pageOrientation": "portrait",

@ -216,21 +216,33 @@
this.form.reportDate = getDateStr(now, -1); //
this.queryTime(); //
this.getPermiss(); //
} else if (options.item) {
} else if (options.type == 'edit') {
this.btnText = '修改并保存';
this.form = JSON.parse(options.item);
this.form.bizBusDataDetailVOList = this.form.bizWaterwayIslandDataVOList;
this.getPermiss(); //
this.queryTime();
} else if (options.id) {
this.btnText = '修改并保存';
this.queryDetailInfo(options.id);
}
this.pageType = 'edit'
let item = JSON.parse(options.item);
// this.form.bizBusDataDetailVOList = this.form.bizWaterwayIslandDataVOList;
// this.getPermiss(); //
// this.queryTime();
this.getDetail(item.id)
}
// else if (options.id) {
// this.btnText = '';
// this.queryDetailInfo(options.id);
// }
},
methods: {
formatDigit(data) {
return (data+'').indexOf('.') > -1 && (data+'').substring((data+'').indexOf('.')).length > 2 ? data.toFixed(2) : data;
},
getDetail(id){
this.$request(getApp().globalData.baseUrl + '/api/biz/busdata/getById/' + id,{},"GET").then(res =>{
console.log('查询详情===>',res)
this.form = res.data;
this.form.bizBusDataDetailVOList = this.form.bizBusDataBodySaveOrUpdateDTOList;
this.queryTime(); //
this.getPermiss();
})
},
//
changeLandNameIndex(index) {
if (this.form.bizBusDataDetailVOList[this.landNameIndex].vehicleInput != '' && this.form

@ -176,14 +176,23 @@ import { calcMom, checkNotEmpty, getDateStr } from '../../../common/util'
this.getRoadTime()
}else if(options.type == 'edit'){
this.pageType = 'edit'
this.form = JSON.parse(options.item);
this.getRoadTime()
let item = JSON.parse(options.item);
this.getDetail(item.id)
}
},
methods: {
formatDigit(data) {
return (data+'').indexOf('.') > -1 && (data+'').substring((data+'').indexOf('.')).length > 2 ? data.toFixed(2) : data;
},
getDetail(id){
this.$request(getApp().globalData.baseUrl + '/api/biz/bizPilotData/getById/' + id,{},"GET").then(res =>{
console.log(res)
this.form = res.data;
this.getRoadTime()
})
},
//
getRoadTime(){
this.$request(getApp().globalData.baseUrl + '/api/dict/dictList?dictType=airport_time&_t=1693372307694',"GET").then(res =>{

@ -18,7 +18,7 @@
:style="roadData.reportingUnitId?'color:#333;':''">{{roadData.reportingUnitId?roadData.reportingUnitId:'请选择'}}</text>
<uni-icons type="right" size="16" color="#D4D4D4"></uni-icons>
</picker>
<text v-else>{{roadData.reportingUnitId}}</text>
<text v-else @click="showPop">{{roadData.reportingUnitId}}</text>
</view>
</view>
<view class="edit_item">
@ -303,6 +303,100 @@
<p class="btn_item confirm" v-if="pageType == 'add'" @click="confirmRoad">保存</p>
<p class="btn_item confirm" v-if="pageType == 'edit'" @click="confirmRoad">修改并保存</p>
</view>
<!-- <view class="pop_box">
<view class="left_box" v-for="(item,index) in treeData" :key="index">
<view class="" v-if="!item.isExpand">
<uni-icons type="right" size="30"></uni-icons>
{{item.deptName}}
</view>
<view class="" v-if="item.isExpand">
<view class="">
<uni-icons type="bottom" size="30"></uni-icons>
{{item.deptName}}
</view>
<view class="" v-for="item1 in item.children" :key="item1.deptId">
{{item1.deptName}}
</view>
</view>
</view>
</view> -->
<view class="pop_conbox">
<uni-popup ref="unitPopup" style="width: 100%;" background-color="#fff">
<view class="pop_box">
<view class="pop_title">
<view class="pop_title">
填报单位
<uni-icons @click="this.$refs.unitPopup.close()" type="closeempty" size="18" color="#666" class="pop_close"></uni-icons>
</view>
</view>
<view class="popup-content">
<view class="tree_item" v-for="(item,index) in treeData" :key="index">
<view class="item">
<view class="first_item">
<view class="first_item_top" :class="item.deptId == selectId ? 'check' : ''">
<view class="left_item">
<uni-icons v-show="item.children.length != 0 && !item.isExpand" @click="expandItem(item)" type="right" size="15"></uni-icons>
<uni-icons v-show="item.children.length != 0 && item.isExpand" @click="expandItem(item)" type="bottom" size="15"></uni-icons>
</view>
<view class="right_item" @click="clickItem(item)">
{{item.deptName}}
</view>
</view>
<view v-if="item.children.length != 0 && item.isExpand">
<view class="second_item" v-for="(item1,index1) in treeData[index].children" :key="item1.deptId">
<view class="seco_top_item" :class="item1.deptId == selectId ? 'check' : ''">
<view class="left_item">
<uni-icons v-show="item1.children.length != 0 && !item1.isExpand" @click="expandItem(item1)" type="right" size="15"></uni-icons>
<uni-icons v-show="item1.children.length != 0 && item1.isExpand" @click="expandItem(item1)" type="bottom" size="15"></uni-icons>
</view>
<view class="right_item" @click="clickItem(item1)">
{{item1.deptName}}
</view>
</view>
<view v-if="item1.children.length != 0 && item1.isExpand">
<view class="third_item" v-for="(item2,index2) in treeData[index].children[index1].children" :key="item2.deptId">
<view class="third_top_item" :class="item2.deptId == selectId ? 'check' : ''">
<view class="left_item">
<uni-icons @click.stop="expandItem(item2)" v-if="item2.children.length != 0 && !item2.isExpand" type="right" size="15"></uni-icons>
<uni-icons @click.stop="expandItem(item2)" v-if="item2.children.length != 0 && item2.isExpand" type="bottom" size="15"></uni-icons>
</view>
<view class="right_item" @click="clickItem(item2)">
{{item2.deptName}}
</view>
</view>
<view v-if="item2.children.length != 0 && item2.isExpand">
<view class="four_item" v-for="(item3,index3) in treeData[index].children[index1].children[index2].children" :key="item3.deptId">
<view class="four_item_item" :class="item3.deptId == selectId ? 'check' : ''">
<view class="left_item">
<uni-icons @click="expandItem(item3)" v-if="item3.children.length != 0 && !item3.isExpand" type="right" size="15"></uni-icons>
<uni-icons @click="expandItem(item3)" v-if="item3.children.length != 0 && item3.isExpand" type="bottom" size="15"></uni-icons>
</view>
<view class="right_item" @click="clickItem(item3)">
{{item3.deptName}}
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="btn_box">
<p class="btn" @click="searchReset">取消</p>
<p class="btn" @click="searchList">确认</p>
</view>
</view>
</uni-popup>
</view>
</view>
</template>
@ -365,14 +459,90 @@ import { calcMom, calcYoy, checkNotEmpty, getDateStr, lastYearDate } from '../..
unitId:'',
peopleList:[],
peopleIndex:'',
peopleName:''
peopleName:'',
treeData:[
{
children: [
{
deptId: 459,
deptName: "青岛公路管理局1",
children:[],
isExpand:false,
},
{
deptId: 460,
deptName: "青岛公路管理局2",
children:[],
isExpand:false,
},
],
isExpand:true,
deptId: 458,
deptName: "青岛公路管理局",
},
{
children: [
{
deptId: 463,
deptName: "青岛公路管理局1",
isExpand:true,
children: [
{
deptId:101,
deptName:'管理局1',
isExpand:false,
children:[]
},
{
deptId:102,
deptName:'管理局2',
isExpand:true,
children:[
{
deptId:103,
deptName:'管理局3',
isExpand:false,
children:[]
}
]
},
]
},
{
deptId: 464,
deptName: "青岛公路管理局2",
children:[]
},
{
deptId: 465,
deptName: "青岛公路管理局3",
children:[]
},
],
deptId: 462,
isExpand:false,
deptName: "青岛公路局",
},
{
deptId: 468,
deptName: "公路局",
children:[]
},
],
newArr:[],
treeIndex:'',
selectId:'',
selectName:'',
selectId1:''
}
},
onLoad(options){
this.getUnitData()
this.getPersonData();
this.getDept()
let arr = uni.getStorageSync('deptName');
this.deptNameList = checkNotEmpty(arr) ? arr : [];
this.unitId = this.deptNameList.length > 0 ? this.deptNameList[0].deptId : '';
if(options.type == 'edit'){
const item = JSON.parse(options.item);
this.pageType = 'edit'
@ -381,7 +551,6 @@ import { calcMom, calcYoy, checkNotEmpty, getDateStr, lastYearDate } from '../..
this.pageType = 'add';
this.roadData.reportingUnitId = this.deptNameList.length > 0 ? this.deptNameList[0].deptName : '';
this.roadData.reportingUnitIdIndex = this.deptNameList.length > 0 ? 0 : '';
this.unitId = this.deptNameList.length > 0 ? this.deptNameList[0].deptId : '';
this.getRoadTime()
this.getPeople()
let now = new Date();
@ -390,26 +559,108 @@ import { calcMom, calcYoy, checkNotEmpty, getDateStr, lastYearDate } from '../..
},
methods: {
showPop(){
this.selectId = this.selectId1;
this.$refs.unitPopup.open('bottom')
this.newArr = []
this.traversalTree(this.treeData,this.newArr);
this.treeData = this.newArr
},
traversalTree(arrs, that) {
arrs.map((item, index) => {
that.push({
deptId: item.deptId,
deptName: item.deptName,
isExpand:false,
isCheckd:false,
children:[]
})
if (item.children.length !== 0) {
this.traversalTree(item.children, that[index].children)
}
})
},
clickItem(item1){
this.selectId = item1.deptId
this.selectName = item1.deptName
},
expandItem(item){
this.treeIndex = this.treeData.findIndex(val => val.id == item.id)
item.isExpand = !item.isExpand
},
searchReset(){
this.$refs.unitPopup.close()
},
searchList(){
this.roadData.reportingUnitId = this.selectName;
this.selectId1 = this.selectId;
this.$refs.unitPopup.close()
},
getPeople(){
this.$request(getApp().globalData.baseUrl + '/api/user/getByDeptId/' + this.unitId,{},"GET").then(res =>{
console.log('人员列表 ===>',res)
res.data.map(item =>{
this.peopleList.push({id:item.id,people:item.username + ',' + item.mobile})
})
if(this.pageType == 'edit'){
console.log('deptNameList ===>',this.peopleList)
let tmp = this.peopleList.find(item => item.id == this.roadData.responsiblePersonId)
this.peopleIndex = this.peopleList.findIndex(item => item.id == this.roadData.responsiblePersonId)
this.peopleName = tmp.people
console.log(tmp)
}
})
},
getDept(){
this.$request(getApp().globalData.baseUrl + '/api/dept/getCurrentAndSubordinateDept',{},"GET").then(res =>{
console.log('单位===>',res)
})
},
getDetail(id){
this.$request(getApp().globalData.baseUrl + '/api/biz/roadtransport/road/find/' + id,{},"GET").then(res =>{
this.roadData = res.data;
this.getRoadTime()
this.getRoadTime();
this.getPeople()
// console.log('last==>',lastYearDate(this.roadData.statisticalDate))
})
},
getRatio(){
this.$request(getApp().globalData.baseUrl + '/api/biz/roadtransport/road/findByStatisticalDate/' + lastYearDate(this.roadData.statisticalDate),{},"GET").then(res =>{
this.lastData = res.data;
this.calcRatio()
let params = {
statisticalDate:this.roadData.statisticalDate,
reportPhase:this.roadData.reportPhase
}
this.$request(getApp().globalData.baseUrl + '/api/biz/roadtransport/road/findByStatisticalDate',params,"GET").then(res =>{
// this.lastData = res.data;
// this.calcRatio()
let yesterdayData = res.data.yesterdayData;
let lastYearData = res.data.lastYearData;
this.roadData.passengerVolumeYesterday = yesterdayData.totalPassengerVolume
this.roadData.passengerVolumeLastYear = lastYearData.totalPassengerVolume
this.roadData.totalBusYesterday = yesterdayData.capacityTotalBus
this.roadData.totalBusLastYear = yesterdayData.capacityTotalBus
// (%)
//
// 1000
// 20-0100
// 30-
// 40(-)/ * 100
this.roadData.passengerVolumeRatio =
(checkNotEmpty(this.roadData.totalPassengerVolume) && this.roadData.totalPassengerVolume != 0 && checkNotEmpty(this.lastData.totalPassengerVolume) && this.lastData.totalPassengerVolume === 0) ? 100 :
(checkNotEmpty(this.roadData.totalPassengerVolume) && checkNotEmpty(this.lastData.totalPassengerVolume) && this.roadData.totalPassengerVolume != 0 && this.lastData.totalPassengerVolume != 0) ?
(this.roadData.totalPassengerVolume - this.lastData.totalPassengerVolume) / this.lastData.totalPassengerVolume * 100 :
(this.roadData.totalPassengerVolume == 0 && this.lastData.totalPassengerVolume == 0) ? 0 : ''
// //
this.roadData.totalBusIncreaseRatio =
(checkNotEmpty(this.roadData.capacityTotalBus) && this.roadData.capacityTotalBus != 0 && checkNotEmpty(this.lastData.capacityTotalBus) && this.lastData.capacityTotalBus === 0) ? 100 :
(checkNotEmpty(this.roadData.capacityTotalBus) && checkNotEmpty(this.lastData.capacityTotalBus) && this.roadData.capacityTotalBus != 0 && this.lastData.capacityTotalBus != 0) ?
(this.roadData.capacityTotalBus - this.lastData.capacityTotalBus) / this.lastData.capacityTotalBus * 100 :
(this.roadData.capacityTotalBus == 0 && this.lastData.capacityTotalBus == 0) ? 0 : ''
})
},
//
@ -447,27 +698,27 @@ import { calcMom, calcYoy, checkNotEmpty, getDateStr, lastYearDate } from '../..
success:(res) =>{
if(res.confirm){
console.log(params)
// this.$request(getApp().globalData.baseUrl + '/api/biz/roadtransport/road/saveOrUpdate',params,'POST').then(res =>{
// if(res.code == 200){
// uni.showToast({
// title:"",
// icon:"none",
// success: () => {
// if(params.id == undefined){
// setTimeout(() => {
// uni.redirectTo({
// url:"/pages/roadTransport/transportData/list"
// })
// }, 300)
// }else{
// setTimeout(() =>{
// uni.navigateBack()
// },300)
// }
// }
// })
// }
// })
this.$request(getApp().globalData.baseUrl + '/api/biz/roadtransport/road/saveOrUpdate',params,'POST').then(res =>{
if(res.code == 200){
uni.showToast({
title:"报送提交成功",
icon:"none",
success: () => {
if(params.id == undefined){
setTimeout(() => {
uni.redirectTo({
url:"/pages/roadTransport/transportData/list"
})
}, 300)
}else{
setTimeout(() =>{
uni.navigateBack()
},300)
}
}
})
}
})
}
}
})
@ -523,21 +774,17 @@ import { calcMom, calcYoy, checkNotEmpty, getDateStr, lastYearDate } from '../..
// 20-0100
// 30-
// 40(-)/ * 100
console.log()
this.roadData.passengerVolumeRatio = calcYoy(this.roadData.totalPassengerVolume,this.lastData.totalPassengerVolume)
// this.roadData.passengerVolumeRatio =
// (checkNotEmpty(this.roadData.totalPassengerVolume) && this.roadData.totalPassengerVolume != 0 && checkNotEmpty(this.lastData.totalPassengerVolume) && this.lastData.totalPassengerVolume === 0) ? 100 :
// (checkNotEmpty(this.roadData.totalPassengerVolume) && checkNotEmpty(this.lastData.totalPassengerVolume) && this.roadData.totalPassengerVolume != 0 && this.lastData.totalPassengerVolume != 0) ?
// (this.roadData.totalPassengerVolume - this.lastData.totalPassengerVolume) / this.lastData.totalPassengerVolume * 100 :
// (this.roadData.totalPassengerVolume == 0 && this.lastData.totalPassengerVolume == 0) ? 0 : ''
//
this.roadData.totalBusIncreaseRatio =
calcYoy(this.roadData.capacityTotalBus,this.lastData.capacityTotalBus)
// (checkNotEmpty(this.roadData.capacityTotalBus) && this.roadData.capacityTotalBus != 0 && checkNotEmpty(this.lastData.capacityTotalBus) && this.lastData.capacityTotalBus === 0) ? 100 :
// (checkNotEmpty(this.roadData.capacityTotalBus) && checkNotEmpty(this.lastData.capacityTotalBus) && this.roadData.capacityTotalBus != 0 && this.lastData.capacityTotalBus != 0) ?
// (this.roadData.capacityTotalBus - this.lastData.capacityTotalBus) / this.lastData.capacityTotalBus * 100 :
// (this.roadData.capacityTotalBus == 0 && this.lastData.capacityTotalBus == 0) ? 0 : ''
// console.log((parseInt(0.12) - parseInt(0.5156) ) /parseInt(0.5156) * 100)
// console.log(' ===>',this.roadData.totalBusIncreaseRatio)
// //
// this.roadData.totalBusIncreaseRatio =
// (checkNotEmpty(this.roadData.capacityTotalBus) && this.roadData.capacityTotalBus != 0 && checkNotEmpty(this.lastData.capacityTotalBus) && this.lastData.capacityTotalBus === 0) ? 100 :
// (checkNotEmpty(this.roadData.capacityTotalBus) && checkNotEmpty(this.lastData.capacityTotalBus) && this.roadData.capacityTotalBus != 0 && this.lastData.capacityTotalBus != 0) ?
// (this.roadData.capacityTotalBus - this.lastData.capacityTotalBus) / this.lastData.capacityTotalBus * 100 :
// (this.roadData.capacityTotalBus == 0 && this.lastData.capacityTotalBus == 0) ? 0 : ''
},
//
getPersonData(){
@ -764,5 +1011,147 @@ import { calcMom, calcYoy, checkNotEmpty, getDateStr, lastYearDate } from '../..
}
}
}
.pop_conbox{
.pop_box {
border-radius: 30rpx 30rpx 0 0;
background-color: #fff;
padding: 30rpx;
.pop_title {
color: #333333;
font-size: 32rpx;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
line-height: 45rpx;
text-align: center;
margin: 20rpx 0;
.pop_close {
float: right;
}
}
.popup-content{
max-height: 500rpx;
margin: 30rpx 0;
overflow-y: auto;
.tree_item{
width: 100%;
display: flex;
padding: 10rpx 0;
.item{
width: 100%;
// display: flex;
.first_item{
width: 100%;
.first_item_top{
width: 100%;
display: flex;
padding: 10rpx 0;
&.check{
background: rgba(45, 140, 240,0.2);
}
.left_item{
width: 40rpx;
height: 40rpx;
display: flex;
align-items: center;
justify-content: center;
margin-right: 10rpx;
}
}
}
.second_item{
width: 100%;
.seco_top_item{
width: 100%;
display: flex;
padding: 10rpx 0 10rpx 40rpx;
&.check{
background: rgba(45, 140, 240,0.2);
}
.left_item{
width: 40rpx;
height: 40rpx;
display: flex;
align-items: center;
justify-content: center;
margin-right: 10rpx;
}
}
.third_item{
width: 100%;
.third_top_item{
width: 100%;
display: flex;
padding: 10rpx 0 10rpx 80rpx;
&.check{
background: rgba(45, 140, 240,0.2);
}
.left_item{
width: 40rpx;
height: 40rpx;
display: flex;
align-items: center;
justify-content: center;
margin-right: 10rpx;
}
}
.four_item{
.four_item_item{
display: flex;
padding: 10rpx 0 10rpx 120rpx;
.left_item{
width: 40rpx;
height: 40rpx;
display: flex;
align-items: center;
justify-content: center;
margin-right: 10rpx;
}
}
}
}
}
}
}
}
.btn_box {
width: 100%;
height: 120rpx;
display: flex;
margin-top: 20px;
align-items: center;
justify-content: space-between;
.btn {
width: 290rpx;
height: 90rpx;
background: #FFFFFF;
border-radius: 100rpx;
border: 1rpx solid #C1C1C1;
color: #666;
font-size: 28rpx;
line-height: 88rpx;
text-align: center;
&:last-child {
background: #2D8CF0;
color: #FFFFFF;
border-color: #2D8CF0;
}
}
}
}
}
}
</style>

Loading…
Cancel
Save