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
};
......@@ -3,38 +3,58 @@ import {
Dropdown,
Menu,
Button,
Tooltip,
Row,
Divider,
Drawer,
Table,
Col,
Steps,
Card,
message,
} from "antd";
import AutoTable from "@/components/AutoTable";
import { useRequest } from "umi";
import defaultFields from "./fields";
import { doFetch } from "@/utils/doFetch";
import Details from "@/components/Details";
import { gongyiDetail } from "@/utils/detailTotalCard";
import Coltext from "@/components/Coltext";
import DrawInitForm from "@/components/DrawInitForm";
import styles from "./index.less";
import {
PlusSquareOutlined,
MinusSquareOutlined,
MinusCircleOutlined,
ArrowDownOutlined,
ArrowUpOutlined,
} from "@ant-design/icons";
import getPrem from '@/utils/getPrem';//权限判断fn
const keytoval = {
"one": 1,
"two": 2,
"three": 3,
"four": 4
}, items = [
{
key: 'one',
label: (
<a>
采购入库
</a>
),
},
{
key: 'two',
label: (
<a>
生产入库
</a>
),
},
{
key: 'three',
label: (
<a>
退料入库
</a>
),
},
{
key: 'four',
label: (
<a>
其他入库
</a>
),
},
]
function Instore(props) {
console.log(defaultFields)
const [activeTabKey, onTabChange] = useState("1");
const [drawprops, setdrawprops] = useState({
let [drawprops, setdrawprops] = useState({
title: "",
visible: false,
onClose: () => {
......@@ -44,16 +64,44 @@ function Instore(props) {
}))
},
fields: {}
});
}),
actionRef = useRef(),
ChildRef = null;
//操作完成后刷新
function reload() {
actionRef.current.reload();
ChildRef?.onRefresh();
message.success("操作成功");
setdrawprops(s => ({
...s,
visible: false
}))
}
const columns = useMemo(() => {
if (activeTabKey == "1") {
return [
{
"title": "入库单号",
"dataIndex": "materieInstoreNo",
"key": "materieInstoreNo"
"key": "materieInstoreNo",
"render": (dom, record) => {
return <a
onClick={() => {
setdrawprops(s => ({
...s,
visible: true,
//查看详情 props
val: "detail",
title: `查看详情`,
...defaultFields?.detail,
totalPath: "/ngic-workmanship/wmsMaterieInstore/getInStoreInfoById",
totalParams: { id: record.id }
}))
}}
>{dom}</a>
}
},
{
"title": "入库类型",
......@@ -128,9 +176,9 @@ function Instore(props) {
{
"title": "状态",
"dataIndex": "statusName",
"key": "statusName",
"key": "status",
"valueType": "select",
"request": [
"options": [
{
"label": "待上架",
"value": "0"
......@@ -145,7 +193,7 @@ function Instore(props) {
"title": "操作",
"valueType": "option",
"width": 240,
"render": (text, row, _, action) => {
"render": (text, record, _, action) => {
return [
getPrem("equipmentCustomer_save", action, '上架采集', async () => {
......@@ -155,93 +203,175 @@ function Instore(props) {
getPrem("equipmentCustomer_deleteById", action, '关单', null, {
title: "确认关单?",
onConfirm: () => {
run({ url: "/ngic-auth/sysCustomer/deleteById", params: { id: record.id } })
doFetch({ url: "/ngic-workmanship/wmsMaterieInstore/close", params: { id: record.id } }).then(res => {
if (res.code == "0000") {
reload()
}
})
}
}),
getPrem("equipmentCustomer_deleteById", action, '删除', null, {
title: "确认删除?",
onConfirm: () => {
run({ url: "/ngic-auth/sysCustomer/deleteById", params: { id: record.id } })
doFetch({ url: "/ngic-workmanship/wmsMaterieInstore/deleteById", params: { id: record.id } }).then(res => {
if (res.code == "0000") {
reload()
}
})
}
})
];
}
}
]
}, [activeTabKey])
const tableprops = {
...props,
// addconfig: {
// premkey: "sysDepartment_save",
// btnprops: {},
// onClick: () => {
// setdrawprops(s => ({
// ...s,
// visible: true,
// title: "新增",
// width: 600
// }))
// },
// },
// exportconfig: {
// premkey: "sysDepartment_save",
// btnprops: {
// },
// onClick: () => {
// alert(1)
// },
// },
pageextra: activeTabKey == "1" ? <Dropdown placement="bottomRight" overlay={<Menu
onClick={(e) => {
console.log(e.key)
} else {
return [
{
"title": "入库单号",
"dataIndex": "materieInstoreNo",
"key": "materieInstoreNo",
"render": (dom, record) => {
return <a
onClick={() => {
setdrawprops(s => ({
...s,
visible: true,
title: "新增",
width: 800,
fields:defaultFields[e.key],
instoreType:e.key
//查看详情 props
val: "detail",
title: `查看详情`,
...defaultFields?.detail,
totalPath: "/ngic-workmanship/wmsMaterieInstoreHis/getInStoreInfoById",
totalParams: { id: record.id }
}))
}}
items={[
>{dom}</a>
}
},
{
key: 'one',
label: (
<a>
采购入库
</a>
),
"title": "入库类型",
"dataIndex": "instoreTypeName",
"key": "instoreType",
"valueType": "select",
"options": [
{
"label": "采购入库",
"value": "1"
},
{
key: 'two',
label: (
<a>
生产入库
</a>
),
"label": "生产入库",
"value": "2"
},
{
key: 'three',
label: (
<a>
退料入库
</a>
),
"label": "退料入库",
"value": "3"
},
{
key: 'four',
label: (
<a>
其他入库
</a>
),
"label": "其他入库",
"value": "4"
}
]
},
{
"title": "入库仓库",
"dataIndex": "storeName",
"key": "storeId",
options: {
database: () => doFetch({ url: "/ngic-auth/sysStore/selectionBox", params: { factoryIdList: [] } }),
params: {}
},
valueType: "select",
},
{
"title": "相关单号",
"dataIndex": "businessNo",
"key": "businessNo"
},
{
"title": "备注",
"dataIndex": "remark",
"key": "remark",
"search": false
},
{
"title": "创建人",
"dataIndex": "createUserName",
"key": "createUserName"
},
{
"title": "创建时间",
"dataIndex": "createTime",
"key": "createTime",
"search": false
},
{
"title": "创建时间开始时间",
"dataIndex": "createTimeStart",
"key": "createTimeStart",
"valueType": "date",
"hideInTable": true
},
{
"title": "创建时间结束时间",
"dataIndex": "createTimeEnd",
"key": "createTimeEnd",
"valueType": "date",
"hideInTable": true
},
{
"title": "关单时间",
"dataIndex": "closeTime",
"key": "closeTime",
"search": false
},
{
"title": "关单时间开始时间",
"dataIndex": "closeTimeStart",
"key": "closeTimeStart",
"valueType": "date",
"hideInTable": true
},
{
"title": "关单时间结束时间",
"dataIndex": "closeTimeEnd",
"key": "closeTimeEnd",
"valueType": "date",
"hideInTable": true
},
]}
{
"title": "状态",
"dataIndex": "statusName",
"key": "status",
"valueType": "select",
"options": [
{
"label": "已上架",
"value": "2"
},
{
"label": "已关单",
"value": "4"
}
]
}
]
}
}, [activeTabKey])
const tableprops = {
...props,
pageextra: activeTabKey == "1" ? <Dropdown placement="bottomRight" overlay={<Menu
onClick={(e) => {
setdrawprops(s => ({
...s,
visible: true,
title: "新增",
width: 800,
fields: defaultFields[e.key],
instoreType: keytoval[e.key],
val: "add" //类型
}))
}}
items={items}
/>}>
<Button type="primary">新增</Button>
</Dropdown> : "none",
......@@ -257,7 +387,7 @@ function Instore(props) {
activeTabKey,
onTabChange,
columns,
path: "/ngic-workmanship/wmsMaterieInstore/queryList"
path: activeTabKey == "1" ? "/ngic-workmanship/wmsMaterieInstore/queryList" : "/ngic-workmanship/wmsMaterieInstoreHis/queryList"
}
......@@ -267,17 +397,20 @@ function Instore(props) {
{
...tableprops
}
actionRef={actionRef}
onRef={(node) => (ChildRef = node)}
></AutoTable>
<DrawInitForm
{...drawprops}
submitData={async (value) => {
if (drawprops.val == "add") {
let res = await doFetch({ url: "/ngic-workmanship/wmsMaterieInstore/saveInStore", params: { ...value, instoreType: drawprops.instoreType } })
if (res.code == "0000") {
reload();
}
}
}}
/>
</div>
);
}
......
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