添加出差申请
parent
1ff25eb88f
commit
a9e7adc655
@ -0,0 +1,11 @@
|
|||||||
|
import {
|
||||||
|
request
|
||||||
|
} from '@/utils/request'
|
||||||
|
|
||||||
|
export const listContractInfo = (query) => {
|
||||||
|
return request({
|
||||||
|
url: '/oa/erp/contractInfo/list',
|
||||||
|
method: 'get',
|
||||||
|
data: query
|
||||||
|
});
|
||||||
|
};
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
import {
|
||||||
|
request
|
||||||
|
} from '@/utils/request'
|
||||||
|
|
||||||
|
export function getInfo() {
|
||||||
|
return request({
|
||||||
|
url: '/system/user/getInfo',
|
||||||
|
method: 'get'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getRouters() {
|
||||||
|
return request({
|
||||||
|
url: '/system/menu/getRouters',
|
||||||
|
method: 'get'
|
||||||
|
});
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
import {
|
||||||
|
request
|
||||||
|
} from '@/utils/request'
|
||||||
|
|
||||||
|
export const listProjectInfo = (query) => {
|
||||||
|
return request({
|
||||||
|
url: '/oa/erp/projectInfo/list',
|
||||||
|
method: 'get',
|
||||||
|
data: query
|
||||||
|
});
|
||||||
|
};
|
||||||
@ -0,0 +1,54 @@
|
|||||||
|
<template>
|
||||||
|
<view class="searchInput">
|
||||||
|
<view class="input">
|
||||||
|
<input style="height: 60rpx;" @input="onInput" v-model="input" />
|
||||||
|
</view>
|
||||||
|
<button class="btn" type="primary" @tap="btnClick">搜索</button>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import {
|
||||||
|
ref,
|
||||||
|
onMounted
|
||||||
|
} from 'vue'
|
||||||
|
const input = ref('')
|
||||||
|
const props = defineProps(['title', 'modelValue'])
|
||||||
|
const emit = defineEmits(['search'])
|
||||||
|
const btnClick = (e) => {
|
||||||
|
emit('search', props.value)
|
||||||
|
}
|
||||||
|
const onInput = (e) => {
|
||||||
|
emit('update:modelValue', e.detail.value)
|
||||||
|
}
|
||||||
|
onMounted(() => {
|
||||||
|
input.value = props.modelValue
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.searchInput {
|
||||||
|
width: 100%;
|
||||||
|
height: 60rpx;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
border-radius: 30rpx;
|
||||||
|
|
||||||
|
.input {
|
||||||
|
display: inline-block;
|
||||||
|
margin: 0 10rpx 0 20rpx;
|
||||||
|
width: calc(100% - 10rpx - 20rpx - 100rpx - 6rpx);
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
display: inline-block;
|
||||||
|
width: 100rpx;
|
||||||
|
height: 48rpx;
|
||||||
|
line-height: 48rpx;
|
||||||
|
vertical-align: top;
|
||||||
|
margin-top: 6rpx;
|
||||||
|
padding: 0;
|
||||||
|
border-radius: 24rpx;
|
||||||
|
font-size: 26rpx
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -0,0 +1,52 @@
|
|||||||
|
<template>
|
||||||
|
<view class="top">
|
||||||
|
<view class="back">
|
||||||
|
<image class="back" :src="`${imgUrl}/icon/back.png`" mode="aspectFit" @tap="toback">
|
||||||
|
</image>
|
||||||
|
</view>
|
||||||
|
<view class="text">
|
||||||
|
{{text}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import {
|
||||||
|
imgUrl
|
||||||
|
} from '@/common/config';
|
||||||
|
import {
|
||||||
|
router
|
||||||
|
} from '../utils/router';
|
||||||
|
const props = defineProps(['text'])
|
||||||
|
const toback = () => {
|
||||||
|
router.back()
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.top {
|
||||||
|
width: 750rpx;
|
||||||
|
height: 100rpx;
|
||||||
|
line-height: 100rpx;
|
||||||
|
text-align: center;
|
||||||
|
background-color: #fff;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
.back {
|
||||||
|
position: absolute;
|
||||||
|
display: inline-block;
|
||||||
|
height: 40rpx;
|
||||||
|
width: 40rpx;
|
||||||
|
top: 50%;
|
||||||
|
left: 40rpx;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.text {
|
||||||
|
vertical-align: top;
|
||||||
|
display: inline-block;
|
||||||
|
width: 750rpx;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
<template>
|
||||||
|
<view class="form-item">
|
||||||
|
<view class="title" :style="{width : (width || 'auto')}">{{title}}</view>
|
||||||
|
<view class="item">
|
||||||
|
<slot></slot>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
const props = defineProps(['title', 'width'])
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.title {
|
||||||
|
display: inline-block;
|
||||||
|
margin-right: 20rpx;
|
||||||
|
line-height: 60rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item {
|
||||||
|
flex: 1;
|
||||||
|
width: 200rpx;
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -0,0 +1,46 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<input :disabled="disabled" class="input" v-model="model" :placeholder="props.placeholder" @change="onChange" />
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import {
|
||||||
|
computed
|
||||||
|
} from 'vue'
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
modelValue: Object,
|
||||||
|
placeholder: String,
|
||||||
|
disabled:Boolean
|
||||||
|
})
|
||||||
|
|
||||||
|
const emit = defineEmits(['update:modelValue', 'change'])
|
||||||
|
|
||||||
|
const model = computed({
|
||||||
|
get() {
|
||||||
|
return props.modelValue
|
||||||
|
},
|
||||||
|
set(val) {
|
||||||
|
emit('update:modelValue', val)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const onChange = (val) => {
|
||||||
|
let data = props.modelValue?.[val.detail.value]?.value || ''
|
||||||
|
emit('change', modelValue)
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.input {
|
||||||
|
height: 50rpx;
|
||||||
|
line-height: 50rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #333;
|
||||||
|
|
||||||
|
.uni-input-placeholder {
|
||||||
|
font-size: 24rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -0,0 +1,35 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<picker mode="selector" @change="onChange" :range-key="key||'label'" :value="valueIndex" :range="data">
|
||||||
|
<view class="picker">
|
||||||
|
{{(data.find(e=>e.value == value)||{}).label}}
|
||||||
|
</view>
|
||||||
|
</picker>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import {
|
||||||
|
computed,
|
||||||
|
} from 'vue'
|
||||||
|
const props = defineProps(['key', 'value', 'data'])
|
||||||
|
const emit = defineEmits(['change'])
|
||||||
|
const onChange = (val) => {
|
||||||
|
let data = props.data?.[val.detail.value]?.value || ''
|
||||||
|
emit('change', data)
|
||||||
|
}
|
||||||
|
const valueIndex = computed(() => {
|
||||||
|
if (!props.data) return 0
|
||||||
|
const index = props.data.findIndex(e => e.value === props.value)
|
||||||
|
return index >= 0 ? index : 0
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.picker {
|
||||||
|
height: 50rpx;
|
||||||
|
line-height: 50rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -0,0 +1,85 @@
|
|||||||
|
<template>
|
||||||
|
<!-- 遮罩层 -->
|
||||||
|
<view v-if="visible" class="popup-mask" @click="close">
|
||||||
|
<view @click.stop class="popup-content" :style="{ transform: transformStyle }">
|
||||||
|
<slot></slot>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import {
|
||||||
|
ref,
|
||||||
|
computed,
|
||||||
|
defineExpose
|
||||||
|
} from 'vue'
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
position: {
|
||||||
|
type: String,
|
||||||
|
default: 'bottom'
|
||||||
|
},
|
||||||
|
duration: {
|
||||||
|
type: Number,
|
||||||
|
default: 300
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const emit = defineEmits(['open', 'close'])
|
||||||
|
|
||||||
|
const visible = ref(false)
|
||||||
|
const animating = ref(false)
|
||||||
|
|
||||||
|
// 动画样式
|
||||||
|
const transformStyle = computed(() => {
|
||||||
|
if (animating.value) return 'translateY(0%)'
|
||||||
|
if (props.position === 'bottom') return 'translateY(100%)'
|
||||||
|
if (props.position === 'top') return 'translateY(-100%)'
|
||||||
|
return 'scale(0.8)'
|
||||||
|
})
|
||||||
|
|
||||||
|
// 对外暴露的方法
|
||||||
|
function open() {
|
||||||
|
visible.value = true
|
||||||
|
animating.value = false
|
||||||
|
setTimeout(() => {
|
||||||
|
animating.value = true
|
||||||
|
emit('open')
|
||||||
|
}, 20)
|
||||||
|
}
|
||||||
|
|
||||||
|
function close() {
|
||||||
|
animating.value = false
|
||||||
|
setTimeout(() => {
|
||||||
|
visible.value = false
|
||||||
|
emit('close')
|
||||||
|
}, props.duration)
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
open,
|
||||||
|
close
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.popup-mask {
|
||||||
|
position: fixed;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background: rgba(0, 0, 0, 0.5);
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: flex-end;
|
||||||
|
z-index: 999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.popup-content {
|
||||||
|
width: 100%;
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 16rpx 16rpx 0 0;
|
||||||
|
transition: transform 0.3s ease;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
import Top from './Top.vue'
|
||||||
|
import Card from './Card.vue'
|
||||||
|
import DictTag from './DictTag.vue'
|
||||||
|
import FormItem from './form/FormItem.vue'
|
||||||
|
import SearchInput from './SearchInput.vue'
|
||||||
|
import Picker from './form/Picker.vue'
|
||||||
|
|
||||||
|
export {
|
||||||
|
Top,
|
||||||
|
Card,
|
||||||
|
DictTag,
|
||||||
|
FormItem,
|
||||||
|
SearchInput,
|
||||||
|
Picker
|
||||||
|
}
|
||||||
@ -0,0 +1,199 @@
|
|||||||
|
<template>
|
||||||
|
<view :style="{marginTop:barHeight+'px'}">
|
||||||
|
<Top text="出差申请" />
|
||||||
|
<scroll-view scroll-y
|
||||||
|
:style="{height:`calc(${pageHeight+'px'} - 30rpx - 100rpx)`,paddingBottom:'30rpx',backgroundColor:'#eee9'}">
|
||||||
|
<view class="list">
|
||||||
|
<view class="item">
|
||||||
|
<view class="formItem">
|
||||||
|
<view class="title">申请单号</view>
|
||||||
|
<view class="inputBg">
|
||||||
|
<Input v-model="applicatioData.applyCode" placeholder="自动生成" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="formItem">
|
||||||
|
<view class="title">申请人</view>
|
||||||
|
<view class="inputBg">
|
||||||
|
<Input v-model="applicatioData.applicantName" placeholder="自动填充" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="formItem">
|
||||||
|
<view class="title">申请人部门</view>
|
||||||
|
<view class="inputBg">
|
||||||
|
<Input v-model="applicatioData.deptName" placeholder="自动填充" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="item" v-for="(i,k) in list">
|
||||||
|
<view class="itemTitle">行程明细 {{k+1}}</view>
|
||||||
|
<view class="formItem">
|
||||||
|
<view class="title">出差类型</view>
|
||||||
|
<view class="inputBg">
|
||||||
|
<Picker key="label" :data="trip_type" :value="i.tripType" @change="e=>i.tripType =e" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="formItem">
|
||||||
|
<view class="title">项目名称</view>
|
||||||
|
<view class="inputBg" @tap="getProject(k)">
|
||||||
|
<Input style="pointer-events:none" disabled v-model="i.projectName" placeholder="点击选择" />
|
||||||
|
<Input v-show="false" v-model="i.projectId" placeholder="projectId" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="formItem">
|
||||||
|
<view class="title">项目号</view>
|
||||||
|
<view class="inputBg" @tap="getProject(k)">
|
||||||
|
<Input style="pointer-events:none" disabled v-model="i.projectCode" placeholder="点击选择" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="formItem">
|
||||||
|
<view class="title">出差事由</view>
|
||||||
|
<view class="inputBg">
|
||||||
|
<textarea class="textArea" v-model="i.tripReason" placeholder="出差事由" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="formItem">
|
||||||
|
<view class="title">开始时间</view>
|
||||||
|
<view class="inputBg">
|
||||||
|
<uni-section :title="'日期范围用法:' + '[' + range + ']'" type="line"></uni-section>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<Popup ref="popupRef" v-model="show" position="bottom" :duration="300">
|
||||||
|
<view class="search">
|
||||||
|
<FormItem :title="'项目名称'">
|
||||||
|
<SearchInput @search="getList" v-model="form.projectName" />
|
||||||
|
</FormItem>
|
||||||
|
</view>
|
||||||
|
<scroll-view scroll-y style="height: 600rpx;">
|
||||||
|
<view @tap="pitchOnProject(i)" v-for="i in projectList">
|
||||||
|
<Card style="pointer-events:none" hideTitle class="projectList">
|
||||||
|
<DictTag style="position: absolute;top: 30rpx;right: 30rpx;" :options="project_category"
|
||||||
|
:value="i.projectCategory" />
|
||||||
|
<view>
|
||||||
|
{{i.projectName}}
|
||||||
|
</view>
|
||||||
|
<view style="font-size: 24rpx;color: #999;margin-right: 24rpx;display: inline-block;">
|
||||||
|
{{i.projectCode}}
|
||||||
|
</view>
|
||||||
|
<view style="font-size: 24rpx;color: #999;display: inline-block;">
|
||||||
|
项目经理:{{i.managerName}}
|
||||||
|
</view>
|
||||||
|
</Card>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
</Popup>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import {
|
||||||
|
toRefs,
|
||||||
|
ref,
|
||||||
|
onMounted,
|
||||||
|
computed
|
||||||
|
} from 'vue'
|
||||||
|
import {
|
||||||
|
useDict
|
||||||
|
} from '@/utils/dict.js'
|
||||||
|
const {
|
||||||
|
trip_type,
|
||||||
|
business_direction,
|
||||||
|
project_category,
|
||||||
|
} = toRefs(
|
||||||
|
useDict(['trip_type', 'business_direction', 'project_category'])
|
||||||
|
);
|
||||||
|
import {
|
||||||
|
listProjectInfo
|
||||||
|
} from '@/api/workHourReporting.js'
|
||||||
|
const popupRef = ref()
|
||||||
|
const applicatioData = ref({})
|
||||||
|
const form = ref({})
|
||||||
|
const projectIndex = ref(null)
|
||||||
|
const list = ref([{}])
|
||||||
|
const projectList = ref([])
|
||||||
|
const getProject = (index) => {
|
||||||
|
projectIndex.value = index
|
||||||
|
popupRef.value.open()
|
||||||
|
}
|
||||||
|
const getProjectList = async () => {
|
||||||
|
const res = await listProjectInfo();
|
||||||
|
projectList.value = res.rows;
|
||||||
|
}
|
||||||
|
const getList = async () => {
|
||||||
|
const res = await listProjectInfo(form.value);
|
||||||
|
projectList.value = res.rows;
|
||||||
|
}
|
||||||
|
const pitchOnProject = (e) => {
|
||||||
|
list.value[projectIndex.value].projectName = e.projectName
|
||||||
|
list.value[projectIndex.value].projectId = e.projectId
|
||||||
|
list.value[projectIndex.value].projectCode = e.projectCode
|
||||||
|
popupRef.value.close()
|
||||||
|
}
|
||||||
|
const pageHeight = ref(0)
|
||||||
|
const barHeight = ref(0)
|
||||||
|
const sys = uni.getSystemInfoSync()
|
||||||
|
onMounted(() => {
|
||||||
|
setTimeout(() => {
|
||||||
|
if ((process.env.UNI_PLATFORM === 'app-plus' || process.env.UNI_PLATFORM === 'app')) {
|
||||||
|
const statusBarHeight = plus.navigator.getStatusbarHeight()
|
||||||
|
barHeight.value = statusBarHeight
|
||||||
|
pageHeight.value = sys.windowHeight - statusBarHeight
|
||||||
|
} else {
|
||||||
|
pageHeight.value = sys.windowHeight
|
||||||
|
}
|
||||||
|
}, 100)
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.list {
|
||||||
|
margin-top: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item {
|
||||||
|
width: 670rpx;
|
||||||
|
margin-left: 20rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
padding: 20rpx;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
|
||||||
|
.itemTitle {
|
||||||
|
font-size: 24rpx;
|
||||||
|
margin-bottom: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.formItem {
|
||||||
|
margin-bottom: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
font-size: 24rpx;
|
||||||
|
margin-bottom: 12rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.inputBg {
|
||||||
|
border-radius: 10rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
padding-left: 10rpx;
|
||||||
|
border: 1rpx solid #eee;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.projectList {
|
||||||
|
background-color: #eee;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.textArea {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #333;
|
||||||
|
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,12 @@
|
|||||||
|
export const getHeight = (dom, proxy) => {
|
||||||
|
let height = 0
|
||||||
|
|
||||||
|
uni.createSelectorQuery()
|
||||||
|
.in(proxy)
|
||||||
|
.select(dom)
|
||||||
|
.boundingClientRect(rect => {
|
||||||
|
height = rect.height
|
||||||
|
})
|
||||||
|
.exec()
|
||||||
|
return height
|
||||||
|
};
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
import {
|
||||||
|
getGlobalData
|
||||||
|
} from '@/store/index.js'
|
||||||
|
const back = () => {
|
||||||
|
const pages = getCurrentPages()
|
||||||
|
if (pages.length === 1) {
|
||||||
|
uni.reLaunch({
|
||||||
|
url: '/pages/workbench/index'
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.navigateBack()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const push = (a, b) => {
|
||||||
|
let routeList = getGlobalData('route')
|
||||||
|
let type = b || 1
|
||||||
|
if (type === 1) {
|
||||||
|
uni.navigateTo(a)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const router = {
|
||||||
|
back,
|
||||||
|
push
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue