上传附件及回显

This commit is contained in:
yangzhq68909 2024-10-14 15:22:41 +08:00
parent 6202ab0f4c
commit 1e857671cb
6 changed files with 4992 additions and 3061 deletions

View File

@ -44,7 +44,7 @@
<view>
请假天数
</view>
<text>{{info.qjdays}}</text>
<text>{{info.days}}</text>
</view>
<view class="info f-row aic jcb">
<view>
@ -64,6 +64,12 @@
</view>
<text>{{info.reason}}</text>
</view>
<view class="info f-row aic jcb">
<view>
附件
</view>
<uni-file-picker v-model="imageValue" :image-styles="imageStyles" />
</view>
</view>
</view>
<view class="f-col aic">
@ -106,13 +112,26 @@
watch,
onMounted
} from 'vue'
import {
imgUrl
} from '@/utils/index.js';
const props = defineProps({
dataId: {
type: String,
default: ''
},
})
const imageValue = ref([])
const imageStyles = {
width: 64,
height: 64,
border: {
color: "#dce7e1",
width: 2,
style: 'dashed',
radius: '2px'
}
}
const info = ref({})
//
const qjQueryById = () => {
@ -121,10 +140,23 @@
}).then((res) => {
if (res.success) {
info.value = res.result.records[0]
// imageValue
imageValue.value = info.value.path.split(',').map(path => {
const name = path.split('/').pop(); //
const extname = name.split('.').pop(); //
return {
name,
extname,
url: imgUrl(path)
};
});
console.log('---',imageValue.value)
}
})
}
}
/**审批步骤*/
const extActFlowData = () => {
extActFlowDataApi({

View File

@ -68,17 +68,22 @@
<view class="title">
请假地点
</view>
<input v-model="address" type="text" placeholder="请输入"
placeholder-style="font-size: 28rpx;color: #999999;" />
<input v-model="address" placeholder="请输入" nplaceholder-style="font-size: 28rpx;color: #999999;" />
</view>
<view class="f-row aic jcb input_box">
<view class="title">
请假事由
</view>
<input v-model="reason" placeholder="请输入" placeholder-style="font-size: 28rpx;color: #999999;" />
</view>
<view class="f-row aic jcb input_box">
<view class="title">
上传附件
</view>
<uni-file-picker @select="select" :image-styles="imageStyles"/>
</view>
</view>
<view class="reason f-col">
<view class="title">
请假事由
</view>
<textarea v-model="reason" placeholder="请输入请假事由" placeholder-style="font-size: 28rpx;color: #999999;"
cols="30" rows="10"></textarea>
</view>
<view class="btn f-col aic">
<view @click="qjAdd">
提交
@ -146,11 +151,41 @@
const address = ref('')
/**请假事由*/
const reason = ref('')
/**附件路径*/
const path = ref([])
const baseUrl = import.meta.env.VITE_REQUEST_BASE_URL + '/jeecg-boot/sys/common/upload/'
const imageStyles = {
width: 64,
height: 64,
border: {
color: "#dce7e1",
width: 2,
style: 'dashed',
radius: '2px'
}
}
onLoad(() => {
loadData()
})
const select = (e) => {
const tempFilePaths = e.tempFilePaths
for (let i = 0; i < e.tempFilePaths.length; i++) {
let photoPath = '职工请假/' + store.userinfo.orgCode + '/' + store.userinfo.realname
uni.uploadFile({
url: baseUrl,
filePath: e.tempFilePaths[i],
name: 'file',
formData: {
appPath: photoPath
},
success: (res) => {
path.value.push(JSON.parse(res.data).message)
}
});
}
}
const qjAdd = () => {
if (!phone.value.trim()) return proxy.$toast('请输入联系方式')
if (!type.value) return proxy.$toast('请选择请假类型')
@ -172,7 +207,8 @@
examineleader: typeArr.value[typeIndex.value].username,
address: address.value,
reason: reason.value,
zwcj: zwcj.value,
zwmc: zwcj.value,
path: path.value.toString()
}).then((res) => {
if (res.success) {
startMutilProcess(res.message)
@ -181,6 +217,7 @@
}
})
}
const startMutilProcess = (id) => {
startMutilProcessApi({
flowCode: "dev_cxc_qxj",
@ -300,60 +337,4 @@
color: #333333;
}
}
.reason {
background-color: #fff;
margin-top: 20rpx;
height: 290rpx;
padding: 30rpx;
.title {
font-size: 28rpx;
color: #333333;
}
textarea {
width: 100%;
margin-top: 20rpx;
}
}
// .progress_box {
// background-color: #fff;
// margin-top: 20rpx;
// padding: 30rpx;
// .title {
// font-size: 28rpx;
// color: #333333;
// }
// .avatar {
// width: 78rpx;
// height: 78rpx;
// border-radius: 38rpx;
// background-color: #333333;
// margin-top: 30rpx;
// }
// text {
// font-size: 24rpx;
// color: #333333;
// margin-top: 10rpx;
// }
// .line {
// width: 91rpx;
// height: 17rpx;
// margin: 0 40rpx;
// }
// }
.lines {
height: 20rpx;
background-color: #F8F8F8;
}
</style>

View File

@ -54,7 +54,7 @@
import {
useStore
} from '@/store';
const baseUrl = import.meta.env.VITE_REQUEST_BASE_URL + '/jeecg-boot'
const baseUrl = import.meta.env.VITE_REQUEST_BASE_URL + '/jeecg-boot/sys/common/upload'
const store = useStore()
const jump = (url) => {
@ -65,23 +65,23 @@
})
}
const chooseAvatar = () => {
uni.chooseImage({
count: 1,
success: (chooseImageRes) => {
const tempFilePaths = chooseImageRes.tempFilePaths;
const photoPath = '用户头像/' + store.userinfo.realname
uni.uploadFile({
url: baseUrl + '/sys/common/upload', //
url: baseUrl, //
filePath: tempFilePaths[0],
name: 'file',
header: {
"X-Access-Token": store.token
formData: {
appPath: photoPath
},
success: (uploadFileRes) => {
success: (res) => {
uni.showLoading({
title: '上传中...'
})
form.avatar = JSON.parse(uploadFileRes.data).message
form.avatar = JSON.parse(res.data).message
userEditApi({
avatar: form.avatar,
id: store.userinfo.id
@ -134,7 +134,6 @@
frontColor: "#ffffff",
backgroundColor: '#bebebe'
})
})
</script>

File diff suppressed because one or more lines are too long

View File

@ -49,6 +49,282 @@
.aic {
align-items: center;
}
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
* 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量同时无需 import 这个文件
*/
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
.uni-file-picker__container[data-v-bdfc07e0] {
display: flex;
box-sizing: border-box;
flex-wrap: wrap;
margin: -5px;
}
.file-picker__box[data-v-bdfc07e0] {
position: relative;
width: 33.3%;
height: 0;
padding-top: 33.33%;
box-sizing: border-box;
}
.file-picker__box-content[data-v-bdfc07e0] {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
margin: 5px;
border: 1px #eee solid;
border-radius: 5px;
overflow: hidden;
}
.file-picker__progress[data-v-bdfc07e0] {
position: absolute;
bottom: 0;
left: 0;
right: 0;
/* border: 1px red solid; */
z-index: 2;
}
.file-picker__progress-item[data-v-bdfc07e0] {
width: 100%;
}
.file-picker__mask[data-v-bdfc07e0] {
display: flex;
justify-content: center;
align-items: center;
position: absolute;
right: 0;
top: 0;
bottom: 0;
left: 0;
color: #fff;
font-size: 12px;
background-color: rgba(0, 0, 0, 0.4);
}
.file-image[data-v-bdfc07e0] {
width: 100%;
height: 100%;
}
.is-add[data-v-bdfc07e0] {
display: flex;
align-items: center;
justify-content: center;
}
.icon-add[data-v-bdfc07e0] {
width: 50px;
height: 5px;
background-color: #f1f1f1;
border-radius: 2px;
}
.rotate[data-v-bdfc07e0] {
position: absolute;
transform: rotate(90deg);
}
.icon-del-box[data-v-bdfc07e0] {
display: flex;
align-items: center;
justify-content: center;
position: absolute;
top: 3px;
right: 3px;
height: 26px;
width: 26px;
border-radius: 50%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 2;
transform: rotate(-45deg);
}
.icon-del[data-v-bdfc07e0] {
width: 15px;
height: 2px;
background-color: #fff;
border-radius: 2px;
}
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
* 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量同时无需 import 这个文件
*/
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
.uni-file-picker__files[data-v-a54939c6] {
display: flex;
flex-direction: column;
justify-content: flex-start;
}
.uni-file-picker__lists[data-v-a54939c6] {
position: relative;
margin-top: 5px;
overflow: hidden;
}
.file-picker__mask[data-v-a54939c6] {
display: flex;
justify-content: center;
align-items: center;
position: absolute;
right: 0;
top: 0;
bottom: 0;
left: 0;
color: #fff;
font-size: 14px;
background-color: rgba(0, 0, 0, 0.4);
}
.uni-file-picker__lists-box[data-v-a54939c6] {
position: relative;
}
.uni-file-picker__item[data-v-a54939c6] {
display: flex;
align-items: center;
padding: 8px 10px;
padding-right: 5px;
padding-left: 10px;
}
.files-border[data-v-a54939c6] {
border-top: 1px #eee solid;
}
.files__name[data-v-a54939c6] {
flex: 1;
font-size: 14px;
color: #666;
margin-right: 25px;
word-break: break-all;
word-wrap: break-word;
}
.icon-files[data-v-a54939c6] {
position: static;
background-color: initial;
}
.is-list-card[data-v-a54939c6] {
border: 1px #eee solid;
margin-bottom: 5px;
border-radius: 5px;
box-shadow: 0 0 2px 0px rgba(0, 0, 0, 0.1);
padding: 5px;
}
.files__image[data-v-a54939c6] {
width: 40px;
height: 40px;
margin-right: 10px;
}
.header-image[data-v-a54939c6] {
width: 100%;
height: 100%;
}
.is-text-box[data-v-a54939c6] {
border: 1px #eee solid;
border-radius: 5px;
}
.is-text-image[data-v-a54939c6] {
width: 25px;
height: 25px;
margin-left: 5px;
}
.rotate[data-v-a54939c6] {
position: absolute;
transform: rotate(90deg);
}
.icon-del-box[data-v-a54939c6] {
display: flex;
margin: auto 0;
align-items: center;
justify-content: center;
position: absolute;
top: 0px;
bottom: 0;
right: 5px;
height: 26px;
width: 26px;
z-index: 2;
transform: rotate(-45deg);
}
.icon-del[data-v-a54939c6] {
width: 15px;
height: 1px;
background-color: #333;
}
.uni-file-picker[data-v-6223573f] {
box-sizing: border-box;
overflow: hidden;
width: 100%;
flex: 1;
}
.uni-file-picker__header[data-v-6223573f] {
padding-top: 5px;
padding-bottom: 10px;
display: flex;
justify-content: space-between;
}
.file-title[data-v-6223573f] {
font-size: 14px;
color: #333;
}
.file-count[data-v-6223573f] {
font-size: 14px;
color: #999;
}
.is-add[data-v-6223573f] {
display: flex;
align-items: center;
justify-content: center;
}
.icon-add[data-v-6223573f] {
width: 50px;
height: 5px;
background-color: #f1f1f1;
border-radius: 2px;
}
.rotate[data-v-6223573f] {
position: absolute;
transform: rotate(90deg);
}
/**
* 这里是uni-app内置的常用样式变量
*

View File

@ -530,6 +530,282 @@
text-decoration: none;
text-align: center;
}
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
* 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量同时无需 import 这个文件
*/
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
.uni-file-picker__container[data-v-bdfc07e0] {
display: flex;
box-sizing: border-box;
flex-wrap: wrap;
margin: -5px;
}
.file-picker__box[data-v-bdfc07e0] {
position: relative;
width: 33.3%;
height: 0;
padding-top: 33.33%;
box-sizing: border-box;
}
.file-picker__box-content[data-v-bdfc07e0] {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
margin: 5px;
border: 1px #eee solid;
border-radius: 5px;
overflow: hidden;
}
.file-picker__progress[data-v-bdfc07e0] {
position: absolute;
bottom: 0;
left: 0;
right: 0;
/* border: 1px red solid; */
z-index: 2;
}
.file-picker__progress-item[data-v-bdfc07e0] {
width: 100%;
}
.file-picker__mask[data-v-bdfc07e0] {
display: flex;
justify-content: center;
align-items: center;
position: absolute;
right: 0;
top: 0;
bottom: 0;
left: 0;
color: #fff;
font-size: 12px;
background-color: rgba(0, 0, 0, 0.4);
}
.file-image[data-v-bdfc07e0] {
width: 100%;
height: 100%;
}
.is-add[data-v-bdfc07e0] {
display: flex;
align-items: center;
justify-content: center;
}
.icon-add[data-v-bdfc07e0] {
width: 50px;
height: 5px;
background-color: #f1f1f1;
border-radius: 2px;
}
.rotate[data-v-bdfc07e0] {
position: absolute;
transform: rotate(90deg);
}
.icon-del-box[data-v-bdfc07e0] {
display: flex;
align-items: center;
justify-content: center;
position: absolute;
top: 3px;
right: 3px;
height: 26px;
width: 26px;
border-radius: 50%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 2;
transform: rotate(-45deg);
}
.icon-del[data-v-bdfc07e0] {
width: 15px;
height: 2px;
background-color: #fff;
border-radius: 2px;
}
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
* 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量同时无需 import 这个文件
*/
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
.uni-file-picker__files[data-v-a54939c6] {
display: flex;
flex-direction: column;
justify-content: flex-start;
}
.uni-file-picker__lists[data-v-a54939c6] {
position: relative;
margin-top: 5px;
overflow: hidden;
}
.file-picker__mask[data-v-a54939c6] {
display: flex;
justify-content: center;
align-items: center;
position: absolute;
right: 0;
top: 0;
bottom: 0;
left: 0;
color: #fff;
font-size: 14px;
background-color: rgba(0, 0, 0, 0.4);
}
.uni-file-picker__lists-box[data-v-a54939c6] {
position: relative;
}
.uni-file-picker__item[data-v-a54939c6] {
display: flex;
align-items: center;
padding: 8px 10px;
padding-right: 5px;
padding-left: 10px;
}
.files-border[data-v-a54939c6] {
border-top: 1px #eee solid;
}
.files__name[data-v-a54939c6] {
flex: 1;
font-size: 14px;
color: #666;
margin-right: 25px;
word-break: break-all;
word-wrap: break-word;
}
.icon-files[data-v-a54939c6] {
position: static;
background-color: initial;
}
.is-list-card[data-v-a54939c6] {
border: 1px #eee solid;
margin-bottom: 5px;
border-radius: 5px;
box-shadow: 0 0 2px 0px rgba(0, 0, 0, 0.1);
padding: 5px;
}
.files__image[data-v-a54939c6] {
width: 40px;
height: 40px;
margin-right: 10px;
}
.header-image[data-v-a54939c6] {
width: 100%;
height: 100%;
}
.is-text-box[data-v-a54939c6] {
border: 1px #eee solid;
border-radius: 5px;
}
.is-text-image[data-v-a54939c6] {
width: 25px;
height: 25px;
margin-left: 5px;
}
.rotate[data-v-a54939c6] {
position: absolute;
transform: rotate(90deg);
}
.icon-del-box[data-v-a54939c6] {
display: flex;
margin: auto 0;
align-items: center;
justify-content: center;
position: absolute;
top: 0px;
bottom: 0;
right: 5px;
height: 26px;
width: 26px;
z-index: 2;
transform: rotate(-45deg);
}
.icon-del[data-v-a54939c6] {
width: 15px;
height: 1px;
background-color: #333;
}
.uni-file-picker[data-v-6223573f] {
box-sizing: border-box;
overflow: hidden;
width: 100%;
flex: 1;
}
.uni-file-picker__header[data-v-6223573f] {
padding-top: 5px;
padding-bottom: 10px;
display: flex;
justify-content: space-between;
}
.file-title[data-v-6223573f] {
font-size: 14px;
color: #333;
}
.file-count[data-v-6223573f] {
font-size: 14px;
color: #999;
}
.is-add[data-v-6223573f] {
display: flex;
align-items: center;
justify-content: center;
}
.icon-add[data-v-6223573f] {
width: 50px;
height: 5px;
background-color: #f1f1f1;
border-radius: 2px;
}
.rotate[data-v-6223573f] {
position: absolute;
transform: rotate(90deg);
}
/**
* 这里是uni-app内置的常用样式变量
*
@ -1044,22 +1320,4 @@ body {
.form .choosed[data-v-f12ae642] {
font-size: 0.875rem;
color: #333333;
}
.reason[data-v-f12ae642] {
background-color: #fff;
margin-top: 0.625rem;
height: 9.0625rem;
padding: 0.9375rem;
}
.reason .title[data-v-f12ae642] {
font-size: 0.875rem;
color: #333333;
}
.reason uni-textarea[data-v-f12ae642] {
width: 100%;
margin-top: 0.625rem;
}
.lines[data-v-f12ae642] {
height: 0.625rem;
background-color: #F8F8F8;
}