Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
T
topsun-bpm
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
鲁鑫
topsun-bpm
Commits
916d34a6
Commit
916d34a6
authored
Dec 25, 2023
by
覃振观
👶
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
js单向绑定,增加下拉框逻辑两种.填入显示值以及填入其他值.
parent
450daa69
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
185 additions
and
59 deletions
+185
-59
listeningFromData.js
...xt/src/main/webapp/biz/topsun/common/listeningFromData.js
+66
-34
product.js
topsun-xt/src/main/webapp/biz/topsun/product/product.js
+2
-5
productDetail.js
...un-xt/src/main/webapp/biz/topsun/product/productDetail.js
+48
-14
productDetail.jsp
...n-xt/src/main/webapp/biz/topsun/product/productDetail.jsp
+5
-6
ProductController.java
...m/huigou/topsun/product/controller/ProductController.java
+13
-0
easy-search-product.xml
...sources/config/content/easysearch/easy-search-product.xml
+51
-0
No files found.
topsun-xt/src/main/webapp/biz/topsun/common/listeningFromData.js
View file @
916d34a6
...
...
@@ -13,7 +13,7 @@
function
mapping
(
dataMapping
,
rawData
)
{
window
.
dataSet
=
{};
window
.
dataSet
.
tempId
=
950366
;
debugger
;
window
.
dataSet
.
original
=
JSON
.
parse
(
JSON
.
stringify
(
rawData
))
;
if
(
Object
.
entries
(
rawData
).
length
/
Object
.
entries
(
window
.
dataMapping
).
length
<
0.5
)
{
window
.
dataSet
.
isInsert
=
true
;
var
rawData
=
{};
...
...
@@ -172,6 +172,63 @@ function checkArrayMapper(str) {
return
retrunData
;
}
/**
* Grid 编辑前触发。 这里记录当前编辑框 对应的 Grid 行索引 GridRowIndex
* @param options
* @private
*/
function
onBeforeEdit_
(
options
)
{
const
originalOnBeforeEdit
=
options
.
onBeforeEdit
;
options
.
onBeforeEdit
=
function
(
editParm
,
gg
){
let
domIds
=
editParm
.
column
.
__domid
.
split
(
'|'
),
recordId
=
editParm
.
record
.
__id
,
colName
=
editParm
.
column
.
name
;
let
parentDomId
=
domIds
[
0
]
+
'|'
+
2
+
'|'
+
recordId
;
// +'|'+domIds[2];
let
rowDOM
;
if
(
!
(
rowDOM
=
document
.
getElementById
(
parentDomId
)))
{
parentDomId
=
domIds
[
0
]
+
'|'
+
1
+
'|'
+
recordId
;
rowDOM
=
document
.
getElementById
(
parentDomId
)
}
let
mapper
=
window
.
dataMapping
.
mapper
;
let
rowId
=
rowDOM
.
childNodes
[
0
].
childNodes
[
0
].
innerText
;
let
mapperEntry
=
mapper
[
colName
];
let
currentMapper
=
checkArrayMapper
(
domIds
[
0
]);
if
(
currentMapper
.
hasOwnProperty
(
"beanName"
))
{
if
(
!
mapperEntry
[
currentMapper
.
beanName
])
{
console
.
error
(
"dataMapping 中,无法找到该 DOMId 的映射。请检查!"
);
}
else
{
//mapperEntry[currentMapper.beanName]['rowId'] = parentDomId;
mapperEntry
[
currentMapper
.
beanName
][
rowId
][
'rowIndex'
]
=
editParm
.
rowindex
;
}
}
originalOnBeforeEdit
.
call
(
this
,
editParm
,
'11'
);
}
}
function
listeningSearchbox
(
elId
,
options
)
{
const
originalOnChange
=
options
.
onChange
;
options
.
onChange
=
function
(
value
,
data
)
{
let
eleName
=
this
.
element
[
0
].
name
;
let
currentMapper
=
window
.
dataMapping
.
mapper
[
eleName
];
if
(
!
currentMapper
)
{
console
.
error
(
"找不到该映射,请检查映射配置是否存在该配置: "
+
eleName
);
}
let
fillInValue
;
Object
.
entries
(
currentMapper
).
forEach
(
mapper
=>
{
let
property
=
""
;
if
(
eleName
.
split
(
'_'
).
length
>
1
)
{
property
=
eleName
.
split
(
'_'
)[
1
];
}
else
{
property
=
mapper
[
1
];
}
let
beanName
=
mapper
[
0
];
window
.
dataSet
.
newData
[
beanName
][
property
]
=
data
[
property
];
fillInValue
=
data
[
property
];
})
originalOnChange
.
call
(
this
,
value
,
data
,
fillInValue
);
}
$
(
elId
).
searchbox
(
options
);
}
/**
* 若需要监听 Grid 数据,必须在此调用组件初始化,此处获取元素 ID
* @param elId
...
...
@@ -265,37 +322,6 @@ function listeningGrid(elId, options) {
return
gridManager
;
}
/**
* Grid 编辑前触发。 这里记录当前编辑框 对应的 Grid 行索引 GridRowIndex
* @param options
* @private
*/
function
onBeforeEdit_
(
options
)
{
const
originalOnBeforeEdit
=
options
.
onBeforeEdit
;
options
.
onBeforeEdit
=
function
(
editParm
,
gg
){
let
domIds
=
editParm
.
column
.
__domid
.
split
(
'|'
),
recordId
=
editParm
.
record
.
__id
,
colName
=
editParm
.
column
.
name
;
let
parentDomId
=
domIds
[
0
]
+
'|'
+
2
+
'|'
+
recordId
;
// +'|'+domIds[2];
let
rowDOM
;
if
(
!
(
rowDOM
=
document
.
getElementById
(
parentDomId
)))
{
parentDomId
=
domIds
[
0
]
+
'|'
+
1
+
'|'
+
recordId
;
rowDOM
=
document
.
getElementById
(
parentDomId
)
}
let
mapper
=
window
.
dataMapping
.
mapper
;
let
rowId
=
rowDOM
.
childNodes
[
0
].
childNodes
[
0
].
innerText
;
let
mapperEntry
=
mapper
[
colName
];
let
currentMapper
=
checkArrayMapper
(
domIds
[
0
]);
if
(
currentMapper
.
hasOwnProperty
(
"beanName"
))
{
if
(
!
mapperEntry
[
currentMapper
.
beanName
])
{
console
.
error
(
"dataMapping 中,无法找到该 DOMId 的映射。请检查!"
);
}
else
{
//mapperEntry[currentMapper.beanName]['rowId'] = parentDomId;
mapperEntry
[
currentMapper
.
beanName
][
rowId
][
'rowIndex'
]
=
editParm
.
rowindex
;
}
}
originalOnBeforeEdit
.
call
(
this
,
editParm
,
'11'
);
}
}
/**
* 监听 input 管理页面显示的 Data。
*/
...
...
@@ -350,8 +376,14 @@ function listenerContent(event) {
tryForEach
(
mappings
,
(
entry
)
=>
{
let
beanName
=
entry
[
0
];
let
property
=
entry
[
1
];
window
.
dataSet
.
newData
[
beanName
][
property
]
=
event
.
target
.
value
;
console
.
log
(
'Input value changed:'
,
event
.
target
.
value
);
if
(
event
.
target
.
type
===
'checkbox'
)
{
window
.
dataSet
.
newData
[
beanName
][
property
]
=
event
.
target
.
checked
?
1
:
0
;
console
.
log
(
'checked value changed:'
,
event
.
target
.
checked
);
}
else
{
window
.
dataSet
.
newData
[
beanName
][
property
]
=
event
.
target
.
value
;
console
.
log
(
'Input value changed:'
,
event
.
target
.
value
);
}
})
}
}
...
...
topsun-xt/src/main/webapp/biz/topsun/product/product.js
View file @
916d34a6
...
...
@@ -20,10 +20,7 @@ function loadCodeRuleListGrid() {
});
gridManager
=
UICtrl
.
grid
(
"#productListGrid"
,
{
columns
:
[
{
display
:
"产品名称"
,
name
:
"productName"
,
width
:
140
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
,
editor
:
{
type
:
'text'
,
required
:
true
}},
{
display
:
"产品名称"
,
name
:
"productName"
,
width
:
140
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
},
{
display
:
"产品类别"
,
name
:
"productCategoryId"
,
width
:
120
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
},
{
display
:
"产品状态"
,
name
:
"productStatus"
,
width
:
120
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
},
{
display
:
"产品计量单位"
,
name
:
"productUnit"
,
width
:
100
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
},
...
...
@@ -37,7 +34,7 @@ function loadCodeRuleListGrid() {
usePager
:
true
,
toolbar
:
toolbarOptions
,
enabledEdit
:
true
,
width
:
"
5
0%"
,
width
:
"
8
0%"
,
height
:
"100%"
,
heightDiff
:
-
8
,
checkbox
:
true
,
...
...
topsun-xt/src/main/webapp/biz/topsun/product/productDetail.js
View file @
916d34a6
...
...
@@ -26,6 +26,36 @@ function initializateSelectC() {
$
(
'#selectedCategory'
).
val
(
data
.
productCategoryName
)
}
});
listeningSearchbox
(
'#selectedFactory'
,
{
type
:
"product"
,
name
:
"productFactoryName"
,
onChange
:
function
(
value
,
data
,
fillInValue
)
{
console
.
log
(
'fillInValue : '
+
fillInValue
);
}
});
listeningSearchbox
(
'#selectedTechnology'
,
{
type
:
"product"
,
name
:
"productTechnologyType"
,
onChange
:
function
(
value
,
data
,
fillInValue
)
{
console
.
log
(
'fillInValue : '
+
fillInValue
);
window
.
dataSet
.
original
.
ProductTechnology
=
data
;
Public
.
ajax
(
web_app
.
name
+
"/product/queryProcessbyTechnologyId.ajax"
,{
productTechnologyId
:
data
.
productTechnologyId
},
function
(
data
)
{
window
.
dataSet
.
original
.
processed
=
data
;
let
showData
=
mapping
(
dataMapping
,
window
.
dataSet
.
original
);
$
(
'#submitForm'
).
formClean
();
$
(
'#submitForm'
).
formSet
(
showData
);
processedGrid
(
'#processedGrid'
,
window
.
dataSet
.
rawData
.
processed
);
});
// $('#selectedTechnology').val(data.productTechnologyName)
}
});
}
function
initializeUI
()
{
...
...
@@ -47,13 +77,17 @@ function deleteHandler(){
}
function
save
()
{
var
process
=
$
(
'#submitForm'
).
formToJSON
({
check
:
true
});
if
(
!
process
)
{
return
false
;
}
let
upData
=
checkUpdata
();
if
(
!
upData
)
{
return
;
}
Public
.
ajax
(
web_app
.
name
+
"/product/saveOrUpdataOnAllDetail.ajax"
,
{
data
:
JSON
.
stringify
(
upData
)
},
function
(
data
)
{
});
//
Public.ajax(web_app.name + "/product/saveOrUpdataOnAllDetail.ajax", {
//
data: JSON.stringify(upData)
//
}, function (data) {
//
//
});
}
function
initializeToobarContainer
(){
...
...
@@ -120,8 +154,8 @@ var dataMapping = {
],
ProductTechnology
:
[
"beerPlateNo"
,
"goldPlateNo"
,
"dieCutPlateNo"
,
"copperpResinLateNo"
,
"netPlateNo"
,
"productTechnologyRequire"
,
"packageStyle"
,
"p
ackageStyle"
,
"p
hysicalTest"
,
"chemistryTest"
,
"productMaterial"
,
"productTechnologyRequire"
,
"packageStyle"
,
"physicalTest"
,
"chemistryTest"
,
"productMaterial"
,
{
"productTechnologyName"
:
"technology_productId"
}
,
"copperpNo"
,
"colorNoCard"
,
"plateNo"
,
"plasticBagStructure"
],
ProductPublishedConf
:
[
...
...
@@ -194,13 +228,13 @@ function processedGrid(elId, data) {
// });
var
gridManager
=
listeningGrid
(
elId
,
{
columns
:
[
{
display
:
"生成顺序"
,
name
:
"productionSequence"
,
width
:
140
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
},
{
display
:
"工序名称"
,
name
:
"processName"
,
width
:
120
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
},
{
display
:
"是否排期工序"
,
name
:
"isScheduleProcess"
,
width
:
120
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
},
{
display
:
"是否完成工序"
,
name
:
"isFinishedProcess"
,
width
:
120
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
},
{
display
:
"工艺备注"
,
name
:
"processRemark"
,
width
:
120
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
},
{
display
:
"完成时间"
,
name
:
"finishedTime"
,
width
:
120
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
},
{
display
:
"签字"
,
name
:
"signed"
,
width
:
120
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
},
{
display
:
"生成顺序"
,
name
:
"productionSequence"
,
width
:
140
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
,
editor
:
{
type
:
'text'
}
},
{
display
:
"工序名称"
,
name
:
"processName"
,
width
:
120
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
,
editor
:
{
type
:
'text'
}
},
{
display
:
"是否排期工序"
,
name
:
"isScheduleProcess"
,
width
:
120
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
,
editor
:
{
type
:
'text'
}
},
{
display
:
"是否完成工序"
,
name
:
"isFinishedProcess"
,
width
:
120
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
,
editor
:
{
type
:
'text'
}
},
{
display
:
"工艺备注"
,
name
:
"processRemark"
,
width
:
120
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
,
editor
:
{
type
:
'text'
}
},
{
display
:
"完成时间"
,
name
:
"finishedTime"
,
width
:
120
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
,
editor
:
{
type
:
'text'
}
},
{
display
:
"签字"
,
name
:
"signed"
,
width
:
120
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
,
editor
:
{
type
:
'text'
}
},
],
// toolbar: toolbarOptions,
dataType
:
"local"
,
...
...
topsun-xt/src/main/webapp/biz/topsun/product/productDetail.jsp
View file @
916d34a6
...
...
@@ -115,7 +115,8 @@
<div
class=
"ui-tab-content"
style=
"padding: 2px; padding-right: 0;"
>
<div
class=
"layout"
id=
'detailFormDiv'
>
<div
class=
"hg-form-row"
>
<x:inputC
name=
"factoryName"
label=
"制造工厂"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"64"
/>
<x:inputC
name=
"factoryName"
id=
"selectedFactory"
label=
"制造工厂"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"64"
wrapper=
"select"
/>
<x:inputC
name=
"factoryName"
label=
"客户名称(无对应)"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"64"
/>
<x:inputC
name=
"productLayout"
label=
"版面"
labelCol=
"1"
fieldCol=
"1"
maxLength=
"64"
/>
<x:inputC
name=
"materialCode"
label=
"材料代号"
labelCol=
"1"
fieldCol=
"1"
maxLength=
"64"
/>
...
...
@@ -195,7 +196,8 @@
<x:inputC
name=
"netPlateNo"
required=
"false"
label=
"网版编号"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"64"
/>
</div>
<div
class=
"hg-form-row"
>
<x:inputC
name=
"productTechnologyName"
label=
"制程工艺"
labelCol=
"1"
fieldCol=
"7"
maxLength=
"64"
/>
<x:inputC
name=
"technology_productId"
title=
"productId"
id =
"selectedTechnology"
label=
"制程工艺"
labelCol=
"1"
fieldCol=
"7"
wrapper=
"select"
maxLength=
"64"
/>
<x:inputC
name=
"productProperty"
label=
"产品性质"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"64"
/>
</div>
...
...
@@ -204,7 +206,7 @@
</div>
<div
class=
"hg-form-row"
>
<x:inputC
name=
"productTechnologyRequire"
label=
"工艺要求"
labelCol=
"1"
fieldCol=
"2"
maxLength=
"64"
readonly=
"true"
/>
<x:inputC
name=
"productTechnologyRequire"
label=
"工艺要求"
labelCol=
"1"
fieldCol=
"2"
maxLength=
"64"
/>
<x:inputC
name=
"packageStyle"
label=
"包装方式"
labelCol=
"1"
fieldCol=
"2"
maxLength=
"64"
/>
<x:inputC
name=
"physicalTest"
label=
"物性测试"
labelCol=
"1"
fieldCol=
"2"
maxLength=
"64"
/>
<x:inputC
name=
"chemistryTest"
label=
"化性测试"
labelCol=
"1"
fieldCol=
"2"
maxLength=
"64"
/>
...
...
@@ -222,9 +224,6 @@
<x:inputC
name=
"plateNo"
label=
"模具编号"
labelCol=
"1"
fieldCol=
"2"
maxLength=
"64"
/>
</div>
<%-- <x:textareaC cols="3" ></x:textareaC>--%>
...
...
topsun/src/main/java/com/huigou/topsun/product/controller/ProductController.java
View file @
916d34a6
...
...
@@ -7,7 +7,9 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import
com.huigou.cache.DictUtil
;
import
com.huigou.topsun.product.application.ProductApplication
;
import
com.huigou.topsun.product.application.ProductProcessApplication
;
import
com.huigou.topsun.product.domain.Product
;
import
com.huigou.topsun.product.domain.ProductProcess
;
import
com.huigou.uasp.annotation.ControllerMapping
;
import
com.huigou.uasp.client.CommonController
;
import
com.huigou.util.SDO
;
...
...
@@ -17,6 +19,7 @@ import org.springframework.stereotype.Controller;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
...
...
@@ -31,6 +34,8 @@ public class ProductController extends CommonController {
@Autowired
private
ProductApplication
productService
;
@Autowired
private
ProductProcessApplication
processService
;
@Autowired
private
ObjectMapper
objectMapper
;
...
...
@@ -105,6 +110,14 @@ public class ProductController extends CommonController {
return
success
(
resultMap
);
}
public
String
queryProcessbyTechnologyId
()
{
SDO
sdo
=
this
.
getSDO
();
BigDecimal
technologyId
=
new
BigDecimal
(
sdo
.
getString
(
"productTechnologyId"
));
List
<
ProductProcess
>
list
=
processService
.
queryProcessbyTechnologyId
(
technologyId
);
return
success
(
list
);
}
}
\ No newline at end of file
topsun/src/main/resources/config/content/easysearch/easy-search-product.xml
View file @
916d34a6
...
...
@@ -24,6 +24,57 @@
<field
name=
"产品名称"
title=
"产品名称"
code=
"productCategoryName"
width=
"200"
/>
</easy-search>
<easy-search
name=
"productTechnologyType"
desc=
"产品"
>
<sql>
SELECT
t.product_id,
t.product_technology_id,
t.product_technology_name,
t.beer_plate_no,
t.gold_plate_no,
t.die_cut_plate_no,
t.copperp_resin_late_no,
t.net_plate_no,
t.product_technology_require,
t.package_style,
t.physical_test,
t.chemistry_test,
t.copperp_no,
t.color_no_card,
t.product_material,
t.plate_no,
t.plastic_bag_structure
FROM
product_technology t
</sql>
<field
name=
"工艺制程"
title=
"工艺制程"
code=
"productTechnologyName"
width=
"200"
/>
<field
name=
"工艺ID"
title=
"工艺ID"
code=
"productTechnologyId"
width=
"200"
/>
<field
name=
"产品ID"
title=
"产品ID"
code=
"productId"
type=
'hidden'
/>
<field
code=
"beerPlateNo"
type=
'hidden'
/>
<field
code=
"goldPlateNo"
type=
'hidden'
/>
<field
code=
"beerPlateNo"
type=
'hidden'
/>
<field
code=
"dieCutPlateNo"
type=
'hidden'
/>
<field
code=
"copperpResinLateNo"
type=
'hidden'
/>
<field
code=
"netPlateNo"
type=
'hidden'
/>
<field
code=
"productTechnologyRequire"
type=
'hidden'
/>
<field
code=
"packageStyle"
type=
'hidden'
/>
<field
code=
"physicalTest"
type=
'hidden'
/>
<field
code=
"chemistryTest"
type=
'hidden'
/>
<field
code=
"productMaterial"
type=
'hidden'
/>
<field
code=
"copperpNo"
type=
'hidden'
/>
<field
code=
"colorNoCard"
type=
'hidden'
/>
<field
code=
"plateNo"
type=
'hidden'
/>
<field
code=
"plasticBagStructure"
type=
'hidden'
/>
</easy-search>
<easy-search
name=
"productFactoryName"
desc=
"产品"
>
<sql>
select t.factory_code, t.factory_name from factory t
</sql>
<field
name=
"工厂名称"
title=
"工厂名称"
code=
"factoryName"
width=
"200"
/>
<field
name=
"工厂编号"
title=
"工厂编号"
code=
"factoryCode"
width=
"200"
/>
</easy-search>
<easy-search
name=
"productS"
desc=
"产品"
>
<sql>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment