Commit be8eed64 authored by krysent's avatar krysent

new

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