1、去除项目选择项目时间周期的联动操作

2、优化项目选择弹层操作
This commit is contained in:
HDM58\hdm58 2023-10-12 14:26:27 +08:00
parent 8e2942f1be
commit 65aa20bd66
5 changed files with 71 additions and 72 deletions

View File

@ -163,8 +163,7 @@
//日期范围
laydate.render({
elem: '#date',
range: ['#start_time', '#end_time'],
rangeLinked:true
range: ['#start_time', '#end_time']
});
//日期
@ -172,7 +171,6 @@
laydate.render({
elem: this,
range: '到',
rangeLinked:true,
trigger: 'click'
});
});

View File

@ -56,6 +56,16 @@
.layui-icon[data-on]{color:#4285f4;}
.check-item-status{color:#969696; font-size:12px; margin-left:3px;}
.check-item:last-child .layui-icon-right{display:none;}
tr[data-level="1"] td{
background-color: #f9f9f9;
}
tr[data-level="2"] td{
background-color: #fbfbfb;
}
tr[data-level="2"] td{
background-color: #fdfdfd;
}
</style>
{/block}
<!-- 主体 -->
@ -66,7 +76,7 @@
<i class="iconfont icon-wodedianping" title="编辑" data-id="{$detail.id}" data-name="name"></i>
</h2>
<div>
<span class="layui-badge layui-bg-gray">#T{$detail.id}</span>
<span class="layui-badge layui-bg-gray">#P{$detail.id}</span>
<span class="mx-2">{$detail.admin_name}</span>
<span class="gray">创建于{$detail.times}<span id="editTips">{gt name="$detail.update_time"
value="0"},最近更新于 {:time_trans($detail.update_time)}{/gt}</span></span>

View File

@ -4,6 +4,8 @@ layui.define(['layer','dtree'],function(exports){
var dtree = layui.dtree;
var opts={
"title":'选择员工',
"department_url": "/api/index/get_department_tree",
"employee_url": "/api/index/get_employee",
"type":1,
"ids":[],
"names":[],
@ -235,8 +237,6 @@ layui.define(['layer','dtree'],function(exports){
ids:ids,
names:names,
type:0,
department_url: "/api/index/get_department_tree",
employee_url: "/api/index/get_employee",
callback:function(ids,names,dids,departments){
that.val(names);
that.next().val(ids);
@ -256,8 +256,6 @@ layui.define(['layer','dtree'],function(exports){
ids:ids_array,
names:names_array,
type:1,
department_url: "/api/index/get_department_tree",
employee_url: "/api/index/get_employee",
callback:function(ids,names,dids,departments){
that.val(names.join(','));
that.next().val(ids.join(','));

View File

@ -1,9 +1,10 @@
layui.define(['tool','employeepicker','tinymce'], function (exports) {
layui.define(['tool','employeepicker','tinymce','oaTool'], function (exports) {
let form = layui.form;
let table = layui.table;
let laydate = layui.laydate;
let dropdown = layui.dropdown;
let employeepicker = layui.employeepicker;
let oaTool = layui.oaTool;
let tinymce = layui.tinymce;
let obj = {
//文本
@ -52,8 +53,6 @@ layui.define(['tool','employeepicker','tinymce'], function (exports) {
employeepicker.init({
ids: real_txt.toString(),
names: show_txt,
department_url: "/api/index/get_department_tree",
employee_url: "/api/index/get_employee",
type: 0,
callback: function (ids, names) {
editPost(id, name, names, ids);
@ -72,61 +71,26 @@ layui.define(['tool','employeepicker','tinymce'], function (exports) {
employeepicker.init({
ids: ids,
names: names,
department_url: "/api/index/get_department_tree",
employee_url: "/api/index/get_employee",
type: 1,
callback: function (ids, names) {
editPost(id, name, names.join(','), ids.join(','));
}
});
},
//ajax表格单选
select_table: function (id, name, real_val, url, editPost) {
let that = this;
let selectTable;
layer.open({
title: '请选择',
area: ['600px', '580px'],
type: 1,
content: '<div class="picker-table">\
<form class="layui-form pb-2">\
<div class="layui-input-inline" style="width:480px;">\
<input type="text" name="keywords" placeholder="项目名称" class="layui-input" autocomplete="off" />\
</div>\
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="search_form">提交搜索</button>\
</form>\
<div id="selectTable"></div></div>',
success: function () {
selectTable = table.render({
elem: '#selectTable'
, url: url
, page: true //开启分页
, limit: 10
, cols: [[
{ type: 'radio', title: '选择' }
, { field: 'id', width: 100, title: '编号', align: 'center' }
, { field: 'title', title: '项目名称' }
]]
});
//项目搜索提交
form.on('submit(search_form)', function (data) {
selectTable.reload({ where: { keywords: data.field.keywords }, page: { curr: 1 } });
return false;
});
},
btn: ['确定'],
yes: function () {
var checkStatus = table.checkStatus(selectTable.config.id);
var data = checkStatus.data;
if (data.length > 0) {
editPost(id, name, data[0].title, data[0].id);
}
else {
layer.msg('请选择');
return false;
}
}
})
//项目
select_table: function (id, name, real_val, editPost) {
let callback = function(data){
editPost(id, name, data.title, data.id);
}
oaTool.projectPicker(callback);
},
//任务
select_task: function (id, name, real_val, editPost) {
let callback = function(data){
console.log(data.id);
editPost(id, name, data.title, data.id);
}
oaTool.taskPicker(callback);
},
//表格单选
select_type: function (id, name, real_val, data, editPost) {

View File

@ -17,6 +17,11 @@ layui.define(['tool'], function (exports) {
}
};
//是否是对象
function isObject(val) {
return typeof val === 'object' && val !== null
}
//格式化文件大小
function renderSize(value){
if(null==value||value==''){
@ -387,9 +392,9 @@ layui.define(['tool'], function (exports) {
return false;
});
},
btn: ['确定'],
btn: ['确定选择','清除数据'],
btnAlign: 'c',
yes: function () {
btn1: function () {
var checkStatus = table.checkStatus(projectTable.config.id);
var data = checkStatus.data;
if (data.length > 0) {
@ -400,15 +405,20 @@ layui.define(['tool'], function (exports) {
layer.msg('请先选择项目');
return false;
}
},
btn2: function () {
callback({'id':0,'title':''});
layer.closeAll();
}
})
},
//选择任务
taskPicker:function(project_id,callback){
var taskTable;
taskPicker:function(callback,where){
let map = isObject(where)?where:{};
let taskTable;
let taskLayer = layer.open({
title: '选择任务',
area: ['600px', '580px'],
area: ['666px', '580px'],
type: 1,
content: '<div class="picker-table">\
<form class="layui-form pb-2">\
@ -424,22 +434,24 @@ layui.define(['tool'], function (exports) {
, url: '/project/api/get_task'
, page: true //开启分页
, limit: 10
, where:{'project_id':project_id}
, where:map
, cols: [[
{ type: 'radio', title: '选择' }
, { field: 'id', width: 100, title: '编号', align: 'center' }
, { field: 'id', width: 90, title: '编号', align: 'center' }
, { field: 'title', title: '任务主题' }
, { field: 'project_name', width: 200, title: '关联项目' }
]]
});
//合同搜索提交
//任务搜索提交
form.on('submit(search_project)', function (data) {
taskTable.reload({ where: { keywords: data.field.keywords }, page: { curr: 1 } });
let maps = $.extend({}, map, data.field);
taskTable.reload({ where: maps, page: { curr: 1 } });
return false;
});
},
btn: ['确定'],
btn: ['确定选择','清除数据'],
btnAlign: 'c',
yes: function () {
btn1: function () {
var checkStatus = table.checkStatus(taskTable.config.id);
var data = checkStatus.data;
if (data.length > 0) {
@ -447,9 +459,13 @@ layui.define(['tool'], function (exports) {
layer.close(taskLayer);
}
else {
layer.msg('请先选择任务主题');
layer.msg('请先选择任务');
return false;
}
},
btn2: function () {
callback({'id':0,'title':''});
layer.closeAll();
}
})
}
@ -551,5 +567,18 @@ layui.define(['tool'], function (exports) {
obj.projectPicker(callback);
});
//选择任务
$('body').on('click','.picker-task',function () {
let that = $(this);
let projectid = that.data('projectid'),taskid = that.data('taskid');
let project_id = projectid?projectid:0;
let task_id = taskid?taskid:0;
let callback = function(data){
that.val(data.title);
that.next().val(data.id);
}
obj.taskPicker(callback,{project_id:project_id,task_id:task_id});
});
exports('oaTool', obj);
});