Commit 5722a4a5 authored by wuhao's avatar wuhao 🎯

kiu

parent a5dffbe5
...@@ -11,7 +11,7 @@ export default { ...@@ -11,7 +11,7 @@ export default {
// localhost:8000/api/** -> https://preview.pro.ant.design/api/** // localhost:8000/api/** -> https://preview.pro.ant.design/api/**
"/wms/": { "/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, changeOrigin: true,
pathRewrite: { pathRewrite: {
"^/wms": "", "^/wms": "",
......
...@@ -84,7 +84,6 @@ export default (props) => { ...@@ -84,7 +84,6 @@ export default (props) => {
return <div style={{ height: 32, width: 64 }}></div> return <div style={{ height: 32, width: 64 }}></div>
} else { } else {
let strarr = props.pageextra ? props.pageextra.split(",") : ["add"]; let strarr = props.pageextra ? props.pageextra.split(",") : ["add"];
console.log(strarr);
return strarr.map((it, i) => { return strarr.map((it, i) => {
return <div style={{ marginRight: i == strarr.length - 1 ? 0 : 6 }}> return <div style={{ marginRight: i == strarr.length - 1 ? 0 : 6 }}>
{actionbtn[it]} {actionbtn[it]}
...@@ -95,22 +94,22 @@ export default (props) => { ...@@ -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 ( return (
<div className="diycard"> <div className="diycard">
{screens.xs ? ( {props.withCard === false ? (
<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 ? (
<div style={{ display: "flex", width: "100%" }}> <div style={{ display: "flex", width: "100%" }}>
{(props.childposition == "left" || !props.childposition) && {(props.childposition == "left" || !props.childposition) &&
props.children} props.children}
......
...@@ -124,7 +124,7 @@ class Mcard extends PureComponent { ...@@ -124,7 +124,7 @@ class Mcard extends PureComponent {
if ( if (
this.props.path != np.path || this.props.path != np.path ||
JSON.stringify(this.props.extraparams) != JSON.stringify(this.props.extraparams) !=
JSON.stringify(np.extraparams) || JSON.stringify(np.extraparams) ||
JSON.stringify(this.props.dataSource) != JSON.stringify(np.dataSource) JSON.stringify(this.props.dataSource) != JSON.stringify(np.dataSource)
) { ) {
this.lv.scrollTo(0); this.lv.scrollTo(0);
...@@ -192,16 +192,16 @@ class Mcard extends PureComponent { ...@@ -192,16 +192,16 @@ class Mcard extends PureComponent {
render() { render() {
let { let {
scrolltop, scrolltop,
dataSource, dataSource,
isLoading, isLoading,
refreshing, refreshing,
hasMore, hasMore,
isEmpty, isEmpty,
visible, visible,
fields, fields,
searchlist, searchlist,
} = this.state, } = this.state,
{ {
columns, columns,
cardtitle, cardtitle,
...@@ -214,6 +214,7 @@ class Mcard extends PureComponent { ...@@ -214,6 +214,7 @@ class Mcard extends PureComponent {
tabList, tabList,
} = this.props; } = this.props;
return ( return (
<div style={{ height: "100%" }}> <div style={{ height: "100%" }}>
<div className="fixedsearch"> <div className="fixedsearch">
...@@ -229,10 +230,15 @@ class Mcard extends PureComponent { ...@@ -229,10 +230,15 @@ class Mcard extends PureComponent {
<SearchOutlined style={{ color: "#fff" }} /> <SearchOutlined style={{ color: "#fff" }} />
</div> </div>
)} )}
{pageextra && {
pageextra.map((it) => { pageextra ?
return <div>{it}</div>; Array.isArray(pageextra) ?
})} pageextra.map((it) => {
return <div>{it}</div>;
}) :
pageextra
: null
}
</div> </div>
<Drawer <Drawer
...@@ -247,7 +253,7 @@ class Mcard extends PureComponent { ...@@ -247,7 +253,7 @@ class Mcard extends PureComponent {
> >
<InitForm <InitForm
fields={fields} fields={fields}
onChange={() => {}} onChange={() => { }}
reset={true} reset={true}
submitData={(values) => { submitData={(values) => {
this.onRefresh(this.props, values); this.onRefresh(this.props, values);
...@@ -327,8 +333,8 @@ class Mcard extends PureComponent { ...@@ -327,8 +333,8 @@ class Mcard extends PureComponent {
columns.filter((it) => it.valueType == "option").length == 0 columns.filter((it) => it.valueType == "option").length == 0
? null ? null
: columns : columns
.filter((it) => it.valueType == "option")[0] .filter((it) => it.valueType == "option")[0]
?.render(null, rowData, null, { type: "text" }) ?.render(null, rowData, null, { type: "text" })
} }
> >
<Row> <Row>
......
...@@ -29,7 +29,8 @@ class Mtable extends PureComponent { ...@@ -29,7 +29,8 @@ class Mtable extends PureComponent {
JSON.stringify(nextprops.extraparams) || JSON.stringify(nextprops.extraparams) ||
JSON.stringify(this.props.path) != JSON.stringify(nextprops.path) || JSON.stringify(this.props.path) != JSON.stringify(nextprops.path) ||
JSON.stringify(this.props.refreshDep) != JSON.stringify(this.props.refreshDep) !=
JSON.stringify(nextprops.refreshDep) JSON.stringify(nextprops.refreshDep) ||
this.props.columns != nextprops.columns
) { ) {
if (nextprops.actionRef) { if (nextprops.actionRef) {
nextprops.actionRef?.current?.reload(); 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 InitForm from "../InitForm";
import { Drawer } from "antd"; import { Drawer } from "antd";
import React, { useState, memo } from "react"; import React, { useState, memo } from "react";
import Details from "../Details/detail";
// title="Basic Drawer" // title="Basic Drawer"
// placement="right" // placement="right"
// closable={false} // closable={false}
...@@ -10,20 +10,36 @@ import React, { useState, memo } from "react"; ...@@ -10,20 +10,36 @@ import React, { useState, memo } from "react";
// getContainer={false} // getContainer={false}
// style={{ position: 'absolute' }} // style={{ position: 'absolute' }}
// drawer props + initform props + detial props
function DrawInitForm(props) { function DrawInitForm(props) {
let newProps = { ...props }; let newProps = { ...props };
delete newProps.children; 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 ( return (
<Drawer <Drawer
maskClosable={false} maskClosable={false}
placement="right" placement="right"
closable={true} closable={true}
getContainer={false} 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}
> >
{props.children} {props.children}
<InitForm {...newProps}></InitForm> {props.val == "detail" ? <Details {...detailprops}></Details> : <InitForm {...newProps}></InitForm>}
</Drawer> </Drawer>
); );
} }
......
import React, { useEffect } from "react"; import React, { useEffect, useRef } from "react";
import { EditableProTable } from "@ant-design/pro-table"; import { EditableProTable } from "@ant-design/pro-table";
import ProField from "@ant-design/pro-field"; import ProField from "@ant-design/pro-field";
import ProCard from "@ant-design/pro-card"; import ProCard from "@ant-design/pro-card";
...@@ -11,7 +11,9 @@ const EditTable = ({ ...@@ -11,7 +11,9 @@ const EditTable = ({
rowKey, rowKey,
recordCreatorProps, recordCreatorProps,
maxLength, maxLength,
linkconfig
}) => { }) => {
const editorFormRef = useRef()
return ( return (
<EditableProTable <EditableProTable
columns={columns} columns={columns}
...@@ -22,20 +24,91 @@ const EditTable = ({ ...@@ -22,20 +24,91 @@ const EditTable = ({
recordCreatorProps == "false" recordCreatorProps == "false"
? false ? false
: { : {
newRecordType: "dataSource", newRecordType: "dataSource",
record: () => ({ record: () => ({
[rowKey]: Date.now(), [rowKey]: Date.now(),
}), }),
} }
} }
editableFormRef={editorFormRef}
editable={{ editable={{
type: "multiple", type: "multiple",
editableKeys: value ? value.map((item) => item[rowKey]) : [], editableKeys: value ? value.map((item) => item[rowKey]) : [],
actionRender: (row, config, defaultDoms) => { actionRender: (row, config, defaultDoms) => {
return [defaultDoms.delete]; return [defaultDoms.delete];
}, },
onValuesChange: (record, recordList) => { onValuesChange: async (record, recordList) => {
onChange(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} maxLength={maxLength ?? 1000}
......
...@@ -557,6 +557,9 @@ let InitForm = ({ ...@@ -557,6 +557,9 @@ let InitForm = ({
// formartSubmit(values); // formartSubmit(values);
}} }}
onValuesChange={(changedValues, values) => { onValuesChange={(changedValues, values) => {
console.log('====================================')
console.log(changedValues)
console.log('====================================')
let newvalue = {}; let newvalue = {};
let linkkey = Object.keys(changedValues)[0]; let linkkey = Object.keys(changedValues)[0];
//联动逻辑 //联动逻辑
...@@ -1187,6 +1190,7 @@ let InitForm = ({ ...@@ -1187,6 +1190,7 @@ let InitForm = ({
recordCreatorProps={item.recordCreatorProps} recordCreatorProps={item.recordCreatorProps}
value={item.value} value={item.value}
maxLength={item.maxLength} maxLength={item.maxLength}
linkconfig={item.linkconfig}
></EditTable> ></EditTable>
</Form.Item> </Form.Item>
</Col> </Col>
......
...@@ -273,7 +273,7 @@ const Materiel = (props) => { ...@@ -273,7 +273,7 @@ const Materiel = (props) => {
dataIndex: "option_dataindex", dataIndex: "option_dataindex",
key: "option_dataindex", key: "option_dataindex",
valueType: "option", valueType: "option",
width: 275, width: 160,
render: (text, row, _, action) => extraAction(text, row, _, action), render: (text, row, _, action) => extraAction(text, row, _, action),
}, },
]; ];
......
import { factorySelect, shopSelectByFactory } from "@/services/system"; import { factorySelect, shopSelectByFactory } from "@/services/system";
import { doFetch } from "@/utils/doFetch"; import { doFetch } from "@/utils/doFetch";
import regValue from "@/utils/regValue"; import { Table } from "antd";
const one = { const one = {
...@@ -35,7 +35,7 @@ const one = { ...@@ -35,7 +35,7 @@ const one = {
], ],
"required": true, "required": true,
"options": { "options": {
database: () => doFetch({ url: "/ngic-auth/sysSupplier/query/selection", params: { } }), database: () => doFetch({ url: "/ngic-auth/sysSupplier/query/selection", params: {} }),
params: {} params: {}
}, },
}, },
...@@ -67,22 +67,37 @@ const one = { ...@@ -67,22 +67,37 @@ const one = {
col: { span: 24 }, col: { span: 24 },
name: ["materialList"], name: ["materialList"],
required: true, 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: [ columns: [
{ {
"title": "物料编码-名称", "title": <span>物料编码-名称 <b style={{ color: "red" }}>*</b></span>,
"dataIndex": "materieId", "dataIndex": "materieId",
"key": "materieId", "key": "materieId",
"valueType":"select", "valueType": "select",
"width":300, "width": 300,
"request":async ()=>{ "request": async () => {
let res = await doFetch({url:"/ngic-workmanship/pmMaterie/query/selectbox",params:{}}) let res = await doFetch({ url: "/ngic-workmanship/pmMaterie/query/selectbox", params: {} })
console.log(res);
return res?.data?.dataList return res?.data?.dataList
}, },
"fieldProps":{ "fieldProps": {
allowClear:true, allowClear: false,
showSearch:true showSearch: true
} },
"formItemProps": () => {
return {
rules: [{ required: true, message: '此项为必填项' }],
};
},
}, },
{ {
"title": "批次号/SN号", "title": "批次号/SN号",
...@@ -90,14 +105,21 @@ const one = { ...@@ -90,14 +105,21 @@ const one = {
"key": "materieControlNo" "key": "materieControlNo"
}, },
{ {
"title": "入库数量", "title": <span>入库数量 <b style={{ color: "red" }}>*</b></span>,
"dataIndex": "instroeNum", "dataIndex": "instroeNum",
"key": "instroeNum" "key": "instroeNum",
"formItemProps": () => {
return {
rules: [{ required: true, message: '此项为必填项' }],
};
},
}, },
{ {
"title": "单位", "title": "单位",
"dataIndex": "productionUnit", "dataIndex": "productionUnitName",
"key": "productionUnit" "key": "productionUnitName",
"readonly": 'productionUnitName',
"width": 60
}, },
{ {
title: "操作", title: "操作",
...@@ -112,113 +134,208 @@ const one = { ...@@ -112,113 +134,208 @@ const one = {
], ],
rowKey: "id", rowKey: "id",
} }
}, },
two = { two = {
"materieInstoreNo": { "materieInstoreNo": {
"value": null, "value": null,
"type": "input", "type": "input",
"title": "入库单号", "title": "入库单号",
"name": [ "name": [
"materieInstoreNo" "materieInstoreNo"
], ],
"required": false "required": false
},
"storeId": {
"value": null,
"type": "select",
"title": "仓库",
"name": [
"storeId"
],
"required": true,
"options": {
database: () => doFetch({ url: "/ngic-auth/sysStore/selectionBox", params: { factoryIdList: [] } }),
params: {}
}, },
}, "storeId": {
"supplierId": { "value": null,
"value": null, "type": "select",
"type": "select", "title": "仓库",
"title": "供应商", "name": [
"name": [ "storeId"
"supplierId" ],
], "required": true,
"required": true, "options": {
"options": { database: () => doFetch({ url: "/ngic-auth/sysStore/selectionBox", params: { factoryIdList: [] } }),
database: () => doFetch({ url: "/ngic-auth/sysSupplier/query/selection", params: { factoryIdList: [] } }), params: {}
params: {} },
}, },
}, "supplierId": {
"businessNo": { "value": null,
"value": null, "type": "select",
"type": "input", "title": "供应商",
"title": "相关单号", "name": [
"name": [ "supplierId"
"businessNo" ],
], "required": true,
"required": false "options": {
}, database: () => doFetch({ url: "/ngic-auth/sysSupplier/query/selection", params: { factoryIdList: [] } }),
"remark": { params: {}
"value": null, },
"type": "textarea", },
"title": "备注", "businessNo": {
"name": [ "value": null,
"remark" "type": "input",
], "title": "相关单号",
"required": false, "name": [
"col": { "businessNo"
"span": 24 ],
"required": false
},
"remark": {
"value": null,
"type": "textarea",
"title": "备注",
"name": [
"remark"
],
"required": false,
"col": {
"span": 24
}
},
"materialList": {
value: [],
title: "物料信息",
type: "table",
col: { span: 24 },
name: ["materialList"],
required: true,
columns: [
{
"title": "物料名称",
"dataIndex": "materieName",
"key": "materieName"
},
{
"title": "物料编码",
"dataIndex": "materieCode",
"key": "materieCode"
},
{
"title": "批次号/SN号",
"dataIndex": "materieControlNo",
"key": "materieControlNo"
},
{
"title": "入库数量",
"dataIndex": "instroeNum",
"key": "instroeNum"
},
{
"title": "单位",
"dataIndex": "productionUnit",
"key": "productionUnit"
},
{
title: "操作",
valueType: "option",
width: 70,
render: (text, record, _, action) => [
<a key="delete" onClick={() => { }}>
删除
</a>,
],
},
],
rowKey: "id",
} }
}, },
"materialList": { three = {},
value: [], four = {},
title: "物料信息", detail = {
type: "table", totalCard: [
col: { span: 24 }, //物料详情
name: ["materialList"],
required: true,
columns: [
{
"title": "物料名称",
"dataIndex": "materieName",
"key": "materieName"
},
{
"title": "物料编码",
"dataIndex": "materieCode",
"key": "materieCode"
},
{
"title": "批次号/SN号",
"dataIndex": "materieControlNo",
"key": "materieControlNo"
},
{
"title": "入库数量",
"dataIndex": "instroeNum",
"key": "instroeNum"
},
{ {
"title": "单位", cardTitle: "基本信息",
"dataIndex": "productionUnit", itemData: [
"key": "productionUnit" {
title: "入库单号",
key: "materieInstoreNo",
},
{
title: "入库类型",
key: "instoreTypeName",
},
{
title: "入库仓库",
key: "storeName",
},
{
title: "相关单号",
key: "businessNo",
},
{
title: "备注",
key: "remark",
},
{
title: "创建人",
key: "createUserName",
},
{
title: "创建时间",
key: "createTime",
},
],
}, },
{ {
title: "操作", cardTitle: "物料信息列表",
valueType: "option", itemData: [
width: 70, {
render: (text, record, _, action) => [ key: "materialList",
<a key="delete" onClick={() => { }}> type: "table",
删除 col: { span: 24 },
</a>, 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}
/>,
}
},
], ],
}, },
], ]
rowKey: "id", };
}
},
three = {},
four = {}
...@@ -227,5 +344,6 @@ export default { ...@@ -227,5 +344,6 @@ export default {
one, one,
two, two,
three, three,
four four,
detail
}; };
...@@ -3,38 +3,58 @@ import { ...@@ -3,38 +3,58 @@ import {
Dropdown, Dropdown,
Menu, Menu,
Button, Button,
Tooltip, message,
Row,
Divider,
Drawer,
Table,
Col,
Steps,
Card,
} from "antd"; } from "antd";
import AutoTable from "@/components/AutoTable"; import AutoTable from "@/components/AutoTable";
import { useRequest } from "umi";
import defaultFields from "./fields"; import defaultFields from "./fields";
import { doFetch } from "@/utils/doFetch"; 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 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 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) { function Instore(props) {
console.log(defaultFields)
const [activeTabKey, onTabChange] = useState("1"); const [activeTabKey, onTabChange] = useState("1");
const [drawprops, setdrawprops] = useState({ let [drawprops, setdrawprops] = useState({
title: "", title: "",
visible: false, visible: false,
onClose: () => { onClose: () => {
...@@ -44,204 +64,314 @@ function Instore(props) { ...@@ -44,204 +64,314 @@ function Instore(props) {
})) }))
}, },
fields: {} fields: {}
}); }),
actionRef = useRef(),
ChildRef = null;
//操作完成后刷新
function reload() {
actionRef.current.reload();
ChildRef?.onRefresh();
message.success("操作成功");
setdrawprops(s => ({
...s,
visible: false
}))
}
const columns = useMemo(() => { const columns = useMemo(() => {
return [ if (activeTabKey == "1") {
{ return [
"title": "入库单号", {
"dataIndex": "materieInstoreNo", "title": "入库单号",
"key": "materieInstoreNo" "dataIndex": "materieInstoreNo",
}, "key": "materieInstoreNo",
{ "render": (dom, record) => {
"title": "入库类型", return <a
"dataIndex": "instoreTypeName", onClick={() => {
"key": "instoreType", setdrawprops(s => ({
"valueType": "select", ...s,
"options": [ visible: true,
{ //查看详情 props
"label": "采购入库", val: "detail",
"value": "1" title: `查看详情`,
}, ...defaultFields?.detail,
{ totalPath: "/ngic-workmanship/wmsMaterieInstore/getInStoreInfoById",
"label": "生产入库", totalParams: { id: record.id }
"value": "2" }))
}, }}
{ >{dom}</a>
"label": "退料入库",
"value": "3"
},
{
"label": "其他入库",
"value": "4"
} }
]
},
{
"title": "入库仓库",
"dataIndex": "storeName",
"key": "storeId",
options: {
database: () => doFetch({ url: "/ngic-auth/sysStore/selectionBox", params: { factoryIdList: [] } }),
params: {}
}, },
valueType: "select", {
}, "title": "入库类型",
{ "dataIndex": "instoreTypeName",
"title": "相关单号", "key": "instoreType",
"dataIndex": "businessNo", "valueType": "select",
"key": "businessNo" "options": [
}, {
{ "label": "采购入库",
"title": "备注", "value": "1"
"dataIndex": "remark", },
"key": "remark", {
"search": false "label": "生产入库",
}, "value": "2"
{ },
"title": "创建人", {
"dataIndex": "createUserName", "label": "退料入库",
"key": "createUserName" "value": "3"
}, },
{ {
"title": "创建时间", "label": "其他入库",
"dataIndex": "createTime", "value": "4"
"key": "createTime", }
"search": false ]
}, },
{ {
"title": "创建时间开始时间", "title": "入库仓库",
"dataIndex": "createTimeStart", "dataIndex": "storeName",
"key": "createTimeStart", "key": "storeId",
"valueType": "date", options: {
"hideInTable": true database: () => doFetch({ url: "/ngic-auth/sysStore/selectionBox", params: { factoryIdList: [] } }),
}, params: {}
{
"title": "创建时间结束时间",
"dataIndex": "createTimeEnd",
"key": "createTimeEnd",
"valueType": "date",
"hideInTable": true
},
{
"title": "状态",
"dataIndex": "statusName",
"key": "statusName",
"valueType": "select",
"request": [
{
"label": "待上架",
"value": "0"
}, },
{ valueType: "select",
"label": "上架中", },
"value": "1" {
} "title": "相关单号",
] "dataIndex": "businessNo",
}, "key": "businessNo"
{ },
"title": "操作", {
"valueType": "option", "title": "备注",
"width": 240, "dataIndex": "remark",
"render": (text, row, _, action) => { "key": "remark",
return [ "search": false
getPrem("equipmentCustomer_save", action, '上架采集', async () => { },
{
"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": "statusName",
"key": "status",
"valueType": "select",
"options": [
{
"label": "待上架",
"value": "0"
},
{
"label": "上架中",
"value": "1"
}
]
},
{
"title": "操作",
"valueType": "option",
"width": 240,
"render": (text, record, _, action) => {
return [
getPrem("equipmentCustomer_save", action, '上架采集', async () => {
}), }),
getPrem("equipmentCustomer_deleteById", action, '关单', null, { getPrem("equipmentCustomer_deleteById", action, '关单', null, {
title: "确认关单?", title: "确认关单?",
onConfirm: () => { 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 } }) }),
} getPrem("equipmentCustomer_deleteById", action, '删除', null, {
}) title: "确认删除?",
]; onConfirm: () => {
doFetch({ url: "/ngic-workmanship/wmsMaterieInstore/deleteById", params: { id: record.id } }).then(res => {
if (res.code == "0000") {
reload()
}
})
}
})
];
}
} }
} ]
] } else {
return [
{
"title": "入库单号",
"dataIndex": "materieInstoreNo",
"key": "materieInstoreNo",
"render": (dom, record) => {
return <a
onClick={() => {
setdrawprops(s => ({
...s,
visible: true,
//查看详情 props
val: "detail",
title: `查看详情`,
...defaultFields?.detail,
totalPath: "/ngic-workmanship/wmsMaterieInstoreHis/getInStoreInfoById",
totalParams: { id: record.id }
}))
}}
>{dom}</a>
}
},
{
"title": "入库类型",
"dataIndex": "instoreTypeName",
"key": "instoreType",
"valueType": "select",
"options": [
{
"label": "采购入库",
"value": "1"
},
{
"label": "生产入库",
"value": "2"
},
{
"label": "退料入库",
"value": "3"
},
{
"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]) }, [activeTabKey])
const tableprops = { const tableprops = {
...props, ...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 pageextra: activeTabKey == "1" ? <Dropdown placement="bottomRight" overlay={<Menu
onClick={(e) => { onClick={(e) => {
console.log(e.key)
setdrawprops(s => ({ setdrawprops(s => ({
...s, ...s,
visible: true, visible: true,
title: "新增", title: "新增",
width: 800, width: 800,
fields:defaultFields[e.key], fields: defaultFields[e.key],
instoreType:e.key instoreType: keytoval[e.key],
val: "add" //类型
})) }))
}} }}
items={[ items={items}
{
key: 'one',
label: (
<a>
采购入库
</a>
),
},
{
key: 'two',
label: (
<a>
生产入库
</a>
),
},
{
key: 'three',
label: (
<a>
退料入库
</a>
),
},
{
key: 'four',
label: (
<a>
其他入库
</a>
),
},
]}
/>}> />}>
<Button type="primary">新增</Button> <Button type="primary">新增</Button>
</Dropdown> : "none", </Dropdown> : "none",
...@@ -257,7 +387,7 @@ function Instore(props) { ...@@ -257,7 +387,7 @@ function Instore(props) {
activeTabKey, activeTabKey,
onTabChange, onTabChange,
columns, columns,
path: "/ngic-workmanship/wmsMaterieInstore/queryList" path: activeTabKey == "1" ? "/ngic-workmanship/wmsMaterieInstore/queryList" : "/ngic-workmanship/wmsMaterieInstoreHis/queryList"
} }
...@@ -267,17 +397,20 @@ function Instore(props) { ...@@ -267,17 +397,20 @@ function Instore(props) {
{ {
...tableprops ...tableprops
} }
actionRef={actionRef}
onRef={(node) => (ChildRef = node)}
></AutoTable> ></AutoTable>
<DrawInitForm <DrawInitForm
{...drawprops} {...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> </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