|
@@ -19,11 +19,13 @@ import {
|
|
|
D3_APIsaveCreate,
|
|
|
D3_APIsaveDraft
|
|
|
} from '@/store/action/D3staff'
|
|
|
-import { D3StaffOversiderType, ID3StaffItem } from '../types'
|
|
|
-import { useSelector } from 'react-redux'
|
|
|
+import { D3StaffOversiderType, ID3StaffItem, SON_TYPE_NAME } from '../types'
|
|
|
+import { useDispatch, useSelector } from 'react-redux'
|
|
|
import { RootState } from '@/store'
|
|
|
import { OutsiderModal } from '../components/OutsiderModal'
|
|
|
import { D3STAFF_OUTSIDER_TABLE_COLUMNS } from '../constants'
|
|
|
+import { D2_APIgetList } from '@/store/action/D2storSet'
|
|
|
+import dayjs from 'dayjs'
|
|
|
|
|
|
export const pageTitTxtObj = {
|
|
|
1: '新增',
|
|
@@ -43,12 +45,25 @@ function C21edit() {
|
|
|
const storeList = useSelector((state: RootState) => state.D2storSet.tableInfo.list)
|
|
|
const [outsiderVisible, setOutsiderVisible] = useState(false)
|
|
|
const [oversiderList, setOversiderList] = useState<D3StaffOversiderType[]>([])
|
|
|
+ const { list: storageIdArr } = useSelector((state: RootState) => state.D2storSet.tableInfo)
|
|
|
+ const pageDisabled = ['3', '4'].includes(key)
|
|
|
+ const [checkedOversider, setCheckedOversider] = useState<null | D3StaffOversiderType>(null)
|
|
|
+
|
|
|
+ const dispatch = useDispatch()
|
|
|
+
|
|
|
+ useEffect(() => {
|
|
|
+ dispatch(D2_APIgetList({ pageNum: 1, pageSize: 99999 }))
|
|
|
+ }, [dispatch])
|
|
|
|
|
|
// 创建订单
|
|
|
const creatFu = useCallback(async () => {
|
|
|
const res = await D3_APIcreate()
|
|
|
if (res.code === 0) {
|
|
|
- setTopInfo(res.data)
|
|
|
+ setTopInfo({
|
|
|
+ ...res.data,
|
|
|
+ sonTypeName: SON_TYPE_NAME.OUT,
|
|
|
+ date: dayjs().format('YYYY-MM-DD')
|
|
|
+ })
|
|
|
}
|
|
|
}, [])
|
|
|
|
|
@@ -56,7 +71,9 @@ function C21edit() {
|
|
|
const getInfoFu = useCallback(async () => {
|
|
|
const res = await D3_APIgetInfo(id)
|
|
|
if (res.code === 0) {
|
|
|
- setTopInfo(res.data)
|
|
|
+ const { memberIds, ...rest } = res.data
|
|
|
+ setTopInfo(rest)
|
|
|
+ setOversiderList(JSON.parse(memberIds || '') || [])
|
|
|
}
|
|
|
}, [id])
|
|
|
|
|
@@ -127,7 +144,8 @@ function C21edit() {
|
|
|
|
|
|
const obj = {
|
|
|
...topInfo,
|
|
|
- rtf: JSON.stringify(rtf1.val || '')
|
|
|
+ rtf: JSON.stringify(rtf1.val || ''),
|
|
|
+ memberIds: JSON.stringify(oversiderList)
|
|
|
}
|
|
|
// console.log(123, obj)
|
|
|
|
|
@@ -149,7 +167,7 @@ function C21edit() {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- [auditSta, checkDataFu, topInfo]
|
|
|
+ [auditSta, checkDataFu, oversiderList, topInfo]
|
|
|
)
|
|
|
|
|
|
// 查看的按钮创建-提交-撤回
|
|
@@ -179,7 +197,7 @@ function C21edit() {
|
|
|
const res = await D3_APIdel(id)
|
|
|
if (res.code === 0) {
|
|
|
MessageFu.success('删除成功')
|
|
|
- history.push('/wealth')
|
|
|
+ history.push('/staff')
|
|
|
}
|
|
|
}, [id])
|
|
|
|
|
@@ -238,7 +256,7 @@ function C21edit() {
|
|
|
/>
|
|
|
) : null}
|
|
|
|
|
|
- <Button onClick={() => history.push('/wealth')}>返回</Button>
|
|
|
+ <Button onClick={() => history.push('/staff')}>返回</Button>
|
|
|
</>
|
|
|
)
|
|
|
}, [delFu, lookBtnFu, lookJumpFu, topInfo])
|
|
@@ -295,8 +313,12 @@ function C21edit() {
|
|
|
</div>
|
|
|
<div className='D4rowrr'>
|
|
|
<DatePicker
|
|
|
- showTime
|
|
|
- onChange={(e, dateString) => setTopInfo({ ...topInfo, date: dateString as string })}
|
|
|
+ disabled={pageDisabled}
|
|
|
+ defaultValue={dayjs(topInfo.date)}
|
|
|
+ style={{ width: '300px' }}
|
|
|
+ onChange={e => {
|
|
|
+ setTopInfo({ ...topInfo, date: e.format('YYYY-MM-DD') })
|
|
|
+ }}
|
|
|
/>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -309,7 +331,7 @@ function C21edit() {
|
|
|
<Input
|
|
|
value={topInfo.reason}
|
|
|
onChange={e => setTopInfo({ ...topInfo, reason: e.target.value })}
|
|
|
- readOnly={['3', '4'].includes(key)}
|
|
|
+ readOnly={pageDisabled}
|
|
|
placeholder='请输入内容'
|
|
|
maxLength={200}
|
|
|
showCount
|
|
@@ -329,10 +351,21 @@ function C21edit() {
|
|
|
<div className='D4rowll'>库别名称:</div>
|
|
|
<div className='D4rowrr'>
|
|
|
<Select
|
|
|
- placeholder='请选择'
|
|
|
- options={storeList}
|
|
|
- fieldNames={{ label: 'name', value: 'id' }}
|
|
|
- onChange={e => setTopInfo({ ...topInfo, storageId: e })}
|
|
|
+ disabled={pageDisabled}
|
|
|
+ placeholder='请搜索选择'
|
|
|
+ showSearch
|
|
|
+ filterOption={(input, option) => {
|
|
|
+ const txt = option!.label
|
|
|
+
|
|
|
+ return txt.toLowerCase().includes(input.toLowerCase())
|
|
|
+ }}
|
|
|
+ options={storageIdArr.map(v => ({ label: v.num + ' - ' + v.name, value: v.id }))}
|
|
|
+ // fieldNames={{ label: 'num', value: 'num' }}
|
|
|
+ allowClear={false}
|
|
|
+ value={topInfo.storageId || null}
|
|
|
+ onChange={e => {
|
|
|
+ setTopInfo({ ...topInfo, storageId: e ? e : null })
|
|
|
+ }}
|
|
|
/>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -352,42 +385,87 @@ function C21edit() {
|
|
|
type='card'
|
|
|
items={[
|
|
|
{
|
|
|
- key: '0',
|
|
|
+ key: SON_TYPE_NAME.OUT,
|
|
|
label: '外部人员',
|
|
|
+ disabled: pageDisabled,
|
|
|
children: (
|
|
|
<>
|
|
|
<div className={styles.tabRow}>
|
|
|
<Input
|
|
|
+ readOnly={pageDisabled}
|
|
|
+ value={topInfo.authUser}
|
|
|
addonBefore='陪同人员'
|
|
|
placeholder='请填入姓名,以逗号分隔'
|
|
|
style={{ width: 500 }}
|
|
|
allowClear
|
|
|
+ onChange={e => setTopInfo({ ...topInfo, authUser: e.target.value })}
|
|
|
/>
|
|
|
|
|
|
- <Button type='primary' onClick={() => setOutsiderVisible(true)}>
|
|
|
- 新增
|
|
|
- </Button>
|
|
|
+ {!pageDisabled && (
|
|
|
+ <Button type='primary' onClick={() => setOutsiderVisible(true)}>
|
|
|
+ 新增
|
|
|
+ </Button>
|
|
|
+ )}
|
|
|
</div>
|
|
|
<MyTable
|
|
|
+ readOnly={pageDisabled}
|
|
|
rowKey='name'
|
|
|
yHeight={200}
|
|
|
list={oversiderList}
|
|
|
+ pagination={false}
|
|
|
columnsTemp={D3STAFF_OUTSIDER_TABLE_COLUMNS}
|
|
|
+ lastBtn={
|
|
|
+ pageDisabled
|
|
|
+ ? undefined
|
|
|
+ : [
|
|
|
+ {
|
|
|
+ title: '操作',
|
|
|
+ render(item: D3StaffOversiderType, _: any, index: number) {
|
|
|
+ return (
|
|
|
+ <>
|
|
|
+ <Button
|
|
|
+ size='small'
|
|
|
+ type='text'
|
|
|
+ onClick={() => {
|
|
|
+ setCheckedOversider(item)
|
|
|
+ setOutsiderVisible(true)
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 编辑
|
|
|
+ </Button>
|
|
|
+ <MyPopconfirm
|
|
|
+ txtK='删除'
|
|
|
+ onConfirm={() => {
|
|
|
+ const temp = [...oversiderList]
|
|
|
+ temp.splice(index, 1)
|
|
|
+ setOversiderList(temp)
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ </>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
/>
|
|
|
</>
|
|
|
)
|
|
|
},
|
|
|
{
|
|
|
- key: '1',
|
|
|
+ key: SON_TYPE_NAME.IN,
|
|
|
label: '内部人员',
|
|
|
+ disabled: pageDisabled,
|
|
|
children: (
|
|
|
<>
|
|
|
<div className={styles.tabRow}>
|
|
|
<Input
|
|
|
- addonBefore='进库人员 '
|
|
|
+ readOnly={pageDisabled}
|
|
|
+ value={topInfo.authUser}
|
|
|
+ addonBefore='进库人员'
|
|
|
placeholder='请填入姓名,以逗号分隔'
|
|
|
style={{ width: 500 }}
|
|
|
allowClear
|
|
|
+ onChange={e => setTopInfo({ ...topInfo, authUser: e.target.value })}
|
|
|
/>
|
|
|
</div>
|
|
|
</>
|
|
@@ -405,7 +483,7 @@ function C21edit() {
|
|
|
|
|
|
{/* 底部按钮 */}
|
|
|
<div className='D4btn'>
|
|
|
- {['3', '4'].includes(key) && topInfo.audits && topInfo.audits.length ? (
|
|
|
+ {pageDisabled && topInfo.audits && topInfo.audits.length ? (
|
|
|
<Button type='primary' onClick={() => setAuditsShow(true)}>
|
|
|
申请记录
|
|
|
</Button>
|
|
@@ -431,13 +509,14 @@ function C21edit() {
|
|
|
</Button>
|
|
|
) : null}
|
|
|
|
|
|
- <MyPopconfirm txtK='取消' onConfirm={() => history.push('/wealth')} />
|
|
|
+ <MyPopconfirm txtK='取消' onConfirm={() => history.push('/staff')} />
|
|
|
</>
|
|
|
)}
|
|
|
</div>
|
|
|
|
|
|
{/* 添加外部人员 */}
|
|
|
<OutsiderModal
|
|
|
+ item={checkedOversider}
|
|
|
visible={outsiderVisible}
|
|
|
setVisible={setOutsiderVisible}
|
|
|
onOk={item => setOversiderList([...oversiderList, item])}
|