@@ -55,6 +55,15 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||
{ | |||
return View(); | |||
} | |||
/// <summary> | |||
/// 审核 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpGet] | |||
public ActionResult FormAudit() | |||
{ | |||
return View(); | |||
} | |||
#endregion | |||
#region 获取数据 | |||
@@ -142,6 +151,12 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||
scoreCheckInfoIBLL.SaveEntity(keyValue, entity); | |||
return Success("保存成功!"); | |||
} | |||
/// <summary> | |||
/// 一键生成 | |||
/// </summary> | |||
/// <param name="AcademicYearNo"></param> | |||
/// <param name="Semester"></param> | |||
/// <returns></returns> | |||
[HttpPost] | |||
[AjaxOnly] | |||
public ActionResult SaveGeneForm(string AcademicYearNo, string Semester) | |||
@@ -149,7 +164,11 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||
int res = scoreCheckInfoIBLL.SaveGeneEntity(AcademicYearNo, Semester); | |||
return Success("本次生成" + res + "条数据!"); | |||
} | |||
/// <summary> | |||
/// 提交 | |||
/// </summary> | |||
/// <param name="keyValue"></param> | |||
/// <returns></returns> | |||
[HttpPost] | |||
[AjaxOnly] | |||
public ActionResult SubmitFrom(string keyValue) | |||
@@ -157,7 +176,19 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||
scoreCheckInfoIBLL.SubmitEntity(keyValue); | |||
return Success("提交成功!"); | |||
} | |||
/// <summary> | |||
/// 审核 | |||
/// </summary> | |||
/// <param name="keyValue"></param> | |||
/// <returns></returns> | |||
[HttpPost] | |||
[AjaxOnly] | |||
public ActionResult AuditFrom(string keyValue, string strEntity) | |||
{ | |||
ScoreCheckInfoEntity entity = strEntity.ToObject<ScoreCheckInfoEntity>(); | |||
scoreCheckInfoIBLL.AuditEntity(keyValue, entity); | |||
return Success("审核成功!"); | |||
} | |||
#endregion | |||
} | |||
@@ -2,7 +2,7 @@ | |||
ViewBag.Title = "学业成绩考核记录表"; | |||
Layout = "~/Views/Shared/_Form.cshtml"; | |||
} | |||
<div class="lr-form-wrap" id="form"> | |||
<div class="lr-form-wrap"> | |||
<div class="col-xs-12 lr-form-item" data-table="ScoreCheckInfo"> | |||
<div class="lr-form-item-title">学年<font face="宋体">*</font></div> | |||
<div id="AcademicYearNo" isvalid="yes" checkexpession="NotNull"></div> | |||
@@ -41,7 +41,7 @@ var bootstrap = function ($, learun) { | |||
text: 'stuname', | |||
headData: | |||
[ | |||
{ label: "学号", name: "stuno", width: 100, align: "left" }, | |||
{ label: "学号", name: "stuno", width: 140, align: "left" }, | |||
{ label: "姓名", name: "stuname", width: 100, align: "left" }, | |||
{ | |||
label: "班级", name: "classno", width: 100, align: "left", | |||
@@ -110,19 +110,20 @@ var bootstrap = function ($, learun) { | |||
}; | |||
// 保存数据 | |||
acceptClick = function (callBack) { | |||
if (!$('body').lrValidform()) { | |||
if (!$('form').lrValidform()) { | |||
return false; | |||
} | |||
var postData = { | |||
strEntity: JSON.stringify($('body').lrGetFormData()) | |||
//postData.StuName= | |||
strEntity: JSON.stringify($('form').lrGetFormData()) | |||
}; | |||
console.log(postData,"postData") | |||
$.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/ScoreCheckInfo/SaveForm?keyValue=' + keyValue, postData, function (res) { | |||
// 保存成功后才回调 | |||
if (!!callBack) { | |||
callBack(); | |||
} | |||
}); | |||
//$.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/ScoreCheckInfo/SaveForm?keyValue=' + keyValue, postData, function (res) { | |||
// // 保存成功后才回调 | |||
// if (!!callBack) { | |||
// callBack(); | |||
// } | |||
//}); | |||
}; | |||
page.init(); | |||
} |
@@ -0,0 +1,15 @@ | |||
@{ | |||
ViewBag.Title = "学业考核成绩记载审核表单"; | |||
Layout = "~/Views/Shared/_Form.cshtml"; | |||
} | |||
<div class="lr-form-wrap"> | |||
<div class="col-xs-12 lr-form-item" data-table="ScoreCheckInfo"> | |||
<div class="lr-form-item-title">审核通过</div> | |||
<div id="CheckStatus"></div> | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="ScoreCheckInfo"> | |||
<div class="lr-form-item-title">备注</div> | |||
<textarea id="CheckOpinion" type="text" class="form-control" style="height:80px;"></textarea> | |||
</div> | |||
</div> | |||
@Html.AppendJsFile("/Areas/EducationalAdministration/Views/ScoreCheckInfo/FormAudit.js") |
@@ -0,0 +1,55 @@ | |||
/* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn) | |||
* Copyright (c) 2013-2018 北京泉江科技有限公司 | |||
* 创建人:超级管理员 | |||
* 日 期:2019-05-15 10:33 | |||
* 描 述:选修课报名审核表单 | |||
*/ | |||
var acceptClick; | |||
var keyValue = request('keyValue'); | |||
var bootstrap = function ($, learun) { | |||
"use strict"; | |||
var page = { | |||
init: function () { | |||
$('.lr-form-wrap').lrscroll(); | |||
page.bind(); | |||
page.initData(); | |||
}, | |||
bind: function () { | |||
$('#CheckStatus').lrRadioCheckbox({ | |||
type: 'radio', | |||
code: 'YesOrNoInt', | |||
}); | |||
}, | |||
initData: function () { | |||
if (!!keyValue) { | |||
$.lrSetForm(top.$.rootUrl + '/EducationalAdministration/ScoreCheckInfo/GetFormData?keyValue=' + keyValue, function (data) { | |||
for (var id in data) { | |||
if (!!data[id].length && data[id].length > 0) { | |||
$('#' + id).jfGridSet('refreshdata', data[id]); | |||
} | |||
else { | |||
$('[data-table="' + id + '"]').lrSetFormData(data[id]); | |||
} | |||
} | |||
}); | |||
} | |||
} | |||
}; | |||
// 保存数据 | |||
acceptClick = function (callBack) { | |||
if (!$('body').lrValidform()) { | |||
return false; | |||
} | |||
var postData = { | |||
strEntity: JSON.stringify($('body').lrGetFormData()) | |||
}; | |||
console.log(keyValue,"keyValue") | |||
$.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/ScoreCheckInfo/AuditFrom?keyValue=' + keyValue, postData, function (res) { | |||
// 保存成功后才回调 | |||
if (!!callBack) { | |||
callBack(); | |||
} | |||
}); | |||
}; | |||
page.init(); | |||
} |
@@ -50,14 +50,14 @@ | |||
<a id="lr_add" class="btn btn-default"><i class="fa fa-plus"></i> 新增</a> | |||
<a id="lr_edit" class="btn btn-default"><i class="fa fa-pencil-square-o"></i> 编辑</a> | |||
<a id="lr_delete" class="btn btn-default"><i class="fa fa-trash-o"></i> 删除</a> | |||
<a id="lr_print" class="btn btn-default"><i class="fa fa-print"></i> 打印</a> | |||
</div> | |||
<div class=" btn-group btn-group-sm" learun-authorize="yes"> | |||
<a id="lr_generate" class="btn btn-default"><i class="fa fa-plus"></i> 一键生成</a> | |||
<a id="lr_Coordinator" class="btn btn-default"><i class="fa fa-plus"></i> 教师评语</a> | |||
<a id="lr_submit" class="btn btn-default"><i class="fa fa-plus"></i> 提交</a> | |||
<a id="lr_lock" class="btn btn-default"><i class="fa fa-plus"></i> 审核</a> | |||
<a id="lr_unlock" class="btn btn-default"><i class="fa fa-plus"></i> 去审核</a> | |||
<a id="lr_print" class="btn btn-default"><i class="fa fa-print"></i> 打印</a> | |||
@*<a id="lr_unlock" class="btn btn-default"><i class="fa fa-plus"></i> 去审核</a>*@ | |||
</div> | |||
</div> | |||
</div> | |||
@@ -131,7 +131,7 @@ var bootstrap = function ($, learun) { | |||
var keyValue = $('#gridtable').jfGridValue('ID'); | |||
if (learun.checkrow(keyValue)) { | |||
var CheckMark = $('#gridtable').jfGridValue('CheckStatus'); | |||
if (CheckMark.indexOf('1') != -1) { | |||
if (CheckMark.indexOf(',') != -1) { | |||
learun.alert.warning("选中记录中包含已审核项目,已审核不能删除!"); | |||
return; | |||
} | |||
@@ -150,9 +150,24 @@ var bootstrap = function ($, learun) { | |||
}); | |||
// 审核 | |||
$('#lr_lock').on('click', function () { | |||
}); | |||
// 去审核 | |||
$('#lr_unlock').on('click', function () { | |||
var keyValue = $('#gridtable').jfGridValue('ID'); | |||
if (learun.checkrow(keyValue)) { | |||
var CheckMark = $('#gridtable').jfGridValue('CheckStatus'); | |||
if (CheckMark.indexOf(',') != "-1") { | |||
learun.alert.warning("选中项不可审核!"); | |||
return; | |||
} | |||
learun.layerForm({ | |||
id: 'formTeach', | |||
title: '编辑', | |||
url: top.$.rootUrl + '/EducationalAdministration/ScoreCheckInfo/FormAudit?keyValue=' + keyValue, | |||
width: 800, | |||
height: 600, | |||
callBack: function (id) { | |||
return top[id].acceptClick(refreshGirdData); | |||
} | |||
}); | |||
} | |||
}); | |||
// 教师评语 | |||
$('#lr_Coordinator').on('click', function () { | |||
@@ -273,7 +288,7 @@ var bootstrap = function ($, learun) { | |||
} | |||
}, | |||
{ | |||
label: "评语填写人", name: "Signed", width: 100, align: "left" , | |||
label: "评语填写人", name: "Signed", width: 100, align: "left", | |||
formatterAsync: function (callback, value, row, op, $cell) { | |||
learun.clientdata.getAsync('custmerData', { | |||
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'bjsj', | |||
@@ -42,7 +42,7 @@ var bootstrap = function ($, learun) { | |||
} | |||
} | |||
}); | |||
$('#F_NewsImage').lrUploader(); | |||
$('#F_NewsImage').lrUploader({ extensions:'gif,jpeg,jpg,png,bmp'}); | |||
$('#F_IsSendFX').lrDataItemSelect({ code: 'YesOrNoBit' }); | |||
$('#F_SendDeptId').lrDepartmentSelect({ type: 'treemultiple' }); | |||
$('#F_SendPostId').lrPostSelect({ type: 'treemultiple' }); | |||
@@ -1132,6 +1132,7 @@ | |||
<Content Include="Areas\EducationalAdministration\Views\Scholarship\IndexZxj.js" /> | |||
<Content Include="Areas\EducationalAdministration\Views\SchoolNews\Form.js" /> | |||
<Content Include="Areas\EducationalAdministration\Views\SchoolNews\Index.js" /> | |||
<Content Include="Areas\EducationalAdministration\Views\ScoreCheckInfo\FormAudit.js" /> | |||
<Content Include="Areas\EducationalAdministration\Views\ScoreCheckInfo\FormTeach.js" /> | |||
<Content Include="Areas\EducationalAdministration\Views\ScoreCheckInfo\FormGene.js" /> | |||
<Content Include="Areas\EducationalAdministration\Views\ScoreStatistics\Form.js" /> | |||
@@ -1245,6 +1246,7 @@ | |||
<Content Include="Areas\EducationalAdministration\Views\Scholarshipxj\IndexStatistic.cshtml" /> | |||
<Content Include="Areas\EducationalAdministration\Views\ScoreCheckInfo\FormGene.cshtml" /> | |||
<Content Include="Areas\EducationalAdministration\Views\ScoreCheckInfo\FormTeach.cshtml" /> | |||
<Content Include="Areas\EducationalAdministration\Views\ScoreCheckInfo\FormAudit.cshtml" /> | |||
<None Include="Areas\EducationalAdministration\Views\StuInfoBasic\Printxjk.cshtml" /> | |||
<Content Include="Areas\EducationalAdministration\Views\StuInfoFresh\AllocationClassDC.js" /> | |||
<Content Include="Areas\EducationalAdministration\Views\StuInfoFresh\StatisticClassIndex.js" /> | |||
@@ -184,6 +184,30 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 审核 | |||
/// </summary> | |||
/// <param name="keyValue"></param> | |||
/// <param name="entity"></param> | |||
public void AuditEntity(string keyValue, ScoreCheckInfoEntity entity) | |||
{ | |||
try | |||
{ | |||
scoreCheckInfoService.AuditEntity(keyValue, entity); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
} | |||
@@ -27,7 +27,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
/// <param name="keyValue">主键</param> | |||
/// <returns></returns> | |||
ScoreCheckInfoEntity GetScoreCheckInfoEntity(string keyValue); | |||
ScoreCheckInfoEntity GetStuNoEntity(string keyValue,string AcademicYearNo,string Semester); | |||
ScoreCheckInfoEntity GetStuNoEntity(string keyValue, string AcademicYearNo, string Semester); | |||
#endregion | |||
#region 提交数据 | |||
@@ -55,7 +55,10 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
/// </summary> | |||
/// <param name="keyValue"></param> | |||
void SubmitEntity(string keyValue); | |||
/// <summary> | |||
/// 审核 | |||
/// </summary> | |||
void AuditEntity(string keyValue, ScoreCheckInfoEntity entity); | |||
#endregion | |||
} | |||
@@ -114,7 +114,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
{ | |||
try | |||
{ | |||
return this.BaseRepository("CollegeMIS").FindEntity<ScoreCheckInfoEntity>(x => x.StuName == keyValue && x.Semester == Semester && x.AcademicYearNo == AcademicYearNo); | |||
return this.BaseRepository("CollegeMIS").FindEntity<ScoreCheckInfoEntity>(x => x.StuNo == keyValue && x.Semester == Semester && x.AcademicYearNo == AcademicYearNo); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -226,6 +226,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
} | |||
} | |||
} | |||
public void SubmitEntity(string keyValue) | |||
{ | |||
var db = this.BaseRepository("CollegeMIS").BeginTrans(); | |||
@@ -254,6 +255,43 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 审核 | |||
/// </summary> | |||
/// <param name="keyValue"></param> | |||
/// <param name="entity"></param> | |||
public void AuditEntity(string keyValue, ScoreCheckInfoEntity entity) | |||
{ | |||
var db = this.BaseRepository("CollegeMIS").BeginTrans(); | |||
try | |||
{ | |||
var userlogin = LoginUserInfo.Get(); | |||
var keyValueArr = keyValue.Split(','); | |||
foreach (var item in keyValueArr) | |||
{ | |||
var model = db.FindEntity<ScoreCheckInfoEntity>(x => x.ID == item); | |||
model.CheckStatus = entity.CheckStatus; | |||
model.CheckTime = DateTime.Now; | |||
model.CheckUser = userlogin.userId; | |||
model.UpdateTime = DateTime.Now; | |||
model.UpdateUser = userlogin.userId; | |||
db.Update(model); | |||
} | |||
db.Commit(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
db.Rollback(); | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
@@ -0,0 +1,42 @@ | |||
export default function uniCopy({content,success,error}) { | |||
if(!content) return error('复制的内容不能为空 !') | |||
content = typeof content === 'string' ? content : content.toString() // 复制内容,必须字符串,数字需要转换为字符串 | |||
/** | |||
* 小程序端 和 app端的复制逻辑 | |||
*/ | |||
//#ifndef H5 | |||
uni.setClipboardData({ | |||
data: content, | |||
success: function() { | |||
success("复制成功~") | |||
console.log('success'); | |||
}, | |||
fail:function(){ | |||
success("复制失败~") | |||
} | |||
}); | |||
//#endif | |||
/** | |||
* H5端的复制逻辑 | |||
*/ | |||
// #ifdef H5 | |||
if (!document.queryCommandSupported('copy')) { //为了兼容有些浏览器 queryCommandSupported 的判断 | |||
// 不支持 | |||
error('浏览器不支持') | |||
} | |||
let textarea = document.createElement("textarea") | |||
textarea.value = content | |||
textarea.readOnly = "readOnly" | |||
document.body.appendChild(textarea) | |||
textarea.select() // 选择对象 | |||
textarea.setSelectionRange(0, content.length) //核心 | |||
let result = document.execCommand("copy") // 执行浏览器复制命令 | |||
if(result){ | |||
success("复制成功~") | |||
}else{ | |||
error("复制失败,请检查h5中调用该方法的方式,是不是用户点击的方式调用的,如果不是请改为用户点击的方式触发该方法,因为h5中安全性,不能js直接调用!") | |||
} | |||
textarea.remove() | |||
// #endif | |||
} |
@@ -24,7 +24,8 @@ export default { | |||
placeholder: {}, | |||
readonly: {}, | |||
rootId: {}, | |||
rootType: {} | |||
rootType: {}, | |||
multiple: {} | |||
}, | |||
methods: { | |||
@@ -34,16 +35,18 @@ export default { | |||
} | |||
this.ONCE('select-organize', data => { | |||
this.$emit('input', data.id) | |||
this.$emit('change', data.id) | |||
this.$emit('input', data.id||data.map(t=>t.id).toString()) | |||
this.$emit('change', data.id||data.map(t=>t.id).toString()) | |||
}) | |||
const rootType = this.rootType || { user: 'department', department: 'company', company: 'company' }[this.type] | |||
const rootId = this.rootId | |||
let url_ = this.multiple?"select-organize-multiple":"select-organize" | |||
this.SET_PARAM(this.value) | |||
const url = rootId | |||
? `/pages/common/select-organize?type=${this.type}&rootId=${rootId}&rootType=${rootType}` | |||
: `/pages/common/select-organize?type=${this.type}` | |||
? `/pages/common/${url_}?type=${this.type}&rootId=${rootId}&rootType=${rootType}` | |||
: `/pages/common/${url_}?type=${this.type}` | |||
this.NAV_TO(url) | |||
} | |||
@@ -54,8 +57,17 @@ export default { | |||
if (!this.value) { | |||
return this.placeholder | |||
} | |||
const orgItem = this.GET_GLOBAL(this.type)[this.value] | |||
const list = this.GET_GLOBAL(this.type) | |||
let values = this.value.split(",") | |||
if(values.length>1){ | |||
const orgItems = values.map(t=>list[t].name).toString() | |||
return orgItems | |||
} | |||
const orgItem = list[this.value] | |||
return orgItem ? orgItem.name : this.placeholder | |||
}, | |||
@@ -28,10 +28,13 @@ | |||
<l-tag v-if="root.type !== 'user' || staffTag" :line="tagColor" size="sm" class="margin-left-sm"> | |||
{{ tagName }} | |||
</l-tag> | |||
<uni-view v-if="root.type === 'user' && mobile" class="margin-left-sm sm line-gray cu-tag" style="z-index: 1;" @tap="copy(mobile)">复制</uni-view> | |||
<!-- 开启按钮显示且级别对应,则显示按钮 --> | |||
<view v-if="button && root.type === level" class="tree-item-action"> | |||
<l-button @click="$emit('buttonClick', root)" line="green" size="sm">选择</l-button> | |||
<l-button v-if="!selectIds.includes(root.id)" @click="itemClick(root)" line="green" size="sm">选择</l-button> | |||
<l-button v-else @click="itemClick(root)" line="blue" size="sm">取消选择</l-button> | |||
</view> | |||
</view> | |||
@@ -51,12 +54,14 @@ | |||
:root="child" | |||
:button="button" | |||
:level="level" | |||
:value="value" | |||
/> | |||
</view> | |||
</view> | |||
</template> | |||
<script> | |||
import uniCopy from "@/common/js/uni-copy.js" | |||
export default { | |||
name: 'l-organize-tree', | |||
@@ -64,7 +69,8 @@ export default { | |||
root: { default: () => ({ type: 'company', id: '0' }) }, | |||
level: { default: 'user' }, | |||
button: {}, | |||
open: { default: true } | |||
open: { default: true }, | |||
value:{}, | |||
}, | |||
data() { | |||
@@ -73,7 +79,8 @@ export default { | |||
isLoading: false, | |||
isLoadOk: false, | |||
isEmpty: false, | |||
children: [] | |||
children: [], | |||
selectIds:[] | |||
} | |||
}, | |||
@@ -84,6 +91,9 @@ export default { | |||
methods: { | |||
// 组件被创建 | |||
async init() { | |||
if(this.value){ | |||
this.selectIds = this.value.split(",") | |||
} | |||
// 如果自己是根节点,则创建时直接加载子节点 | |||
if (this.open) { | |||
await this.loadChildren() | |||
@@ -108,6 +118,15 @@ export default { | |||
this.loadChildren() | |||
}, | |||
itemClick(root){ | |||
if(this.selectIds.indexOf(root.id) !== -1){ | |||
this.selectIds.splice(this.selectIds.indexOf(root.id),1) | |||
}else{ | |||
this.selectIds.push(root.id) | |||
} | |||
this.$emit('buttonClick', root) | |||
}, | |||
// 加载子节点 | |||
async loadChildren() { | |||
@@ -160,7 +179,27 @@ export default { | |||
this.isLoadOk = true | |||
this.isOpen = true | |||
this.isLoading = false | |||
} | |||
}, | |||
copy(mobile){ | |||
uniCopy({ | |||
content:mobile, | |||
success:(res)=>{ | |||
uni.showToast({ | |||
title: "复制手机号成功~", | |||
icon: 'none', | |||
duration:3000, | |||
}) | |||
}, | |||
error:(e)=>{ | |||
uni.showToast({ | |||
title: e, | |||
icon: 'none', | |||
duration:3000, | |||
}) | |||
} | |||
}) | |||
} | |||
}, | |||
computed: { | |||
@@ -153,6 +153,12 @@ | |||
"navigationBarTitleText": "选择公司/部门/员工" | |||
} | |||
}, | |||
{ | |||
"path": "pages/common/select-organize-multiple", | |||
"style": { | |||
"navigationBarTitleText": "选择公司/部门/员工" | |||
} | |||
}, | |||
{ | |||
"path": "pages/common/select-layer", | |||
"style": { | |||
@@ -0,0 +1,141 @@ | |||
<template> | |||
<view id="contact" class="page"> | |||
<!-- 顶部搜索栏 --> | |||
<view class="topSearch"> | |||
<l-banner v-model="searchText" :placeholder="placeholder" type="search" noSearchButton fill fixed /> | |||
<view class=""> | |||
<view class="pearson"> | |||
已选择人员:{{names||'暂无'}} | |||
</view> | |||
<view style="display: flex;justify-content: center;"> | |||
<view class="cu-btn sm line-green" @tap="itemConfirm" style="font-size: 16px;"> | |||
确定选择 | |||
</view> | |||
</view> | |||
</view> | |||
</view> | |||
<!-- 树形列表 --> | |||
<l-organize-tree v-if="type && !searchText" @buttonClick="itemClick" :level="type" :root="root" button :value="ids" /> | |||
<!-- 如果用户输入了搜索关键字,只列出用户 --> | |||
<view v-else-if="type" class="user-item-list"> | |||
<l-organize-single-item v-for="item of searchList" @buttonClick="itemClick" :key="item.id" :item="item" button :value="ids" /> | |||
</view> | |||
</view> | |||
</template> | |||
<script> | |||
export default { | |||
data() { | |||
return { | |||
type: null, | |||
contactList: [], | |||
searchText: '', | |||
placeholder: '搜索公司名/部门名/职员姓名', | |||
root: { type: 'company', id: '0' }, | |||
items:[], | |||
ids:'', | |||
} | |||
}, | |||
onBackPress() { | |||
this.OFF('select-organize') | |||
}, | |||
onUnload() { | |||
this.OFF('select-organize') | |||
}, | |||
async onLoad({ type, rootId, rootType }) { | |||
await this.init(type, rootId, rootType) | |||
}, | |||
methods: { | |||
// 加载页面 | |||
async init(type, rootId, rootType) { | |||
this.ids = this.GET_PARAM() | |||
if(this.ids){ | |||
let arr = this.ids.split(",") | |||
let items = [] | |||
for (let s of arr) { | |||
if(this.GET_GLOBAL("user")[s]){ | |||
items.push({...this.GET_GLOBAL("user")[s],id:s}) | |||
} | |||
} | |||
this.items = items | |||
} | |||
this.placeholder = { | |||
user: '搜索职员姓名', | |||
department: '搜索公司名/部门名', | |||
company: '搜索公司名/部门名/职员姓名' | |||
}[type] | |||
if (rootId && rootId !== 'undefined' && rootId !== 'null') { | |||
this.root = { id: rootId, type: rootType } | |||
} | |||
this.type = type || 'user' | |||
const selectType = { user: '职员', department: '部门', company: '公司' }[type] | |||
this.SET_TITLE(`请选择一个${selectType}`) | |||
}, | |||
findItem(arr,item){ | |||
const result = arr.findIndex(t => t.id === item.id); | |||
if(result === -1){ | |||
arr.push(item) | |||
}else{ | |||
arr.splice(result,1) | |||
} | |||
return arr | |||
}, | |||
// 某一项被点击,触发事件 | |||
itemClick(item) { | |||
this.items = this.findItem(this.items,item) | |||
// this.EMIT('select-organize', item) | |||
// this.NAV_BACK() | |||
}, | |||
itemConfirm(){ | |||
this.EMIT('select-organize', this.items) | |||
this.NAV_BACK() | |||
} | |||
}, | |||
computed: { | |||
// 用户输入关键字搜索时的列表 | |||
searchList() { | |||
if (!this.searchText) { | |||
return [] | |||
} | |||
return Object.entries(this.GET_GLOBAL(this.type)) | |||
.filter(([id, item]) => item.name.includes(this.searchText)) | |||
.map(([id, item]) => ({ | |||
...item, | |||
type: this.type, | |||
id | |||
})) | |||
}, | |||
names(){ | |||
if(!this.items.length){ | |||
return '' | |||
} | |||
return this.items.map(t=>t.name).toString() | |||
} | |||
} | |||
} | |||
</script> | |||
<style lang="scss"> | |||
page { | |||
padding-top: 100rpx; | |||
} | |||
.topSearch{ | |||
.pearson{ | |||
color: #606266; | |||
line-height: 32px; | |||
} | |||
} | |||
</style> |