Browse Source

Merge branch 'master' of http://10.2.1.24:10244/bpa/BPA.KitChen.Web

tags/小炒逻辑变更前
txb 2 years ago
parent
commit
01fdba4fce
4 changed files with 63 additions and 11 deletions
  1. +0
    -4
      src/pages/device/deviceBom/index.jsx
  2. +25
    -6
      src/pages/device/deviceInfo/components/CreateForm.jsx
  3. +30
    -1
      src/pages/device/deviceInfo/index.jsx
  4. +8
    -0
      src/pages/device/deviceInfo/services.js

+ 0
- 4
src/pages/device/deviceBom/index.jsx View File

@@ -134,10 +134,6 @@ const TableList = () => {
type="primary" type="primary"
key="primary" key="primary"
onClick={() => { onClick={() => {
if (DeviceId == undefined) {
message.error('请选择门店或者设备');
return;
}
setStockModalVisible(true); setStockModalVisible(true);
}} }}
> >


+ 25
- 6
src/pages/device/deviceInfo/components/CreateForm.jsx View File

@@ -26,13 +26,13 @@ const CreateForm = (props) => {
<Input /> <Input />
</Form.Item> </Form.Item>


<Form.Item label={'设备名称'} name="deviceName" rules={[{ required: true,max:50 }]}>
<Form.Item label={'设备名称'} name="deviceName" rules={[{ required: true, max: 50 }]}>
<Input /> <Input />
</Form.Item> </Form.Item>


<Form.Item label={'设备类型'} name="deviceTypeKey" rules={[{ required: true }]}> <Form.Item label={'设备类型'} name="deviceTypeKey" rules={[{ required: true }]}>
<Select>
{ props.dicData.map((item, index) => {
<Select>
{props.dicData.map((item, index) => {
return ( return (
<Select.Option index={index} value={item.code} key={item.code}> <Select.Option index={index} value={item.code} key={item.code}>
{item.value} {item.value}
@@ -62,7 +62,26 @@ const CreateForm = (props) => {
})} })}
</Select> </Select>
</Form.Item> </Form.Item>

<Form.Item
noStyle
shouldUpdate={(prevValues, currentValues) => prevValues.deviceTypeKey !== currentValues.deviceTypeKey}
>
{({ getFieldValue }) =>
getFieldValue('deviceTypeKey') === 'TMC' ? (
<Form.Item name="deviceVersion" label="设备版本" initialValue="WorryFreeEdition">
<Select>
{props.deviceVersions?.map((item, index) => {
return (
<Select.Option index={index} value={item.code} key={item.code}>
{item.name}
</Select.Option>
);
})}
</Select>
</Form.Item>
) : null
}
</Form.Item>
<Form.Item label={'状态'} name="status" rules={[{ required: true }]}> <Form.Item label={'状态'} name="status" rules={[{ required: true }]}>
<Select placeholder="请选择状态"> <Select placeholder="请选择状态">
<OptGroup> <OptGroup>
@@ -72,10 +91,10 @@ const CreateForm = (props) => {
</Select> </Select>
</Form.Item> </Form.Item>
<Form.Item label={'设备坐标'} name="deviceLoc"> <Form.Item label={'设备坐标'} name="deviceLoc">
<Input placeholder="104.070734,30.575041" />
<Input placeholder="104.070734,30.575041" />
</Form.Item> </Form.Item>
<Form.Item label={'设备详细地址'} name="deviceAddr"> <Form.Item label={'设备详细地址'} name="deviceAddr">
<Input placeholder="成都市武侯区桂溪街道环球中心N5-9111C" />
<Input placeholder="成都市武侯区桂溪街道环球中心N5-9111C" />
</Form.Item> </Form.Item>
<Form.Item> <Form.Item>
<Button type="primary" htmlType="submit"> <Button type="primary" htmlType="submit">


+ 30
- 1
src/pages/device/deviceInfo/index.jsx View File

@@ -11,6 +11,7 @@ import {
UpdateDeviceInfo, UpdateDeviceInfo,
DelDeviceInfo, DelDeviceInfo,
GetDeviceType, GetDeviceType,
GetDeviceVersions,
} from './services'; } from './services';
import { gettree } from '../../sys/org/service'; import { gettree } from '../../sys/org/service';
const key = 'message'; const key = 'message';
@@ -85,6 +86,8 @@ const GoodsTypeManage = () => {
const [OrgListArray, setOrgListArray] = useState([]); const [OrgListArray, setOrgListArray] = useState([]);
const [dicDataAny, setDicDataAny] = useState([]); const [dicDataAny, setDicDataAny] = useState([]);
const [dicData, setDicData] = useState([]); const [dicData, setDicData] = useState([]);

const [deviceVersion, setDeviceVersion] = useState([]);
//初始化数据 //初始化数据
useEffect(() => { useEffect(() => {
const initStoreType = () => { const initStoreType = () => {
@@ -104,11 +107,26 @@ const GoodsTypeManage = () => {
}; };
function initOrgList() { function initOrgList() {
gettree().then((r) => { 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); setOrgList(r.data);
let list = {}; let list = {};
formateData(r.data); formateData(r.data);
function formateData(datas) { function formateData(datas) {
for (var i in datas) { for (var i in datas) {
list[datas[i]['disabled']]=true;
list[datas[i]['value']] = { text: datas[i]['title'] }; list[datas[i]['value']] = { text: datas[i]['title'] };
if (datas[i].children) { if (datas[i].children) {
formateData(datas[i].children); formateData(datas[i].children);
@@ -139,8 +157,18 @@ const GoodsTypeManage = () => {
}); });
} }
intDicData(); intDicData();
initDeviceVersion();
}, []); }, []);


const initDeviceVersion = async () => {
const response = await GetDeviceVersions();
if (response.statusCode == 200) {
setDeviceVersion(response.data);
} else {
message.error('获取设备版本失败');
}
}

/** 新建/更新窗口的弹窗 */ /** 新建/更新窗口的弹窗 */
const [createModalVisible, handleModalVisible] = useState(false); const [createModalVisible, handleModalVisible] = useState(false);
/** 分布更新窗口的弹窗 */ /** 分布更新窗口的弹窗 */
@@ -228,7 +256,7 @@ const GoodsTypeManage = () => {
更新 更新
</a>, </a>,
<a <a
key="primary"
key="primary2"
onClick={() => { onClick={() => {
record.status = record.status == 0 ? 1 : 0; record.status = record.status == 0 ? 1 : 0;
UpdateDeviceInfo(record).then((r) => { UpdateDeviceInfo(record).then((r) => {
@@ -341,6 +369,7 @@ const GoodsTypeManage = () => {
setCurrentRow(undefined); setCurrentRow(undefined);
}} }}
createModalVisible={createModalVisible} createModalVisible={createModalVisible}
deviceVersions={deviceVersion}
values={currentRow || {}} values={currentRow || {}}
/> />
</PageContainer> </PageContainer>


+ 8
- 0
src/pages/device/deviceInfo/services.js View File

@@ -41,3 +41,11 @@ export async function DelDeviceInfo(data) {
method: 'GET', method: 'GET',
}); });
} }

/** 获取所有设备版本 */
export async function GetDeviceVersions() {
return request(`​/kitchen/api/Device/GetDeviceVersions`, {
method: 'post',
});
}

Loading…
Cancel
Save