123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749 |
- <template>
- <view class="bg-color">
- <cu-custom bgColor="bg-blue">
- <block slot="backText">
- <!-- #ifdef H5 -->
- <image v-if="showRetBtn" @tap="backToUrl" style="width: 32rpx;height: 32rpx;margin-right: 16rpx;" src="/static/user/bask.png"></image>
- <!-- #endif -->
- <text>智慧工程</text>
- </block>
- <block slot="content">
- <view style="display: flex;align-items: center;background-color: #fff;height: 64rpx;border-radius: 60rpx;" :style="{width:showRetBtn?'438rpx':'470rpx'}" @click="search()">
- <image src="/static/index/search-gray.png" style="width: 32rpx;height: 32rpx;margin: 0 16rpx 0 22rpx;"></image>
- <view style="color:#AEAEAE;font-size: 28rpx;">请输入关键字搜索</view>
- </view>
- </block>
- <block slot="right">
- <image @click="sancode()" src="/static/index/scanningcode.png" style="width: 44rpx;height: 41rpx;margin-right: 22rpx;"></image>
- </block>
- </cu-custom>
- <!-- 项目 、合同段 -->
- <!-- <view style="padding-top: 20rpx;padding-bottom: 22rpx;background-color: #F7F7F7;">
- <cu-project :projectList="projectList" style="height: 236rpx;background-color: #C6E6FF;"></cu-project>
- </view> -->
- <view class="top-bg">
- <view @click="navToProject()" class="pj-box">
- <text class="pj-title text-white">{{projectList.project_name + ' | ' + projectList.contractName}}</text>
- <text class="text-white cuIcon-right" style="font-size: 40rpx;"></text>
- </view>
- <!-- 菜单-->
- <view class="cu-list grid bg-black" :class="['col-' + gridCol,gridBorder?'':'no-border']" style="background-color: #FFFFFF;padding: 0;margin: 20rpx;border-radius: 16rpx;box-shadow: 0 2px 4px rgba(0, 0, 0, .25)">
- <template v-for="(item,index) in menuList">
- <view class="cu-item" @click="navTo(item)" v-if="item.show">
- <view>
- <image class="menuImage" :src="item.imageurl"></image>
- </view>
- <text style="font-size: 26rpx;color: #101010;">{{item.name}}</text>
- </view>
- </template>
- </view>
- </view>
- <view class="page margin-bottom-xxxl bg-white">
- <!-- 待办任务 -->
- <view style="background-color: #F7F7F7;">
- <view class="cu-bar bg-white " style="border-radius: 20rpx 20rpx 0 0;background-color: #fff;box-shadow: 0px -2px 3px #EEEEEE;border-bottom: 1upx solid #EAEAEA;">
- <view class="action">
- <text v-if="taskList.length!=0" class="text-xl">待办任务(<text class="text-blue">{{taskList.length}}个</text>)</text>
- <text v-else class="text-xl">待办任务(<text class="text-blue">0</text>)</text>
- </view>
- </view>
- </view>
- <view v-if="taskList.length==0" class="bg-white text-center">
- <view>
- <image class="menuImageNoTask" src="../../static/task/noTask.png"></image>
- </view>
- <view style="padding:28rpx 0 132rpx;font-size: 26rpx;color: #8A8A8A;">暂时没有待办任务~</view>
- </view>
- <view v-else class="cu-list menu-avatar">
- <view class="cu-item_1" v-for="item in taskList" :key="item.id" @click="navToTaskDetails(item)">
- <view class="cu-item_left">
- <image v-if="item.task_category=='2'" src="../../static/task/report.png"></image>
- <image v-else-if="item.task_category=='3' || item.task_category=='1'" src="../../static/task/audit.png"></image>
- <image v-else src="../../static/task/diy.png"></image>
- </view>
- <view class="cu-item_right">
- <view class="cu-item_name">{{item.name}}</view>
- <view class="cu-item_start">
- <view class="cu-item_text"> 发起人:{{item.userName}}</view>
- <view class="cu-item_text">{{ item.start_date | timeStamp }}</view>
- </view>
- </view>
- </view>
- </view>
- <view v-if="taskList.length!=0" class="flex justify-center text-gray" style="padding: 60rpx 0 100rpx;color:#AEAEAE ;font-size: 28rpx;">没有更多内容了~</view>
- </view>
- <!-- 引入底部导航栏 -->
- <tabBar v-if="show" :pagePath="'/pages/index/index'"></tabBar>
- </view>
- </template>
- <script>
- import coreConfig from '../../core/index.js'
- export default {
- computed: {
- style() {
- var StatusBar = this.StatusBar;
- var CustomBar = this.CustomBar;
- var bgImage = this.bgImage;
- var style = `height:${CustomBar}px;padding-top:${StatusBar}px;`;
- if (this.bgImage) {
- style = `${style}background-image:url(${bgImage});`;
- }
- return style
- },
- showRetBtn(){
- if(this.returnInfo.token && this.returnInfo.url){
- return true;
- }else{
- return false;
- }
- }
- },
- data() {
- return {
- loadModal: false,
- TabCur: 0,
- show:false,//用于待办任务的数据统计才显示组件
- modalName: "",
- modalShow: false,
- modelList: [{
- name: '选择分类'
- }, {
- name: '选择桩号'
- }],
- menuList: [{
- url: "",
- imageurl: "/static/index/fill-Information.png",
- name: '资料填报',
- type: 1,
- show:true,
- },
- {
- url: "/pages/informationProgress/informationProgress",
- imageurl: "/static/index/dataAccuracy.png",
- name: '资料进度',
- type: "",
- show:true,
- },
- {
- url: "/pages/conSchedule/conSchedule",
- imageurl: "/static/index/shigong.png",
- name: '施工进度',
- type: "",
- show:true,
- },
- {
- url: "/pages/constructionLog2/constructionLog",
- imageurl: "/static/index/sglog.png",
- name: '施工日志',
- type: "",
- show:false,
- },
- {
- url: "/pages/conLedger/conLedger",
- imageurl: "/static/index/constructionLedger.png",
- name: '施工台账',
- type: "",
- show:true,
- },
- {
- url: "/pages/task/task",
- imageurl: "/static/index/myTask.png",
- name: '我的任务',
- type: "",
- show:true,
- },
- {
- url: "/pages/smartSearch/smartSearch",
- imageurl: "/static/index/smartQuery.png",
- name: '智能查阅',
- type: "",
- show:true,
- },{
- url: "/pages/supervisorLog/supervisorLog",
- imageurl: "/static/index/supervisorLog.png",
- name: '监理日志',
- type: "",
- show:false,
- },{
- url: "/pages/sentinelLog/sentinelLog",
- imageurl: "/static/index/sentinelLog.png",
- name: '旁站记录',
- type: "",
- show:false,
- },{
- url: "/pages/patrolLog/patrolLog",
- imageurl: "/static/index/patrolLog.png",
- name: '巡视记录',
- type: "",
- show:false,
- },{
- url: "/pages/securityLog/securityLog",
- imageurl: "/static/index/securityLog.png",
- name: '安全日志',
- type: "",
- show:false,
- },{
- url: "/pages/superpatrolLog/superpatrolLog",
- imageurl: "/static/index/superpatrolLog.png",
- name: '安全巡视',
- type: "",
- show:false,
- },{
- url: "/pages/supersecurityLog/supersecurityLog",
- imageurl: "/static/index/supersecurityLog.png",
- name: '安全监理日志',
- type: "",
- show:false,
- },{
- url: "/pages/multimedia/multimedia",
- imageurl: "/static/index/multimedia.png",
- name: '影像资料',
- type: "",
- show:false,
- },{
- url: "",
- imageurl: "/static/index/concealment.png",
- name: '隐蔽工程',
- type: 1,
- show:false,
- },{
- url: "/pages/qualityInspection/qualityInspection",
- imageurl: "/static/index/qualityInspection.png",
- name: '质量巡检',
- type: "",
- show:false,
- },
- /* ,
- {
- url: "",
- imageurl: "/static/index/graphic.png",
- name: '图文识别',
- type: ""
- }, */
- ],
- taskList: [],
- gridCol: 4,
- gridBorder: false,
- menuBorder: false,
- menuArrow: false,
- menuCard: false,
- projectId: 0,
- contractId: 0,
- userInfo: "",
- projectList: "",
- divideClientList: "",
- stakeList: [], //桩号
- divisionName: "请选择",
- stake: "请选择",
- chooseDate: null,
- returnInfo:{
- url:'',
- token:''
- }
- }
- },
- async onLoad(options) {
- //console.log('onload')
- //#ifdef H5
- //H5通过页面传过来的token,来判断是否登录了
- let token = options.token;
- let account = options.account;
- let projectCode = options.projectCode;
- let retUrl = decodeURIComponent(options.retUrl);
- console.log(token)
- console.log(retUrl)
- if(token){
- let result = await this.http.request('/app/getUser', {
- token:token,
- account:account,
- projectCode:projectCode,
- })
- if(result && result.result == "1"){
- //设置登录的人员信息缓存
- uni.setStorageSync("userInfo", result.data);
- //设置登录成功后后台创建的token,用于每次请求
- uni.setStorageSync("token", result.msg);
- //清除权限缓存
- uni.removeStorageSync('authorityList');
- if(token && token !='undefined' && retUrl && retUrl !='undefined'){
- uni.setStorageSync("retUrl",retUrl)
- uni.setStorageSync("retToken",token)
- }
- await this.onLoadData();
- //this.findDivideClient();
- //获取权限
- this.getAuthority();
- }
- }
- //#endif
- //var porject = uni.getStorageSync("porject"+"_"+uni.getStorageSync("userInfo").id);
- var userInfo = uni.getStorageSync('userInfo');
- //#ifdef H5
- //缓存返回按钮需要的信息
- this.returnInfo.url = uni.getStorageSync("retUrl");
- this.returnInfo.token = uni.getStorageSync("retToken");
- //console.log(this.returnInfo)
- //#endif
- //console.log(sessionStorage.getItem("retUrl"))
- if(userInfo==""){
- uni.reLaunch({
- url:"/pages/user/login/login"
- })
- }
- //#ifdef H5
- let tourl = options.tourl;
- if(tourl){
- console.log(tourl)
- uni.navigateTo({
- url: tourl
- })
- }
- //#endif
- // #ifdef APP-PLUS
- if(uni.getSystemInfoSync().brand!='Xiaomi'){//屏蔽小米手机 小米本身会处理,如果调用会在系统消息中心显示一条通知, “您有x条未读消息"”,其中x未设置的角标数字值。
- //有些需要手动清除角标
- plus.runtime.setBadgeNumber(0);
- }
- if(!getApp().globalData.isbingCID && userInfo){
- console.log("异步获取客户端推送标识信息");
- let that = this;
- plus.push.getClientInfoAsync(function(info){
- //console.log(userInfo.id);
- //console.log(info.clientid)
- that.http.request("/app/bindCid",{
- userId:userInfo.id,
- cId:info.clientid
- }).then((res)=>{
- //console.log(res)
- if(res.result == '1'){
- console.log('bingCIDSuccess');
- }else{
- console.log(res.msg)
- }
- })
- getApp().globalData.isbingCID = true;
- console.log('Success');
- console.log(JSON.stringify(info));
- }, function(e){
- console.log('Failed');
- console.log(JSON.stringify(e));
- })
- }
- // #endif
- },
- async onShow() {
- //console.log('onShow')
- await this.onLoadData();
- //this.findDivideClient();
- //获取权限
- this.getAuthority();
- },
- methods: {
- sancode(){
- var that =this;
- uni.scanCode({
- success:function(res){
- var value = JSON.stringify(res.result);
- value =value.split(",");
- if(value.length==1){
- that.$prompt.none("二维码无效")
- return;
- }
- if(value[2]==3){//这个为app生成的二维码,需要检验时间
- var time =value[3].replace('"',"");
- var endTime = Date.parse(time.replace("-", "/").replace("-", "/"));
- var newDate = Date.parse(new Date());
- if(newDate <= endTime){
- //二维码有效,直接跳转文件列表
- uni.navigateTo({
- url:"/pages/documentList/documentList?title="+value[0].replace('"',"")+"&id="+value[1].replace('"',"")
- })
- } else {
- that.$prompt.none("二维码已无效") //二维码无效
- }
- }else{ //pc端生成的二维码
- setTimeout(function(){
- uni.navigateTo({
- url:"/pages/smartSearch/smartSearch?value="+JSON.stringify(res.result)
- })
- },1000)
- }
- }
- });
- },
- tabSelect(e) {
- this.TabCur = e.currentTarget.dataset.id;
- this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60
- },
- /* 刷新方法 */
- async onLoadData() {
- var userInfo = uni.getStorageSync("userInfo")
- if (userInfo) {
- this.userInfo = userInfo;
- }
- var project = uni.getStorageSync("porject"+"_"+uni.getStorageSync("userInfo").id);
- if (project) {
- this.projectList = project; //获取选中的当前项目
- this.findTask(userInfo.id, this.projectList.contractId,this.projectList.id);
- } else {
- await this.findProject();
- }
- //console.log(this.projectList)
- },
- /* 查询项目 */
- async findProject(){
- var that =this;
- let result = await that.http.request('/app/findProject', {userId:this.userInfo.id})
- if(result&& result.datas.length!=0){
- that.projectList=result.datas[0];
- //默认选中第一条
- uni.setStorageSync("storeName",that.projectList.store_name);
- uni.setStorageSync("porject"+"_"+uni.getStorageSync("userInfo").id,that.projectList);
- that.findTask(that.userInfo.id,that.projectList.contractId,that.projectList.id);
- }else{
- that.show= true;
- }
- },
- /* 查询待办任务 */
- findTask(userId,contractId,projectid){
- var that =this;
- var userInfo = uni.getStorageSync("userInfo");
- that.http.request('/app/task/findTaskComing', {userId:userId,contractId:contractId,projectid:projectid}).then((result)=>{
- if(result.datas){
- that.taskList=result.datas;
- }else{
- that.taskList=[];
- }
- that.tabberData.taskNum = that.taskList.length;
- if(!that.taskList){
- that.taskList=[]
- }
- //获取信息的未读个数
- that.http.request("/app/task/findInformation",{userId:userId,contractId:contractId,projectId:projectid}).then((res)=>{
- var i=0;
- if(!res.datas){
- res.datas = [];
- }
- res.datas.forEach((item)=>{
- if(item.reading==0){
- i=i+1;
- }
- })
- that.tabberData.newsNum=i;
- that.show= true;
- })
- })
- },
- navTo(value) {
- if(value.name === '质量巡检' && coreConfig.type === 'fj') {
- uni.navigateTo({
- url: "/pages/qualityInspection_fj/qualityInspection"
- })
- } else if (1 != value.type) {
- if (value.url) {
- uni.navigateTo({
- url: value.url
- })
- } else {
- this.$prompt.none("开发中")
- }
- } else { //显示弹窗
- if(value.name === '隐蔽工程'){
- uni.navigateTo({
- url: "./data/data?type=6"
- })
- return;
- }
- uni.navigateTo({
- url: "./data/data"
- })
- }
- },
- certain() {
- if (this.stake == '请选择' || this.divisionName == '请选择') {
- this.modalShow = true
- return;
- }
- uni.navigateTo({
- url: "/pages/personBase/personBase?id=" + this.chooseDate.id + "&name=" + this.chooseDate.name
- })
- },
- navToTaskDetails(item) {
- var type;
- if (item.task_category == 2) {
- type = 2
- } else if (item.task_category == 3) {
- type = 3
- } else if (item.task_category == 1) {
- type = 1
- }else{
- type=4
- }
- uni.navigateTo({
- url: "/pages/task/details/details?type=" + type + "&value=0"+"&taskId="+item.id+ "&contractid=" +item.contract_info_id
- })
- },
- search() {
- uni.setStorageSync("pageType", 0);
- uni.navigateTo({
- url: "/pages/search/search"
- })
- },
- /* 获取单位工程、分部工程*/
- findDivideClient() {
- var that = this;
- that.http.request('/app/divideClient/findDivideClientByType', {contractId:this.projectList.contractId}).then((result)=>{
- if(result.result!="-1"){
- that.divideClientList = result.datas
- }
- });
- },
- /* 选择分部工程*/
- chooseDivision(data) {
- this.stakeList = [];
- this.divisionName = data.divisionName;
- if (data.stake) { //拆分桩号
- this.stakeList.push(data);
- } else {
- data.stake = "不限"
- this.stakeList.push(data);
- }
- this.TabCur = 1; //跳转分类
- this.stake = '请选择'
- },
- /* 选择桩号*/
- chooseStake(data) {
- this.stake = data.stake;
- this.chooseDate = data;
- },
- async getAuthority(){
- var authorityList = uni.getStorageSync("authorityList");
- //console.log(authorityList)
- if(authorityList && authorityList.length > 0){
- //有缓存不再请求
- }else{
- let result = await this.http.request('/app/menu/getMenuByContractId', {userId:this.userInfo.id,contractId:this.projectList.contractId})
- if(result.result!="-1"){
- uni.setStorageSync("authorityList",result.datas);
- authorityList = result.datas;
- }
- }
- if(!authorityList){
- return;
- }
- for (let i = 0; i < authorityList.length; i++) {
- if(!this.menuList[3].show && authorityList[i].url == '/template/newlog/diary.html'){
- //施工日志填报权限
- this.menuList[3].show = true;
- }
- if(!this.menuList[7].show && authorityList[i].url == '/template/newlog/super.html'){
- //监理日志填报权限
- this.menuList[7].show = true;
- }
- if(!this.menuList[8].show && authorityList[i].url == '/template/newlog/sentinel.html'){
- //监理旁站填报权限
- this.menuList[8].show = true;
- }
- if(!this.menuList[9].show && authorityList[i].url == '/template/newlog/patrol.html'){
- //监理巡视填报权限
- this.menuList[9].show = true;
- }
- if(!this.menuList[10].show && authorityList[i].url == '/template/newlog/security.html'){
- //安全日志填报权限
- this.menuList[10].show = true;
- }
- if(!this.menuList[11].show && authorityList[i].url == '/template/newlog/superpatrol.html'){
- //安全巡视填报权限
- this.menuList[11].show = true;
- }
- if(!this.menuList[12].show && authorityList[i].url == '/template/newlog/supersecurity.html'){
- //安全监理日志填报权限
- this.menuList[12].show = true;
- }
- if(!this.menuList[13].show && authorityList[i].url == '/template/select/multimedia.html'){
- //安全监理日志填报权限
- this.menuList[13].show = true;
- }
- if(!this.menuList[14].show && authorityList[i].url == '/template/excelWrite/concealment.html'){
- //隐蔽工程填报权限
- this.menuList[14].show = true;
- }
- if(!this.menuList[15].show && authorityList[i].url == '/template/qualityInspection/supervisionPatrol.html'){
- //隐蔽工程填报权限
- this.menuList[15].show = true;
- }
- //
- }
- this.$nextTick(()=>{
- this.$set(this, 'menuList', this.menuList);
- })
- },
- navToProject(){
- uni.navigateTo({
- url:"/pages/user/project/project?type=1"
- })
- },
- backToUrl(){
- //#ifdef H5
- location.href=this.returnInfo.url+'?token='+this.returnInfo.token;
- //#endif
- }
- },
- filters: {
- timeStamp: function(value) {
- if (!value) return '';
- var now = new Date(value);
- var year = now.getFullYear();
- var month = now.getMonth() + 1;
- if (month < 10) {
- month = '0' + month
- }
- var date = now.getDate();
- if (date < 10) {
- date = '0' + date
- }
- return year + "-" + month + "-" + date
- },
- },
- onHide() {
- this.show=false
- }
- }
- </script>
- <style lang="scss">
- page {
- background-color: #fff;
- }
- .cu-list.grid {
- background-color:transparent;
- text-align: center;
- }
- .solid-type {
- border-bottom: 2upx solid black;
- }
- .solid-type-top {
- border-top: 2upx solid rgba(0, 0, 0, 0.1);
- }
- .dashed-type {
- border-bottom: 2upx dashed black;
- }
- .box {
- margin-top: -20rpx;
- }
- .box view.cu-bar {
- margin-top: 20upx;
- }
- .page {
- width: 100vw;
- }
- .page.show {
- overflow: hidden;
- }
- .menuImage {
- height: 110rpx;
- width: 110rpx;
- }
- .shadowType {
- -moz-box-shadow: 0px 1px 4px #D0D0D0;
- -webkit-box-shadow: 0px 1px 4px #D0D0D0;
- box-shadow: 0px 1px 4px #D0D0D0;
- }
- .cu-list.grid>.cu-item uni-text {
- display: block;
- margin-top: 4px;
- color: black;
- font-size: 14px;
- line-height: 17px;
- }
- .cu-dialog {
- position: relative;
- display: inline-block;
- vertical-align: middle;
- margin-left: auto;
- margin-right: auto;
- width: 100%;
- max-width: 100%;
- /* height: 100%; */
- background-color: #f8f8f8;
- border-radius: 4px;
- overflow: hidden;
- }
- .bg-diy-yellow {
- background-color: #FDF1DF;
- }
- .bg-diy-blue {
- background-color: #D7ECF8;
- }
- .menuImageNoTask{width:162rpx;height: 105rpx;margin-top: 60rpx;}
- .cu-item_1{display: flex;align-items: center;padding: 22rpx 24rpx;border-bottom: 2rpx solid #E3e1e1;}
- .cu-item_left{margin-right: 10rpx;}
- .cu-item_left image{width: 100rpx;height: 100rpx;}
- .cu-item_right{width: 592rpx;}
- .cu-item_name{font-size: 30rpx;color: #101010;overflow: hidden;text-overflow: ellipsis; -o-text-overflow: ellipsis;white-space:nowrap;}
- .cu-item_start{display: flex;align-items: center;justify-content: space-between;padding-top: 8rpx;}
- .cu-item_text{color: #8A8A8A;font-size: 26rpx;}
- .bg-color{
- background-color: #F7F7F7;
- }
- .top-bg{
- background-image: url(../../static/index/topbg.png);
- background-size:750rpx 250rpx;
- background-repeat: no-repeat;
- }
- .pj-box{
- display: flex;
- padding: 20rpx;
- align-items: center;
- justify-content: space-between;
- }
- .pj-title{
- font-size: 32rpx;
- font-weight: bold;
- }
- </style>
|