1、修改点击方法

2、添加 当班员工页面 配置路由
This commit is contained in:
wyw 2024-11-20 16:42:15 +08:00
parent 59fc1be7c7
commit 68c1124ad6
3 changed files with 367 additions and 12 deletions

View File

@ -31,6 +31,12 @@
// "navigationBarBackgroundColor": "#fff"
}
},
{
"path": "pages/apply/user",
"style": {
"navigationBarTitleText": "当班员工"
}
},
{
"path": "pages/apply/complete",
"style": {

342
pages/apply/user.vue Normal file
View File

@ -0,0 +1,342 @@
<template>
<!-- 当班工作人员 -->
<view class="content">
<view class="container">
<view class="form-sub">
<u-form :model="model" ref="uForm" label-width="90px" class="demo-ruleForm" size="mini">
<view style="position: relative;">
<view style="position: absolute;left: -10px;color: #3d4b70;top: -3px;">*</view>
</view>
<view style="font-size: 15px; font-weight: bold;color: #3d4b70;margin-bottom: 10px;">组织信息</view>
<u-form-item label="组织名称" prop="NAME" borderBottom ref="item1">
<u--input v-model="model.NAME" border="none"
customStyle="margin:0px;display:flex;padding:3px 9px"></u--input>
</u-form-item>
<u-form-item label="员工数" prop="COUNT" borderBottom @click="showSex = true;" ref="item1">
<u--input v-model="model.COUNT" disabled disabledColor="#ffffff" placeholder="员工数量"
border="none" suffixIcon="arrow-right" fontSize="14px"
customStyle="margin:0px;display:flex;padding:3px 9px"
suffixIconStyle="font-size:12px"></u--input>
</u-form-item>
</u-form>
<!-- 动态加载用户信息 -->
<u-sticky offset-top="20">
<view class="sub-form">
<view class="sub-form-wrap">
<u--form labelPosition="left" labelWidth="auto" labelAlign="center"
errorType="border-bottom" ref="sForm">
<uni-collapse :border="false" accordion>
<uni-card style="margin-bottom: 16px;" margin="0" spacing="0" :is-shadow="false"
v-for="(item, index) in model.Nav_ListUser.filter(i => !i.IS_DELETED)">
<uni-collapse-item :title="(index+1) + '. ' + item.NAME" name="1">
<u-form-item label="姓名" prop="NAME" borderBottom>
<u--input disabled disabledColor="#fff" v-model="item.NAME"
border="none" inputAlign="right"></u--input>
</u-form-item>
<u-form-item label="性别" prop="SEX" borderBottom>
<u--input disabled disabledColor="#fff" v-model="item.NAME"
border="none" inputAlign="right"></u--input>
</u-form-item>
</uni-collapse-item>
</uni-card>
</uni-collapse>
</u--form>
</view>
</view>
</u-sticky>
<view style="display: flex;flex-direction: row;" class="bottom-button">
<u-button type="primary" @click="reset" color="#3d4b70" :plain="true"
style="margin-right: 5px;">重置</u-button>
<u-button type="primary" @click="submit" color="#3d4b70" style="margin-left: 5px;"
v-if="loading == false">提交</u-button>
<u-button type="primary" loading loadingText="加载中" color="#3d4b70" style="margin-left: 5px;"
v-if="loading == true">提交</u-button>
</view>
<u-action-sheet :show="showSex" :actions="actions" title="请选择性别" @close="showSex = false"
@select="sexSelect">
</u-action-sheet>
<u-datetime-picker :show="dateTimePickerInfo.showCheckDate" mode="date"
v-model='dateTimePickerInfo.defaultDateTime' :formatter="formatter" @confirm="handleCheckDate"
@close="dateTimePickerInfo.showCheckDate = false;"
@cancel="dateTimePickerInfo.showCheckDate = false;"></u-datetime-picker>
<u-picker :show="pickerShow" :columns="pickerColumns" @confirm="pickerConfirm"
@cancel="pickerCancel"></u-picker>
</view>
</view>
</view>
</template>
<script>
import {
RegisterUser
} from '../../services/apply.js'
import config from '../../config/common.js'
import {
isChinaMobilePhone,
easyCheckID,
getNowFormatDate
} from '../../utils/common.js'
export default {
data() {
return {
showSex: false,
appurl: config.uni_app_url,
formatter: null,
pickerShow: false,
loading: false,
pickerColumns: [Array(60).fill(null).map((_, i) => i)],
model: {
NAME:'组织名称',
COUNT:'员工数量',
Nav_ListUser: [{
NAME: '姓名显示',
SEX: '性别显示'
}]
},
dateTimePickerInfo: {
showCheckDate: false,
defaultDateTime: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd'),
value: '',
},
actions: [{
name: '男',
},
{
name: '女',
},
],
rules: {
'NAME': {
type: 'string',
required: true,
message: '请填写姓名',
trigger: ['blur', 'change']
},
'COUNT': {
type: 'string',
max: 1,
required: true,
message: '请选择男或女',
trigger: ['blur', 'change']
},
},
radio: '',
switchVal: false
}
},
onLoad() {},
onReady() {
//setRules
this.$refs.uForm.setRules(this.rules)
},
methods: {
sexSelect(e) {
this.model.userInfo.Sex = e.name
this.$refs.uForm.validateField('userInfo.Sex')
},
showCheckDate() {
if (this.model.userInfo.InTime == null) {
this.model.userInfo.InTime = uni.$u.timeFormat(new Date(),
'yyyy-mm-dd')
}
this.dateTimePickerInfo = {
showCheckDate: true,
defaultDateTime: this.model.userInfo.InTime,
}
},
handleCheckDate(e) {
// let v = uni.$u.timeFormat(e.value, 'yyyy-mm-dd')
this.model.userInfo.InTime = uni.$u.timeFormat(e.value,
'yyyy-mm-dd')
this.dateTimePickerInfo.showCheckDate = false
},
pickerConfirm(e) {
this.model.userInfo.WORKINGYEAR = e.value.toString()
this.pickerShow = false
},
pickerCancel(e) {
this.pickerShow = false
},
reset() {
this.model.userInfo = {
Name: '',
Sex: '',
Phone: '',
ID_CARD: '',
InTime: '',
WORKINGYEAR: '',
}
},
submit() {
// if (this.model.userInfo.Name == '' ||
// this.model.userInfo.Sex == '' ||
// this.model.userInfo.Phone == '' ||
// this.model.userInfo.ID_CARD == '' ||
// this.model.userInfo.InTime == '') {
// uni.showToast({
// icon: 'error',
// title: ''
// })
// return
// }
// if (isChinaMobilePhone(this.model.userInfo.Phone) == false) {
// uni.showToast({
// icon: 'error',
// title: ''
// })
// return
// }
// if (easyCheckID(this.model.userInfo.ID_CARD) == false) {
// uni.showToast({
// icon: 'error',
// title: ''
// })
// return
// }
// this.loading = true
// const json = {
// Name: this.model.userInfo.Name,
// Sex: this.model.userInfo.Sex == '' ? '1' : '0',
// Phone: this.model.userInfo.Phone,
// ID_CARD: this.model.userInfo.ID_CARD,
// InTime: this.model.userInfo.InTime,
// WORKINGYEAR: this.model.userInfo.WORKINGYEAR,
// }
// // const json = {
// // Name: '',
// // Sex: '0',
// // Phone: '18480141719',
// // ID_CARD: '230182200000000000',
// // InTime: '2024-07-25',
// // WORKINGYEAR: '0',
// // }
// RegisterUser(json).then((res) => {
// if (res.code == 200) {
// this.loading = false
// uni.showToast({
// title: '',
// icon: 'none'
// })
// setTimeout(() => {
// uni.hideToast();
// location.href = this.appurl
// // uni.redirectTo({
// // url: '/pages/webview/webview?url=' + this.appurl
// // })
// }, 1500)
// // uni.navigateTo({
// // url: '/pages/apply/complete?type=success'
// // })
// } else {
// this.loading = false
// uni.showToast({
// title: res.msg,
// icon: 'none'
// })
// // uni.navigateTo({
// // url: `/pages/apply/complete?type=failed&title=${res.msg}`
// // })
// }
// }).catch((err) => {
// this.loading = false
// uni.navigateTo({
// url: `/pages/apply/complete?type=failed&title=${err.msg}`
// })
// })
},
}
}
</script>
<style>
.content {
background-color: #f4f7ff;
width: 100%;
/* #ifndef APP-PLUS */
height: calc(100vh - 44px - 50px); // APP
/* #endif */
/* #ifdef APP-PLUS */
height: calc(100vh); // APP
/* #endif */
}
.container {
padding: 20px 16px 10px 16px;
}
.form-sub {
/* margin: 20px 16px 10px 16px; */
/* border: 1px solid #EBEEF5; */
padding: 20px 30px 10px 30px;
/* box-shadow: rgba(0, 0, 0, 0.08) 0px 0px 3px 1px; */
background-color: #ffffff;
border-radius: 10px;
}
.demo-ruleForm>>>.u-form-item__body__left__content__label {
font-size: 14px;
color: #8e8b9c;
/* justify-content: flex-start; */
}
.demo-ruleForm>>>.u-form-item__body__left__content__ {
left: -11px;
top: 0px
}
.demo-ruleForm>>>.u-textarea__field {
font-size: 14px;
}
.demo-ruleForm>>>.u-cell__title-text {
font-size: 14px;
}
.demo-ruleForm-thr>>>.u-textarea {
padding: 9px 9px 25px 9px;
}
.demo-ruleForm-thr>>>.u-form-item__body__left__content__label {
font-size: 14px;
color: #8e8b9c;
/* justify-content: flex-start; */
}
.demo-ruleForm-thr>>>.u-form-item__body__left__content__ {
left: -11px;
top: 0px
}
.demo-ruleForm-thr>>>.u-textarea__field {
font-size: 14px;
}
.demo-ruleForm-thr>>>.u-cell__title-text {
font-size: 14px;
}
.bottom-button {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
padding: 10px 16px;
box-sizing: border-box;
background: #f4f7ff;
z-index: 999;
}
</style>

View File

@ -1,9 +1,10 @@
<template>
<view class="content">
<view class="list">
<u-grid :border="false" @click="click" :col="2">
<u-grid :border="false" :col="2"> <!-- @click="click" -->
<u-grid-item v-for="(baseListItem,baseListIndex) in baseList" :key="baseListIndex" bgColor="#fff">
<u-icon :customStyle="{paddingTop:20+'rpx'}" :name="baseListItem.iconName" :size="42" color="#304ffe"></u-icon>
<u-icon :customStyle="{paddingTop:20+'rpx'}" :name="baseListItem.iconName" :size="42"
@click="menuClick(baseListItem.url)" color="#304ffe"></u-icon>
<text class="grid-text">{{baseListItem.name}}</text>
</u-grid-item>
</u-grid>
@ -53,7 +54,7 @@
const pages = getCurrentPages()
const currentPage = pages[pages.length - 1]
const Options = currentPage.options
uni.setStorageSync('Company', Options.Company?Options.Company:'XLK')
uni.setStorageSync('Company', Options.Company ? Options.Company : 'XLK')
},
onLoad() {
this.getCaidan()
@ -66,15 +67,21 @@
})
},
methods: {
click(name) {
this.baseList.map((item, index) => {
if (index == name) {
if (item.name == '新增用户') {
uni.navigateTo({
url: '/pages/apply/index'
})
}
}
// click(name) {
// this.baseList.map((item, index) => {
// if (index == name) {
// if (item.name == '') {
// uni.navigateTo({
// url: '/pages/apply/index'
// })
// }
// }
// })
// },
menuClick(linkToUrl) {
uni.navigateTo({
url: linkToUrl
})
},
goCamera() {