1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- {extend name="common/base"/}
- {block name="style"}
- <style>
- .footer{
- display: none;
- }
-
- .layui-input-block{
- padding: 15px;
- }
-
- .note{
- padding: 0 0 0 15px;
- }
-
- .button{
- text-align: center;
- }
- </style>
- {/block}
- <!-- 主体 -->
- {block name="body"}
- <div id="ID-test-layer-wrapper" >
- <div style="height: 100px;display: flex;align-items: center;padding-left: 15px;">
- <button class="layui-btn layui-btn layui-bg-blue" style="float: center;" type="button"
- id="uploadBtn" >选择附件
- <div>
-
- </div>
- </div>
- <form class="layui-form layui-form-pane" action="">
- <div class="layui-form-item">
- <div class="layui-form-item layui-form-text">
- <div class="note">附件说明:</div>
- <div class="layui-input-block">
- <textarea name="remark" placeholder="请输入附件说明" class="layui-textarea"></textarea>
- </div>
- </div>
- <div class="layui-form-item button">
- <button class="layui-btn" lay-submit lay-filter="demo2" onclick="parent.location.reload();" value="刷新父页面">确认</button>
- <button id="closeIframe" class="layui-btn layui-btn-primary">取消</button>
- </div>
- </form>
- </div>
- {/block}
- {block name="script"}
- <script>
- const moduleInit = ['tool', 'oaTool'];
- function gouguInit() {
- var table = layui.table, tool = layui.tool, form = layui.form, oaTool = layui.oaTool;
- let formData;
- oaTool.addFile({
- type: 1,
- isSave: true,
- ajaxSave: function (res) {
- formData = res
- if(res.code == 0 ){
- layer.msg(res.msg)
- }
- }
- });
-
-
-
- var index = parent.layer.getFrameIndex(window.name);
- $('#closeIframe').click(function(){
- parent.layer.close(index);
- });
- form.on('submit(demo2)', function(data){
- var field = data.field;
- let callback = function (e) {
- if("msg" in e){
- layer.msg(e.msg);
- }else{
- layer.msg('上传成功!')
- }
- setTimeout(function () {
- parent.layer.close(index);
- $("#filesBox2").load(location.href+" #filesBox>*","type=2")
- }, 500)
- }
- // console.log(field)
- tool.post("/admin/project.api/add_file", { // 上传附件
- 'topic_id': "{$detailId}",
- 'file_id': formData.data.id,
- 'file_name': formData.data.name,
- 'module': 'project',
- 'remark': field.remark
- }, callback);
- return false; // 阻止默认 form 跳转
- });
-
- }
- </script>
- {/block}
-
|