|
@@ -77,7 +77,7 @@
|
|
|
<!-- 通用名 -->
|
|
|
<div class="customize-form-group edit">
|
|
|
<label class="is-required">通用名:</label>
|
|
|
- <input type="text" name="generic_name" class="styled-input edit_inputs" />
|
|
|
+ <input type="text" name="generic_name" id="generic_name" class="styled-input edit_inputs" />
|
|
|
<span class="span_line" readonly></span>
|
|
|
</div>
|
|
|
|
|
@@ -441,7 +441,7 @@
|
|
|
|
|
|
<div class="customize-form-group edit">
|
|
|
<label class="is-required">是否凭处方销售:</label>
|
|
|
- <select name="prescription_required" class="styled-input edit_inputs" th:with="type=${@dict.getType('sys_select_yes_no')}">
|
|
|
+ <select name="prescription_required" class="styled-input edit_inputs" th:with="type=${@dict.getType('sys_select_yes_no')}" required>
|
|
|
<option value="">请选择</option>
|
|
|
<option th:each="dict : ${type}" th:value="${dict.dictValue}" th:text="${dict.dictLabel}"></option>
|
|
|
</select>
|
|
@@ -471,7 +471,7 @@
|
|
|
|
|
|
<div class="customize-form-group edit">
|
|
|
<label class="is-required">登记品:</label>
|
|
|
- <select name="registered_item" class="styled-input edit_inputs" th:with="type=${@dict.getType('sys_select_yes_no')}">
|
|
|
+ <select name="registered_item" class="styled-input edit_inputs" th:with="type=${@dict.getType('sys_select_yes_no')}" required>
|
|
|
<option value="">请选择</option>
|
|
|
<option th:each="dict : ${type}" th:value="${dict.dictValue}" th:text="${dict.dictLabel}"></option>
|
|
|
</select>
|
|
@@ -480,7 +480,7 @@
|
|
|
|
|
|
<div class="customize-form-group edit">
|
|
|
<label class="is-required">随访品:</label>
|
|
|
- <select name="follow_up_item" class="styled-input edit_inputs" th:with="type=${@dict.getType('sys_select_yes_no')}">
|
|
|
+ <select name="follow_up_item" id="follow_up_item" class="styled-input edit_inputs" th:with="type=${@dict.getType('sys_select_yes_no')}" required>
|
|
|
<option value="">请选择</option>
|
|
|
<option th:each="dict : ${type}" th:value="${dict.dictValue}" th:text="${dict.dictLabel}"></option>
|
|
|
</select>
|
|
@@ -489,7 +489,7 @@
|
|
|
|
|
|
<div class="customize-form-group edit">
|
|
|
<label class="is-required">冷链品:</label>
|
|
|
- <select name="cold_chain_item" class="styled-input edit_inputs" th:with="type=${@dict.getType('sys_select_yes_no')}">
|
|
|
+ <select name="cold_chain_item" class="styled-input edit_inputs" th:with="type=${@dict.getType('sys_select_yes_no')}" required>
|
|
|
<option value="">请选择</option>
|
|
|
<option th:each="dict : ${type}" th:value="${dict.dictValue}" th:text="${dict.dictLabel}"></option>
|
|
|
</select>
|
|
@@ -498,7 +498,7 @@
|
|
|
|
|
|
<div class="customize-form-group edit">
|
|
|
<label class="is-required">流向品:</label>
|
|
|
- <select name="flow_item" class="styled-input edit_inputs" th:with="type=${@dict.getType('sys_select_yes_no')}">
|
|
|
+ <select name="flow_item" class="styled-input edit_inputs" th:with="type=${@dict.getType('sys_select_yes_no')}" required>
|
|
|
<option value="">请选择</option>
|
|
|
<option th:each="dict : ${type}" th:value="${dict.dictValue}" th:text="${dict.dictLabel}"></option>
|
|
|
</select>
|
|
@@ -517,11 +517,11 @@
|
|
|
<div class="form-grid1">
|
|
|
<div class="form-field-left">
|
|
|
<label class="is-required">最大剂量数量:</label>
|
|
|
- <input type="number" name="dosage_max" placeholder="最大剂量数量" class="styled-input1" />
|
|
|
+ <input type="number" name="dosage_max" placeholder="最大剂量数量" class="styled-input1" required/>
|
|
|
</div>
|
|
|
<div class="form-field-right">
|
|
|
<label class="is-required">最大剂量单位:</label>
|
|
|
- <select name="unit_max" class="styled-input1" placeholder="最大剂量单位" th:with="type=${@dict.getType('sys_gxhpz_gg_unitall')}">
|
|
|
+ <select name="unit_max" class="styled-input1" placeholder="最大剂量单位" th:with="type=${@dict.getType('sys_gxhpz_gg_unitall')}" required>
|
|
|
<option value="">请选择</option>
|
|
|
<option th:each="dict : ${type}" th:value="${dict.dictValue}" th:text="${dict.dictLabel}"></option>
|
|
|
</select>
|
|
@@ -529,11 +529,11 @@
|
|
|
|
|
|
<div class="form-field-left">
|
|
|
<label class="is-required">常用剂量数量:</label>
|
|
|
- <input type="number" name="dosage_normal" placeholder="常用剂量数量" class="styled-input1" />
|
|
|
+ <input type="number" name="dosage_normal" placeholder="常用剂量数量" class="styled-input1"required />
|
|
|
</div>
|
|
|
<div class="form-field-right">
|
|
|
- <label>常用剂量单位:</label>
|
|
|
- <select name="unit_normal" class="styled-input1" placeholder="常用剂量单位" th:with="type=${@dict.getType('sys_gxhpz_gg_unitall')}">
|
|
|
+ <label class="is-required">常用剂量单位:</label>
|
|
|
+ <select name="unit_normal" class="styled-input1" placeholder="常用剂量单位" th:with="type=${@dict.getType('sys_gxhpz_gg_unitall')}" required>
|
|
|
<option value="">请选择</option>
|
|
|
<option th:each="dict : ${type}" th:value="${dict.dictValue}" th:text="${dict.dictLabel}"></option>
|
|
|
</select>
|
|
@@ -542,22 +542,22 @@
|
|
|
<div class="form-grid2">
|
|
|
<div class="form-field-left">
|
|
|
<label class="is-required">最小剂量数量:</label>
|
|
|
- <input type="number" name="dosage_min" placeholder="最小剂量数量" class="styled-input1" />
|
|
|
+ <input type="number" name="dosage_min" placeholder="最小剂量数量" class="styled-input1" required />
|
|
|
</div>
|
|
|
<div class="form-field-right">
|
|
|
<label class="is-required">最小剂量单位:</label>
|
|
|
- <select name="unit_min" class="styled-input1" placeholder="最小剂量单位" th:with="type=${@dict.getType('sys_gxhpz_gg_unitall')}">
|
|
|
+ <select name="unit_min" class="styled-input1" placeholder="最小剂量单位" th:with="type=${@dict.getType('sys_gxhpz_gg_unitall')}" required>
|
|
|
<option value="">请选择</option>
|
|
|
<option th:each="dict : ${type}" th:value="${dict.dictValue}" th:text="${dict.dictLabel}"></option>
|
|
|
</select>
|
|
|
</div>
|
|
|
<div class="form-field-left">
|
|
|
<label class="is-required">购药包装单位数值:</label>
|
|
|
- <input type="number" name="packing_value" placeholder="购药包装单位数值" class="styled-input1" />
|
|
|
+ <input type="number" name="packing_value" placeholder="购药包装单位数值" class="styled-input1" required />
|
|
|
</div>
|
|
|
<div class="form-field-right">
|
|
|
<label>包装单位:</label>
|
|
|
- <select name="packing_unit" class="styled-input1" placeholder="包装单位" th:with="type=${@dict.getType('sys_gxhpz_gg_unitall')}">
|
|
|
+ <select name="packing_unit" class="styled-input1" placeholder="包装单位" th:with="type=${@dict.getType('sys_gxhpz_gg_unitall')}" required>
|
|
|
<option value="">请选择</option>
|
|
|
<option th:each="dict : ${type}" th:value="${dict.dictValue}" th:text="${dict.dictLabel}"></option>
|
|
|
</select>
|
|
@@ -1618,151 +1618,241 @@
|
|
|
$("#form-server-edit6"),
|
|
|
$("#form-server-edit12")
|
|
|
];
|
|
|
-
|
|
|
+ var flag = true;
|
|
|
// 获取 product_code 并验证是否已填写
|
|
|
var productCodeData = $("#form-server-edit1").serializeArray().find(item => item.name === 'product_code');
|
|
|
if (productCodeData.value === '') {
|
|
|
$.modal.alertWarning("请先填写【基本属性】产品编码!");
|
|
|
- return null;
|
|
|
+ // 调用函数设置焦点到必填项,并保持一段时间内的焦点
|
|
|
+ keepFocusOnInput('product_code', 5000); // 保持焦点 5 秒钟
|
|
|
+ flag= false;
|
|
|
+ return flag;
|
|
|
}
|
|
|
var product_name = $("#form-server-edit1").serializeArray().find(item => item.name === 'product_name');
|
|
|
if (product_name.value === '') {
|
|
|
$.modal.alertWarning("请先填写【基本属性】商品名称!");
|
|
|
- return null;
|
|
|
+ // 调用函数设置焦点到必填项,并保持一段时间内的焦点
|
|
|
+ keepFocusOnInput('product_name', 5000); // 保持焦点 5 秒钟
|
|
|
+ flag= false;
|
|
|
+ return flag;
|
|
|
+ }
|
|
|
+ var manufacturer = $("#form-server-edit1").serializeArray().find(item => item.name === 'generic_name');
|
|
|
+ if (manufacturer.value === '') {
|
|
|
+ $.modal.alertWarning("请先填写【基本属性】通用名!");
|
|
|
+ // 调用函数设置焦点到必填项,并保持一段时间内的焦点
|
|
|
+ keepFocusOnInput('generic_name', 5000); // 保持焦点 5 秒钟
|
|
|
+ flag= false;
|
|
|
+ return flag;
|
|
|
}
|
|
|
var manufacturer = $("#form-server-edit1").serializeArray().find(item => item.name === 'manufacturer');
|
|
|
if (manufacturer.value === '') {
|
|
|
$.modal.alertWarning("请先填写【基本属性】生产厂家!");
|
|
|
- return null;
|
|
|
+ // 调用函数设置焦点到必填项,并保持一段时间内的焦点
|
|
|
+ keepFocusOnInput('manufacturer', 5000); // 保持焦点 5 秒钟
|
|
|
+ flag= false;
|
|
|
+ return flag;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
var product_status = $("#form-server-edit1").serializeArray().find(item => item.name === 'product_status');
|
|
|
if (product_status.value === '') {
|
|
|
$.modal.alertWarning("请先填写【基本属性】商品状态!");
|
|
|
- return null;
|
|
|
+ // 调用函数设置焦点到必填项,并保持一段时间内的焦点
|
|
|
+ keepFocusOnInput('product_status', 5000); // 保持焦点 5 秒钟
|
|
|
+ flag= false;
|
|
|
+ return flag;
|
|
|
}
|
|
|
var category_maj = $("#form-server-edit1").serializeArray().find(item => item.name === 'category_maj');
|
|
|
if (category_maj.value === '') {
|
|
|
$.modal.alertWarning("请先填写【基本属性】商品大类!");
|
|
|
- return null;
|
|
|
+ // 调用函数设置焦点到必填项,并保持一段时间内的焦点
|
|
|
+ keepFocusOnInput('category_maj', 5000); // 保持焦点 5 秒钟
|
|
|
+ flag= false;
|
|
|
+ return flag;
|
|
|
}
|
|
|
var category_min = $("#form-server-edit1").serializeArray().find(item => item.name === 'category_min');
|
|
|
if (category_min.value === '') {
|
|
|
$.modal.alertWarning("请先填写【基本属性】商品小类!");
|
|
|
- return null;
|
|
|
+ // 调用函数设置焦点到必填项,并保持一段时间内的焦点
|
|
|
+ keepFocusOnInput('category_min', 5000); // 保持焦点 5 秒钟
|
|
|
+ flag= false;
|
|
|
+ return flag;
|
|
|
}
|
|
|
var specification = $("#form-server-edit1").serializeArray().find(item => item.name === 'specification');
|
|
|
if (specification.value === '') {
|
|
|
$.modal.alertWarning("请先填写【基本属性】规格!");
|
|
|
- return null;
|
|
|
+ // 调用函数设置焦点到必填项,并保持一段时间内的焦点
|
|
|
+ keepFocusOnInput('specification', 5000); // 保持焦点 5 秒钟
|
|
|
+ flag= false;
|
|
|
+ return flag;
|
|
|
}
|
|
|
var packaging = $("#form-server-edit1").serializeArray().find(item => item.name === 'packaging');
|
|
|
if (packaging.value === '') {
|
|
|
$.modal.alertWarning("请先填【基本属性】写包装!");
|
|
|
- return null;
|
|
|
- }
|
|
|
- var reference_purchase_price = $("#form-server-edit2").serializeArray().find(item => item.name === 'reference_purchase_price');
|
|
|
- if (reference_purchase_price.value === '') {
|
|
|
- $.modal.alertWarning("请先填写【采购属性】参考进价!");
|
|
|
- return null;
|
|
|
- }
|
|
|
- var national_negotiated_price = $("#form-server-edit2").serializeArray().find(item => item.name === 'national_negotiated_price');
|
|
|
- if (national_negotiated_price.value === '') {
|
|
|
- $.modal.alertWarning("请先填写【采购属性】国谈价格!");
|
|
|
- return null;
|
|
|
- }
|
|
|
- var storage_category = $("#form-server-edit3").serializeArray().find(item => item.name === 'storage_category');
|
|
|
- if (storage_category.value === '') {
|
|
|
- $.modal.alertWarning("请先填写【存储分类】存储分类!");
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
- var approval_number_1 = $("#form-server-edit4").serializeArray().find(item => item.name === 'approval_number_1');
|
|
|
- if (approval_number_1.value === '') {
|
|
|
- $.modal.alertWarning("请先填写【质管属性】批准文号1!");
|
|
|
- return null;
|
|
|
- }
|
|
|
- var reference_retail_price = $("#form-server-edit5").serializeArray().find(item => item.name === 'reference_retail_price');
|
|
|
- if (reference_retail_price.value === '') {
|
|
|
- $.modal.alertWarning("请先填写【销售属性】参考零售价!");
|
|
|
- return null;
|
|
|
- }
|
|
|
- var platform_property = $("#form-server-edit6").serializeArray().find(item => item.name === 'platform_property');
|
|
|
- if (platform_property.value === '') {
|
|
|
- $.modal.alertWarning("请先填写【业态属性】平台属性!");
|
|
|
- return null;
|
|
|
+ // 调用函数设置焦点到必填项,并保持一段时间内的焦点
|
|
|
+ keepFocusOnInput('packaging', 5000); // 保持焦点 5 秒钟
|
|
|
+ flag= false;
|
|
|
+ return flag;
|
|
|
}
|
|
|
-
|
|
|
var follow_up_item = $("#form-server-edit12").serializeArray().find(item => item.name === 'follow_up_item');
|
|
|
if (follow_up_item.value === '') {
|
|
|
$.modal.alertWarning("请选择是【D值配置属性】否随访品!");
|
|
|
- return null;
|
|
|
+ // 调用函数设置焦点到必填项,并保持一段时间内的焦点
|
|
|
+ keepFocusOnInput('follow_up_item', 5000); // 保持焦点 5 秒钟
|
|
|
+ flag= false;
|
|
|
+ return flag;
|
|
|
}
|
|
|
|
|
|
var cold_chain_item = $("#form-server-edit12").serializeArray().find(item => item.name === 'cold_chain_item');
|
|
|
if (cold_chain_item.value === '') {
|
|
|
$.modal.alertWarning("请选择【D值配置属性】是否冷链品!");
|
|
|
- return null;
|
|
|
+ // 调用函数设置焦点到必填项,并保持一段时间内的焦点
|
|
|
+ keepFocusOnInput('cold_chain_item', 5000); // 保持焦点 5 秒钟
|
|
|
+ flag= false;
|
|
|
+ return flag;
|
|
|
}
|
|
|
|
|
|
var registered_item = $("#form-server-edit12").serializeArray().find(item => item.name === 'registered_item');
|
|
|
if (registered_item.value === '') {
|
|
|
$.modal.alertWarning("请选择【D值配置属性】是否登记品!");
|
|
|
- return null;
|
|
|
+ // 调用函数设置焦点到必填项,并保持一段时间内的焦点
|
|
|
+ keepFocusOnInput('registered_item', 5000); // 保持焦点 5 秒钟
|
|
|
+ flag= false;
|
|
|
+ return flag;
|
|
|
}
|
|
|
|
|
|
var flow_item = $("#form-server-edit12").serializeArray().find(item => item.name === 'flow_item');
|
|
|
if (flow_item.value === '') {
|
|
|
$.modal.alertWarning("请选择【D值配置属性】是否流向品!");
|
|
|
- return null;
|
|
|
+ // 调用函数设置焦点到必填项,并保持一段时间内的焦点
|
|
|
+ keepFocusOnInput('flow_item', 5000); // 保持焦点 5 秒钟
|
|
|
+ flag= false;
|
|
|
+ return flag;
|
|
|
}
|
|
|
|
|
|
var prescription_required = $("#form-server-edit12").serializeArray().find(item => item.name === 'prescription_required');
|
|
|
if (prescription_required.value === '') {
|
|
|
$.modal.alertWarning("请选择【D值配置属性】是否是否凭处方销售!");
|
|
|
- return null;
|
|
|
+ // 调用函数设置焦点到必填项,并保持一段时间内的焦点
|
|
|
+ keepFocusOnInput('prescription_required', 5000); // 保持焦点 5 秒钟
|
|
|
+ flag= false;
|
|
|
+ return flag;
|
|
|
}
|
|
|
|
|
|
var dosage_max = $("#form-server-edit12").serializeArray().find(item => item.name === 'dosage_max');
|
|
|
if (dosage_max.value === '') {
|
|
|
$.modal.alertWarning("请选择【D值配置属性】最大剂量数量!");
|
|
|
- return null;
|
|
|
+ flag= false;
|
|
|
+ return flag;
|
|
|
}
|
|
|
var dosage_min = $("#form-server-edit12").serializeArray().find(item => item.name === 'dosage_min');
|
|
|
if (dosage_min.value === '') {
|
|
|
$.modal.alertWarning("请选择【D值配置属性】最小剂量数量!");
|
|
|
- return null;
|
|
|
+ // 调用函数设置焦点到必填项,并保持一段时间内的焦点
|
|
|
+ keepFocusOnInput('dosage_min', 5000); // 保持焦点 5 秒钟
|
|
|
+ flag= false;
|
|
|
+ return flag;
|
|
|
}
|
|
|
var unit_max = $("#form-server-edit12").serializeArray().find(item => item.name === 'unit_max');
|
|
|
if (unit_max.value === '') {
|
|
|
$.modal.alertWarning("请选择【D值配置属性】最大剂量单位!");
|
|
|
- return null;
|
|
|
+ // 调用函数设置焦点到必填项,并保持一段时间内的焦点
|
|
|
+ keepFocusOnInput('unit_max', 5000); // 保持焦点 5 秒钟
|
|
|
+ flag= false;
|
|
|
+ return flag;
|
|
|
}
|
|
|
var unit_min = $("#form-server-edit12").serializeArray().find(item => item.name === 'unit_min');
|
|
|
if (unit_min.value === '') {
|
|
|
$.modal.alertWarning("请选择【D值配置属性】最小剂量单位!");
|
|
|
- return null;
|
|
|
+ // 调用函数设置焦点到必填项,并保持一段时间内的焦点
|
|
|
+ keepFocusOnInput('unit_min', 5000); // 保持焦点 5 秒钟
|
|
|
+ flag= false;
|
|
|
+ return flag;
|
|
|
}
|
|
|
var unit_normal = $("#form-server-edit12").serializeArray().find(item => item.name === 'unit_normal');
|
|
|
if (unit_normal.value === '') {
|
|
|
$.modal.alertWarning("请选择【D值配置属性】常见计量单位!");
|
|
|
- return null;
|
|
|
+ // 调用函数设置焦点到必填项,并保持一段时间内的焦点
|
|
|
+ keepFocusOnInput('unit_normal', 5000); // 保持焦点 5 秒钟
|
|
|
+ flag= false;
|
|
|
+ return flag;
|
|
|
}
|
|
|
var dosage_normal = $("#form-server-edit12").serializeArray().find(item => item.name === 'dosage_normal');
|
|
|
if (dosage_normal.value === '') {
|
|
|
$.modal.alertWarning("请选择【D值配置属性】常见计量数量!");
|
|
|
- return null;
|
|
|
+ // 调用函数设置焦点到必填项,并保持一段时间内的焦点
|
|
|
+ keepFocusOnInput('dosage_normal', 5000); // 保持焦点 5 秒钟
|
|
|
+ flag= false;
|
|
|
+ return flag;
|
|
|
}
|
|
|
var packing_value = $("#form-server-edit12").serializeArray().find(item => item.name === 'packing_value');
|
|
|
if (packing_value.value === '') {
|
|
|
$.modal.alertWarning("请选择【D值配置属性】包装单位值!");
|
|
|
- return null;
|
|
|
+ // 调用函数设置焦点到必填项,并保持一段时间内的焦点
|
|
|
+ keepFocusOnInput('packing_value', 5000); // 保持焦点 5 秒钟
|
|
|
+ flag= false;
|
|
|
+ return flag;
|
|
|
}
|
|
|
var packing_unit = $("#form-server-edit12").serializeArray().find(item => item.name === 'packing_unit');
|
|
|
if (packing_unit.value === '') {
|
|
|
$.modal.alertWarning("请选择【D值配置属性】包装单位!");
|
|
|
- return null;
|
|
|
+ // 调用函数设置焦点到必填项,并保持一段时间内的焦点
|
|
|
+ keepFocusOnInput('packing_unit', 5000); // 保持焦点 5 秒钟
|
|
|
+ flag= false;
|
|
|
+ return flag;
|
|
|
+ }
|
|
|
+ var reference_purchase_price = $("#form-server-edit2").serializeArray().find(item => item.name === 'reference_purchase_price');
|
|
|
+ if (reference_purchase_price.value === '') {
|
|
|
+ $.modal.alertWarning("请先填写【采购属性】参考进价!");
|
|
|
+ // 调用函数设置焦点到必填项,并保持一段时间内的焦点
|
|
|
+ keepFocusOnInput('reference_purchase_price', 5000); // 保持焦点 5 秒钟
|
|
|
+ flag= false;
|
|
|
+ return flag;
|
|
|
+ }
|
|
|
+ var national_negotiated_price = $("#form-server-edit2").serializeArray().find(item => item.name === 'national_negotiated_price');
|
|
|
+ if (national_negotiated_price.value === '') {
|
|
|
+ $.modal.alertWarning("请先填写【采购属性】国谈价格!");
|
|
|
+ // 调用函数设置焦点到必填项,并保持一段时间内的焦点
|
|
|
+ keepFocusOnInput('national_negotiated_price', 5000); // 保持焦点 5 秒钟
|
|
|
+ flag= false;
|
|
|
+ return flag;
|
|
|
+ }
|
|
|
+ var storage_category = $("#form-server-edit3").serializeArray().find(item => item.name === 'storage_category');
|
|
|
+ if (storage_category.value === '') {
|
|
|
+ $.modal.alertWarning("请先填写【存储分类】存储分类!");
|
|
|
+ // 调用函数设置焦点到必填项,并保持一段时间内的焦点
|
|
|
+ keepFocusOnInput('storage_category', 5000); // 保持焦点 5 秒钟
|
|
|
+ flag= false;
|
|
|
+ return flag;
|
|
|
}
|
|
|
|
|
|
+ var approval_number_1 = $("#form-server-edit4").serializeArray().find(item => item.name === 'approval_number_1');
|
|
|
+ if (approval_number_1.value === '') {
|
|
|
+ $.modal.alertWarning("请先填写【质管属性】批准文号1!");
|
|
|
+ // 调用函数设置焦点到必填项,并保持一段时间内的焦点
|
|
|
+ keepFocusOnInput('approval_number_1', 5000); // 保持焦点 5 秒钟
|
|
|
+ flag= false;
|
|
|
+ return flag;
|
|
|
+ }
|
|
|
+ var reference_retail_price = $("#form-server-edit5").serializeArray().find(item => item.name === 'reference_retail_price');
|
|
|
+ if (reference_retail_price.value === '') {
|
|
|
+ $.modal.alertWarning("请先填写【销售属性】参考零售价!");
|
|
|
+ // 调用函数设置焦点到必填项,并保持一段时间内的焦点
|
|
|
+ keepFocusOnInput('reference_retail_price', 5000); // 保持焦点 5 秒钟
|
|
|
+ flag= false;
|
|
|
+ return flag;
|
|
|
+ }
|
|
|
+ var platform_property = $("#form-server-edit6").serializeArray().find(item => item.name === 'platform_property');
|
|
|
+ if (platform_property.value === '') {
|
|
|
+ $.modal.alertWarning("请先填写【业态属性】平台属性!");
|
|
|
+ // 调用函数设置焦点到必填项,并保持一段时间内的焦点
|
|
|
+ keepFocusOnInput('platform_property', 5000); // 保持焦点 5 秒钟
|
|
|
+ flag= false;
|
|
|
+ return flag;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
// 初始化合并后的数据数组
|
|
|
var allData = [];
|
|
|
|
|
@@ -1773,12 +1863,43 @@
|
|
|
formData.push({ name: 'product_code', value: productCodeData.value });
|
|
|
allData = allData.concat(formData);
|
|
|
});
|
|
|
+ if (flag){
|
|
|
+ return allData;
|
|
|
+ }else{
|
|
|
+ return false;
|
|
|
+ }
|
|
|
|
|
|
- return allData;
|
|
|
}
|
|
|
+ function keepFocusOnInput(fieldName, duration = 5000) {
|
|
|
+ var element = $('[name="' + fieldName + '"]');
|
|
|
+ let intervalId;
|
|
|
+
|
|
|
+ if (element.length && element.is(':visible')) {
|
|
|
+ element.focus();
|
|
|
+
|
|
|
+ // 开始一个间隔定时器,在指定的时间内重复设置焦点
|
|
|
+ intervalId = setInterval(() => {
|
|
|
+ element.focus();
|
|
|
+ if (element.is('input[type="text"], textarea')) {
|
|
|
+ element[0].setSelectionRange(element.val().length, element.val().length);
|
|
|
+ }
|
|
|
+ }, 200); // 每 200ms 设置一次焦点
|
|
|
+
|
|
|
+ // 在指定时间后清除定时器
|
|
|
+ setTimeout(() => {
|
|
|
+ clearInterval(intervalId);
|
|
|
+ }, duration);
|
|
|
+ } else {
|
|
|
+ console.warn("无法找到或访问名为 " + fieldName + " 的元素");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
function submitHandler() {
|
|
|
if ($.validate.form()) {
|
|
|
var allData = collectFormData();
|
|
|
+ if (allData === false) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
$.ajax({
|
|
|
url: prefix + "/ProductAdd", // 后台接口地址
|
|
|
type: "post",
|