From b73d391179ab549b755ca6bee5175406e93dc9cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=88=B1=7E=E6=B5=B7=7E=E7=88=B1=E6=B5=B7=E7=88=B1?= =?UTF-8?q?=E6=B5=B7=7E=E5=8F=B3?= <1828712314@qq.com> Date: Thu, 15 May 2025 08:54:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=97=E6=AE=B5=E6=98=A0=E5=B0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wwwroot/rezero/default_ui/add_filed.html | 796 ++++++++++++++++++ .../wwwroot/rezero/default_ui/js/tools.js | 553 ++++++------ .../rezero/default_ui/std_entity_config.html | 24 +- .../rezero/default_ui/std_filed_map.html | 79 +- .../rezero/default_ui/std_method_config.html | 25 +- 5 files changed, 1166 insertions(+), 311 deletions(-) create mode 100644 SuperAPI/wwwroot/rezero/default_ui/add_filed.html diff --git a/SuperAPI/wwwroot/rezero/default_ui/add_filed.html b/SuperAPI/wwwroot/rezero/default_ui/add_filed.html new file mode 100644 index 0000000..74485e5 --- /dev/null +++ b/SuperAPI/wwwroot/rezero/default_ui/add_filed.html @@ -0,0 +1,796 @@ +@@master_page.html + +
+
+
+
+
+ 本地表 +
+ {{`(${localJosnName})`}} +
+
+ + + 导入本地表 +
+
+
+
+ 表名 +
+
+ 表注释 +
+
+
+
+
+ 三方表 +
+ ({{thirdJsonName}}) +
+
+ + + 导入三方表 +
+
+
+
+ 表名 +
+
+ 表注释 +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
序号字段名 + 字段注释 + + 字段类型 + + 字典名称 + 字段名 + 字段注释 + + 字段类型 + + 字典名称 + 操作
{{index + 1}} + {{item.SYSTEM_FIELD}} + + {{item.SYSTEM_NAME}} + + {{item.SYSTEM_FIELD_TYPE}} + + {{item.SYSTEM_DICT_NAME}} + + {{item.INTERFACE_FIELD}} + + {{item.INTERFACE_NAME}} + + {{item.OBJECT_FIELD_TYPE}} + + {{item.OBJECT_DICT_NAME}} + + +
{{data.length + 1}} + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ diff --git a/SuperAPI/wwwroot/rezero/default_ui/js/tools.js b/SuperAPI/wwwroot/rezero/default_ui/js/tools.js index 6d753ab..76d056d 100644 --- a/SuperAPI/wwwroot/rezero/default_ui/js/tools.js +++ b/SuperAPI/wwwroot/rezero/default_ui/js/tools.js @@ -1,271 +1,324 @@ -var isLoading = false; +var isLoading = false var tools = { - highlightErrorFields: function (data) { - if (!data.ErrorParameters) { - tools.alert(data.message); - return; - } - data.ErrorParameters.forEach(function (error) { - // 获取 Name 属性的值 - var fieldName = error.Name; + highlightErrorFields: function (data) { + if (!data.ErrorParameters) { + tools.alert(data.message) + return + } + data.ErrorParameters.forEach(function (error) { + // 获取 Name 属性的值 + var fieldName = error.Name - // 查找具有相同 name 属性值的所有元素 - var elements = document.getElementsByName(fieldName); + // 查找具有相同 name 属性值的所有元素 + var elements = document.getElementsByName(fieldName) - // 循环遍历找到的元素,设置样式 - for (var i = 0; i < elements.length; i++) { - elements[i].style.border = "2px solid red"; + // 循环遍历找到的元素,设置样式 + for (var i = 0; i < elements.length; i++) { + elements[i].style.border = '2px solid red' - var spanElement = document.createElement("span"); - spanElement.style.color = "red"; - spanElement.style.marginLeft = "5px"; // 调整距离,可根据需要更改 - spanElement.innerHTML = error.Message; + var spanElement = document.createElement('span') + spanElement.style.color = 'red' + spanElement.style.marginLeft = '5px' // 调整距离,可根据需要更改 + spanElement.innerHTML = error.Message - // 将 span 元素添加到当前元素的后面 - elements[i].parentNode.insertBefore(spanElement, elements[i].nextSibling); - } - setTimeout(function () { - for (var i = 0; i < elements.length; i++) { - elements[i].style.border = ""; - // 移除当前元素后面的 span 元素 - var nextSibling = elements[i].nextSibling; - if (nextSibling && nextSibling.tagName === "SPAN") { - elements[i].parentNode.removeChild(nextSibling); - } - } - }, 3000); - }); - }, - alert: function (msg) { - $(divAlertBody).html(msg); - btnAlert.click(); - }, - objectToQueryString: function (obj) { - return Object.keys(obj) - .filter(key => obj[key] !== null && obj[key] !== undefined) // Filter out null and undefined values - .map(key => key + '=' + encodeURIComponent(obj[key])) - .join('&'); - }, - formToJson: function (formId) { - var form = document.getElementById(formId); - var formData = new FormData(form); - var jsonData = {}; + // 将 span 元素添加到当前元素的后面 + elements[i].parentNode.insertBefore( + spanElement, + elements[i].nextSibling + ) + } + setTimeout(function () { + for (var i = 0; i < elements.length; i++) { + elements[i].style.border = '' + // 移除当前元素后面的 span 元素 + var nextSibling = elements[i].nextSibling + if ( + nextSibling && + nextSibling.tagName === 'SPAN' + ) { + elements[i].parentNode.removeChild(nextSibling) + } + } + }, 3000) + }) + }, + alert: function (msg) { + $(divAlertBody).html(msg) + btnAlert.click() + }, + objectToQueryString: function (obj) { + return Object.keys(obj) + .filter( + key => obj[key] !== null && obj[key] !== undefined + ) // Filter out null and undefined values + .map(key => key + '=' + encodeURIComponent(obj[key])) + .join('&') + }, + formToJson: function (formId) { + var form = document.getElementById(formId) + var formData = new FormData(form) + var jsonData = {} - formData.forEach(function (value, key) { - jsonData[key] = value; - }); + formData.forEach(function (value, key) { + jsonData[key] = value + }) - return jsonData; - }, - isValidURLPattern: function (inputString) { - var url = "https://www.rezero.com" + inputString; - var pattern = /^((http|https|ftp):\/\/)?([a-zA-Z0-9_-]+\.)+[a-zA-Z]{2,6}(\/[a-zA-Z0-9_.-]*)*\/?$/; - return (pattern.test(url)); - }, - ensureNumeric: function (inputField) { - // 尝试将输入值转换为数字 - var value = inputField.value; + return jsonData + }, + isValidURLPattern: function (inputString) { + var url = 'https://www.rezero.com' + inputString + var pattern = + /^((http|https|ftp):\/\/)?([a-zA-Z0-9_-]+\.)+[a-zA-Z]{2,6}(\/[a-zA-Z0-9_.-]*)*\/?$/ + return pattern.test(url) + }, + ensureNumeric: function (inputField) { + // 尝试将输入值转换为数字 + var value = inputField.value - // 尝试将输入值转换为数字 - var numericValue = parseFloat(value); + // 尝试将输入值转换为数字 + var numericValue = parseFloat(value) - // 如果转换失败,则将值设置为 0 - if (isNaN(numericValue)) { - numericValue = 0; - } + // 如果转换失败,则将值设置为 0 + if (isNaN(numericValue)) { + numericValue = 0 + } - // 将更新后的值设置回输入框 - inputField.value = numericValue; - }, - showSpecifiedElementAndHideOthers: function (elementToShowId, elementsToHideIds) { - // 显示指定元素并隐藏其他元素 - document.getElementById(elementToShowId).style.display = "block"; - for (var i = 0; i < elementsToHideIds.length; i++) { - document.getElementById(elementsToHideIds[i]).style.display = "none"; - } - }, - assignValuesToObject: function (sourceObject, targetObject) { - Object.keys(sourceObject).forEach(function (key) { - if (targetObject.hasOwnProperty(key)) { - targetObject[key] = sourceObject[key]; - } else { - console.warn(`Property '${key}' does not exist in the target object.`); - } - }); - }, - openLoading: function () { - var loadingOverlay = document.getElementById('loadingOverlay'); - loadingOverlay.style.display = 'flex'; - }, - closeLoading: function () { - var loadingOverlay = document.getElementById('loadingOverlay'); - loadingOverlay.style.display = 'none'; - }, - getValue: function (id) { - var element = document.getElementById(id); - if (element) { - return element.value; - } else { - return null; - } - }, - checkAuthorization: function () { - setTimeout(function () { + // 将更新后的值设置回输入框 + inputField.value = numericValue + }, + showSpecifiedElementAndHideOthers: function ( + elementToShowId, + elementsToHideIds + ) { + // 显示指定元素并隐藏其他元素 + document.getElementById(elementToShowId).style.display = + 'block' + for (var i = 0; i < elementsToHideIds.length; i++) { + document.getElementById( + elementsToHideIds[i] + ).style.display = 'none' + } + }, + assignValuesToObject: function ( + sourceObject, + targetObject + ) { + Object.keys(sourceObject).forEach(function (key) { + if (targetObject.hasOwnProperty(key)) { + targetObject[key] = sourceObject[key] + } else { + console.warn( + `Property '${key}' does not exist in the target object.` + ) + } + }) + }, + openLoading: function () { + var loadingOverlay = document.getElementById( + 'loadingOverlay' + ) + loadingOverlay.style.display = 'flex' + }, + closeLoading: function () { + var loadingOverlay = document.getElementById( + 'loadingOverlay' + ) + loadingOverlay.style.display = 'none' + }, + getValue: function (id) { + var element = document.getElementById(id) + if (element) { + return element.value + } else { + return null + } + }, + checkAuthorization: function () { + setTimeout(function () { + var tokeEle = document.getElementById('txtToken') + if (tokeEle) return - var tokeEle = document.getElementById("txtToken"); - if (tokeEle) return; + axios + .get( + '/PrivateReZeroRoute/100004/GetDbTypeList', + jwHeader + ) + .then(response => { + this.dbTypeList = response.data + isLoading = true + this.error = null + }) + .catch(error => { + isLoading = true + this.error = error.message + this.data = null + }) + }, 3000) + }, + jsonToUrl: function (json) { + return Object.keys(json) + .map(function (key) { + return ( + encodeURIComponent(key) + + '=' + + encodeURIComponent(json[key]) + ) + }) + .join('&') + }, + initColor: function () { + if (localStorage.BgColorType == 1) { + document.body.setAttribute('data-theme', 'dark') + } else if (localStorage.BgColorType !== 'default') { + document.body.setAttribute('data-theme', 'default') + } + var dropdown = document.querySelector( + '.dropdown-skin.open' + ) - axios.get("/PrivateReZeroRoute/100004/GetDbTypeList", jwHeader) - .then(response => { - this.dbTypeList = response.data; - isLoading = true; - this.error = null; - }) - .catch(error => { - isLoading = true; - this.error = error.message; - this.data = null; - }); - }, 3000) - }, - jsonToUrl: function (json) { - return Object.keys(json).map(function (key) { - return encodeURIComponent(key) + '=' + encodeURIComponent(json[key]); - }).join('&'); - }, - initColor: function () { - if (localStorage.BgColorType == 1) { - document.body.setAttribute('data-theme', 'dark'); - } else if (localStorage.BgColorType !== 'default') { - document.body.setAttribute('data-theme', 'default'); - } - var dropdown = document.querySelector('.dropdown-skin.open'); + if (dropdown) { + // 移除 "open" 类,添加 "close" 类 + dropdown.classList.remove('open') + dropdown.classList.add('close') + } + }, + appendQueryParams: function (url) { + // 从当前 URL 中提取查询参数 + const searchParams = new URLSearchParams( + window.location.search + ) + const params = {} - if (dropdown) { - // 移除 "open" 类,添加 "close" 类 - dropdown.classList.remove('open'); - dropdown.classList.add('close'); - } - }, - appendQueryParams: function (url) { - // 从当前 URL 中提取查询参数 - const searchParams = new URLSearchParams(window.location.search); - const params = {}; + // 动态提取 token 和 model + if (searchParams.has('token')) { + params.token = searchParams.get('token') + } + if (searchParams.has('model')) { + params.model = searchParams.get('model') + } - // 动态提取 token 和 model - if (searchParams.has('token')) { - params.token = searchParams.get('token'); - } - if (searchParams.has('model')) { - params.model = searchParams.get('model'); - } + // 如果没有参数,直接返回原始 URL + if (Object.keys(params).length === 0) { + return url + } - // 如果没有参数,直接返回原始 URL - if (Object.keys(params).length === 0) { - return url; - } + // 检查 URL 是否已经包含查询参数 + const separator = url.includes('?') ? '&' : '?' - // 检查 URL 是否已经包含查询参数 - const separator = url.includes('?') ? '&' : '?'; + // 将参数对象转换为查询字符串 + const queryString = Object.keys(params) + .map( + key => + `${encodeURIComponent(key)}=${encodeURIComponent( + params[key] + )}` + ) + .join('&') - // 将参数对象转换为查询字符串 - const queryString = Object.keys(params) - .map(key => `${encodeURIComponent(key)}=${encodeURIComponent(params[key])}`) - .join('&'); - - // 拼接 URL 和查询参数 - return url + separator + queryString; - }, - validateDatalist: function (ele, datalistId) { - const input = ele; - const list = document.getElementById(datalistId); - const options = list && list.options; - const value = input.value; - let isValid = false; - if (options) { - for (let i = 0; i < options.length; i++) { - if (value === options[i].value) { - isValid = true; - break; - } - } - } - if (!isValid) { - input.value = ''; - } - }, - copyText: function (text) - { - navigator.clipboard.writeText(text).then(() => { - tools.alert("复制成功"); - }).catch(err => { - tools.alert("复制失败"); - }); - }, - formatDate: function (date) { - if (!date) return ''; - const d = new Date(date); - const month = '' + (d.getMonth() + 1); - const day = '' + d.getDate(); - const year = d.getFullYear(); - return [year, month.padStart(2, '0'), day.padStart(2, '0')].join('-'); - } + // 拼接 URL 和查询参数 + return url + separator + queryString + }, + validateDatalist: function (ele, datalistId) { + const input = ele + const list = document.getElementById(datalistId) + const options = list && list.options + const value = input.value + let isValid = false + if (options) { + for (let i = 0; i < options.length; i++) { + if (value === options[i].value) { + isValid = true + break + } + } + } + if (!isValid) { + input.value = '' + } + }, + copyText: function (text) { + navigator.clipboard + .writeText(text) + .then(() => { + tools.alert('复制成功') + }) + .catch(err => { + tools.alert('复制失败') + }) + }, + formatDate: function (date) { + if (!date) return '' + const d = new Date(date) + const month = '' + (d.getMonth() + 1) + const day = '' + d.getDate() + const year = d.getFullYear() + return [ + year, + month.padStart(2, '0'), + day.padStart(2, '0'), + ].join('-') + }, } Array.prototype.removeArrayItem = function (item) { - const index = this.indexOf(item); - if (index !== -1) { - this.splice(index, 1); - } - return this; -}; + const index = this.indexOf(item) + if (index !== -1) { + this.splice(index, 1) + } + return this +} setTimeout(function () { - // 设置请求拦截器 - axios.interceptors.request.use(function (config) { - if (isLoading) { - tools.openLoading(); - } - return config; - }, function (error) { - // 对请求错误做些什么 - return Promise.reject(error); - }); - - // 设置响应拦截器 - axios.interceptors.response.use(function (response) { - if (isLoading) { - tools.closeLoading(); - } - return response; - }, function (error) { - if (error.response) { - // 请求已发出,但服务器响应的状态码不在 2xx 范围内 - if (error.response.status === 401) { - if (isLoading) { - tools.closeLoading(); - } - tools.alert("授权失败,自动跳到授权页面"); - // 如果是401错误(未授权),则跳转到登录页面 - setTimeout(function () { - if (isloginPage) { - window.location.href = '/rezero/login.html'; - } else { - window.location.href = '/rezero/authorization.html'; - } - }, 2000); - - } else { - // 处理其他状态码 - return Promise.reject(error); - } - } else if (error.request) { - // 请求已发出,但没有收到响应 - console.log('Request:', error.request); - return Promise.reject(error); - } else { - // 发生一些其他问题在设置请求时触发了一个错误 - console.log('Error', error.message); - return Promise.reject(error); - } - }); + // 设置请求拦截器 + axios.interceptors.request.use( + function (config) { + if (isLoading) { + tools.openLoading() + } + return config + }, + function (error) { + // 对请求错误做些什么 + return Promise.reject(error) + } + ) -},2000) \ No newline at end of file + // 设置响应拦截器 + axios.interceptors.response.use( + function (response) { + if (isLoading) { + tools.closeLoading() + } + return response + }, + function (error) { + if (error.response) { + // 请求已发出,但服务器响应的状态码不在 2xx 范围内 + if (error.response.status === 401) { + if (isLoading) { + tools.closeLoading() + } + tools.alert('授权失败,自动跳到授权页面') + // 如果是401错误(未授权),则跳转到登录页面 + setTimeout(function () { + if (isloginPage) { + window.location.href = '/rezero/login.html' + } else { + window.location.href = + '/rezero/authorization.html' + } + }, 2000) + } else { + // 处理其他状态码 + return Promise.reject(error) + } + } else if (error.request) { + // 请求已发出,但没有收到响应 + console.log('Request:', error.request) + return Promise.reject(error) + } else { + // 发生一些其他问题在设置请求时触发了一个错误 + console.log('Error', error.message) + return Promise.reject(error) + } + } + ) +}, 2000) diff --git a/SuperAPI/wwwroot/rezero/default_ui/std_entity_config.html b/SuperAPI/wwwroot/rezero/default_ui/std_entity_config.html index 28c583e..0869b2d 100644 --- a/SuperAPI/wwwroot/rezero/default_ui/std_entity_config.html +++ b/SuperAPI/wwwroot/rezero/default_ui/std_entity_config.html @@ -61,7 +61,9 @@
- +
{ @@ -480,7 +489,9 @@ var th = this var frmId = 'frmEdit' var json = this.formData - var url = json.METHOD_ID ? '/std_entity/update' : '/std_entity/create' + var url = json.METHOD_ID + ? '/std_entity/update' + : '/std_entity/create' this.addOrUpdateSubmit(url, json) }, addOrUpdateSubmit: function (url, json) { @@ -526,7 +537,8 @@ this.isSelectTable = item }, importEntitySubmit: function () { - this.formData.MAPPING_TABLE = this.isSelectTable.Name + this.formData.MAPPING_TABLE = + this.isSelectTable.Name btnImportEntityClose.click() }, }, diff --git a/SuperAPI/wwwroot/rezero/default_ui/std_filed_map.html b/SuperAPI/wwwroot/rezero/default_ui/std_filed_map.html index 55a86ed..99b0122 100644 --- a/SuperAPI/wwwroot/rezero/default_ui/std_filed_map.html +++ b/SuperAPI/wwwroot/rezero/default_ui/std_filed_map.html @@ -61,7 +61,9 @@
- +
修改