Commit 57678750 authored by 彭俊龙's avatar 彭俊龙

feat:自动化工单测试

parent 8e02163a
Pipeline #96641 failed with stages
......@@ -13,6 +13,7 @@ import {
InputNumber,
Checkbox,
message,
Switch
} from 'antd';
import 'moment/dist/locale/zh-cn';
import locale from 'antd/es/date-picker/locale/zh_CN';
......@@ -119,7 +120,7 @@ const CaseModify = props => {
scheduledConfig: {
userIds: [], //用户ID
roleIds: [], //角色ID
Values: [], //工单移交模板
values: [], //工单模板提交数据
agentConfig: '',
}, //定时触发
});
......@@ -182,7 +183,7 @@ const CaseModify = props => {
{
let res;
if (TriggerMethod === '定时触发') {
setShowForm(true);
getBizMetaData(detail);
res = await GetConditionConfigFlowNode({ flowId: FlowId });
} else {
......@@ -401,12 +402,24 @@ const CaseModify = props => {
...paramObj,
userId: 1,
};
const vals = ScheduledConfig.Values
setShowForm(vals.length > 0);
const { code, data, msg } = await GetBizMetaData(paramObj);
const { formJson, values } = data[0];
const jsonObj = JSON.parse(formJson)
const formValues =vals.length > 0 ? values.map(v=> {
const d = vals.find(x=> v.fieldName === x.fieldName)
if(d){
return {
...v,
fieldValue: d.fieldValue
}
}
return v
}) : values
formJsonRef.current = jsonObj
setSchemaValues({ values, formJson: jsonObj });
console.log(formData, 'formDataformData')
setSchemaValues({ values: formValues, formJson: jsonObj });
}
};
......@@ -920,7 +933,6 @@ const CaseModify = props => {
const handleSelectRuleType = (e, type) => {
const { checked } = e.target;
generatePostData({ triggerMethod: type });
setShowForm(type === '定时触发')
if (type === '定时触发') {
generatePostData({});
if (nodeNams.length > 0) {
......@@ -1200,6 +1212,7 @@ const CaseModify = props => {
agentConfig,
userIds: configInfo.userIds,
roleIds: configInfo.roleIds,
values: showForm ? postData.current.scheduledConfig.values : []
};
}
const fn = () => setloadding(false);
......@@ -1561,20 +1574,39 @@ const CaseModify = props => {
}
return '';
};
const loaclPaths = ['【本人姓名】', '【本人电话】', '【本人部门】']
const onOK= async ()=>{
console.log(formJsonRef.current, 'formJsonRef.current');
if(isObject(formJsonRef.current)){
const formJsonData = getFormData(formJsonRef.current);
if(isObject(formJsonData)){
Object.keys(formJsonData).forEach(v => {
if(formJsonData[v].widget === 'TextInput'){
const { presetValue, isStoreID } = formJsonData[v];
const { errors, formValue } = await formRef.current.getValues();
const values = formValue.map(v=> {
if(formJsonData[v.fieldName]){
const { widget, presetValue, isStoreID, isMySite } = formJsonData[v.fieldName]
if(widget === 'TextInput' && loaclPaths.includes(presetValue)){
return {
fieldName: v.fieldName,
fieldValue: '',
presetValue,
isStoreID
}
})
}else if(widget === 'ComboBox' && isMySite){
return {
fieldName: v.fieldName,
fieldValue: '',
presetValue: '',
isStoreID
}
const formData = await formRef.current.getValues();
console.log(formData, formJsonData, 'formDataformDataformData');
}
return {
fieldName: v.fieldName,
fieldValue: v.fieldValue,
presetValue: '',
isStoreID
}
}
})
postData.current.scheduledConfig.Values = values
}
setFormVisible(false)
}
......@@ -1933,8 +1965,16 @@ const CaseModify = props => {
</div>
<p style={{ color: 'red' }}>{errorMsg}</p>
<span>下次请求时间:{tip}</span>
{configInfo.triggerType == '定时触发' &&
<div style={{ marginTop: '10px' }}>
<Space>
<span>启用工单模板:</span>
<Switch checkedChildren="开启" unCheckedChildren="关闭" checked={showForm} onChange={(e)=> setShowForm(e)}/>
</Space>
</div>
}
{showForm && (
<div style={{ marginTop: '20px' }}>
<div style={{ marginTop: '10px' }}>
<Space>
<span>工单移交模板:</span>
<Button onClick={()=> setFormVisible(true)}>点击查看</Button>
......
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