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

fix: 增加增加本人电话

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