app/views/educode_sales/ideas/new.html.erb in educode_sales-0.9.64 vs app/views/educode_sales/ideas/new.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>
@@ -273,24 +279,13 @@
})
}
})
- 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 department_id = gon.value;
var department = selectInput.render({
elem: '#department',
name: 'department', // 渲染的input的name值
layFilter: 'department_filter', //同layui form参数lay-filter
@@ -334,10 +329,35 @@
data: gon.staffs,
filterable: true,
multiple: true
})
+ var attachment_list = xmSelect.render({
+ el: '#attachment_ids',
+ data: gon.attachments,
+ 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)
+ }
+ });
+
//监听提交
form.on('submit(saveBtn)', function (data) {
// if (department.getValue() == "" && department_id == "") {
// layer.alert("请选择单位部门")
// return false;
@@ -359,19 +379,20 @@
})
data.field.department_id = departments[0];
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');
request.authPost("missions/ideas/", data.field, function (res) {
if (res.success == false) {
layer.alert(res.msg)
} else {
layer.close(parent.add_idea_index);
parent.layer.close(parent.layer.getFrameIndex(window.name))
parent.table.reload('ideas_table', {
- done: function () {
- }
- });
+ done: function () {
+ }
+ });
}
})
// }
return false;
});
\ No newline at end of file