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

代码修改

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