app/views/educode_sales/ideas/new.html.erb in educode_sales-0.9.59 vs app/views/educode_sales/ideas/new.html.erb in educode_sales-0.9.60
- old
+ new
@@ -4,14 +4,22 @@
<div class="layui-form-item" style="padding: 25px">
<div class="layui-row">
<h2 style="padding-left: 25px">方案信息</h2>
</div>
<div class="layui-row" style="padding-top: 15px">
- <div class="layui-inline">
- <label class="layui-form-label required">单位部门</label>
- <div class="layui-input-block" id="department" style="width: 300px;"></div>
+ <div class="layui-col-md6">
+ <labeL class="layui-form-label required">学校/单位:</labeL>
+ <div class="layui-input-block">
+ <input type="text" name="school_name" autocomplete="off" lay-verify="required" lay-reqtext="学校不能为空" placeholder="请输入学校/单位名称" value="<%= @idea&.school_name %>" class="layui-input">
+ </div>
</div>
+ <div class="layui-col-md6">
+ <labeL class="layui-form-label">院系/部门:</labeL>
+ <div class="layui-input-block">
+ <input type="text" name="department_name" autocomplete="off" placeholder="请输入院系/部门名称" value="<%= @idea&.department_name %>" class="layui-input">
+ </div>
+ </div>
</div>
<div class="layui-row" style="padding-top: 15px">
<div class="layui-col-md6">
<labeL class="layui-form-label">学校负责人:</labeL>
<div class="layui-input-block">
@@ -25,19 +33,33 @@
</div>
</div>
</div>
<div class="layui-row" style="padding-top: 15px">
<div class="layui-col-md6">
+ <labeL class="layui-form-label required">销售负责人:</labeL>
+ <div class="layui-input-block">
+ <div id="sale_staff_id"></div>
+ </div>
+ </div>
+ <div class="layui-col-md6">
+ <labeL class="layui-form-label">协作人:</labeL>
+ <div class="layui-input-block">
+ <div id="assist_staff_ids"></div>
+ </div>
+ </div>
+ </div>
+ <div class="layui-row" style="padding-top: 15px">
+ <div class="layui-col-md6">
<labeL class="layui-form-label required">项目名称:</labeL>
<div class="layui-input-block">
<input type="text" name="name" autocomplete="off" lay-verify="required" lay-reqtext="项目名称不能为空" placeholder="请输入项目名称" value="<%= @idea&.name %>" class="layui-input">
</div>
</div>
<div class="layui-col-md6">
- <labeL class="layui-form-label required">指派人:</labeL>
+ <labeL class="layui-form-label required">方案指派人:</labeL>
<div class="layui-input-block">
- <%= select_tag "staff_id", options_for_select(EducodeSales::Staff.all.map { |d| [d.user&.real_name, d.id] }, @idea&.staff_id), { 'lay-filter': 'staff_id', include_blank: false } %>
+ <div id="new_staff_id"></div>
</div>
</div>
</div>
<div class="layui-row" style="padding-top: 15px">
<div class="layui-col-md6">
@@ -73,63 +95,121 @@
<div class="layui-input-block">
<input type="number" name="hardware" autocomplete="off" lay-verify="required" lay-reqtext="硬件规模不能为空" placeholder="请输入硬件规模" value="<%= @idea&.hardware %>" class="layui-input">
</div>
</div>
<div class="layui-col-md6">
- <labeL class="layui-form-label required">项目预算(万):</labeL>
+ <labeL class="layui-form-label">项目预算(万):</labeL>
<div class="layui-input-block">
- <input type="number" name="money" autocomplete="off" lay-verify="required" lay-reqtext="项目预算不能为空" placeholder="请输入项目预算" value="<%= @idea&.money %>" class="layui-input">
+ <input type="number" name="money" autocomplete="off" placeholder="请输入项目预算" value="<%= @idea&.money %>" class="layui-input">
</div>
</div>
</div>
<div class="layui-row" style="padding-top: 5px">
<div class="layui-col-md6">
- <labeL class="layui-form-label required">项目规模(人):</labeL>
+ <labeL class="layui-form-label">并发规模(人):</labeL>
<div class="layui-input-block">
- <input type="number" name="project" autocomplete="off" lay-verify="required" lay-reqtext="项目规模不能为空" placeholder="请输入项目规模" value="<%= @idea&.project %>" class="layui-input">
+ <input type="number" name="project" autocomplete="off" placeholder="请输入项目规模" value="<%= @idea&.project %>" class="layui-input">
</div>
</div>
<div class="layui-col-md6">
<labeL class="layui-form-label required">截止时间:</labeL>
<div class="layui-input-block">
<input type="text" id="new_time" name="end_time" autocomplete="off" lay-verify="required" lay-reqtext="截止时间不能为空" placeholder="请选择截止时间" value="<%= @idea&.end_time&.to_s(:date) %>" class="layui-input">
</div>
</div>
</div>
+ <div class="layui-row" style="padding-top: 5px;display: none">
+ <div class="layui-col-md6">
+ <labeL class="layui-form-label">文件id:</labeL>
+ <div class="layui-input-block">
+ <input type="text" name="attachment_id" id="attachment_id" autocomplete="off" value="" class="layui-input">
+ </div>
+ </div>
+ </div>
<div class="layui-row" style="padding-top: 15px">
<labeL class="layui-form-label">反馈情况:</labeL>
<div class="layui-input-block">
<textarea name="content" placeholder="反馈情况" class="layui-textarea"><%= @idea&.content.to_s %></textarea>
</div>
</div>
+ <div class="layui-row" style="padding-top: 15px">
+ <div class="layui-col-md6">
+ <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>
<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>
</div>
</div>
</div>
</div>
<script>
- layui.use(['form', 'table', 'upload', 'layer', 'laytpl', 'request', 'selectInput', 'xmSelect'], function () {
+
+ function displayFile() {
+ var input = document.getElementById("fileInput");
+ var fileName = document.getElementById("fileName");
+ fileName.innerText = "已选择文件:" + input.files[0].name;
+ }
+
+ function uploadFile() {
+ var input = document.getElementById("fileInput");
+ var file = input.files[0];
+ var formData = new FormData();
+ formData.append("file", file);
+
+ var xhr = new XMLHttpRequest();
+ xhr.open("POST", "/api/upload");
+ xhr.onload = function() {
+ if (xhr.status === 200) {
+ console.log(xhr.responseText);
+ alert("上传成功!");
+ } else {
+ alert("上传失败!");
+ }
+ };
+ xhr.send(formData);
+ }
+
+ layui.use(['form', 'upload', 'table', 'upload', 'layer', 'laytpl', 'request', 'selectInput', 'xmSelect'], function () {
var form = layui.form,
layer = layui.layer,
request = layui.request,
laydate = layui.laydate,
table = layui.table,
laytpl = layui.laytpl,
request = layui.request,
xmSelect = layui.xmSelect,
+ upload = layui.upload,
$ = layui.$;
selectInput = layui.selectInput;
form.render();
//时间常规用法
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)
+ }
+ });
+
+
var department_id = gon.value;
var department = selectInput.render({
elem: '#department',
name: 'department', // 渲染的input的name值
layFilter: 'department_filter', //同layui form参数lay-filter
@@ -153,17 +233,40 @@
});
// 当前弹出层,防止ID被覆盖
var parentIndex = layer.index;
+
+ var staff_list = xmSelect.render({
+ el: '#new_staff_id',
+ data: gon.staffs,
+ filterable: true,
+ radio: true,
+ })
+ var sale_staff_list = xmSelect.render({
+ el: '#sale_staff_id',
+ data: gon.staffs,
+ filterable: true,
+ radio: true,
+ })
+ var assist_staff_list = xmSelect.render({
+ el: '#assist_staff_ids',
+ data: gon.staffs,
+ filterable: true,
+ multiple:true
+ })
+
//监听提交
form.on('submit(saveBtn)', function (data) {
- if (department.getValue() == "" && department_id == "") {
- layer.alert("请选择单位部门")
- return false;
- } else {
+ // if (department.getValue() == "" && department_id == "") {
+ // layer.alert("请选择单位部门")
+ // return false;
+ // } else {
data.field.department_id = department.getValue() || department_id;
+ 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');
request.authPost("missions/ideas/", data.field, function (res) {
if (res.success == false) {
layer.alert(res.msg)
} else {
layer.close(parent.add_idea_index);
@@ -172,10 +275,10 @@
done: function () {
}
});
}
})
- }
+ // }
return false;
});
});
</script>
\ No newline at end of file