优化:置标标签前端渲染组件其他标签自动设置是否只读

master
Guo XIn 1 year ago
parent 1994567fdd
commit e50a322314
  1. 9
      shandan-common/src/main/resources/static/js/common/layui/extend/datalabel.js

@ -249,8 +249,8 @@ layui.define(['globalTree'], function (exports) {
});
}
function addOtherLabel(value) {
let template = `<div class="layui-input-block label-set-component other-label" th:data-field-title="其他标签"></div>`;
function addOtherLabel(value, readonly) {
let template = `<div class="layui-input-block label-set-component other-label ${readonly?'read-only':''}" th:data-field-title="其他标签"></div>`;
$('.other-label-item').append(template);
let cid = _KEY + _CACHE.size,
component = new Component(cid, $('.label-set-component.other-label:last'));
@ -272,15 +272,16 @@ layui.define(['globalTree'], function (exports) {
function setData(dataArr = []) {
for (let data of dataArr) {
let find = false;
let find = false, readonly = false;
for (let component of _CACHE.values()) {
readonly = component.isReadOnly();
if (data.fieldTitle !== '其他标签' && data.fieldTitle === component.fieldTitle) {
component.setData(data);
find = true;
}
}
if (!find) {
addOtherLabel(data);
addOtherLabel(data, readonly);
}
}
}