Commit 9f24b928 authored by 田翔's avatar 田翔

fix: 增加增加本人电话

parent 1b68a7f5
{ {
"name": "panda-xform", "name": "panda-xform",
"version": "5.0.9", "version": "5.1.0",
"description": "5.0.9 表格增加自动计算", "description": "5.1.0 增加增加本人电话",
"keywords": [ "keywords": [
"panda-xform" "panda-xform"
], ],
......
...@@ -5,7 +5,12 @@ import moment from 'moment' ...@@ -5,7 +5,12 @@ import moment from 'moment'
import { debounce } from '../../../../../../utils' import { debounce } from '../../../../../../utils'
import { formAutomaticComputation } from '../../../../../../apis/process' import { formAutomaticComputation } from '../../../../../../apis/process'
const initUserInfo = {
fullName: '【本人姓名】',
Phone: '【本人电话】',
depart: { name: '【本人部门】' }
}
const loaclPaths = ['【本人姓名】', '【本人电话】', '【本人部门】']
const formAutomatic = async (parmas, callback) => { const formAutomatic = async (parmas, callback) => {
const { code, data } = await formAutomaticComputation(parmas) const { code, data } = await formAutomaticComputation(parmas)
if (code === 0) { if (code === 0) {
...@@ -23,7 +28,7 @@ const formAuto = debounce(formAutomatic) ...@@ -23,7 +28,7 @@ const formAuto = debounce(formAutomatic)
const ValueEdit = (props) => { const ValueEdit = (props) => {
const preview = sessionStorage.getItem('FormRender') const preview = sessionStorage.getItem('FormRender')
const userInfo = preview === 'preview' ? { fullName: '【本人姓名】', depart: { name: '【本人部门】' } } : window?.globalConfig?.userInfo || { fullName: '【本人姓名】', depart: { name: '【本人部门】' } } const userInfo = preview !== 'preview' ? initUserInfo : window?.globalConfig?.userInfo || initUserInfo
const { const {
onChange, onChange,
value, value,
...@@ -44,10 +49,9 @@ const ValueEdit = (props) => { ...@@ -44,10 +49,9 @@ const ValueEdit = (props) => {
useEffect(() => { useEffect(() => {
if (widget === 'TextInput') { if (widget === 'TextInput') {
let paths = ['【本人姓名】', '【本人部门】']
let value = presetValue let value = presetValue
if (preview === 'preview') { if (preview === 'preview') {
if (paths.includes(value)) { if (loaclPaths.includes(value)) {
if (value === '【本人姓名】') { if (value === '【本人姓名】') {
if (isStoreID) { if (isStoreID) {
value = userInfo.OID + '' value = userInfo.OID + ''
......
...@@ -138,7 +138,7 @@ const RelationForm = (props) => { ...@@ -138,7 +138,7 @@ const RelationForm = (props) => {
} }
const deleteTableInfo = (r) => { const deleteTableInfo = (r) => {
let listItem = { type: 'delete', accountTable: accountName, ID: r?.ID, values: getItem('delete', r) } let listItem = { type: 'delete', accountTable: accountName, ID: r?.ID, values: getItem(r) }
let relationForm = addons.getValue('relationForm') || { configs: [], data: [] } let relationForm = addons.getValue('relationForm') || { configs: [], data: [] }
if (r?.ID?.includes('前端ID')) { if (r?.ID?.includes('前端ID')) {
let list = relationForm.data.filter(v => v.ID !== r.ID) let list = relationForm.data.filter(v => v.ID !== r.ID)
...@@ -357,6 +357,18 @@ const RelationForm = (props) => { ...@@ -357,6 +357,18 @@ const RelationForm = (props) => {
setLoadingOther(false) setLoadingOther(false)
} }
const setDataSources = (array) => {
let i = 0
let timer = setInterval(() => {
if (i < array.length) {
setDataSource(dataSource => [...dataSource, array[i]])
i++
} else {
clearInterval(timer)
}
}, 100)
}
const rowsOk = () => { const rowsOk = () => {
if (!keys.length) { if (!keys.length) {
return message.info('请选择行数据!') return message.info('请选择行数据!')
...@@ -397,7 +409,8 @@ const RelationForm = (props) => { ...@@ -397,7 +409,8 @@ const RelationForm = (props) => {
array.push(obj) array.push(obj)
} }
}) })
setDataSource([...dataSource, ...array]) setDataSources(array)
// setDataSource([...dataSource, ...array])
setKeys([]) setKeys([])
let relationForm = addons.getValue('relationForm') || { configs: [], data: [] } let relationForm = addons.getValue('relationForm') || { configs: [], data: [] }
let listArray = relationForm.data.concat(items) let listArray = relationForm.data.concat(items)
......
...@@ -5,16 +5,17 @@ import styles from './index.less' ...@@ -5,16 +5,17 @@ import styles from './index.less'
const options = [ const options = [
{ label: '本人姓名', key: '【本人姓名】' }, { label: '本人姓名', key: '【本人姓名】' },
{ label: '本人电话', key: '【本人电话】' },
{ label: '本人部门', key: '【本人部门】' }, { label: '本人部门', key: '【本人部门】' },
] ]
const loaclPaths = ['【本人姓名】', '【本人电话】', '【本人部门】']
const InputDefault = (props) => { const InputDefault = (props) => {
const { value, onChange, addons, disabled } = props const { value, onChange, addons, disabled } = props
const style = useMemo(() => { const style = useMemo(() => {
let paths = ['【本人姓名】', '【本人部门】'] if (loaclPaths.includes(value)) {
if (paths.includes(value)) {
return { color: 'blue' } return { color: 'blue' }
} }
return null return null
......
...@@ -6,6 +6,12 @@ import { GetFieldValueFromTable } from '../../../../apis/process' ...@@ -6,6 +6,12 @@ import { GetFieldValueFromTable } from '../../../../apis/process'
import styles from './index.less' import styles from './index.less'
const iconList = Object.keys(icons).filter((item) => typeof icons[item] === 'object') const iconList = Object.keys(icons).filter((item) => typeof icons[item] === 'object')
const initUserInfo = {
fullName: '【本人姓名】',
Phone: '【本人电话】',
depart: { name: '【本人部门】' }
}
const loaclPaths = ['【本人姓名】', '【本人电话】', '【本人部门】']
const debounce = (fn) => { const debounce = (fn) => {
let t = null let t = null
...@@ -24,7 +30,7 @@ const debounce = (fn) => { ...@@ -24,7 +30,7 @@ const debounce = (fn) => {
const TextInput = (props) => { const TextInput = (props) => {
const preview = sessionStorage.getItem('FormRender') const preview = sessionStorage.getItem('FormRender')
const userInfo = preview === 'preview' ? { fullName: '【本人姓名】', depart: { name: '【本人部门】' } } : window?.globalConfig?.userInfo || { fullName: '【本人姓名】', depart: { name: '【本人部门】' } } const userInfo = preview === 'preview' ? initUserInfo : window?.globalConfig?.userInfo || initUserInfo
const { value, onChange, schema, addons } = props const { value, onChange, schema, addons } = props
const { title, disabled, placeholder, presetValue, addonBefore, addonAfter, maxLength, rules, uniqueVerify, tableName, fieldName, isStoreID, textDefalut } = schema const { title, disabled, placeholder, presetValue, addonBefore, addonAfter, maxLength, rules, uniqueVerify, tableName, fieldName, isStoreID, textDefalut } = schema
...@@ -47,10 +53,9 @@ const TextInput = (props) => { ...@@ -47,10 +53,9 @@ const TextInput = (props) => {
}, [textDefalut, value, isStoreID]) }, [textDefalut, value, isStoreID])
useEffect(() => { useEffect(() => {
let paths = ['【本人姓名】', '【本人部门】']
let value = presetValue let value = presetValue
if (preview !== 'preview') { if (preview !== 'preview') {
if (paths.includes(value)) { if (loaclPaths.includes(value)) {
if (value === '【本人姓名】') { if (value === '【本人姓名】') {
if (isStoreID) { if (isStoreID) {
value = userInfo.OID + '' value = userInfo.OID + ''
...@@ -63,6 +68,8 @@ const TextInput = (props) => { ...@@ -63,6 +68,8 @@ const TextInput = (props) => {
} else { } else {
value = userInfo.depart.name value = userInfo.depart.name
} }
} else if (value === '【本人电话】') {
value = userInfo.Phone
} }
} }
} }
...@@ -98,7 +105,7 @@ const TextInput = (props) => { ...@@ -98,7 +105,7 @@ const TextInput = (props) => {
return ( return (
<div className={styles.textInput} isdisabled={JSON.stringify(disabled)}> <div className={styles.textInput} isdisabled={JSON.stringify(disabled)}>
<Input <Input
style={{ color: ['【本人姓名】', '【本人部门】'].includes(value) ? 'blue' : '' }} style={{ color: loaclPaths.includes(presetValue) ? 'blue' : '' }}
disabled={disabled} disabled={disabled}
value={valueShow} value={valueShow}
maxLength={maxLength} maxLength={maxLength}
......
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