省市区街道

This commit is contained in:
shijing 2022-11-03 16:51:59 +08:00
parent d4dabf8cbe
commit cb2c522905
6 changed files with 195910 additions and 16 deletions

190437
common/city.data.js Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,328 @@
<template>
<view>
<view class="mask" :class="{'maskShow' : showPicker}" @click="hide" @click.stop.prevent @touchmove.stop.prevent catchtouchmove="true"></view>
<view class="cpicker-content" :class="{'cpickerShow' : showPicker}">
<view class="city-head" @click.stop.prevent @touchmove.stop.prevent catchtouchmove="true">
<view class="city-head-title">{{headtitle}}</view>
<text v-if="rightIcon" class="rightIcon iconfont icon-quxiao" @click="hide('self')"></text>
</view>
<scroll-view id="nav-bar" class="nav-bar"scroll-x="true" scroll-with-animation="true" :scroll-left="scrollLeft" >
<view
v-for="(item,index) in tabbars"
class="nav-item"
:key="index"
:id="'tab'+index"
@click="changeTab(index)"
:class="{'current': index === tabCurrentIndex}"
><text class="nav-bar-title">{{item.text}}</text></view>
</scroll-view>
<view class="city_content">
<scroll-view class="panel-scroll-box" :scroll-y="enableScroll" :cscrollTop="scrollTop" :current="tabCurrentIndex" :scroll-top="scrollTop">
<block v-for="(item,index) in showData" :key="index">
<view class="flex-row-c-c" @click="changCity(tabCurrentIndex,item)">
<icon type="success_no_circle" v-if="tabbars[tabCurrentIndex].value==item.value" :id="'show'+tabCurrentIndex" class="ischeck" size="14" color="#00B1B7" ></icon>
<text class="city-text">{{item.text}}</text>
</view>
</block>
</scroll-view>
</view>
</view>
</view>
</template>
<script>
let windowWidth = 0,scrollTimer = false, tabBar;
export default {
name: 'UniCityNvue',
props: {
headtitle: { // 使tab
type: String,
default: ''
},
pickerSize: { // 使tab
type: [String, Number],
default: 1
},
data: { // id使id[]
type:Array,
default:function(){
return [];
},
},
provincedata: { // id使id[]
type:Array,
default:function(){
return [];
},
}
},
data() {
return {
isFirst: true,
rightIcon:true,
scrollLeft: 500, //
scrollTop:0,
enableScroll: true,
tabCurrentIndex: 0, //
tabbars:this.provincedata,
showData:this.data,
pickersize: this.pickerSize,
showPicker: false
}
},
watch: {
showPicker(){
if(this.isFirst){
this.isFirst = false;
}
},
provincedata(val){
this.tabbars=val;
}
},
methods: {
show(){
this.showPicker = true;
windowWidth = uni.getSystemInfoSync().windowWidth;
if(this.provincedata.length>0&&this.provincedata.length<this.pickerSize&&this.isFirst&&this.provincedata[this.provincedata.length-1].value!=""){
this.showData=this.findSameId(this.data,this.tabbars[this.provincedata.length],this.tabbars[this.provincedata.length-1]);
var current={
text:"请选择",
value:"",
}
this.tabbars.push(current);
this.tabCurrentIndex=this.provincedata.length-1;
this.scrollTop=0;
this.setScroll(this.tabCurrentIndex);
}else{
console.log(this.tabbars)
this.showData=this.findSameId(this.data,this.tabbars[this.provincedata.length-1],this.tabbars[this.provincedata.length-2]);
this.$nextTick(()=>{
this.tabCurrentIndex=this.provincedata.length-1;
this.scrollTop=0;
this.setScroll(this.tabCurrentIndex);
})
}
},
findSameId(tree, currentTab,preTab) {
let retNode = null;
function deepSearch(tree, currentTab,preTab) {
for (var i = 0; i < tree.length; i++) {
if (tree[i].children && tree[i].children.length > 0) {
deepSearch(tree[i].children, currentTab,preTab);
}
var flag=currentTab==undefined?true:(currentTab.value===""?true:false);
var value=tree[i].value+"";
var text=tree[i].text;
if (preTab!=null&&flag&&preTab.text=== text&&preTab.value+"" ===value) {
retNode=tree[i].children;
break;
}else if (currentTab!=null&&currentTab.text=== text&&currentTab.value+"" === value) {
retNode=tree;
break;
}
}
}
deepSearch(tree, currentTab,preTab);
return retNode==null?tree:retNode;
},
hide(){
this.showPicker = false;
},
//tab
changeTab(e){
let index = e;
this.setScroll(index);
//300ms,swipertabbar
this.tabCurrentIndex = index;
this.showData=this.findSameId(this.data,this.tabbars[index],index===0?this.tabbars[index]:this.tabbars[index-1]);
setTimeout(()=>{
this.getScroll("show"+index);
}, 10)
},
//size
getElSize(id) {
return new Promise((res, rej) => {
let el = uni.createSelectorQuery().in(this).select('#' + id);
el.fields({
size: true,
scrollOffset: true,
rect: true
}, (data) => {
res(data);
}).exec();
});
},
changCity(index,item) {
if(this.tabbars[index].value!=item.value){
this.tabbars[index].text=item.text;
this.tabbars[index].value=item.value;
if(index<(this.tabbars.length-1)){
this.tabbars.splice(index+1,this.tabbars.length-index-1)
}
if(item.children && item.children.length > 0){
if(this.tabbars.length<this.pickersize){
var current={
text:"请选择",
value:""
}
this.showData=item.children;
this.tabbars.push(current);
this.tabCurrentIndex++;
this.scrollTop=0;
this.setScroll(index);
}else{
this.$emit('funcvalue',this.tabbars);
this.hide();
}
}else{
this.$emit('funcvalue',this.tabbars);
this.hide();
}
}
},
async setScroll(index){
let width = 0;
let nowWidth = 0;
for (let i = 0; i <= index; i++) {
let result = await this.getElSize('tab' + i);
width += result.width;
if(i === index){
nowWidth = result.width;
}
}
if ((width+nowWidth)>windowWidth) {
this.scrollLeft=width+nowWidth;
}else{
this.scrollLeft = 0;
}
},
getScroll(id) {
uni.createSelectorQuery().in(this).select('.panel-scroll-box').boundingClientRect((data)=>{
uni.createSelectorQuery().in(this).select('#' + id).boundingClientRect((res)=>{
if(res != undefined && res != null && res != ''){
this.scrollTop=res.top-data.top;
}
}).exec()
}).exec();
}
}
}
</script>
<style scoped lang="scss">
.mask {
visibility: hidden;
position: fixed;
top: 0;
right: 0;
left: 0;
bottom: 0;
z-index: 1000;
background: rgba(0, 0, 0, .6);
opacity: 0;
transition: all .3s ease;
}
.maskShow {
visibility: visible;
opacity: 1;
}
.cpicker-content {
position: fixed;
right: 0;
bottom: 0;
left: 0;
background-color: #FFFFFF;
transition: all .3s ease;
transform: translateY(100%);
z-index: 3000;
}
.cpickerShow {
transform: translateY(0);
}
.city-head {
width: 750rpx;
height: 88rpx;
flex-direction: column;
border-bottom-width: 1px;
border-bottom-color: #F4F4F4;
border-bottom-style: solid;
}
.city-head-title {
font-size: 15px;
line-height: 88rpx;
align-items: center;
text-align: center;
}
.rightIcon {
position: absolute;
right: 15px;
top: 9px;
font-size: 30px;
color: #BEBEBE;
}
.nav-bar {
position: relative;
z-index: 10;
height: 90upx;
white-space: nowrap;
box-shadow: 0 2upx 8upx rgba(0,0,0,.06);
background-color: #fff;
}
.nav-bar::-webkit-scrollbar {
display: none;
}
.nav-item {
display: inline-flex!important;
flex-direction: row!important;
width: 170rpx;
padding: 7px 0px;
line-height: 26px;
align-items: center;
justify-content: center;
color: #303133;
position: relative;
overflow: hidden;
text-overflow: ellipsis;
}
.nav-bar-title {
font-size: 12px;
}
.current {
// color: $base-bgcolor;
// border-color: $base-bgcolor;
border-bottom-width: 4rpx;
border-bottom-style: solid;
}
.current:after {
width: 50%;
}
.panel-scroll-box {
height: 516rpx;
margin-top: 8px;
}
.flex-row-c-c {
display: block;
flex-direction: row;
padding-left: 25px;
}
.city-text {
flex-direction: row;
height: 35px;
line-height: 35px;
font-size: 13px;
}
.hide {
opacity: 0;
}
.ischeck {
display: inline-flex!important;
flex-direction: column;
margin-right: 5px;
vertical-align: middle;
}
</style>

