64 lines
2.1 KiB
Markdown
64 lines
2.1 KiB
Markdown
# 功能实现
|
|
|
|
```javascript
|
|
// 代码内容需要根据实际内容进行调整
|
|
var list_att="field14739,field14740"; //入职、行政
|
|
var list_att_name={'field14739':'入职','field14740':'行政'};
|
|
|
|
// 「附件相关」附件控件的显示与隐藏
|
|
function AttBtnnSet(obj_id){
|
|
if(WfForm.getFieldValue(obj_id) == ""){
|
|
$("div[data-fieldmark='"+obj_id+"'] .wea-upload-container").css("cssText","display:inline;");
|
|
}else{
|
|
$("div[data-fieldmark='"+obj_id+"'] .wea-upload-container").css("cssText","display:none;");
|
|
}
|
|
}
|
|
|
|
// 「附件相关」检查附件数量 - 单附件
|
|
function CheckAttCount(obj_id){
|
|
var obj_v=WfForm.getFieldValue(obj_id);
|
|
return (obj_v != "" && obj_v.split(",").length>1) ? false : true;
|
|
}
|
|
```
|
|
|
|
# 「CSS」样式美化
|
|
|
|
```css
|
|
/* ----------> 附件美化调整 <---------- */
|
|
/* 上传附件位置调整 */
|
|
.wea-upload-container{ margin-left: 2px!important; }
|
|
.wea-upload,.wea-upload-list,.wea-upload-list-item-file{ padding: 0px!important; }
|
|
.wea-upload-list-item-file{ min-height: 0px!important; }
|
|
.icon-coms-AddTo{ margin: 0px 5px 0px 0px!important; }
|
|
```
|
|
|
|
# 「扩展」变动时间中中调用
|
|
|
|
```javascript
|
|
AttBtnnSet(id); // 对上传控件显示隐藏的控制
|
|
if(!AttCountCheck(id)){
|
|
WfForm.showMessage(`请注意「证明材料-${list_att_name[id]}」控件只接受单一附件,当前控件不符合规则,流程将无法保存与提交!`, 2, 10);
|
|
}
|
|
```
|
|
# 「扩展」初始化函数中调用
|
|
|
|
```javascript
|
|
// 「控件设置」附件
|
|
let att_a=list_att.split(','); // 将上面设置的附件列表分割为数组
|
|
for(let obj_id of att_a){
|
|
AttBtnnSet(obj_id);
|
|
}
|
|
```
|
|
|
|
# 「扩展」拦截事件中调用
|
|
|
|
```javascript
|
|
// 「校验」附件数量
|
|
let att_a=list_att.split(','); // 将上面设置的附件列表分割为数组
|
|
for(let obj_id of att_a){
|
|
if(!AttCountCheck(obj_id)){
|
|
WfForm.showMessage(`请注意「证明材料-${list_att_name[obj_id]}」控件只接受单一附件,当前控件不符合规则,流程将无法保存与提交!`, 2, 2);
|
|
return;
|
|
}
|
|
}
|
|
``` |