作者 何书鹏

后台规格编辑优化

@@ -151,6 +151,9 @@ class Litestoregoods extends Backend @@ -151,6 +151,9 @@ class Litestoregoods extends Backend
151 if ($this->dataLimit && $this->dataLimitFieldAutoFill) { 151 if ($this->dataLimit && $this->dataLimitFieldAutoFill) {
152 $params[$this->dataLimitField] = $this->auth->id; 152 $params[$this->dataLimitField] = $this->auth->id;
153 } 153 }
  154 + if($params['spec_type'] == '20' && !$this->request->post("spec_many/a")){
  155 + $this->error('请添加规格');
  156 + }
154 try { 157 try {
155 //是否采用模型验证 158 //是否采用模型验证
156 if ($this->modelValidate) { 159 if ($this->modelValidate) {
@@ -223,6 +226,9 @@ class Litestoregoods extends Backend @@ -223,6 +226,9 @@ class Litestoregoods extends Backend
223 if ($this->request->isPost()) { 226 if ($this->request->isPost()) {
224 $params = $this->request->post("row/a"); 227 $params = $this->request->post("row/a");
225 if ($params) { 228 if ($params) {
  229 + if($params['spec_type'] == '20' && !$this->request->post("spec_many/a")){
  230 + $this->error('请添加规格');
  231 + }
226 try { 232 try {
227 //是否采用模型验证 233 //是否采用模型验证
228 if ($this->modelValidate) { 234 if ($this->modelValidate) {
@@ -102,12 +102,14 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','template','litestoreg @@ -102,12 +102,14 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','template','litestoreg
102 if (token) { 102 if (token) {
103 $("input[name='__token__']", form).val(token); 103 $("input[name='__token__']", form).val(token);
104 } 104 }
105 - //关闭弹窗  
106 - var index = parent.Layer.getFrameIndex(window.name);  
107 - var callback = parent.$("#layui-layer" + index).data("callback");  
108 - parent.Layer.close(index);  
109 - //刷新列表  
110 - parent.$("#table").bootstrapTable('refresh'); 105 + if(xhr.responseJSON.code == 1){
  106 + //关闭弹窗
  107 + var index = parent.Layer.getFrameIndex(window.name);
  108 + var callback = parent.$("#layui-layer" + index).data("callback");
  109 + parent.Layer.close(index);
  110 + //刷新列表
  111 + parent.$("#table").bootstrapTable('refresh');
  112 + }
111 } 113 }
112 }, function (data, ret) { 114 }, function (data, ret) {
113 $('.form-group', form).removeClass('has-feedback has-success has-error'); 115 $('.form-group', form).removeClass('has-feedback has-success has-error');
@@ -192,12 +194,14 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','template','litestoreg @@ -192,12 +194,14 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','template','litestoreg
192 if (token) { 194 if (token) {
193 $("input[name='__token__']", form).val(token); 195 $("input[name='__token__']", form).val(token);
194 } 196 }
195 - //关闭弹窗  
196 - var index = parent.Layer.getFrameIndex(window.name);  
197 - var callback = parent.$("#layui-layer" + index).data("callback");  
198 - parent.Layer.close(index);  
199 - //刷新列表  
200 - parent.$("#table").bootstrapTable('refresh'); 197 + if(xhr.responseJSON.code == 1){
  198 + //关闭弹窗
  199 + var index = parent.Layer.getFrameIndex(window.name);
  200 + var callback = parent.$("#layui-layer" + index).data("callback");
  201 + parent.Layer.close(index);
  202 + //刷新列表
  203 + parent.$("#table").bootstrapTable('refresh');
  204 + }
201 } 205 }
202 }, function (data, ret) { 206 }, function (data, ret) {
203 $('.form-group', form).removeClass('has-feedback has-success has-error'); 207 $('.form-group', form).removeClass('has-feedback has-success has-error');