123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259 |
- <div class="p-3 bg-white">
- <table class="layui-hide" id="user" lay-filter="user"></table>
- </div>
- <script type="text/html" id="toolbaruser">
- <div class="layui-btn-container">
- <button class="layui-btn layui-btn-sm" lay-event="add">+ 新增送审单位成员</button>
- <button class="layui-btn layui-btn-sm" lay-event="adda">+ 新增施工单位成员</button>
- </div>
- </script>
- <script>
- function project_user() {
- let tool = layui.tool, table = layui.table, employeepicker = layui.employeepicker;
- //项目成员
- parent.layui.userTable = table.render({
- elem: '#user',
- title: '项目成员列表',
- cellMinWidth: 80,
- toolbar: '#toolbaruser',
- url: "/admin/project.cost/project_user", //数据接口
- where: {'project_id': project_id},
- page: false, //开启分页
- limit: 20,
- cols: [[ //表头
- {field: 'nickname', fixed: 'left', title: '成员姓名', width: 200, align: 'center', rowspan: 2},
- {field: 'unit_name', title: '所在单位', align: 'center', width: 200, rowspan: 2},
- {field: 'type', title: '成员类型', align: 'center', width: 200, rowspan: 2,
- templet:function (a){
- var html= "";
- if(a.type==1){
- html = "项目负责人"
- }else if(a.type==2) {
- html = "项目负责人"
- }else if(a.type==3) {
- html = "作业负责人"
- }else if(a.type==4) {
- html = "作业成员"
- }else if(a.type==5) {
- html = "项目负责人"
- }else if(a.type==6) {
- html = "项目负责人"
- }
- return html;
- }},
- {field: 'unit_type', title: '单位类型', align: 'center', width: 200, rowspan: 2},
- {field: 'mobile', title: '手机号码', align: 'center', rowspan: 2},
- {field: 'email', title: '单位邮箱', align: 'center', rowspan: 2},
- {
- title: '操作', fixed: 'right', align: 'center', width: 150, rowspan: 2, templet: function (d) {
- var html = '<span class="layui-btn layui-btn-danger layui-btn-xs" lay-event="remove">移除</span>';
- return html;
- }
- }
- ]]
- });
- //触发事件
- table.on('toolbar(user)', function (obj) {
- var checkStatus = table.checkStatus(obj.config.id);
- switch (obj.event) {
- case 'add':
- // getSentReview()
- let call = function () {
- layer.msg(e.msg);
- if (e.code == 0) {
- parent.layui.userTable.reload();
- }
- }
-
- parent.layui.tool.side('/admin/project.cost/add_sent_review_unit?project_id=' + project_id, call);
-
- break;
- case "adda":
- let callback = function (){
- layer.msg(e.msg);
- if (e.code == 0) {
- parent.layui.userTable.reload();
- }
- }
- parent.layui.tool.side('/admin/project.cost/addconstructionpeople?project_id=' + project_id,callback);
- break;
- }
- });
- //监听行工具事件
- table.on('tool(user)', function (obj) {
- let postData = {"id": obj.data.id, "project_id": project_id, "type": obj.data.type};
- let callback = function (e) {
- layer.closeAll();
- layer.msg(e.msg);
- if (e.code == 0) {
- parent.layui.userTable.reload();
- }
- }
- if (obj.event === 'remove') {
- if (obj.data.type == 3 || obj.data.type == 4) {
- let callback = function (e) {
- layer.closeAll();
- layer.msg(e.msg);
- if (e.code == 0) {
- parent.layui.userTable.reload();
- }
- }
- layer.confirm('确定要移除该项目成员吗?', {icon: 3, title: '提示'}, function (index) {
- tool.delete("/admin/project.cost_company/remove_user", postData, callback);
- });
- }else if(obj.data.type == 5){
- let callback = function (e) {
- layer.closeAll();
- layer.msg(e.msg);
- if (e.code == 0) {
- parent.layui.userTable.reload();
- }
- }
- layer.confirm('确定要移除该项目成员吗?', {icon: 3, title: '提示'}, function (index) {
- tool.delete("/admin/project.cost/remove_construction_user", postData, callback);
- });
- } else if(obj.data.type == 6){
- let callback = function (e) {
- layer.closeAll();
- layer.msg(e.msg);
- if (e.code == 0) {
- parent.layui.userTable.reload();
- }
- }
- layer.confirm('确定要移除该项目成员吗?', {icon: 3, title: '提示'}, function (index) {
- tool.delete("/admin/project.cost/remove_sent_review", {"id": obj.data.id, "project_id": project_id, "type": obj.data.type,"nickname":obj.data.nickname}, callback);
- });
- }
- else {
- console.log(postData);
- layer.msg("该成员不可移除");
- }
- }
- return;
- });
- function getSentReview(){
- var sentReviewTable,form = layui.form;
- const a = 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_customer">提交搜索</button>\
- </form>\
- <div id="sentReviewTable"></div></div>',
- success: function () {
- sentReviewTable = table.render({
- elem: '#sentReviewTable'
- , url: '/admin/project.api/get_sent_review'
- , page: true //开启分页
- , limit: 10
- , cols: [[
- {type: 'radio', title: '选择'},
- {field: 'id', width: 80, title: '编号', align: 'center'},
- {field: 'title', title: '送审单位名称', align: 'center'},
- {field: 'address', title: ' 送审单位地址', align: 'center'}
- ]]
- });
- //客户搜索提交
- form.on('submit(search_customer)', function (data) {
- sentReviewTable.reload({where: {keywords: data.field.keywords}, page: {curr: 1}});
- return false;
- });
- },
- btn: ['确定'],
- btnAlign: 'c',
- yes: function () {
- var checkStatus = table.checkStatus(sentReviewTable.config.id);
- var data = checkStatus.data;
- console.log(data)
- if (data.length > 0) {
- getSentReviewPeople(data);
- layer.close(a);
- } else {
- layer.msg('请先选择送审单位');
- return false;
- }
- }
- })
- }
- function getSentReviewPeople(e){
- var sentReviewPeople,form = layui.form;
- 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="entrustPeople">提交搜索</button>\
- </form>\
- <div id="sentReviewPeople"></div></div>',
- success: function () {
- sentReviewPeople = table.render({
- elem: '#sentReviewPeople'
- , url: '/admin/project.api/get_sent_review_people'
- , where:{unit_id:e[0]["id"]}
- , page: true //开启分页
- , limit: 10
- , cols: [[
- {type: 'radio', title: '选择'},
- {field: 'id', width: 80, title: '编号', align: 'center'},
- {field: 'nickname', title: '昵称', align: 'center'},
- ]]
- });
- //客户搜索提交
- form.on('submit(entrustPeople)', function (data) {
- sentReviewPeople.reload({where: {keywords: data.field.keywords,unit_id:e[0]["id"]}, page: {curr: 1}});
- return false;
- });
- },
- btn: ['确定'],
- btnAlign: 'c',
- yes: function () {
- var checkStatus = table.checkStatus(sentReviewPeople.config.id);
- var data = checkStatus.data;
- console.log(data)
- if (data.length > 0) {
- let callback = function (e) {
- layer.msg(e.msg);
- if (e.code == 0) {
- layer.closeAll();
- parent.layui.userTable.reload();
- }
- }
- tool.post("/admin/project.cost/add_sent_review_unit", {
- id: data[0]["id"],
- project_id: project_id,
- }, callback);
- } else {
- layer.msg('请先选择送审单位人员');
- return false;
- }
- }
- })
- }
- }
- </script>
|