app/views/educode_sales/ideas/edit.html.erb in educode_sales-0.9.64 vs app/views/educode_sales/ideas/edit.html.erb in educode_sales-0.9.65

- old
+ new

@@ -136,10 +136,16 @@ <labeL class="layui-form-label">方案材料:</labeL> <div class="layui-btn-container"> <button type="button" class="layui-btn layui-btn-normal" id="test8">选择文件</button> </div> </div> + <div class="layui-col-md6"> + <labeL class="layui-form-label">文件:</labeL> + <div class="layui-input-block"> + <div id="attachment_ids"></div> + </div> + </div> </div> <div class="layui-row" style="padding-top: 30px; float: left"> <div class="layui-input-block"> <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">确认保存</button> </div> @@ -282,22 +288,22 @@ laydate.render({ elem: '#new_time' }); form.render(); - upload.render({ - elem: '#test8' - , url: '/missions/upload_files' //此处配置你自己的上传接口即可 - , auto: true - , accept: 'file' //普通文件 - , bindAction: '#test9' - , done: function (res) { - layer.msg('上传成功'); - $("#attachment_id").val(res.attachment_id) - // $("#filename").val(res.filename) - } - }); + // upload.render({ + // elem: '#test8' + // , url: '/missions/upload_files' //此处配置你自己的上传接口即可 + // , auto: true + // , accept: 'file' //普通文件 + // , bindAction: '#test9' + // , done: function (res) { + // layer.msg('上传成功'); + // $("#attachment_id").val(res.attachment_id) + // // $("#filename").val(res.filename) + // } + // }); var staff_list = xmSelect.render({ el: '#new_staff_id', data: gon.staffs, @@ -313,16 +319,43 @@ }) var assist_staff_list = xmSelect.render({ el: '#assist_staff_ids', data: gon.staffs, filterable: true, - multiple:true + multiple: true }) + + var attachment_list = xmSelect.render({ + el: '#attachment_ids', + data: [], + filterable: true, + multiple: true + }) + + + upload.render({ + elem: '#test8' + , url: '/missions/upload_files' //此处配置你自己的上传接口即可 + , auto: true + , accept: 'file' //普通文件 + , bindAction: '#test9' + , done: function (res) { + layer.msg('上传成功'); + // $("#attachment_id").val(res.attachment_id) + // $("#filename").val(res.filename) + a = attachment_list.getValue() + b = [{name: res.filename, value: res.attachment_id}] + c = a.concat(b) + attachment_list.setValue(c) + } + }); + staff_list.setValue(gon.staff_value) sale_staff_list.setValue(gon.sale_staff_value) assist_staff_list.setValue(gon.assist_staff_value) + attachment_list.setValue(gon.attachment_list) var department_id = gon.value; var department = selectInput.render({ elem: '#department', name: 'department', // 渲染的input的name值 @@ -352,9 +385,10 @@ //监听提交 form.on('submit(saveBtn)', function (data) { data.field.staff_id = staff_list.getValue('valueStr'); data.field.sale_staff_id = sale_staff_list.getValue('valueStr'); data.field.assist_staff_ids = assist_staff_list.getValue('valueStr'); + data.field.attachment_ids = attachment_list.getValue('valueStr'); var schools = []; school_list.getValue().forEach(function (d) { schools.push(d.value); }) if (schools.length == 0) { \ No newline at end of file