app/views/educode_sales/businesses/edit.html.erb in educode_sales-0.9.66 vs app/views/educode_sales/businesses/edit.html.erb in educode_sales-0.9.67
- old
+ new
@@ -31,10 +31,24 @@
<div class="layui-inline" style="padding-top: 10px">
<p style="padding-left: 40px">选择的商机及其下的跟进记录将会合并到该编辑的商机中</p>
</div>
</div>
<% end %>
+ <% if @current_admin.is_admin? %>
+ <div class="layui-form-item m-t-20">
+ <label class="layui-form-label">商机等级</label>
+ <div class="layui-input-inline">
+ <div id="levels" style="width: 300px;"></div>
+ </div>
+ </div>
+ <div class="layui-form-item m-t-20 layui-hide" id="watch_ids_wraper">
+ <label class="layui-form-label">指定查看人员</label>
+ <div class="layui-input-inline">
+ <div id="watch_ids" style="width: 300px;"></div>
+ </div>
+ </div>
+ <% end %>
<div class="layui-form-item m-t-20">
<div class="layui-input-block">
<button class="layui-btn layui-btn-normal" lay-submit lay-filter="edit_business">提交</button>
</div>
</div>
@@ -49,10 +63,39 @@
request = layui.request,
xmSelect = layui.xmSelect,
$ = layui.$;
selectInput = layui.selectInput;
+ var levels_select = xmSelect.render({
+ el: '#levels',
+ name: 'level_ids',
+ data: gon.levels,
+ on: function(data) {
+ var is_secret = false;
+ data.arr.forEach(function(i) {
+ if (i.name == '战略型' || i.name == '保密型') {
+ is_secret = true;
+ }
+ })
+ if (is_secret) {
+ $("#watch_ids_wraper").removeClass('layui-hide')
+ } else {
+ $("#watch_ids_wraper").addClass('layui-hide')
+ }
+ }
+ })
+
+ var watch_id_select = xmSelect.render({
+ el: '#watch_ids',
+ name: 'watch_ids',
+ data: gon.watche_ids,
+ filterable: true,
+ })
+ if (gon.is_secret) {
+ $("#watch_ids_wraper").removeClass("layui-hide")
+ }
+
form.render();
var department_id = gon.value;
var department = selectInput.render({
elem: '#department',
name: 'department', // 渲染的input的name值
@@ -97,15 +140,14 @@
form.on('submit(edit_business)', function (data) {
if (department.getValue() == "" && department_id == "") {
layer.alert("请选择单位部门")
return false;
} else {
- request.authPut("missions/businesses/" + parent.id, {
- department_id: department.getValue() || department_id,
- name: data.field.name,
- source: data.field.source,
- merge_business_ids: data.field.merge_business_ids,
- }, function (res) {
+ var field = data.field;
+ console.log('field', field)
+ field.department_id = department.getValue() || department_id;
+ field.merge_business_ids = data.field.merge_business_ids;
+ request.authPut("missions/businesses/" + parent.id, field, function (res) {
if (res.success == false) {
layer.alert(res.msg)
} else {
layer.close(parent.sindex);
parent.layer.close(parent.layer.getFrameIndex(window.name))
\ No newline at end of file