@@ -264,7 +264,7 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||||
var wechatemplete = weChatTempletIbll.GetWeChatTemplateEntityByCodeConfigId(WeChatConfigentity.ID, "task"); | var wechatemplete = weChatTempletIbll.GetWeChatTemplateEntityByCodeConfigId(WeChatConfigentity.ID, "task"); | ||||
string weixintaskurl = wechatemplete.TUrl; | string weixintaskurl = wechatemplete.TUrl; | ||||
string weixintasktempid = wechatemplete.TempId; | string weixintasktempid = wechatemplete.TempId; | ||||
var responsejson = Util.HttpMethods.HttpGet("https://capi.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + appid + "&secret=" + secret); | |||||
var responsejson = Util.HttpMethods.HttpGet("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + appid + "&secret=" + secret); | |||||
OperateLogModel operateLogModel = new OperateLogModel(); | OperateLogModel operateLogModel = new OperateLogModel(); | ||||
operateLogModel.title = title; | operateLogModel.title = title; | ||||
@@ -5,6 +5,7 @@ using System.Web.Mvc; | |||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using Learun.Util.Operat; | using Learun.Util.Operat; | ||||
using Newtonsoft.Json; | using Newtonsoft.Json; | ||||
using Learun.Loger; | |||||
namespace Learun.Application.Web.Areas.LR_Desktop.Controllers | namespace Learun.Application.Web.Areas.LR_Desktop.Controllers | ||||
{ | { | ||||
@@ -118,7 +119,7 @@ namespace Learun.Application.Web.Areas.LR_Desktop.Controllers | |||||
entity.Cancelnoticetime= System.DateTime.Now; | entity.Cancelnoticetime= System.DateTime.Now; | ||||
} | } | ||||
VisitManageIBLL.SaveEntity(keyValue,entity); | VisitManageIBLL.SaveEntity(keyValue,entity); | ||||
if (string.IsNullOrEmpty(keyValue)) | |||||
if (entity.IsNotice == "1") | |||||
{ | { | ||||
PushWeixin(entity, "到访预约通知"); | PushWeixin(entity, "到访预约通知"); | ||||
} | } | ||||
@@ -179,57 +180,62 @@ namespace Learun.Application.Web.Areas.LR_Desktop.Controllers | |||||
public void PushWeixin(VisitManageEntity vdata, string title) | public void PushWeixin(VisitManageEntity vdata, string title) | ||||
{ | { | ||||
//mNQx_dn1eIVyzQ2dB9lkHxqat1DoXyvJgtJ-xz5t5Zk | |||||
var WeChatConfigentity = weChatConfigIbll.GetEnableEntity(); | |||||
string appid = WeChatConfigentity.APPId; | |||||
string secret = WeChatConfigentity.secret; | |||||
var wechatemplete = weChatTempletIbll.GetWeChatTemplateEntityByCodeConfigId(WeChatConfigentity.ID, "task"); | |||||
string weixintaskurl = wechatemplete.TUrl; | |||||
string weixintasktempid = wechatemplete.TempId; | |||||
var responsejson = Util.HttpMethods.HttpGet("https://capi.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + appid + "&secret=" + secret); | |||||
OperateLogModel operateLogModel = new OperateLogModel(); | |||||
operateLogModel.title = title; | |||||
operateLogModel.type = OperationType.Other; | |||||
operateLogModel.url = "ArrangeLessonTermController"; | |||||
operateLogModel.sourceObjectId = "002"; | |||||
operateLogModel.sourceContentJson = responsejson; | |||||
OperatorHelper.Instance.WriteOperateLog(operateLogModel); | |||||
if (!string.IsNullOrEmpty(vdata.Openid)) | |||||
{ | |||||
//执行推送任务 | |||||
if (!string.IsNullOrEmpty(appid) && !string.IsNullOrEmpty(secret) && !string.IsNullOrEmpty(weixintaskurl) && !string.IsNullOrEmpty(weixintasktempid)) | |||||
try | |||||
{ | |||||
//mNQx_dn1eIVyzQ2dB9lkHxqat1DoXyvJgtJ-xz5t5Zk | |||||
var WeChatConfigentity = weChatConfigIbll.GetEnableEntity(); | |||||
//string appid = "wx9bba72a124c32b58";// WeChatConfigentity.APPId; | |||||
//string secret = "3553f4244898c20e387ccc4d039b683e";// WeChatConfigentity.secret; | |||||
string appid = WeChatConfigentity.APPId; | |||||
string secret = WeChatConfigentity.secret; | |||||
string weixintasktempid = "mNQx_dn1eIVyzQ2dB9lkHxqat1DoXyvJgtJ-xz5t5Zk"; | |||||
var responsejson = Util.HttpMethods.HttpGet("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + appid + "&secret=" + secret); | |||||
//var log = LogFactory.GetLogger(this.GetType().ToString()); | |||||
//log.Info(responsejson); | |||||
if (!string.IsNullOrEmpty(vdata.Openid)) | |||||
{ | { | ||||
if (!string.IsNullOrEmpty(responsejson)) | |||||
//执行推送任务 | |||||
if (!string.IsNullOrEmpty(appid) && !string.IsNullOrEmpty(secret) && !string.IsNullOrEmpty(weixintasktempid)) | |||||
{ | { | ||||
var weixintokenobj = JsonConvert.DeserializeObject<dynamic>(responsejson); | |||||
if (string.IsNullOrEmpty(weixintokenobj.errcode)) | |||||
if (!string.IsNullOrEmpty(responsejson)) | |||||
{ | { | ||||
string access_token = weixintokenobj.access_token; | |||||
string jsondata = "{\"touser\":\"" + vdata.Openid + "\"," + | |||||
"\"template_id\":\"" + weixintasktempid + "\"," + | |||||
"\"url\":\"" + weixintaskurl + "\"," + | |||||
"\"data\":{" + | |||||
"\"thing3\": {\"value\":\"" + vdata.Name + "\",\"color\":\"#173177\"}," + | |||||
"\"character_string4\":{\"value\":\"您提交的到访预约申请已通过,请按预约时间到校。\",\"color\":\"#173177\"}," + | |||||
"\"time2\": {\"value\":\"" + vdata.Visitdate + " " + vdata.Visittime + "\",\"color\":\"#173177\"}," + | |||||
"\"const1\": {\"value\":\"待查看\",\"color\":\"#173177\"}" + | |||||
"}" + | |||||
"}"; | |||||
string pushresult = Util.HttpMethods.HttpPost("https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + access_token, jsondata); | |||||
operateLogModel.title = title; | |||||
operateLogModel.type = OperationType.Other; | |||||
operateLogModel.url = "ArrangeLessonTermController"; | |||||
operateLogModel.sourceObjectId = "002"; | |||||
operateLogModel.sourceContentJson = pushresult; | |||||
OperatorHelper.Instance.WriteOperateLog(operateLogModel); | |||||
string res = ""; | |||||
if (vdata.IsNotice == "1") | |||||
{ | |||||
res = "通过"; | |||||
} | |||||
if (vdata.IsNotice == "2") | |||||
{ | |||||
res = "未通过"; | |||||
} | |||||
var weixintokenobj = JsonConvert.DeserializeObject<dynamic>(responsejson); | |||||
if (string.IsNullOrEmpty(weixintokenobj.errcode)) | |||||
{ | |||||
string access_token = weixintokenobj.access_token; | |||||
string jsondata = "{\"touser\":\"" + vdata.Openid + "\"," + | |||||
"\"template_id\":\"" + weixintasktempid + "\"," + | |||||
"\"url\":\"\"," + | |||||
"\"data\":{" + | |||||
"\"thing3\": {\"value\":\"" + vdata.Name + "\",\"color\":\"#173177\"}," + | |||||
"\"character_string4\":{\"value\":\""+vdata.Idcard+"\",\"color\":\"#173177\"}," + | |||||
"\"time2\": {\"value\":\"" + vdata.Visittime + "\",\"color\":\"#173177\"}," + | |||||
"\"const1\": {\"value\":\"" + res + "\",\"color\":\"#173177\"}" + | |||||
"}" + | |||||
"}"; | |||||
string pushresult = Util.HttpMethods.HttpPost("https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + access_token, jsondata); | |||||
//log.Info(responsejson); | |||||
} | |||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
catch (System.Exception ex) | |||||
{ | |||||
} | |||||
} | } | ||||
#endregion | #endregion | ||||
} | } | ||||
@@ -3,6 +3,10 @@ | |||||
Layout = "~/Views/Shared/_Form.cshtml"; | Layout = "~/Views/Shared/_Form.cshtml"; | ||||
} | } | ||||
<div class="lr-form-wrap" id="form"> | <div class="lr-form-wrap" id="form"> | ||||
<div class="col-xs-12 lr-form-item" data-table="VisitManage" style="display:none"> | |||||
<div class="lr-form-item-title">姓名</div> | |||||
<input id="Openid" name="Openid" class="form-control" readonly disabled /> | |||||
</div> | |||||
<div class="col-xs-12 lr-form-item" data-table="VisitManage"> | <div class="col-xs-12 lr-form-item" data-table="VisitManage"> | ||||
<div class="lr-form-item-title">姓名</div> | <div class="lr-form-item-title">姓名</div> | ||||
<input id="Name" name="Name" class="form-control" readonly disabled /> | <input id="Name" name="Name" class="form-control" readonly disabled /> | ||||
@@ -12,8 +16,8 @@ | |||||
<input id="Tel" class="form-control" readonly disabled /> | <input id="Tel" class="form-control" readonly disabled /> | ||||
</div> | </div> | ||||
<div class="col-xs-12 lr-form-item" data-table="VisitManage"> | <div class="col-xs-12 lr-form-item" data-table="VisitManage"> | ||||
<div class="lr-form-item-title">到访日期</div> | |||||
<input id="Visitdate" class="form-control" readonly disabled /> | |||||
<div class="lr-form-item-title">身份证号</div> | |||||
<input id="Idcard" class="form-control" readonly disabled /> | |||||
</div> | </div> | ||||
<div class="col-xs-12 lr-form-item" data-table="VisitManage"> | <div class="col-xs-12 lr-form-item" data-table="VisitManage"> | ||||
<div class="lr-form-item-title">到访时间</div> | <div class="lr-form-item-title">到访时间</div> | ||||
@@ -50,6 +50,11 @@ var bootstrap = function ($, learun) { | |||||
$('#审核通知').on('click', function () { | $('#审核通知').on('click', function () { | ||||
var keyValue = $('#gridtable').jfGridValue('V_id'); | var keyValue = $('#gridtable').jfGridValue('V_id'); | ||||
if (learun.checkrow(keyValue)) { | if (learun.checkrow(keyValue)) { | ||||
var IsNotice = $('#gridtable').jfGridValue('IsNotice'); | |||||
if (IsNotice != 0) { | |||||
learun.alert.warning("选中记录中已处理!"); | |||||
return; | |||||
} | |||||
learun.layerForm({ | learun.layerForm({ | ||||
id: 'form', | id: 'form', | ||||
title: '编辑', | title: '编辑', | ||||
@@ -66,6 +71,11 @@ var bootstrap = function ($, learun) { | |||||
$('#取消审核通知').on('click', function () { | $('#取消审核通知').on('click', function () { | ||||
var keyValue = $('#gridtable').jfGridValue('V_id'); | var keyValue = $('#gridtable').jfGridValue('V_id'); | ||||
if (learun.checkrow(keyValue)) { | if (learun.checkrow(keyValue)) { | ||||
var IsNotice = $('#gridtable').jfGridValue('IsNotice'); | |||||
if (IsNotice != 0) { | |||||
learun.alert.warning("选中记录中已处理!"); | |||||
return; | |||||
} | |||||
learun.layerForm({ | learun.layerForm({ | ||||
id: 'form', | id: 'form', | ||||
title: '编辑', | title: '编辑', | ||||
@@ -94,17 +104,12 @@ var bootstrap = function ($, learun) { | |||||
}, | }, | ||||
// 初始化列表 | // 初始化列表 | ||||
initGird: function () { | initGird: function () { | ||||
$('#gridtable').lrAuthorizeJfGrid({ | |||||
$('#gridtable').jfGrid({ | |||||
url: top.$.rootUrl + '/LR_Desktop/VisitManage/GetPageList', | url: top.$.rootUrl + '/LR_Desktop/VisitManage/GetPageList', | ||||
headData: [ | headData: [ | ||||
{ label: "姓名", name: "Name", width: 100, align: "left"}, | { label: "姓名", name: "Name", width: 100, align: "left"}, | ||||
{ label: "联系电话", name: "Tel", width: 100, align: "left"}, | { label: "联系电话", name: "Tel", width: 100, align: "left"}, | ||||
{ | |||||
label: "到访日期", name: "Visitdate", width: 100, align: "left", | |||||
formatterAsync: function (callback, value, row, op, $cell) { | |||||
callback(row.Visitdate.substring(0,10)); | |||||
} | |||||
}, | |||||
{ label: "身份证号", name: "Idcard", width: 100, align: "left" }, | |||||
{ label: "到访时间", name: "Visittime", width: 100, align: "left"}, | { label: "到访时间", name: "Visittime", width: 100, align: "left"}, | ||||
{ label: "到访部门", name: "VisitDept", width: 100, align: "left"}, | { label: "到访部门", name: "VisitDept", width: 100, align: "left"}, | ||||
{ label: "学校联系人", name: "Contact", width: 100, align: "left"}, | { label: "学校联系人", name: "Contact", width: 100, align: "left"}, | ||||
@@ -113,6 +118,7 @@ var bootstrap = function ($, learun) { | |||||
{ label: "提交时间", name: "Createtime", width: 100, align: "left"}, | { label: "提交时间", name: "Createtime", width: 100, align: "left"}, | ||||
{ label: "审核通知", name: "IsNotice", width: 100, align: "left", | { label: "审核通知", name: "IsNotice", width: 100, align: "left", | ||||
formatterAsync: function (callback, value, row, op, $cell) { | formatterAsync: function (callback, value, row, op, $cell) { | ||||
console.log(123) | |||||
if (row.IsNotice.trim()=="0") { | if (row.IsNotice.trim()=="0") { | ||||
callback("否"); | callback("否"); | ||||
} | } | ||||
@@ -45,6 +45,11 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop | |||||
[Column("VISITDEPT")] | [Column("VISITDEPT")] | ||||
public string VisitDept { get; set; } | public string VisitDept { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// VisitDept | |||||
/// </summary> | |||||
[Column("IDCARD")] | |||||
public string Idcard { get; set; } | |||||
/// <summary> | |||||
/// Contact | /// Contact | ||||
/// </summary> | /// </summary> | ||||
[Column("CONTACT")] | [Column("CONTACT")] | ||||
@@ -32,18 +32,7 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop | |||||
var strSql = new StringBuilder(); | var strSql = new StringBuilder(); | ||||
strSql.Append("SELECT "); | strSql.Append("SELECT "); | ||||
strSql.Append(@" | strSql.Append(@" | ||||
t.V_id, | |||||
t.Name, | |||||
t.Tel, | |||||
t.Visitdate, | |||||
t.Visittime, | |||||
t.VisitDept, | |||||
t.Contact, | |||||
t.Reason, | |||||
t.Files, | |||||
t.Createtime, | |||||
t.IsNotice, | |||||
t.Noticetime | |||||
* | |||||
"); | "); | ||||
strSql.Append(" FROM VisitManage t "); | strSql.Append(" FROM VisitManage t "); | ||||
strSql.Append(" WHERE 1=1 "); | strSql.Append(" WHERE 1=1 "); | ||||
@@ -54,7 +43,7 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop | |||||
{ | { | ||||
dp.Add("startTime", queryParam["StartTime"].ToDate(), DbType.DateTime); | dp.Add("startTime", queryParam["StartTime"].ToDate(), DbType.DateTime); | ||||
dp.Add("endTime", queryParam["EndTime"].ToDate(), DbType.DateTime); | dp.Add("endTime", queryParam["EndTime"].ToDate(), DbType.DateTime); | ||||
strSql.Append(" AND ( t.Visitdate >= @startTime AND t.Visitdate <= @endTime ) "); | |||||
strSql.Append(" AND ( t.Visittime >= @startTime AND t.Visittime <= @endTime ) "); | |||||
} | } | ||||
return this.BaseRepository("CollegeMIS").FindList<VisitManageEntity>(strSql.ToString(),dp, pagination); | return this.BaseRepository("CollegeMIS").FindList<VisitManageEntity>(strSql.ToString(),dp, pagination); | ||||
} | } | ||||
@@ -1258,6 +1258,13 @@ | |||||
"style": { | "style": { | ||||
"navigationBarTitleText": "到访预约" | "navigationBarTitleText": "到访预约" | ||||
} | } | ||||
}, | |||||
//到访预约审核结果 | |||||
{ | |||||
"path": "pages/visitmanage/result", | |||||
"style": { | |||||
"navigationBarTitleText": "到访预约" | |||||
} | |||||
} | } | ||||
@@ -5,8 +5,10 @@ | |||||
required></l-input> | required></l-input> | ||||
<l-input @input="setValue('visitform.Tel', $event)" :value="getValue('visitform.Tel')" title="联系电话" | <l-input @input="setValue('visitform.Tel', $event)" :value="getValue('visitform.Tel')" title="联系电话" | ||||
required></l-input> | required></l-input> | ||||
<l-date-picker @input="setValue('visitform.Visitdate', $event)" :value="getValue('visitform.Visitdate')" | |||||
title="到访日期" required /> | |||||
<l-input @input="setValue('visitform.Idcard', $event)" :value="getValue('visitform.Idcard')" 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')" | <l-datetime-picker @input="setValue('visitform.Visittime', $event)" :value="getValue('visitform.Visittime')" | ||||
required title="到访时间" /> | required title="到访时间" /> | ||||
<l-input @input="setValue('visitform.VisitDept', $event)" :value="getValue('visitform.VisitDept')" | <l-input @input="setValue('visitform.VisitDept', $event)" :value="getValue('visitform.VisitDept')" | ||||
@@ -62,6 +64,7 @@ | |||||
}, | }, | ||||
data() { | data() { | ||||
return { | return { | ||||
code:'', | |||||
// 页面相关参数 | // 页面相关参数 | ||||
id: null, | id: null, | ||||
mode: null, | mode: null, | ||||
@@ -85,11 +88,14 @@ | |||||
type: 'text', | type: 'text', | ||||
title: '联系电话' | title: '联系电话' | ||||
}, | }, | ||||
Visitdate: { | |||||
Idcard: { | |||||
type: 'text', | type: 'text', | ||||
title: '到访日期' | |||||
title: '身份证号' | |||||
}, | }, | ||||
// Visitdate: { | |||||
// type: 'text', | |||||
// title: '到访日期' | |||||
// }, | |||||
Visittime: { | Visittime: { | ||||
type: 'text', | type: 'text', | ||||
title: '到访时间' | title: '到访时间' | ||||
@@ -122,13 +128,27 @@ | |||||
} | } | ||||
}, | }, | ||||
async onLoad() { | async onLoad() { | ||||
if (this.getHashSearchParam("code")) { | |||||
this.code = this.getHashSearchParam("code") | |||||
} | |||||
await this.init() | await this.init() | ||||
}, | }, | ||||
methods: { | methods: { | ||||
getHashSearchParam(key) { | |||||
let search = location.search | |||||
let array = [] | |||||
if (search) { | |||||
search = search.substring(1) | |||||
array = search.split("&") | |||||
let res = array.find((item) => item.split("=")[0] == key) | |||||
return res.split("=")[1] | |||||
} | |||||
return '' | |||||
}, | |||||
async init() { | async init() { | ||||
await this.fetchForm() | await this.fetchForm() | ||||
// this.folderId = this.GUID(); | // this.folderId = this.GUID(); | ||||
// this.loginInit() | |||||
this.loginInit() | |||||
}, | }, | ||||
inputValue(val) { | inputValue(val) { | ||||
this.fileList = val; | this.fileList = val; | ||||
@@ -162,8 +182,12 @@ | |||||
this.TOAST("联系方式不能为空!") | this.TOAST("联系方式不能为空!") | ||||
return | return | ||||
} | } | ||||
if (!this.getValue('visitform.Visitdate')) { | |||||
this.TOAST("到访日期不能为空!") | |||||
if (!this.getValue('visitform.Idcard')) { | |||||
this.TOAST("身份证不能为空!") | |||||
return | |||||
} | |||||
if (!/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i.test(this.getValue('visitform.Idcard'))) { | |||||
this.TOAST("身份证格式不正确!") | |||||
return | return | ||||
} | } | ||||
if (!this.getValue('visitform.Visittime')) { | if (!this.getValue('visitform.Visittime')) { | ||||
@@ -223,25 +247,9 @@ | |||||
this.LOADING("加载中...") | this.LOADING("加载中...") | ||||
this.HTTP_POST("weixinapi/getweixinaccess_token?code=" + this.code, null).then(success => { | this.HTTP_POST("weixinapi/getweixinaccess_token?code=" + this.code, null).then(success => { | ||||
this.HIDE_LOADING() | 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 | |||||
} | |||||
// this.ready = true | |||||
this.setValue('visitform.openid', success.openid); | |||||
// this.visitform.openid = success.openid | |||||
}) | }) | ||||
} else { | } else { | ||||
this.HIDE_LOADING(); | this.HIDE_LOADING(); | ||||
@@ -251,7 +259,7 @@ | |||||
} | } | ||||
window.location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + | window.location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + | ||||
success.appid + "&redirect_uri=" + encodeURIComponent('http://' + window.location | success.appid + "&redirect_uri=" + encodeURIComponent('http://' + window.location | ||||
.host + '/#/pages/wxLogin') + | |||||
.host + '/#/pages/visitmanage/index') + | |||||
"&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect"; | "&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect"; | ||||
}) | }) | ||||
} | } | ||||
@@ -0,0 +1,283 @@ | |||||
<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-input @input="setValue('visitform.Idcard', $event)" :value="getValue('visitform.Idcard')" 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 { | |||||
code:'', | |||||
// 页面相关参数 | |||||
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: '联系电话' | |||||
}, | |||||
Tel: { | |||||
type: 'Idcard', | |||||
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() { | |||||
if (this.getHashSearchParam("id")) { | |||||
this.code = this.getHashSearchParam("code") | |||||
} | |||||
await this.init() | |||||
}, | |||||
methods: { | |||||
getHashSearchParam(key) { | |||||
let search = location.search | |||||
let array = [] | |||||
if (search) { | |||||
search = search.substring(1) | |||||
array = search.split("&") | |||||
let res = array.find((item) => item.split("=")[0] == key) | |||||
return res.split("=")[1] | |||||
} | |||||
return '' | |||||
}, | |||||
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() | |||||
// this.ready = true | |||||
this.setValue('visitform.openid', success.openid); | |||||
// 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/visitmanage/index') + | |||||
"&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> |