103
pages/comm/city/city.vue Normal file
View File

@ -0,0 +1,103 @@
<template>
<picker @change="bindPickerChange" @columnchange="columnchange" :range="array" range-key="name" :value="value" mode="multiSelector">
<slot></slot>
</picker>
</template>
<script>
import AllAddress from './data.js'
let selectVal = ['','','']
export default {
data() {
return{
value: [0,0,0],
array: [],
index: 0
}
},
created() {
this.initSelect()
},
methods:{
//
initSelect() {
this.updateSourceDate() //
.updateAddressDate() //
.$forceUpdate() //
},
//
columnchange(d) {
this.updateSelectIndex(d.detail.column, d.detail.value) //
.updateSourceDate() //
.updateAddressDate() //
.$forceUpdate() //
},
/**
* 更新源数据
* */
updateSourceDate() {
this.array = []
this.array[0] = AllAddress.map(obj => {
return {
name: obj.name
}
})
this.array[1] = AllAddress[this.value[0]].city.map(obj => {
return {
name: obj.name
}
})
this.array[2] = AllAddress[this.value[0]].city[this.value[1]].area.map(obj => {
return {
name: obj
}
})
return this
},
/**
* 更新索引
* */
updateSelectIndex(column, value){
let arr = JSON.parse(JSON.stringify(this.value))
arr[column] = value
if(column === 0 ) {
arr[1] = 0
arr[2] = 0
}
if(column === 1 ) {
arr[2] = 0
}
this.value = arr
return this
},
/**
* 更新结果数据
* */
updateAddressDate() {
selectVal[0] = this.array[0][this.value[0]].name
selectVal[1] = this.array[1][this.value[1]].name
selectVal[2] = this.array[2][this.value[2]].name
return this
},
/**
* 点击确定
* */
bindPickerChange(e) {
this.$emit('change', {
index: this.value,
data: selectVal
})
return this
}
}
}
</script>
<style>
</style>

