123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434 |
- <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">
- {if $detail.maker_type==2}<button class="layui-btn layui-btn-sm" lay-event="addEntrust">+ 新增委托单位成员</button>{/if}
- <button class="layui-btn layui-btn-sm" lay-event="add_head">+ 新增项目负责人</button>
- <button class="layui-btn layui-btn-sm" lay-event="add">+ 新增作业负责人</button>
- <button class="layui-btn layui-btn-sm picker-more" lay-event="adda">+ 新增作业成员</button>
- <button class="layui-btn layui-btn-sm picker-more" lay-event="adc">+ 新增送审单位成员</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_company/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 'addEntrust':
- // let callback = function (){
- // layui.alert("hhh")
- // }
- aaa()
- break;
- case 'add':
- employeepicker.init({
- type: 0,
- department_url: "/admin/project.cost_company/get_department_tree",
- employee_url: "/admin/project.cost_company/get_employee",
- callback: function (ids, names, dids, departments) {
- let callback = function (e) {
- layer.msg(e.msg);
- if (e.code == 0) {
- parent.layui.userTable.reload();
- }
- }
- tool.post("/admin/project.cost_company/add_user_company_type1", {
- id: ids,
- project_id: project_id,
- type: 1
- }, callback);
- }
- })
- break;
- case "adda":
- employeepicker.init({
- type: 0,
- department_url: "/admin/project.cost_company/get_department_tree",
- employee_url: "/admin/project.cost_company/get_employee",
- callback: function (ids, names, dids, departments) {
- let callback = function (e) {
- layer.msg(e.msg);
- if (e.code == 0) {
- parent.layui.userTable.reload();
- }
- }
- tool.post("/admin/project.cost_company/add_user_company_type2", {
- id: ids,
- project_id: project_id,
- type: 2
- }, callback);
- }
- })
- break;
- case "adc":
- // getSentReview()
- let call = function () {
- layer.msg(e.msg);
- if (e.code == 0) {
- parent.layui.userTable.reload();
- }
- }
- // employeepicker.init({
- // type: 0,
- // department_url: "/admin/project.cost_company/get_department_tree",
- // employee_url: "/admin/project.cost_company/get_employee",
- // callback: function (ids, names, dids, departments) {
- // let callback = function (e) {
- // layer.msg(e.msg);
- // if (e.code == 0) {
- // parent.layui.userTable.reload();
- // }
- // }
- // tool.post("/admin/project.cost_company/add_sent_review_unit", {
- // id: ids,
- // project_id: project_id,
- // }, callback);
- // }
- // })
- parent.layui.tool.side('/admin/project.cost_company/add_sent_review_unit?project_id=' + project_id, call);
- break;
- case "add_head":
- employeepicker.init({
- type: 0,
- department_url: "/admin/project.cost_company/get_department_tree",
- employee_url: "/admin/project.cost_company/get_employee",
- callback: function (ids, names, dids, departments) {
- let callback = function (e) {
- layer.msg(e.msg);
- if (e.code == 0) {
- parent.layui.userTable.reload();
- }
- }
- tool.post("/admin/project.cost_company/add_user_company_head", {
- id: ids,
- 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) {
- console.log(postData);
- layer.confirm('确定要移除该项目成员吗?', {icon: 3, title: '提示'}, function (index) {
- tool.delete("/admin/project.cost_company/remove_user_company", postData, callback);
- });
- } else if (obj.data.type == 6) {
- layer.confirm('确定要移除该送审单位成员吗?', {icon: 3, title: '提示'}, function (index) {
- tool.delete("/admin/project.cost_company/remove_sent_review", {
- "id": obj.data.id,
- "project_id": project_id,
- "type": obj.data.type,
- "nickname": obj.data.nickname
- }, callback);
- });
- } else if (obj.data.type == 2) {
- layer.confirm('确定要移除该送审单位成员吗?', {icon: 3, title: '提示'}, function (index) {
- tool.delete("/admin/project.cost_company/remove_review_head", postData, callback);
- });
- } else if (obj.data.type == 1) {
- layer.confirm('确定要移除该委托单位成员吗?', {icon: 3, title: '提示'}, function (index) {
- tool.delete("/admin/project.cost_company/remove_entrust_head", postData, callback);
- });
- }else {
- layer.msg("该成员不可移除");
- }
- }
- return;
- });
- //委托单位
- function aaa(callback){
- var customeTable,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="customerTable"></div></div>',
- success: function () {
- customeTable = table.render({
- elem: '#customerTable'
- , url: '/admin/project.api/get_entrust'
- , page: true //开启分页
- , limit: 10
- , cols: [[
- {type: 'radio', title: '选择'},
-
- {field: 'title', title: '委托单位名称', align: 'center'},
- {field: 'address', title: ' 评审单位地址', align: 'center'}
- ]]
- });
- //客户搜索提交
- form.on('submit(search_customer)', function (data) {
- customeTable.reload({where: {keywords: data.field.keywords}, page: {curr: 1}});
- return false;
- });
- },
- btn: ['确定'],
- btnAlign: 'c',
- yes: function () {
- var checkStatus = table.checkStatus(customeTable.config.id);
- var data = checkStatus.data;
- console.log(data)
- if (data.length > 0) {
- bbb(data);
- layer.close(a);
- } else {
- layer.msg('请先选择委托单位');
- return false;
- }
- }
- })
- }
- function bbb(e){
- var entrustPeopleTable,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="entrustPeopleTable"></div></div>',
- success: function () {
- entrustPeopleTable = table.render({
- elem: '#entrustPeopleTable'
- , url: '/admin/project.api/get_entrust_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) {
- entrustPeopleTable.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(entrustPeopleTable.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_company/add_entrust_people", {
- id: data[0]["id"],
- project_id: project_id,
- }, callback);
- } else {
- layer.msg('请先选择委托单位人员');
- return false;
- }
- }
- })
- }
- 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_company/add_sent_review_unit", {
- id: data[0]["id"],
- project_id: project_id,
- }, callback);
- } else {
- layer.msg('请先选择送审单位人员');
- return false;
- }
- }
- })
- }
- }
- </script>
|