factory_mp_old/pages/workSpace/workSpace.vue

778 lines
19 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="workbench">
<view style="position: relative;overflow: hidden;">
<view
style="position: absolute;top:0;left:0;bottom:0;right:0;height: 290rpx;background-image: url(../../static/workSpace/bgimg.png);background-position: center bottom;background-size: 100%;">
</view>
<view class="top-title" style="display: flex;">
<block v-for="(item,index) in routerList" :key="item.index">
<!-- <view class="title-item" v-if="item.children">
<view class="title-icon" >
<image :src="require('@/static/worSpace/'+item.icon+'')" mode="widthFix"></image>
</view>
<text class="title-text" >{{item.name}}</text>
<picker mode="selector" :range="item.childItems" @change="intoAddPage($event,item.childUrls)" range-key="name">
<view class="workbench-picker">
{{name}}
</view>
</picker>
</view> -->
<view class="title-item" @click="goInto(index)">
<view class="title-icon">
<image :src="require('@/static/workSpace/'+item.icon+'')" mode="widthFix"></image>
</view>
<text class="title-text">{{item.name}}</text>
</view>
</block>
</view>
</view>
<view style="height: 22rpx;">
</view>
<view class="my-apply">
<view class="title">
<view class="">
<image src="../../static/home/daiban.png" mode="widthFix" class="img"></image>
<text class="title-text-left">作业管理</text>
</view>
<view class="" @click="goIntoMoreApply('operation')">
<text class="title-text-right">查看更多</text>
<uni-icons type="right" :size="15" color="#ababab"></uni-icons>
</view>
</view>
<view class="line"></view>
<view class="apply-item" v-for="(val,index) in myApplyArray" :key="val.pkId" @click="intoUpdataPage(val)">
<view style="display: flex;">
<view class="apply-title">
{{val.itemName}}
</view>
<view class="apply-status" :style="{color: val.statusColor}">
{{val.eventStatusValue}}
</view>
<!-- <image src="../../static/logo.png" mode="" class="image"></image> -->
</view>
<view class="apply-content">
所属模块:{{val.menuName}}
</view>
<view style="display: flex;">
<view class="apply-content">
申请人:{{val.applicantName}}
</view>
<view class="apply-time">
{{val.submissionTime}}
</view>
</view>
</view>
</view>
<view class="my-apply">
<view class="title">
<view class="">
<image src="../../static/home/daiban.png" mode="widthFix" class="img"></image>
<text class="title-text-left">入场项目</text>
</view>
<view class="" @click="goIntoMoreApply('rpj')">
<text class="title-text-right">查看更多</text>
<uni-icons type="right" :size="15" color="#ababab"></uni-icons>
</view>
</view>
<view class="line"></view>
<view class="apply-item" v-for="(val,index) in myApplyArray" :key="val.pkId" @click="intoUpdataPage(val)">
<view style="display: flex;">
<view class="apply-title">
{{val.itemName}}
</view>
<view class="apply-status" :style="{color: val.statusColor}">
{{val.eventStatusValue}}
</view>
<!-- <image src="../../static/logo.png" mode="" class="image"></image> -->
</view>
<view class="apply-content">
所属模块:{{val.menuName}}
</view>
<view style="display: flex;">
<view class="apply-content">
申请人:{{val.applicantName}}
</view>
<view class="apply-time">
{{val.submissionTime}}
</view>
</view>
</view>
</view>
<view class="my-apply">
<view class="title">
<view class="">
<image src="../../static/home/daiban.png" mode="widthFix" class="img"></image>
<text class="title-text-left">来访项目</text>
</view>
<view class="" @click="goIntoMoreApply('visit')">
<text class="title-text-right">查看更多</text>
<uni-icons type="right" :size="15" color="#ababab"></uni-icons>
</view>
</view>
<view class="line"></view>
<view class="apply-item" v-for="(val,index) in myApplyArray" :key="val.pkId" @click="intoUpdataPage(val)">
<view style="display: flex;">
<view class="apply-title">
{{val.itemName}}
</view>
<view class="apply-status" :style="{color: val.statusColor}">
{{val.eventStatusValue}}
</view>
<!-- <image src="../../static/logo.png" mode="" class="image"></image> -->
</view>
<view class="apply-content">
所属模块:{{val.menuName}}
</view>
<view style="display: flex;">
<view class="apply-content">
申请人:{{val.applicantName}}
</view>
<view class="apply-time">
{{val.submissionTime}}
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
name: "",
username: "",
routerList: [{
name: '作业管理',
icon: 'specialmatter.png',
path: 'index',
childItems: [{
name: "请假申请"
},
{
name: "公出申请"
},
{
name: "出差申请"
},
{
name: "值班申请"
},
{
name: "未打卡说明"
}
],
childUrls: [
"/pages/workSpace/new_apply/del",
"/pages/workSpace/new_apply/del",
"/pages/workSpace/new_apply/del",
"/pages/workSpace/new_apply/del",
"/pages/workSpace/new_apply/del",
]
},
{
name: '入厂项目',
icon: 'hetong.png',
path: 'index'
},
{
name: '来访项目',
icon: 'renli.png',
path: 'index'
},
],
myApplyArray: [],
mytopimg: require("@/static/workSpace/bgimg-top.jpg"),
}
},
onShow() {
// this._getMyApply();
// this.getUserInfo();
},
methods: {
goInto(index) {
if (index == 0) {
uni.navigateTo({
url: '/pages/workSpace/newWork/work'
})
} else if (index == 1) {
uni.navigateTo({
url: '/pages/workSpace/newWork/relevant'
})
} else if (index == 2) {
uni.navigateTo({
url: '/pages/workSpace/newWork/visit'
})
}
},
getUserInfo() {
var promise;
var that = this;
promise = new Promise(function(resolve, reject) {
authUser().then(res => {
if (res.statusCode === 200) {
const principal = res.data.principal;
that.username = principal.username;
resolve()
} else {
uni.showToast({
title: '获取用户信息失败',
icon: 'none'
})
}
}).catch(err => {
uni.showToast({
title: 'user请求失败',
icon: 'none'
})
})
})
promise.then(function() {
//查看当前用户路由
getCurrentUserRoute(that.username).then(res => {
if (res.statusCode === 200) {
const routes = res.data.data.routes;
that.initList(routes);
} else {
uni.showToast({
title: '获取当前用户路由失败',
icon: 'none'
})
}
}).catch(err => {
uni.showToast({
title: '获取路由失败',
icon: 'none'
})
})
})
},
initList(routes) {
const obj = routes.find(item => {
return item.path === '/apply'
})
//合同管理
const project = routes.find(item => {
return item.path === '/project_management'
})
//通知公告
const inform = routes.find(item => {
return item.path === '/press'
})
let projectObj;
let informObj;
if (project) { //创建合同
projectObj = project.children.find(item => {
return item.path == "hetongxinxi_shoukuan";
})
}
if (inform) { //通知公告
informObj = inform.children.find(item => {
return item.path == "index";
})
}
if (obj) {
const newObj = JSON.parse(JSON.stringify(obj));
let arr = newObj.children;
const index = arr.findIndex(item => {
return item.path == "index";
});
if (index !== -1) {
arr.splice(index, 1); //去除‘新建申请 index
}
if (informObj) {
const newInformObj = JSON.parse(JSON.stringify(informObj));
arr.splice(arr.length, 0, newInformObj); //‘通知公告’放到倒数第一个
}
let htBackItem;
for (let val of arr) {
if (val.path == "yewufeiyong") {
htBackItem = val;
break;
} else if (val.path == "jiesuanguanli") {
htBackItem = val;
break;
} else if (val.path == "index_detail_xinwen") {
htBackItem = val;
break;
} else if (val.path == "special_matter") {
htBackItem = val;
break;
} else if (val.path == "issue_report") {
htBackItem = val;
break;
} else if (val.path == "index") {
htBackItem = val;
break;
}
}
if (projectObj) {
const newProjectObj = JSON.parse(JSON.stringify(projectObj));
newProjectObj.name = "创建合同";
if (htBackItem) {
const backIndex = arr.findIndex(item => {
return item == htBackItem;
})
if (backIndex !== -1) {
arr.splice(backIndex, 0, newProjectObj); //‘合同’插入业务费用之前
} else {
arr.push(newProjectObj) //容错处理
}
} else {
arr.push(newProjectObj)
}
}
this.routerList = arr.map(item => {
item.childItems = [];
item.childUrls = [];
item.icon = "kaoqin.png";
if (item.path == "kqgl") {
item.icon = "kaoqin.png";
item.childItems = [{
name: "请假申请"
},
{
name: "公出申请"
},
{
name: "出差申请"
},
{
name: "值班申请"
},
{
name: "未打卡说明"
}
];
item.childUrls = [
"/pages/workSpace/new_apply/kaoqin_management/qingjia_apply",
"/pages/workSpace/new_apply/kaoqin_management/gongchu_apply",
"/pages/workSpace/new_apply/kaoqin_management/chuchai_apply",
"/pages/workSpace/new_apply/kaoqin_management/zhiban_apply",
"/pages/workSpace/new_apply/kaoqin_management/weidaka_apply",
]
} else if (item.path == "cl") {
item.icon = "cheliang.png";
item.childItems = [{
name: "车辆维修、保养"
},
{
name: "私车公用申请"
},
{
name: "车辆使用登记"
},
];
item.childUrls = [
"/pages/workSpace/new_apply/car_management/repair_car_apply",
"/pages/workSpace/new_apply/car_management/private_car_public",
"/pages/workSpace/new_apply/car_management/paicheshenqing",
]
} else if (item.path == "cg") {
item.icon = "caigou.png";
item.childItems = [{
name: "印刷品清单"
},
{
name: "办公用品采购申请表"
},
{
name: "固定资产采购申请表"
},
{
name: "低值易耗品购置申请表"
}
];
item.childUrls = [
"/pages/workSpace/new_apply/caigou_management/print_list_apply",
"/pages/workSpace/new_apply/caigou_management/office_supplies_apply",
"/pages/workSpace/new_apply/caigou_management/fixed_assets_apply",
"/pages/workSpace/new_apply/caigou_management/low_value_products_apply"
];
} else if (item.path == "gdzc") {
item.icon = "fixedassets.png";
item.childItems = [{
name: "验收记录"
},
{
name: "内部调拨记录表"
},
{
name: "报废申请表"
},
{
name: "维修申请表"
}
];
item.childUrls = [
"/pages/workSpace/new_apply/fixed_assets_management/yanshoujilu",
"/pages/workSpace/new_apply/fixed_assets_management/neibu_diaobo_apply",
"/pages/workSpace/new_apply/fixed_assets_management/baofeishenqing",
"/pages/workSpace/new_apply/fixed_assets_management/weixiushenqing"
];
} else if (item.path == "jiesuanguanli") {
item.icon = "jiesuan.png";
} else if (item.path == "xinziguanli") {
item.icon = "xinzi.png";
} else if (item.path == "yewufeiyong") {
item.icon = "yewu.png";
} else if (item.path == "hetongxinxi_shoukuan") {
item.icon = "hetong.png";
} else if (item.path == "yzgl") {
item.icon = "yinzhang.png";
item.childItems = [{
name: "刻章申请表"
},
{
name: "重要文件/印鉴借用"
},
{
name: '销毁印鉴申请表'
},
{
name: "印章申请表"
}
];
item.childUrls = [
"/pages/workSpace/new_apply/yinzhang__management/kedushenqingbiao",
"/pages/workSpace/new_apply/yinzhang__management/zhongyaowenjian",
"/pages/workSpace/new_apply/yinzhang__management/xiaohuiyinjian",
"/pages/workSpace/new_apply/yinzhang__management/yinzhangshenqingbiao"
];
} else if (item.path == "zdwj") {
item.name = "制度文件";
item.icon = "zhidu.png";
item.childItems = [{
name: "红头文件审批"
},
{
name: "红头文件审批(涉及财务)"
},
];
item.childUrls = [
"/pages/workSpace/new_apply/zhiduwenjian_management/hongtouwenjian",
"/pages/workSpace/new_apply/zhiduwenjian_management/hongtouwenjian_cw"
];
} else if (item.path == "issue_report") {
item.icon = "fafang.png"
} else if (item.path == "special_matter") {
item.icon = "specialmatter.png"
} else if (item.path == "index") {
item.name = "通知公告";
item.icon = "tongzhigonggao.png"
}
return item;
})
}
},
/* 跳转详情页 */
intoUpdataPage(val) {
this.$store.commit("clearAllStoreData"); /* 清空选择人员时留存的数据 */
const routeObj = routeArray.find(item => {
return item.pcRoute == val.menuID;
})
const params =
`?pkId=${val.pkId}&itemId=${val.itemId}&execId=${val.execId}&eventStatus=${val.eventStatus}&detail=${true}`;
uni.navigateTo({
url: routeObj.appAdd + params,
})
},
/* 获取列表数据 */
_getMyApply() {
getMyApply().then(res => {
if (res.statusCode === 200) {
let list = res.data.data.rows;
if (list && list.length > 0) {
list = list.slice(0, 3);
}
list = list.map(item => {
if (!item.submissionTime) {
item.submissionTime = "";
}
if (item.eventStatus == 3) { //审核中
item.statusColor = '#2c6fd9';
}
if (item.eventStatus == 1) { //审核通过
item.statusColor = '#15a306';
}
if (item.eventStatus == 0) { //退回
item.statusColor = '#e2053e';
}
return item;
});
this.myApplyArray = list;
} else {
this.myApplyArray = [];
uni.showToast({
title: res.data.message,
icon: 'none'
})
}
}).catch(err => {
this.myApplyArray = [];
uni.showToast({
title: '网络异常, 请求失败',
icon: 'none'
})
})
},
/* -----------------顶部模块页面跳转-----------------------------------------------*/
/* 没有子页面的模块 */
goSingleIntoPage(path) {
let url = "";
switch (path) {
case 'index':
url = '/pages/workbench/new_apply/xinwen_management/xinwen';
break;
}
uni.navigateTo({
url
})
},
/* 存在子页面的模块 。顺序与上边文字顺序一一对应*/
intoAddPage(e, urls) {
const i = parseInt(e.target.value);
let url = urls[i];
uni.navigateTo({
url
})
},
goIntoMoreApply(index) {
if (index === 'operation')
uni.navigateTo({
url: '/pages/workSpace/list/opreation'
})
else if (index === 'rpj')
uni.navigateTo({
url: '/pages/workSpace/list/rpj'
})
else if (index === 'visit')
uni.navigateTo({
url: '/pages/workSpace/list/visit'
})
}
}
}
</script>
<style scoped>
.my-nav-bar {}
.workbench-picker {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
background-color: transparent;
color: transparent;
}
.workbench {
position: relative;
background-color: #edf8ff;
padding-bottom: 17rpx;
}
.nav-bar {
height: 401rpx;
background-color: #2cade8;
background-size: cover;
color: #FFFFFF;
padding-top: 26rpx;
padding-left: 18rpx;
}
.nav-bar-text {
font-size: 38rpx;
color: #ffffff;
font-weight: 400;
}
.top-title {
width: 720rpx;
height: auto;
background-color: #FFFFFF;
border-radius: 10rpx;
margin-top: 190rpx;
margin-left: 50%;
transform: translateX(-50%);
display: flex;
justify-content: space-around;
flex-wrap: wrap;
padding-bottom: 20rpx;
}
.title-item {
width: 20%;
text-align: center;
padding-top: 20rpx;
box-sizing: border-box;
position: relative;
}
.title-icon image {
width: 77rpx;
border-radius: 50%;
}
.title-text {
font-size: 26rpx;
color: #383838;
}
.empty-view {
height: 390rpx;
}
.my-apply {
width: 720rpx;
margin: 0 auto;
border-radius: 10rpx;
}
.line {
width: 660rpx;
height: 1rpx;
background-color: #eeeeee;
margin: 0 auto;
}
.my-apply .title {
display: flex;
justify-content: space-between;
padding: 21rpx 21rpx;
background-color: #FFFFFF;
}
.my-apply .title .img {
width: 30rpx;
height: 30rpx;
margin-right: 10rpx;
}
.my-apply .title-text-left {
font-family: PingFang-SC-Medium;
font-size: 34rpx;
line-height: 72rpx;
letter-spacing: 0rpx;
color: #383838;
}
.my-apply .title-text-right {
font-family: PingFang-SC-Medium;
font-size: 24rpx;
line-height: 72rpx;
letter-spacing: 0rpx;
color: #ababab;
margin-right: 10rpx;
}
.apply-item {
line-height: 50rpx;
padding: 0 21rpx;
margin-bottom: 17rpx;
background-color: #FFFFFF;
}
.apply-item .image {
width: 55rpx;
height: 55rpx;
border-radius: 50%;
vertical-align: middle;
}
.apply-item .apply-title {
font-family: PingFang-SC-Medium;
font-size: 30rpx;
line-height: 72rpx;
letter-spacing: -2rpx;
color: #3d3d3d;
margin-left: 15rpx;
margin-right: 20rpx;
display: -webkit-box;
overflow: hidden;
text-overflow: ellipsis;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
flex: 1;
}
.apply-item .apply-status {
font-family: PingFang-SC-Medium;
font-size: 26rpx;
line-height: 72rpx;
letter-spacing: -2rpx;
color: #2c6fd9;
}
.apply-item .apply-time {
font-family: PingFang-SC-Regular;
font-size: 24rpx;
letter-spacing: 0rpx;
color: #ababab;
}
.apply-item .apply-content {
flex: 1;
font-size: 28rpx;
letter-spacing: -2rpx;
margin-left: 15rpx;
color: #5b5b5b;
display: -webkit-box;
overflow: hidden;
text-overflow: ellipsis;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
}
</style>