Commit be8eed64 authored by krysent's avatar krysent

new

parent a4479aff
......@@ -17,6 +17,7 @@ import {
Cascader,
ConfigProvider,
Rate,
Divider,
} from "antd";
import moment from "moment";
import React, { useEffect, useMemo, useState } from "react";
......@@ -141,7 +142,6 @@ let InitForm = ({
[ind, cind] = useState(0);
form = formRef ? formRef : form;
useEffect(() => {
let Doms = [],
klink = {},
......@@ -378,7 +378,7 @@ let InitForm = ({
);
let getOptions = async (options, item) => {
let curkey = item.name[0];
let curkey = item?.name[0];
if (Array.isArray(options)) {
if (JSON.stringify(optiondom[curkey]) !== JSON.stringify(options)) {
cdom((optiondom) => {
......@@ -627,8 +627,9 @@ let InitForm = ({
},
item.name[0].indexOf("phone") != -1
? {
pattern: /^(((\d{3,4}-)?[0-9]{7,8})|(1(3|4|5|6|7|8|9)\d{9}))$/,
message: item.title+"格式不正确",
pattern:
/^(((\d{3,4}-)?[0-9]{7,8})|(1(3|4|5|6|7|8|9)\d{9}))$/,
message: item.title + "格式不正确",
}
: item.name[0].indexOf("mail") != -1
? {
......@@ -1244,6 +1245,12 @@ let InitForm = ({
</Form.Item>
</Col>
) : null;
} else if (item.type == "split") {
return !extraprops.hides ? (
<Col key={i} {...getCol(item.col)}>
<Divider orientation="left" style={{fontWeight:600,fontSize:14}}>{item.title}</Divider>
</Col>
) : null;
}
})}
{bottomNode && <Col span={24}>{bottomNode}</Col>}
......
......@@ -85,8 +85,8 @@ function Table({ route }) {
},
{
"title": "角色",
"dataIndex": "roleNames",
"key": "roleNames"
"dataIndex": "roleName",
"key": "roleName"
},
{
"title": "直属领导",
......
......@@ -8,10 +8,16 @@ import {
import { doFetch } from "@/utils/doFetch";
export default {
jbsx: {
title: "基本属性",
type: "split",
col: { span: 24 },
name: ["jbsx"],
},
materieCode: {
value: null,
type: "input",
title: "物料编",
title: "物料编",
name: ["materieCode"],
required: true,
},
......@@ -25,12 +31,16 @@ export default {
materieTypeId: {
value: null,
type: "treeselect",
title: "物料类",
title: "物料类",
name: ["materieTypeId"],
required: true,
options: {
database: (params) => doFetch({ url: "/ngic-workmanship/pmMaterieType/queryTreeList", params }),
params: {}
database: (params) =>
doFetch({
url: "/ngic-workmanship/pmMaterieType/queryTreeList",
params,
}),
params: {},
},
},
materieControl: {
......@@ -40,24 +50,75 @@ export default {
name: ["materieControl"],
required: true,
options: {
database: (params) => doFetch({ url: "/ngic-base-business/sysDic/queryMaterieControlSelect", params }),
params: {}
database: (params) =>
doFetch({
url: "/ngic-base-business/sysDic/queryMaterieControlSelect",
params,
}),
params: {},
},
},
specificationModel: {
value: null,
type: "input",
title: "规格型号",
name: ["specificationModel"],
required: true,
},
issueType: {
type: "select",
title: "发料类型",
name: ["issueType"],
required: true,
options: {
database: (params) =>
doFetch({
url: "/ngic-base-business/sysDic/queryMaterieTypeSelect",
params,
}),
params: {},
},
},
scsx: {
title: "生产属性",
type: "split",
col: { span: 24 },
name: ["scsx"],
},
ironLoss: {
value: null,
type: "inputnumber",
title: "铁损",
name: ["ironLoss"],
required: false,
},
sheetThickness: {
value: null,
type: "inputnumber",
title: "片厚",
name: ["sheetThickness"],
required: false,
},
inventoryMin: {
unilateralThickness: {
value: null,
type: "inputnumber",
title: "库存下限",
name: ["inventoryMin"],
title: "宽度",
name: ["unilateralThickness"],
required: false,
},
inventoryMax: {
shopSign: {
value: null,
type: "inputnumber",
title: "库存上限",
name: ["inventoryMax"],
title: "牌号",
name: ["shopSign"],
required: false,
},
cksx: {
title: "仓库属性",
type: "split",
name: ["cksx"],
col: { span: 24 },
},
productionUnit: {
value: null,
type: "select",
......@@ -65,94 +126,36 @@ export default {
name: ["productionUnit"],
required: true,
options: {
database: (params) => doFetch({ url: "/ngic-base-business/sysDic/queryMaterieUnitSelect", params }),
params: {}
},
database: (params) =>
doFetch({
url: "/ngic-base-business/sysDic/queryMaterieUnitSelect",
params,
}),
params: {},
},
qualityGuaranteePeriod: {
value: null,
type: "inputnumber",
title: "保质期",
name: ["qualityGuaranteePeriod"],
required: false,
},
qualityGuaranteePeriodUnit: {
storeId: {
value: null,
type: "select",
title: "保质期单位",
name: ["qualityGuaranteePeriodUnit"],
title: "默认仓库",
name: ["storeId"],
required: false,
options: [
{
label: "天",
value: 1,
options: {
database: (params) =>
doFetch({ url: "/ngic-auth/sysStore/selectionBoxAll", params }),
params: {},
},
{
label: "月",
value: 2,
},
{
label: "年",
value: 3,
}
],
storeAreaId: {
value: null,
type: "select",
title: "默认库区",
name: ["storeAreaId"],
options: {
database: (params) =>
doFetch({ url: "/ngic-auth/sysStoreArea/selection", params }),
params: {},
},
issueType: {
value: 1,
type: "radio",
title: "发料类型",
name: ["issueType"],
required: true,
options: [
{
label: "散发",
value: 1,
},
{
label: "整发",
value: 2,
}
],
},
materieProductUnitList: {
value: [],
title: "转换单位",
type: "table",
col: { span: 24 },
name: ["materieProductUnitList"],
required: false,
columns: [
{
title: "辅助单位",
dataIndex: "productionUnit",
key: "productionUnit",
search: false,
valueType: "select",
request: async () => {
let res = await doFetch({url:"/ngic-base-business/sysDic/queryMaterieUnitSelect",params:{}})
return res?.data?.dataList
},
},
{
title: "转换比 库存单位=辅助单位*转换比”",
dataIndex: "conversionRate",
key: "conversionRate",
search: false,
valueType: "digit",
width:200
},
{
title: "操作",
valueType: "option",
width: 70,
render: (text, record, _, action) => [
<a key="delete" onClick={() => { }}>
删除
</a>,
],
},
],
rowKey: "id",
},
};
......@@ -167,7 +167,7 @@ const Materiel = (props) => {
} = state,
columns = [
{
title: "物料编",
title: "物料编",
dataIndex: "materieCode",
key: "materieCode",
},
......@@ -228,7 +228,7 @@ const Materiel = (props) => {
search: false,
},
{
title: "物料管控",
title: "管控方式",
dataIndex: "materieControlName",
key: "materieControlName",
options: {
......@@ -244,43 +244,32 @@ const Materiel = (props) => {
},
},
{
title: "保质期",
dataIndex: "qualityGuaranteePeriod",
key: "qualityGuaranteePeriod",
search: false,
render: (text, row) => {
return (
(row.qualityGuaranteePeriod ?? "") +
" - " +
(row.qualityGuaranteePeriodUnitName ?? "")
);
title: "铁损",
dataIndex: "ironLoss",
key: "ironLoss",
valueType: "digit",
},
{
title: "片厚",
dataIndex: "sheetThickness",
valueType: "digit",
key: "sheetThickness",
},
{
title: "库存上限",
dataIndex: "inventoryMax",
key: "inventoryMax",
search: false,
title: "宽度",
dataIndex: "unilateralThickness",
key: "unilateralThickness",
},
{
title: "库存下限",
dataIndex: "inventoryMin",
key: "inventoryMin",
search: false,
title: "牌号",
dataIndex: "shopSign",
key: "shopSign",
},
{
title: "库存单位",
dataIndex: "productionUnitName",
key: "productionUnit",
options: {
database: () =>
doFetch({
url: "/ngic-base-business/sysDic/queryMaterieUnitSelect",
}),
params: {},
},
valueType: "select",
title: "默认库区",
dataIndex: "storeAreaName",
key: "storeAreaName",
},
{
......@@ -305,7 +294,7 @@ const Materiel = (props) => {
return [
getPrem("sysDepartment_save", action, "修改", () => {
doFetch({
url: "/ngic-workmanship/pmMaterie/queryUpdateById",
url: "/ngic-workmanship/pmMaterie/queryById",
params: { id: record.id },
}).then((res) => {
if (res.code == "0000") {
......@@ -386,27 +375,6 @@ const Materiel = (props) => {
.validateFields()
.then((secondFields) => {
let secondFieldsKeys = Object.keys(secondFields);
let materieCharList = defaultSpecificFileds.map((it) => {
if (secondFieldsKeys.indexOf(it.fieldsKey) != -1) {
it.fieldRealValue = secondFields[it.fieldsKey];
}
const el = {
fieldType: it.fieldType,
fieldTypeName: it.fieldTypeName,
fieldCondName: it.fieldCondName,
fieldCondKey: it.fieldCondKey,
optCondName: it.optCondName,
optCondKey: it.optCondKey,
fieldId: it.fieldId,
fieldName: it.fieldName,
fieldChar: it.fieldChar,
fieldCharName: it.fieldCharName,
fieldCharValue: it.fieldCharValue,
fieldRealValue: it.fieldRealValue,
valueList: it.valueList,
};
return el;
});
let materieProductUnitList =
firstValues?.materieProductUnitList?.map((it) => {
return {
......@@ -417,7 +385,6 @@ const Materiel = (props) => {
params = {
...firstValues,
materieCharList,
...difrid,
materieProductUnitList,
};
......@@ -473,9 +440,9 @@ const Materiel = (props) => {
) {
defaultFields[i].required = false;
}
if (i == "issueType") {
defaultFields[i].value = 1;
}
// if (i == "issueType") {
// defaultFields[i].value = 1;
// }
if (i == "materieTypeId") {
defaultFields[i].value =
materieTypeId == "00000000" ? null : materieTypeId;
......@@ -587,17 +554,6 @@ const Materiel = (props) => {
return null;
}}
></InitForm>
<div style={{ fontSize: 16, fontWeight: "bold", marginBottom: 15 }}>
特定属性
</div>
<InitForm
formRef={formRefs}
fields={specificFileds}
onChange={(changedValues, allValues) => {}}
actions={() => {
return null;
}}
></InitForm>
</>
}
<Button
......
......@@ -192,8 +192,8 @@ const Shiftgroup = (props) => {
},
{
title: "角色",
dataIndex: "roleNames",
key: "roleNames",
dataIndex: "roleName",
key: "roleName",
search: false,
},
],
......@@ -236,8 +236,8 @@ const Shiftgroup = (props) => {
},
{
title: "角色",
dataIndex: "roleNames",
key: "roleNames",
dataIndex: "roleName",
key: "roleName",
search: false,
},
{
......
......@@ -34,7 +34,7 @@ function reducer(state, action) {
...state,
vs: true,
iftype: {
title: "新增仓库",
title: "新增库区",
val: type,
},
fields: { ...action.fields },
......@@ -45,7 +45,7 @@ function reducer(state, action) {
...state,
vs: true,
iftype: {
title: "编辑仓库",
title: "编辑库区",
val: type,
},
fields: { ...action.fields },
......
import { doFetch } from "@/utils/doFetch";
import { factorySelect } from "@/services/system";
export default {
"customerNo": {
"value": null,
"type": "input",
"title": "仓位编码",
"name": [
"customerNo"
],
"required": false
},
"customerName": {
"value": null,
"type": "input",
"title": "仓位名称",
"name": [
"customerName"
],
"required": true
},
"officialWebsite": {
"value": null,
"type": "input",
"title": "所属仓库",
"name": [
"officialWebsite"
],
"required": false
},
"telephone": {
"value": null,
"type": "input",
"title": "所属库区",
"name": [
"telephone"
],
"required": false
},
"email": {
"value": null,
"type": "input",
"title": "排",
"name": [
"email"
],
"required": false
},
"address": {
"value": null,
"type": "input",
"title": "列",
"name": [
"address"
],
"required": false
},
"score": {
"value": null,
"type": "rate",
"title": "层",
"name": [
"score"
],
"required": false,
allowHalf: true,
storePositionCode: {
value: null,
type: "input",
title: "库位编码",
name: ["storePositionCode"],
required: true,
},
"status": {
"value": 1,
"type": "select",
"title": "启停状态",
"name": [
"status"
],
"required": true,
options: [
{
label: "启用",
value: 1
storePositionName: {
value: null,
type: "input",
title: "库位名称",
name: ["storePositionName"],
required: true,
},
{
label: "停用",
value: 0
factoryId: {
value: null,
type: "select",
title: "所属工厂",
name: ["factoryId"],
required: true,
options: {
database: factorySelect,
params: {},
},
]
linked: true,
},
"remark": {
"value": null,
"type": "textarea",
"title": "备注",
"name": [
"remark"
],
"required": false,
col: { span: 24 }
storeId: {
value: null,
type: "select",
title: "所属仓库",
name: ["storeId"],
required: true,
linked: true,
belinked: {
options: {
database: () =>
doFetch({ url: "/ngic-auth/sysStore/selectionBox", params: {} }),
params: {
factoryId: "linked",
},
"customerUserList": {
"value": null,
"editable": true,
"type": "table",
"title": "联系人",
"name": [
"customerUserList"
],
"required": false,
"columns": [
{
"title": "联系人姓名",
"dataIndex": "userName",
"key": "userName",
"search": false,
"valueType": "input",
formItemProps: {
rules: [
{
},
},
},
storeAreaId: {
value: null,
type: "select",
title: "所属库区",
name: ["storeAreaId"],
required: true,
message: '此项为必填项',
belinked: {
options: {
database: () =>
doFetch({ url: "/ngic-auth/sysStoreArea/selection", params: {} }),
params: {
storeId: "linked",
},
],
}
},
},
linked: true,
},
status: {
value: 1,
type: "select",
name: ["status"],
title: "库位状态",
required: true,
options: [
{
"title": "联系电话",
"dataIndex": "telephone",
"key": "telephone",
"search": false,
"valueType": "input",
formItemProps: {
rules: [
label: "启用",
value: 1,
},
{
required: false,
pattern: /^(((\d{3,4}-)?[0-9]{7,8})|(1(3|4|5|6|7|8|9)\d{9}))$/,
message: '手机号格式不正确'
label: "停用",
value: 2,
},
],
}
},
{
"title": "邮箱",
"dataIndex": "email",
"key": "email",
"search": false,
"valueType": "input",
formItemProps: {
rules: [
{
wzpz: {
type: "split",
title: "位置配置",
name: ["wzpz"],
col: { span: 24 },
},
row: {
value: null,
type: "input",
title: "排",
name: ["row"],
required: false,
pattern: /^[a-z0-9A-Z]+[- | a-z0-9A-Z . _]+@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\.)+[a-z]{2,}$/,
message: '邮箱格式不正确'
},
],
}
line: {
value: null,
type: "input",
title: "列",
name: ["line"],
required: false,
},
{
"title": "职位",
"dataIndex": "title",
"key": "title",
"search": false,
"valueType": "input"
level: {
value: null,
type: "input",
title: "层",
name: ["level"],
required: false,
allowHalf: true,
},
{
title: '操作',
valueType: 'option',
render: () => {
return null;
roadway: {
value: null,
type: "input",
title: "巷道",
name: ["roadway"],
required: false,
allowHalf: true,
},
remark: {
value: null,
type: "textarea",
title: "备注",
name: ["remark"],
required: false,
col: { span: 24 },
},
],
"editable": true,
"rowKey": "id",
"rowName": "",
"dataSource": [],
col: { span: 24 }
}
}
\ No newline at end of file
};
import React, { useState, useRef, useReducer } from "react";
import {
Modal,
Button,
Drawer,
Tooltip,
Popconfirm,
message,
Switch,
Layout,
} from "antd";
import { Button, Tooltip, Row, Divider, Drawer, Form, message } from "antd";
import AutoTable from "@/components/AutoTable";
import getPrem from "@/utils/getPrem"; //权限判断fn
import InitForm from "@/components/InitForm";
import { useRequest } from "umi";
import defaultFields from "./fields";
import { doFetch } from "@/utils/doFetch";
import { deviceprovideDetail, deleteProvideCheck } from "@/services/device";
import { usercusDetails } from "@/utils/detailTotalCard";
import Details from "@/components/Details";
import { useAsyncEffect } from "ahooks";
import tempfields from "@/utils/tempfields";
import { materielDetail } from "@/utils/detailTotalCard";
import InitForm from "@/components/InitForm";
import moment from "moment";
import TreeRender from "@/components/TreeRender";
const { Sider, Content } = Layout;
import { useEffect } from "react";
const initState = {
vs: false,
fields: {},
iftype: {},
details: {
curitem: {},
detail: {
dataSource: {},
totalCard: [],
},
visible: false,
};
specificFileds: {},
commonFields: {},
defaultCommonFields: [],
},
otherBasic = {
materieCode: "物料编号",
materieName: "物料名称",
materieTypeName: "物料类型",
productionUnitName: "生产单位(主)",
processLineName: "工艺路线",
};
function reducer(state, action) {
let { type } = action,
newState = {};
......@@ -43,10 +42,12 @@ function reducer(state, action) {
...state,
vs: true,
iftype: {
title: "新增客户",
title: "新增仓位",
val: type,
},
fields: { ...action.fields },
commonFields: action.commonFields,
specificFileds: action.specificFileds,
};
break;
case "edit":
......@@ -54,361 +55,532 @@ function reducer(state, action) {
...state,
vs: true,
iftype: {
title: "编辑客户",
title: "编辑库位",
val: type,
},
fields: { ...action.fields },
curitem: action.curitem,
commonFields: action.commonFields,
specificFileds: action.specificFileds,
defaultCommonFields: action.defaultCommonFields,
};
break;
case "cdetails":
let n = 1,
dataSource = action.dataSource;
let special = action?.dataSource?.customerCharList?.map?.((it) => {
n++;
let key = n.toString();
dataSource[key] = it?.fieldRealValue;
return {
title: it?.fieldName,
key: key,
};
});
let extraspecial = [
{
cardTitle: "特殊属性",
itemData: special,
case "bom":
newState = {
...state,
vs: true,
iftype: {
title: "编辑物料BOM",
val: type,
},
];
fields: { ...action.fields },
curitem: action.curitem,
markKey: action.markKey,
};
break;
case "see":
newState = {
...state,
details: {
detail: {
dataSource: action.dataSource,
totalCard: [...usercusDetails, ...extraspecial],
totalCard: action.totalCard,
},
visible: true,
};
break;
case "changeSpecificFileds":
newState = {
...state,
specificFileds: action.specificFileds,
};
break;
case "changeFields":
newState = {
...state,
fields: action.fields,
};
break;
case "changeCommonFields":
newState = {
...state,
commonFields: action.commonFields,
};
break;
case "changeDefaultCommonFields":
newState = {
...state,
defaultCommonFields: action.defaultCommonFields,
};
break;
case "close":
newState = {
vs: false,
fields: {},
iftype: {},
details: {
curitem: {},
detail: {
dataSource: {},
totalCard: [],
},
visible: false,
specificFileds: {},
};
break;
}
return newState;
}
const Reservoir = (props) => {
const Materiel = (props) => {
let actionRef = useRef(),
ChildRef = null;
ChildRef = null,
[formRef] = Form.useForm(),
[formRefs] = Form.useForm();
const [materieTypeId, setmaterieTypeId] = useState();
const [defaultSpecificFileds, setdefaultSpecificFileds] = useState();
function reload() {
actionRef?.current?.reload();
ChildRef?.onRefresh();
}
const [state, dispatch] = useReducer(reducer, initState),
{ vs, fields, iftype, details, visible } = state,
const { run, loading } = useRequest(doFetch, {
manual: true,
formatResult: (res) => res,
onSuccess: (result, params) => {
if (result.code == "0000") {
reload();
dispatch({ type: "close" });
}
},
}),
[state, dispatch] = useReducer(reducer, initState),
{
vs,
fields,
iftype,
curitem,
detail,
visible,
specificFileds,
commonFields,
defaultCommonFields,
markKey,
} = state,
columns = [
{
title: "客户编号",
dataIndex: "customerNo",
key: "customerNo",
title: "库位编码",
dataIndex: "storePositionCode",
key: "storePositionCode",
},
{
title: "客户名称",
dataIndex: "customerName",
key: "customerName",
render: (_, row) => {
return (
<div
style={{
padding: "3px 0",
overflow: "hidden",
whiteSpace: "nowrap",
textOverflow: "ellipsis",
}}
>
<Tooltip title={row.customerName}>
<a
onClick={() => {
doFetch({
url: "/ngic-auth/sysCustomer/query/detail",
params: { id: row.id },
}).then((res) => {
let data = res?.data?.data || {};
dispatch({ type: "cdetails", dataSource: data });
});
}}
>
{row.customerName}
</a>
</Tooltip>
</div>
);
},
title: "库位名称",
dataIndex: "storePositionName",
key: "storePositionName",
// render: (_, row) => {
// return (
// <Tooltip title={row.materieName}>
// <a
// className="table-cell"
// onClick={() => {
// doFetch({
// url: "/ngic-workmanship/pmMaterie/queryDetailById",
// params: { id: row.id },
// }).then((res) => {
// if (res.code == "0000") {
// let dataSource = res?.data?.data ?? {},
// specials = res?.data?.data?.materieCharList ?? [];
// let newData = formatFieds(specials, "special")?.data;
// let newSpecialData = newData.map((it) => {
// dataSource[it.fieldsKey] = it.fieldRealValue;
// return {
// title: it.fieldName,
// key: it.fieldsKey,
// };
// });
// let itemCol = [
// {
// cardTitle: "特殊属性",
// itemData: newSpecialData,
// },
// ];
// dataSource.newqualityGuaranteePeriod =
// dataSource.qualityGuaranteePeriod == 0 ||
// dataSource.qualityGuaranteePeriod
// ? dataSource.qualityGuaranteePeriod +
// dataSource.qualityGuaranteePeriodUnitName
// : null;
// let totalCard = materielDetail.concat(itemCol);
// dispatch({ type: "see", dataSource, totalCard });
// }
// });
// }}
// >
// {row.materieName}
// </a>
// </Tooltip>
// );
// },
},
{
title: "联系电话",
dataIndex: "telephone",
key: "telephone",
title: "所属仓库",
dataIndex: "storeName",
key: "storeName",
},
{
title: "邮箱",
dataIndex: "email",
key: "email",
title: "所属库区",
dataIndex: "storeAreaName",
key: "storeAreaName",
options: {
database: () =>
doFetch({
url: "/ngic-base-business/sysDic/queryMaterieControlSelect",
}),
params: {},
},
valueType: "select",
formItemProps: {
name: "materieControl",
},
{
title: "地址",
dataIndex: "address",
key: "address",
search: false,
},
{
title: "备注",
dataIndex: "remark",
key: "remark",
search: false,
title: "",
dataIndex: "row",
key: "row",
valueType: "digit",
},
{
title: "评分",
dataIndex: "score",
key: "score",
render: (_, row) => {
return <div>{row.score}</div>;
title: "列",
dataIndex: "line",
key: "line",
valueType: "digit",
},
{
title: "层",
dataIndex: "level",
key: "level",
valueType: "digit",
},
{
title: "状态",
dataIndex: "status",
key: "status",
valueType: "select",
options: [
{
label: "启用",
value: 1,
render: (_, row) => <span>{row?.status == "1" ? "启用" : "禁用"}</span>,
},
{
label: "关闭",
value: 0,
},
],
render: (text, row, _, action) => {
return (
<Popconfirm
title="是否开启或关闭客户?"
onConfirm={() => {
run({
url: "/ngic-auth/sysCustomer/update/status",
params: { id: row.id, status: row.status == 1 ? 0 : 1 },
});
}}
onCancel={() => {}}
okText="确定"
cancelText="取消"
disabled={!getPrem("equipmentCustomer_updatestatus", "ifs")}
>
<Switch
checked={row.status == 1 ? true : false}
checkedChildren="开启"
unCheckedChildren="关闭"
defaultChecked={false}
/>
</Popconfirm>
);
title: "更新人",
dataIndex: "updateUserName",
key: "updateUserName",
},
{
title: "更新时间",
dataIndex: "updateTime",
key: "updateTime",
},
{
title: "操作",
dataIndex: "option_dataindex",
key: "option_dataindex",
valueType: "option",
width: 150,
width: 160,
render: (text, row, _, action) => extraAction(text, row, _, action),
},
],
{ run, loading } = useRequest(doFetch, {
manual: true,
formatResult: (res) => res,
onSuccess: (result, params) => {
if (result.code == "0000") {
message.success("操作成功!");
reload();
dispatch({ type: "close" });
}
},
];
useEffect(() => {
doFetch({
url: "/ngic-workmanship/pmMaterieChar/queryCommonList",
params: {},
}).then((res) => {
setdefaultSpecificFileds(res?.data?.dataList);
});
const [extrafields, setextrafields] = useState({});
const [subdata, setsubdata] = useState([]);
const [curitem, setcuritem] = useState({});
}, []);
function extraAction(text, record, _, action) {
return [
getPrem("equipmentCustomer_save", action, "修改", async () => {
await setcuritem({
...record,
key: "edit",
getPrem("sysDepartment_save", action, "修改", () => {
doFetch({
url: "/ngic-auth/sysStorePosition/queryById",
params: { id: record.id },
}).then((res) => {
if (res.code == "0000") {
let data = res?.data?.data ?? {};
console.log(data);
let newArr =
data?.materieProductUnitList?.map((it) => {
return {
productionUnit: it.productionUnit,
productionUnitType: it.productionUnitType,
id: it.id,
};
}) ?? [];
for (let i in defaultFields) {
defaultFields[i].value = data[i];
// if (i == "unitList") {
// defaultFields[i].value = [
// {
// id: moment().valueOf(),
// productionUnit: data?.productionUnit,
// productionUnitType: data?.productionUnitType,
// },
// ...newArr,
// ];
// }
}
console.log(defaultFields);
let all = async () => {
let common = await doFetch({
url: "/ngic-workmanship/pmMaterieChar/queryCommonList",
params: { id: record.id },
});
return {
commonData: common?.data?.dataList,
};
};
all().then((res) => {
let commonDataFields = formatFieds(
res?.commonData,
"common"
)?.obj,
newCommonData = formatFieds(res?.commonData, "common")?.data;
console.log(defaultFields);
dispatch({
type: "edit",
fields: defaultFields,
curitem: record,
commonFields: commonDataFields,
specificFileds: { ...commonDataFields },
defaultCommonFields: newCommonData,
});
setdefaultSpecificFileds([...newCommonData]);
});
}
});
}),
getPrem("equipmentCustomer_deleteById", action, "删除", null, {
title: "确认删除该客户?",
getPrem("sysDepartment_deleteById", action, "删除", null, {
title: "确认删除该库位?",
onConfirm: () => {
run({
url: "/ngic-auth/sysCustomer/deleteById",
url: "/ngic-workmanship/pmMaterie/deleteById",
params: { id: record.id },
});
},
}),
];
}
let saveData = (values, fn) => {
let newfields = JSON.parse(JSON.stringify(values));
let saveData = () => {
//新增&修改
let difrid = iftype.val == "edit" ? { id: curitem.id } : {};
let customerUserList = newfields?.customerUserList?.map((it) => {
delete it.id;
return it;
});
let customerCharList = subdata.map((it, i) => {
let key = "field" + i.toString();
it.fieldRealValue = values[key];
delete newfields[key];
return it;
let difrid = iftype.val != "add" ? { id: curitem.id } : {},
params,
url;
if (iftype.val != "bom") {
formRef
.validateFields()
.then((firstValues) => {
formRefs
.validateFields()
.then((secondFields) => {
let secondFieldsKeys = Object.keys(secondFields);
let materieProductUnitList =
firstValues?.materieProductUnitList?.map((it) => {
return {
productionUnit: it.productionUnit,
conversionRate: it.conversionRate,
};
});
let params = {
...newfields,
customerUserList,
customerCharList,
params = {
...firstValues,
...difrid,
factoryId: materieTypeId,
materieProductUnitList,
};
url = "/ngic-auth/sysStorePosition/save";
run({ url, params });
})
.catch((error) => {});
})
.catch((error) => {});
} else {
url = "/ngic-workmanship/pmMaterie/saveMaterieBom";
let firstValues = formRef?.getFieldsValue();
let materieBomList = firstValues?.materieBomList?.map((it, i) => {
return {
materieId: it.id,
materieName: it.materieName,
materieCode: it.materieCode,
materieType: it.materieType,
numberUnits: it.numberUnits,
workingProduceId: it.workingProduceId,
workingFeedingId: it.workingFeedingId,
rowKey: String(i),
productionUnitName: it.productionUnitName,
};
run({
url: "/ngic-auth/sysCustomer/save",
params: { ...params, ...difrid },
});
params = {
materieBomList,
...difrid,
};
run({ url, params });
}
};
let extrarender = [
<Button
disabled={!getPrem("equipmentCustomer_save", "ifs")}
disabled={!getPrem("sysDepartment_save", "ifs")}
type="primary"
onClick={async () => {
let result = await tempfields(
"/ngic-auth/sysCustomerChar/queryCommonList",
{}
);
onClick={() => {
doFetch({
url: "/ngic-workmanship/pmMaterieChar/queryCommonList",
params: {},
}).then((res) => {
if (res.code == "0000") {
let data = res?.data?.dataList,
otherFields = formatFieds(data, "common")?.obj,
newData = formatFieds(data, "common")?.data;
for (let i in defaultFields) {
defaultFields[i].value = null;
if (i == "customerUserList") {
defaultFields[i].value = [];
defaultFields[i].disabled = false;
if (
i == "serialNumberRuleId" ||
i == "labelTemplateId" ||
i == "processLineId"
) {
defaultFields[i].required = false;
}
if (i == "status") {
defaultFields[i].value = 1;
// if (i == "issueType") {
// defaultFields[i].value = 1;
// }
if (i == "materieTypeId") {
defaultFields[i].value =
materieTypeId == "00000000" ? null : materieTypeId;
}
}
for (let i in extrafields) {
extrafields[i].value = null;
if (extrafields[i]["multiple"] == true) {
extrafields[i].value = [];
}
}
dispatch({
type: "add",
fields: { ...defaultFields, ...result?.fields },
fields: defaultFields,
commonFields: otherFields,
specificFileds: otherFields,
});
dispatch({
type: "changeDefaultCommonFields",
defaultCommonFields: newData,
});
}
});
}}
>
新增
</Button>,
];
useAsyncEffect(async () => {
let result = await tempfields(
"/ngic-auth/sysCustomerChar/queryCommonList",
{ id: curitem.id }
);
await setextrafields(result?.fields);
await setsubdata(result?.data);
if (curitem.key == "edit") {
doFetch({
url: "/ngic-auth/sysCustomer/query/detail",
params: { id: curitem.id },
}).then((res) => {
if (res.code == "0000") {
let data = res?.data?.data || {};
for (let i in defaultFields) {
defaultFields[i].value = data[i];
function formatFieds(data, type) {
let obj = {};
for (let i = 0; i < data.length; i++) {
let item = data[i],
fieldsKey = type + "field" + i;
item["fieldsKey"] = fieldsKey;
if (item.fieldChar == 1) {
obj[fieldsKey] = {
value: item?.fieldRealValue ?? "",
title: item.fieldName,
name: [fieldsKey],
required: false,
type: "input",
};
} else {
obj[fieldsKey] = {
value:
item?.fieldRealValue == 0 || item?.fieldRealValue
? item?.fieldRealValue
: item.fieldChar == 4
? []
: "",
title: item.fieldName,
name: [fieldsKey],
required: false,
type: item.fieldChar == 3 ? "radio" : "select",
options: item.valueList,
multiple: item.fieldChar == 4 ? true : false,
};
}
dispatch({
type: "edit",
fields: { ...defaultFields, ...result?.fields },
});
}
});
return {
obj,
data,
};
}
}, [curitem]);
const [collapsed, setCollapsed] = useState(false);
return (
<div>
<Layout
style={{
minHeight: "100%",
}}
>
<Sider
theme="light"
collapsible
collapsed={collapsed}
onCollapse={(value) => setCollapsed(value)}
>
{/* <TreeRender /> */}
123
</Sider>
<Content>
<AutoTable
pagetitle={props.route.name} //页面标题
pageextra={extrarender} //页面操作 新增or批量删除
columns={columns}
path="/ngic-auth/sysCustomer/queryList"
path="/ngic-auth/sysStorePosition/queryList"
actionRef={actionRef}
onRef={(node) => (ChildRef = node)}
></AutoTable>
</Content>
</Layout>
<Modal
maskClosable={false}
childposition="left"
extraparams={{ factoryId: materieTypeId }}
x={600}
>
<div
style={{
width: 260,
flexShrink: 0,
marginTop: -4,
borderRight: "1px solid #f0f0f0",
paddingRight: 12,
marginRight: 12,
}}
>
<TreeRender
url="/ngic-auth/sysFactory/queryFactoryStoreTree"
deleteurl="/ngic-auth/sysFactory/deleteById"
saveurl="/ngic-auth/sysFactory/save"
onselected={(vals) => {
setmaterieTypeId(vals[0] ?? "");
}}
/>
</div>
</AutoTable>
<Drawer
title={iftype.title}
visible={vs}
onCancel={() => dispatch({ type: "close" })}
onClose={() => dispatch({ type: "close" })}
footer={false}
destroyOnClose={true}
width={1000}
getContainer={false}
style={{ position: "absolute" }}
width={"100%"}
>
<InitForm
formRef={formRef}
fields={fields}
submitData={(values) => {
saveData(values);
onChange={(changedValues, allValues) => {}}
actions={() => {
return null;
}}
onChange={(changedValues, allValues) => {
//联动操作
}}
submitting={loading || !vs}
></InitForm>
</Modal>
<Button
style={{ width: "100%" }}
type="primary"
size="large"
loading={loading || !vs}
onClick={() => saveData()}
>
提交
</Button>
</Drawer>
<Details
title="客户详情"
closable={true}
title="物料详情"
visible={visible}
onClose={() => dispatch({ type: "close" })}
footer={false}
destroyOnClose={true}
afterVisibleChange={(v) => {}}
width="100%"
className="drawerDetails"
{...details}
width={"100%"}
{...detail}
></Details>
</div>
);
};
export default Reservoir;
export default Materiel;
......@@ -136,6 +136,7 @@ const Store = (props) => {
for (let i in defaultFields) {
defaultFields[i].value = record[i];
}
console.log(defaultFields);
dispatch({ type: "edit", fields: defaultFields, curitem: record });
}),
getPrem("sysDepartment_deleteById", action, "删除", null, {
......
......@@ -241,7 +241,7 @@ const userDetails = [
},
{
title: "角色",
key: "roleNames",
key: "roleName",
},
{
title: "直属领导",
......@@ -835,8 +835,8 @@ const shiftgroupDetail = [
},
{
title: "角色",
dataIndex: "roleNames",
key: "roleNames",
dataIndex: "roleName",
key: "roleName",
search: false,
},
{
......
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