Commit 5dfc4510 authored by 覃振观's avatar 覃振观 👶

1

parent f3405fdd
...@@ -151,6 +151,17 @@ function checkUpdata() { ...@@ -151,6 +151,17 @@ function checkUpdata() {
}) })
} }
/**
* 若需要监听 Grid 数据,必须在此调用组件初始化,此处获取元素 ID
* @param elId
* @param options
* @returns {*}
*/
function listeningGrid(elId, options) {
addObserver(elId);
return UICtrl.grid(elId, options);
}
/** /**
* 用于判断字符串是否更改 * 用于判断字符串是否更改
* @param str * @param str
...@@ -179,17 +190,26 @@ function getHashCode (str, caseSensitive) { ...@@ -179,17 +190,26 @@ function getHashCode (str, caseSensitive) {
} }
} }
function runObserver() { function addObserver(eleId) {
observer.observe(document.querySelector('#panelContainer'), mutationConfig); observer.observe(document.querySelector(eleId), mutationConfig);
} }
// 补充方案 监听 Value 属性 // 补充方案 监听 Value 属性
const observer = new MutationObserver((mutations) => { const observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => { mutations.forEach((mutation) => {
if(mutation.type === 'attributes'&& mutation.attributeName === 'value') { if(mutation.type === 'childList') {
console.log('属性变化节点 : ' + mutation.target); let addNodes = mutation.addedNodes;
console.log('变化属性名 : ' + mutation.attributeName); if(addNodes.length == 1 && addNodes[0].nodeName === 'DIV') {
console.log('变化属性值 : ' + mutation.target.value); let childNodes = addNodes[0].childNodes;
if(childNodes.length == 1 && childNodes[0].nodeName === 'INPUT') {
let node = childNodes[0];
debugger;
console.log('属性变化节点 : ' + mutation.target);
console.log('变化属性名 : ' + mutation.attributeName);
console.log('变化属性值 : ' + mutation.target.value);
}
}
} }
}) })
}) })
......
...@@ -4,7 +4,7 @@ $(document).ready(function() { ...@@ -4,7 +4,7 @@ $(document).ready(function() {
initializeToobarContainer(); initializeToobarContainer();
initializateSelectC(); initializateSelectC();
$('#pageTab').tab(); $('#pageTab').tab();
runObserver(); // runObserver();
}); });
...@@ -40,7 +40,7 @@ function faceGrid(elId, data) { ...@@ -40,7 +40,7 @@ function faceGrid(elId, data) {
} }
} }
}); });
var gridManager = UICtrl.grid(elId, { var gridManager = listeningGrid(elId, {
columns: [ columns: [
{ display: "颜色名称", name: "productFaceColorId", width: 140, minWidth: 60, type: "string", align: "left", editor: { { display: "颜色名称", name: "productFaceColorId", width: 140, minWidth: 60, type: "string", align: "left", editor: {
type: 'text', type: 'text',
......
package com.huigou.topsun.product.application; package com.huigou.topsun.product.application;
import com.huigou.topsun.product.domain.Product; import com.huigou.topsun.product.domain.Product;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -35,7 +36,7 @@ public interface ProductApplication { ...@@ -35,7 +36,7 @@ public interface ProductApplication {
/** /**
* description 对比所有对象,并保存更改的数据。 * description 对比所有对象,并保存更改的数据。
* *
* @param rawMap 原数据 * @param newData 更新数据
* @return java.util.HashMap<java.lang.String, java.lang.Object> * @return java.util.HashMap<java.lang.String, java.lang.Object>
* @author qinzhenguan * @author qinzhenguan
* @createDate 2023/12/8 17:19 * @createDate 2023/12/8 17:19
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment