app/views/educode_sales/shixuns/index.html.erb in educode_sales-1.10.49 vs app/views/educode_sales/shixuns/index.html.erb in educode_sales-1.10.58
- old
+ new
@@ -1,16 +1,25 @@
<style>
.inner_div {
margin-bottom: 10px;
margin-right: 10px;
}
+ .markdown_list img{
+ max-width: 500px;
+ }
+ .layui-table-cell{
+ height: auto !important;
+ width: auto;
+ white-space: normal;
+ /*line-height: 28px;*/
+ }
</style>
-<div class="layui-tab" style="margin: 10px">
+<div class="layui-tab" style="margin: 10px" lay-filter="shixun_nav">
<ul class="layui-tab-title">
- <li id="category_1" class="layui-this" lay-id="11">管培</li>
- <li id="category_2" lay-id="22">全职</li>
- <li id="category_3" lay-id="33">专职</li>
+ <li id="category_1" class="layui-this" lay-id="1">管培</li>
+ <li id="category_2" lay-id="2">全职</li>
+ <li id="category_3" lay-id="3">专职</li>
</ul>
<div class="layui-tab-content">
<div>
<form class="layui-form layui-form-pane" lay-filter="search_form">
@@ -26,31 +35,39 @@
</div>
<div class="layui-inline show_item_contract borders inner_div">
<label class="layui-form-label">项目状态</label>
<div class="layui-input-inline">
<%= select_tag "status", options_for_select(
- [["全部", 0], ["待建设", 1], ["已签协议", 2], ["建设中", 3],
- ["审核中", 4], ["返修中", 5], ["已内部发布", 6], ["已公开发布", 7]], selected: 0
+ [["全部", 0], ["待建设", 1], ["建设中", 3],
+ ["审核中", 4], ["返修中", 5], ["已内部发布", 6], ["已公开发布", 7],
+ ["已付费用",8],["审核通过",9]], selected: 0
), { include_blank: true } %>
</div>
</div>
<div class="layui-inline inner_div">
<label class="layui-form-label">交付时间</label>
<div class="layui-inline" id="ID-laydate-range">
<input type="text" class="layui-input" name="time" id="ID-laydate-demo" placeholder="yyyy-MM-dd">
</div>
</div>
+
+<!-- <div class="layui-inline inner_div">-->
+<!-- <label class="layui-form-label">商机名称</label>-->
+<!-- <div class="layui-inline" id="ID-laydate-range">-->
+<!-- <input type="text" class="layui-input" name="business_name" id="business_name">-->
+<!-- </div>-->
+<!-- </div>-->
</div>
<div>
<div class="layui-inline borders inner_div">
<label class="layui-form-label" style="width: 120px">项目名称</label>
<div class="layui-input-inline">
<input type="text" class="layui-input" name="shixun_name">
</div>
</div>
<div class="layui-inline borders inner_div">
- <label class="layui-form-label" style="width: 120px">实践课程名称</label>
+ <label class="layui-form-label" style="width: 130px">实践课程名称</label>
<div class="layui-input-inline">
<input type="text" class="layui-input" name="subject_name">
</div>
</div>
<div class="layui-inline borders inner_div">
@@ -64,11 +81,11 @@
</div>
<div id="contact_table_wraper">
<table class="layui-hide" id="shixuns_table" lay-filter="shixuns_table"></table>
</div>
- <input type="text" class="layui-input" name="subject_name" id="shixun_nav_type_id" value="1" style="display: none" >
+ <input type="text" class="layui-input" name="subject_name" id="shixun_nav_type_id" value="1" style="display: none">
</div>
</div>
<script type="text/html" id="bussinessBar">
<div class="layui-btn-container">
@@ -94,10 +111,14 @@
<span>返修中</span>
{{# } else if(d.shixun_status === 6){ }}
<span>已内部发布</span>
{{# } else if(d.shixun_status === 7){ }}
<span>已公开发布</span>
+ {{# } else if(d.shixun_status === 8){ }}
+ <span>已付费用</span>
+ {{# } else if(d.shixun_status === 9){ }}
+ <span>审核通过</span>
{{# } }}
</script>
<script type="text/html" id="show_level">
{{# if(d.level === 1){ }}
<span>不明确</span>
@@ -111,15 +132,64 @@
<span>不重要不紧急</span>
{{# } }}
</script>
<script type="text/html" id="shixun_table_bar">
<a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">编辑</a>
+ {{# if(d.shixun_status === 3 || d.shixun_status === 5){ }}
<a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="examine">提交审核</a>
+ {{# } else { }}
+ <a class="layui-btn layui-btn-disabled layui-btn-xs data-count-edit">提交审核</a>
+ {{# } }}
</script>
+<!--<script type="text/html" id="show_markdown">-->
+<!-- {{# if(d.dectect_feedback !== null && d.dectect_feedback !== '' ){ }}-->
+<!-- <a lay-event="show_markdown">点击查看</a>-->
+<!-- {{# } else { }}-->
+<!-- <span>---</span>-->
+<!-- {{# } }}-->
+<!--</script>-->
+
+<script type="text/html" id="shixun_name_t">
+ {{# if(d.s_identifier !== null && d.s_identifier !== ''){ }}
+ <a target='_blank' style='color: #1E9FFF' href='<%=@url %>/shixuns/{{=d.s_identifier}}/challenges'>{{=d.shixun_name}}</a>
+ {{# } else { }}
+ <a target='_blank' style='color: #1E9FFF' href='{{=d.link}}'>{{=d.shixun_name}}</a>
+ {{# } }}
+</script>
+<script type="text/html" id="subject_name_t">
+ {{# if(d.subject_name !== '--'){ }}
+ <a target='_blank' style='color: #1E9FFF' href='<%=@url %>/paths/{{=d.subjects_identifier}}'>{{=d.subject_name}}</a>
+ {{# } else { }}
+ <a style='color: #1E9FFF' >{{=d.subject_name}}</a>
+ {{# } }}
+</script>
+<script src="/markdown/marked.min.js" type="text/javascript" charset="utf-8"></script>
<script>
- layui.use(['form', 'table', 'miniPage', 'element', 'laydate', 'dropdown', 'jquery'], function () {
+ function extractFirstTenCharsAndImage(markdownText) {
+ let firstTenChars = '';
+ let imageTag = '';
+ // 行内图片的正则表达式
+ const inlineImageRegex = /!\[.*?\]\((.*?)\)/g;
+ // 处理行内图片
+ markdownText = markdownText.replace(inlineImageRegex, (_, imagePath) => {
+ // 如果匹配到行内图片,则生成图片标签,并将匹配的图片部分替换为空字符串
+ imageTag = `<img style="max-height: 100px" src="${imagePath}" />`;
+ return '';
+ });
+ // 去除Markdown格式,只保留纯文本内容
+ const pureText = markdownText.replace(/(^|\n)(\d+\.|)\s*/g, '$1').trim();
+ // 获取前十个字符
+ firstTenChars = pureText.substring(0, 10);
+ // 输出结果
+ return `<div lay-event="show_markdown"><p>${firstTenChars}</p> ${imageTag}</div>`
+ }
+ layui.config({
+ base: '/markdown/mods/' //存放layui拓展模块的目录位置
+ }).use(['form', 'table', 'miniPage', 'element', 'laydate', 'dropdown', 'jquery','easyeditor'], function () {
var laydate = layui.laydate,
+ easyeditor = layui.easyeditor,
+ element = layui.element,
form = layui.form,
table = layui.table,
$ = layui.jquery,
miniPage = layui.miniPage
@@ -127,19 +197,16 @@
laydate.render({
elem: '#ID-laydate-demo',
range: true
});
- var data = form.val("search_form");
- // 默认管培
- data.category = 1
+
var cols_table = [
[
{
field: 'id',
width: 60,
- fixed: 'left',
title: '序号', type: 'numbers',
align: 'center',
},
{
field: 'school_name',
@@ -151,24 +218,36 @@
{
field: 'subject_name',
title: '实践课程名称',
width: 200,
align: 'center',
+ templet: "#subject_name_t",
hide: gon.filter.subject_name
},
{
field: 'reception_at',
title: '交付时间',
width: 150,
align: 'center',
hide: gon.filter.reception_at
},
{
+ field: 'type',
+ title: '项目类型',
+ width: 150,
+ align: 'center',
+ templet: (d)=>{
+ return d.type === 1? "实践项目":"非实践项目"
+ },
+ hide: gon.filter.type
+ },
+ {
field: 'shixun_name',
title: '项目名称',
width: 150,
align: 'center',
+ templet: "#shixun_name_t",
hide: gon.filter.shixun_name
},
{
field: 'level',
title: '项目级别',
@@ -202,10 +281,16 @@
{
field: 'dectect_feedback',
title: '审核反馈',
width: 150,
align: 'center',
+ templet: (d)=>{
+ if(d.dectect_feedback){
+ return extractFirstTenCharsAndImage(d.dectect_feedback)
+ }
+ return ''
+ },
hide: gon.filter.dectect_feedback
},
{
field: 'shixun_producer',
title: '项目制作人',
@@ -236,33 +321,189 @@
},
{
title: '操作',
align: 'center',
width: 150,
- fixed: 'right',
templet: "#shixun_table_bar"
}
]
]
+ var money_cols_table = [
+ [
+ {
+ field: 'id',
+ width: 60,
+ title: '序号', type: 'numbers',
+ align: 'center',
+ },
+ {
+ field: 'school_name',
+ title: '交付单位',
+ width: 150,
+ align: 'center',
+ hide: gon.filter.school_name
+ },
+ {
+ field: 'subject_name',
+ title: '实践课程名称',
+ width: 200,
+ align: 'center',
+ templet: "#subject_name_t",
+ hide: gon.filter.subject_name
+ },
+ {
+ field: 'reception_at',
+ title: '交付时间',
+ width: 150,
+ align: 'center',
+ hide: gon.filter.reception_at
+ },
+ {
+ field: 'type',
+ title: '项目类型',
+ width: 150,
+ align: 'center',
+ templet: (d)=>{
+ return d.type === 1? "实践项目":"非实践项目"
+ },
+ hide: gon.filter.type
+ },
+ {
+ field: 'shixun_name',
+ title: '项目名称',
+ width: 150,
+ align: 'center',
+ templet: "#shixun_name_t",
+ hide: gon.filter.shixun_name
+ },
+ {
+ field: 'level',
+ title: '项目级别',
+ width: 150,
+ align: 'center',
+ templet: '#show_level',
+ hide: gon.filter.level
+ },
+ {
+ field: 'shixun_status',
+ title: '项目状态',
+ width: 150,
+ templet: '#show_state',
+ align: 'center',
+ hide: gon.filter.shixun_status
+ },
+ {
+ field: 'deliver_date',
+ title: '制作完成时间',
+ width: 150,
+ align: 'center',
+ hide: gon.filter.deliver_date
+ },
+ {
+ field: 'commit_dectect_time',
+ title: '提交审核时间',
+ width: 150,
+ align: 'center',
+ hide: gon.filter.commit_dectect_time
+ },
+ {
+ field: 'dectect_feedback',
+ title: '审核反馈',
+ width: 150,
+ align: 'center',
+ templet: (d)=>{
+ if(d.dectect_feedback){
+ return extractFirstTenCharsAndImage(d.dectect_feedback)
+ }
+ return ''
+ },
+ hide: gon.filter.dectect_feedback
+ },
+ {
+ field: 'shixun_producer',
+ title: '项目制作人',
+ width: 150,
+ align: 'center',
+ hide: gon.filter.shixun_producer
+ },
+ {
+ field: 'shixun_manages',
+ title: '课程组长',
+ width: 150,
+ align: 'center',
+ hide: gon.filter.shixun_manages
+ },
+ {
+ field: 'max_manage',
+ title: '课程组主管',
+ width: 150,
+ align: 'center',
+ hide: gon.filter.max_manage
+ },
+ {
+ field: 'shixun_staff',
+ title: '销售',
+ width: 150,
+ align: 'center',
+ hide: gon.filter.shixun_staff
+ },
+ {
+ title: '操作',
+ align: 'center',
+ width: 150,
+ templet: "#shixun_table_bar"
+ }
+ ]
+ ]
+ var data = form.val("search_form");
+ // 默认管培
+ data.category = gon.category
+ localStorage.setItem("is_admin-<%=session[:admin_id] %>",gon.is_admin)
+ element.tabChange("shixun_nav", gon.category);
+ console.log("is_admin-<%=session[:admin_id] %>")
+ console.log(gon.is_admin)
+ if (gon.is_admin && data.category == 3 ){
+ console.log("admin")
+ money_cols_table[0].splice(8, 0, {field: 'money',title: '金额',width: 150, align: 'center',hide: gon.filter.money })
+ // console.log(demo)
+ }
+
+ var tableDataCount = 0
var id = localStorage.getItem("subjects_id")
console.log(id)
var shixuns_table = table.render({
elem: '#shixuns_table',
url: '/missions/shixuns',
autoSort: false,
where: {q: data},
title: '实践项目列表',
toolbar: '#bussinessBar',
defaultToolbar: ['filter'],
- cols: cols_table,
+ cols: money_cols_table,
limit: 10,
limits: [10, 15, 20, 30, 40, 50, 60, 70, 80, 90],
page: true,
- skin: 'line'
+ skin: 'line',
+ done:function (res, curr, count){
+ tableDataCount = count;
+ }
});
-
+ // 重置
+ form.on('submit(reset_business_search)', function (data) {
+ $(".layui-form")[0].reset();
+ var category = localStorage.getItem("category")
+ console.log(category)
+ table.reload('shixuns_table', {
+ page: {
+ curr: 1
+ },
+ where: {q: {category:category}}
+ }, 'data');
+ form.render()
+ return false;
+ });
var sort = {}, search = {};
// 监听搜索操作
form.on('submit(search_contract)', function (data) {
search = data.field
search.category = document.getElementById('shixun_nav_type_id').value
@@ -287,19 +528,19 @@
var edit = layer.open({
title: '编辑实践项目',
type: 1,
shade: 0.2,
maxmin: true,
- shadeClose: true,
+ shadeClose: false,
area: [openWH[0] + 'px', openWH[1] + 'px'],
offset: [openWH[2] + 'px', openWH[3] + 'px'],
content: content
});
$(window).on("resize", function () {
});
return false;
- } else if (obj.event === 'examine'){
+ } else if (obj.event === 'examine') {
var status = data.shixun_status
console.log(status)
if (status != 3 && status != 5) {
layer.confirm("当前状态无法提交审核")
return false
@@ -310,19 +551,43 @@
data: data,
dataType: 'json',
success: function (res) {
var data = res.data;
console.log(res)
- if(res.success){
+ if (res.success) {
layer.msg("提交成功")
+ search = form.val()
+ search.category = document.getElementById('shixun_nav_type_id').value
+ console.log(search)
+ table.reload('shixuns_table', {
+ page: {
+ curr: 1
+ },
+ where: {q: search, sort: sort}
+ }, 'data');
+ return false;
}
},
- error:(res)=>{
+ error: (res) => {
layer.msg("已经提交过了")
}
})
return false
+ }else if(obj.event === 'show_markdown'){
+ if(data.dectect_feedback !== '--'){
+ var text = `<div class="markdown_list" style="margin: 50px" >` + data.dectect_feedback + `</div>`
+ layer.open({
+ type: 1,
+ title: '审核反馈',
+ area: ['900px', '700px'], // 宽高
+ content: text,
+ move: '#ID-test-layer-move'
+ });
+ easyeditor.render({
+ elem: ".markdown_list"
+ });
+ }
}
});
table.on('toolbar(shixuns_table)', function (obj) {
@@ -333,177 +598,122 @@
add_courses = layer.open({
title: '添加实践项目',
type: 1,
shade: 0.2,
maxmin: true,
- shadeClose: true,
+ shadeClose: false,
area: [openWH[0] + 'px', openWH[1] + 'px'],
offset: [openWH[2] + 'px', openWH[3] + 'px'],
content: content,
});
$(window).on("resize", function () {
});
- }else if(obj.event === 'LAYTABLE_COLS') {
- layui.form.on('checkbox(LAY_TABLE_TOOL_COLS)', function(objs) {
+ } else if (obj.event === 'LAYTABLE_COLS') {
+ layui.form.on('checkbox(LAY_TABLE_TOOL_COLS)', function (objs) {
var value = objs.elem.checked
+ console.log(objs)
var name = objs.elem.attributes[1].value
+ console.log(name)
$.ajax({
url: "filter",
type: "GET",
data: "type=shixuns&name=" + name + "&check=" + value,
- success: function (data){
- let hide_type = "[data-field='"+name+"']"
- if (data.hidden === 1){
+ success: function (data) {
+ let hide_type = "[data-field='" + name + "']"
+ if (data.hidden === 1) {
$(hide_type).addClass('layui-hide');
- }else if (data.hidden === 0){
+ } else if (data.hidden === 0) {
$(hide_type).removeClass('layui-hide');
}
//(因为触发筛选器出现的checkbox是根据cols的值得到 这里必须修改 cols的值 然后才会出现下次点击筛选器时 checkbox正常显示)
- for (i=1;i<cols_table[0].length;i++){
- if (name === cols_table[0][i].field ){
+ for (i = 1; i < cols_table[0].length; i++) {
+ if (name === cols_table[0][i].field) {
cols_table[0][i].hide = !value
- objs.config.cols = cols_table
+ obj.config.cols = cols_table
}
+
+ if (i < money_cols_table[0].length && name === money_cols_table[0][i].field) {
+ money_cols_table[0][i].hide = !value
+ obj.config.cols = money_cols_table
+ }
}
},
- error: function (data){
+ error: function (data) {
layer.msg("操作失败")
},
dataType: 'Json'
})
});
+ }else if(obj.event === 'list'){
+ table.reload('shixuns_table',{
+ page: 1,
+ limit:tableDataCount, //加载所有数据
+ done:function (){
+ //导出所有数据
+ table.exportFile("shixuns_table",false,"xls");
+ //恢复数据分页显示
+ table.reload('shixuns_table',{
+ page: 1,
+ limit:20,
+ done:function (res, curr, count){
+ tableDataCount = count;
+ }
+ })
+
+ }
+ })
}
});
for (let i = 1; i <= 3; i++) {
if (i !== 3) {
+ console.log("tabchange是否跳转")
$("#category_" + i).click(function () {
+ $(".layui-form")[0].reset();
data.category = i
- console.log(i)
+ localStorage.setItem("category",i)
table.reload('shixuns_table', {
page: {
curr: 1
},
- cols:cols_table,
+ cols: cols_table,
where: {q: data}
})
// 更换面包屑后,跟新类型
document.getElementById('shixun_nav_type_id').value = i
});
} else if (i === 3) {
$("#category_" + i).click(function () {
-
+ $(".layui-form")[0].reset();
data.category = i
- var arr = [[
- {
- field: 'id',
- width: 60,
- fixed: 'left',
- title: '序号', type: 'numbers',
- align: 'center'
- },
- {
- field: 'school_name',
- title: '交付单位',
- width: 150,
- align: 'center'
- },
- {
- field: 'subject_name',
- title: '实践课程名称',
- width: 200,
- align: 'center'
- },
- {
- field: 'reception_at',
- title: '交付时间',
- width: 150,
- align: 'center'
- },
- {
- field: 'shixun_name',
- title: '项目名称',
- width: 150,
- align: 'center'
- },
- {
- field: 'level',
- title: '项目级别',
- width: 150,
- align: 'center',
- templet: '#show_level'
- },
- {
- field: 'shixun_status',
- title: '项目状态',
- width: 150,
- templet: '#show_state',
- align: 'center'
- },
- {
- field: 'deliver_date',
- title: '制作完成时间',
- width: 150,
- align: 'center'
- },
- {
- field: 'money',
- title: '金额',
- width: 150,
- align: 'center'
- },
- {
- field: 'time2',
- title: '提交审核时间',
- width: 150,
- align: 'center'
- },
- {
- field: 'feedback',
- title: '审核反馈',
- width: 150,
- align: 'center'
- },
- {
- field: 'shixun_producer',
- title: '项目制作人',
- width: 150,
- align: 'center'
- },
- {
- field: 'shixun_manages',
- title: '课程组长',
- width: 150,
- align: 'center'
- },
- {
- field: 'shixun_manages',
- title: '课程组主管',
- width: 150,
- align: 'center'
- },
- {
- field: 'shixun_staff',
- title: '销售',
- width: 150,
- align: 'center'
- },
- {
- title: '操作',
- align: 'center',
- width: 150,
- fixed: 'right',
- templet: "#shixun_table_bar"
+ localStorage.setItem("category",i)
+
+ var flag = true
+ for(let i = 0; i < money_cols_table[0].length; i ++){
+ if(money_cols_table[0][i].field === "money"){
+ flag = false
+ break
}
- ]]
+ }
+
+ var is_admin = localStorage.getItem("is_admin-<%=session[:admin_id] %>")
+ if (flag && is_admin !== 'false' && data.category == 3 ){
+ hash = {field: 'money',title: '金额',width: 150, align: 'center',hide: gon.filter.money }
+ money_cols_table[0].splice(8, 0, hash)
+ }
table.reload('shixuns_table', {
page: {
curr: 1
},
- cols:arr,
- where: {q: data}
+ cols: money_cols_table,
+ where: {q: data},
+ done:function (res, curr, count){
+ tableDataCount = count;
+ }
})
+
+
document.getElementById('shixun_nav_type_id').value = i
});
}
}
\ No newline at end of file