feat: 首页申请模块通过接口获取
This commit is contained in:
parent
80cfa6dbaf
commit
ff7d51a463
|
|
@ -95,7 +95,7 @@
|
||||||
"vueVersion" : "3",
|
"vueVersion" : "3",
|
||||||
"h5" : {
|
"h5" : {
|
||||||
"router" : {
|
"router" : {
|
||||||
"base" : "/h5/",
|
"base" : "/h5x/",
|
||||||
"mode" : "hash"
|
"mode" : "hash"
|
||||||
},
|
},
|
||||||
"devServer" : {
|
"devServer" : {
|
||||||
|
|
|
||||||
10
pages.json
10
pages.json
|
|
@ -27,21 +27,21 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path" : "pages/ofm/booking_form",
|
"path" : "pages/ofm/mroombooking_form",
|
||||||
"style" :
|
"style" :
|
||||||
{
|
{
|
||||||
"navigationBarTitleText" : "会议室预约"
|
"navigationBarTitleText" : "会议室预约"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path" : "pages/ofm/sealForm",
|
"path" : "pages/ofm/seal_form",
|
||||||
"style" :
|
"style" :
|
||||||
{
|
{
|
||||||
"navigationBarTitleText" : "印章申请"
|
"navigationBarTitleText" : "印章申请"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path" : "pages/ofm/vehicleForm",
|
"path" : "pages/ofm/vehicle_form",
|
||||||
"style" :
|
"style" :
|
||||||
{
|
{
|
||||||
"navigationBarTitleText" : "用车申请"
|
"navigationBarTitleText" : "用车申请"
|
||||||
|
|
@ -55,7 +55,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path" : "pages/ofm/publicityForm",
|
"path" : "pages/ofm/publicity_form",
|
||||||
"style" :
|
"style" :
|
||||||
{
|
{
|
||||||
"navigationBarTitleText" : "宣传报道"
|
"navigationBarTitleText" : "宣传报道"
|
||||||
|
|
@ -111,7 +111,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path" : "pages/ofm/booking",
|
"path" : "pages/ofm/mroombooking",
|
||||||
"style" :
|
"style" :
|
||||||
{
|
{
|
||||||
"navigationBarTitleText" : "预约记录",
|
"navigationBarTitleText" : "预约记录",
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import config from '/utils/config';
|
import config from '/utils/config';
|
||||||
|
import { auth } from '@/utils/auth.js'
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
@ -207,6 +208,7 @@
|
||||||
uni.setStorageSync('access', res.access)
|
uni.setStorageSync('access', res.access)
|
||||||
that.$api.getUserInfo().then(res => {
|
that.$api.getUserInfo().then(res => {
|
||||||
uni.setStorageSync('userInfo', res)
|
uni.setStorageSync('userInfo', res)
|
||||||
|
auth.setPermissions(Object.keys(res.perms))
|
||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
url: '/pages/index/index'
|
url: '/pages/index/index'
|
||||||
})
|
})
|
||||||
|
|
@ -237,6 +239,7 @@
|
||||||
uni.setStorageSync('access', res.access)
|
uni.setStorageSync('access', res.access)
|
||||||
that.$api.getUserInfo().then(res => {
|
that.$api.getUserInfo().then(res => {
|
||||||
uni.setStorageSync('userInfo', res)
|
uni.setStorageSync('userInfo', res)
|
||||||
|
auth.setPermissions(Object.keys(res.perms))
|
||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
url: '/pages/index/index'
|
url: '/pages/index/index'
|
||||||
})
|
})
|
||||||
|
|
@ -295,6 +298,7 @@
|
||||||
uni.setStorageSync('access', res.access)
|
uni.setStorageSync('access', res.access)
|
||||||
that.$api.getUserInfo().then(res => {
|
that.$api.getUserInfo().then(res => {
|
||||||
uni.setStorageSync('userInfo', res)
|
uni.setStorageSync('userInfo', res)
|
||||||
|
auth.setPermissions(Object.keys(res.perms))
|
||||||
that.bindXX()
|
that.bindXX()
|
||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
url: '/pages/index/index'
|
url: '/pages/index/index'
|
||||||
|
|
@ -311,6 +315,7 @@
|
||||||
that.bindXX()
|
that.bindXX()
|
||||||
that.$api.getUserInfo().then(res => {
|
that.$api.getUserInfo().then(res => {
|
||||||
uni.setStorageSync('userInfo', res)
|
uni.setStorageSync('userInfo', res)
|
||||||
|
auth.setPermissions(Object.keys(res.perms))
|
||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
url: '/pages/index/index'
|
url: '/pages/index/index'
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -23,102 +23,37 @@
|
||||||
</uni-col>
|
</uni-col>
|
||||||
</uni-row>
|
</uni-row>
|
||||||
<view style="height: 12rpx;"></view>
|
<view style="height: 12rpx;"></view>
|
||||||
<uni-section title="功能入口" type="line">
|
<uni-section title="发起申请" type="line">
|
||||||
|
<div v-for="group in wfOptions" :key="group.category">
|
||||||
|
<div style="padding-left:10px;color: #606266;">{{ group.category }}</div>
|
||||||
<uni-grid :column="5" :show-border="false" :square="false">
|
<uni-grid :column="5" :show-border="false" :square="false">
|
||||||
<uni-grid-item v-for="(item ,index) in moduleList" :index="index" :key="index">
|
<uni-grid-item v-for="(item ,index) in group.items" :index="index" :key="index">
|
||||||
<view class="grid-item-box" @click="pageEnter(item)">
|
<view class="grid-item-box" @click="pageEnter(item)">
|
||||||
<image class="image" :src="item.url" mode="aspectFill" />
|
<image class="image" :src="item.icon_path?item.icon_path:'/static/yuding.png'" mode="aspectFill" />
|
||||||
<text class="text">{{item.text}}</text>
|
<text class="text">{{item.name}}</text>
|
||||||
<view v-if="item.badge" class="grid-dot">
|
|
||||||
<uni-badge :text="item.badge" :type="item.type" />
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</uni-grid-item>
|
</uni-grid-item>
|
||||||
</uni-grid>
|
</uni-grid>
|
||||||
|
</div>
|
||||||
</uni-section>
|
</uni-section>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import tool from "../../utils/tools.js";
|
import tool from "../../utils/tools.js";
|
||||||
|
import { auth } from '@/utils/auth.js'
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
welTitle: "",
|
welTitle: "",
|
||||||
imageSrc:"",
|
imageSrc:"",
|
||||||
currentDate: tool.getTodayDate(),
|
currentDate: tool.getTodayDate(),
|
||||||
moduleList: [
|
wfOptions: []
|
||||||
{
|
|
||||||
navigate:'/pages/ofm/booking_form?mode=add',
|
|
||||||
url: '/static/yuding.png',
|
|
||||||
text: '会议预定',
|
|
||||||
type: "primary",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
navigate:'/pages/ofm/sealForm?mode=add',
|
|
||||||
url: '/static/meetingRecord.png',
|
|
||||||
text: '印章申请',
|
|
||||||
type: "success"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
navigate:'/pages/ofm/vehicleForm?mode=add',
|
|
||||||
url: '/static/meetingRecord.png',
|
|
||||||
text: '用车申请',
|
|
||||||
type: "success"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
navigate:'/pages/ofm/borrowfile_form?mode=add',
|
|
||||||
url: '/static/meetingRecord.png',
|
|
||||||
text: '档案借阅',
|
|
||||||
type: "success"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
navigate:'/pages/ofm/publicityForm?mode=add',
|
|
||||||
url: '/static/huiyishi.png',
|
|
||||||
text: '宣传报道',
|
|
||||||
type: "warning"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
navigate:'/pages/srm/patent_form?mode=add',
|
|
||||||
url: '/static/huiyishi.png',
|
|
||||||
text: '专利审批',
|
|
||||||
type: "warning"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
navigate:'/pages/srm/paperse_form?mode=add',
|
|
||||||
url: '/static/huiyishi.png',
|
|
||||||
text: '论文申密',
|
|
||||||
type: "warning"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
navigate:'/pages/srm/plant_form?mode=add',
|
|
||||||
url: '/static/huiyishi.png',
|
|
||||||
text: '平台审批',
|
|
||||||
type: "warning"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
navigate:'/pages/srm/project_form?mode=add',
|
|
||||||
url: '/static/huiyishi.png',
|
|
||||||
text: '立项审批',
|
|
||||||
type: "warning"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
navigate:'/pages/hrm/resignation_form?mode=add',
|
|
||||||
url: '/static/huiyishi.png',
|
|
||||||
text: '离职申请',
|
|
||||||
type: "warning"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
navigate:'/pages/pum/supplieraudit_form?mode=add',
|
|
||||||
url: '/static/huiyishi.png',
|
|
||||||
text: '供应商审批',
|
|
||||||
type: "warning"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.initWelTitle();
|
this.initWelTitle();
|
||||||
|
this.getWfOptions();
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
|
|
@ -126,6 +61,27 @@
|
||||||
// #endif
|
// #endif
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getWfOptions() {
|
||||||
|
let permissions = auth.getPermissions();
|
||||||
|
const groups = {};
|
||||||
|
this.$api.getWorkflow({ page: 0 }).then((res) => {
|
||||||
|
res.forEach((item) => {
|
||||||
|
if(item.key && permissions.includes(item.key)) {
|
||||||
|
let cate = item.cate;
|
||||||
|
if (!cate){cate="未分组"}
|
||||||
|
if (!groups[cate]) {
|
||||||
|
groups[cate] = [];
|
||||||
|
}
|
||||||
|
groups[cate].push(item);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// 转换为数组形式,便于模板遍历
|
||||||
|
this.wfOptions = Object.keys(groups).map(category => ({
|
||||||
|
category,
|
||||||
|
items: groups[category]
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
},
|
||||||
initWelTitle() {
|
initWelTitle() {
|
||||||
let userInfo = uni.getStorageSync("userInfo")
|
let userInfo = uni.getStorageSync("userInfo")
|
||||||
let name = userInfo.name;
|
let name = userInfo.name;
|
||||||
|
|
@ -137,23 +93,12 @@
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
pageEnter(item){
|
pageEnter(item){
|
||||||
|
const viewPath = item.view_path;
|
||||||
|
let view_path = item.view_path2?item.view_path2:item.view_path;
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url:item.navigate
|
url:`/pages${view_path}?mode=add`
|
||||||
})
|
})
|
||||||
},
|
|
||||||
cameraClick(){
|
|
||||||
uni.chooseImage({
|
|
||||||
count: 1, // 默认选择1张图片
|
|
||||||
sourceType: ['album', 'camera'], // 支持相册和相机
|
|
||||||
success: function (res) {
|
|
||||||
// 返回选择或拍摄的图片路径
|
|
||||||
console.log(res.tempFilePaths[0]);
|
|
||||||
},
|
|
||||||
fail: function (err) {
|
|
||||||
console.log('选择或拍照失败', err);
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ export default {
|
||||||
|
|
||||||
employeeList:(data) => http('/hrm/employee/', 'GET', data),
|
employeeList:(data) => http('/hrm/employee/', 'GET', data),
|
||||||
|
|
||||||
|
getWorkflow: (data) => http('/wf/workflow/', 'GET', data),
|
||||||
getTicket:(data) => http('/wf/ticket/', 'GET', data),
|
getTicket:(data) => http('/wf/ticket/', 'GET', data),
|
||||||
getTicketItem:(id) => http(`/wf/ticket/${id}/`, 'GET'),
|
getTicketItem:(id) => http(`/wf/ticket/${id}/`, 'GET'),
|
||||||
getTicketFlowLogs:(id) => http(`/wf/ticket/${id}/flowlogs/`, 'GET'),
|
getTicketFlowLogs:(id) => http(`/wf/ticket/${id}/flowlogs/`, 'GET'),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue