Browse Source

到访预约改h5+api

塔里木分支
hwh2023 1 year ago
parent
commit
c7bf5617cd
9 changed files with 556 additions and 3 deletions
  1. +4
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/VisitManage/Form.cshtml
  2. +1
    -0
      Learun.Framework.Ultimate V7/Learun.Application.WebApi/Learun.Application.WebApi.csproj
  3. +1
    -1
      Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/BaseApi.cs
  4. +46
    -0
      Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/VisitmanageApi.cs
  5. +1
    -1
      Learun.Framework.Ultimate V7/Learun.Application.WebApi/XmlConfig/system.config
  6. +1
    -1
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/App.vue
  7. +216
    -0
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/components/upload-file3.vue
  8. +7
    -0
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages.json
  9. +279
    -0
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/visitmanage/index.vue

+ 4
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/VisitManage/Form.cshtml View File

@@ -27,6 +27,10 @@
<div class="lr-form-item-title">学校联系人</div>
<input id="Contact" class="form-control" readonly disabled />
</div>
<div class="col-xs-12 lr-form-item" data-table="VisitManage">
<div class="lr-form-item-title">联系人电话</div>
<input id="Contacttel" class="form-control" readonly disabled />
</div>
<div class="col-xs-12 lr-form-item" data-table="VisitManage">
<div class="lr-form-item-title">到访事项</div>
<input id="Reason" class="form-control" readonly disabled />


+ 1
- 0
Learun.Framework.Ultimate V7/Learun.Application.WebApi/Learun.Application.WebApi.csproj View File

@@ -220,6 +220,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Bootstraper.cs" />
<Compile Include="Modules\VisitmanageApi.cs" />
<Compile Include="Modules\LessonInfoOfElectiveOnlineApi.cs" />
<Compile Include="Modules\RepairReport\RepairReportTeacherApi.cs" />
<Compile Include="Modules\RepairReport\RepairReportStudentApi.cs" />


+ 1
- 1
Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/BaseApi.cs View File

@@ -191,7 +191,7 @@ namespace Learun.Application.WebApi
ReqParameter req = this.Bind<ReqParameter>();
loginMark = req.loginMark;
token = req.token;
if (path == "/learun/adms/user/login"|| path == "/learun/adms/user/loginbyIdCard" || path == "/" || path == "/bgimg" || path == "/learun/adms/user/img" || path == "/learun/adms/desktop/img"||path== "/learun/adms/user/imgfordc"||path== "/learun/adms/timetable/timeTableData"||path== "/quanjiang/sso/authorize")
if (path == "/learun/adms/user/login"|| path == "/learun/adms/user/loginbyIdCard" || path == "/" || path == "/bgimg" || path == "/learun/adms/user/img" || path == "/learun/adms/desktop/img"||path== "/learun/adms/user/imgfordc"||path== "/learun/adms/timetable/timeTableData"||path== "/quanjiang/sso/authorize"||path== "/learun/nologin/adms/annexes/upload"||path== "/learun/adms/annexes/wxlist" || path == "/learun/visitmanage/save")
{// 登录接口,默认页面接口不做权限验证处理
return null;
}


+ 46
- 0
Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/VisitmanageApi.cs View File

@@ -0,0 +1,46 @@
using Learun.Application.Base.SystemModule;
using Learun.Application.TwoDevelopment.LR_Desktop;
using Learun.Util;
using Nancy;
using System;
using System.Collections.Generic;
using System.IO;

namespace Learun.Application.WebApi.Modules
{
public class VisitmanageApi : BaseApi
{
public VisitmanageApi()
: base("/learun/visitmanage")
{

Post["/save"] = SaveForm;
}
private VisitManageBLL visitIBLL = new VisitManageBLL();

/// <summary>
/// 保存实体数据(新增、修改)
/// <param name="_"></param>
/// <summary>
/// <returns></returns>
public Response SaveForm(dynamic _)
{
ReqFormEntity parameter = this.GetReqData<ReqFormEntity>();
VisitManageEntity entity = parameter.strEntity.ToObject<VisitManageEntity>();
visitIBLL.SaveEntity(parameter.keyValue, entity);
return Success("保存成功!");
}

#region 私有类

/// <summary>
/// 表单实体类
/// <summary>
private class ReqFormEntity
{
public string keyValue { get; set; }
public string strEntity { get; set; }
}
#endregion
}
}

+ 1
- 1
Learun.Framework.Ultimate V7/Learun.Application.WebApi/XmlConfig/system.config View File

@@ -65,7 +65,7 @@

<add key="userKey" value="14B417B0-463D-4F2B-8075-0A20EEDB773A" />
<!-- ==================注意附件上传地址 修改到主网站部署目录下的Resource要不然飞星会报错================== -->
<add key="AnnexesFile" value="E:\西昌程序单校区版2019_09_16\Learun.Framework.Ultimate V7\Learun.Application.Web\Resource" />
<add key="AnnexesFile" value="D:\work\DigitalScholl\Learun.Framework.Ultimate V7\Learun.Application.Web\Resource" />
<add key="ReportFile" value="~/Reports" />
<!-- ================== 工作流服务地址 ================== -->
<add key="workflowapi" value="http://localhost:8013" />


+ 1
- 1
Learun.Framework.Ultimate V7/LearunApp-2.2.0/App.vue View File

@@ -12,7 +12,7 @@
// H5 刷新时获取当前页面路径
const pagePath = "/" + param.path;
// 如果 H5 刷新后访问的不是首页/登录页/注册页,直接跳转回首页
if (!["/pages/login","/pages/weixinLogin","/pages/wxLogin", "/pages/home", "/pages/signup","/pages/my/newpassword"].includes(pagePath)) {
if (!["/pages/login","/pages/weixinLogin","/pages/wxLogin", "/pages/home", "/pages/signup","/pages/my/newpassword","/pages/visitmanage/index"].includes(pagePath)) {
this.$nextTick(() => {
this.TAB_TO("/pages/home");
return;


+ 216
- 0
Learun.Framework.Ultimate V7/LearunApp-2.2.0/components/upload-file3.vue View File

@@ -0,0 +1,216 @@
<template>
<view>
<view class="cu-form-group" style="border-bottom: none; padding-bottom: 0;">
<view class="title">
<text v-if="required" class="lr-required">*</text>
{{ title || '' }}
</view>
</view>
<view class="cu-form-group">
<view class="grid col-4 grid-square flex-sub">
<view v-for="(item, index) in imgList" @tap="viewImg(item)" :key="index" class="bg-img">
<image v-if="showfile()&&item&&(typeof item == 'string'||isImage(item.type))" :src="item.url?CONFIG('webHost') + item.url:item" mode="aspectFill">
</image>
<l-icon v-if="showfile()&&!isImage(item.type)" type="text" />
<text class="file-name">{{item.name}}</text>
<view v-if="!readonly" @tap.stop="delImg(index)" class="cu-tag bg-red"
style="width: 18px; height: 18px; font-size: 24px">
<l-icon type="close" style="width: 18px; height: 18px; font-size: 12px" />
</view>
</view>
<view v-if="!readonly && imgList.length < Number(number)" @click="chooseFile" class="solids">
<l-icon type="file" />
</view>
</view>
</view>
</view>

</template>

<script>
/**
* 附件上传组件
* 使用相机拍摄 和 从相册选图
*
* 注意:可以选择图片;如果选择文档的话则是从手机的‘文件管理’里面去选择,有可能会找不到文档;
*/
export default {

props: {
number: {
default: 1
},
readonly: {},
value: {
default: () => []
},
folderId: {},
title: {},
required: false
},

data() {
return {
isShow: false,
imgList: [],
}
},

methods: {
chooseFile() {
uni.chooseImage({
count: Number(this.number),
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success: ({ tempFilePaths,tempFiles }) => {
tempFilePaths.forEach((item, i) => {
this.chooseChangeback(tempFilePaths[i],tempFiles[i])
})
}
})
},
delImg(index) {
this.CONFIRM("", "是否确认删除?", true).then(res => {
if(!res)return
this.LOADING('正在删除…');
const newList = JSON.parse(JSON.stringify(this.imgList));
this.HTTP_POST('learun/adms/annexes/wxdelete', this.imgList[index].id, "文件删除失败").then((data) => {
this.HIDE_LOADING();
if (data) {
newList.splice(index, 1);
this.imgList = newList

this.$emit("update:value", newList);
this.$emit("input", newList);
this.$emit("change");
this.$emit("del");
}
})
})

},
showfile() {
return true;
},

async chooseChangeback(tempFilePaths, tempFiles) {
// console.log(tempFilePaths,22)
let uploadImageRes = await this.uploadImage(tempFilePaths, tempFiles ? tempFiles.name : "")
let newList = this.imgList || []
if (uploadImageRes) {
//请求‘获取附件列表’接口
let data = await this.FETCH_FILEList(uploadImageRes);
// console.log(data,33)
if(data){
newList = data.map(t=>({
id: t.F_Id,
name: t.F_FileName,
url: t.F_FilePath.substring(t.F_FilePath.indexOf('Resource')),
type: t.F_FileType,
folderid:t.F_FolderId,
}))
}
}

this.imgList = newList

this.$emit("update:value", newList);
this.$emit("input", newList);
this.$emit("change", newList);
},

uploadImage(url, name) {
if (!url) return
// 文件上传
return new Promise(async (reslove, reject) => {
this.LOADING('正在上传…');
let params = name ? {
folderId: this.folderId,
name
} : {
folderId: this.folderId
}
this.HTTP_UPLOAD2('learun/nologin/adms/annexes/upload', url, params).then((data) => {
this.HIDE_LOADING();
if (data) {
reslove(data)
} else {
reject('上传失败!')
}
})
})

},
validate(array) {
// let type = array.every(item=>{
// return item.type && item.type.substring(0,6) == "image/"
// })
// if(!type){
// this.TOAST('文件类型错误');
// return false
// }
let size = array.every(item => {
return item.size && item.size <= 200 * 1024 * 1024
})
if (!size) {
this.TOAST('文件大小不得超过200M');
return false
}
return true
},

isImage(type) {
if (type && type.length) {
return ["png", "jpg"].includes(type.substring(type.length - 3, type.length))
} else {
return false
}
},

viewImg(item) {
if (!this.isImage(item.type)) {
window.location.href = this.CONFIG("webHost") + item.url
} else {
uni.previewImage({
urls: [this.CONFIG('webHost') + item.url],
current: this.CONFIG('webHost') + item.url
});
}
},
},
created() {
// console.log(this.value)
this.imgList = JSON.parse(JSON.stringify(this.value.map(item => {
return {
id: item.F_Id,
name: item.F_FileName,
url: item.F_FilePath.substring(item.F_FilePath.indexOf('Resource')),
type: item.F_FileType,
folderid:item.F_FolderId,
}
})))
this.$nextTick(() => {
this.isShow = true
})
}
};
</script>

<style scoped>
.file-name {
position: absolute;
bottom: 0;
width: 100%;
color: #606266;
font-size: 12px;
text-align: center;
background-color: rgba(255, 255, 255, 0.6);

text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
</style>

+ 7
- 0
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages.json View File

@@ -1251,6 +1251,13 @@
"style": {
"navigationBarTitleText": "学生报修处理详情"
}
},
//到访预约
{
"path": "pages/visitmanage/index",
"style": {
"navigationBarTitleText": "到访预约"
}
}


+ 279
- 0
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/visitmanage/index.vue View File

@@ -0,0 +1,279 @@
<template>
<view class="page">
<view>
<l-input @input="setValue('visitform.Name', $event)" :value="getValue('visitform.Name')" title="姓名"
required></l-input>
<l-input @input="setValue('visitform.Tel', $event)" :value="getValue('visitform.Tel')" title="联系电话"
required></l-input>
<l-date-picker @input="setValue('visitform.Visitdate', $event)" :value="getValue('visitform.Visitdate')"
title="到访日期" required />
<l-datetime-picker @input="setValue('visitform.Visittime', $event)" :value="getValue('visitform.Visittime')"
required title="到访时间" />
<l-input @input="setValue('visitform.VisitDept', $event)" :value="getValue('visitform.VisitDept')"
title="到访部门" required></l-input>
<l-input @input="setValue('visitform.Contact', $event)" :value="getValue('visitform.Contact')" title="学校联系人"
required></l-input>
<l-input @input="setValue('visitform.Contacttel', $event)" :value="getValue('visitform.Contacttel')"
title="联系人电话" required></l-input>
<l-input @input="setValue('visitform.Reason', $event)" :value="getValue('visitform.Reason')" title="到访事由"
required></l-input>
<l-input @input="setValue('visitform.Files', $event)" :value="getValue('visitform.Files')"
disabled="disabled" v-show="false" title="身份证正面" required />
<uploadFile @input="inputValue" :number="5" :folderId="folderId" :value="fileList" title="身份证正面"
:required="true"></uploadFile>
</view>
<view class="bg-white margin-tb padding" style="padding-top: 0; overflow: hidden;">
<l-button @click="action('save')" size="lg" color="green" class="block margin-top" block>
提交
</l-button>
</view>
</view>
</template>


<script>
/*
* 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn)
* Copyright (c) 2013-2020 上海力软信息技术有限公司
* 创建人:超级管理员
* 日 期:2020-10-20 09:25
* 描 述:活动安排
*/

/**
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录:
* { "path": "pages/PersonnelManagement/BookBorrow/single", "style": { "navigationBarTitleText": "表单详情页" } }
*
* (navigationBarTitleText 字段为本页面的标题文本,可以修改)
* (必须自行操作该步骤,力软代码生成器不会自动帮您修改 /pages.json 文件)
*/

import get from 'lodash/get'
import set from 'lodash/set'
import moment from 'moment'
import customPageMixins from '@/common/custompage.js'
import uploadFile from '@/components/upload-file3.vue'

export default {
mixins: [customPageMixins],
components: {
uploadFile,
},
data() {
return {
// 页面相关参数
id: null,
mode: null,
edit: null,
evaluate: null,
ready: false,
current: '',
// 表单数据
fileList: [], //附件列表
fileListvalue: [],
folderId: null, //附件随机文件夹id
fileTitle: '故障图片', //附件label值
// 表单项数据结构
scheme: {
visitform: {
Name: {
type: 'text',
title: '姓名'
},
Tel: {
type: 'text',
title: '联系电话'
},

Visitdate: {
type: 'text',
title: '到访日期'
},
Visittime: {
type: 'text',
title: '到访时间'
},
VisitDept: {
type: 'text',
title: '到访部门'
},

Contact: {
type: 'text',
title: '学校联系人'
},
Contacttel: {
type: 'text',
title: '联系人电话'
},
Reason: {
type: 'text',
title: '到访事由'
},
Files: {},
openid: {}
}
},
// 数据源
dataSource: {

}
}
},
async onLoad() {
await this.init()
},
methods: {
async init() {
await this.fetchForm()
// this.folderId = this.GUID();
// this.loginInit()
},
inputValue(val) {
this.fileList = val;

this.setValue('visitform.Files', this.fileList[0].folderid);
},
// 加载表单数据
async fetchForm() {
this.origin = await this.getDefaultForm()
this.current = this.COPY(this.origin)
},
// 点击 「编辑」、「重置」、「保存」、「删除」 按钮
async action(type) {
switch (type) {
case 'reset':
this.current = this.COPY(this.origin)
this.edit = false
break
case 'save':
const verifyResult = this.verifyForm()
// console.log(verifyResult,555)
if (verifyResult.length > 0) {
this.CONFIRM('表单验证失败', verifyResult.join('\n'))
return
}
if (!this.getValue('visitform.Name')) {
this.TOAST("姓名不能为空!")
return
}
if (!this.getValue('visitform.Tel')) {
this.TOAST("联系方式不能为空!")
return
}
if (!this.getValue('visitform.Visitdate')) {
this.TOAST("到访日期不能为空!")
return
}
if (!this.getValue('visitform.Visittime')) {
this.TOAST("到访时间不能为空!")
return
}
if (!this.getValue('visitform.VisitDept')) {
this.TOAST("到访部门不能为空!")
return
}
if (!this.getValue('visitform.Contact')) {
this.TOAST("学校联系人不能为空!")
return
}
if (!this.getValue('visitform.Contacttel')) {
this.TOAST("联系人电话不能为空!")
return
}
if (!this.getValue('visitform.Reason')) {
this.TOAST("到访事由不能为空!")
return
}
if (this.fileList.length <= 0) {
this.TOAST("请上传身份证正面照!")
return
}


if (!(await this.CONFIRM('提交确认', '确定要提交吗?', true))) {
return
}

// this.LOADING('正在提交...')
const postData = await this.getPostData(this.id)
let strEntity = JSON.parse(postData.strEntity)
console.log(postData)
this.HTTP_POST('learun/visitmanage/save', postData, '表单提交保存失败').then(success => {
this.HIDE_LOADING()
if (!success) {
return
}

this.EMIT('LogisticsManagementRepairReportTeacher-list-change')
this.NAV_BACK()
this.TOAST('提交成功')
})
break


default:
break
}
},

loginInit() {
if (this.code) {
this.LOADING("加载中...")
this.HTTP_POST("weixinapi/getweixinaccess_token?code=" + this.code, null).then(success => {
this.HIDE_LOADING()
if (!success) {
location.href = "http://" + window.location.host;
return
}
if (success.logined) {
// var logininfo = {
// account: account,
// token: success.baseinfo.token,
// date: moment().format('yyyy-MM-dd hh:mm:ss')
// };
this.SET_STORAGE("token", success.baseinfo.token)
// this.SET_STORAGE("logininfo",logininfo)
// this.SET_STORAGE("userinfo",success)
location.href = "http://" + window.location.host;
// location.href = "http://" + window.location.host;
} else {
// this.ready = true
this.visitform.openid = success.openid
}
})
} else {
this.HIDE_LOADING();
this.HTTP_GET("weixinapi/weixinconfig").then(success => {
if (!success) {
return
}
window.location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" +
success.appid + "&redirect_uri=" + encodeURIComponent('http://' + window.location
.host + '/#/pages/wxLogin') +
"&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect";
})
}
},
// 获取表单值
getValue(path) {
return get(this.current, path)
},

// 设置表单值
setValue(path, val) {
set(this.current, path, val)
},
}
}
</script>
<style lang="less" scoped>
.maintenancetitle {
text-align: center;
height: 80rpx;
line-height: 80rpx;
background: #0C86D8;
color: #fff;
}
</style>

Loading…
Cancel
Save