Commit 5722a4a5 authored by wuhao's avatar wuhao 🎯

kiu

parent a5dffbe5
......@@ -11,7 +11,7 @@ export default {
// localhost:8000/api/** -> https://preview.pro.ant.design/api/**
"/wms/": {
// 要代理的地址
target: "http://192.168.40.215:18040/", //39:18040 23/wms/ //60 翔 //18
target: "http://192.168.40.114:18040/", //39:18040 23/wms/ //60 翔 //18
changeOrigin: true,
pathRewrite: {
"^/wms": "",
......
......@@ -84,7 +84,6 @@ export default (props) => {
return <div style={{ height: 32, width: 64 }}></div>
} else {
let strarr = props.pageextra ? props.pageextra.split(",") : ["add"];
console.log(strarr);
return strarr.map((it, i) => {
return <div style={{ marginRight: i == strarr.length - 1 ? 0 : 6 }}>
{actionbtn[it]}
......@@ -95,22 +94,22 @@ export default (props) => {
// screens.xs ? (
// <div
// style={{ display: "flex", flexDirection: "column", height: "100%" }}
// >
// {props.children && (
// <div style={{ marginBottom: 12 }}>{props.children}</div>
// )}
// <div>
// <Mcard {...props} pageextra={renderextra()}/>
// </div>
// </div>
// ) :
return (
<div className="diycard">
{screens.xs ? (
<div
style={{ display: "flex", flexDirection: "column", height: "100%" }}
>
{props.children && (
<div style={{ marginBottom: 12 }}>{props.children}</div>
)}
<div>
<Mcard {...props} />
</div>
</div>
) : props.withCard === false ? (
{props.withCard === false ? (
<div style={{ display: "flex", width: "100%" }}>
{(props.childposition == "left" || !props.childposition) &&
props.children}
......
......@@ -214,6 +214,7 @@ class Mcard extends PureComponent {
tabList,
} = this.props;
return (
<div style={{ height: "100%" }}>
<div className="fixedsearch">
......@@ -229,10 +230,15 @@ class Mcard extends PureComponent {
<SearchOutlined style={{ color: "#fff" }} />
</div>
)}
{pageextra &&
{
pageextra ?
Array.isArray(pageextra) ?
pageextra.map((it) => {
return <div>{it}</div>;
})}
}) :
pageextra
: null
}
</div>
<Drawer
......@@ -247,7 +253,7 @@ class Mcard extends PureComponent {
>
<InitForm
fields={fields}
onChange={() => {}}
onChange={() => { }}
reset={true}
submitData={(values) => {
this.onRefresh(this.props, values);
......
......@@ -29,7 +29,8 @@ class Mtable extends PureComponent {
JSON.stringify(nextprops.extraparams) ||
JSON.stringify(this.props.path) != JSON.stringify(nextprops.path) ||
JSON.stringify(this.props.refreshDep) !=
JSON.stringify(nextprops.refreshDep)
JSON.stringify(nextprops.refreshDep) ||
this.props.columns != nextprops.columns
) {
if (nextprops.actionRef) {
nextprops.actionRef?.current?.reload();
......
import React, { useState, useEffect, memo } from "react";
import {
Table,
Divider,
Card,
Descriptions,
Typography,
Spin,
Row,
Col,
Tooltip,
Rate,
Image,
} from "antd";
import { doFetch, postFetch } from "@/utils/doFetch";
import AutoTable from "@/components/Tableform";
import styles from "./index.less";
const Details = (props) => {
/**
* dataSource: 整个页面的数据,Object
* totalPath: 整个详情页的接口,String
* totalParams: 整个详情页接口的参数
* totalCard: 整个页面的模块,Array
* col: 列数
*
* totalCard中的每一项变量:cardTitle每一个模块的标题;itemData每一个模块的数据信息(Array)
* itemData中的每一项变量:key所对应的字段;title每一项label标题;type每一项的类型(file,img,textarea,table,不填默认就是普通的展示类型);col每一项的占比;columns表格类型所用;path当类型为表格时,若该表格是单独查询出来的可以填入path;urlName 当传入文件为url为字符串时
*
*/
const {
totalPath = "",
dataSource,
totalCard,
totalParams,
col,
bottomNode,
topNode,
} = props;
const [pageData, cp] = useState({});
useEffect(() => {
if (dataSource) {
cp(dataSource);
} else if (!dataSource && !Array.isArray(totalPath)) {
doFetch({
url: totalPath,
params: totalParams ? { ...totalParams } : {},
}).then((res) => {
if (res.code == "0000") {
if (!res.data) {
return;
}
cp(res?.data?.data);
}
});
}
}, []);
const getCol = (itemcol) => {
if (itemcol) {
return itemcol;
} else {
return col ? col : { xs: 24, sm: 24, md: 12, lg: 8, xl: 8, xxl: 6 };
}
};
//获取每一项
const getItem = (itemData) => {
const {
type,
key,
title,
columns,
path,
urlName,
col,
rowKey,
expandable,
} = itemData,
value = pageData[key];
if (!type || type == "input") {
return value == 0 || value ? (
<Tooltip title={`${title}:${value}`}>
<pre className={col ? "" : styles.one}>{value}</pre>
</Tooltip>
) : (
<div>-</div>
);
} else if (type == "file") {
return (
<div style={{ display: "flex", flexFlow: "row wrap", width: "100%" }}>
{value && typeof value == "string" ? (
<a
href={value}
download={value}
style={{ margin: "0 10px 0 0", display: "block" }}
>
{urlName ? urlName : "下载"}
</a>
) : value && Array.isArray(value) && value?.length ? (
value?.map((el) => {
return (
<a
key={el.url}
href={el.url}
download={el.name}
style={{ margin: "0 10px 0 0", display: "block" }}
>
{el.name}
</a>
);
})
) : (
"-"
)}
</div>
);
} else if (type == "img") {
return (
<div style={{ display: "flex", flexFlow: "row wrap" }}>
{value && value?.length
? value?.map((el) => {
return (
<Image
style={{ margin: "0 10px 0 0" }}
src={el?.url}
width={30}
height={30}
key={el?.uid}
></Image>
);
})
: "-"}
</div>
);
} else if (type == "table") {
return (
<AutoTable
columns={columns || []}
path={path ? path : null}
bordered={false}
dataSource={path ? null : value}
rowKey={rowKey ?? "id"}
expandable={expandable ?? null}
></AutoTable>
);
} else if (type == "rate") {
return (
<Rate
bordered={false}
className={"simple"}
style={{ width: "100%" }}
disabled={itemData.disabled}
allowHalf={itemData.allowHalf ? itemData.allowHalf : false}
value={value || 0}
/>
);
}
};
return (
<div className={`${styles.bodyBox} detailCards`}>
<Spin spinning={false}>
{topNode && <div>{topNode}</div>}
{totalCard?.map((item, i) => {
return (
<Card
key={i}
title={item.cardTitle}
bordered={false}
style={{ marginBottom: 16 }}
bodyStyle={{ padding: "16px 10px" }}
>
<Row gutter={[12, 12]}>
{item?.itemData?.map((it, j) => {
return (
<Col key={j} {...getCol(it.col)}>
<div style={{ width: "100%", display: "flex" }}>
<div
style={{
flexShrink: 0,
display: `${it.title ? "block" : "none"}`,
textAlign: "right",
width: 126,
}}
>
{it.title}
</div>
{getItem(it)}
</div>
</Col>
);
})}
</Row>
</Card>
);
})}
{bottomNode && <div>{bottomNode}</div>}
</Spin>
</div>
);
};
export default memo(Details);
import InitForm from "../InitForm";
import { Drawer } from "antd";
import React, { useState, memo } from "react";
import Details from "../Details/detail";
// title="Basic Drawer"
// placement="right"
// closable={false}
......@@ -10,20 +10,36 @@ import React, { useState, memo } from "react";
// getContainer={false}
// style={{ position: 'absolute' }}
// drawer props + initform props + detial props
function DrawInitForm(props) {
let newProps = { ...props };
delete newProps.children;
const detailprops = {
totalPath: props.totalPath,
dataSource: props.detaildataSource,
totalCard: props.totalCard,
totalParams: props.totalParams,
col: props.col,
bottomNode: props.bottomNode,
topNode: props.topNode,
}
return (
<Drawer
maskClosable={false}
placement="right"
closable={true}
getContainer={false}
style={{ position: "absolute",transform:"translateX(0)" }}
style={{ position: "absolute", transform: "translateX(0)" }}
width={props.val == "detail" ? 1000 : props.width}
destroyOnClose={true}
{...props}
>
{props.children}
<InitForm {...newProps}></InitForm>
{props.val == "detail" ? <Details {...detailprops}></Details> : <InitForm {...newProps}></InitForm>}
</Drawer>
);
}
......
import React, { useEffect } from "react";
import React, { useEffect, useRef } from "react";
import { EditableProTable } from "@ant-design/pro-table";
import ProField from "@ant-design/pro-field";
import ProCard from "@ant-design/pro-card";
......@@ -11,7 +11,9 @@ const EditTable = ({
rowKey,
recordCreatorProps,
maxLength,
linkconfig
}) => {
const editorFormRef = useRef()
return (
<EditableProTable
columns={columns}
......@@ -28,14 +30,85 @@ const EditTable = ({
}),
}
}
editableFormRef={editorFormRef}
editable={{
type: "multiple",
editableKeys: value ? value.map((item) => item[rowKey]) : [],
actionRender: (row, config, defaultDoms) => {
return [defaultDoms.delete];
},
onValuesChange: (record, recordList) => {
onChange(recordList);
onValuesChange: async (record, recordList) => {
let { urlchangeval } = linkconfig ?? {};
let newvalue = [...recordList];
if (urlchangeval && record) {//根据url 改变 数据值
let { params, database, effectresult } = urlchangeval ?? {},
curvaluerow = value && value.length > 0 ? value.filter(it => it[rowKey] == record[rowKey])[0] : {}
//获取除本行之外已修改的value值
newvalue = newvalue.map((it, i) => {
if (!record) return it;
if (it[rowKey] == record[rowKey]) {
let freshvals = {}
Object.keys(effectresult).map(its => {
freshvals[its] = value[i][its]
})
it = {
...record,
...freshvals
}
} else {
it = value && value.length > 0 ? value.filter(its => its[rowKey] == it[rowKey])[0] : {}
}
return it
});
//参数获取
let parames = {};
let ifs = false;
Object.keys(params).map(it => {
if (params[it] == "linked") {
parames[it] = record[it]
if (record[it] == curvaluerow[it]) {
ifs = true;
}
} else {
parames[it] = params[it]
}
})
if (ifs) {
//值未变化
} else {
let res = await database(parames);
console.log(newvalue);
newvalue = newvalue.map((it, i) => {
if (it[rowKey] == record[rowKey]) {
Object.keys(effectresult).map(items => {
it[items] = res?.data?.data[effectresult[items]];
})
}
editorFormRef.current?.setRowData?.(i, it)
return it
})
};
}
onChange(newvalue);
},
}}
maxLength={maxLength ?? 1000}
......
......@@ -557,6 +557,9 @@ let InitForm = ({
// formartSubmit(values);
}}
onValuesChange={(changedValues, values) => {
console.log('====================================')
console.log(changedValues)
console.log('====================================')
let newvalue = {};
let linkkey = Object.keys(changedValues)[0];
//联动逻辑
......@@ -1187,6 +1190,7 @@ let InitForm = ({
recordCreatorProps={item.recordCreatorProps}
value={item.value}
maxLength={item.maxLength}
linkconfig={item.linkconfig}
></EditTable>
</Form.Item>
</Col>
......
......@@ -273,7 +273,7 @@ const Materiel = (props) => {
dataIndex: "option_dataindex",
key: "option_dataindex",
valueType: "option",
width: 275,
width: 160,
render: (text, row, _, action) => extraAction(text, row, _, action),
},
];
......
import { factorySelect, shopSelectByFactory } from "@/services/system";
import { doFetch } from "@/utils/doFetch";
import regValue from "@/utils/regValue";
import { Table } from "antd";
const one = {
......@@ -35,7 +35,7 @@ const one = {
],
"required": true,
"options": {
database: () => doFetch({ url: "/ngic-auth/sysSupplier/query/selection", params: { } }),
database: () => doFetch({ url: "/ngic-auth/sysSupplier/query/selection", params: {} }),
params: {}
},
},
......@@ -67,22 +67,37 @@ const one = {
col: { span: 24 },
name: ["materialList"],
required: true,
linkconfig: {
urlchangeval: {//根据url接口 改变某个value
database: (params) => doFetch({ url: "/ngic-workmanship/pmMaterie/queryUnitByMaterieId", params }),
params: { "materieId": "linked" },
effectresult: {
"productionUnit": "productionUnit",//key 为列表更新值 value为response 返回值
"productionUnitName": "productionUnitName"
}
}
},
columns: [
{
"title": "物料编码-名称",
"title": <span>物料编码-名称 <b style={{ color: "red" }}>*</b></span>,
"dataIndex": "materieId",
"key": "materieId",
"valueType":"select",
"width":300,
"request":async ()=>{
let res = await doFetch({url:"/ngic-workmanship/pmMaterie/query/selectbox",params:{}})
console.log(res);
"valueType": "select",
"width": 300,
"request": async () => {
let res = await doFetch({ url: "/ngic-workmanship/pmMaterie/query/selectbox", params: {} })
return res?.data?.dataList
},
"fieldProps":{
allowClear:true,
showSearch:true
}
"fieldProps": {
allowClear: false,
showSearch: true
},
"formItemProps": () => {
return {
rules: [{ required: true, message: '此项为必填项' }],
};
},
},
{
"title": "批次号/SN号",
......@@ -90,14 +105,21 @@ const one = {
"key": "materieControlNo"
},
{
"title": "入库数量",
"title": <span>入库数量 <b style={{ color: "red" }}>*</b></span>,
"dataIndex": "instroeNum",
"key": "instroeNum"
"key": "instroeNum",
"formItemProps": () => {
return {
rules: [{ required: true, message: '此项为必填项' }],
};
},
},
{
"title": "单位",
"dataIndex": "productionUnit",
"key": "productionUnit"
"dataIndex": "productionUnitName",
"key": "productionUnitName",
"readonly": 'productionUnitName',
"width": 60
},
{
title: "操作",
......@@ -113,7 +135,7 @@ const one = {
rowKey: "id",
}
},
two = {
two = {
"materieInstoreNo": {
"value": null,
"type": "input",
......@@ -216,9 +238,104 @@ two = {
],
rowKey: "id",
}
},
three = {},
four = {}
},
three = {},
four = {},
detail = {
totalCard: [
//物料详情
{
cardTitle: "基本信息",
itemData: [
{
title: "入库单号",
key: "materieInstoreNo",
},
{
title: "入库类型",
key: "instoreTypeName",
},
{
title: "入库仓库",
key: "storeName",
},
{
title: "相关单号",
key: "businessNo",
},
{
title: "备注",
key: "remark",
},
{
title: "创建人",
key: "createUserName",
},
{
title: "创建时间",
key: "createTime",
},
],
},
{
cardTitle: "物料信息列表",
itemData: [
{
key: "materialList",
type: "table",
col: { span: 24 },
columns: [
{
title: "物料名称",
dataIndex: "materieName",
key: "materieName",
search: false,
},
{
title: "物料编码",
dataIndex: "materieCode",
key: "materieCode",
search: false,
},
{
title: "入库数量",
dataIndex: "instroeNum",
key: "instroeNum",
search: false,
},
{
title: "单位",
dataIndex: "productionUnitName",
key: "productionUnitName",
search: false,
},
],
expandable: {
expandedRowRender: record => <Table
style={{marginLeft:48}}
columns={[
{
title: "库位名称",
dataIndex: "storeName",
key: "storeName",
search: false,
},
{
title: "上架数量",
dataIndex: "instroeNum",
key: "instroeNum",
search: false,
}
]}
dataSource={record.uploadList}
pagination={false}
/>,
}
},
],
},
]
};
......@@ -227,5 +344,6 @@ export default {
one,
two,
three,
four
four,
detail
};
This diff is collapsed.
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