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

feat:地图路径绘制加地图,数值框加校验

parent 0b114fb4
{ {
"name": "panda-xform", "name": "panda-xform",
"version": "6.10.84", "version": "6.10.89",
"description": "6.10.84 部门选择支持选择父级自动带入子级", "description": "6.10.89 数值输入新增最大值最小值校验",
"keywords": [ "keywords": [
"panda-xform" "panda-xform"
], ],
......
...@@ -24,7 +24,6 @@ const SearchGroup = forwardRef((props, ref) => { ...@@ -24,7 +24,6 @@ const SearchGroup = forwardRef((props, ref) => {
const [dateArray, setDateArray] = useState([]) const [dateArray, setDateArray] = useState([])
const [formatterStr, setFormatterStr] = useState('YYYY-MM-DD HH:mm:ss') const [formatterStr, setFormatterStr] = useState('YYYY-MM-DD HH:mm:ss')
const [queryInfo, setQueryInfo] = useState({ info: '', timeFrom: '', timeTo: '' }) const [queryInfo, setQueryInfo] = useState({ info: '', timeFrom: '', timeTo: '' })
const searchShow = useMemo(() => { const searchShow = useMemo(() => {
return accountFieids.some(v => v.likeSearch) return accountFieids.some(v => v.likeSearch)
}, [accountFieids]) }, [accountFieids])
...@@ -360,8 +359,6 @@ const SearchGroup = forwardRef((props, ref) => { ...@@ -360,8 +359,6 @@ const SearchGroup = forwardRef((props, ref) => {
return ( return (
<Row className={styles.controlRow}> <Row className={styles.controlRow}>
<Form layout={'inline'} form={form} onValuesChange={onValuesChange}> <Form layout={'inline'} form={form} onValuesChange={onValuesChange}>
{
enableTimeFilter ? (
<Form.Item label={`录入时间`} name="time" style={{ marginBottom: 0 }}> <Form.Item label={`录入时间`} name="time" style={{ marginBottom: 0 }}>
<RangePicker <RangePicker
size="middle" size="middle"
...@@ -373,10 +370,6 @@ const SearchGroup = forwardRef((props, ref) => { ...@@ -373,10 +370,6 @@ const SearchGroup = forwardRef((props, ref) => {
style={{ width: 300 }} style={{ width: 300 }}
/> />
</Form.Item> </Form.Item>
) : null
}
{
searchShow ? (
<Form.Item <Form.Item
label={getSearchLabel()} label={getSearchLabel()}
name="info" name="info"
...@@ -393,17 +386,11 @@ const SearchGroup = forwardRef((props, ref) => { ...@@ -393,17 +386,11 @@ const SearchGroup = forwardRef((props, ref) => {
onSearch={onSearch} onSearch={onSearch}
/> />
</Form.Item> </Form.Item>
) : null
}
{
(enableTimeFilter || searchShow) ? (
<Form.Item style={{ marginBottom: 0 }}> <Form.Item style={{ marginBottom: 0 }}>
<Button type="primary" onClick={() => reset()}> <Button type="primary" onClick={() => reset()}>
重置 重置
</Button> </Button>
</Form.Item> </Form.Item>
) : null
}
</Form> </Form>
{/* 按钮区域 */} {/* 按钮区域 */}
<div className={styles.controlRowRight}> <div className={styles.controlRowRight}>
......
...@@ -93,6 +93,7 @@ const AccountSelectorCell = (props) => { ...@@ -93,6 +93,7 @@ const AccountSelectorCell = (props) => {
} }
const getDataSource = async (outParams = {}) => { const getDataSource = async (outParams = {}) => {
debugger;
setLoading(true); setLoading(true);
let param = { let param = {
...params, ...params,
......
...@@ -205,7 +205,7 @@ const ValueEdit = (props) => { ...@@ -205,7 +205,7 @@ const ValueEdit = (props) => {
</div> </div>
), ),
userName: v.userName, userName: v.userName,
value: v[property], value: v[property] * 1,
groupName: v.groupName groupName: v.groupName
} }
})) }))
...@@ -280,7 +280,6 @@ const ValueEdit = (props) => { ...@@ -280,7 +280,6 @@ const ValueEdit = (props) => {
disabled={disabled} disabled={disabled}
value={value === '' ? null : Number(value)} value={value === '' ? null : Number(value)}
onChange={(value) => { onChange={(value) => {
onChange({ fieldName, fieldValue: value !== null ? `${value}` : '' })
if (autoArray.length) { if (autoArray.length) {
autoArray.forEach(v => { autoArray.forEach(v => {
if (v.fields.includes(fieldName)) { if (v.fields.includes(fieldName)) {
...@@ -293,6 +292,8 @@ const ValueEdit = (props) => { ...@@ -293,6 +292,8 @@ const ValueEdit = (props) => {
formAuto({ ...v, values }, otherChange) formAuto({ ...v, values }, otherChange)
} }
}) })
}else{
onChange({ fieldName, fieldValue: value !== null ? `${value}` : '' })
} }
}} }}
style={{ width: '100%' }} style={{ width: '100%' }}
......
...@@ -277,7 +277,6 @@ const TablePack = (props, ref) => { ...@@ -277,7 +277,6 @@ const TablePack = (props, ref) => {
fields.forEach(v => { fields.forEach(v => {
otherRow[v.fieldName] = v.fieldValue otherRow[v.fieldName] = v.fieldValue
}) })
console.log('otherRow', record, otherRow)
btnsClick({ type: '变化', row: { ...record, ...otherRow } }) btnsClick({ type: '变化', row: { ...record, ...otherRow } })
} else { } else {
......
...@@ -89,7 +89,13 @@ const RelationForm = (props) => { ...@@ -89,7 +89,13 @@ const RelationForm = (props) => {
if (Array.isArray(mappedField)) { if (Array.isArray(mappedField)) {
mappedField.forEach(s => { mappedField.forEach(s => {
if (s.toField === v) { if (s.toField === v) {
array.push({ fieldName: s.toField, fieldValue: getFieldValue(s, formDataObj, codes) }) let value = getFieldValue(s, formDataObj, codes)
if(s.fromField === '当前用户ID'){
value = userID
}else if(s.fromField === '当前用户名称'){
value = fullName
}
array.push({ fieldName: s.toField, fieldValue: value })
} }
}) })
} }
...@@ -166,9 +172,9 @@ const RelationForm = (props) => { ...@@ -166,9 +172,9 @@ const RelationForm = (props) => {
let formDataObj = getFormDataObj(addons?.formData) let formDataObj = getFormDataObj(addons?.formData)
mappedField.forEach(v => { mappedField.forEach(v => {
let value = codes[v.fromField] || formDataObj[v.fromField] let value = codes[v.fromField] || formDataObj[v.fromField]
if(v.fromField === '用户ID'){ if(v.fromField === '当前用户ID'){
value = userID value = userID
}else if(v.fromField === '用户名称'){ }else if(v.fromField === '当前用户名称'){
value = fullName value = fullName
} }
queryWheres.push({ field: v.toField, type: '等于', value }) queryWheres.push({ field: v.toField, type: '等于', value })
...@@ -324,6 +330,11 @@ const RelationForm = (props) => { ...@@ -324,6 +330,11 @@ const RelationForm = (props) => {
mappedField.forEach(s => { mappedField.forEach(s => {
if (s.toField === v) { if (s.toField === v) {
let value = getFieldValue(s, formDataObj, codes) || '' let value = getFieldValue(s, formDataObj, codes) || ''
if(v.fromField === '当前用户ID'){
value = userID
}else if(v.fromField === '当前用户名称'){
value = fullName
}
array.push({ fieldName: s.toField, fieldValue: value }) array.push({ fieldName: s.toField, fieldValue: value })
obj[s.toField] = value obj[s.toField] = value
} }
...@@ -370,7 +381,7 @@ const RelationForm = (props) => { ...@@ -370,7 +381,7 @@ const RelationForm = (props) => {
}, }) }, })
if (code === 0) { if (code === 0) {
setDataSourceOther(data?.jsonData ? JSON.parse(data?.jsonData) : []) setDataSourceOther(data?.jsonData ? JSON.parse(data?.jsonData) : [])
setParamsOther({ ...paramsOther, total: data.totalCount }) setParamsOther({ ...paramsOther, total: data.totalCount, pageIndex: data.pageIndex, pageSize: data.pageSize })
} }
setLoadingOther(false) setLoadingOther(false)
} }
...@@ -396,6 +407,7 @@ const RelationForm = (props) => { ...@@ -396,6 +407,7 @@ const RelationForm = (props) => {
let items = [] let items = []
let field = accountFieids.filter(v => v.webDisplay).map(v => v.fieldName) let field = accountFieids.filter(v => v.webDisplay).map(v => v.fieldName)
dataSourceOther.forEach(v => { dataSourceOther.forEach(v => {
if (keys.includes(v.ID)) { if (keys.includes(v.ID)) {
let ID = `${getNanoid(10, '前端ID')}` let ID = `${getNanoid(10, '前端ID')}`
let values = [] let values = []
...@@ -406,6 +418,11 @@ const RelationForm = (props) => { ...@@ -406,6 +418,11 @@ const RelationForm = (props) => {
mappedField.forEach(j => { mappedField.forEach(j => {
if (j.toField === s) { if (j.toField === s) {
let value = getFieldValue(j, formDataObj, codes) || '' let value = getFieldValue(j, formDataObj, codes) || ''
if(j.fromField === '当前用户ID'){
value = userID
}else if(j.fromField === '当前用户名称'){
value = fullName
}
values.push({ fieldName: s, fieldValue: value }) values.push({ fieldName: s, fieldValue: value })
obj[s] = value obj[s] = value
} }
......
...@@ -61,17 +61,27 @@ const DrawPath = (props) => { ...@@ -61,17 +61,27 @@ const DrawPath = (props) => {
view.map.remove(layers.current) view.map.remove(layers.current)
drawTool.activate({ drawTool.activate({
view, view,
action: 'polyline', action: 'arrowsLine',
target: 'erroSendUpWidget',// 随便写 target: 'erroSendUpWidget',// 随便写
toolTip: '左键选择位置', toolTip: '左键选择位置',
drawEnd: geometry => { drawEnd: geometry => {
console.log(geometry, "1111111")
setPaths({ paths: geometry.paths }) setPaths({ paths: geometry.paths })
let layer = new Graphic({ const graphic = drawTool.getDrawGraphic()
geometry: geometry, let symbol = new SimpleLineSymbol({
symbol: new SimpleLineSymbol({
// color: "#ff0000", // color: "#ff0000",
width: 2 width: 2
}), });
if(graphic && graphic?.symbol){
symbol = graphic.symbol.clone()
}
let layer = new Graphic({
geometry: geometry,
symbol
// symbol: new SimpleLineSymbol({
// // color: "#ff0000",
// width: 2
// }),
// symbol: { // symbol: {
// type: "CIMLineSymbol", // type: "CIMLineSymbol",
// symbolLayers: [{ // symbolLayers: [{
......
...@@ -96,7 +96,7 @@ const MappedField = (props) => { ...@@ -96,7 +96,7 @@ const MappedField = (props) => {
showCheckedStrategy showCheckedStrategy
> >
<TreeNode value='内置字段' title='内置字段' disabled> <TreeNode value='内置字段' title='内置字段' disabled>
{['工单编号', '事件编号', '事件名称', '用户ID', '用户名称'].map(s => <TreeNode value={s} title={s} key={s} />)} {['工单编号', '事件编号', '事件名称', '当前用户ID', '当前用户名称'].map(s => <TreeNode value={s} title={s} key={s} />)}
</TreeNode> </TreeNode>
<TreeNode value='附加字段' title='附加字段' disabled> <TreeNode value='附加字段' title='附加字段' disabled>
{ {
......
...@@ -21,17 +21,62 @@ function formatMoney(number, places, symbol, thousand, decimal) { ...@@ -21,17 +21,62 @@ function formatMoney(number, places, symbol, thousand, decimal) {
j = (j = i.length) > 3 ? j % 3 : 0; j = (j = i.length) > 3 ? j % 3 : 0;
return symbol + negative + (j ? i.substr(0, j) + thousand : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + thousand) + (places ? decimal + Math.abs(number - i).toFixed(places).slice(2) : ""); return symbol + negative + (j ? i.substr(0, j) + thousand : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + thousand) + (places ? decimal + Math.abs(number - i).toFixed(places).slice(2) : "");
} }
const debounce = (fn) => {
let t = null
return function (e) {
const context = this
const args = arguments
if (t) {
clearTimeout(t)
}
t = setTimeout(function () {
fn.call(context, args)
}, 200)
}
}
const NumberInput = (props) => { const NumberInput = (props) => {
const { value, onChange, schema, addons } = props const { value, onChange, schema, addons } = props
const { disabled, presetValue, placeholder, prefix, formatter, decimalDigits, isStoreFormatter, addonBefore, addonAfter, min, max } = schema const { disabled, presetValue, placeholder, prefix, formatter, decimalDigits, isStoreFormatter, addonBefore, addonAfter, min, max } = schema
//新增最大最小值校验
useEffect(()=>{
if (addons && (min || max) && value) {
let getValue = async (params) => {
const [rule, value, callback] = params
if(min){
if(Number(value) < Number(min)){
callback(new Error(`最小值不能小于${min}`))
}else{
callback()
}
}
if(max){
if(Number(value) > Number(max)){
callback(new Error(`最大值不能大于${max}`))
}else{
callback()
}
}
}
let uniqueRules = [
{
validator: debounce(getValue)
}
]
addons.setSchemaByPath(addons.dataPath, { ...schema, rules: uniqueRules })
}
}, [value])
useEffect(() => { useEffect(() => {
if (addons) { if (addons) {
addons.setValueByPath(addons.dataPath, presetValue) addons.setValueByPath(addons.dataPath, presetValue)
} else { } else {
onChange(presetValue) onChange(presetValue)
} }
}, [presetValue]) }, [presetValue])
const numberChange = (value) => { const numberChange = (value) => {
...@@ -41,6 +86,8 @@ const NumberInput = (props) => { ...@@ -41,6 +86,8 @@ const NumberInput = (props) => {
} else { } else {
onChange('') onChange('')
} }
} }
} }
......
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