feat: 首页申请模块通过接口获取

This commit is contained in:
caoqianming 2025-11-21 14:31:59 +08:00
parent 80cfa6dbaf
commit ff7d51a463
10 changed files with 52 additions and 101 deletions

View File

@ -95,7 +95,7 @@
"vueVersion" : "3",
"h5" : {
"router" : {
"base" : "/h5/",
"base" : "/h5x/",
"mode" : "hash"
},
"devServer" : {

View File

@ -27,21 +27,21 @@
}
},
{
"path" : "pages/ofm/booking_form",
"path" : "pages/ofm/mroombooking_form",
"style" :
{
"navigationBarTitleText" : "会议室预约"
}
},
{
"path" : "pages/ofm/sealForm",
"path" : "pages/ofm/seal_form",
"style" :
{
"navigationBarTitleText" : "印章申请"
}
},
{
"path" : "pages/ofm/vehicleForm",
"path" : "pages/ofm/vehicle_form",
"style" :
{
"navigationBarTitleText" : "用车申请"
@ -55,7 +55,7 @@
}
},
{
"path" : "pages/ofm/publicityForm",
"path" : "pages/ofm/publicity_form",
"style" :
{
"navigationBarTitleText" : "宣传报道"
@ -111,7 +111,7 @@
}
},
{
"path" : "pages/ofm/booking",
"path" : "pages/ofm/mroombooking",
"style" :
{
"navigationBarTitleText" : "预约记录",

View File

@ -48,6 +48,7 @@
<script>
import config from '/utils/config';
import { auth } from '@/utils/auth.js'
export default {
data() {
return {
@ -207,6 +208,7 @@
uni.setStorageSync('access', res.access)
that.$api.getUserInfo().then(res => {
uni.setStorageSync('userInfo', res)
auth.setPermissions(Object.keys(res.perms))
uni.reLaunch({
url: '/pages/index/index'
})
@ -237,6 +239,7 @@
uni.setStorageSync('access', res.access)
that.$api.getUserInfo().then(res => {
uni.setStorageSync('userInfo', res)
auth.setPermissions(Object.keys(res.perms))
uni.reLaunch({
url: '/pages/index/index'
})
@ -295,6 +298,7 @@
uni.setStorageSync('access', res.access)
that.$api.getUserInfo().then(res => {
uni.setStorageSync('userInfo', res)
auth.setPermissions(Object.keys(res.perms))
that.bindXX()
uni.reLaunch({
url: '/pages/index/index'
@ -311,6 +315,7 @@
that.bindXX()
that.$api.getUserInfo().then(res => {
uni.setStorageSync('userInfo', res)
auth.setPermissions(Object.keys(res.perms))
uni.reLaunch({
url: '/pages/index/index'
})

View File

@ -23,102 +23,37 @@
</uni-col>
</uni-row>
<view style="height: 12rpx;"></view>
<uni-section title="功能入口" type="line">
<uni-grid :column="5" :show-border="false" :square="false">
<uni-grid-item v-for="(item ,index) in moduleList" :index="index" :key="index">
<view class="grid-item-box" @click="pageEnter(item)">
<image class="image" :src="item.url" mode="aspectFill" />
<text class="text">{{item.text}}</text>
<view v-if="item.badge" class="grid-dot">
<uni-badge :text="item.badge" :type="item.type" />
<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-item v-for="(item ,index) in group.items" :index="index" :key="index">
<view class="grid-item-box" @click="pageEnter(item)">
<image class="image" :src="item.icon_path?item.icon_path:'/static/yuding.png'" mode="aspectFill" />
<text class="text">{{item.name}}</text>
</view>
</view>
</uni-grid-item>
</uni-grid>
</uni-grid-item>
</uni-grid>
</div>
</uni-section>
</view>
</template>
<script>
import tool from "../../utils/tools.js";
import { auth } from '@/utils/auth.js'
export default {
data() {
return {
welTitle: "",
imageSrc:"",
currentDate: tool.getTodayDate(),
moduleList: [
{
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"
}
]
wfOptions: []
}
},
mounted() {
this.initWelTitle();
this.initWelTitle();
this.getWfOptions();
},
onShow() {
// #ifdef MP-WEIXIN
@ -126,6 +61,27 @@
// #endif
},
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() {
let userInfo = uni.getStorageSync("userInfo")
let name = userInfo.name;
@ -137,23 +93,12 @@
})
},
pageEnter(item){
const viewPath = item.view_path;
let view_path = item.view_path2?item.view_path2:item.view_path;
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>

View File

@ -16,6 +16,7 @@ export default {
employeeList:(data) => http('/hrm/employee/', 'GET', data),
getWorkflow: (data) => http('/wf/workflow/', 'GET', data),
getTicket:(data) => http('/wf/ticket/', 'GET', data),
getTicketItem:(id) => http(`/wf/ticket/${id}/`, 'GET'),
getTicketFlowLogs:(id) => http(`/wf/ticket/${id}/flowlogs/`, 'GET'),