123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- {extend name="common/base"/}
- <!-- 主体 -->
- {block name="body"}
- <form class="layui-form p-4">
- <h3 class="pb-3">部门架构</h3>
- {eq name="$id" value="0"}
- <table class="layui-table">
- <tr>
- <td class="layui-td-gray">部门名称<font>*</font></td>
- <td>
- <input type="text" name="title" lay-verify="required" autocomplete="off" placeholder="请输入部门名称" lay-reqText="请输入部门名称" class="layui-input">
- </td>
- <td class="layui-td-gray">上级部门<font>*</font></td>
- <td>
- <select name="pid" lay-verify="required" lay-reqText="请选择上级部门">
- <option value="0">作为顶级部门</option>
- {volist name="department" id="v"}
- <option value="{$v.id}" {eq name="$pid" value="$v.id"} selected{/eq}>{$v.title}</option>
- {/volist}
- </select>
- </td>
- </tr>
- {if $permission == 1}
- <tr>
- <td class="layui-td-gray">单位类型:<font>*</font></td>
- <td>
- <input type="radio" name="type" value="-1" title="系统方" checked>
- <input type="radio" name="type" value="0" title="财政局">
- <input type="radio" name="type" value="1" title="业主">
- <input type="radio" name="type" value="2" title="公司">
- </td>
- </tr>
- {/if}
- <tr>
- <td class="layui-td-gray-2">部门联系电话</td>
- <td colspan="3">
- <input type="text" name="phone" placeholder="请输入部门联系电话,可空" autocomplete="off" class="layui-input">
- </td>
- </tr>
- </table>
- {else/}
- <table class="layui-table">
- <tr>
- <td class="layui-td-gray">部门名称<font>*</font></td>
- <td>
- <input type="text" name="title" value="{$detail.title}" lay-verify="required" autocomplete="off" placeholder="请输入部门名称" lay-reqText="请输入部门名称" class="layui-input">
- </td>
- <td class="layui-td-gray">上级部门<font>*</font></td>
- <td>
- <select name="pid" lay-verify="required" lay-reqText="请选择上级部门">
- <option value="0">作为顶级部门</option>
- {volist name="department" id="v"}
- <option value="{$v.id}" {eq name="$detail.pid" value="$v.id"} selected{/eq}>{$v.title}</option>
- {/volist}
- </select>
- </td>
- </tr>
- {if $permission == 1}
- <tr>
- <td class="layui-td-gray">单位类型:<font>*</font></td>
- <td>
- <input type="radio" name="type" value="-1" title="系统方" {eq name="$d_type" value="-1" }checked{/eq}>
- <input type="radio" name="type" value="0" title="财政局"{eq name="$d_type" value="0" }checked{/eq}>
- <input type="radio" name="type" value="1" title="业主"{eq name="$d_type" value="1" }checked{/eq}>
- <input type="radio" name="type" value="2" title="公司"{eq name="$d_type" value="2" }checked{/eq}>
- </td>
- </tr>
- {/if}
- <tr>
- <td class="layui-td-gray-2">部门负责人</td>
- <td>
- <select name="leader_id">
- <option value="0">请选择部门负责人</option>
- {volist name="users" id="v"}
- <option value="{$v.id}" {eq name="detail.leader_id" value="$v.id"} selected{/eq}>{$v.nickname}</option>
- {/volist}
- </select>
- </td>
- <td class="layui-td-gray-2">部门联系电话</td>
- <td>
- <input type="text" name="phone" value="{$detail.phone}" placeholder="请输入部门联系电话,可空" autocomplete="off" class="layui-input">
- </td>
- </tr>
- </table>
- {/eq}
- <div class="py-3">
- <input type="hidden" name="id" value="{$id}">
- <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
- <button type="reset" class="layui-btn layui-btn-primary">重置</button>
- </div>
- </form>
- {/block}
- <!-- /主体 -->
- <!-- 脚本 -->
- {block name="script"}
- <script>
- const moduleInit = ['tool'];
- function gouguInit() {
- var form = layui.form,tool=layui.tool;
-
- let a = 1;
- //监听提交
- form.on('submit(webform)', function(data){
- if(a){
- let callback = function (e) {
- layer.msg(e.msg);
- if (e.code == 0) {
- setTimeout(function () {
- parent.location.reload();
- a = 1
- }, 1000);
- }
- }
- tool.post("/admin/department/add", data.field, callback);
- }
-
- a = 0
- return false;
- });
- }
- </script>
- {/block}
- <!-- /脚本 -->
|