提交 aaf65246 编写于 作者: Skyeye云's avatar Skyeye云

代码修改

上级 559fda9a
......@@ -147,23 +147,29 @@ layui.config({
</div>
</div>`,
'deleteRowCallbackBox': `<div class="layui-form-item layui-col-xs12">
<label class="layui-form-label" style="width: 60%;">删除行之后的回调函数:</label>
<label class="layui-form-label" style="width: 70%;">删除行之后的回调函数:</label>
<div class="layui-input-block" script="">
<button id="deleteRowCallbackConfig" type="button" class="winui-toolbtn writeScript">编写脚本</button>
</div>
</div>`,
'addRowCallbackBox': `<div class="layui-form-item layui-col-xs12">
<label class="layui-form-label" style="width: 60%;">新增行之后的回调函数:</label>
<label class="layui-form-label" style="width: 70%;">新增行之后的回调函数:</label>
<div class="layui-input-block" script="">
<button id="addRowCallbackConfig" type="button" class="winui-toolbtn writeScript">编写脚本</button>
</div>
</div>`,
'afterScriptBox': `<div class="layui-form-item layui-col-xs12">
<label class="layui-form-label" style="width: 60%;">组件加载完成后执行的脚本:</label>
<div class="layui-input-block" script="">
<label class="layui-form-label" style="width: 70%;">组件加载完成后执行的JS:</label>
<div class="layui-input-block" script="layui.define(['jquery'], function(exports) {\n\tvar form = layui.form;\n\n});">
<button id="afterScriptConfig" type="button" class="winui-toolbtn writeScript">编写脚本</button>
</div>
</div>`,
'afterHtmlBox': `<div class="layui-form-item layui-col-xs12">
<label class="layui-form-label" style="width: 70%;">组件加载完成后执行的HTML:</label>
<div class="layui-input-block" script="">
<button id="afterHtmlConfig" type="button" class="winui-toolbtn writeScript">编写脚本</button>
</div>
</div>`,
};
// 详情类布局才展示的组件属性
var detailsPageAttr = ['attrKeyBox', 'titleBox', 'widthBox'];
......@@ -253,6 +259,7 @@ layui.config({
$("#deleteRowCallbackConfig").parent().attr('script', data.deleteRowCallback);
$("#addRowCallbackConfig").parent().attr('script', data.addRowCallback);
$("#afterScriptConfig").parent().attr('script', data.afterScript);
$("#afterHtmlConfig").parent().attr('script', data.afterHtml);
$("body").on("click", "#attrTransformTableListConfig", function() {
parent.temData = $("#attrTransformTableListConfig").parent().attr('data');
......@@ -321,6 +328,7 @@ layui.config({
newParams.deleteRowCallback = $("#deleteRowCallbackConfig").parent().attr('script');
newParams.addRowCallback = $("#addRowCallbackConfig").parent().attr('script');
newParams.afterScript = $("#afterScriptConfig").parent().attr('script');
newParams.afterHtml = $("#afterHtmlConfig").parent().attr('script');
if (!isNull($("#attrKey").val())) {
newParams.attrDefinition = getInPoingArr(parent.attrList, 'attrKey', $("#attrKey").val());
......
......@@ -17,7 +17,7 @@ layui.config({
form.render();
form.on('submit(formWriteBean)', function (data) {
if (winui.verifyForm(data.elem)) {
parent.scriptData = encodeURIComponent(jsEditor.getValue());
parent.scriptData = jsEditor.getValue();
parent.layer.close(index);
parent.refreshCode = '0';
}
......
......@@ -15,6 +15,8 @@ layui.config({
var checkType = '1';//工序选择类型:1.单选;2.多选
if (!isNull(parent.procedureCheckType)) {
checkType = parent.procedureCheckType;
} else {
checkType = GetUrlParam("checkType");
}
//设置提示信息
......
......@@ -325,6 +325,9 @@ var dsFormUtil = {
var html_js = getDataUseHandlebars('{{#bean}}' + component.jsContent + '{{/bean}}', jsonStr);
var jsCon = `<script id="script${content.id}">${html_js}</script>`;
$("#" + boxId).append(html + jsCon);
// 组件加载完成后执行的HTML和JS
$("#" + boxId).append(content.afterHtml);
$("#" + boxId).append(`<script>${content.afterScript}</script>`);
if (!isNull(content.require)) {
dsFormUtil.setIsRequired(content);
......@@ -422,33 +425,38 @@ var dsFormUtil = {
// 获取属性关联的数据值来源信息
getContentLinkedData: function (content) {
var json = {};
if (isNull(content.attrDefinition) || isNull(content.attrDefinition.attrDefinitionCustom)) {
return content;
}
var customAttr = content.attrDefinition.attrDefinitionCustom;
var dataType = customAttr.dataType;
if (isNull(customAttr.objectId) && isNull(customAttr.defaultData) && isNull(customAttr.businessApi) && $.isEmptyObject(customAttr.businessApi)) {
return content;
}
content.context = dsFormUtil.getHtmlContentByDataFrom(customAttr, content.dsFormComponent.htmlDataFrom);
return content;
},
getHtmlContentByDataFrom: function (obj, htmlDataFrom) {
var json = {};
var dataType = obj.dataType;
if (dataType == 1) {
// 自定义
var obj = isNull(customAttr.defaultData) ? [] : customAttr.defaultData;
if(typeof obj == 'string'){
var obj = isNull(obj.defaultData) ? [] : obj.defaultData;
if (typeof obj == 'string') {
obj = JSON.parse(obj);
}
json = obj;
} else if (dataType == 2) {
// 枚举
json = skyeyeClassEnumUtil.getEnumDataListByClassName(customAttr.objectId).rows;
json = skyeyeClassEnumUtil.getEnumDataListByClassName(obj.objectId).rows;
} else if (dataType == 3) {
// 数据字典
sysDictDataUtil.queryDictDataListByDictTypeCode(customAttr.objectId, function (data) {
sysDictDataUtil.queryDictDataListByDictTypeCode(obj.objectId, function (data) {
json = data.rows;
});
} else if (dataType == 4) {
// 自定义接口
var businessApi = customAttr.businessApi;
var businessApi = obj.businessApi;
var params = {};
$.each(businessApi.params, function (key, value) {
var realValue = "";
......@@ -461,10 +469,10 @@ var dsFormUtil = {
json = data.rows;
}, async: false});
}
if (!isNull(content.dsFormComponent.htmlDataFrom)) {
content.context = getDataUseHandlebars(content.dsFormComponent.htmlDataFrom, json);
if (!isNull(htmlDataFrom)) {
return getDataUseHandlebars(htmlDataFrom, json);
}
return content;
return '';
},
// 获取显示值
......
......@@ -191,6 +191,8 @@ var initTableChooseUtil = {
value = $("#" + tdId).val();
} else if (bean.formType == 'detail') {
value = $("#" + tdId).html();
} else if (item.formType == 'chooseInput') {
value = $("#" + tdId).attr("data-id");
}
row[bean.id] = value;
});
......@@ -277,6 +279,7 @@ var initTableChooseUtil = {
$("#" + tdId).val(value);
} else if (formType == 'chooseInput') {
$("#" + tdId).val(value);
} else if (formType == 'select') {
if (!isNull(value["html"])) {
$("#" + tdId).html(value["html"]);
......
<option value="">请选择</option>
{{#each this}}
<option value="{{id}}">{{name}}</option>
{{/each}}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册