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", "vueVersion" : "3",
"h5" : { "h5" : {
"router" : { "router" : {
"base" : "/h5/", "base" : "/h5x/",
"mode" : "hash" "mode" : "hash"
}, },
"devServer" : { "devServer" : {

View File

@ -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" : "预约记录",

View File

@ -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'
}) })

View File

@ -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">
<uni-grid :column="5" :show-border="false" :square="false"> <div v-for="group in wfOptions" :key="group.category">
<uni-grid-item v-for="(item ,index) in moduleList" :index="index" :key="index"> <div style="padding-left:10px;color: #606266;">{{ group.category }}</div>
<view class="grid-item-box" @click="pageEnter(item)"> <uni-grid :column="5" :show-border="false" :square="false">
<image class="image" :src="item.url" mode="aspectFill" /> <uni-grid-item v-for="(item ,index) in group.items" :index="index" :key="index">
<text class="text">{{item.text}}</text> <view class="grid-item-box" @click="pageEnter(item)">
<view v-if="item.badge" class="grid-dot"> <image class="image" :src="item.icon_path?item.icon_path:'/static/yuding.png'" mode="aspectFill" />
<uni-badge :text="item.badge" :type="item.type" /> <text class="text">{{item.name}}</text>
</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>

View File

@ -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'),