|
|
@@ -1,12 +1,12 @@ |
|
|
|
import { PlusOutlined } from '@ant-design/icons'; |
|
|
|
import { Modal,Button, message, Input, Drawer } from 'antd'; |
|
|
|
import React, { useState, useRef,useEffect } from 'react'; |
|
|
|
import { Modal, Button, message, Input, Drawer, Form } from 'antd'; |
|
|
|
import React, { useState, useRef, useEffect } from 'react'; |
|
|
|
import { PageContainer, FooterToolbar } from '@ant-design/pro-layout'; |
|
|
|
import ProTable from '@ant-design/pro-table'; |
|
|
|
import QRCode from 'qrcode.react'; |
|
|
|
import ProDescriptions from '@ant-design/pro-descriptions'; |
|
|
|
import CreateForm from './components/CreateForm'; |
|
|
|
import { Getstorestaffpage, Addstorestaff, Updatestorestaff, Delstorestaff, } from "./services" |
|
|
|
import { Getstorestaffpage, Addstorestaff, Updatestorestaff, Delstorestaff, UpdatestorestaffPwd, } from "./services" |
|
|
|
import { gettree } from '../../sys/org/service'; |
|
|
|
const key = 'message'; |
|
|
|
|
|
|
@@ -79,6 +79,7 @@ const handleRemove = async (selectedRows) => { |
|
|
|
const GoodsTypeManage = () => { |
|
|
|
/** 新建/更新窗口的弹窗 */ |
|
|
|
const [createModalVisible, handleModalVisible] = useState(false); |
|
|
|
const [pwdModal, setpwdModal] = useState(false); |
|
|
|
/** 分布更新窗口的弹窗 */ |
|
|
|
|
|
|
|
const [showDetail, setShowDetail] = useState(false); |
|
|
@@ -89,42 +90,42 @@ const GoodsTypeManage = () => { |
|
|
|
const [OrgListArray, setOrgListArray] = useState([]); |
|
|
|
/** 国际化配置 */ |
|
|
|
|
|
|
|
//初始化数据 |
|
|
|
useEffect(() => { |
|
|
|
|
|
|
|
function initOrgList() { |
|
|
|
gettree().then((r) => { |
|
|
|
inittree(r.data); |
|
|
|
function inittree(datas) { |
|
|
|
for (var i in datas) { |
|
|
|
if( datas[i]['type']==2|| datas[i]['type']==3){ |
|
|
|
datas[i]['disabled']=false; |
|
|
|
}else{ |
|
|
|
datas[i]['disabled']=true; |
|
|
|
} |
|
|
|
|
|
|
|
if (datas[i].children) { |
|
|
|
inittree(datas[i].children); |
|
|
|
} |
|
|
|
//初始化数据 |
|
|
|
useEffect(() => { |
|
|
|
|
|
|
|
function initOrgList() { |
|
|
|
gettree().then((r) => { |
|
|
|
inittree(r.data); |
|
|
|
function inittree(datas) { |
|
|
|
for (var i in datas) { |
|
|
|
if (datas[i]['type'] == 2 || datas[i]['type'] == 3) { |
|
|
|
datas[i]['disabled'] = false; |
|
|
|
} else { |
|
|
|
datas[i]['disabled'] = true; |
|
|
|
} |
|
|
|
|
|
|
|
if (datas[i].children) { |
|
|
|
inittree(datas[i].children); |
|
|
|
} |
|
|
|
} |
|
|
|
setOrgList(r.data); |
|
|
|
let list = {}; |
|
|
|
formateData(r.data); |
|
|
|
function formateData(datas) { |
|
|
|
for (var i in datas) { |
|
|
|
list[datas[i]['disabled']]=true; |
|
|
|
list[datas[i]['value']] = { text: datas[i]['title'] }; |
|
|
|
if (datas[i].children) { |
|
|
|
formateData(datas[i].children); |
|
|
|
} |
|
|
|
} |
|
|
|
setOrgList(r.data); |
|
|
|
let list = {}; |
|
|
|
formateData(r.data); |
|
|
|
function formateData(datas) { |
|
|
|
for (var i in datas) { |
|
|
|
list[datas[i]['disabled']] = true; |
|
|
|
list[datas[i]['value']] = { text: datas[i]['title'] }; |
|
|
|
if (datas[i].children) { |
|
|
|
formateData(datas[i].children); |
|
|
|
} |
|
|
|
} |
|
|
|
setOrgListArray(list); |
|
|
|
}); |
|
|
|
} |
|
|
|
initOrgList(); |
|
|
|
}, []); |
|
|
|
} |
|
|
|
setOrgListArray(list); |
|
|
|
}); |
|
|
|
} |
|
|
|
initOrgList(); |
|
|
|
}, []); |
|
|
|
|
|
|
|
const columns = [ |
|
|
|
{ |
|
|
@@ -186,7 +187,14 @@ const GoodsTypeManage = () => { |
|
|
|
onClick={() => { |
|
|
|
handleModalVisible(true); |
|
|
|
setCurrentRow(record); |
|
|
|
}} > 更新</a> |
|
|
|
}} > 更新</a>, |
|
|
|
<a |
|
|
|
key="config" |
|
|
|
onClick={() => { |
|
|
|
setpwdModal(true); |
|
|
|
record.pwd=""; |
|
|
|
setCurrentRow(record); |
|
|
|
}} > 修改密码</a> |
|
|
|
], |
|
|
|
}, |
|
|
|
]; |
|
|
@@ -262,8 +270,8 @@ const GoodsTypeManage = () => { |
|
|
|
</FooterToolbar> |
|
|
|
)} |
|
|
|
|
|
|
|
|
|
|
|
<CreateForm |
|
|
|
|
|
|
|
<CreateForm |
|
|
|
onFinish={async (value) => { |
|
|
|
var success = false; |
|
|
|
if (value.id) { |
|
|
@@ -285,6 +293,37 @@ const GoodsTypeManage = () => { |
|
|
|
OrgData={OrgList} |
|
|
|
values={currentRow || {}} |
|
|
|
/> |
|
|
|
|
|
|
|
<Modal title="修改密码" open={pwdModal} footer={null} |
|
|
|
onCancel={() => { |
|
|
|
setpwdModal(false); |
|
|
|
}}> |
|
|
|
<Form |
|
|
|
preserve={false} |
|
|
|
onFinish={async ()=>{ |
|
|
|
await UpdatestorestaffPwd(JSON.stringify(currentRow)).then((r) => { |
|
|
|
if (r.data) { |
|
|
|
message.success('修改成功',); |
|
|
|
setpwdModal(false); |
|
|
|
} else { |
|
|
|
message.error('修改失败'); |
|
|
|
} |
|
|
|
}); |
|
|
|
}} |
|
|
|
initialValues={currentRow}> |
|
|
|
<Form.Item name="id" hidden={true}> |
|
|
|
<Input /> |
|
|
|
</Form.Item> |
|
|
|
<Form.Item label={"密码"} name="pwd" rules={[{ required: true }]} > |
|
|
|
<Input /> |
|
|
|
</Form.Item> |
|
|
|
<Form.Item> |
|
|
|
<Button type="primary" htmlType="submit"> |
|
|
|
保存 |
|
|
|
</Button> |
|
|
|
</Form.Item> |
|
|
|
</Form> |
|
|
|
</Modal> |
|
|
|
</PageContainer> |
|
|
|
); |
|
|
|
}; |
|
|
|