4914
pages/comm/city/data.js Normal file

File diff suppressed because it is too large Load Diff

View File

@ -10,6 +10,11 @@
<text class="text">{{ticketCount}}</text> <text class="text">{{ticketCount}}</text>
<view class="status">待办工单</view> <view class="status">待办工单</view>
</view> </view>
<view @click="goIntoTargetPage('copy')"
style="width: 25%;height: 100%;display: flex;flex-direction: column;justify-content: center;">
<text class="text">{{copyCount}}</text>
<view class="status">抄送我</view>
</view>
<view @click="goIntoTargetPage('warning')" <view @click="goIntoTargetPage('warning')"
style="width: 25%;height: 100%;display: flex;flex-direction: column;justify-content: center;"> style="width: 25%;height: 100%;display: flex;flex-direction: column;justify-content: center;">
<text class="text">{{eventCount}}</text> <text class="text">{{eventCount}}</text>
@ -58,6 +63,43 @@
</view> </view>
</view> </view>
</view> </view>
<view class="copy">
<view class="copy01">
<view class="title">
<view class="left-content">
<view class="img-view">
<image src="../../static/home/daiban.png" mode="" class="img"></image>
</view>
<text class="title-text-left">抄送我</text>
</view>
<view class="" @click="goIntoTargetPage('daiban')">
<text class="title-text-right">查看更多</text>
<uni-icons type="right" :size="11" color="#ababab"></uni-icons>
</view>
</view>
<view class="line"></view>
<view class="listWrap" v-if="copyList.length>0">
<view v-for="item in copyList" :key="item.id">
<view class="itemTitle">{{item.title}}</view>
<view class="itemCenter">
<view class="info-details">所属工作流{{item.workflow_.name}}</view>
<view class="info-details">工单状态{{item.state_.name}}</view>
<view class="info-details">提交时间{{item.create_time}} </view>
<view class="info-details">更新时间{{item.update_time}} </view>
</view>
<view class="bottom-btns">
<view class="shenhejieshu bottom-btn" @click="ticketHandle(item,'show')">
<image src="../../static/my/my_apply/tongguo.png" mode=""></image>
查看
</view>
</view>
</view>
</view>
<view class="listWrap" v-else>
<view class="emptyList">暂无待办工单</view>
</view>
</view>
</view>
<view class="tongzhi"> <view class="tongzhi">
<view class="title"> <view class="title">
<view class="left-content"> <view class="left-content">
@ -110,10 +152,12 @@
limitedOperation:false, limitedOperation:false,
limitedRpj:false, limitedRpj:false,
limitedVisit:false, limitedVisit:false,
copyList: [],
ticketList: [], ticketList: [],
eventList: [], eventList: [],
eventCount: 0, eventCount: 0,
ticketCount: 0, ticketCount: 0,
copyCount:0,
// 2022218 // 2022218
mytopimg: require("@/static/home/bgimg-top.jpg"), mytopimg: require("@/static/home/bgimg-top.jpg"),
} }
@ -134,6 +178,7 @@
this.cateAggForm.start_create = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate(); this.cateAggForm.start_create = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate();
this.getTicketAgg(); this.getTicketAgg();
this.getTicket(); this.getTicket();
this.getcopy();
this.getEventAgg(); this.getEventAgg();
this.getEvent(); this.getEvent();
} }
@ -150,6 +195,17 @@
that.ticketList = res.results.splice(0, 2); that.ticketList = res.results.splice(0, 2);
}) })
}, },
getcopy() {
let that = this;
that.copyList = []
let params = {
category: 'cc'
};
that.$u.api.getTickets(params).then(res => {
that.copyList = res.results.splice(0, 2);
})
},
getEvent() { getEvent() {
let that = this; let that = this;
let params = { let params = {
@ -188,13 +244,17 @@
url: "./list/ticket" url: "./list/ticket"
}) })
} }
if (type == "copy") {
uni.navigateTo({
url: "./list/ticket"
})
}
if (type == "warning") { if (type == "warning") {
uni.navigateTo({ uni.navigateTo({
url: "./list/event" url: "./list/event"
}) })
} }
} }
}, },
ticketHandle(row, type) { ticketHandle(row, type) {
let projectId = null; let projectId = null;
@ -280,15 +340,16 @@
font-size: 26rpx; font-size: 26rpx;
color: #383838; color: #383838;
} }
.daiban01 ,.copy01{
.daiban01 {
width: 720rpx; width: 720rpx;
background-color: #ffffff; background-color: #ffffff;
border-radius: 10rpx; border-radius: 10rpx;
margin: 0 auto; margin: 0 auto;
margin-top: 88rpx; margin-top: 88rpx;
} }
.copy01{
margin-top: 20upx;
}
.title { .title {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;

View File

@ -26,8 +26,26 @@
</view> </view>
<view class="item item_bottom_border"> <view class="item item_bottom_border">
<view class="title"><text class="star">*</text>来源地</view> <view class="title"><text class="star">*</text>来源地</view>
<view class="content" @click="toggleMaskLocation">
<text class="cell-tip">
<text class="choose-text">{{addressByPcrs}}</text>
<text class="iconfont icon-xiangxia"></text>
</text>
</view>
<gk-city
:headtitle="headtitle"
:provincedata="provincedata"
:data="selfData"
mode="cityPicker"
ref="cityPicker"
@funcvalue="getpickerParentValue"
:pickerSize="4"></gk-city>
</view>
<view class="item item_bottom_border">
<view class="title"><text class="star">*</text>具体地址</view>
<view class="content"> <view class="content">
<input type="text" v-model="formData.come_place" maxlength="20" placeholder="请输入来源地" /> <!-- <pickerAddress @change="cityChange"><i>{{cityTitle}}</i></pickerAddress> -->
<input type="text" v-model="formData.come_place" maxlength="20" placeholder="请输入来源地具体地址" />
</view> </view>
</view> </view>
<view class="item item_bottom_border"> <view class="item item_bottom_border">
@ -96,9 +114,12 @@
<script> <script>
import imgUpload from '@/components/linzq-imgUpload/linzq-imgUpload.vue'; import imgUpload from '@/components/linzq-imgUpload/linzq-imgUpload.vue';
import nonNullCheck from '../../../utils/nonNullCheck.js'; import nonNullCheck from '../../../utils/nonNullCheck.js';
import pickerAddress from '../../comm/city/city.vue';
import provinceData from '@/common/city.data.js';
export default { export default {
components: { components: {
imgUpload imgUpload,
pickerAddress
}, },
data() { data() {
return { return {
@ -116,6 +137,16 @@
is_main: false, is_main: false,
is_reported: false, is_reported: false,
}, },
selfData:provinceData,
headtitle:"请选择所在地",
addressByPcrs:"请选择所在地",
provincedata:[
{
text:'北京市',
value:''
}
],
// cityTitle: '',
head: { head: {
Authorization: "Bearer " + this.vuex_token Authorization: "Bearer " + this.vuex_token
}, },
@ -135,7 +166,7 @@
} }
}, },
onLoad(params) { onLoad(params) {
debugger; // debugger;
if (params.visitId) { if (params.visitId) {
this.formData.visit = params.visitId; this.formData.visit = params.visitId;
this.visitId = params.visitId; this.visitId = params.visitId;
@ -179,6 +210,23 @@
}) })
}, },
// cityChange(data) { //
// this.cityTitle = data.data.join('-')
// this.cityForm.province = this.cityTitle.split('-')[0] //
// this.cityForm.city = this.cityTitle.split('-')[1] //
// this.cityForm.district = this.cityTitle.split('-')[2] //
// this.cityForm.city = this.cityTitle // this.cityForm.city
// },
toggleMaskLocation(){
this.$nextTick(()=>{
this.$refs["cityPicker"].show();
})
},
getpickerParentValue(data){
console.log(data.map(o=>{return o.value})); //value
this.provincedata=data;
this.addressByPcrs=data.map(o=>{return o.text}).join(" ")
},
/* 参数验证 */ /* 参数验证 */
paramsCheck() { paramsCheck() {
if (!nonNullCheck(this.formData.visitor)) { if (!nonNullCheck(this.formData.visitor)) {
@ -195,9 +243,16 @@
}) })
return false; return false;
} }
if (this.addressByPcrs=="请选择所在地") {
uni.showToast({
title: '请选择所在地',
icon: "none"
})
return false;
}
if (!nonNullCheck(this.formData.come_place)) { if (!nonNullCheck(this.formData.come_place)) {
uni.showToast({ uni.showToast({
title: '请选择来源地', title: '请填写来源地具体地址',
icon: "none" icon: "none"
}) })
return false; return false;
@ -252,6 +307,7 @@
if (!that.paramsCheck()) { if (!that.paramsCheck()) {
return; return;
} else { } else {
that.formData.come_place = that.addressByPcrs+that.formData.come_place;
that.$u.api.vpeopleCreate(that.formData).then(res => { that.$u.api.vpeopleCreate(that.formData).then(res => {
if (res.err_msg) {} else { if (res.err_msg) {} else {
uni.navigateBack({ uni.navigateBack({
@ -271,17 +327,12 @@
} }
</script> </script>
<style scoped> <style scoped lang="scss">
>>>.uni-navbar__header, >>>.uni-navbar__header,
>>>.uni-status-bar { >>>.uni-status-bar {
background-image: linear-gradient(254deg, background-image: linear-gradient(90deg, #164cc3 0%, #2c6fd9 100%), linear-gradient(#e60012, #e60012) !important;
#0ca7ee 0%,
#005aff 100%,
#2a8cff 100%,
#54bdff 100%),
linear-gradient(#e60012,
#e60012);
} }
>>>uni-image{ >>>uni-image{
height: 200upx; height: 200upx;
width: 200upx; width: 200upx;