完成初版

This commit is contained in:
2026-07-22 17:23:49 +08:00
parent cf40ccbdb0
commit bf390e8f7e
37 changed files with 4387 additions and 102 deletions

View File

@@ -0,0 +1,36 @@
.customButton_class_box {
width: 100%;
line-height: 24px;
height:24px;
color: #1f85ec;
cursor: pointer;
font-family: "Microsoft YaHei"!important;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
word-break:keep-all;
box-sizing: border-box;
-webkit-box-sizing : border-box;
-moz-box-sizing : border-box;
text-align: center;
outline: none;
border: 1px solid #1f85ec;
background-color: #fff;
border-radius: 15px;
-webkit-border-radius: 15px;
-moz-border-radius: 15px;
}
.customInputArea{
width: 65%;
height:auto;
color: #1f85ec;
font-family: "Microsoft YaHei"!important;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
word-break:keep-all;
}
.customButton_box_content{
width: 100%;
height: auto;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

View File

@@ -0,0 +1,173 @@
(function(factory) {
var nameSpace = 'field_88661234567890123656';
if (!window[nameSpace]) {
console.log("开始实例化计算明细表资产边界数据在主表生成")
var Builder = factory();
window[nameSpace] = {
instance: {}
};
window[nameSpace].init = function(options) {
window[nameSpace].instance[options.privateId] = new Builder(options);
};
}
})(function() {
function App(options) {
var self = this;
self.initParams(options);
//初始化dom
self.initDom();
//事件
self.events();
}
App.prototype = {
initParams: function(options) {
console.log("开始初始化参数")
var self = this;
self.adaptation = options.adaptation;
self.privateId = options.privateId;
self.preUrl = options.url_prefix;
self.adaptation.formMessage = options.formMessage;
self.messageObj = options.getData;
console.log(self.messageObj)
},
initDom: function() {
var self = this;
console.log("开始渲染dom")
dynamicLoading.css(self.preUrl + '/css/btn.css');
self.appendChildDom();
},
events: function() {
var self = this;
// 监听是否数据刷新
console.log("设置事件监听")
self.adaptation.ObserverEvent.listen('Event' + self.privateId, function() {
self.messageObj = self.adaptation.childrenGetData(self.privateId);
self.appendChildDom();
});
},
computed: function(privateId,messageObj,adaptation) {
var tableName = adaptation.formMessage.tableName;
var formId = messageObj.content.contentDataId;
var formsons[] = messageObj.formdata.formsons;
var formmains = messageObj.formdata.formmains[tableName];
var assetsNo = '';
var mainTableMap = formmains.elements;
var boundConfigs[];
console.log(mainTableMap)
for(let i=0; i<formsons.length; i++) {
var formson = formsons[i]
if(formson.display == ''){
var subTableList[] = formsons.records;
console.log(subTableList)
for(let i=0; i<subTableList.length; i++) {
let subTableMap = subTableList[i].lists
let subKeys = Object.keys(subTableMap)
var boundConfig;
subKeys.forEach((k) => {
let display = tableMap[k].display;
let value = tableMap[k].value;
if (display === '地块序号') boundConfig.blockNum = value;
if (display === '线路顺序') boundConfig.pathOrder = value;
if (display === '地块定位纬度') boundConfig.lat = value;
if (display === '地块定位经度') boundConfig.lng = value;
});
boundConfigs.push(boundConfig)
}
break;
}
}
const keys = Object.keys(tableMap);
keys.forEach((k) => {
let display = tableMap[k].display;
let value = tableMap[k].value;
if (display === '资产编号') assetsNo = value;
});
const params = new URLSearchParams({
subBoundConfigs: boundConfigs,
fieldDisplay: "资产边界数据",
formId: formId
});
$.ajax({
type: "POST",
url: '/seeyon/rest/assetsRegion/reComputedBoundConfig',
data: JSON.stringify(params),
dataType: "json",
contentType: 'application/json;charset=UTF-8',
success: function(res) {
// 后台解析数据后 将数据填写到表单中
if (res.code == 0) {
var backfill = {};
backfill.tableName = res.data.masterTableName;
// 回填主表
backfill.tableCategory = 'formmain';
// 后台组装的data数据
console.log(res.data)
backfill.updateData = res.data.updateData;
adaptation.backfillFormControlData(backfill, privateId);
} else {
// 报错
$.alert(res.message);
}
},
complete: function() {},
error: function(e) {
top.$.error(e.responseText);
}
});
},
appendChildDom: function() {
var self = this;
var doBiz = function() {
self.computed(self.privateId, self.messageObj, self.adaptation)
}
var domStructure = '<section class="customButton_box_content">' +
'<div class="customButton_class_box ' + self.privateId + '" title="' + self.messageObj.display
.escapeHTML() + '">' + self.messageObj.display.escapeHTML() + '</div>' +
'</section>';
document.querySelector('#' + self.privateId).innerHTML = domStructure;
var content = self.messageObj.formdata.content
document.querySelector('.' + self.privateId).removeEventListener('click', doBiz);
document.querySelector('.' + self.privateId).addEventListener('click', doBiz);
//渲染隐藏权限
if (self.messageObj.auth === 'hide') {
document.querySelector('#' + self.privateId).innerHTML =
'<div class="cap4-text__browse" style="line-height: 1.8; color: rgb(0, 0, 0) !important;">***</div>';
}
}
};
function backFill(latlng, fieldName, fieldDisplay, privateId, messageObj, adaptation,tableName) {
}
var dynamicLoading = {
css: function(path) {
if (!path || path.length === 0) {
throw new Error('argument "path" is required !');
}
var head = document.getElementsByTagName('head')[0];
var link = document.createElement('link');
link.href = path;
link.rel = 'stylesheet';
link.type = 'text/css';
head.appendChild(link);
},
js: function(path) {
if (!path || path.length === 0) {
throw new Error('argument "path" is required !');
}
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.src = path;
script.type = 'text/javascript';
head.appendChild(script);
}
}
return App;
});