diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..7e3649a --- /dev/null +++ b/.editorconfig @@ -0,0 +1,16 @@ +# http://editorconfig.org +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false + +[Makefile] +indent_style = tab diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..4b31db0 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,57 @@ +{ + "parser": "babel-eslint", + "extends": "airbnb", + "env": { + "browser": true, + "node": true, + "es6": true, + "mocha": true, + "jest": true, + "jasmine": true + }, + "plugins": [ + "jsx-a11y" + ], + "rules": { + "arrow-body-style": [0], + "consistent-return": [0], + "generator-star-spacing": [0], + "global-require": [1], + "import/extensions": [0], + "import/no-extraneous-dependencies": [0], + "import/no-unresolved": [0], + "import/prefer-default-export": [0], + "jsx-a11y/no-static-element-interactions": [0], + "jsx-a11y/anchor-is-valid": [ "error", { + "components": [ "Link" ], + "specialLink": [ "hrefLeft", "hrefRight" ], + "aspects": [ "noHref", "invalidHref", "preferButton" ] + }], + "no-restricted-globals": ["error", "event", "fdescribe"], + "jsx-a11y/click-events-have-key-events": [0], + "no-bitwise": [0], + "no-cond-assign": [0], + "no-else-return": [0], + "no-nested-ternary": [0], + "no-restricted-syntax": [0], + "no-use-before-define": [0], + "react/forbid-prop-types": [0], + "react/jsx-filename-extension": [1, { "extensions": [".js"] }], + "react/jsx-no-bind": [0], + "react/prefer-stateless-function": [0], + "react/prop-types": [0], + "require-yield": [1], + "linebreak-style": 0, //去除eslint控制 LF/CRLF的判断 //packjson.json "set port=9000&&roadhog server" + "max-len": [0, 200, 4], //每行太多老要回车 + "no-param-reassign": [0], //禁止给参数重新赋值 + "react/no-multi-comp": [0], + "no-shadow": [0], + "no-await-in-loop": [0], + "camelcase": [1, {"properties": "never"}] + }, + "parserOptions": { + "ecmaFeatures": { + "experimentalObjectRestSpread": true + } + } +} diff --git a/.gitignore b/.gitignore index 8818726..cdc8ba3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,16 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies /node_modules -/.env.local -/.umirc.local.ts -/config/config.local.ts -/src/.umi -/src/.umi-production -/src/.umi-test +/.idea +package-lock.json +# production /dist -.swc -/.history /.vscode +pnpm-lock.yaml + +# misc .DS_Store +npm-debug.log* +/.history +/*.zip diff --git a/.npmrc b/.npmrc deleted file mode 100644 index 0b44d45..0000000 --- a/.npmrc +++ /dev/null @@ -1,2 +0,0 @@ -registry=https://registry.npmjs.com/ - diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index 5892e28..0000000 --- a/.prettierignore +++ /dev/null @@ -1,3 +0,0 @@ -node_modules -.umi -.umi-production diff --git a/.roadhogrc.mock.js b/.roadhogrc.mock.js new file mode 100644 index 0000000..02a61be --- /dev/null +++ b/.roadhogrc.mock.js @@ -0,0 +1,2 @@ +export default { +}; diff --git a/.umirc.ts b/.umirc.ts deleted file mode 100644 index c388150..0000000 --- a/.umirc.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { defineConfig } from "umi"; -import { join } from "path"; -import { readdirSync } from "fs"; - -const getIcons = () => { - const iconDir = join(__dirname, "src/icons"); - return readdirSync(iconDir) - .filter(file => file.endsWith(".svg")) - .map(file => `local:${file.replace(/\.svg$/, "")}`); -}; - -export default defineConfig({ - routes: [ - { path: "/", redirect: "/login" }, - { path: "/login", component: "@/routes/login/login" }, - { - path: "/indexPage", - component: "@/routes/indexPage", - routes: [{ path: "*" }], - }, - { - path: "/loginMobile", - component: "@/routes/mobile/login/LoginMobile", - }, - - { - path: "/indexMobile", - component: "@/routes/mobile/IndexMobile", - routes: [{ path: "*" }], - }, - ], - title: "小羚羊EBC前台业务系统", - favicons: ["/favicon.ico"], - npmClient: "pnpm", - dva: {}, - icons: { - include: getIcons(), - }, - plugins: ["@umijs/plugins/dist/dva"], - mfsu: false, -}); diff --git a/.webpackrc.js b/.webpackrc.js new file mode 100644 index 0000000..b0b5c32 --- /dev/null +++ b/.webpackrc.js @@ -0,0 +1,76 @@ +export default { + "entry": { + index: "./src/index.js", + "vendor": [ + "react", + "react-dom", + "dva", + "prop-types", + "lodash", + "classnames" + ], + "antd": [ + "antd/lib/button", + "antd/lib/icon", + "antd/lib/breadcrumb", + "antd/lib/form", + "antd/lib/menu", + "antd/lib/input", + "antd/lib/input-number", + "antd/lib/dropdown", + "antd/lib/table", + "antd/lib/tabs", + "antd/lib/modal", + "antd/lib/row", + "antd/lib/col" + ], + "components":[ + "./src/components/Common/CommonComponent" + ] + }, + "disableCSSModules": false, + "publicPath": "/", + "hash": true, + "extraBabelPlugins": [ + ["import", { "libraryName": "antd"}, "pc"], + ["import", { "libraryName": "antd-mobile", "style": true }, "mobile"] + ], + "define": { 'process.env.API': process.env.API }, + "env": { + "development": { + "extraBabelPlugins": [ + "dva-hmr", "dynamic-import-node" + ], + }, + "dllPlugin": { + "exclude": [ + "babel-runtime", + "roadhog" + ], + "include": [ + "dva/router", + "dva/saga", + "dva/fetch" + ] + } + }, + "commons": [ + { + "names": ["vendor", "antd", "components"], + "minChunks": "Infinity" + } + ], + "lessLoaderOptions": { + "javascriptEnabled": true + }, + "theme": { + "@primary-color": "#1890FF", + "@link-color": "#1890FF", + "@table-header-bg": '#e6e6e6', + "@disabled-bg": '#fff', + "@table-border-color": '#d9d9d9', + "@border-color-split": '#d9d9d9', + "@font-family": "Monospaced Number, Chinese Quote, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Helvetica Neue, Helvetica, Arial, sans-serif", + }, + "html": { "template": "./src/index.ejs" } +} diff --git a/WW_verify_3IbaWKOXmkkYLaAK.txt b/WW_verify_3IbaWKOXmkkYLaAK.txt new file mode 100644 index 0000000..0574b89 --- /dev/null +++ b/WW_verify_3IbaWKOXmkkYLaAK.txt @@ -0,0 +1 @@ +3IbaWKOXmkkYLaAK diff --git a/app/index.html b/app/index.html new file mode 100644 index 0000000..82ad08e --- /dev/null +++ b/app/index.html @@ -0,0 +1,60 @@ + + + + + + + + + + + + + diff --git a/app/js/common.js b/app/js/common.js new file mode 100644 index 0000000..faea56d --- /dev/null +++ b/app/js/common.js @@ -0,0 +1,37 @@ +/** + * @param {String} protocol 协议, http/https + * @param {string} url url地址 + * @param {number} port + */ +// eslint-disable-next-line no-unused-vars +function setUrlData(protocol, url, port) { + // eslint-disable-next-line no-undef + plus.storage.setItem('urlData', JSON.stringify({ + protocol, + url, + port, + })); +} + +/** + * @return {{protocol:'http'|'https', url:string, port:number} | null} + */ +// eslint-disable-next-line no-unused-vars +function getUrlData() { + // eslint-disable-next-line no-undef + const str = plus.storage.getItem('urlData'); + try { + return JSON.parse(str); + } catch (e) { + return null; + } +} + +// eslint-disable-next-line no-unused-vars +function getDefaultUrlData() { + return { + protocol: 'http', + url: '118.178.131.219', + port: 8088, + }; +} diff --git a/app/manifest.json b/app/manifest.json new file mode 100644 index 0000000..ebccb67 --- /dev/null +++ b/app/manifest.json @@ -0,0 +1,317 @@ +{ + "@platforms" : [ "android", "iPhone", "iPad" ], + "id" : "H5DCD0C6A", + /*应用的标识*/ + "name" : "小羚羊EBC", + /*应用名称,程序桌面图标名称*/ + "version" : { + "name" : "1.1", + /*应用版本名称*/ + "code" : 101 + }, + "description" : "", + /*应用描述信息*/ + "icons" : { + "72" : "icon.png" + }, + "launch_path" : "index.html", + /*应用的入口页面,默认为根目录下的index.html;支持网络地址,必须以http://或https://开头*/ + "developer" : { + "name" : "", + /*开发者名称*/ + "email" : "", + /*开发者邮箱地址*/ + "url" : "" /*开发者个人主页地址*/ + }, + "permissions" : { + "Accelerometer" : { + "description" : "访问加速度感应器" + }, + "Audio" : { + "description" : "访问麦克风" + }, + "Messaging" : { + "description" : "短彩邮件插件" + }, + "Cache" : { + "description" : "管理应用缓存" + }, + "Camera" : { + "description" : "访问摄像头" + }, + "Console" : { + "description" : "跟踪调试输出日志" + }, + "Contacts" : { + "description" : "访问系统联系人信息" + }, + "Device" : { + "description" : "访问设备信息" + }, + "Downloader" : { + "description" : "文件下载管理" + }, + "Events" : { + "description" : "应用扩展事件" + }, + "File" : { + "description" : "访问本地文件系统" + }, + "Gallery" : { + "description" : "访问系统相册" + }, + "Geolocation" : { + "description" : "访问位置信息" + }, + "Invocation" : { + "description" : "使用Native.js能力" + }, + "Orientation" : { + "description" : "访问方向感应器" + }, + "Proximity" : { + "description" : "访问距离感应器" + }, + "Storage" : { + "description" : "管理应用本地数据" + }, + "Uploader" : { + "description" : "管理文件上传任务" + }, + "Runtime" : { + "description" : "访问运行期环境" + }, + "XMLHttpRequest" : { + "description" : "跨域网络访问" + }, + "Zip" : { + "description" : "文件压缩与解压缩" + }, + "Barcode" : { + "description" : "管理二维码扫描插件" + }, + "Maps" : { + "description" : "管理地图插件" + }, + "Speech" : { + "description" : "管理语音识别插件" + }, + "Webview" : { + "description" : "窗口管理" + }, + "NativeUI" : { + "description" : "原生UI控件" + }, + "Navigator" : { + "description" : "浏览器信息" + }, + "NativeObj" : { + "description" : "原生对象" + } + }, + "plus" : { + "error" : { + "url" : "/setting.html" + }, + "splashscreen" : { + "autoclose" : true, + /*是否自动关闭程序启动界面,true表示应用加载应用入口页面后自动关闭;false则需调plus.navigator.closeSplashscreen()关闭*/ + "waiting" : true, /*是否在程序启动界面显示等待雪花,true表示显示,false表示不显示。*/ + "delay" : 1 + }, + "popGesture" : "close", + /*设置应用默认侧滑返回关闭Webview窗口,"none"为无侧滑返回功能,"hide"为侧滑隐藏Webview窗口。参考http://ask.dcloud.net.cn/article/102*/ + "runmode" : "normal", + /*应用的首次启动运行模式,可取liberate或normal,liberate模式在第一次启动时将解压应用资源(Android平台File API才可正常访问_www目录)*/ + "signature" : "Sk9JTiBVUyBtYWlsdG86aHIyMDEzQGRjbG91ZC5pbw==", + /*可选,保留给应用签名,暂不使用*/ + "distribute" : { + "apple" : { + "appid" : "", + /*iOS应用标识,苹果开发网站申请的appid,如io.dcloud.HelloH5*/ + "mobileprovision" : "", + /*iOS应用打包配置文件*/ + "password" : "", + /*iOS应用打包个人证书导入密码*/ + "p12" : "", + /*iOS应用打包个人证书,打包配置文件关联的个人证书*/ + "devices" : "universal", + /*iOS应用支持的设备类型,可取值iphone/ipad/universal*/ + "frameworks" : [] /*调用Native.js调用原生Objective-c API需要引用的FrameWork,如需调用GameCenter,则添加"GameKit.framework"*/ + }, + "google" : { + "packagename" : "", + /*Android应用包名,如io.dcloud.HelloH5*/ + "keystore" : "", + /*Android应用打包使用的密钥库文件*/ + "password" : "", + /*Android应用打包使用密钥库中证书的密码*/ + "aliasname" : "", + /*Android应用打包使用密钥库中证书的别名*/ + "permissions" : [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ] + }, + /*使用Native.js调用原生安卓API需要使用到的系统权限*/ + "orientation" : [ "portrait-primary" ], + /*应用支持的方向,portrait-primary:竖屏正方向;portrait-secondary:竖屏反方向;landscape-primary:横屏正方向;landscape-secondary:横屏反方向*/ + "icons" : { + "ios" : { + "prerendered" : true, + /*应用图标是否已经高亮处理,在iOS6及以下设备上有效*/ + "auto" : "", + /*应用图标,分辨率:512x512,用于自动生成各种尺寸程序图标*/ + "iphone" : { + "normal" : "", + /*iPhone3/3GS程序图标,分辨率:57x57*/ + "retina" : "", + /*iPhone4程序图标,分辨率:114x114*/ + "retina7" : "", + /*iPhone4S/5/6程序图标,分辨率:120x120*/ + "retina8" : "", + /*iPhone6 Plus程序图标,分辨率:180x180*/ + "spotlight-normal" : "", + /*iPhone3/3GS Spotlight搜索程序图标,分辨率:29x29*/ + "spotlight-retina" : "", + /*iPhone4 Spotlight搜索程序图标,分辨率:58x58*/ + "spotlight-retina7" : "", + /*iPhone4S/5/6 Spotlight搜索程序图标,分辨率:80x80*/ + "settings-normal" : "", + /*iPhone4设置页面程序图标,分辨率:29x29*/ + "settings-retina" : "", + /*iPhone4S/5/6设置页面程序图标,分辨率:58x58*/ + "settings-retina8" : "", /*iPhone6Plus设置页面程序图标,分辨率:87x87*/ + "app@2x" : "unpackage/res/icons/120x120.png", + "app@3x" : "unpackage/res/icons/180x180.png", + "notification@2x" : "unpackage/res/icons/40x40.png", + "notification@3x" : "unpackage/res/icons/60x60.png", + "settings@2x" : "unpackage/res/icons/58x58.png", + "settings@3x" : "unpackage/res/icons/87x87.png", + "spotlight@2x" : "unpackage/res/icons/80x80.png", + "spotlight@3x" : "unpackage/res/icons/120x120.png" + }, + "ipad" : { + "normal" : "", + /*iPad普通屏幕程序图标,分辨率:72x72*/ + "retina" : "", + /*iPad高分屏程序图标,分辨率:144x144*/ + "normal7" : "", + /*iPad iOS7程序图标,分辨率:76x76*/ + "retina7" : "", + /*iPad iOS7高分屏程序图标,分辨率:152x152*/ + "spotlight-normal" : "", + /*iPad Spotlight搜索程序图标,分辨率:50x50*/ + "spotlight-retina" : "", + /*iPad高分屏Spotlight搜索程序图标,分辨率:100x100*/ + "spotlight-normal7" : "", + /*iPad iOS7 Spotlight搜索程序图标,分辨率:40x40*/ + "spotlight-retina7" : "", + /*iPad iOS7高分屏Spotlight搜索程序图标,分辨率:80x80*/ + "settings-normal" : "", + /*iPad设置页面程序图标,分辨率:29x29*/ + "settings-retina" : "", /*iPad高分屏设置页面程序图标,分辨率:58x58*/ + "app" : "unpackage/res/icons/76x76.png", + "app@2x" : "unpackage/res/icons/152x152.png", + "notification" : "unpackage/res/icons/20x20.png", + "notification@2x" : "unpackage/res/icons/40x40.png", + "proapp@2x" : "unpackage/res/icons/167x167.png", + "settings" : "unpackage/res/icons/29x29.png", + "settings@2x" : "unpackage/res/icons/58x58.png", + "spotlight" : "unpackage/res/icons/40x40.png", + "spotlight@2x" : "unpackage/res/icons/80x80.png" + }, + "appstore" : "unpackage/res/icons/1024x1024.png" + }, + "android" : { + "mdpi" : "", + /*普通屏程序图标,分辨率:48x48*/ + "ldpi" : "", + /*大屏程序图标,分辨率:48x48*/ + "hdpi" : "unpackage/res/icons/72x72.png", + /*高分屏程序图标,分辨率:72x72*/ + "xhdpi" : "unpackage/res/icons/96x96.png", + /*720P高分屏程序图标,分辨率:96x96*/ + "xxhdpi" : "unpackage/res/icons/144x144.png", /*1080P 高分屏程序图标,分辨率:144x144*/ + "xxxhdpi" : "unpackage/res/icons/192x192.png" + } + }, + "splashscreen" : { + "ios" : { + "iphone" : { + "default" : "", + /*iPhone3启动图片选,分辨率:320x480*/ + "retina35" : "", + /*3.5英寸设备(iPhone4)启动图片,分辨率:640x960*/ + "retina40" : "", + /*4.0 英寸设备(iPhone5/iPhone5s)启动图片,分辨率:640x1136*/ + "retina47" : "", + /*4.7 英寸设备(iPhone6)启动图片,分辨率:750x1334*/ + "retina55" : "", + /*5.5 英寸设备(iPhone6 Plus)启动图片,分辨率:1242x2208*/ + "retina55l" : "" /*5.5 英寸设备(iPhone6 Plus)横屏启动图片,分辨率:2208x1242*/ + }, + "ipad" : { + "portrait" : "", + /*iPad竖屏启动图片,分辨率:768x1004*/ + "portrait-retina" : "", + /*iPad高分屏竖屏图片,分辨率:1536x2008*/ + "landscape" : "", + /*iPad横屏启动图片,分辨率:1024x748*/ + "landscape-retina" : "", + /*iPad高分屏横屏启动图片,分辨率:2048x1496*/ + "portrait7" : "", + /*iPad iOS7竖屏启动图片,分辨率:768x1024*/ + "portrait-retina7" : "", + /*iPad iOS7高分屏竖屏图片,分辨率:1536x2048*/ + "landscape7" : "", + /*iPad iOS7横屏启动图片,分辨率:1024x768*/ + "landscape-retina7" : "" /*iPad iOS7高分屏横屏启动图片,分辨率:2048x1536*/ + } + }, + "android" : { + "mdpi" : "", + /*普通屏启动图片,分辨率:240x282*/ + "ldpi" : "", + /*大屏启动图片,分辨率:320x442*/ + "hdpi" : "", + /*高分屏启动图片,分辨率:480x762*/ + "xhdpi" : "", + /*720P高分屏启动图片,分辨率:720x1242*/ + "xxhdpi" : "" /*1080P高分屏启动图片,分辨率:1080x1882*/ + }, + "androidStyle" : "common" + }, + "plugins" : { + "speech" : { + "ifly" : {} + }, + "ad" : {} + }, + "ios" : { + "dSYMs" : false + } + } + }, + "screenOrientation" : [ "portrait-primary" ] +} diff --git a/app/setting.html b/app/setting.html new file mode 100644 index 0000000..5fbbcfc --- /dev/null +++ b/app/setting.html @@ -0,0 +1,158 @@ + + + + + + + + + + + +
服务器设置
+
+

协议

+ + +

IP地址

+ +

端口号

+ +
+ + +
+
+ + diff --git a/app/unpackage/res/icons/1024x1024.png b/app/unpackage/res/icons/1024x1024.png new file mode 100644 index 0000000..149cc10 --- /dev/null +++ b/app/unpackage/res/icons/1024x1024.png diff --git a/app/unpackage/res/icons/120x120.png b/app/unpackage/res/icons/120x120.png new file mode 100644 index 0000000..62d878f --- /dev/null +++ b/app/unpackage/res/icons/120x120.png diff --git a/app/unpackage/res/icons/144x144.png b/app/unpackage/res/icons/144x144.png new file mode 100644 index 0000000..e585500 --- /dev/null +++ b/app/unpackage/res/icons/144x144.png diff --git a/app/unpackage/res/icons/152x152.png b/app/unpackage/res/icons/152x152.png new file mode 100644 index 0000000..1cc2611 --- /dev/null +++ b/app/unpackage/res/icons/152x152.png diff --git a/app/unpackage/res/icons/167x167.png b/app/unpackage/res/icons/167x167.png new file mode 100644 index 0000000..f0f0e35 --- /dev/null +++ b/app/unpackage/res/icons/167x167.png diff --git a/app/unpackage/res/icons/180x180.png b/app/unpackage/res/icons/180x180.png new file mode 100644 index 0000000..9789c37 --- /dev/null +++ b/app/unpackage/res/icons/180x180.png diff --git a/app/unpackage/res/icons/192x192.png b/app/unpackage/res/icons/192x192.png new file mode 100644 index 0000000..4c412eb --- /dev/null +++ b/app/unpackage/res/icons/192x192.png diff --git a/app/unpackage/res/icons/20x20.png b/app/unpackage/res/icons/20x20.png new file mode 100644 index 0000000..1e8355e --- /dev/null +++ b/app/unpackage/res/icons/20x20.png diff --git a/app/unpackage/res/icons/29x29.png b/app/unpackage/res/icons/29x29.png new file mode 100644 index 0000000..240a4e9 --- /dev/null +++ b/app/unpackage/res/icons/29x29.png diff --git a/app/unpackage/res/icons/40x40.png b/app/unpackage/res/icons/40x40.png new file mode 100644 index 0000000..78430de --- /dev/null +++ b/app/unpackage/res/icons/40x40.png diff --git a/app/unpackage/res/icons/58x58.png b/app/unpackage/res/icons/58x58.png new file mode 100644 index 0000000..4a8828a --- /dev/null +++ b/app/unpackage/res/icons/58x58.png diff --git a/app/unpackage/res/icons/60x60.png b/app/unpackage/res/icons/60x60.png new file mode 100644 index 0000000..3fceaea --- /dev/null +++ b/app/unpackage/res/icons/60x60.png diff --git a/app/unpackage/res/icons/72x72.png b/app/unpackage/res/icons/72x72.png new file mode 100644 index 0000000..c8ffe62 --- /dev/null +++ b/app/unpackage/res/icons/72x72.png diff --git a/app/unpackage/res/icons/76x76.png b/app/unpackage/res/icons/76x76.png new file mode 100644 index 0000000..3e019ce --- /dev/null +++ b/app/unpackage/res/icons/76x76.png diff --git a/app/unpackage/res/icons/80x80.png b/app/unpackage/res/icons/80x80.png new file mode 100644 index 0000000..30f2af3 --- /dev/null +++ b/app/unpackage/res/icons/80x80.png diff --git a/app/unpackage/res/icons/87x87.png b/app/unpackage/res/icons/87x87.png new file mode 100644 index 0000000..43ab230 --- /dev/null +++ b/app/unpackage/res/icons/87x87.png diff --git a/app/unpackage/res/icons/96x96.png b/app/unpackage/res/icons/96x96.png new file mode 100644 index 0000000..3cff85a --- /dev/null +++ b/app/unpackage/res/icons/96x96.png diff --git a/app/unpackage/res/icons/移动端LOGO-16-2.png b/app/unpackage/res/icons/移动端LOGO-16-2.png new file mode 100644 index 0000000..096b345 --- /dev/null +++ b/app/unpackage/res/icons/移动端LOGO-16-2.png diff --git a/app/unpackage/res/icons/移动端LOGO-512-2.png b/app/unpackage/res/icons/移动端LOGO-512-2.png new file mode 100644 index 0000000..36186d8 --- /dev/null +++ b/app/unpackage/res/icons/移动端LOGO-512-2.png diff --git a/package.json b/package.json index e398a5b..48cda63 100644 --- a/package.json +++ b/package.json @@ -1,60 +1,155 @@ { + "name": "dik-dik", + "version": "1.0.5", "private": true, - "author": "zhangzhen <525765282@qq.com>", "scripts": { - "dev": "cross-env PORT=9000 umi dev", - "build": "umi build", - "postinstall": "umi setup", - "setup": "umi setup", - "start": "npm run dev" + "start": "cross-env PORT=8035 roadhog server --progress --watch --colors --profile", + "build": "roadhog build", + "lint": "eslint --ext .js src test", + "precommit": "npm run lint" + }, + "engines": { + "install-node": "6.9.2" }, "dependencies": { - "@ant-design/compatible": "^1.1.2", - "@ant-design/icons": "^5.6.1", - "@antv/data-set": "^0.11.8", + "@ant-design/compatible": "^1.0.8", + "@ant-design/icons": "^4.6.2", + "@antv/data-set": "0.10.1", "@antv/g2": "^4.1.24", - "@js-preview/docx": "^1.6.4", - "@js-preview/excel": "^1.7.14", + "@js-preview/docx": "^1.3.0", + "@js-preview/excel": "^1.4.4", "@js-preview/pdf": "^2.0.10", - "antd": "^5.24.3", - "antd-mobile": "5.37.1", - "antd-mobile-icons": "^0.3.0", - "antd-mobile-v2": "2.3.4", - "antd-v4": "npm:antd@4.24.16", - "braft-editor": "^2.3.9", - "classnames": "^2.5.1", - "dhtmlx-gantt": "^9.0.6", - "g2": "^2.3.13", - "g2-plugin-slider": "^1.2.1", - "immutability-helper": "^3.1.1", - "lodash": "^4.17.21", - "lodash-decorators": "^6.0.1", - "moment": "^2.30.1", - "numeral": "^2.0.6", - "rc-form": "2.4.11", - "react-dnd": "^14.0.5", - "react-dnd-html5-backend": "^14.1.0", + "ahooks": "^2.10.9", + "antd": "^4.24.16", + "antd-mobile": "^2.3.1", + "babel-plugin-transform-decorators-legacy": "1.3.5", + "babel-polyfill": "6.26.0", + "babel-runtime": "6.26.0", + "classnames": "^2.2.6", + "copy-to-clipboard": "^3.3.1", + "core-js": "3.6.5", + "dhtmlx-gantt": "^7.1.6", + "dva": "^2.4.1", + "dva-router-config": "^1.1.0", + "g-cloud": "1.0.2-beta", + "g2": "2.3.13", + "g2-plugin-slider": "1.2.1", + "history": "^5.3.0", + "immutability-helper": "^3.0.1", + "jsqr": "^1.3.1", + "lodash": "4.17.11", + "lodash-decorators": "6.0.0", + "lodash.clonedeep": "4.5.0", + "moment": "2.22.2", + "numeral": "2.0.6", + "prop-types": "15.6.2", + "qs": "6.5.2", + "quagga": "^0.12.1", + "rc-form": "^2.4.11", + "react": "^18.2.0", + "react-container-query": "0.11.0", + "react-dnd": "^14.0.2", + "react-dnd-html5-backend": "^14.0.0", + "react-document-title": "2.0.3", + "react-dom": "^18.2.0", "react-draggable": "4.4.5", "react-fittext": "1.0.0", - "react-flow-renderer": "^10.3.17", - "react-grid-layout": "^1.3.4", - "react-highlight-words": "^0.21.0", - "react-pdf": "^5.7.2", - "react-resizable": "^3.0.5", + "react-flow-renderer": "^10.3.16", + "react-grid-layout": "1.3.4", + "react-highlight-words": "0.16.0", + "react-hot-keys": "1.3.1", + "react-pdf": "^5.5.0", + "react-resizable": "^3.0.4", "react-sortable-hoc": "^2.0.0", - "react-to-print": "^3.0.5", - "umi": "^4.4.11", - "weixin-js-sdk": "1.6.0", - "xlsx": "^0.18.5" + "react-to-print": "^3.0.2", + "react-window": "^1.8.6", + "sortablejs": "^1.15.0", + "terser-webpack-plugin-legacy": "^1.2.5", + "url-loader": "^4.1.1", + "vconsole": "^3.3.4", + "virtuallist-antd": "^0.6.3", + "weixin-js-sdk": "^1.6.0" }, "devDependencies": { - "@types/react": "^18.0.33", - "@types/react-dom": "^18.0.11", - "@umijs/plugins": "^4.4.6", - "cross-env": "^7.0.3", - "prettier": "^2.8.8", - "prettier-plugin-organize-imports": "^3.2.2", - "prettier-plugin-packagejson": "^2.4.3", - "typescript": "^5.0.3" - } -} \ No newline at end of file + "antd-mobile-icons": "^0.3.0", + "babel-eslint": "8.2.5", + "babel-jest": "21.0.0", + "babel-plugin-dva-hmr": "0.4.1", + "babel-plugin-dynamic-import-node": "^2.3.3", + "babel-plugin-import": "1.11.0", + "babel-plugin-transform-class-properties": "6.24.1", + "babel-plugin-transform-decorators-legacy": "1.3.4", + "babel-plugin-transform-runtime": "6.23.0", + "babel-preset-env": "1.7.0", + "babel-preset-react": "6.24.1", + "braft-editor": "^2.3.9", + "cross-env": "5.2.0", + "cross-port-killer": "1.0.1", + "dva-router-config": "^1.1.0", + "enzyme": "3.7.0", + "enzyme-adapter-react-16": "1.6.0", + "eslint": "4.19.1", + "eslint-config-airbnb": "16.1.0", + "eslint-plugin-babel": "4.1.2", + "eslint-plugin-compat": "2.6.2", + "eslint-plugin-import": "2.14.0", + "eslint-plugin-jsx-a11y": "6.1.2", + "eslint-plugin-markdown": "1.0.0-beta.6", + "eslint-plugin-react": "7.11.1", + "expect": "1.20.2", + "gh-pages": "1.2.0", + "jest": "21.2.1", + "lint-staged": "4.3.0", + "lodash.flow": "^3.5.0", + "mockjs": "1.0.1-beta3", + "prettier": "1.14.3", + "pro-download": "1.0.1", + "react-test-renderer": "15.6.1", + "redbox-react": "1.6.0", + "roadhog-api-doc": "0.3.4", + "rollbar": "2.5.0", + "stylelint": "9.7.1", + "stylelint-config-standard": "18.2.0", + "svg-sprite-loader": "^6.0.11", + "svgo-loader": "^3.0.0", + "xly_roadhog": "^1.2.3" + }, + "optionalDependencies": { + "nightmare": "2.10.0" + }, + "babel": { + "presets": [ + "env", + "react" + ], + "plugins": [ + "transform-decorators-legacy", + "transform-class-properties" + ] + }, + "jest": { + "setupFiles": [ + "/tests/setupTests.js" + ], + "testMatch": [ + "**/?(*.)(spec|test|e2e).js?(x)" + ], + "setupTestFrameworkScriptFile": "/tests/jasmine.js", + "moduleFileExtensions": [ + "js", + "jsx" + ], + "moduleNameMapper": { + "\\.(css|less)$": "/tests/styleMock.js" + } + }, + "lint-staged": { + "**/*.{js,jsx}": "lint-staged:js", + "**/*.less": "stylelint --syntax less" + }, + "browserslist": [ + "> 1%", + "last 2 versions", + "not ie <= 10" + ] +} diff --git a/public/about.html b/public/about.html new file mode 100644 index 0000000..eedf218 --- /dev/null +++ b/public/about.html @@ -0,0 +1,22 @@ + + + + + + 用户协议与隐私政策 + + +
+

用户协议与隐私政策

+

感谢您选择小羚羊EBC!
+ 我们非常重视您的个人信息和隐私保护。为了更好地保障您的个人权益,在您使用我们的产品前,请务必审慎阅读 + 《小羚羊EBC服务协议》与 + 《小羚羊EBC隐私政策》内的所有条款,尤其是:
+ 1.我们对您的个人信息的收集/保存/使用/对外提供/保护等规则条款,以及您的用户权利等条款;
+ 2.约定我们的限制责任、免责条款。
+ 3.其他以颜色或加粗进行标识的重要条款。
+ 如您对以上协议有任何疑问,可通过人工客服或发邮件至yanghl@xlyerp.com与我们联系。


+
+
+ + diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..a2e3aa0 --- /dev/null +++ b/public/favicon.ico diff --git a/public/favicons.ico b/public/favicons.ico deleted file mode 100644 index a783c3e..0000000 --- a/public/favicons.ico +++ /dev/null diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..ffab51c --- /dev/null +++ b/public/index.html @@ -0,0 +1,28 @@ + + + + + + + 小羚羊EBC前台业务系统 + + + + + + + +
+ + + + + + + + + + + + + diff --git a/public/pinban.json b/public/pinban.json new file mode 100644 index 0000000..4caeab7 --- /dev/null +++ b/public/pinban.json @@ -0,0 +1,5 @@ +{ + "mianhuaUrl": "http://hybridsoftware.net.cn:9090", + "fileQueryUrl": "http://8.210.130.8:8080/xlyApi/api/invoke/SP_interface_Get_002", + "uploadFileUrl": "http://8.210.130.8:8888/xlyReport/file/uploadMultiMh" +} \ No newline at end of file diff --git a/public/privacyPolicy.html b/public/privacyPolicy.html new file mode 100644 index 0000000..42e85e9 --- /dev/null +++ b/public/privacyPolicy.html @@ -0,0 +1,40 @@ + + + + + + 小羚羊EBC隐私政策 + + +本应用非常重视用户隐私政策并严格遵守相关的法律规定。请您仔细阅读《隐私政策》后再继续使用。如果您继续使用我们的服务,表示您已经充分阅读和理解我们协议的全部内容。 +本app尊重并保护所有使用服务用户的个人隐私权。为了给您提供更准确、更优质的服务,本应用会按照本隐私权政策的规定使用和披露您的个人信息。除本隐私权政策另有规定外,在未征得您事先许可的情况下,本应用不会将这些信息对外披露或向第三方提供。本应用会不时更新本隐私权政策。您在同意本应用服务使用协议之时,即视为您已经同意本隐私权政策全部内容。 +1.适用范围 +(a)在您注册本应用app帐号时,您根据app要求提供的个人注册信息; +(b)在您使用本应用网络服务,或访问本应用平台网页时,本应用自动接收并记录的您的浏览器和计算机上的信息,包括但不限于您的IP地址、浏览器的类型、使用的语言、访问日期和时间、软硬件特征信息及您需求的网页记录等数据; +(c)本应用通过合法途径从商业伙伴处取得的用户个人数据。 +(d)本应用严禁用户发布不良信息,如裸露、色情和亵渎内容,发布的内容我们会进行审核,一经发现不良信息,会禁用该用户的所有权限,予以封号处理。 +2.信息使用 +(a)本应用不会向任何无关第三方提供、出售、出租、分享或交易您的个人登录信息。如果我们存储发生维修或升级,我们会事先发出推送消息来通知您,请您提前允许本应用消息通知。 +(b)本应用亦不允许任何第三方以任何手段收集、编辑、出售或者无偿传播您的个人信息。任何本应用平台用户如从事上述活动,一经发现,本应用有权立即终止与该用户的服务协议。 +(c)为服务用户的目的,本应用可能通过使用您的个人信息,向您提供您感兴趣的信息,包括但不限于向您发出产品和服务信息,或者与本应用合作伙伴共享信息以便他们向您发送有关其产品和服务的信息(后者需要您的事先同意)。 +3.信息披露 +在如下情况下,本应用将依据您的个人意愿或法律的规定全部或部分的披露您的个人信息: +(a)未经您事先同意,我们不会向第三方披露; +(b)为提供您所要求的产品和服务,而必须和第三方分享您的个人信息; +(c)根据法律的有关规定,或者行政或司法机构的要求,向第三方或者行政、司法机构披露; +(d)如您出现违反中国有关法律、法规或者本应用服务协议或相关规则的情况,需要向第三方披露; +(e)如您是适格的知识产权投诉人并已提起投诉,应被投诉人要求,向被投诉人披露,以便双方处理可能的权利纠纷; +4.信息存储和交换 +本应用收集的有关您的信息和资料将保存在本应用及(或)其关联公司的服务器上,这些信息和资料可能传送至您所在国家、地区或本应用收集信息和资料所在地的境外并在境外被访问、存储和展示。 +5. Cookie的使用 +(a)在您未拒绝接受cookies的情况下,本应用会在您的计算机上设定或取用cookies,以便您能登录或使用依赖于cookies的本应用平台服务或功能。本应用使用cookies可为您提供更加周到的个性化服务,包括推广服务。 +(b)您有权选择接受或拒绝接受cookies。您可以通过修改浏览器设置的方式拒绝接受cookies。但如果您选择拒绝接受cookies,则您可能无法登录或使用依赖于cookies的本应用网络服务或功能。 +(c)通过本应用所设cookies所取得的有关信息,将适用本政策。 +6.本隐私政策的更改 +(a)如果决定更改隐私政策,我们会在本政策中、本公司网站中以及我们认为适当的位置发布这些更改,以便您了解我们如何收集、使用您的个人信息,哪些人可以访问这些信息,以及在什么情况下我们会透露这些信息。 +(b)本公司保留随时修改本政策的权利,因此请经常查看。如对本政策作出重大更改,本公司会通过网站通知的形式告知。 +方披露自己的个人信息,如联络方式或者邮政地址。请您妥善保护自己的个人信息,仅在必要的情形下向他人提供。如您发现自己的个人信息泄密,尤其是本应用用户名及密码发生泄露,请您立即联络本应用客服,以便本应用采取相应措施。 +感谢您花时间了解我们的隐私政策!我们将尽全力保护您的个人信息和合法权益,再次感谢您的信任!
+
+ + diff --git a/public/serviceAgreement.html b/public/serviceAgreement.html new file mode 100644 index 0000000..862b246 --- /dev/null +++ b/public/serviceAgreement.html @@ -0,0 +1,133 @@ + + + + + + 小羚羊EBC用户服务协议 + + +一、前言 +小羚羊EBC依据《 小羚羊EBC(用户版)服务协议》(以下简称“本协议”)的规定提供服务,本协议具有合同效力。用户注册时,请您认真阅读本协议,审阅并接受或不接受本协议(未成年人应在法定监护人陪同下审阅)。若您已经注册为小羚羊EBC用户,即表示您已充分阅读、理解并同意自己与小羚羊EBC订立本协议,且您自愿受本协议的条款约束。小羚羊EBC有权随时变更本协议并在小羚羊EBC上予以公告。经修订的条款一经在小羚羊EBC公布后,立即自动生效。如您不同意相关变更,必须停止使用小羚羊EBC。本协议内容包括协议正文及所有小羚羊EBC已经发布的各类规则。所有规则为本协议不可分割的一部分,与本协议正文具有同等法律效力。一旦您继续使用小羚羊EBC,则表示您已接受并自愿遵守经修订后的条款。 +二、用户资格 +只有符合下列条件之一的自然人或法人才能申请成为小羚羊EBC用户,可以使用 +小羚羊EBC的服务: +a.年满十八周岁,并具有民事权利能力和民事行为能力的自然人; +b.无民事行为能力人或限制民事行为能力人应经过其监护人的同意; +c.根据中国法律、法规、行政规章成立并合法存在的机关、企事业单位、社团 组织和其他组织。无法人资格的单位或组织不应当注册为小羚羊EBC用户的,其与小羚羊EBC之间的协议自始无效,小羚羊EBC一经发现,有权立即终止对该用户的服务,并追究其使用小羚羊EBC服务的一切法律责任。 +三、用户的权利和义务 +1.用户有权根据本协议及小羚羊EBC发布的相关规则,利用羚羊ERP寻找专家咨询,向其他用户发送资料,参加小羚羊EBC的有关活动及有权享受小羚羊EBC提供的其他有关资讯及信息服务; +2.用户须自行负责自己的用户账号和密码,且须对在用户账号密码下发生的所有活动(包括但不限于发起咨询、 参加官方活动、发送及接受文件等)承担责任。用户有权根据需要更改登录和账户提现密码。因用户的过错导致的任何损失由用 户自行承担,该过错包括但不限于:不按照提示操作,未及时进行操作,遗忘或泄漏密码,密码被他人破解,您使用的移动端被他人侵入; +3.用户应当向小羚羊EBC提供真实准确的注册信息。同时,用户也应当在相关资料实际变更时及时更新有关注册资料; +4.用户不得以任何形式擅自转让或授权他人使用自己在小羚羊EBC的用户帐号; +5.用户有义务确保在小羚羊EBC上所咨询的内容真实有效; +6.用户在小羚羊EBC上进行咨询以及向专家咨询时所产生的信息,不得违反国家法律、法规、行政规章的规定、不得侵犯他人知识产权或其他合法权益的信息、不得违背社会公共利益或公共道德、不得违反 小羚羊EBC的相关规定; +7.用户在 小羚羊EBC咨询中应当遵守诚实信用原则,不得干预或操纵扰乱 小羚羊EBC秩序,不得进行与咨询无关的不当行为; +8.用户不得参与帮助专家提高信用度(包括但不限于刷邀约、刷好评等方式)的行为,或采用不正当手段恶意评价其他专家,降低其他专家信用度; +9.用户承诺自己在使用小羚羊EBC实施的所有行为遵守法律、法规、行政规章和小羚羊EBC的相关规定以及各种社会公共利益或公共道德。如有违反导致任何法律后果的发生,用户将以自己的名义独立承担相应的法律责任; +10.用户在 小羚羊EBC咨询过程中如与其他专家因咨询产生纠纷,可以请求小羚羊EBC + +从中予以协调处理。 用户如发现其他用户或专家有违法或违反本协议的行为,可以向 小羚羊EBC举报; +11.用户应当自行承担因咨询产生的相关费用; +12.未经 小羚羊EBC书面允许,用户不得将小羚羊EBC的任何资料以及在咨询平台上所展示的任何信息作商业性利用 (包括但不限于以复制、修改、翻译等形式制作衍生作品、分发或公开展示); +13.用户不得使用以下方式登录小羚羊EBC或破坏小羚羊EBC所提供的服务: +a.任何机器人软件或其它自动方式访问或登录小羚羊EBC; +b.通过任何方式对本公司内部结构造成或可能造成不合理或不合比例的重大负荷的行为; +14.通过任何方式干扰或试图干扰小羚羊EBC的正常工作或小羚羊EBC上进行的任何活动。 +15.用户同意接收来自小羚羊EBC的信息,包括但不限于活动信息、咨询信息等。 +四、用户行为规则: +1.为了提升咨询者的咨询体验,专家的良好服务,维护小羚羊EBC正常运营秩序,对于违反行为规范的用户,小羚羊EBC将按照本规则规定的情形对用户进行处罚。 +2.您将同意:本 App 有权对小羚羊EBC咨询中产生的违规行为进行处理。本App 处理举报完全基于您的委托,本 App承诺秉持公平、公正、透明的态度处理违规行为,但本 App 并非权力机构,对相关证据只能以普通人的立场进行形式和内容上的审查和判断, 不保证举报处理结果符合您的期望,亦不对违规行为的处理结果承担任何责任。 +3.本规则只适用于中华人民共和国大陆境内咨询产生的纠纷,涉及到此范围以外的争议,不适用本规则。 +4.用户的违规行为,通过小羚羊EBC用户、专家、其他第三方投诉或小羚羊EBC排查发现。 +5.本规则自公布之日起实行。本规则中的“天”,以24 小时计算。 +6.在用户违规处理期间,小羚羊EBC将按照本规则规定的情形对用户采取以下违规处理措施: +a.限制参加营销活动:指限制用户参加小羚羊EBC官方发起的营销活动; +b.查封账户:指禁止违规账户登录小羚羊EBC。 +c.警告:指对该用户的行为进行口头或书面的警告通知。 +7.用户可在被违规处理之时起15 天内向客服提交违规申诉申请。 +8.经小羚羊EBC判定为违规行为类型及处罚措施如下所示: +线下咨询:用户发起线下咨询,专家同意的,包括但不限于以下情形: +a.用户从小羚羊EBC获取专家信息,无论以何种形式进行线下咨询的; +b.用户从小羚羊EBC以外的途径获取专家信息,单次咨询中,部分款项通过 小羚羊EBC支付,而另一部分通过其他途径支付的。 +c.无论金额大小,永久查封账户。 +恶意举报:指通过举报干扰正常咨询的行为,包含但不限于以下情形: +1.用户自己或利用他人,对专家的正常信息(包括但不限于咨询,评价等), +在短时间内进行多次举报, 严重妨碍其他专家正常咨询活动的行为。无论是否对其他专家造成直接或间接的影响,则暂时封停账号。 +2.指用户利用自己或他人账号,对正常咨询进行干扰,妨碍他人进行合理操作 +的行为,如查证,暂时封停该账号。 +辱骂污蔑他人:包括但不限于以下两种情况: +1.用户自己或利用他人,通过捏造、散布虚伪事实等不正当手段,对其他专家进行恶意的诋毁、贬低,辱骂等行为,计次数,三次以下警告,累计三次或三次以上暂停服务。 +2.在咨询过程中,用户通过小羚羊EBC对专家进行辱骂、诋毁、人身攻击等行为, 计次数,一次警告,累计三次以上暂停服务。盗用他人账户: 指盗用他人 小羚羊EBC账户, 涉嫌侵犯他人财产权的行为。 永久查封账户。骗取他人财物: 指用户通过 小羚羊EBC以非法获利为目的 (例如盗用他人品牌形象行骗等),非法获取他人财物,涉嫌侵犯他人财产权的行为。永久查封账户。并保 留申报相应执法部门权利。图文传输含联系方式:指用户发布的图文传输含有联系方式(包括但不限于QQ,电话号码,邮箱,网址),包括但不限于以下情形: +五、若用户或专家发布的信息被认定为含有联系方式,App将屏蔽该信息。 +六、小羚羊EBC的权利和义务 +1.小羚羊EBC仅为用户提供一个咨询信息交流平台,是普通用户发起咨询和专家提 供解决方案的一个服务平台,小羚羊EBC对服务双方均不加以监视或控制,亦不介入服务具体的流程; +2.小羚羊EBC有义务在现有技术水平的基础上努力确保整个移动端平台的正常运行,尽力避免服务中断或将中断时间限制在最短时间内,保证专家及用户活动的顺利进行; +3.为保障使用流程公平安全,小羚羊EBC为用户提供代付(即指用户将咨询费用充值至平台,平台代为向专家支付)服务。 +4.小羚羊EBC有义务对用户在注册使用 小羚羊EBC信息平台中所遇到的与充值或注册有关的问题及反映的情况及时作出回复; +5.用户因在 小羚羊EBC咨询过程与其他用户或专家产生纠纷的,将纠纷告知小羚羊EBC,或小羚羊EBC知悉纠纷情况的,经审核后,小羚羊EBC有权通过电话或任何联系方式联系向纠纷双方了解纠纷情况, 并将所了解的情况通过电话或任何联系方式互相通知 +对方;两方若通过司法机关依照法定程序要求小羚羊EBC提供相关资料,小羚羊EBC将积极配合并提供有关资料; +6.因移动服务平台的特殊性,小羚羊EBC没有义务对用户的咨询行为、专家的解答 行为以及与咨询有关的其他事项(包含但不限于图文传输等)进行事先审查, 但如发生以下情形,小羚羊EBC有权无需征得用户的同意限制用户的活动、向用户核实有关资料、发出警告通知、暂时中止、无限期中止及拒绝向该用户提供服务: +a.用户违反本协议或因被提及而纳入本协议的相关规则; +b.存在用户、专家或其他第三方通知小羚羊EBC,认为某个用户的具体咨询事项存在违法或不当行为, 并提供相关证据, 而小羚羊EBC无法联系到该用户核证或验证该用户向小羚羊EBC提供的任何资料; +c.存在用户、专家或其他第三方通知小羚羊EBC,认为某个用户或具体咨询事项存 在违法或不当行为,并提供相关证据。小羚羊EBC以普通非专业知识水平标准对相关 内容进行判别, 可以明显认为这些内容或行为可能对 小羚羊EBC专家或用户或 小羚羊EBC 造成财务损失或法律责任。 +7.根据国家法律、法规、行政规章规定、本协议的内容和小羚羊EBC所掌握的事实依据,可以认定该专家或用户存在违法或违反本协议行为以及在小羚羊EBC中进行的其他不当行为,小羚羊EBC有权无需征得用户的同意在小羚羊EBC服务平台及所在 小羚羊EBC上以公告形式公布该用户的违法行为, 并有权随时作出删除相关信息、终止服务提 供 等 处 理 ; +8.小羚羊EBC有权在不通知专家或用户的前提下,删除或采取其他限制性措施处理下列信息:包括但不限于以规避费用为目的;以炒作信用为目的; 存在欺诈等恶意或虚假内容; 与咨询无关或不是以咨询为目的;存在恶意评价或其他试图扰乱正常咨询秩序因素;违反公共利益或可能严重损害小羚羊EBC和其他专家或用户合法利益的信息。 +七、服务的中断和终止 +1.小羚羊EBC可自行全权决定以任何理由 ( 包括但不限于 小羚羊EBC认为用户或专家已违反本协议及相关规则的字面意义和精神,以及专家或用户在超过180 日内未登录 +小羚羊EBC等) 终止对用户的服务, 并有权在两年内保存用户在 小羚羊EBC的全部资料(包括但不限于用户信息、产品信息、咨询信息等)。同时 小羚羊EBC可自行全权决定, 在发出通知或不发出通知的情况下, 随时停止提供全部或部分服务。 服务终止后, +小羚羊EBC没有义务为专家或用户保留原账户中或与之相关的任何信息,或转发任何未曾阅读或发送的信息给专家或用户或第三方; +2.若用户申请终止小羚羊EBC服务,需经 小羚羊EBC审核同意,方可解除与小羚羊EBC的协议关系,但 小羚羊EBC仍保留下列权利: +a.小羚羊EBC有权在法律、法规、行政规章规定的时间内保留该用户的资料,包括但不限于以前的用户资料、咨询记录等; +b.若终止服务之前,该用户在 小羚羊EBC服务平台上存在违法行为或违反本协议的行为,小羚羊EBC仍可行使本协议所规定的权利。3.用户存在下列情况, 小羚羊EBC可以终止向该用户提供服务; +a.用户违反本协议及相关规则规定时,小羚羊EBC有权终止向用户提供服务。 小羚羊EBC 将在中断服务时通知用户。 但该用户在被 小羚羊EBC终止提供服务后, 再一次直接或间接或以他人名义注册为 小羚羊EBC专家或用户的, 小羚羊EBC有权再次单方面终止为该用户提供服务; +b.小羚羊EBC发现用户注册资料中主要内容是虚假的, 小羚羊EBC有权随时终止为该用户提供服务; +c.本协议终止或更新时,用户未确认新的协议的; +d.其它 小羚羊EBC认为需终止服务的情况。 +八、小羚羊EBC的责任范围 +用户接受该协议时,用户应当明确了解并同意: +1.小羚羊EBC不能随时预见到任何技术上的问题或其他困难。该困难可能会导致数据损失或其他服务中断。小羚羊EBC是在现有技术基础上提供的服务。小羚羊EBC不保证以下事项∶ +a.小羚羊EBC将符合所有专家或用户的要求; +b.小羚羊EBC不受干扰、能够及时提供所有内容、安全可靠或免于出错; +c.本服务使用权的取得结果是正确或可靠的。 +2.是否经由 小羚羊EBC下载或取得其他专家或用户发送的任何资料,由用户自行考虑、衡量并且自负风险, 因下载任何资料而导致用户移动端系统的任何损坏或资料流失,用户应负完全责任。希望用户在使用小羚羊EBC时,小心谨慎并运用常识; 3.用户经由 小羚羊EBC取得的建议和咨询内容,无论其形式或表现,绝不构成本协议未明示规定的任何保证; +4.基于以下原因而造成的利润、商誉、使用、资料损失或其它无形损失,小羚羊EBC不承担任何直接、间接、附带、特别、衍生性或惩罚性赔偿: +a.小羚羊EBC的使用或无法使用; +b.用户的传输或资料遭到未获授权的存取或变更; +c.小羚羊EBC中任何第三方之声明或行为; +d.小羚羊EBC在服务中为用户提供咨询机会,推荐咨询对象; +e.小羚羊EBC其它相关事宜。 +九、知识产权 +1.小羚羊EBC及 小羚羊EBC所使用的任何相关软件、程序、内容,包括但不限于作品、 +图片、档案、资料、 小羚羊EBC构架、 小羚羊EBC版面的安排、页面设计、经由小羚羊EBC或广告商向专家或用户呈现的广告或资讯, 均由 小羚羊EBC或其它权利人依法享有相应的知识产权,包括但不限于著作权、商标权、专利权或其它专属权利等,受到相 关法律的保护。未经 小羚羊EBC或权利人明示授权,用户保证不修改、出租、出借、 出售、散布 小羚羊EBC及 小羚羊EBC所使用的上述任何资料和资源,或根据上述资料和资源制作成任何种类产品; +2.小羚羊EBC授予用户不可转移及非专属的使用权,使用户可以通过移动端使用小羚羊EBC的目标代码(以下简称 " 客户端 " ),但用户不得且不得允许任何第三方复制、修改、创作衍生作品、进行还原工程、反向组译,或以其它方式破译或试图 破译源代码, 或出售、转让" 客户端 " 或对" 客户端 " 进行再授权, 或以其它方式移转" 客户端 " 之任何权利。用户同意不以任何方式修改 " 客户端 " ,或使用修改后的" 客户端 " ; +1.用户不得经由非 小羚羊EBC所提供的界面使用 小羚羊EBC。 +2.隐私权 +3.信息使用: +a.小羚羊EBC不会向任何人出售或出借用户的个人或法人信息,除非事先得到用户的许可; +b.小羚羊EBC亦不允许任何第三方以任何手段收集、编辑、出售或者无偿传播用户 的个人或法人信息。任何用户如从事上述活动,一经发现, 小羚羊EBC有权立即终止与该用户的服务协议,查封其账号。 +4.信息披露:用户的个人或法人信息将在下述情况下部分或全部被披露: +a.经用户同意,向第三方披露; +b.若用户是合法的知识产权使用权人并提起投诉,应被投诉人要求,向被投诉人披露,以便双方处理可能的权利纠纷; +c.根据法律的有关规定,或者行政、司法机关的要求,向第三方或者行政、司法机关披露; +d.若用户出现违反中国有关法律或者 小羚羊EBC规定的情况,需要向第三方披露; +e.为提供你所要求的产品和服务,而必须和第三方分享用户的个人或法人信息; +f.其它 小羚羊EBC根据法律或者 小羚羊EBC规定认为合适的披露。 5.信息安全: +a.在使用 小羚羊EBC服务进行咨询时,请用户妥善保护自己的个人或法人信息,仅在必要的情形下向他人提供; +b.如果用户发现自己的个人或法人信息泄密,尤其是用户账户或“支付账户管理”账户及密码发生泄露, 请用户立即联络 小羚羊EBC客服,以便我们采取相应措施。 +十、不可抗力 +十一、因不可抗力或者其他意外事件,使得本协议的履行不可能、 不必要或者无意义的, 双方均不承担责任。 本合同所称之不可抗力意指不能预见、不能避免并不能克服的客观情况,包括但不限于战争、台风、水灾、火灾、雷击或地震、罢 工、暴动、法定疾病、黑客攻击、网络病毒、电信部门技术管制、政府行为或任 何其它自然或人为造成的灾难等客观情况。 +十二、保密 +十三、双方保证在对讨论、 签订、执行本协议中所获悉的属于对方的且无法自公开渠道获得的文件及资料(包括但不限于商业秘密、公司计划、运营活动、财务信息、技术信息、经营信息及其他商业秘密)予以保密。未经该资料和文件的原提供方同意,另一方不得向第三方泄露该商业秘密的全部或者部分内容。 但法律、法规、行政规章另有规定或者双方另有约定的除外。 +十四、咨询纠纷解决方式 +1.本协议及其规则的有效性、履行和与本协议及其规则效力有关的所有事宜,将受中华人民共和国法律管辖,任何争议仅适用中华人民共和国法律; +2.小羚羊EBC有权受理并调处您与其他专家或用户因咨询服务产生的纠纷,同时有权单方面独立判断其他专家或用户对您的举报及索偿是否成立。 小羚羊EBC没有使用自用资金进行偿付的义务, 但若进行了该等支付, 您应及时赔偿 小羚羊EBC的全部损失,否则 小羚羊EBC有权通过前述方式抵减相应资金或权益, 如仍无法弥补损失, 则 +小羚羊EBC保留继续追偿的权利。 因 小羚羊EBC对证据的鉴别能力及对纠纷的处理能力有限,受理咨询纠纷完全是基于您之委托,不保证处理结果符合您的期望,小羚羊EBC有权决定是否参与争议的调处; +3.凡因本协议及其规则发生的所有纠纷,双方可协商解决。 +十五、解释权 +小羚羊EBC对本服务协议包括基于本服务协议制定的各项规则拥有最终解释权。十六、附则在本协议中所使用的下列词语,除非另有定义,应具有以下含义: +“ 小羚羊EBC”在无特别说明的情况下, 均指 XX有限公司 "小羚羊EBC"产品(www.XX.cn)。 +“用户”:指所有正常途径注册的 XXAp(p 用户版)各项服务的使用者。 指在 小羚羊EBC上进行咨询等“支出”操作的用户。 +“专家”:是指在 小羚羊EBC上接受咨询等“收入”操作的用户。
+
+ + diff --git a/src/assets/disProcessSolution.svg b/src/assets/disProcessSolution.svg new file mode 100644 index 0000000..40b3770 --- /dev/null +++ b/src/assets/disProcessSolution.svg @@ -0,0 +1 @@ + diff --git a/src/assets/disablereflesh.svg b/src/assets/disablereflesh.svg new file mode 100644 index 0000000..56e2c14 --- /dev/null +++ b/src/assets/disablereflesh.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/foot_logo.png b/src/assets/foot_logo.png index e0cee18..df876f3 100644 --- a/src/assets/foot_logo.png +++ b/src/assets/foot_logo.png diff --git a/src/assets/hasCancel_english.png b/src/assets/hasCancel_english.png deleted file mode 100644 index d2cb85b..0000000 --- a/src/assets/hasCancel_english.png +++ /dev/null diff --git a/src/assets/hasChecked.png b/src/assets/hasChecked.png deleted file mode 100644 index 65a5324..0000000 --- a/src/assets/hasChecked.png +++ /dev/null diff --git a/src/assets/hasChecked_big5.png b/src/assets/hasChecked_big5.png deleted file mode 100644 index 94a005a..0000000 --- a/src/assets/hasChecked_big5.png +++ /dev/null diff --git a/src/assets/hasChecked_english.png b/src/assets/hasChecked_english.png deleted file mode 100644 index cce3cca..0000000 --- a/src/assets/hasChecked_english.png +++ /dev/null diff --git a/src/assets/hasChecking_big5.png b/src/assets/hasChecking_big5.png deleted file mode 100644 index 8f84ff6..0000000 --- a/src/assets/hasChecking_big5.png +++ /dev/null diff --git a/src/assets/hasChecking_english.png b/src/assets/hasChecking_english.png deleted file mode 100644 index 7cc03d4..0000000 --- a/src/assets/hasChecking_english.png +++ /dev/null diff --git a/src/assets/haveCancel_big5.png b/src/assets/haveCancel_big5.png deleted file mode 100644 index ea00c99..0000000 --- a/src/assets/haveCancel_big5.png +++ /dev/null diff --git a/src/assets/haveCancel_english.png b/src/assets/haveCancel_english.png deleted file mode 100644 index 3602850..0000000 --- a/src/assets/haveCancel_english.png +++ /dev/null diff --git a/src/assets/haveSubmit_english.png b/src/assets/haveSubmit_english.png deleted file mode 100644 index b1cebe3..0000000 --- a/src/assets/haveSubmit_english.png +++ /dev/null diff --git a/src/assets/haveSubmit_english1.png b/src/assets/haveSubmit_english1.png deleted file mode 100644 index 023df72..0000000 --- a/src/assets/haveSubmit_english1.png +++ /dev/null diff --git a/src/assets/haveSubmit_sBig5.png b/src/assets/haveSubmit_sBig5.png deleted file mode 100644 index afd4e2d..0000000 --- a/src/assets/haveSubmit_sBig5.png +++ /dev/null diff --git a/src/assets/logo.png b/src/assets/logo.png index fbaf489..090bd6d 100644 --- a/src/assets/logo.png +++ b/src/assets/logo.png diff --git a/src/assets/logo_pic.png b/src/assets/logo_pic.png index 6c13f56..ce17ec5 100644 --- a/src/assets/logo_pic.png +++ b/src/assets/logo_pic.png diff --git a/src/assets/mobile/6.png b/src/assets/mobile/6.png deleted file mode 100644 index e58a53a..0000000 --- a/src/assets/mobile/6.png +++ /dev/null diff --git a/src/assets/mobile/61.png b/src/assets/mobile/61.png deleted file mode 100644 index 5f12f7a..0000000 --- a/src/assets/mobile/61.png +++ /dev/null diff --git a/src/assets/paiban1.png b/src/assets/paiban1.png new file mode 100644 index 0000000..5fa8b9a --- /dev/null +++ b/src/assets/paiban1.png diff --git a/src/assets/paiban2.png b/src/assets/paiban2.png new file mode 100644 index 0000000..82a5ad5 --- /dev/null +++ b/src/assets/paiban2.png diff --git a/src/assets/panban.png b/src/assets/panban.png new file mode 100644 index 0000000..4d55a48 --- /dev/null +++ b/src/assets/panban.png diff --git a/src/assets/processSolution.svg b/src/assets/processSolution.svg new file mode 100644 index 0000000..9b3f01d --- /dev/null +++ b/src/assets/processSolution.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/reflesh.svg b/src/assets/reflesh.svg new file mode 100644 index 0000000..ad40a67 --- /dev/null +++ b/src/assets/reflesh.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/components/AuditInformation/AuditInformation.js b/src/components/AuditInformation/AuditInformation.js index fa5495e..f5d6554 100644 --- a/src/components/AuditInformation/AuditInformation.js +++ b/src/components/AuditInformation/AuditInformation.js @@ -5,8 +5,8 @@ // , Switch, Icon import React, { Component } from 'react'; import { Form } from '@ant-design/compatible'; -// import '@ant-design/compatible/assets/index.css'; -import { Layout, Spin, Tabs, Avatar, message, Select, Input, Button } from 'antd-v4'; +import '@ant-design/compatible/assets/index.css'; +import { Layout, Spin, Tabs, Avatar, message, Select, Input, Button } from 'antd'; import * as commonFunc from './../Common/commonFunc';/* 通用单据方法 */ /* 通用单据方法 */ import StaticEditTable from '../Common/CommonTable';/* 可编辑表格 */ import styles from './../../index.less'; @@ -14,7 +14,7 @@ import CommonView from './../Common/CommonView'; import CommonBase from './../Common/CommonBase';/* 获取配置及数据 */ import * as commonUtils from './../../utils/utils';/* 通用方法 */ import * as commonBusiness from './../Common/commonBusiness';/* 单据业务功能 */ -import commonConfig from './../../utils/config'; +import * as commonConfig from './../../utils/config'; import * as commonServices from './../../services/services';/* 服务类 */ const { TabPane } = Tabs; @@ -33,7 +33,7 @@ class AuditInformation extends Component { let { masterConfig, canSendMsg } = nextProps; const { userinfo } = app; if (commonUtils.isEmptyArr(masterConfig) && formData.length > 0) { - const sId = currentId || nextProps.masterData?.sId || ''; + const sId = currentId !== undefined ? currentId : ''; /* 数据Id */ masterConfig = formData.filter(item => !item.bGrd)[0]; const checkConfig = formData.filter(item => item.bGrd && item.sTbName === 'sysbillcheckresult')[0]; @@ -58,7 +58,7 @@ class AuditInformation extends Component { /** 获取主表数据 */ handleGetData = async (masterConfig, checkConfig) => { const { currentId } = this.props; /* 当前页签数据 */ - const sId = currentId || this.props.masterData?.sId || ''; + const sId = currentId !== undefined ? currentId : ''; await this.props.handleGetDataOne({ name: 'master', configData: masterConfig, condition: { sId, pageSize: '', pageNum: '' } }); const { masterData } = this.props; if (!commonUtils.isEmptyObject(checkConfig) && !commonUtils.isEmptyObject(masterData)) { @@ -112,8 +112,8 @@ class AuditInformation extends Component { } }; render() { - const { masterData, sModelsType, app } = this.props; - const imgSrc = commonBusiness.handleAddIcon(masterData, sModelsType, app); + const { pageLoading, masterData } = this.props; + const imgSrc = commonBusiness.handleAddIcon(masterData); return ( { + this.renderChart(); + }, 10); window.addEventListener('resize', this.resize); } componentWillReceiveProps(nextProps) { - if (!this.isEqual(this.props, nextProps)) { - this.renderChart(nextProps); + if (!equal(this.props, nextProps)) { + setTimeout(() => { + this.renderChart(nextProps); + }, 10); } } componentWillUnmount() { window.removeEventListener('resize', this.resize); + // if (this.chart) { + // console.log('data', this.chart); + // this.chart.destroy(); + // } this.resize.cancel(); - if (this.chart) { - this.chart.destroy(); - } } - resize = debounce(() => { - if (this.chart) { - this.chart.render(); + @Bind() + @Debounce(200) + resize() { + if (!this.node) { + return; } - }, 200); + this.renderChart([]); + } - isEqual = (prevProps, nextProps) => { - // Implement your own equality check logic - return prevProps.data === nextProps.data && prevProps.color === nextProps.color; + handleRef = (n) => { + this.node = n; }; - renderChart = (props = this.props) => { - const { data, color = primaryColor, bgColor = backgroundColor } = props; - const value = Math.min(Math.max(data, 0), 100); // Ensure value is between 0 and 100 + initChart(nextProps) { + const { xUnit, color = primaryColor } = nextProps || this.props; + + Shape.registShape('point', 'dashBoard', { + drawShape(cfg, group) { + const originPoint = cfg.points[0]; + const point = this.parsePoint({ x: originPoint.x, y: 0.4 }); + + const center = this.parsePoint({ + x: 0, + y: 0, + }); + + const shape = group.addShape('polygon', { + attrs: { + points: [ + [center.x, center.y], + [point.x + 8, point.y], + [point.x + 8, point.y - 2], + [center.x, center.y - 2], + ], + radius: 2, + lineWidth: 2, + arrow: false, + fill: color, + }, + }); + + group.addShape('Marker', { + attrs: { + symbol: 'circle', + lineWidth: 2, + fill: color, + radius: 8, + x: center.x, + y: center.y, + }, + }); + group.addShape('Marker', { + attrs: { + symbol: 'circle', + lineWidth: 2, + fill: '#fff', + radius: 5, + x: center.x, + y: center.y, + }, + }); + + const { origin } = cfg; + group.addShape('text', { + attrs: { + x: center.x, + y: center.y + 80, + text: `${origin._origin.value}%`, + textAlign: 'center', + fontSize: 24, + fill: 'rgba(0, 0, 0, 0.85)', + }, + }); + group.addShape('text', { + attrs: { + x: center.x, + y: center.y + 45, + text: xUnit, + textAlign: 'center', + fontSize: 14, + fill: 'rgba(0, 0, 0, 0.43)', + }, + }); + + return shape; + }, + }); + } + + renderChart(nextProps) { + if (this.node.offsetWidth === 0) { + return; + } + const { + height, color = primaryColor, bgColor = backgroundColor, xUnit, + } = nextProps || this.props; + const data = [{ name: xUnit, value: this.props.data }]; if (this.chart) { + this.chart.clear(); + } + if (this.chart) { this.chart.destroy(); } + if (this.node) { + this.node.innerHTML = ''; + } - const chart = new Chart({ + this.initChart(nextProps); + const chart = new G2.Chart({ container: this.node, - autoFit: true, - height: 200, - padding: [20, 20, 60, 20], + forceFit: true, + height, + animate: false, + plotCfg: { + margin: [10, 10, 30, 10], + }, }); + chart.source(data); + chart.tooltip(false); - chart.coordinate('polar', { - startAngle: -Math.PI / 2, - endAngle: Math.PI / 2, - radius: 0.9, + chart.coord('gauge', { + startAngle: -1.2 * Math.PI, + endAngle: 0.20 * Math.PI, }); - - chart.axis('value', false); - - // Draw background arc - chart.guide().arc({ - start: [0, 0.95], - end: [100, 0.95], - style: { - stroke: bgColor, - lineWidth: 12, - }, + chart.col('value', { + type: 'linear', + nice: true, + min: 0, + max: 100, + tickCount: 6, }); - - // Draw value arc - chart.guide().arc({ - start: [0, 0.95], - end: [value, 0.95], - style: { + chart.axis('value', { + subTick: false, + tickLine: { stroke: color, - lineWidth: 12, + lineWidth: 2, + value: -14, + }, + labelOffset: -12, + formatter: (val) => { + switch (parseInt(val, 10)) { + case 20: + return '差'; + case 40: + return '中'; + case 60: + return '良'; + case 80: + return '优'; + default: + return ''; + } }, }); + chart.point().position('value').shape('dashBoard'); + draw(data); + + /* eslint no-shadow: 0 */ + function draw(data) { + const val = data[0].value; + const lineWidth = 12; + chart.guide().clear(); + + chart.guide().arc(() => { + return [0, 0.95]; + }, () => { + return [val, 0.95]; + }, { + stroke: color, + lineWidth, + }); + + chart.guide().arc(() => { + return [val, 0.95]; + }, (arg) => { + return [arg.max, 0.95]; + }, { + stroke: bgColor, + lineWidth, + }); - // Draw center circle - chart.guide().html({ - position: [50, 0.95], - html: `
${value}%
`, - }); - - chart.render(); + chart.changeData(data); + } this.chart = chart; - }; - - handleRef = (node) => { - this.node = node; - }; + } render() { - return
; + return ( +
+ ); } } -export default Gauge; \ No newline at end of file +export default Gauge; diff --git a/src/components/Charts/Pie/index.js b/src/components/Charts/Pie/index.js index fc56053..fd92735 100644 --- a/src/components/Charts/Pie/index.js +++ b/src/components/Charts/Pie/index.js @@ -1,7 +1,7 @@ /* eslint-disable no-undef, jsx-a11y/no-noninteractive-element-interactions */ import React, { Component } from 'react'; import G2 from 'g2'; -import { Divider } from 'antd-v4'; +import { Divider } from 'antd'; import classNames from 'classnames'; import ReactFitText from 'react-fittext'; import Debounce from 'lodash-decorators/debounce'; @@ -182,7 +182,7 @@ class Pie extends Component { }); // chart.changeSize(180, 216);// 设置图标的高度 chart - .interval() + .intervalStack() .position(Stat.summary.percent('y')) .style({ lineWidth, stroke: '#fff' }) .color('x', percent ? formatColor : defaultColors) diff --git a/src/components/Charts/Pie/index.less b/src/components/Charts/Pie/index.less index 47da292..70796d9 100644 --- a/src/components/Charts/Pie/index.less +++ b/src/components/Charts/Pie/index.less @@ -1,4 +1,4 @@ -@import "~antd-v4/lib/style/themes/default.less"; +@import "~antd/lib/style/themes/default.less"; .pie { position: relative; diff --git a/src/components/Charts/PieGroup/index.js b/src/components/Charts/PieGroup/index.js index cdbe243..2d6cb73 100644 --- a/src/components/Charts/PieGroup/index.js +++ b/src/components/Charts/PieGroup/index.js @@ -1,5 +1,5 @@ import React, { Component } from 'react'; -import { Row, Col } from 'antd-v4'; +import { Row, Col } from 'antd'; import { getTheme } from '@antv/g2'; import Pie from '../Pie'; diff --git a/src/components/Charts/TimeLineGroup/index.js b/src/components/Charts/TimeLineGroup/index.js index 6d82488..1f147b9 100644 --- a/src/components/Charts/TimeLineGroup/index.js +++ b/src/components/Charts/TimeLineGroup/index.js @@ -1,6 +1,6 @@ /* eslint-disable object-curly-newline */ import React, { Component } from 'react'; -import { Row, Col, Tabs } from 'antd-v4'; +import { Row, Col, Tabs } from 'antd'; import TimeLineChart from '../TimelineChart'; import NumberInfo from '../../NumberInfo'; import Pie from '../Pie'; diff --git a/src/components/Charts/WaterWave/index.less b/src/components/Charts/WaterWave/index.less index be35c21..4ded14d 100644 --- a/src/components/Charts/WaterWave/index.less +++ b/src/components/Charts/WaterWave/index.less @@ -1,4 +1,4 @@ -@import "~antd-v4/lib/style/themes/default.less"; +@import "~antd/lib/style/themes/default.less"; .waterWave { display: block; diff --git a/src/components/Charts/index.less b/src/components/Charts/index.less index 95f7056..b2646b8 100644 --- a/src/components/Charts/index.less +++ b/src/components/Charts/index.less @@ -1,4 +1,4 @@ -@import "~antd-v4/lib/style/themes/default.less"; +@import "~antd/lib/style/themes/default.less"; .char { margin: 24px; } diff --git a/src/components/Common/AffixMenu.js b/src/components/Common/AffixMenu.js index a61f588..094c703 100644 --- a/src/components/Common/AffixMenu.js +++ b/src/components/Common/AffixMenu.js @@ -1,10 +1,11 @@ /* eslint-disable */ import React, { Component } from 'react'; -import { Affix, Table, Checkbox, Input, Select, message, Tabs, Alert } from 'antd-v4'; +import fetch from 'dva/fetch'; +import { Affix, Table, Checkbox, Input, Select, message, Tabs, Alert } from 'antd'; import styles from '@/index.less'; import lodash from 'lodash'; import * as commonUtils from '@/utils/utils'; -import config from '@/utils/config'; +import * as config from '@/utils/config'; import * as commonFunc from '@/components/Common/commonFunc'; import AntdDraggableModal from '@/components/Common/AntdDraggableModal'; import SvgIcon from '../SvgIcon'; @@ -349,12 +350,7 @@ class AffixMenuComponent extends Component { const columniFitWidth = commonFunc.showMessage(app.commonConst, 'columniFitWidth');/* 宽度 */ const columnbVisible = commonFunc.showMessage(app.commonConst, 'columnbVisible');/* 是否显示 */ const columnsName = commonFunc.showMessage(app.commonConst, 'columnsName');/* 字段名 */ - const columnsReadOnly = commonFunc.showMessage(app.commonConst, 'columnsReadOnly') || '是否只读';/* 是否自读 */ - const columnsFontColor = commonFunc.showMessage(app.commonConst, 'columnsFontColor') || '字体颜色';/* 字体颜色 */ const isDefault = commonFunc.showMessage(app.commonConst, 'isDefault');/* 是否设置默认 */ - const BtnSure = commonFunc.showMessage(app.commonConst, 'BtnSure') || '确认';/* 按钮确认 */ - const BtnCancel = commonFunc.showMessage(app.commonConst, 'BtnCancel') || '取消';/* 按钮取消 */ - const selectAll = commonFunc.showMessage(app.commonConst, 'selectAll') || '全选';/* 全选 */ // eslint-disable-next-line no-unused-vars Object.keys(modalData).forEach((child, i) => { const splitArr = commonUtils.isNotEmptyObject(child) && commonUtils.isNotEmptyArr(child.split('_')) ? child.split('_') : []; @@ -409,11 +405,11 @@ class AffixMenuComponent extends Component { visible += 1; } } - checkAll = {selectAll}   this.onCheckAll(e, child, count, configId)} />; + checkAll = 全选   this.onCheckAll(e, child, count, configId)} />; } if (this.props.app.userinfo.sType === 'sysadmin' || true) { /* 管理员设置列是否可修改 */ columns.push({ - title: columnsReadOnly, + title: '是否只读', dataIndex: 'bReadonly', render: (text, record) => this.renderColumns(text, 'bReadonly', configId, record), width: 80, @@ -421,7 +417,7 @@ class AffixMenuComponent extends Component { } if (this.props.app.userinfo.sType === 'sysadmin' || true) { /* 管理员设置列颜色 */ columns.push({ - title: columnsFontColor, + title: '字体颜色', dataIndex: 'sFontColor', render: (text, record) => this.renderColumns(text, 'sFontColor', configId, record), width: 80, @@ -489,8 +485,6 @@ class AffixMenuComponent extends Component { onCancel={this.handlePpopUpPaneCancel.bind(this)} onOk={this.handleOk.bind(this)} width={1000} - okText={BtnSure} - cancelText={BtnCancel} >
{ diff --git a/src/components/Common/AntdDraggableModal.js b/src/components/Common/AntdDraggableModal.js index 0b4cdc9..0d0cc4b 100644 --- a/src/components/Common/AntdDraggableModal.js +++ b/src/components/Common/AntdDraggableModal.js @@ -1,5 +1,5 @@ import React from 'react'; -import { Modal } from 'antd-v4'; +import { Modal } from 'antd'; import './AntdDraggableModal/antDraggle.less'; diff --git a/src/components/Common/AssignmentField.js b/src/components/Common/AssignmentField.js index 757e0e5..2cf0aef 100644 --- a/src/components/Common/AssignmentField.js +++ b/src/components/Common/AssignmentField.js @@ -3,7 +3,7 @@ */ /* eslint-disable no-undef,import/first,prefer-destructuring,jsx-a11y/alt-text */ import React, { Component } from 'react'; -import { Modal } from 'antd-v4'; +import { Modal } from 'antd'; import styles from '@/index.less'; import * as commonUtils from '@/utils/utils'; import StaticEditTable from '@/components/Common/CommonTable';/* 可编辑表格 */ diff --git a/src/components/Common/BoxDesign/createAirplaneBox.js b/src/components/Common/BoxDesign/createAirplaneBox.js index e833fc5..1176104 100644 --- a/src/components/Common/BoxDesign/createAirplaneBox.js +++ b/src/components/Common/BoxDesign/createAirplaneBox.js @@ -2,9 +2,8 @@ // 创建飞机盒盒身 const boxContent = (width, height, offsetX, offsetY) => { const svg = document.createElementNS("http://www.w3.org/2000/svg", "path"); - const d = `M ${offsetX} ${offsetY} L ${offsetX} ${offsetY + height} L ${offsetX + width} ${offsetY + height} L ${ - offsetX + width - } ${offsetY} L ${offsetX} ${offsetY} Z`; + const d = `M ${offsetX} ${offsetY} L ${offsetX} ${offsetY + height} L ${offsetX + width} ${offsetY + height} L ${offsetX + + width} ${offsetY} L ${offsetX} ${offsetY} Z`; svg.setAttribute("d", d); svg.setAttribute("fill", "transparent"); svg.setAttribute("stroke", "#333"); @@ -15,9 +14,8 @@ const boxContent = (width, height, offsetX, offsetY) => { // 创建飞机盒上盒部件 const createBoxTop = (width, height, offsetX, offsetY, outerWidth) => { const svg = document.createElementNS("http://www.w3.org/2000/svg", "path"); - const d = `M ${offsetX} ${offsetY} L ${width} ${offsetY} A ${height} ${height} 0 0 1 ${width + outerWidth} ${offsetX} L ${offsetX - outerWidth} ${ - offsetY + height - } A ${height} ${height} 0 0 1 ${offsetX} ${offsetY}`; + const d = `M ${offsetX} ${offsetY} L ${width} ${offsetY} A ${height} ${height} 0 0 1 ${width + outerWidth} ${offsetX} L ${offsetX - + outerWidth} ${offsetY + height} A ${height} ${height} 0 0 1 ${offsetX} ${offsetY}`; svg.setAttribute("d", d); svg.setAttribute("fill", "transparent"); svg.setAttribute("stroke", "#333"); @@ -27,9 +25,8 @@ const createBoxTop = (width, height, offsetX, offsetY, outerWidth) => { // 创建飞机左上部件 const createBoxLeftTop = (width, height, offsetX, offsetY, isLeft) => { const svg = document.createElementNS("http://www.w3.org/2000/svg", "path"); - const d = `M ${offsetX} ${offsetY} L ${offsetX - width + (isLeft ? 5 : -5)} ${offsetY + 5} A 10 10 0 0 ${isLeft ? 0 : 1} ${offsetX - width} ${ - offsetY + 15 - } L ${offsetX - width} ${offsetY + height - 15} + const d = `M ${offsetX} ${offsetY} L ${offsetX - width + (isLeft ? 5 : -5)} ${offsetY + 5} A 10 10 0 0 ${isLeft ? 0 : 1} ${offsetX - + width} ${offsetY + 15} L ${offsetX - width} ${offsetY + height - 15} A 10 10 0 0 ${isLeft ? 0 : 1} ${offsetX - width + (isLeft ? 5 : -5)} ${offsetY + height - 5} L ${offsetX} ${offsetY + height}`; svg.setAttribute("d", d); svg.setAttribute("fill", "transparent"); @@ -96,16 +93,7 @@ export const createPathElement = (x, y, width, height, id, wrapperId) => { svg.setAttribute("stroke-dasharray", "4"); // 添加虚线效果 return svg; }; -export const createPathElements = (x, y, width, height, id, wrapperId) => { - const d = `M ${x} ${y} L ${x} ${y + height} L ${x + width} ${y + height} L ${x + width} ${y} L ${x} ${y} Z`; - const svg = document.createElementNS("http://www.w3.org/2000/svg", "path"); - svg.setAttribute("d", d); - svg.setAttribute("fill", "transparent"); - svg.setAttribute("stroke", "#7588B9"); - svg.setAttribute("stroke-width", "1"); - // svg.setAttribute("stroke-dasharray", "4"); // 添加虚线效果 - return svg; -}; + // // 左边斜线贴边 export const createTrapezoid = (height, offsetX, offsetY, size) => { @@ -120,9 +108,9 @@ export const createTrapezoid = (height, offsetX, offsetY, size) => { // 左上盒舌 盒舌 x轴原点 y轴原点 高度 x轴方向偏移 y轴方向偏移 是否瞬时针 是否镜像 type0 export const createTopTongue = (width, offsetX, offsetY, size, xz, yz, clockwise, isMirror, az, jxY) => { const svg = document.createElementNS("http://www.w3.org/2000/svg", "path"); - const d = `M ${offsetX} ${offsetY} L ${offsetX + xz} ${offsetY + az} L ${offsetX + xz} ${offsetY - size} L ${ - offsetX + width - (isMirror ? -(yz * 2) : yz * 2) - } ${offsetY - size} + const d = `M ${offsetX} ${offsetY} L ${offsetX + xz} ${offsetY + az} L ${offsetX + xz} ${offsetY - size} L ${offsetX + + width - + (isMirror ? -(yz * 2) : yz * 2)} ${offsetY - size} A ${yz} ${yz} 0 0 ${clockwise} ${offsetX + width - (isMirror ? -yz : yz)} ${offsetY - size + jxY} L ${offsetX + width} ${offsetY}`; svg.setAttribute("d", d); svg.setAttribute("fill", "transparent"); @@ -133,9 +121,9 @@ export const createTopTongue = (width, offsetX, offsetY, size, xz, yz, clockwise // 下边 export const createBottomTongue = (width, offsetX, offsetY, size, xz, yz, clockwise, isMirror, az, jxY) => { const svg = document.createElementNS("http://www.w3.org/2000/svg", "path"); - const d = `M ${offsetX} ${offsetY} L ${offsetX + xz} ${offsetY + az} L ${offsetX + xz} ${offsetY - size} L ${ - offsetX + width - (isMirror ? -(yz * 2) : yz * 2) - } ${offsetY - size} + const d = `M ${offsetX} ${offsetY} L ${offsetX + xz} ${offsetY + az} L ${offsetX + xz} ${offsetY - size} L ${offsetX + + width - + (isMirror ? -(yz * 2) : yz * 2)} ${offsetY - size} A ${yz} ${yz} 0 0 ${clockwise} ${offsetX + width - (isMirror ? -yz : yz)} ${offsetY - size + jxY} L ${offsetX + width} ${offsetY}`; svg.setAttribute("d", d); svg.setAttribute("fill", "transparent"); @@ -146,9 +134,8 @@ export const createBottomTongue = (width, offsetX, offsetY, size, xz, yz, clockw // 上盒舌类型1 export const createTopTongueType1 = (width, offsetX, offsetY, size, xz, yz) => { const svg = document.createElementNS("http://www.w3.org/2000/svg", "path"); - const d = `M ${offsetX} ${offsetY} L ${offsetX + xz} ${offsetY + size} L ${offsetX + width - xz + yz} ${offsetY + size} L${ - offsetX + width - } ${offsetY} `; + const d = `M ${offsetX} ${offsetY} L ${offsetX + xz} ${offsetY + size} L ${offsetX + width - xz + yz} ${offsetY + size} L${offsetX + + width} ${offsetY} `; svg.setAttribute("d", d); svg.setAttribute("fill", "transparent"); svg.setAttribute("stroke", "#333"); @@ -160,9 +147,8 @@ export const createDynamicTop = (width, height, deep, offsetX, offsetY, size) => const svg = document.createElementNS("http://www.w3.org/2000/svg", "path"); // 动态生成路径,基于输入参数 const d = `M ${offsetX} ${offsetY} L ${offsetX} ${offsetY - deep - size + isSignNum} A 2 2 0 0 1 ${offsetX + 2} ${offsetY - deep - size} - L ${offsetX + width - 2} ${offsetY - deep - size} A 2 2 0 0 1 ${offsetX + width} ${offsetY - deep - size + isSignNum} L ${offsetX + width} ${ - offsetY - deep - } + L ${offsetX + width - 2} ${offsetY - deep - size} A 2 2 0 0 1 ${offsetX + width} ${offsetY - deep - size + isSignNum} L ${offsetX + + width} ${offsetY - deep} L ${offsetX} ${offsetY - deep} L ${offsetX + width} ${offsetY - deep} L ${offsetX + width} ${offsetY} `; svg.setAttribute("d", d); svg.setAttribute("fill", "transparent"); @@ -201,20 +187,19 @@ export const createText = (offsetX, offsetY, size, textContent) => { text.setAttribute("dominant-baseline", "middle"); // 文字垂直居中 text.setAttribute("fill", "#333"); // 文字颜色 text.setAttribute("font-size", size); // 文字大小 - text.textContent = textContent || ""; // 默认文字内容 + text.textContent = textContent || "Text"; // 默认文字内容 return text; }; // 竖向双箭头 -export const createDoubleArrow = (height, offsetX, offsetY, scale) => { - const Y = -3 * (scale ? scale : 1); +export const createDoubleArrow = (height, offsetX, offsetY,scale) => { + const Y = -3 * (scale?scale:1) const svg = document.createElementNS("http://www.w3.org/2000/svg", "path"); - const d = `M ${offsetX} ${offsetY} L ${offsetX} ${offsetY - height / 2 - Y} L ${offsetX + Y} ${offsetY - height / 2 - Y} L ${offsetX} ${ - offsetY - height / 2 - } + const d = `M ${offsetX} ${offsetY} L ${offsetX} ${offsetY - height / 2 - Y} L ${offsetX + Y} ${offsetY - height / 2 - Y} L ${offsetX} ${offsetY - + height / 2} L ${offsetX - Y} ${offsetY - height / 2 - Y} L ${offsetX} ${offsetY - height / 2 - Y} L ${offsetX} ${offsetY + height / 2 + Y} L - ${offsetX - Y} ${offsetY + height / 2 + Y} L ${offsetX} ${offsetY + height / 2} L ${offsetX + Y} ${offsetY + height / 2 + Y} L ${offsetX} ${ - offsetY + height / 2 + Y - }`; + ${offsetX - Y} ${offsetY + height / 2 + Y} L ${offsetX} ${offsetY + height / 2} L ${offsetX + Y} ${offsetY + + height / 2 + + Y} L ${offsetX} ${offsetY + height / 2 + Y}`; svg.setAttribute("d", d); svg.setAttribute("fill", "#F5AD6C"); svg.setAttribute("stroke", "#F5AD6C"); @@ -223,15 +208,14 @@ export const createDoubleArrow = (height, offsetX, offsetY, scale) => { return svg; }; // 横向双箭头 -export const createHorizontalDoubleArrow = (width, offsetX, offsetY, scale) => { - const Y = 3 * (scale ? scale : 1); +export const createHorizontalDoubleArrow = (width, offsetX, offsetY,scale) => { + const Y = 3 * (scale?scale:1) const svg = document.createElementNS("http://www.w3.org/2000/svg", "path"); - const d = `M ${offsetX} ${offsetY} L ${offsetX - width / 2 + Y} ${offsetY} L ${offsetX - width / 2 + Y} ${offsetY - Y} L ${ - offsetX - width / 2 - } ${offsetY} - L ${offsetX - width / 2 + Y} ${offsetY + Y} L ${offsetX - width / 2 + Y} ${offsetY} L ${offsetX + width / 2 - Y} ${offsetY} L ${ - offsetX + width / 2 - Y - } ${offsetY + Y} L ${offsetX + width / 2} ${offsetY} + const d = `M ${offsetX} ${offsetY} L ${offsetX - width / 2 + Y} ${offsetY} L ${offsetX - width / 2 + Y} ${offsetY - Y} L ${offsetX - + width / 2} ${offsetY} + L ${offsetX - width / 2 + Y} ${offsetY + Y} L ${offsetX - width / 2 + Y} ${offsetY} L ${offsetX + width / 2 - Y} ${offsetY} L ${offsetX + + width / 2 - + Y} ${offsetY + Y} L ${offsetX + width / 2} ${offsetY} L ${offsetX + width / 2 - Y} ${offsetY - Y} L ${offsetX + width / 2 - Y} ${offsetY}`; svg.setAttribute("d", d); svg.setAttribute("fill", "#F5AD6C"); @@ -444,10 +428,7 @@ export function createBoxs(slaveRowData) { export function createHeavenBox(slaveRowData) { const pathList = []; const { W, L, D, dF, dF1, dD1, dZBJJ } = slaveRowData; - const rectangles = [ - { x: 0, y: 0, width: L, height: W }, - { x: L + D + dZBJJ + dD1, y: -2, width: L + 4, height: W + 4 }, - ]; + const rectangles = [{ x: 0, y: 0, width: L, height: W }, { x: L + D + dZBJJ + dD1, y: -2, width: L + 4, height: W + 4 }]; rectangles.forEach(x => { pathList.push(boxContent(x.width, x.height, x.x, x.y)); }); @@ -523,9 +504,8 @@ export function createDiscBox(slaveRowData) { // 展示盒f1 const createShowBoxF1 = (width, height, offsetX, offsetY, size) => { const svg = document.createElementNS("http://www.w3.org/2000/svg", "path"); - const d = `M ${offsetX} ${offsetY} L ${offsetX} ${offsetY + size} L ${offsetX - width} ${offsetY + size + 1} L ${offsetX - width} ${ - offsetY + height - } L ${offsetX} ${offsetY + height} Z`; + const d = `M ${offsetX} ${offsetY} L ${offsetX} ${offsetY + size} L ${offsetX - width} ${offsetY + size + 1} L ${offsetX - width} ${offsetY + + height} L ${offsetX} ${offsetY + height} Z`; svg.setAttribute("d", d); svg.setAttribute("fill", "transparent"); svg.setAttribute("stroke", "#333"); @@ -557,11 +537,7 @@ const createShowBoxF2 = (width, height, offsetX, offsetY, size) => { export function createShowBox(slaveRowData) { const pathList = []; const { L, W, D, dD2, dF1, dF2 } = slaveRowData; - const rectangles = [ - { x: 0, y: 0, width: D, height: W }, - { x: D, y: 0, width: L, height: W }, - { x: D + L, y: 0, width: dD2, height: W }, - ]; + const rectangles = [{ x: 0, y: 0, width: D, height: W }, { x: D, y: 0, width: L, height: W }, { x: D + L, y: 0, width: dD2, height: W }]; rectangles.forEach(x => { pathList.push(boxContent(x.width, x.height, x.x, x.y)); }); @@ -593,9 +569,8 @@ export function createShowBox(slaveRowData) { // 内衬槽 const createInnerLiningGroove = (width, height, offsetX, offsetY) => { const svg = document.createElementNS("http://www.w3.org/2000/svg", "path"); - const d = `M ${offsetX} ${offsetY} L ${offsetX} ${offsetY + height - width / 2} A ${width / 2} ${width / 2} 0 0 0 ${offsetX - width} ${ - offsetY + height - } L ${offsetX - width} ${offsetY}`; + const d = `M ${offsetX} ${offsetY} L ${offsetX} ${offsetY + height - width / 2} A ${width / 2} ${width / 2} 0 0 0 ${offsetX - width} ${offsetY + + height} L ${offsetX - width} ${offsetY}`; svg.setAttribute("d", d); svg.setAttribute("fill", "transparent"); svg.setAttribute("stroke", "#333"); @@ -626,9 +601,8 @@ export function createLiningBox(slaveRowData) { } const createDiagonalEdging = (width, height, offsetX, offsetY) => { const svg = document.createElementNS("http://www.w3.org/2000/svg", "path"); - const d = `M ${offsetX} ${offsetY} L ${offsetX + 5} ${offsetY + height} L ${offsetX + width - 5} ${offsetY + height} L${ - offsetX + width - } ${offsetY}`; + const d = `M ${offsetX} ${offsetY} L ${offsetX + 5} ${offsetY + height} L ${offsetX + width - 5} ${offsetY + height} L${offsetX + + width} ${offsetY}`; svg.setAttribute("d", d); svg.setAttribute("fill", "transparent"); svg.setAttribute("stroke", "#333"); @@ -666,8 +640,8 @@ const createSvg = d => { const svg = document.createElementNS("http://www.w3.org/2000/svg", "path"); svg.setAttribute("d", d); svg.setAttribute("fill", "transparent"); - svg.setAttribute("stroke", "#333"); - svg.setAttribute("stroke-width", "0.5"); + svg.setAttribute("stroke", "#7588B9"); + svg.setAttribute("stroke-width", "1"); return svg; }; const createDasharraySvg = d => { @@ -688,16 +662,14 @@ export const createLineWeltTop = (width, height, offsetX, offsetY) => { // 上方盒舌等腰梯形 export const createIsoscelesTrapezoidWeltTop = (width, height, offsetX, offsetY) => { - const d = `M ${offsetX} ${offsetY} L ${offsetX + width * 0.1} ${offsetY + height} L ${offsetX + width * 0.9} ${offsetY + height} L ${ - offsetX + width - } ${offsetY}`; + const d = `M ${offsetX} ${offsetY} L ${offsetX + width * 0.1} ${offsetY + height} L ${offsetX + width * 0.9} ${offsetY + height} L ${offsetX + + width} ${offsetY}`; return createSvg(d); }; // 盒舌梯形 export const createTrapezoidWeltTop = (width, height, offsetX, offsetY) => { - const d = `M ${offsetX} ${offsetY} L ${offsetX + width * 0.5} ${offsetY + height} L ${offsetX + width * 0.9} ${offsetY + height} L ${ - offsetX + width - } ${offsetY}`; + const d = `M ${offsetX} ${offsetY} L ${offsetX + width * 0.5} ${offsetY + height} L ${offsetX + width * 0.9} ${offsetY + height} L ${offsetX + + width} ${offsetY}`; return createSvg(d); }; // 盒舌折叠 @@ -717,260 +689,152 @@ export const createFoldWeltTopLine = (width, height, offsetX, offsetY) => { export const createRoundedCornersWeltTop = (width, height, offsetX, offsetY) => { const isNegative = (width > 0 && height > 0) || (width < 0 && height < 0); - const d = `M ${offsetX} ${offsetY} L ${offsetX + width * 0.1} ${offsetY + height * 0.9} L ${offsetX + width} ${offsetY + height} L ${ - offsetX + width - } ${offsetY}`; + const d = `M ${offsetX} ${offsetY} L ${offsetX + width * 0.1} ${offsetY + height * 0.9} L ${offsetX + width} ${offsetY + height} L ${offsetX + width} ${offsetY}` return createSvg(d); }; // 盒底组件 直角 -export const createRightAngleBoxBottomComponent = (width, deep, size, offsetX, offsetY) => { +export const createRightAngleBoxBottomComponent = (width, deep,size, offsetX, offsetY) => { const d = `M ${offsetX} ${offsetY} L ${offsetX} ${offsetY + size} L ${offsetX + width} ${offsetY + size} L ${offsetX + width} ${offsetY} L ${offsetX + width} ${offsetY + size} L ${offsetX + width + deep} ${offsetY + size} L ${offsetX + width + deep} ${offsetY} L ${offsetX + width + deep} ${offsetY + size} L ${offsetX + width + deep + width} ${offsetY + size} L ${offsetX + width + deep + width} ${offsetY} - L ${offsetX + width + deep + width} ${offsetY + size} L ${offsetX + width + deep + width + deep} ${offsetY + size} L ${ - offsetX + width + deep + width + deep - } ${offsetY}`; + L ${offsetX + width + deep + width} ${offsetY + size} L ${offsetX + width + deep + width + deep} ${offsetY + size} L ${offsetX + width + deep + width + deep} ${offsetY}`; return createSvg(d); }; // 盒底组件 5002 export const createBoxBottomComponent1 = (width, deep, size, offsetX, offsetY) => { - const d = `M ${offsetX} ${offsetY} L ${offsetX + width * 0.2} ${offsetY + size * 0.5} L ${offsetX + width * 0.2} ${offsetY + size} L ${ - offsetX + width * 0.8 - } ${offsetY + size} L ${offsetX + width * 0.8} ${offsetY + size * 0.5} L ${offsetX + width} ${offsetY} - L ${offsetX + width} ${offsetY + size} L ${offsetX + width + deep * 0.5} ${offsetY + size} L ${offsetX + width + deep * 0.5} ${ - offsetY + size * 0.5 - } L ${offsetX + width + deep} ${offsetY} - L ${offsetX + width + deep} ${offsetY + size} L ${offsetX + width + deep + width * 0.2} ${offsetY + size} L ${ - offsetX + width + deep + width * 0.2 - } ${offsetY + size * 0.5} L ${offsetX + width + deep + width * 0.8} ${offsetY + size * 0.5} L ${offsetX + width + deep + width * 0.8} ${ - offsetY + size - } + const d = `M ${offsetX} ${offsetY} L ${offsetX + width * 0.2} ${offsetY + size * 0.5} L ${offsetX + width * 0.2} ${offsetY + size} L ${offsetX + width * 0.8} ${offsetY + size} L ${offsetX + width * 0.8} ${offsetY + size *0.5} L ${offsetX + width} ${offsetY} + L ${offsetX + width} ${offsetY + size} L ${offsetX + width + deep * 0.5} ${offsetY + size} L ${offsetX + width + deep * 0.5} ${offsetY + size * 0.5} L ${offsetX + width + deep} ${offsetY} + L ${offsetX + width + deep} ${offsetY + size} L ${offsetX + width + deep + width * 0.2} ${offsetY + size} L ${offsetX + width + deep + width * 0.2} ${offsetY + size * 0.5} L ${offsetX + width + deep + width * 0.8} ${offsetY + size * 0.5} L ${offsetX + width + deep + width * 0.8} ${offsetY + size} L ${offsetX + width + deep + width} ${offsetY + size} L ${offsetX + width + deep + width} ${offsetY} - L ${offsetX + width + deep + width + deep * 0.5} ${offsetY + size * 0.5} L ${offsetX + width + deep + width + deep * 0.5} ${offsetY + size} L ${ - offsetX + width + deep + width + deep - } ${offsetY + size} L ${offsetX + width + deep + width + deep} ${offsetY} - `; + L ${offsetX + width + deep + width + deep *0.5} ${offsetY + size * 0.5} L ${offsetX + width + deep + width + deep * 0.5} ${offsetY + size} L ${offsetX + width + deep + width + deep} ${offsetY + size} L ${offsetX + width + deep + width + deep} ${offsetY} + ` return createSvg(d); -}; +} // 盒底组件 5003 export const createBoxBottomComponent2 = (width, deep, size, offsetX, offsetY) => { const d = `M ${offsetX} ${offsetY} L ${offsetX + width * 0.2} ${offsetY + size} L ${offsetX + width * 0.8} ${offsetY + size} L ${offsetX + width} ${offsetY} - L ${offsetX + width} ${offsetY + size} L ${offsetX + width + deep * 0.5} ${offsetY + size} L ${offsetX + width + deep * 0.5} ${ - offsetY + size * 0.5 - } L ${offsetX + width + deep} ${offsetY} - L ${offsetX + width + deep} ${offsetY + size} L ${offsetX + width + deep + width * 0.2} ${offsetY + size} L ${ - offsetX + width + deep + width * 0.2 - } ${offsetY + size * 0.5} L ${offsetX + width + deep + width * 0.8} ${offsetY + size * 0.5} L ${offsetX + width + deep + width * 0.8} ${ - offsetY + size - } ${offsetX + width + deep + width} ${offsetY + size} L ${offsetX + width + deep + width} ${offsetY} - L ${offsetX + width + deep + width + deep * 0.5} ${offsetY + size * 0.5} L ${offsetX + width + deep + width + deep * 0.5} ${offsetY + size} L ${ - offsetX + width + deep + width + deep - } ${offsetY + size} L ${offsetX + width + deep + width + deep} ${offsetY} + L ${offsetX + width} ${offsetY + size} L ${offsetX + width + deep * 0.5} ${offsetY + size} L ${offsetX + width + deep * 0.5} ${offsetY + size * 0.5} L ${offsetX + width + deep} ${offsetY} + L ${offsetX + width + deep} ${offsetY + size} L ${offsetX + width + deep + width * 0.2} ${offsetY + size} L ${offsetX + width + deep + width * 0.2} ${offsetY + size * 0.5} L ${offsetX + width + deep + width * 0.8} ${offsetY + size * 0.5} L ${offsetX + width + deep + width * 0.8} ${offsetY + size} ${offsetX + width + deep + width} ${offsetY + size} L ${offsetX + width + deep + width} ${offsetY} + L ${offsetX + width + deep + width + deep *0.5} ${offsetY + size * 0.5} L ${offsetX + width + deep + width + deep * 0.5} ${offsetY + size} L ${offsetX + width + deep + width + deep} ${offsetY + size} L ${offsetX + width + deep + width + deep} ${offsetY} - `; + ` return createSvg(d); -}; +} // 盒底组件 5004 export const createBoxBottomComponent3 = (width, deep, size, offsetX, offsetY) => { const d = `M ${offsetX} ${offsetY} - L ${offsetX + width * 0.05} ${offsetY + size} L ${offsetX + width * 0.25} ${offsetY + size} L ${offsetX + width * 0.5} ${offsetY + size * 0.5} L ${ - offsetX + width * 0.75 - } ${offsetY + size} L ${offsetX + width * 0.95} ${offsetY + size} L ${offsetX + width} ${offsetY} - L ${offsetX + width + deep * 0.1} ${offsetY + size} L ${offsetX + width + deep * 0.5} ${offsetY + size} L ${offsetX + width + deep} ${offsetY} - L ${offsetX + width + deep + width * 0.05} ${offsetY + size} L ${offsetX + width + deep + width * 0.25} ${offsetY + size} L ${ - offsetX + width + deep + width * 0.5 - } ${offsetY + size * 0.5} L ${offsetX + width + deep + width * 0.75} ${offsetY + size} L ${offsetX + width + deep + width * 0.95} ${ - offsetY + size - } L ${offsetX + width + deep + width} ${offsetY} - L ${offsetX + width * 2 + deep + deep * 0.5} ${offsetY + size} L ${offsetX + width * 2 + deep + deep * 0.9} ${offsetY + size} L ${ - offsetX + width * 2 + deep + deep - } ${offsetY + size} L ${offsetX + width * 2 + deep * 2} ${offsetY} - `; + L ${offsetX + width * 0.05} ${offsetY + size} L ${offsetX + width * 0.25} ${offsetY + size} L ${offsetX + width * 0.5} ${offsetY + size * 0.5} L ${offsetX + width * 0.75} ${offsetY + size} L ${offsetX + width *0.95} ${offsetY + size} L ${offsetX + width} ${offsetY} + L ${offsetX + width + deep * 0.1} ${offsetY + size} L ${offsetX + width + deep * 0.5} ${offsetY + size} L ${offsetX + width + deep} ${offsetY } + L ${offsetX + width + deep + width * 0.05} ${offsetY + size} L ${offsetX + width + deep + width * 0.25} ${offsetY + size} L ${offsetX + width + deep + width * 0.5} ${offsetY + size * 0.5} L ${offsetX + width + deep + width * 0.75} ${offsetY + size} L ${offsetX + width + deep + width *0.95} ${offsetY + size} L ${offsetX + width + deep + width} ${offsetY} + L ${offsetX + width * 2 +deep + deep *0.5} ${offsetY + size} L ${offsetX + width * 2 +deep + deep*0.9} ${offsetY + size} L ${offsetX + width * 2 +deep + deep} ${offsetY + size} L ${offsetX + width * 2 +deep * 2} ${offsetY} + ` return createSvg(d); -}; +} // 盒底组件 5005 export const createBoxBottomComponent4 = (width, deep, size, offsetX, offsetY) => { const d = `M ${offsetX} ${offsetY} - L ${offsetX} ${offsetY + size} L ${offsetX + width * 0.3} ${offsetY + size} L ${offsetX + width} ${offsetY} - L ${offsetX + width} ${offsetY + size} L ${offsetX + width + deep * 0.3} ${offsetY + size} L ${offsetX + width + deep} ${offsetY} - L ${offsetX + width + deep} ${offsetY + size} L ${offsetX + width + deep + width * 0.3} ${offsetY + size} L ${offsetX + width * 2 + deep} ${offsetY} - L ${offsetX + width * 2 + deep} ${offsetY + size} L ${offsetX + width * 2 + deep + deep * 0.3} ${offsetY + size} L ${ - offsetX + width * 2 + deep * 2 - } ${offsetY} - `; + L ${offsetX } ${offsetY + size} L ${offsetX + width * 0.3} ${offsetY + size} L ${offsetX + width} ${offsetY} + L ${offsetX + width } ${offsetY + size} L ${offsetX + width + deep * 0.3} ${offsetY + size} L ${offsetX + width + deep} ${offsetY} + L ${offsetX + width + deep} ${offsetY + size} L ${offsetX + width + deep + width * 0.3} ${offsetY + size} L ${offsetX + width * 2+ deep} ${offsetY} + L ${offsetX + width * 2 + deep } ${offsetY + size} L ${offsetX + width * 2 + deep + deep * 0.3} ${offsetY + size} L ${offsetX + width * 2+ deep * 2} ${offsetY} + ` return createSvg(d); -}; // 盒底组件 5006 +}// 盒底组件 5006 export const createBoxBottomComponent5 = (width, deep, size, offsetX, offsetY) => { const d = `M ${offsetX} ${offsetY} - A ${width * 0.5} ${width * 0.5} 0 0 0 ${offsetX + width} ${offsetY} - A ${deep * 0.5} ${deep * 0.5} 0 0 0 ${offsetX + width + deep} ${offsetY} - A ${width * 0.5} ${width * 0.5} 0 0 0 ${offsetX + width * 2 + deep} ${offsetY} - A ${deep * 0.5} ${deep * 0.5} 0 0 0 ${offsetX + width * 2 + deep * 2} ${offsetY} - `; + A ${width * 0.5} ${width * 0.5 } 0 0 0 ${offsetX + width} ${offsetY } + A ${deep * 0.5} ${deep * 0.5 } 0 0 0 ${offsetX + width + deep} ${offsetY } + A ${width * 0.5} ${width * 0.5 } 0 0 0 ${offsetX + width * 2 + deep} ${offsetY } + A ${deep * 0.5} ${deep * 0.5 } 0 0 0 ${offsetX + width * 2 + deep * 2} ${offsetY } + ` return createSvg(d); -}; +} // 盒底组件 5007 export const createBoxBottomComponent6 = (width, deep, size, offsetX, offsetY) => { const d = `M ${offsetX} ${offsetY} - L ${offsetX} ${offsetY + size} L ${offsetX + width} ${offsetY + size} L ${offsetX + width} ${offsetY} + L ${offsetX } ${offsetY + size} L ${offsetX + width } ${offsetY + size} L ${offsetX + width} ${offsetY} L ${offsetX + width + deep * 0.2} ${offsetY + size * 0.7} A ${size * 0.1} ${size * 0.1} 0 0 0 ${offsetX + width + deep * 0.2} ${offsetY + size} L ${offsetX + width + deep * 0.8} ${offsetY + size} A ${size * 0.1} ${size * 0.1} 0 0 0 ${offsetX + width + deep * 0.8} ${offsetY + size * 0.7} L ${offsetX + width + deep} ${offsetY} - L ${offsetX + width + deep} ${offsetY + size} L ${offsetX + width + width + deep} ${offsetY + size} L ${offsetX + width + deep + width} ${offsetY} - L ${offsetX + width + deep + width + deep * 0.2} ${offsetY + size * 0.7} A ${size * 0.1} ${size * 0.1} 0 0 0 ${ - offsetX + width + deep + width + deep * 0.2 - } ${offsetY + size} - L ${offsetX + width + deep + width + deep * 0.8} ${offsetY + size} A ${size * 0.1} ${size * 0.1} 0 0 0 ${ - offsetX + width + deep + width + deep * 0.8 - } ${offsetY + size * 0.7} + L ${offsetX + width + deep} ${offsetY + size} L ${offsetX + width + width + deep } ${offsetY + size} L ${offsetX + width + deep+ width} ${offsetY} + L ${offsetX + width + deep + width + deep * 0.2} ${offsetY + size * 0.7} A ${size * 0.1} ${size * 0.1} 0 0 0 ${offsetX + width + deep + width + deep * 0.2} ${offsetY + size} + L ${offsetX + width + deep+ width + deep * 0.8} ${offsetY + size} A ${size * 0.1} ${size * 0.1} 0 0 0 ${offsetX + width + deep + width + deep * 0.8} ${offsetY + size * 0.7} L ${offsetX + width + deep + width + deep} ${offsetY} - `; + ` return createSvg(d); -}; +} // 部件 -export const createBoxComponentNew = (width, deep, size, offsetX, offsetY) => { +export const createBoxComponentNew = (width, deep,size, offsetX, offsetY) => { const d = `M ${offsetX} ${offsetY} L ${offsetX} ${offsetY + deep} L ${offsetX + width} ${offsetY + deep} L ${offsetX + width} ${offsetY} - L ${offsetX + width} ${offsetY + deep + size} L ${offsetX} ${offsetY + deep + size} L ${offsetX} ${offsetY}`; + L ${offsetX + width} ${offsetY + deep + size} L ${offsetX} ${offsetY + deep + size} L ${offsetX} ${offsetY}` return createSvg(d); -}; +} // 部件1 -export const createBoxComponentNew1 = (width, deep, size, offsetX, offsetY) => { - const d = `M ${offsetX} ${offsetY} L ${offsetX} ${offsetY + size} L ${offsetX + width} ${offsetY + size} L ${offsetX + width} ${offsetY}`; +export const createBoxComponentNew1 = (width, deep,size, offsetX, offsetY) => { + const d = `M ${offsetX} ${offsetY} L ${offsetX} ${offsetY + size} L ${offsetX + width} ${offsetY + size} L ${offsetX + width} ${offsetY}` return createSvg(d); -}; +} // 部件2 -export const createBoxComponentNew2 = (width, deep, size, offsetX, offsetY) => { - const d = `M ${offsetX} ${offsetY} L ${offsetX + width * 0.4} ${offsetY} L ${offsetX + width * 0.4} ${offsetY + size} L ${offsetX + width * 0.6} ${ - offsetY + size - } L ${offsetX + width * 0.6} ${offsetY} L ${offsetX + width} ${offsetY}`; +export const createBoxComponentNew2 = (width, deep,size, offsetX, offsetY) => { + const d = `M ${offsetX} ${offsetY} L ${offsetX + width * 0.4} ${offsetY} L ${offsetX + width * 0.4} ${offsetY + size} L ${offsetX + width * 0.6} ${offsetY + size} L ${offsetX + width * 0.6} ${offsetY} L ${offsetX + width} ${offsetY}` return createSvg(d); -}; +} // 部件3 -export const createBoxComponentNew3 = (width, deep, size, offsetX, offsetY) => { - const d = `M ${offsetX} ${offsetY} L ${offsetX} ${offsetY + deep * 2} L ${offsetX + width * 0.2} ${offsetY + deep * 2} L ${offsetX + width * 0.2} ${ - offsetY + deep * 2 + size - } L ${offsetX + width * 0.4} ${offsetY + deep * 2 + size} - L ${offsetX + width * 0.4} ${offsetY + deep * 2} L ${offsetX + width * 0.6} ${offsetY + deep * 2} L${offsetX + width * 0.6} ${ - offsetY + deep * 2 + size - } L ${offsetX + width * 0.8} ${offsetY + deep * 2 + size} L ${offsetX + width * 0.8} ${offsetY + deep * 2} - L ${offsetX + width} ${offsetY + deep * 2} L ${offsetX + width} ${offsetY + deep} L ${offsetX} ${offsetY + deep} L ${offsetX + width} ${ - offsetY + deep - } ${offsetX + width} ${offsetY}`; +export const createBoxComponentNew3 = (width, deep,size, offsetX, offsetY) => { + const d = `M ${offsetX} ${offsetY} L ${offsetX} ${offsetY + deep * 2} L ${offsetX + width * 0.2} ${offsetY + deep * 2} L ${offsetX + width * 0.2} ${offsetY + deep * 2 + size} L ${offsetX + width * 0.4} ${offsetY + deep * 2 + size} + L ${offsetX + width * 0.4} ${offsetY + deep * 2} L ${offsetX + width * 0.6} ${offsetY + deep * 2} L${offsetX + width * 0.6} ${offsetY + deep * 2 + size} L ${offsetX + width * 0.8} ${offsetY + deep * 2 + size} L ${offsetX + width * 0.8} ${offsetY + deep * 2} + L ${offsetX + width} ${offsetY + deep * 2} L ${offsetX + width} ${offsetY + deep} L ${offsetX} ${offsetY+deep} L ${offsetX + width} ${offsetY+deep} ${offsetX+width} ${offsetY}` return createSvg(d); -}; +} // 部件4 -export const createBoxComponentNew4 = (width, deep, size, offsetX, offsetY) => { - const d = `M ${offsetX} ${offsetY} L ${offsetX} ${offsetY + deep * 2} L ${offsetX + width} ${offsetY + deep * 2} L ${offsetX + width} ${ - offsetY + deep - } L ${offsetX} ${offsetY + deep} L ${offsetX + width} ${offsetY + deep} L ${offsetX + width} ${offsetY} - M ${offsetX + width * 0.3} ${offsetY + deep * 0.8} L ${offsetX + width * 0.3} ${offsetY + deep * 0.6} L ${offsetX + width * 0.7} ${ - offsetY + deep * 0.6 - } L ${offsetX + width * 0.7} ${offsetY + deep * 0.8} L ${offsetX + width * 0.3} ${offsetY + deep * 0.8} - M ${offsetX + width * 0.3} ${offsetY + deep + deep * 0.8} L ${offsetX + width * 0.3} ${offsetY + deep + deep * 0.6} L ${offsetX + width * 0.7} ${ - offsetY + deep + deep * 0.6 - } L ${offsetX + width * 0.7} ${offsetY + deep + deep * 0.8} L ${offsetX + width * 0.3} ${offsetY + deep + deep * 0.8} - `; +export const createBoxComponentNew4 = (width, deep,size, offsetX, offsetY) => { + const d = `M ${offsetX} ${offsetY} L ${offsetX} ${offsetY + deep * 2} L ${offsetX + width} ${offsetY + deep * 2} L ${offsetX + width} ${offsetY + deep} L ${offsetX} ${offsetY + deep} L ${offsetX + width} ${offsetY + deep} L ${offsetX + width} ${offsetY} + M ${offsetX + width * 0.3} ${offsetY + deep * 0.8} L ${offsetX + width * 0.3} ${offsetY + deep * 0.6} L ${offsetX + width * 0.7} ${offsetY + deep * 0.6} L ${offsetX + width * 0.7} ${offsetY + deep * 0.8} L ${offsetX + width * 0.3} ${offsetY + deep * 0.8} + M ${offsetX + width * 0.3} ${offsetY+ deep + deep * 0.8} L ${offsetX + width * 0.3} ${offsetY + deep + deep * 0.6} L ${offsetX + width * 0.7} ${offsetY+ deep + deep * 0.6} L ${offsetX + width * 0.7} ${offsetY+ deep + deep * 0.8} L ${offsetX + width * 0.3} ${offsetY+ deep + deep * 0.8} + ` return createSvg(d); -}; +} // 部件4的小组件 -export const createBoxComponentNew4_1 = (width, size, offsetX, offsetY) => { - const d = `M ${offsetX} ${offsetY} L ${offsetX} ${offsetY + size} L ${offsetX + width} ${offsetY + size} L ${offsetX + width} ${offsetY}Z`; +export const createBoxComponentNew4_1 = (width,size, offsetX, offsetY) => { + const d = `M ${offsetX} ${offsetY} L ${offsetX} ${offsetY + size} L ${offsetX + width} ${offsetY + size} L ${offsetX + width} ${offsetY}Z` return createSvg(d); -}; - -// 部件5 -export const createBoxComponentNew5 = (width, deep, size, offsetX, offsetY) => { - const d = `M ${offsetX} ${offsetY} L ${offsetX} ${offsetY + deep} L ${offsetX + width} ${offsetY + deep} - L ${offsetX + width} ${offsetY} L ${offsetX + width} ${offsetY + deep} L ${offsetX + width * 0.9} ${offsetY + deep + size} - L ${offsetX + width * 0.1} ${offsetY + deep + size} L ${offsetX} ${offsetY + deep} - `; - return createSvg(d); -}; -// 手提盒部件 -export const createBoxComponentNew6 = (width, deep, size, offsetX, offsetY) => { - const d = `M ${offsetX} ${offsetY} L ${offsetX} ${offsetY + deep} L ${offsetX + width * 0.3} ${offsetY + deep} - L ${offsetX + width * 0.3} ${offsetY + deep + size * 0.5} L ${offsetX + width * 0.7} ${offsetY + deep + size * 0.5} - L ${offsetX + width * 0.7} ${offsetY + deep} L ${offsetX + width} ${offsetY + deep} L ${offsetX} ${offsetY + deep} - L ${offsetX} ${offsetY + deep + size} L ${offsetX + width * 0.1} ${offsetY + deep + size} - L ${offsetX + width * 0.1} ${offsetY + deep + size * 0.8} L ${offsetX + width * 0.2} ${offsetY + deep + size} - L ${offsetX + width * 0.8} ${offsetY + deep + size} L ${offsetX + width * 0.9} ${offsetY + deep + size * 0.8} - L ${offsetX + width * 0.9} ${offsetY + deep + size}L ${offsetX + width} ${offsetY + deep + size}L ${offsetX + width} ${offsetY} - `; - return createSvg(d); -}; +} // 贴边1 -export const createWelt = (height, size, offsetX, offsetY) => { - const d = `M ${offsetX} ${offsetY} L ${offsetX + size * 0.6} ${offsetY} L ${offsetX + size * 0.6} ${offsetY + height} L ${ - offsetX + size * 0.6 - } ${offsetY} L ${offsetX + size} ${offsetY + height * 0.1} L ${offsetX + size} ${offsetY + height * 0.9} L ${offsetX + size * 0.6} ${ - offsetY + height - } L ${offsetX} ${offsetY + height}`; +export const createWelt = (height,size,offsetX,offsetY) =>{ + const d = `M ${offsetX} ${offsetY} L ${offsetX + size * 0.6} ${offsetY} L ${offsetX + size * 0.6} ${offsetY + height} L ${offsetX + size * 0.6} ${offsetY} L ${offsetX + size} ${offsetY + height * 0.1} L ${offsetX + size} ${offsetY + height * 0.9} L ${offsetX + size * 0.6} ${offsetY + height} L ${offsetX} ${offsetY + height}` return createSvg(d); -}; +} // 贴边1 -export const createWelt1 = (height, size, offsetX, offsetY) => { - const d = `M ${offsetX} ${offsetY} L ${offsetX + size} ${offsetY + height * 0.1} L ${offsetX + size} ${offsetY + height * 0.9} L ${offsetX} ${ - offsetY + height - }`; +export const createWelt1 = (height,size,offsetX,offsetY) =>{ + const d = `M ${offsetX} ${offsetY} L ${offsetX + size} ${offsetY + height * 0.1} L ${offsetX + size} ${offsetY + height * 0.9} L ${offsetX} ${offsetY + height}` return createSvg(d); -}; +} // 贴边2 -export const createWelt2 = (height, size, offsetX, offsetY) => { - const d = `M ${offsetX} ${offsetY} L ${offsetX + size} ${offsetY} A ${size *0.3} ${size * 0.3} 0 0 1 ${offsetX } ${offsetY } L ${offsetX} ${offsetY + height} L - ${offsetX + size} ${offsetY + height} A ${size *0.3} ${size * 0.3} 0 0 0 ${offsetX} ${offsetY + height} L ${offsetX + size} ${offsetY + height} L ${offsetX + size} ${offsetY} - ` - // A ${ size * 0.5 } ${size} 0 0 1 ${offsetX} ${offsetY} L ${offsetX} ${offsetY + height} A ${size * 0.5} ${size} 0 0 1 ${offsetX + size * 0.5} ${ - // offsetY + height + Math.abs(size) - // } A ${size * 0.5} ${size} 0 0 1 ${offsetX + size} ${offsetY + height} L ${offsetX + size} ${offsetY} L ${offsetX + size} ${ - // offsetY + height - // } L ${offsetX} ${offsetY + height}`; - return createSvg(d); -}; -export const createWelt2Right = (height, size, offsetX, offsetY) => { - const d = `M ${offsetX} ${offsetY} L ${offsetX + size} ${offsetY} A ${size * 0.3} ${size * 0.3} 0 0 0 ${offsetX} ${offsetY} L ${offsetX} ${offsetY + height} - L ${offsetX + size} ${offsetY + height} A ${size *0.3} ${size * 0.3} 0 0 1 ${offsetX} ${offsetY + height} L ${offsetX + size} ${offsetY + height} L ${offsetX + size} ${offsetY} ` - // A ${ - // size * 0.5 - // } ${size} 0 0 0 ${offsetX} ${offsetY} L ${offsetX} ${offsetY + height} A ${size * 0.5} ${size} 0 0 0 ${offsetX + size * 0.5} ${ - // offsetY + height + Math.abs(size) - // } A ${size * 0.5} ${size} 0 0 0 ${offsetX + size} ${offsetY + height} L ${offsetX + size} ${offsetY} L ${offsetX + size} ${ - // offsetY + height - // } L ${offsetX} ${offsetY + height}`; +export const createWelt2 = (height,size,offsetX,offsetY) =>{ + const d = `M ${offsetX} ${offsetY} L ${offsetX + size} ${offsetY} A ${size * 0.5} ${size} 0 0 1 ${offsetX + size * 0.5} ${offsetY + size} A ${size * 0.5} ${size} 0 0 1 ${offsetX} ${offsetY} L ${offsetX} ${offsetY + height} A ${size * 0.5} ${size} 0 0 1 ${offsetX + size * 0.5} ${offsetY + height + Math.abs(size)} A ${size * 0.5} ${size} 0 0 1 ${offsetX + size} ${offsetY + height} L ${offsetX + size} ${offsetY} L ${offsetX + size} ${offsetY + height} L ${offsetX} ${offsetY + height}` return createSvg(d); -}; -export const createWelt3 = (height, size, offsetX, offsetY) => { - const d = `M ${offsetX} ${offsetY} L ${offsetX} ${offsetY + height} L ${offsetX + size} ${offsetY + height} L ${offsetX + size} ${ - offsetY + size * 0.3 - } L ${offsetX} ${offsetY + size * 0.3} L ${offsetX} ${offsetY}`; - return createSvg(d); -}; -export const createWelt4 = (height, size, offsetX, offsetY, dSFHS, dXFHS) => { - const d = `M ${offsetX} ${offsetY} L ${offsetX} ${offsetY - dSFHS} L ${offsetX + size} ${offsetY - dSFHS} L ${offsetX + size} ${offsetY + height+dXFHS} - L ${offsetX} ${offsetY + height+dXFHS} L ${offsetX} ${offsetY + height}`; +} +export const createWelt2Right = (height,size,offsetX,offsetY) =>{ + const d = `M ${offsetX} ${offsetY} L ${offsetX + size} ${offsetY} A ${size * 0.5} ${size} 0 0 0 ${offsetX + size * 0.5} ${offsetY - size} A ${size * 0.5} ${size} 0 0 0 ${offsetX} ${offsetY} L ${offsetX} ${offsetY + height} A ${size * 0.5} ${size} 0 0 0 ${offsetX + size * 0.5} ${offsetY + height + Math.abs(size)} A ${size * 0.5} ${size} 0 0 0 ${offsetX + size} ${offsetY + height} L ${offsetX + size} ${offsetY} L ${offsetX + size} ${offsetY + height} L ${offsetX} ${offsetY + height}` return createSvg(d); -}; -export const createWelt3Right = (height, size, offsetX, offsetY) => { - const d = `M ${offsetX} ${offsetY} L ${offsetX} ${offsetY + height} L ${offsetX + size} ${offsetY + height} L ${offsetX + size} ${ - offsetY - size * 0.3 - } L ${offsetX} ${offsetY - size * 0.3} L ${offsetX} ${offsetY}`; +} +export const createWelt3 = (height,size,offsetX,offsetY) =>{ + const d = `M ${offsetX} ${offsetY} L ${offsetX} ${offsetY + height} L ${offsetX + size} ${offsetY + height} L ${offsetX + size} ${offsetY + size * 0.3} L ${offsetX} ${offsetY + size * 0.3} L ${offsetX} ${offsetY}` return createSvg(d); -}; -export const createWelt4Right = (height, size, offsetX, offsetY, dSFHS, dXFHS) => { - const d = `M ${offsetX} ${offsetY} L ${offsetX} ${offsetY - dSFHS} L ${offsetX + size} ${offsetY - dSFHS} - L ${offsetX + size} ${offsetY + height + dXFHS} L ${offsetX } ${offsetY + height + dXFHS} L ${offsetX} ${offsetY + height}`; +} +export const createWelt3Right = (height,size,offsetX,offsetY) =>{ + const d = `M ${offsetX} ${offsetY} L ${offsetX} ${offsetY + height} L ${offsetX + size} ${offsetY + height} L ${offsetX + size} ${offsetY - size * 0.3} L ${offsetX} ${offsetY - size * 0.3} L ${offsetX} ${offsetY}` return createSvg(d); -}; +} // 天地盒 -export const createFullTelescope = (width, height, deep, offsetX, offsetY) => { - const d = `M ${offsetX} ${offsetY} L ${offsetX + width} ${offsetY} L ${offsetX + width} ${offsetY + height} L ${offsetX} ${ - offsetY + height - } L ${offsetX} ${offsetY} +export const createFullTelescope = (width,height,deep,offsetX,offsetY) => { + const d = `M ${offsetX} ${offsetY} L ${offsetX + width} ${offsetY} L ${offsetX + width} ${offsetY + height} L ${offsetX} ${offsetY + height} L ${offsetX} ${offsetY} L ${offsetX - deep} ${offsetY} L ${offsetX - deep} ${offsetY + height} L ${offsetX} ${offsetY + height} L ${offsetX} ${offsetY + height + deep} L ${offsetX + width} ${offsetY + height + deep} L ${offsetX + width} ${offsetY + height} L ${offsetX + width + deep} ${offsetY + height} L ${offsetX + width + deep} ${offsetY} L ${offsetX + width} ${offsetY} L ${offsetX + width} ${offsetY - deep} L ${offsetX} ${offsetY - deep} L ${offsetX} ${offsetY} - `; + ` const svg = document.createElementNS("http://www.w3.org/2000/svg", "path"); svg.setAttribute("d", d); svg.setAttribute("fill", "transparent"); @@ -978,67 +842,41 @@ export const createFullTelescope = (width, height, deep, offsetX, offsetY) => { svg.setAttribute("stroke-width", "1"); svg.setAttribute("stroke-dasharray", "4"); // 添加虚线效果 return svg; -}; +} // 天地部件1 -export const createBoxComponentNewFull = (width, deep, size, offsetX, offsetY) => { +export const createBoxComponentNewFull = (width, deep,size, offsetX, offsetY) => { const d = `M ${offsetX} ${offsetY} L ${offsetX + deep} ${offsetY} L ${offsetX + deep} ${offsetY + width} L ${offsetX + deep} ${offsetY} - L ${offsetX + deep + size} ${offsetY} L ${offsetX + deep + size} ${offsetY + width} L ${offsetX} ${offsetY + width}`; + L ${offsetX + deep + size} ${offsetY} L ${offsetX+ deep + size} ${offsetY + width} L ${offsetX} ${offsetY + width}` return createSvg(d); -}; +} // 天地部件2 -export const createBoxComponentNewFull1 = (width, size, offsetX, offsetY) => { - const d = `M ${offsetX} ${offsetY} L ${offsetX + size} ${offsetY} L ${offsetX + size} ${offsetY + width} L ${offsetX} ${offsetY + width}`; +export const createBoxComponentNewFull1 = (width,size, offsetX, offsetY) => { + const d = `M ${offsetX} ${offsetY} L ${offsetX + size} ${offsetY} L ${offsetX + size} ${offsetY + width} L ${offsetX } ${offsetY + width}` return createSvg(d); -}; +} // 天地部件3 -export const createBoxComponentNewFull2 = (width, size, offsetX, offsetY) => { - const d = `M ${offsetX} ${offsetY} L ${offsetX} ${offsetY + width * 0.4} L ${offsetX + size} ${offsetY + width * 0.4} +export const createBoxComponentNewFull2 = (width,size, offsetX, offsetY) => { + const d = `M ${offsetX} ${offsetY} L ${offsetX } ${offsetY + width * 0.4} L ${offsetX + size} ${offsetY + width * 0.4} L ${offsetX + size} ${offsetY + width * 0.6} L ${offsetX} ${offsetY + width * 0.6} L ${offsetX} ${offsetY + width} - `; + ` return createSvg(d); -}; +} // 天地部件4 -export const createBoxComponentNewFul3 = (width, deep, size, offsetX, offsetY) => { +export const createBoxComponentNewFul3 = (width, deep,size, offsetX, offsetY) => { const d = `M ${offsetX} ${offsetY} L ${offsetX + deep} ${offsetY} L ${offsetX + deep} ${offsetY + width} L ${offsetX} ${offsetY + width} - L ${offsetX + deep * 2} ${offsetY + width} L ${offsetX + deep * 2} ${offsetY + width * 0.8} L ${offsetX + deep * 2 + size} ${offsetY + width * 0.8} - L ${offsetX + deep * 2 + size} ${offsetY + width * 0.6} L ${offsetX + deep * 2} ${offsetY + width * 0.6} - L ${offsetX + deep * 2} ${offsetY + width * 0.4} L ${offsetX + deep * 2 + size} ${offsetY + width * 0.4} - L ${offsetX + deep * 2 + size} ${offsetY + width * 0.2} L ${offsetX + deep * 2} ${offsetY + width * 0.2} - L ${offsetX + deep * 2} ${offsetY} L ${offsetX} ${offsetY} - `; + L ${offsetX + deep * 2} ${offsetY + width} L ${offsetX + deep * 2} ${offsetY + width * 0.8} L ${offsetX + deep * 2+size} ${offsetY + width * 0.8} + L ${offsetX + deep * 2 + size} ${offsetY + width*0.6} L ${offsetX + deep * 2} ${offsetY + width*0.6} + L ${offsetX + deep * 2} ${offsetY + width*0.4} L ${offsetX + deep * 2 + size} ${offsetY + width*0.4} + L ${offsetX + deep * 2 + size} ${offsetY + width*0.2} L ${offsetX + deep * 2} ${offsetY + width*0.2} + L ${offsetX + deep * 2 } ${offsetY} L ${offsetX} ${offsetY} + ` return createSvg(d); -}; +} // 天地部件4 -export const createBoxComponentNewFul4 = (width, deep, size, offsetX, offsetY) => { - const d = `M ${offsetX} ${offsetY} L ${offsetX + deep * 2} ${offsetY} L ${offsetX + deep * 2} ${offsetY + width} L ${offsetX + deep} ${ - offsetY + width - } L ${offsetX + deep} ${offsetY} L ${offsetX + deep} ${offsetY + width} L ${offsetX} ${offsetY + width} - M ${offsetX + deep * 0.8} ${offsetY + width * 0.3} L ${offsetX + deep * 0.6} ${offsetY + width * 0.3} L ${offsetX + deep * 0.6} ${ - offsetY + width * 0.7 - } L ${offsetX + deep * 0.8} ${offsetY + width * 0.7} L ${offsetX + deep * 0.8} ${offsetY + width * 0.3} - M ${offsetX + deep + deep * 0.8} ${offsetY + width * 0.3} L ${offsetX + deep + deep * 0.6} ${offsetY + width * 0.3} L ${ - offsetX + deep + deep * 0.6 - } ${offsetY + width * 0.7} L ${offsetX + deep + deep * 0.8} ${offsetY + width * 0.7} L ${offsetX + deep + deep * 0.8} ${offsetY + width * 0.3} - `; +export const createBoxComponentNewFul4 = (width, deep,size, offsetX, offsetY) => { + const d = `M ${offsetX} ${offsetY} L ${offsetX + deep * 2} ${offsetY} L ${offsetX + deep * 2} ${offsetY + width} L ${offsetX + deep} ${offsetY + width} L ${offsetX + deep} ${offsetY} L ${offsetX + deep} ${offsetY + width} L ${offsetX } ${offsetY+ width} + M ${offsetX + deep * 0.8} ${offsetY + width * 0.3} L ${offsetX + deep * 0.6} ${offsetY + width * 0.3} L ${offsetX+ deep * 0.6} ${offsetY + width * 0.7} L ${offsetX+ deep * 0.8} ${offsetY + width * 0.7} L ${offsetX+ deep * 0.8} ${offsetY + width * 0.3} + M ${offsetX + deep + deep * 0.8} ${offsetY+ width * 0.3} L ${offsetX + deep + deep * 0.6} ${offsetY+ width * 0.3} L ${offsetX+ deep + deep * 0.6} ${offsetY + width * 0.7} L ${offsetX+ deep + deep * 0.8} ${offsetY + width * 0.7} L ${offsetX+ deep + deep * 0.8 } ${offsetY + width * 0.3} + ` return createSvg(d); -}; -// 部件5 -export const createBoxComponentNewFul5 = (width, deep, size, offsetX, offsetY) => { - const d = `M ${offsetX} ${offsetY} L ${offsetX + deep} ${offsetY} L ${offsetX + deep} ${offsetY + width} - L ${offsetX + deep} ${offsetY} L ${offsetX + deep + size} ${offsetY + width * 0.1} L${offsetX + deep + size} ${offsetY + width * 0.9} - L ${offsetX + deep} ${offsetY + width} L ${offsetX} ${offsetY + width} - `; - return createSvg(d); -}; -// 手提盒部件 -export const createBoxComponentNewFul6 = (width, deep, size, offsetX, offsetY) => { - const d = `M ${offsetX} ${offsetY} L ${offsetX + deep} ${offsetY} L ${offsetX + deep} ${offsetY + width * 0.3} - L ${offsetX + deep + size * 0.5} ${offsetY + width * 0.3} L ${offsetX + deep + size * 0.5} ${offsetY + width * 0.7} - L ${offsetX + deep} ${offsetY + width * 0.7} L ${offsetX + deep} ${offsetY + width} L ${offsetX + deep} ${offsetY} - L ${offsetX + deep + size} ${offsetY} L ${offsetX + deep + size} ${offsetY + width * 0.1} - L ${offsetX + deep + size * 0.8} ${offsetY + width * 0.1} L ${offsetX + deep + size} ${offsetY + width * 0.2} - L ${offsetX + deep + size} ${offsetY + width * 0.8} L ${offsetX + deep + size * 0.8} ${offsetY + width * 0.9} - L ${offsetX + deep + size} ${offsetY + width * 0.9}L ${offsetX + deep + size} ${offsetY + width}L ${offsetX} ${offsetY + width} - `; - return createSvg(d); -}; +} \ No newline at end of file diff --git a/src/components/Common/BoxDesignCompontent/compontents/doubleLayer.js b/src/components/Common/BoxDesignCompontent/compontents/doubleLayer.js deleted file mode 100644 index db1da9a..0000000 --- a/src/components/Common/BoxDesignCompontent/compontents/doubleLayer.js +++ /dev/null @@ -1,415 +0,0 @@ -/* eslint-disable */ -import React, { useRef, useState, useEffect } from "react"; -import styles from "../index.less"; -import SvgBox from "../svg"; -import { Select, Button, message, Input, Spin } from "antd-v4"; -import { CompressOutlined, ExpandOutlined } from "@ant-design/icons"; -import * as commonUtils from "@/utils/utils"; -import * as commonFunc from "@/components/Common/commonFunc"; -import * as commonBusiness from "@/components/Common/commonBusiness"; -import * as commonServices from "@/services/services"; -import CommonBase from "@/components/Common/CommonBase"; -import AntdDraggableModal from "@/components/Common/AntdDraggableModal"; -import CommonViewTable from "@/components/Common/CommonViewTable"; -import StaticEditTable from "@/components/Common/CommonTable"; -import jsPreviewPdf from "@js-preview/pdf"; -import commonConfig from "@/utils/config"; -const DoubleLayerBox = props => { - const { onCancel, onOk, title, loading, masterConfig, bFullScreen, tableData, options = [] } = props; - const { slaveData = {}, masterData = {} } = props.state; - const [boxList, setBoxList] = useState([]); - const [tableColum, setTableColum] = useState([]); // 盒身类型 - const [tableDataList, setTableDataList] = useState([]); // 盒长 - const [boxBodyList, setBoxBodyList] = useState([]); // 盒身信息 - const [isDefaultValue, setIsDefaultValue] = useState(true); // 是否默认值 - const [topBoxList, setTopBoxList] = useState([]); // 盒身信息 - const [leftBoxList, setLeftBoxList] = useState([]); // 左边 - const [rightBoxList, setRightBoxList] = useState([]); - // useEffect(() => { - // if (tableData && tableData.length) { - // const newTableColum = tableData.map(item => { - // return { - // ...item, - // isEditable: true, - // isSelect: false, - // selectImage: null, - // value: "", - // }; - // }); - // const newList = newTableColum.filter( - // item => item.showName.includes("盒长") || item.showName.includes("盒高") || item.showName.includes("盒宽") - // ); - // const newLists = newTableColum.filter( - // item => - // !(item.showName.includes("盒长") || item.showName.includes("盒高") || item.showName.includes("盒宽") || item.showName.includes("盒身")) - // ); - // const bodyList = newTableColum.filter(item => item.showName.includes("盒身")); - // newLists.forEach(x => { - // if (x.showName === "盒型类别") { - // x.showName = "盒型名称"; - // } - // }); - // setTableColum(newLists); - // setBoxBodyList(bodyList); - // newList.forEach(item => { - // let name = ""; - // if (item.showName === "盒长") { - // name = item.showName + "(L)"; - // } else if (item.showName === "盒宽") { - // name = item.showName + "(W)"; - // } else if (item.showName === "盒高") { - // name = item.showName + "(D)"; - // } - // item.sName = name; - // }); - // setTableDataList(newList); - // } - // }, [tableData]); - const titleList = [ - "左(上)插位组件", - "上插位组件", - "右(上)插位组件", - "左偏移", - "左插位组件", - "左(下)插位组件", - "右偏移", - "右插位组件", - "右(下)插位组件", - "盒型名称", - "盒身", - "个数", - "首盒长(L)", - "首盒宽(W)", - "次盒长(L)", - "次盒宽(W)", - ]; - const titleList1 = [ - { name: "左(上)插位组件", value: "dZSCW" }, - { name: "上插位组件", value: "dSCW" }, - { name: "右(上)插位组件", value: "dYSCW" }, - { name: "左偏移", value: "dZPY" }, - { name: "左插位组件", value: "dZCW" }, - { name: "左(下)插位组件", value: "dZXCW" }, - { name: "右偏移", value: "dYPY" }, - { name: "右插位组件", value: "dYCW" }, - { name: "右(下)插位组件", value: "dYXCW" }, - ]; - // tableColum.forEach(item => { - // titleList.push(item.showName); - // }); - // boxBodyList.forEach(item => { - // titleList.push(item.showName); - // }); - // tableDataList.forEach(item => { - // titleList.push(item.showName); - // }); - const newBoxList = []; - // 盒身信息 - titleList.forEach((item, index) => { - newBoxList.push({ - value: "", - sName: item, - isEditable: true, - isSelect: false, - selectValue: null, - selectLabel: "", - selectImage: null, - type: null, - show: true, - showName: item, // 参数名称 - sAssignFormula: null, - }); - }); - if (slaveData && slaveData.length) { - slaveData.forEach((item, index) => { - const i = titleList1.findIndex(i => { - return i.value === item.sCode; - }); - if (i !== -1) { - const x = newBoxList.findIndex(z => z.sName === titleList1[i].name); - newBoxList[x].value = item.iValue; - newBoxList[x].type = item.sTypes; - newBoxList[x].showName = item.sName; - newBoxList[x].selectImage = item.sMakeUpPath; - newBoxList[x].sName = titleList1[i].name; - newBoxList[x].sAssignFormula = item.sAssignFormula; - newBoxList[x].bVisible = item.bVisible; - } - }); - } - // 盒身信息 - if (masterData) { - newBoxList.forEach((item, index) => { - if (item.sName === "盒身") { - newBoxList[index].value = masterData.sBoxBody; - newBoxList[index].selectImage = masterData.sMakeUpPath; - newBoxList[index].type = masterData.sTypes; - } else if (item.sName === "盒长") { - newBoxList[index].value = masterData.dBoxLength; - } else if (item.sName === "盒宽") { - newBoxList[index].value = masterData.dBoxWidth; - } else if (item.sName === "盒高") { - newBoxList[index].value = masterData.dBoxHeight; - } else if (item.sName === "盒型名称") { - newBoxList[index].value = masterData.sName; - } - }); - } - const arraysAreEqual = (arr1, arr2) => { - if (arr1.length !== arr2.length) return false; - return arr1.every((item, index) => item.sName === arr2[index].sName); - }; - // 有数据的时候 盒型设计需要赋值 - useEffect(() => { - if (newBoxList.length > 0 && !arraysAreEqual(boxList, newBoxList)) { - setBoxList(newBoxList); - } - }, [newBoxList]); - const getImage = fileName => { - // const imageUrl = `${commonConfig.file_host}file/download?savePathStr=${fileName}&sModelsId=100&token=${props.token}`; - const imageUrl = `${commonConfig.file_host}file/download?savePathStr=${fileName}&scale=0.1&sModelsId=100&token=${props.token}`; - return imageUrl; - }; - // 下来框 - const renderOptionWithImage = option => { - return ( - -
- {option.sMakeUpPath ? : ""} - {option.sName} -
-
- ); - }; - const svgBoxProps = { - ...props, - boxList, - showNew: 0, - }; - - useEffect(() => { - if (!boxList.length) return; - const slicedArray = boxList.slice(9, 12); - // 处理盒型部分 - setBoxBodyList(slicedArray); - }, [boxList]); - console.log(tableDataList, "boxList"); - - return ( -
-
- {topBoxList.map((topItem, index) => ( -
-
{topItem.sName}
- {topItem?.selectImage ? ( - {topItem.value} - ) : ( - "" - )} - - -
- {/*
参数:
*/} - handleChangeName(e, index)} - onFocus={e => handleFocus(e, index)} - onBlur={e => handleBlur(e, index)} - readOnly={!topItem?.isEditable} - className={styles.text} - /> - handleChange(e, index)} - onFocus={e => handleFocus(e, index)} - onBlur={e => handleBlur(e, index)} - readOnly={!topItem?.isEditable} - style={{ width: " 80%" }} - /> -
-
- ))} -
-
- {leftBoxList.map((item, index) => ( -
-
{titleList[index + 3]}
- - -
- {item?.selectImage ? ( - {item.value} - ) : ( - "" - )} - handleChangeName(e, findIndexBySname(item.sName))} - onFocus={e => handleFocus(e, findIndexBySname(item.sName))} - onBlur={e => handleBlur(e, findIndexBySname(item.sName))} - readOnly={!item?.isEditable} - className={styles.text} - /> - handleChange(e, findIndexBySname(item.sName))} - onFocus={e => handleFocus(e, findIndexBySname(item.sName))} - onBlur={e => handleBlur(e, findIndexBySname(item.sName))} - readOnly={!item?.isEditable} - style={{ width: " 80%" }} - /> -
-
- ))} -
-
- {rightBoxList.map((item, index) => ( -
-
{titleList[findIndexBySname(item.sName)]}
- - -
- {item?.selectImage ? ( - {item.value} - ) : ( - "" - )} - - handleChangeName(e, findIndexBySname(item.sName))} - onFocus={e => handleFocus(e, findIndexBySname(item.sName))} - onBlur={e => handleBlur(e, findIndexBySname(item.sName))} - readOnly={!item?.isEditable} - className={styles.text} - /> - handleChange(e, findIndexBySname(item.sName))} - onFocus={e => handleFocus(e, findIndexBySname(item.sName))} - onBlur={e => handleBlur(e, findIndexBySname(item.sName))} - readOnly={!item?.isEditable} - style={{ width: " 80%" }} - /> -
-
- ))} -
-
-
- -
-
-
- {boxBodyList && boxBodyList.length - ? boxBodyList.map((item, index) => { - const uniqueIndex = index + 9; - return ( -
-
-
- {item.showName} -
- {boxList[uniqueIndex]?.selectImage ? ( - {boxList[uniqueIndex].value} - ) : ( - "" - )} - {isDefaultValue ?
{boxList[uniqueIndex]?.value}
: ""} - -
-
- ); - }) - : ""} -
-
-
-
- ); -}; -export default DoubleLayerBox; diff --git a/src/components/Common/BoxDesignCompontent/index.js b/src/components/Common/BoxDesignCompontent/index.js index 7def463..2dad824 100644 --- a/src/components/Common/BoxDesignCompontent/index.js +++ b/src/components/Common/BoxDesignCompontent/index.js @@ -1,6 +1,6 @@ /* eslint-disable */ import React, { useRef, useState, useEffect } from "react"; -import { Select, Button, message, Input, Spin } from "antd-v4"; +import { Select, Button, message, Input, Spin } from "antd"; import { CompressOutlined, ExpandOutlined } from "@ant-design/icons"; import * as commonUtils from "@/utils/utils"; import * as commonFunc from "@/components/Common/commonFunc"; @@ -11,7 +11,7 @@ import AntdDraggableModal from "@/components/Common/AntdDraggableModal"; import CommonViewTable from "@/components/Common/CommonViewTable"; import StaticEditTable from "@/components/Common/CommonTable"; import jsPreviewPdf from "@js-preview/pdf"; -import commonConfig from "@/utils/config"; +import * as commonConfig from "@/utils/config"; import SvgBox from "./svg"; import styles from "./index.less"; const BoxDesignEvent = props => { @@ -53,13 +53,16 @@ const BoxDesignEvent = props => { setLoading(false); }; - useEffect(() => { - if (!formData.length) return; + useEffect( + () => { + if (!formData.length) return; - const data = formData[0].gdsconfigformslave.filter(Item => Item.bVisible); - setTableData(data); - props.onSaveState(pre => ({ ...pre, data })); - }, [formData.length]); + const data = formData[0].gdsconfigformslave.filter(Item => Item.bVisible); + setTableData(data); + props.onSaveState(pre => ({ ...pre, data })); + }, + [formData.length] + ); return { ...props, @@ -77,83 +80,58 @@ const BoxDesignCompontent = baseProps => { const [boxList, setBoxList] = useState([]); const [tableColum, setTableColum] = useState([]); // 盒身类型 const [tableDataList, setTableDataList] = useState([]); // 盒长 - const [tableDataLists, setTableDataLists] = useState([]); // 盒长 const [boxBodyList, setBoxBodyList] = useState([]); // 盒身信息 const [isDefaultValue, setIsDefaultValue] = useState(true); // 是否默认值 const [topBoxList, setTopBoxList] = useState([]); // 盒身信息 - const [topDoubleBoxList, setTopDoubleBoxList] = useState([]); // 盒身信息 const [leftBoxList, setLeftBoxList] = useState([]); // 左边 - const [leftDoubleBoxList, setLeftDoubleBoxList] = useState([]); // 左边 const [rightBoxList, setRightBoxList] = useState([]); - const [rightDoubleBoxList, setRightDoubleBoxList] = useState([]); const [boxKey, setBoxKey] = useState(new Date().getTime()); - const [doubleLayerList, setDoubleLayerList] = useState([]); if (!boxVisible) return ""; - // 1️⃣ 只负责 tableColum - useEffect(() => { - if (!tableData?.length) return; - - const newTableColum = tableData - .filter(item => item.bVisible) // 先过滤可见 - .map(item => ({ - ...item, - isEditable: true, - isSelect: false, - selectImage: null, - value: "", - })) - .filter( - item => - !(item.showName.includes("盒长") || item.showName.includes("盒高") || item.showName.includes("盒宽") || item.showName.includes("盒身")) - ) - .map(item => (item.showName === "盒型类别" ? { ...item, showName: "盒型名称" } : item)); - - setTableColum(newTableColum); - }, [tableData]); - - // 2️⃣ 只负责 boxBodyList - useEffect(() => { - if (!tableData?.length) return; - - const bodyList = tableData - .filter(item => item.bVisible) - .map(item => ({ - ...item, - isEditable: true, - isSelect: false, - selectImage: null, - value: "", - })) - .filter(item => item.showName.includes("盒身")); - - setBoxBodyList(bodyList); - }, [tableData]); - - // 3️⃣ 只负责 tableDataList 和 tableDataLists - useEffect(() => { - if (!tableData?.length) return; - - const newList = tableData - .filter(item => item.bVisible) - .map(item => ({ - ...item, - isEditable: true, - isSelect: false, - selectImage: null, - value: "", - })) - .filter(item => item.showName.includes("盒长") || item.showName.includes("盒高") || item.showName.includes("盒宽")) - .map(item => { - let name = ""; - if (item.showName === "盒长") name = "盒长(L)"; - if (item.showName === "盒宽") name = "盒宽(W)"; - if (item.showName === "盒高") name = "盒高(D)"; - return { ...item, sName: name }; - }); - - setTableDataList(newList); - setTableDataLists(newList); - }, [tableData]); + useEffect( + () => { + if (tableData && tableData.length) { + const newTableColum = tableData.map(item => { + return { + ...item, + isEditable: true, + isSelect: false, + selectImage: null, + value: "", + }; + }); + // const last = newTableColum.pop(); + // const newList = [last, ...newTableColum]; + const newList = newTableColum.filter( + item => item.showName.includes("盒长") || item.showName.includes("盒高") || item.showName.includes("盒宽") + ); + const newLists = newTableColum.filter( + item => + !(item.showName.includes("盒长") || item.showName.includes("盒高") || item.showName.includes("盒宽") || item.showName.includes("盒身")) + ); + const bodyList = newTableColum.filter(item => item.showName.includes("盒身")); + newLists.forEach(x => { + if (x.showName === "盒型类别") { + x.showName = "盒型名称"; + } + }); + setTableColum(newLists); + setBoxBodyList(bodyList); + newList.forEach(item => { + let name = ""; + if (item.showName === "盒长") { + name = item.showName + "(L)"; + } else if (item.showName === "盒宽") { + name = item.showName + "(W)"; + } else if (item.showName === "盒高") { + name = item.showName + "(D)"; + } + item.sName = name; + }); + setTableDataList(newList); + } + }, + [tableData] + ); const titleList = [ "上方盒舌", "盒底组件", @@ -176,46 +154,19 @@ const BoxDesignCompontent = baseProps => { { name: "右贴边位", value: "dYTBW" }, { name: "右(下)插位组件", value: "dYXCW" }, ]; - const doubleTitlieList = [ - "左上插位组件", - "上插位组件", - "右上插位组件", - "左偏移", - "左插位组件", - "左下插位组件", - "右偏移", - "右插位组件", - "右下插位组件", - ]; - const doubleTitlieList1 = [ - { name: "左上插位组件", value: "dZSCW" }, - { name: "上插位组件", value: "dSCW" }, - { name: "右上插位组件", value: "dYSCW" }, - { name: "左偏移", value: "dZPY" }, - { name: "左插位组件", value: "dZCW" }, - { name: "左下插位组件", value: "dZXCW" }, - { name: "右偏移", value: "dYPY" }, - { name: "右插位组件", value: "dYCW" }, - { name: "右下插位组件", value: "dYXCW" }, - { name: "首盒长", value: "dSHC" }, - { name: "首盒宽", value: "dSHK" }, - { name: "次盒长", value: "dCHC" }, - { name: "次盒宽", value: "dCHK" }, - ]; const newBoxList = []; // const boxs = titleList.length + tableData.length; tableColum.forEach(item => { titleList.push(item.showName); }); + console.log("🚀 ~ tableColum:", tableColum); boxBodyList.forEach(item => { titleList.push(item.showName); }); tableDataList.forEach(item => { titleList.push(item.showName); }); - // 这里处理双盒的初始数据 - titleList.push(...["首盒长", "首盒宽", "次盒长", "次盒宽"], ...doubleTitlieList); // 盒身信息 titleList.forEach((item, index) => { newBoxList.push({ @@ -229,54 +180,29 @@ const BoxDesignCompontent = baseProps => { type: null, show: true, showName: item, // 参数名称 - sAssignFormula: null, + sAssignFormula:null }); }); // 部件信息 - - const boxTypes = masterData.sTypes; if (slaveData && slaveData.length) { - if (boxTypes !== "8") { - slaveData.forEach((item, index) => { - const i = titleList1.findIndex(i => { - return i.value === item.sCode; - }); - if (i !== -1) { - const x = newBoxList.findIndex(z => z.sName === titleList1[i].name); - newBoxList[x].value = item.iValue; - newBoxList[x].type = item.sTypes; - newBoxList[x].showName = item.sName; - newBoxList[x].selectImage = item.sMakeUpPath; - newBoxList[x].sName = titleList1[i].name; - newBoxList[x].sAssignFormula = item.sAssignFormula; - newBoxList[x].bVisible = item.bVisible; - } - }); - } else { - slaveData.forEach((item, index) => { - const i = doubleTitlieList1.findIndex(i => { - return i.value === item.sCode; - }); - if (i !== -1) { - const x = newBoxList.findIndex(z => z.sName === doubleTitlieList1[i].name); - newBoxList[x].value = item.iValue; - newBoxList[x].type = item.sTypes; - newBoxList[x].showName = item.sName; - newBoxList[x].selectImage = item.sMakeUpPath; - newBoxList[x].sName = doubleTitlieList1[i].name; - newBoxList[x].sAssignFormula = item.sAssignFormula; - newBoxList[x].bVisible = item.bVisible; - } + slaveData.forEach((item, index) => { + const i = titleList1.findIndex(i => { + return i.value === item.sCode; }); - // 双盒盒型单独处理 - } + if (i !== -1) { + const x = newBoxList.findIndex(z => z.sName === titleList1[i].name); + newBoxList[x].value = item.iValue; + newBoxList[x].type = item.sTypes; + newBoxList[x].showName = item.sName; + newBoxList[x].selectImage = item.sMakeUpPath; + newBoxList[x].sName = titleList1[i].name; + newBoxList[x].sAssignFormula = item.sAssignFormula + newBoxList[x].bVisible = item.bVisible + } + }); } // 盒身信息 if (masterData) { - const headLength = slaveData.find(item => item.sCode === "dSHC")?.iValue - const headWidth = slaveData.find(item => item.sCode === "dSHK")?.iValue - const orderLength = slaveData.find(item => item.sCode === "dCHC")?.iValue - const orderWidth = slaveData.find(item => item.sCode === "dCHK")?.iValue newBoxList.forEach((item, index) => { if (item.sName === "盒身") { newBoxList[index].value = masterData.sBoxBody; @@ -290,121 +216,69 @@ const BoxDesignCompontent = baseProps => { newBoxList[index].value = masterData.dBoxHeight; } else if (item.sName === "盒型名称") { newBoxList[index].value = masterData.sName; - } else if (item.sName === "首盒长") { - newBoxList[index].value = headLength; - } else if (item.sName === "首盒宽") { - newBoxList[index].value = headWidth; - } else if (item.sName === "次盒长") { - newBoxList[index].value = orderLength; - } else if (item.sName === "次盒宽") { - newBoxList[index].value = orderWidth; - } + } }); } // 有数据的时候 盒型设计需要赋值 - useEffect(() => { - if (newBoxList.length > 0 && !arraysAreEqual(boxList, newBoxList)) { - setBoxList(newBoxList); - } - }, [newBoxList]); + useEffect( + () => { + if (newBoxList.length > 0 && !arraysAreEqual(boxList, newBoxList)) { + setBoxList(newBoxList); + } + }, + [newBoxList] + ); const arraysAreEqual = (arr1, arr2) => { if (arr1.length !== arr2.length) return false; return arr1.every((item, index) => item.sName === arr2[index].sName); }; - useEffect(() => { - const type = boxList.find(item => item.sName === "盒身")?.type; - const updateLists = () => { - const topBoxFilter = item => item.sName === "上方盒舌" || item.sName === "盒底组件" || item.sName === "下方盒舌"; - - const leftBoxFilter = item => item.sName === "左(上)插位组件" || item.sName === "左贴边位" || item.sName === "左(下)插位组件"; - - const rightBoxFilter = item => item.sName === "右(上)插位组件" || item.sName === "右贴边位" || item.sName === "右(下)插位组件"; - - if (type === "2" || type === 2 || type === "4" || type === 4 || type === 3 || type === "3" || type === 5 || type === "5") { - const box = [...boxList]; - box.forEach(x => { - x.show = true; - }); - if (type === "2" || type === 2) { - box.forEach(x => x.sName === "盒底组件" && (x.show = false)); - } else if (type === "4" || type === 4) { - const title = ["盒底组件", "左贴边位", "右贴边位"]; - box.forEach(x => title.includes(x.sName) && (x.show = false)); - } else if (type === "3" || type === 3) { - const title = ["左(上)插位组件", "右(下)插位组件", "盒底组件"]; - box.forEach(x => title.includes(x.sName) && (x.show = false)); - } else if (type === "5" || type === 5) { - const title = ["盒底组件"]; - box.forEach(x => title.includes(x.sName) && (x.show = false)); - } - setTopBoxList(box.filter(topBoxFilter)); - setLeftBoxList(box.filter(leftBoxFilter)); - if (type === 3 || type === "3") { - setRightBoxList(box.filter(rightBoxFilter).reverse()); + useEffect( + () => { + const type = boxList.find(item => item.sName === "盒身")?.type; + const updateLists = () => { + const topBoxFilter = item => item.sName === "上方盒舌" || item.sName === "盒底组件" || item.sName === "下方盒舌"; + + const leftBoxFilter = item => item.sName === "左(上)插位组件" || item.sName === "左贴边位" || item.sName === "左(下)插位组件"; + + const rightBoxFilter = item => item.sName === "右(上)插位组件" || item.sName === "右贴边位" || item.sName === "右(下)插位组件"; + + if (type === "2" || type === 2 || type === "4" || type === 4 || type === 3 || type === "3") { + const box = [...boxList]; + box.forEach(x => { + x.show = true; + }); + if (type === "2" || type === 2) { + box.forEach(x => x.sName === "盒底组件" && (x.show = false)); + } else if (type === "4" || type === 4) { + const title = ["盒底组件", "左贴边位", "右贴边位"]; + box.forEach(x => title.includes(x.sName) && (x.show = false)); + } else if (type === "3" || type === 3) { + const title = ["左(上)插位组件", "右(下)插位组件", "盒底组件"]; + box.forEach(x => title.includes(x.sName) && (x.show = false)); + } + setTopBoxList(box.filter(topBoxFilter)); + setLeftBoxList(box.filter(leftBoxFilter)); + if (type === 3 || type === "3") { + setRightBoxList(box.filter(rightBoxFilter).reverse()); + } else { + setRightBoxList(box.filter(rightBoxFilter)); + } } else { + const box = [...boxList]; + box.forEach(x => { + x.show = true; + }); + setTopBoxList(box.filter(topBoxFilter)); + setLeftBoxList(box.filter(leftBoxFilter)); setRightBoxList(box.filter(rightBoxFilter)); } - } else if (type === "7" || type === 7) { - const box = [...boxList]; - box.forEach(x => { - x.show = true; - }); - const title = ["盒底组件", "左贴边位", "右贴边位", "上方盒舌", "下方盒舌"]; - box.forEach(x => title.includes(x.sName) && (x.show = false)); - setTopBoxList(box.filter(topBoxFilter)); - setLeftBoxList(box.filter(leftBoxFilter)); - setRightBoxList(box.filter(rightBoxFilter)); - } else if (type === "8" || type === 8) { - const box = [...boxList]; - box.forEach(x => { - x.show = true; - }); - const topBoxFilter = item => item.sName === "左上插位组件" || item.sName === "上插位组件" || item.sName === "右上插位组件"; - const leftBoxFilter = item => item.sName === "左偏移" || item.sName === "左插位组件" || item.sName === "左下插位组件"; - const rightBoxFilter = item => item.sName === "右偏移" || item.sName === "右插位组件" || item.sName === "右下插位组件"; - setTopDoubleBoxList(box.filter(topBoxFilter)); - setLeftDoubleBoxList(box.filter(leftBoxFilter)); - setRightDoubleBoxList(box.filter(rightBoxFilter)); - } else { - const box = [...boxList]; - box.forEach(x => { - x.show = true; - }); - setTopBoxList(box.filter(topBoxFilter)); - setLeftBoxList(box.filter(leftBoxFilter)); - setRightBoxList(box.filter(rightBoxFilter)); - } - }; + }; - updateLists(); - }, [boxList]); - const boxType = boxList.find(item => item.sName === "盒身")?.type; - // 监听盒身类型 - useEffect(() => { - if (!boxType) return; - if (boxType === "8") { - const createBox = names => - names.map(sName => ({ - value: "", - sName, - isEditable: true, - isSelect: false, - selectValue: null, - selectLabel: "", - selectImage: null, - type: null, - show: true, - showName: sName, - sAssignFormula: null, - })); - setDoubleLayerList(createBox(["首盒长", "首盒宽", "次盒长", "次盒宽"])); - // setTopDoubleBoxList(createBox(["左上插位组件", "上插位组件", "右上插位组件"])); - // setLeftDoubleBoxList(createBox(["左偏移", "左插位组件", "左下插位组件"])); - // setRightDoubleBoxList(createBox(["右偏移", "右插位组件", "右下插位组件"])); - } else { - } - }, [boxType]); + updateLists(); + }, + [boxList] + ); const handleFocus = (e, index) => { if (boxList && boxList.length) { @@ -461,17 +335,15 @@ const BoxDesignCompontent = baseProps => { setBoxList(updatedBoxList); }; const getImage = fileName => { - // const imageUrl = `${commonConfig.file_host}file/download?savePathStr=${fileName}&sModelsId=100&token=${props.token}`; - const imageUrl = `${commonConfig.file_host}file/download?savePathStr=${fileName}&scale=0.1&sModelsId=100&token=${props.token}`; + const imageUrl = `${commonConfig.file_host}file/download?savePathStr=${fileName}&sModelsId=100&token=${props.token}`; return imageUrl; }; - // 下来框 const renderOptionWithImage = option => { return (
- {option.sMakeUpPath ? : ""} + {option.sMakeUpPath ? {option.sName} : ""} {option.sName}
@@ -480,11 +352,6 @@ const BoxDesignCompontent = baseProps => { const svgBoxProps = { ...props, boxList, - showNew: 0, - }; - const dobuleProps = { - ...props, - renderOptionWithImage, }; // 计算展长展宽 // 创建盒型 @@ -493,26 +360,24 @@ const BoxDesignCompontent = baseProps => { // 判断是新增还是修改 // 存储子表数据 - const boxTypes = boxList.find(item => item.sName === "盒身")?.type; - const findList = boxTypes === "8" ? doubleTitlieList1 : titleList1; boxList.forEach((item, index) => { - const i = findList.findIndex(i => i.name === item.sName); - const slave = slaveData.find(z => z.sCode === findList[i]?.value); + const i = titleList1.findIndex(i => i.name === item.sName); + const slave = slaveData.find(z => z.sCode === titleList1[i]?.value); if (i !== -1) { const data = { ...slaveData[0], handleType: slave ? "update" : "add", sName: item.showName, - sCode: findList[i].value, + sCode: titleList1[i].value, iValue: item.value, iOrder: index + 1, iRowNum: index + 1, sId: slave ? slave.sId : commonUtils.createSid(), sMakeUpPath: item.selectImage, sTypes: item.type, - bVisible: item.value ? true : false, + bVisible: (item.value ? true : false), sParentId: masterData.sId, - sAssignFormula: item.sAssignFormula, + sAssignFormula:item.sAssignFormula }; // if (item.value !== "") { newSlaveData.push(data); @@ -527,337 +392,6 @@ const BoxDesignCompontent = baseProps => { } }); submitSlaveData.concat(newSlaveData); - - // 处理计算公式 - // 计算展长公式 sLengthFormula - let sLengthFormula = ""; - let sWidthFormula = ""; - const boxType = boxList.find(item => item.sName === "盒身")?.type; - if (boxType === "8") { - - } else { - const boxLength = Number(boxList.find(item => item.sName === "盒长")?.value); - const boxWidth = Number(boxList.find(item => item.sName === "盒宽")?.value); - const boxHeight = Number(boxList.find(item => item.sName === "盒高")?.value); - const zxcw = boxList.find(x => x.sName === "左(下)插位组件"); - const zscw = boxList.find(x => x.sName === "左(上)插位组件"); - const yscw = boxList.find(x => x.sName === "右(上)插位组件"); - const yxcw = boxList.find(x => x.sName === "右(下)插位组件"); - const hdzj = boxList.find(x => x.sName === "盒底组件"); - const zxcwType = zxcw?.type; - const zxcwValue = zxcw?.value; - const zscwType = zscw?.type; - const zscwValue = zscw?.value; - const yscwType = yscw?.type; - const yscwValue = yscw?.value; - const yxcwType = yxcw?.type; - const yxcwValue = yxcw?.value; - let leftTopValue = 0; - let leftTop = ""; - let rightTopValue = 0; - let rightTop = ""; - let leftBottomValue = 0; - let leftBottom = ""; - let rightBottomValue = 0; - let rightBottom = ""; - if (boxType && boxType === "1") { - // 四面盒 - const ztbw = boxList.find(x => x.sName === "左贴边位")?.type && boxList.find(x => x.sName === "左贴边位")?.value; - const ytbw = boxList.find(x => x.sName === "右贴边位")?.type && boxList.find(x => x.sName === "右贴边位")?.value; - sLengthFormula = (ztbw ? "dZTBW+ " : "") + "L * 2 + W * 2" + (ytbw ? " +dYTBW" : ""); - - if (zxcwType === "4001" || zxcwType === "4006" || zxcwType === "4007") { - leftBottomValue = Number(zxcwValue) + boxHeight; - leftBottom = " + dZXCW + W"; - } else if (zxcwType === "4002" || zxcwType === "4003") { - leftBottomValue = Number(zxcwValue); - leftBottom = " + dZXCW"; - } else if (zxcwType === "4004") { - leftBottomValue = Number(zxcwValue) + boxHeight * 2; - leftBottom = " + dZXCW + W * 2"; - } else if (zxcwType === "4005") { - leftBottomValue = boxHeight * 2; - leftBottom = "+ W * 2"; - } - if (yscwType === "6001" || yscwType === "6006" || yscwType === "6007") { - rightTopValue = Number(yscwValue) + boxHeight; - rightTop = "dYSCW + W + "; - } else if (yscwType === "6002" || yscwType === "6003") { - rightTopValue = Number(yscwValue); - rightTop = "dYSCW + "; - } else if (yscwType === "6004") { - rightTopValue = Number(yscwValue) + boxHeight * 2; - rightTop = "dYSCW + W * 2+ "; - } else if (yscwType === "6005") { - rightTopValue = boxHeight * 2; - rightTop = "W * 2+ "; - } - if (zscwType === "3001" || zscwType === "3006" || zscwType === "3007") { - leftTopValue = Number(zscwValue) + boxHeight; - leftTop = "dZSCW + W +"; - } else if (zscwType === "3002" || zscwType === "3003") { - leftTopValue = Number(zscwValue); - leftTop = "dZSCW +"; - } else if (zscwType === "3004") { - leftTopValue = Number(zscwValue) + boxHeight * 2; - leftTop = "dZSCW + W * 2 +"; - } else if (zscwType === "3005") { - leftTopValue = boxHeight * 2; - leftTop = "W * 2 +"; - } - if (yxcwType === "7001" || yxcwType === "7006" || yxcwType === "7007") { - rightBottomValue = Number(yxcwValue) + boxHeight; - rightBottom = "+ dYXCW + W"; - } else if (yxcwType === "7002" || yxcwType === "7003") { - rightBottomValue = Number(yxcwValue); - rightBottom = "+ dYXCW "; - } else if (yxcwType === "7004") { - rightBottomValue = Number(yxcwValue) + boxHeight * 2; - rightBottom = "+ dYXCW + W * 2"; - } else if (yxcwType === "7005") { - rightBottomValue = boxHeight * 2; - rightBottom = "+ W * 2"; - } - sWidthFormula = - (leftTopValue > rightTopValue ? leftTop : rightTop) + - "D" + - (hdzj ? " + dHDC" : leftBottomValue > rightBottomValue ? leftBottom : rightBottom); - } else if (boxType && boxType === "2") { - // 单折 - const ztbw = boxList.find(x => x.sName === "左贴边位")?.type && boxList.find(x => x.sName === "左贴边位")?.value; - const ytbw = boxList.find(x => x.sName === "右贴边位")?.type && boxList.find(x => x.sName === "右贴边位")?.value; - sLengthFormula = (ztbw ? "dZTBW+ " : "") + "L * 2 + W" + (ytbw ? " +dYTBW" : ""); - if (zxcwType === "4001" || zxcwType === "4006" || zxcwType === "4007") { - leftBottomValue = Number(zxcwValue) + boxHeight; - leftBottom = " + dZXCW + W"; - } else if (zxcwType === "4002" || zxcwType === "4003") { - leftBottomValue = Number(zxcwValue); - leftBottom = " + dZXCW"; - } else if (zxcwType === "4004") { - leftBottomValue = Number(zxcwValue) + boxHeight * 2; - leftBottom = " + dZXCW + W * 2"; - } else if (zxcwType === "4005") { - leftBottomValue = boxHeight * 2; - leftBottom = "+ W * 2"; - } - if (yscwType === "6001" || yscwType === "6006" || yscwType === "6007") { - rightTopValue = Number(yscwValue) + boxHeight; - rightTop = "dYSCW + W + "; - } else if (yscwType === "6002" || yscwType === "6003") { - rightTopValue = Number(yscwValue); - rightTop = "dYSCW + "; - } else if (yscwType === "6004") { - rightTopValue = Number(yscwValue) + boxHeight * 2; - rightTop = "dYSCW + W * 2+ "; - } else if (yscwType === "6005") { - rightTopValue = boxHeight * 2; - rightTop = "W * 2+ "; - } - if (zscwType === "3001" || zscwType === "3006" || zscwType === "3007") { - leftTopValue = Number(zscwValue) + boxHeight; - leftTop = "dZSCW + W +"; - } else if (zscwType === "3002" || zscwType === "3003") { - leftTopValue = Number(zscwValue); - leftTop = "dZSCW +"; - } else if (zscwType === "3004") { - leftTopValue = Number(zscwValue) + boxHeight * 2; - leftTop = "dZSCW + W * 2 +"; - } else if (zscwType === "3005") { - leftTopValue = boxHeight * 2; - leftTop = "W * 2 +"; - } - if (yxcwType === "7001" || yxcwType === "7006" || yxcwType === "7007") { - rightBottomValue = Number(yxcwValue) + boxHeight; - rightBottom = "+ dYXCW + W"; - } else if (yxcwType === "7002" || yxcwType === "7003") { - rightBottomValue = Number(yxcwValue); - rightBottom = "+ dYXCW "; - } else if (yxcwType === "7004") { - rightBottomValue = Number(yxcwValue) + boxHeight * 2; - rightBottom = "+ dYXCW + W * 2"; - } else if (yxcwType === "7005") { - rightBottomValue = boxHeight * 2; - rightBottom = "+ W * 2"; - } - sWidthFormula = (leftTopValue > rightTopValue ? leftTop : rightTop) + "D" + (leftBottomValue > rightBottomValue ? leftBottom : rightBottom); - } else if (boxType && boxType === "3") { - const ztbw = boxList.find(x => x.sName === "左贴边位")?.type && boxList.find(x => x.sName === "左贴边位")?.value; - const ytbw = boxList.find(x => x.sName === "右贴边位")?.type && boxList.find(x => x.sName === "右贴边位")?.value; - sLengthFormula = (ztbw ? "dZTBW+ " : "") + "L + W * 2" + (ytbw ? " +dYTBW" : ""); - if (zxcwType === "4001" || zxcwType === "4006" || zxcwType === "4007") { - leftBottomValue = Number(zxcwValue) + boxHeight; - leftBottom = " + dZXCW + W"; - } else if (zxcwType === "4002" || zxcwType === "4003") { - leftBottomValue = Number(zxcwValue); - leftBottom = " + dZXCW"; - } else if (zxcwType === "4004") { - leftBottomValue = Number(zxcwValue) + boxHeight * 2; - leftBottom = " + dZXCW + W * 2"; - } else if (zxcwType === "4005") { - leftBottomValue = boxHeight * 2; - leftBottom = "+ W * 2"; - } - if (yscwType === "6001" || yscwType === "6006" || yscwType === "6007") { - rightTopValue = Number(yscwValue) + boxHeight; - rightTop = "dYSCW + W + "; - } else if (yscwType === "6002" || yscwType === "6003") { - rightTopValue = Number(yscwValue); - rightTop = "dYSCW + "; - } else if (yscwType === "6004") { - rightTopValue = Number(yscwValue) + boxHeight * 2; - rightTop = "dYSCW + W * 2+ "; - } else if (yscwType === "6005") { - rightTopValue = boxHeight * 2; - rightTop = "W * 2+ "; - } - if (zscwType === "3001" || zscwType === "3006" || zscwType === "3007") { - leftTopValue = Number(zscwValue) + boxHeight; - leftTop = "dZSCW + W +"; - } else if (zscwType === "3002" || zscwType === "3003") { - leftTopValue = Number(zscwValue); - leftTop = "dZSCW +"; - } else if (zscwType === "3004") { - leftTopValue = Number(zscwValue) + boxHeight * 2; - leftTop = "dZSCW + W * 2 +"; - } else if (zscwType === "3005") { - leftTopValue = boxHeight * 2; - leftTop = "W * 2 +"; - } - if (yxcwType === "7001" || yxcwType === "7006" || yxcwType === "7007") { - rightBottomValue = Number(yxcwValue) + boxHeight; - rightBottom = "+ dYXCW + W"; - } else if (yxcwType === "7002" || yxcwType === "7003") { - rightBottomValue = Number(yxcwValue); - rightBottom = "+ dYXCW "; - } else if (yxcwType === "7004") { - rightBottomValue = Number(yxcwValue) + boxHeight * 2; - rightBottom = "+ dYXCW + W * 2"; - } else if (yxcwType === "7005") { - rightBottomValue = boxHeight * 2; - rightBottom = "+ W * 2"; - } - sWidthFormula = (leftTopValue > rightTopValue ? leftTop : rightTop) + "D" + (leftBottomValue > rightBottomValue ? leftBottom : rightBottom); - } else if (boxType && boxType === "4") { - // 天地盒 - const zxcw = boxList.find(x => x.sName === "左(下)插位组件"); - const zscw = boxList.find(x => x.sName === "左(上)插位组件"); - const yscw = boxList.find(x => x.sName === "右(上)插位组件"); - const yxcw = boxList.find(x => x.sName === "右(下)插位组件"); - const zxcwType = zxcw?.type; - const zxcwValue = zxcw?.value; - const zscwType = zscw?.type; - const zscwValue = zscw?.value; - const yscwType = yscw?.type; - const yscwValue = yscw?.value; - const yxcwType = yxcw?.type; - const yxcwValue = yxcw?.value; - let leftValue = ""; - let rightValue = ""; - let topValue = ""; - let bottomValue = ""; - if (zxcwType === "4001" || zxcwType === "4006" || zxcwType === "4007") { - // leftValue = leftValue + Number(zxcwValue) + boxHeight * 2; - leftValue = "dZXCW + D * 2 +"; - } else if (zxcwType === "4002" || zxcwType === "4003") { - leftValue = "dZXCW + D +"; - } else if (zxcwType === "4004") { - leftValue = "dZXCW + D * 3 +"; - } else if (zxcwType === "4005") { - leftValue = "D * 3 +"; - } - if (yscwType === "6001" || yscwType === "6006" || yscwType === "6007") { - rightValue = "+ dYSCW + D * 2"; - } else if (yscwType === "6002" || yscwType === "6003") { - rightValue = "+ dYSCW + D"; - } else if (yscwType === "6004") { - rightValue = "+ dYSCW + D * 3"; - } else if (yscwType === "6005") { - rightValue = " + D * 3"; - } - if (zscwType === "3001" || zscwType === "3006" || zscwType === "3007") { - topValue = "dZSCW + D * 2 +"; - } else if (zscwType === "3002" || zscwType === "3003") { - topValue = "dZSCW + D +"; - } else if (zscwType === "3004") { - topValue = "dZSCW + D * 3 +"; - } else if (zscwType === "3005") { - topValue = "D * 3+"; - } - if (yxcwType === "7001" || yxcwType === "7006" || yxcwType === "7007") { - bottomValue = "+ dYXCW + D * 2"; - } else if (yxcwType === "7002" || yxcwType === "7003") { - bottomValue = "+ dYXCW + D "; - } else if (yxcwType === "7004") { - bottomValue = "+ dYXCW + D * 3"; - } else if (yxcwType === "7005") { - bottomValue = "+ D * 3"; - } - // viewBoxWidth = Number(boxLength) + leftValue + rightValue; - // viewBoxHeight = Number(boxWidth) + topValue + bottomValue; - sLengthFormula = leftValue + "L" + rightValue; - sWidthFormula = topValue + "W" + bottomValue; - } else if (boxType && boxType === "5") { - // 飞机盒 - const ztbw = boxList.find(x => x.sName === "左贴边位")?.type && boxList.find(x => x.sName === "左贴边位")?.value; - const ytbw = boxList.find(x => x.sName === "右贴边位")?.type && boxList.find(x => x.sName === "右贴边位")?.value; - sLengthFormula = (ztbw ? "dZTBW+ " : "") + "D * 2 + W * 2" + (ytbw ? " +dYTBW" : ""); - if (zxcwType === "4001" || zxcwType === "4006" || zxcwType === "4007") { - leftBottomValue = Number(zxcwValue) + boxHeight; - leftBottom = " + dZXCW + D"; - } else if (zxcwType === "4002" || zxcwType === "4003") { - leftBottomValue = Number(zxcwValue); - leftBottom = " + dZXCW"; - } else if (zxcwType === "4004") { - leftBottomValue = Number(zxcwValue) + boxHeight * 2; - leftBottom = " + dZXCW + D * 2"; - } else if (zxcwType === "4005") { - leftBottomValue = boxHeight * 2; - leftBottom = "+ D * 2"; - } - if (yscwType === "6001" || yscwType === "6006" || yscwType === "6007") { - rightTopValue = Number(yscwValue) + boxHeight; - rightTop = "dYSCW + D + "; - } else if (yscwType === "6002" || yscwType === "6003") { - rightTopValue = Number(yscwValue); - rightTop = "dYSCW + "; - } else if (yscwType === "6004") { - rightTopValue = Number(yscwValue) + boxHeight * 2; - rightTop = "dYSCW + D * 2+ "; - } else if (yscwType === "6005") { - rightTopValue = boxHeight * 2; - rightTop = "D * 2+ "; - } - if (zscwType === "3001" || zscwType === "3006" || zscwType === "3007") { - leftTopValue = Number(zscwValue) + boxHeight; - leftTop = "dZSCW + D +"; - } else if (zscwType === "3002" || zscwType === "3003") { - leftTopValue = Number(zscwValue); - leftTop = "dZSCW +"; - } else if (zscwType === "3004") { - leftTopValue = Number(zscwValue) + boxHeight * 2; - leftTop = "dZSCW + D * 2 +"; - } else if (zscwType === "3005") { - leftTopValue = boxHeight * 2; - leftTop = "D * 2 +"; - } - if (yxcwType === "7001" || yxcwType === "7006" || yxcwType === "7007") { - rightBottomValue = Number(yxcwValue) + boxHeight; - rightBottom = "+ dYXCW + D"; - } else if (yxcwType === "7002" || yxcwType === "7003") { - rightBottomValue = Number(yxcwValue); - rightBottom = "+ dYXCW "; - } else if (yxcwType === "7004") { - rightBottomValue = Number(yxcwValue) + boxHeight * 2; - rightBottom = "+ dYXCW + D * 2"; - } else if (yxcwType === "7005") { - rightBottomValue = boxHeight * 2; - rightBottom = "+ D * 2"; - } - sWidthFormula = (leftTopValue > rightTopValue ? leftTop : rightTop) + "L" + (leftBottomValue > rightBottomValue ? leftBottom : rightBottom); - } - } - - // const sDoubleSize = JSON.stringify([headLength,headWidth,orderLength,orderWidth]) // 存储盒身数据 主表 const newMasterData = { ...masterData, @@ -868,17 +402,13 @@ const BoxDesignCompontent = baseProps => { sName: boxList.find(item => item.sName === "盒型名称")?.value || "", sMakeUpPath: boxList.find(item => item.sName === "盒身")?.selectImage || "", sTypes: boxList.find(item => item.sName === "盒身")?.type || "", - sLengthFormula: masterData.sLengthFormula || sLengthFormula, - sWidthFormula: masterData.sWidthFormula || sWidthFormula, }; - onOk({ slaveData: newSlaveData, masterData: newMasterData }); // 提交数据 }; const findIndexBySname = name => { const i = boxList.findIndex(x => x.sName === name); return i || 0; }; - return ( { }} > {/* 盒身信息 */} -
- {boxType !== "8" && - topBoxList.map((topItem, index) => ( -
-
{topItem.sName}
- {topItem?.selectImage ? ( - {topItem.value} - ) : ( - "" - )} - - -
- {/*
参数:
*/} - handleChangeName(e, index)} - onFocus={e => handleFocus(e, index)} - onBlur={e => handleBlur(e, index)} - readOnly={!topItem?.isEditable} - className={styles.text} - /> - handleChange(e, index)} - onFocus={e => handleFocus(e, index)} - onBlur={e => handleBlur(e, index)} - readOnly={!topItem?.isEditable} - style={{ width: " 80%" }} - /> -
+ {topBoxList.map((topItem, index) => ( +
+
{topItem.sName}
+ {topItem?.selectImage ? ( + {topItem.value} + ) : ( + "" + )} + + +
+ {/*
参数:
*/} + handleChangeName(e, index)} + onFocus={e => handleFocus(e, index)} + onBlur={e => handleBlur(e, index)} + readOnly={!topItem?.isEditable} + className={styles.text} + /> + handleChange(e, index)} + onFocus={e => handleFocus(e, index)} + onBlur={e => handleBlur(e, index)} + readOnly={!topItem?.isEditable} + style={{ width: " 80%" }} + />
- ))} - {boxType === "8" && - topDoubleBoxList.map((item, index) => ( -
-
{doubleTitlieList[index]}
+
+ ))} +
+
+ {leftBoxList.map((item, index) => ( +
+
{titleList[index + 3]}
+ + +
{item?.selectImage ? ( {item.value} - ) : ( - "" - )} - - -
- handleChangeName(e, findIndexBySname(item.sName))} - onFocus={e => handleFocus(e, findIndexBySname(item.sName))} - onBlur={e => handleBlur(e, findIndexBySname(item.sName))} - readOnly={!item?.isEditable} - className={styles.text} - /> - handleChange(e, findIndexBySname(item.sName))} - onFocus={e => handleFocus(e, findIndexBySname(item.sName))} - onBlur={e => handleBlur(e, findIndexBySname(item.sName))} - readOnly={!item?.isEditable} - style={{ width: " 80%" }} - /> -
-
- ))} -
-
- {boxType !== "8" && - leftBoxList.map((item, index) => ( -
-
{titleList[index + 3]}
- - -
- {item?.selectImage ? ( - {item.value} - ) : ( - "" - )} - handleChangeName(e, findIndexBySname(item.sName))} - onFocus={e => handleFocus(e, findIndexBySname(item.sName))} - onBlur={e => handleBlur(e, findIndexBySname(item.sName))} - readOnly={!item?.isEditable} - className={styles.text} - /> - handleChange(e, findIndexBySname(item.sName))} - onFocus={e => handleFocus(e, findIndexBySname(item.sName))} - onBlur={e => handleBlur(e, findIndexBySname(item.sName))} - readOnly={!item?.isEditable} - style={{ width: " 80%" }} - /> -
-
- ))} - {boxType === "8" && - leftDoubleBoxList.map((item, index) => ( -
-
{doubleTitlieList[index + 3]}
- - {index !== 0 ? ( - + /> ) : ( "" )} -
- {item?.selectImage ? ( - {item.value} - ) : ( - "" - )} - handleChangeName(e, findIndexBySname(item.sName))} - onFocus={e => handleFocus(e, findIndexBySname(item.sName))} - onBlur={e => handleBlur(e, findIndexBySname(item.sName))} - readOnly={!item?.isEditable} - className={styles.text} - /> - handleChange(e, findIndexBySname(item.sName))} - onFocus={e => handleFocus(e, findIndexBySname(item.sName))} - onBlur={e => handleBlur(e, findIndexBySname(item.sName))} - readOnly={!item?.isEditable} - style={{ width: " 80%" }} - /> -
+ handleChangeName(e, findIndexBySname(item.sName))} + onFocus={e => handleFocus(e, findIndexBySname(item.sName))} + onBlur={e => handleBlur(e, findIndexBySname(item.sName))} + readOnly={!item?.isEditable} + className={styles.text} + /> + handleChange(e, findIndexBySname(item.sName))} + onFocus={e => handleFocus(e, findIndexBySname(item.sName))} + onBlur={e => handleBlur(e, findIndexBySname(item.sName))} + readOnly={!item?.isEditable} + style={{ width: " 80%" }} + />
- ))} +
+ ))}
- {boxType !== "8" && - rightBoxList.map((item, index) => ( -
-
{titleList[findIndexBySname(item.sName)]}
- - -
- {item?.selectImage ? ( - {item.value} - ) : ( - "" - )} - - handleChangeName(e, findIndexBySname(item.sName))} - onFocus={e => handleFocus(e, findIndexBySname(item.sName))} - onBlur={e => handleBlur(e, findIndexBySname(item.sName))} - readOnly={!item?.isEditable} - className={styles.text} - /> - handleChange(e, findIndexBySname(item.sName))} - onFocus={e => handleFocus(e, findIndexBySname(item.sName))} - onBlur={e => handleBlur(e, findIndexBySname(item.sName))} - readOnly={!item?.isEditable} - style={{ width: " 80%" }} - /> -
-
- ))} - {boxType === "8" && - rightDoubleBoxList.map((item, index) => ( -
-
{doubleTitlieList[index + 6]}
- - {index !== 0 ? ( - handleSelect(value, option, findIndexBySname(item.sName), 0)} + onDropdownVisibleChange={async open => { + if (open) { + props.getSqlOptions(findIndexBySname(item.sName) + 1); // 在下拉菜单打开时调用 getSqlOptions + } + }} + > + {!loading ? options.map(option => renderOptionWithImage(option)) : ""} + +
+ {item?.selectImage ? ( + {item.value} - {!loading ? options.map(option => renderOptionWithImage(option)) : ""} - + /> ) : ( "" )} -
- {item?.selectImage ? ( - {item.value} - ) : ( - "" - )} - handleChangeName(e, findIndexBySname(item.sName))} - onFocus={e => handleFocus(e, findIndexBySname(item.sName))} - onBlur={e => handleBlur(e, findIndexBySname(item.sName))} - readOnly={!item?.isEditable} - className={styles.text} - /> - handleChange(e, findIndexBySname(item.sName))} - onFocus={e => handleFocus(e, findIndexBySname(item.sName))} - onBlur={e => handleBlur(e, findIndexBySname(item.sName))} - readOnly={!item?.isEditable} - style={{ width: " 80%" }} - /> -
+ handleChangeName(e, findIndexBySname(item.sName))} + onFocus={e => handleFocus(e, findIndexBySname(item.sName))} + onBlur={e => handleBlur(e, findIndexBySname(item.sName))} + readOnly={!item?.isEditable} + className={styles.text} + /> + handleChange(e, findIndexBySname(item.sName))} + onFocus={e => handleFocus(e, findIndexBySname(item.sName))} + onBlur={e => handleBlur(e, findIndexBySname(item.sName))} + readOnly={!item?.isEditable} + style={{ width: " 80%" }} + />
- ))} +
+ ))}
@@ -1305,7 +662,7 @@ const BoxDesignCompontent = baseProps => { }) : ""}
- {tableDataList && tableDataList.length && boxType !== "8" + {tableDataList && tableDataList.length ? tableDataList.map((item, index) => { const uniqueIndex = index + 9 + tableColum.length + boxBodyList.length; @@ -1325,28 +682,6 @@ const BoxDesignCompontent = baseProps => { }) : ""}
- -
- {doubleLayerList && doubleLayerList.length && boxType === "8" - ? doubleLayerList.map((item, index) => { - const uniqueIndex = index + 9 + tableColum.length + boxBodyList.length + tableDataList.length; - - return ( -
-
{item.sName}
- handleChange(e, uniqueIndex)} - onFocus={e => handleFocus(e, uniqueIndex)} - onBlur={e => handleBlur(e, uniqueIndex)} - readOnly={!boxList[uniqueIndex]?.isEditable} - style={{ width: " 60%" }} - /> -
- ); - }) - : ""} -
diff --git a/src/components/Common/BoxDesignCompontent/showSvg.js b/src/components/Common/BoxDesignCompontent/showSvg.js index ddcefc9..b5f30f5 100644 --- a/src/components/Common/BoxDesignCompontent/showSvg.js +++ b/src/components/Common/BoxDesignCompontent/showSvg.js @@ -26,7 +26,6 @@ import { createBoxComponentNew2, createBoxComponentNew3, createBoxComponentNew4, - createBoxComponentNew5, createBoxComponentNew4_1, createWelt, createWelt1, @@ -195,7 +194,7 @@ const SvgBox = props => { } // 左上部件 pathList.push(createDynamicTopLeft(zsbj?.type, scaledWidth, -scaledHeight, -dZSCW * scale, 0, 0)); - if ((zsbj?.type === "3001" && zsbj?.value )|| (zsbj?.type === "3006" && zsbj?.value)) { + if (zsbj?.type === "3001" && zsbj?.value) { pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, -scaledHeight / 2, scales)); pathList.push(createText(scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); // 插位值 @@ -350,7 +349,7 @@ const SvgBox = props => { } // 左上部件 pathList.push(createDynamicTopLeft(zsbj?.type, scaledWidth, -scaledHeight, -dZSCW * scale, 0, 0)); - if ((zsbj?.type === "3001" && zsbj?.value )|| (zsbj?.type === "3006" && zsbj?.value)) { + if (zsbj?.type === "3001" && zsbj?.value) { pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, -scaledHeight / 2, scales)); pathList.push(createText(scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); pathList.push(createText(scaledWidth / 2, -scaledHeight - dZSCW / 2 + 4, 10 * scales, dZSCW)); @@ -579,7 +578,7 @@ const SvgBox = props => { const zscw = valueList.find(x => x.sName === "左(上)插位组件"); const yscw = valueList.find(x => x.sName === "右(上)插位组件"); let top = 0; - const one = ["6001", "3001", "4001", "7001", "3006", "4006", "6006", "7006"]; + const one = ["6001", "3001", "4001", "7001"]; const four = ["6004", "3004", "4004", "7004"]; const five = ["6005", "3005", "4005", "7005"]; const dYSCW = Number(yscw?.value) || 0; @@ -634,7 +633,7 @@ const SvgBox = props => { // 将找到的对象放入数组中,并过滤掉 undefined 值 // 使用 reduce 方法比较 value 属性,找出最大的对象 let top = 0; - const one = ["6001", "3001", "4001", "7001", "3006", "4006", "6006", "7006"]; + const one = ["6001", "3001", "4001", "7001"]; const four = ["6004", "3004", "4004", "7004"]; const five = ["6005", "3005", "4005", "7005"]; const dYSCW = Number(yscw?.value) || 0; @@ -872,9 +871,6 @@ const SvgBox = props => { case "3005": data = createBoxComponentNew4(width, height, size, offsetX, offsetY); break; - case "3006": - data = createBoxComponentNew5(width, height, size, offsetX, offsetY); - break; case "4001": data = createBoxComponentNew(width, height, size, offsetX, offsetY); break; @@ -890,9 +886,6 @@ const SvgBox = props => { case "4005": data = createBoxComponentNew4(width, height, size, offsetX, offsetY); break; - case "4006": - data = createBoxComponentNew5(width, height, size, offsetX, offsetY); - break; case "6001": data = createBoxComponentNew(width, height, size, offsetX, offsetY); break; @@ -908,9 +901,6 @@ const SvgBox = props => { case "6005": data = createBoxComponentNew4(width, height, size, offsetX, offsetY); break; - case "6006": - data = createBoxComponentNew5(width, height, size, offsetX, offsetY); - break; case "7001": data = createBoxComponentNew(width, height, size, offsetX, offsetY); break; @@ -926,9 +916,6 @@ const SvgBox = props => { case "7005": data = createBoxComponentNew4(width, height, size, offsetX, offsetY); break; - case "7006": - data = createBoxComponentNew5(width, height, size, offsetX, offsetY); - break; default: data = createNoneProject(); break; diff --git a/src/components/Common/BoxDesignCompontent/svg.js b/src/components/Common/BoxDesignCompontent/svg.js index 3608b31..5e2c821 100644 --- a/src/components/Common/BoxDesignCompontent/svg.js +++ b/src/components/Common/BoxDesignCompontent/svg.js @@ -13,7 +13,6 @@ import { createTrapezoidWeltTop, createFoldWeltTop, createFoldWeltTopLine, - createPathElements, createRoundedCornersWeltTop, createRightAngleBoxBottomComponent, createBoxBottomComponent1, @@ -27,17 +26,13 @@ import { createBoxComponentNew2, createBoxComponentNew3, createBoxComponentNew4, - createBoxComponentNew5, - createBoxComponentNew6, createBoxComponentNew4_1, createWelt, createWelt1, createWelt2, createWelt2Right, createWelt3, - createWelt4, createWelt3Right, - createWelt4Right, createText, createDoubleArrow, createHorizontalDoubleArrow, @@ -47,36 +42,32 @@ import { createBoxComponentNewFull2, createBoxComponentNewFul3, createBoxComponentNewFul4, - createBoxComponentNewFul5, - createBoxComponentNewFul6, } from "../BoxDesign/createAirplaneBox"; const SvgBox = props => { const svgContainerRef = useRef(null); const svgRef = useRef(null); const [boxKey, setBoxKey] = useState(new Date().getTime()); - const { boxList, dSvgBoxWidth, dSvgBoxHeight, iFAngle } = props; + const { boxList, dSvgBoxWidth, dSvgBoxHeight } = props; const [width, setWidth] = useState(0); const [height, setHeight] = useState(0); const [deep, setDeep] = useState(0); const [svgType, setSvgType] = useState(1); // 盒身 - useEffect(() => { - setTimeout(() => { - const svg = svgRef.current; - if (svg) { + useEffect( + () => { + setTimeout(() => { initSVG(); - } - }, 0); - }, [boxList, svgType]); + }, 0); + }, + [boxList, svgType] + ); // 初始化svg const initSVG = () => { - // setBoxKey(new Date().getTime()); + setBoxKey(new Date().getTime()); const svg = svgRef.current; - const g = document.createElementNS("http://www.w3.org/2000/svg", "g"); // 创建 - svg.innerHTML = ""; - if (!(boxList && boxList.length)) return; + // 获取盒型类型 const svgTypes = boxList.find(x => x.sName === "盒身")?.type || 1; setSvgType(svgTypes); @@ -84,21 +75,11 @@ const SvgBox = props => { // 获取盒长、盒宽、盒高 const boxLength = Number(boxList.find(x => x.sName === "盒长")?.value) || 0; const boxWidth = Number(boxList.find(x => x.sName === "盒宽")?.value) || 0; - let boxHeight = Number(boxList.find(x => x.sName === "盒高")?.value) || 0; + const boxHeight = Number(boxList.find(x => x.sName === "盒高")?.value) || 0; setWidth(boxLength); setHeight(boxWidth); setDeep(boxHeight); - let headLength = 0; - let headWidth = 0; - let orderLength = 0; - let orderWidth = 0; - if (svgTypes === "8") { - headLength = Number(boxList.find(x => x.sName === "首盒长")?.value) || 0; - headWidth = Number(boxList.find(x => x.sName === "首盒宽")?.value) || 0; - orderLength = Number(boxList.find(x => x.sName === "次盒长")?.value) || 0; - orderWidth = Number(boxList.find(x => x.sName === "次盒宽")?.value) || 0; - } // 计算视口宽度和高度 const zbtb = boxList.find(x => x.sName === "左贴边位"); @@ -127,431 +108,63 @@ const SvgBox = props => { // 展宽 if (boxList && boxList.length) { // 如果存在部件和盒舌 取最大的 - const top = topOffect(boxList, boxLength, boxWidth, boxHeight); const bottom = bottomOffect(boxList, boxLength, boxWidth, boxHeight); - max = Number(top) + Number(bottom); - if (Number(svgType) === 8) { - const top = topOffect(boxList, headLength, headWidth); - const bottom = bottomOffect(boxList, orderLength, orderWidth); - max = Number(top) + Number(bottom); - } + max = top + bottom; } let viewBoxHeight = Number(boxHeight) + max; if (Number(svgType) === 1) { // 四面盒身 - viewBoxWidth = Number(boxLength) * 2 + Number(boxWidth) * 2 + dZTBW + dYTBW; + viewBoxWidth = dZTBW + Number(boxLength) * 2 + Number(boxWidth) * 2; } else if (Number(svgType) === 2) { viewBoxWidth = boxLength * 2 + boxWidth + dYTBW + dZTBW; } else if (Number(svgType) === 3) { viewBoxWidth = boxLength + boxWidth * 2 + dYTBW + dZTBW; - } else if (Number(svgType) === 4) { - // 天地盒 - - const zxcw = boxList.find(x => x.sName === "左(下)插位组件"); - const zscw = boxList.find(x => x.sName === "左(上)插位组件"); - const yscw = boxList.find(x => x.sName === "右(上)插位组件"); - const yxcw = boxList.find(x => x.sName === "右(下)插位组件"); - const zxcwType = zxcw?.type; - const zxcwValue = zxcw?.value; - const zscwType = zscw?.type; - const zscwValue = zscw?.value; - const yscwType = yscw?.type; - const yscwValue = yscw?.value; - const yxcwType = yxcw?.type; - const yxcwValue = yxcw?.value; - let leftValue = 0; - let rightValue = 0; - let topValue = 0; - let bottomValue = 0; - if (zxcwType === "4001" || zxcwType === "4006" || zxcwType === "4007") { - leftValue = leftValue + Number(zxcwValue) + boxHeight * 2; - } else if (zxcwType === "4002" || zxcwType === "4003") { - leftValue = leftValue + Number(zxcwValue) + boxHeight; - } else if (zxcwType === "4004") { - leftValue = leftValue + Number(zxcwValue) + boxHeight * 3; - } else if (zxcwType === "4005") { - leftValue = boxHeight * 3; - } - if (yscwType === "6001" || yscwType === "6006" || yscwType === "6007") { - rightValue = rightValue + Number(yscwValue) + boxHeight * 2; - } else if (yscwType === "6002" || yscwType === "6003") { - rightValue = rightValue + Number(yscwValue) + boxHeight; - } else if (yscwType === "6004") { - rightValue = rightValue + Number(yscwValue) + boxHeight * 3; - } else if (yscwType === "6005") { - rightValue = boxHeight * 3; - } - if (zscwType === "3001" || zscwType === "3006" || zscwType === "3007") { - topValue = topValue + Number(zscwValue) + boxHeight * 2; - } else if (zscwType === "3002" || zscwType === "3003") { - topValue = topValue + Number(zscwValue) + boxHeight; - } else if (zscwType === "3004") { - topValue = topValue + Number(zscwValue) + boxHeight * 3; - } else if (zscwType === "3005") { - topValue = boxHeight * 3; - } - if (yxcwType === "7001" || yxcwType === "7006" || yxcwType === "7007") { - bottomValue = bottomValue + Number(yxcwValue) + boxHeight * 2; - } else if (yxcwType === "7002" || yxcwType === "7003") { - bottomValue = bottomValue + Number(yxcwValue) + boxHeight; - } else if (yxcwType === "7004") { - bottomValue = bottomValue + Number(yxcwValue) + boxHeight * 3; - } else if (yxcwType === "7005") { - bottomValue = boxHeight * 3; - } - viewBoxWidth = Number(boxLength) + leftValue + rightValue; - viewBoxHeight = Number(boxWidth) + topValue + bottomValue; - } else if (Number(svgType) === 5) { - viewBoxWidth = (boxHeight + boxWidth) * 2 + dYTBW + dZTBW; - viewBoxHeight = boxLength + max; - } else if (Number(svgType) === 6) { - viewBoxWidth = boxWidth + 2; - viewBoxHeight = boxLength + 2; - } else if (Number(svgType) === 7) { - boxHeight = boxWidth; - const zxcw = boxList.find(x => x.sName === "左(下)插位组件"); - const zscw = boxList.find(x => x.sName === "左(上)插位组件"); - const yscw = boxList.find(x => x.sName === "右(上)插位组件"); - const yxcw = boxList.find(x => x.sName === "右(下)插位组件"); - const zxcwType = zxcw?.type; - const zxcwValue = zxcw?.value; - const zscwType = zscw?.type; - const zscwValue = zscw?.value; - const yscwType = yscw?.type; - const yscwValue = yscw?.value; - const yxcwType = yxcw?.type; - const yxcwValue = yxcw?.value; - let leftValue = 0; - let rightValue = 0; - let topValue = 0; - let bottomValue = 0; - if (zxcwType === "4001" || zxcwType === "4006" || zxcwType === "4007") { - leftValue = leftValue + Number(zxcwValue) + boxHeight * 2; - } else if (zxcwType === "4002" || zxcwType === "4003") { - leftValue = leftValue + Number(zxcwValue) + boxHeight; - } else if (zxcwType === "4004") { - leftValue = leftValue + Number(zxcwValue) + boxHeight * 3; - } else if (zxcwType === "4005") { - leftValue = boxHeight * 3; - } - if (yscwType === "6001" || yscwType === "6006" || yscwType === "6007") { - rightValue = rightValue + Number(yscwValue) + boxHeight * 2; - } else if (yscwType === "6002" || yscwType === "6003") { - rightValue = rightValue + Number(yscwValue) + boxHeight; - } else if (yscwType === "6004") { - rightValue = rightValue + Number(yscwValue) + boxHeight * 3; - } else if (yscwType === "6005") { - rightValue = boxHeight * 3; - } - if (zscwType === "3001" || zscwType === "3006" || zscwType === "3007") { - topValue = topValue + Number(zscwValue) + boxHeight * 2; - } else if (zscwType === "3002" || zscwType === "3003") { - topValue = topValue + Number(zscwValue) + boxHeight; - } else if (zscwType === "3004") { - topValue = topValue + Number(zscwValue) + boxHeight * 3; - } else if (zscwType === "3005") { - topValue = boxHeight * 3; - } - if (yxcwType === "7001" || yxcwType === "7006" || yxcwType === "7007") { - bottomValue = bottomValue + Number(yxcwValue) + boxHeight * 2; - } else if (yxcwType === "7002" || yxcwType === "7003") { - bottomValue = bottomValue + Number(yxcwValue) + boxHeight; - } else if (yxcwType === "7004") { - bottomValue = bottomValue + Number(yxcwValue) + boxHeight * 3; - } else if (yxcwType === "7005") { - bottomValue = boxHeight * 3; - } - viewBoxWidth = Number(boxLength) + leftValue + rightValue; - viewBoxHeight = Number(boxWidth) + topValue + bottomValue; - // viewBoxWidth = boxWidth + leftValue + rightValue; - // viewBoxHeight = boxLength + dZSCW + dYXCW; - } else if (Number(svgType) === 8) { - const getTop = (item, offset = 0) => { - const map = { - 10001: headWidth + Number(item?.value), - 10002: Number(item?.value), - 10003: Number(item?.value), - 10004: Number(item?.value) + headWidth * 2, - 10005: headWidth * 2, - 10006: Number(item?.value) + headWidth, - 10007: Number(item?.value) + headWidth, - }; - return map[item?.type - offset] ?? 0; // 根据偏移量统一处理 - }; - - const topLeft = getTop(boxList.find(x => x.sName === "左上插位组件")); - const topRight = getTop( - boxList.find(x => x.sName === "右上插位组件"), - 2000 - ); - const topLength = headLength + topLeft + topRight; - const bottomLeft = getTop( - boxList.find(x => x.sName === "左插位组件"), - 3000 - ); - const bottomRight = getTop( - boxList.find(x => x.sName === "右插位组件"), - 5000 - ); - const bottomLength = orderLength * 2 + bottomLeft + bottomRight; - const leftOffect = boxList.find(x => x.sName === "左偏移")?.value || 0; - const rightOffect = boxList.find(x => x.sName === "右偏移")?.value || 0; - viewBoxWidth = Math.max(topLength, bottomLength) + Number(leftOffect) + Number(rightOffect); - viewBoxHeight = Number(headWidth) + Number(orderWidth) + max; + } else { + viewBoxWidth = boxLength + boxHeight + dYTBW + dZTBW; + viewBoxHeight = Number(boxWidth) + Number(boxHeight) * 2 + max; } - // 计算缩放比例 let scale = 1; - if (props.showNew === 0) { - if (viewBoxWidth > (dSvgBoxWidth ? dSvgBoxWidth : 500) || viewBoxHeight > (dSvgBoxHeight ? dSvgBoxHeight : 250)) { - const widthScale = (dSvgBoxWidth ? dSvgBoxWidth : 500) / viewBoxWidth; - const heightScale = (dSvgBoxHeight ? dSvgBoxHeight : 250) / viewBoxHeight; - scale = Math.min(widthScale, heightScale); - let ySvg = dSvgBoxHeight - ? topOffect(boxList, boxLength, boxWidth, boxHeight) * scale - : topOffect(boxList, boxLength, boxWidth, boxHeight) * scale; - let bottom = 0; - if (Number(svgType) !== 8) { - bottom = bottomOffect(boxList, boxLength, boxWidth, boxHeight); - } else { - bottom = bottomOffect(boxList, orderLength, orderWidth); - } - if (Number(svgType) === 4) { - ySvg = ySvg + boxHeight * scale; - } else if (Number(svgType) === 8) { - ySvg = topOffect(boxList, headLength, headWidth) * scale; - } - ySvg = ySvg + 50 * scale; - let xSvg = 0; - if (Number(svgType) === 7) { - xSvg = scaledWidth + dZXCW * scale; - } else if (Number(svgType) === 8) { - const leftOffect = boxList.find(x => x.sName === "左偏移")?.value || 0; - // 计算首盒部件与次盒部件尺寸 - const getTop = (item, offset = 0) => { - const map = { - 10001: headWidth + Number(item?.value), - 10002: Number(item?.value), - 10003: Number(item?.value), - 10004: Number(item?.value) + headWidth * 2, - 10005: headWidth * 2, - 10006: Number(item?.value) + headWidth, - 10007: Number(item?.value) + headWidth, - }; - return map[item?.type - offset] ?? 0; // 根据偏移量统一处理 - }; - const topLeft = getTop(boxList.find(x => x.sName === "左上插位组件")); - const topLength = headLength + topLeft; - const bottomLeft = getTop( - boxList.find(x => x.sName === "左插位组件"), - 3000 - ); - const bottomLength = headLength / 2 - orderLength + -bottomLeft - Number(leftOffect); - xSvg = Math.max(Math.abs(bottomLength), Math.abs(topLength)); - } else { - xSvg = zbtb?.value; - } - svg.setAttribute( - "viewBox", - `${-(xSvg * scale)} ${dSvgBoxWidth ? (dSvgBoxWidth === 100 ? -ySvg : 0) : -ySvg} ${dSvgBoxWidth ? dSvgBoxWidth + ySvg : 500} ${ - dSvgBoxHeight ? dSvgBoxHeight - ySvg - bottom * scale : 250 + ySvg - }` - ); - svg.setAttribute("width", `${dSvgBoxWidth ? dSvgBoxWidth : 500}px`); - svg.setAttribute("height", `${dSvgBoxHeight ? dSvgBoxHeight : 250}px`); - svgContainerRef.current.style.width = `${dSvgBoxWidth ? dSvgBoxWidth : 500}px`; - svgContainerRef.current.style.height = `${dSvgBoxHeight ? dSvgBoxHeight : 250}px`; - } else { - scale = 0.5; - let ySvg = topOffect(boxList, boxLength, boxWidth, boxHeight) * scale; - if (Number(svgType) === 4) { - ySvg = ySvg + boxHeight; - } else if (Number(svgType) === 8) { - ySvg = topOffect(boxList, headLength, headWidth) * scale; - } - ySvg = ySvg + 50 * scale; - let xSvg = 0; - if (Number(svgType) === 7) { - xSvg = scaledWidth + dZXCW * scale; - } else if (Number(svgType) === 8) { - const leftOffect = boxList.find(x => x.sName === "左偏移")?.value || 0; - // 计算首盒部件与次盒部件尺寸 - const getTop = (item, offset = 0) => { - const map = { - 10001: headWidth + Number(item?.value), - 10002: Number(item?.value), - 10003: Number(item?.value), - 10004: Number(item?.value) + headWidth * 2, - 10005: headWidth * 2, - 10006: Number(item?.value) + headWidth, - 10007: Number(item?.value) + headWidth, - }; - return map[item?.type - offset] ?? 0; // 根据偏移量统一处理 - }; - const topLeft = getTop(boxList.find(x => x.sName === "左上插位组件")); - const topLength = headLength + topLeft; - const bottomLeft = getTop( - boxList.find(x => x.sName === "左插位组件"), - 3000 - ); - const bottomLength = headLength / 2 - orderLength + -bottomLeft - Number(leftOffect); - xSvg = Math.max(Math.abs(bottomLength), Math.abs(topLength)); - } else { - xSvg = zbtb?.value; - } - svg.setAttribute( - "viewBox", - `${-(dSvgBoxWidth ? xSvg : viewBoxWidth / 2)} ${dSvgBoxWidth ? -0 : -ySvg} ${dSvgBoxWidth ? dSvgBoxWidth : 500} ${ - dSvgBoxHeight ? dSvgBoxHeight : 250 - }` - ); - svg.setAttribute("width", `${dSvgBoxWidth ? dSvgBoxWidth : 500}px`); - svg.setAttribute("height", `${dSvgBoxHeight ? dSvgBoxHeight : 250}px`); - svgContainerRef.current.style.width = `${dSvgBoxWidth ? dSvgBoxWidth : 500}px`; - svgContainerRef.current.style.height = `${dSvgBoxHeight ? dSvgBoxHeight : 250}px`; - } - } else if (props.showNew === 1) { - let ySvg = topOffect(boxList, boxLength, boxWidth, boxHeight) * scale; - let leftSize = 0; - let topSize = 0; + if (viewBoxWidth > (dSvgBoxWidth ? dSvgBoxWidth : 500) || viewBoxHeight > (dSvgBoxHeight ? dSvgBoxHeight : 250)) { + const widthScale = (dSvgBoxWidth ? dSvgBoxWidth : 500) / viewBoxWidth; + const heightScale = (dSvgBoxHeight ? dSvgBoxHeight : 250) / viewBoxHeight; + scale = Math.min(widthScale, heightScale); + let ySvg = dSvgBoxHeight + ? topOffect(boxList, boxLength, boxWidth, boxHeight) * scale + : topOffect(boxList, boxLength, boxWidth, boxHeight) * scale; + const bottom = bottomOffect(boxList, boxLength, boxWidth, boxHeight); if (Number(svgType) === 4) { - const zxcw = boxList.find(x => x.sName === "左(下)插位组件"); - const zxcwType = zxcw?.type; - const zxcwValue = zxcw?.value; - if (zxcwType === "4001" || zxcwType === "4006") { - leftSize = Number(zxcwValue) + boxHeight * 2; - } else if (zxcwType === "4002" || zxcwType === "4003") { - leftSize = Number(zxcwValue) + boxHeight; - } else if (zxcwType === "4004") { - leftSize = Number(zxcwValue) + boxHeight * 3; - } else if (zxcwType === "4005") { - leftSize = Number(zxcwValue) + boxHeight * 3; - } - const zscw = boxList.find(x => x.sName === "左(上)插位组件"); - const zscwType = zscw?.type; - const zscwValue = zscw?.value; - if (zscwType === "3001" || zscwType === "3006") { - topSize = Number(zscwValue) + boxHeight * 2; - } else if (zscwType === "3002" || zscwType === "3003") { - topSize = Number(zscwValue) + boxHeight; - } else if (zscwType === "3004") { - topSize = Number(zscwValue) + boxHeight * 3; - } else if (zscwType === "3005") { - topSize = Number(zscwValue) + boxHeight * 3; - } - ySvg = topSize; - } else if (Number(svgType) === 6) { - leftSize = 0; - } else if (Number(svgType) === 8) { - const leftOffect = boxList.find(x => x.sName === "左偏移")?.value || 0; - // 计算首盒部件与次盒部件尺寸 - const getTop = (item, offset = 0) => { - const map = { - 10001: headWidth + Number(item?.value), - 10002: Number(item?.value), - 10003: Number(item?.value), - 10004: Number(item?.value) + headWidth * 2, - 10005: headWidth * 2, - 10006: Number(item?.value) + headWidth, - 10007: Number(item?.value) + headWidth, - }; - return map[item?.type - offset] ?? 0; // 根据偏移量统一处理 - }; - const topLeft = getTop(boxList.find(x => x.sName === "左上插位组件")); - const topLength = topLeft; - const bottomLeft = getTop( - boxList.find(x => x.sName === "左插位组件"), - 3000 - ); - const bottomLength = headLength / 2 - orderLength + -bottomLeft - Number(leftOffect); - leftSize = Math.max(Math.abs(bottomLength), Math.abs(topLength)); - ySvg = topOffect(boxList, headLength, headWidth); - } else { - leftSize = zbtb?.value; + ySvg = ySvg + boxHeight * scale; } - - svg.setAttribute("viewBox", `${-(leftSize * scale) || 0} ${-ySvg} ${viewBoxWidth + 2} ${viewBoxHeight + 2}`); - svg.setAttribute("width", `${viewBoxWidth}px`); - svg.setAttribute("height", `${viewBoxHeight}px`); - svgContainerRef.current.style.width = `${viewBoxWidth}px`; - svgContainerRef.current.style.height = `${viewBoxHeight}px`; - const scaleX = (dSvgBoxWidth ? dSvgBoxWidth : 450) / viewBoxWidth; - const scaleY = (dSvgBoxHeight ? dSvgBoxHeight : 200) / viewBoxHeight; - svgContainerRef.current.style.transform = `scale(${scaleX >= 1 ? 1 : scaleX}, ${scaleY >= 1 ? 1 : scaleY})`; - svgContainerRef.current.style.transformOrigin = "top left"; - svgContainerRef.current.style.paddingTop = dSvgBoxWidth ? "0" : "25px"; - svgContainerRef.current.style.backgroundColor = props.isMobile ? "#EDF4FF" : ""; - // svgContainerRef.current.style.position = 'absolute'; - // svgContainerRef.current.style.left = '50%'; - // svgContainerRef.current.style.top = '50%'; - // svgContainerRef.current.style.transform = 'translate(-50%, -50%)'; - } else if (props.showNew === 2) { - // g.setAttribute("transform", `rotate(${iFAngle, dSvgBoxWidth/2,dSvgBoxHeight*2})`); + ySvg = ySvg + 50 * scale; + svg.setAttribute( + "viewBox", + `${-(zbtb?.value * scale)} ${dSvgBoxWidth ? (dSvgBoxWidth === 100 ? -ySvg : 0) : -ySvg} ${dSvgBoxWidth ? dSvgBoxWidth + ySvg : 500} ${ + dSvgBoxHeight ? dSvgBoxHeight - ySvg - bottom * scale : 250 + ySvg + }` + ); + svg.setAttribute("width", `${dSvgBoxWidth ? dSvgBoxWidth : 500}px`); + svg.setAttribute("height", `${dSvgBoxHeight ? dSvgBoxHeight : 250}px`); + svgContainerRef.current.style.width = `${dSvgBoxWidth ? dSvgBoxWidth : 500}px`; + svgContainerRef.current.style.height = `${dSvgBoxHeight ? dSvgBoxHeight : 250}px`; + } else { + scale = 0.6; let ySvg = topOffect(boxList, boxLength, boxWidth, boxHeight) * scale; - let leftSize = 0; - let topSize = 0; if (Number(svgType) === 4) { - const zxcw = boxList.find(x => x.sName === "左(下)插位组件"); - const zxcwType = zxcw?.type; - const zxcwValue = zxcw?.value; - if (zxcwType === "4001" || zxcwType === "4006") { - leftSize = Number(zxcwValue) + boxHeight * 2; - } else if (zxcwType === "4002" || zxcwType === "4003") { - leftSize = Number(zxcwValue) + boxHeight; - } else if (zxcwType === "4004") { - leftSize = Number(zxcwValue) + boxHeight * 3; - } else if (zxcwType === "4005") { - leftSize = Number(zxcwValue) + boxHeight * 3; - } - const zscw = boxList.find(x => x.sName === "左(上)插位组件"); - const zscwType = zscw?.type; - const zscwValue = zscw?.value; - if (zscwType === "3001" || zscwType === "3006") { - topSize = Number(zscwValue) + boxHeight * 2; - } else if (zscwType === "3002" || zscwType === "3003") { - topSize = Number(zscwValue) + boxHeight; - } else if (zscwType === "3004") { - topSize = Number(zscwValue) + boxHeight * 3; - } else if (zscwType === "3005") { - topSize = Number(zscwValue) + boxHeight * 3; - } - ySvg = topSize; - } else if (Number(svgType) === 6) { - leftSize = 0; - } else if (Number(svgType) === 8) { - const leftOffect = boxList.find(x => x.sName === "左偏移")?.value || 0; - // 计算首盒部件与次盒部件尺寸 - const getTop = (item, offset = 0) => { - const map = { - 10001: headWidth + Number(item?.value), - 10002: Number(item?.value), - 10003: Number(item?.value), - 10004: Number(item?.value) + headWidth * 2, - 10005: headWidth * 2, - 10006: Number(item?.value) + headWidth, - 10007: Number(item?.value) + headWidth, - }; - return map[item?.type - offset] ?? 0; // 根据偏移量统一处理 - }; - const topLeft = getTop(boxList.find(x => x.sName === "左上插位组件")); - const topLength = topLeft; - const bottomLeft = getTop( - boxList.find(x => x.sName === "左插位组件"), - 3000 - ); - const bottomLength = headLength / 2 - orderLength + -bottomLeft - Number(leftOffect); - leftSize = Math.max(Math.abs(bottomLength), Math.abs(topLength)); - ySvg = topOffect(boxList, headLength, headWidth); - } else { - leftSize = zbtb?.value; + ySvg = ySvg + boxHeight; } - svg.setAttribute("viewBox", `${-(leftSize * scale || 0)} ${-ySvg} ${dSvgBoxWidth} ${dSvgBoxHeight}`); - svg.setAttribute("width", `${dSvgBoxWidth}px`); - svg.setAttribute("height", `${dSvgBoxHeight}px`); - svgContainerRef.current.style.width = `${dSvgBoxWidth}px`; - svgContainerRef.current.style.height = `${dSvgBoxHeight}px`; + svg.setAttribute( + "viewBox", + `${-(dSvgBoxWidth ? zbtb?.value : viewBoxWidth / 2)} ${dSvgBoxWidth ? -0 : -ySvg} ${dSvgBoxWidth ? dSvgBoxWidth : 500} ${ + dSvgBoxHeight ? dSvgBoxHeight : 250 + }` + ); + svg.setAttribute("width", `${dSvgBoxWidth ? dSvgBoxWidth : 500}px`); + svg.setAttribute("height", `${dSvgBoxHeight ? dSvgBoxHeight : 250}px`); + svgContainerRef.current.style.width = `${dSvgBoxWidth ? dSvgBoxWidth : 500}px`; + svgContainerRef.current.style.height = `${dSvgBoxHeight ? dSvgBoxHeight : 250}px`; } const scaledWidth = boxLength * scale; const scaledHeight = boxWidth * scale; @@ -566,9 +179,8 @@ const SvgBox = props => { { x: 0 + scaledWidth * 2 + scaledHeight, y: 0, width: scaledHeight, height: scaledDeep }, ]; rectangles.forEach(rect => { - g.appendChild(createPathElement(rect.x, rect.y, rect.width, rect.height)); + svg.appendChild(createPathElement(rect.x, rect.y, rect.width, rect.height)); }); - svg.appendChild(g); let pathList = []; // 上方盒舌 @@ -578,11 +190,20 @@ const SvgBox = props => { pathList.push(createText(scaledWidth + scaledHeight / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS)); pathList.push(createText(scaledWidth * 2 + scaledHeight + scaledHeight / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS)); } + // if (sfhs?.type === "1004") { + // pathList.push(createFoldWeltTopLine(scaledHeight * 0.5, -dSFHS * scale * 0.5, scaledWidth, 0)); + // pathList.push(createFoldWeltTopLine(-scaledHeight * 0.5, -dSFHS * scale * 0.5, scaledWidth * 2 + scaledHeight * 2, 0)); + // } + // if (sfhs?.type === "1005") { + // pathList.push(createFoldWeltTopLine(scaledHeight * 0.85, -dSFHS * scale * 0.9, scaledWidth, 0)); + // pathList.push(createFoldWeltTopLine(-scaledHeight * 0.85, -dSFHS * scale * 0.9, scaledWidth * 2 + scaledHeight * 2, 0)); + // } // 盒底组件 if (hdzj && hdzj.type) { // 盒底组件 pathList.push(createBoxBottomComponent(hdzj?.type, scaledWidth, scaledHeight, Number(hdzj?.value) * scale, 0, scaledDeep)); - pathList.push(createText(scaledWidth / 2, scaledDeep + (Number(hdzj?.value) / 2) * scales, 10 * scales, Number(hdzj?.value))); + pathList.push(createText(scaledWidth / 2, scaledDeep + Number(hdzj?.value) / 2 * scales, 10 * scales, Number(hdzj?.value))); + } else { // 下方盒舌 @@ -595,19 +216,18 @@ const SvgBox = props => { } // 左边贴边 - pathList.push(createTrapezoidLeft(zbtb?.type, scaledDeep, -dZTBW * scale, 0, 0, dSFHS * scale, dXFHS * scale)); + pathList.push(createTrapezoidLeft(zbtb?.type, scaledDeep, -dZTBW * scale, 0, 0)); if (zbtb?.type && dZTBW) { pathList.push(createText(-dZTBW * 0.4, scaledDeep / 2, 10 * scales, dZTBW)); } // 右边贴边 - - pathList.push(createTrapezoidRight(ybtb?.type, scaledDeep, dYTBW * scale, scaledWidth * 2 + scaledHeight * 2, 0, dSFHS * scale, dXFHS * scale)); + pathList.push(createTrapezoidRight(ybtb?.type, scaledDeep, dYTBW * scale, scaledWidth * 2 + scaledHeight * 2, 0)); if (ybtb?.type && dYTBW) { pathList.push(createText(scaledWidth * 2 + scaledHeight * 2 + dYTBW * 0.4, scaledDeep / 2, 10 * scales, dYTBW)); } // 左上部件 pathList.push(createDynamicTopLeft(zsbj?.type, scaledWidth, -scaledHeight, -dZSCW * scale, 0, 0)); - if ((zsbj?.type === "3001" && zsbj?.value) || (zsbj?.type === "3006" && zsbj?.value) || (zsbj?.type === "3007" && zsbj?.value)) { + if (zsbj?.type === "3001" && zsbj?.value) { pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, -scaledHeight / 2, scales)); pathList.push(createText(scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); // 插位值 @@ -627,15 +247,13 @@ const SvgBox = props => { pathList.push(createText(scaledWidth * 0.1 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.8, -(scaledHeight + scaledHeight / 2), scales)); pathList.push(createText(scaledWidth * 0.8 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W")); - } else if (zsbj?.type && dZSCW) { - pathList.push(createText(scaledWidth / 2, -dZSCW / 2 + 4, 10 * scales, dZSCW)); } // 右上部件 pathList.push(createDynamicTopLeft(ysbj?.type, scaledWidth, -scaledHeight, -dYSCW * scale, scaledWidth + scaledHeight, 0)); - if ((ysbj?.type === "6001" && ysbj?.value) || (ysbj?.type === "6006" && ysbj?.value) || (ysbj?.type === "6007" && ysbj?.value)) { + if (ysbj?.type === "6001" && ysbj?.value) { pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, -scaledHeight / 2, scales)); pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); - pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, -scaledHeight - dYSCW / 2, 10 * scales, dYSCW)); + pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, -scaledHeight - dYSCW / 2 + 4, 10 * scales, dYSCW)); } else if (ysbj?.type === "6002" && dYSCW) { pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW)); } else if (ysbj?.type === "6003" && dYSCW) { @@ -653,14 +271,12 @@ const SvgBox = props => { pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.1 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.8, -(scaledHeight + scaledHeight / 2), scales)); pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.8 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W")); - } else if (ysbj?.type && dYSCW) { - pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW)); } // 左下部件- if (!(hdzj && hdzj.type)) { pathList.push(createDynamicTopLeft(zxbj?.type, scaledWidth, scaledHeight, dZXCW * scale, 0, scaledDeep)); - if ((zxbj?.type === "4001" && zxbj?.value) || (zxbj?.type === "4006" && zxbj?.value) || (zxbj?.type === "4007" && zxbj?.value)) { + if (zxbj?.type === "4001" && zxbj?.value) { pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales)); pathList.push(createText(scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); pathList.push(createText(scaledWidth / 2, scaledDeep + scaledHeight + dZXCW / 2 - 4, 10 * scales, dZXCW)); @@ -679,16 +295,14 @@ const SvgBox = props => { pathList.push(createText(scaledWidth * 0.1 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.8, scaledDeep + (scaledHeight + scaledHeight / 2), scales)); pathList.push(createText(scaledWidth * 0.8 + 10 * scales, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scales, "W")); - } else if (zxbj?.type && dZXCW) { - pathList.push(createText(scaledWidth / 2, scaledDeep + dZXCW / 2 - 4, 10 * scales, dZXCW)); } } if (!(hdzj && hdzj.type)) { pathList.push(createDynamicTopLeft(yxbj?.type, scaledWidth, scaledHeight, dYXCW * scale, scaledWidth + scaledHeight, scaledDeep)); - if ((yxbj?.type === "7001" && yxbj?.value) || (yxbj?.type === "7006" && yxbj?.value) || (yxbj?.type === "7007" && yxbj?.value)) { + if (yxbj?.type === "7001" && yxbj?.value) { pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales)); pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); - pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, scaledDeep + scaledHeight + dYXCW / 2, 10 * scales, dYXCW)); + pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, scaledDeep + scaledHeight + dYXCW / 2 - 4, 10 * scales, dYXCW)); } else if (yxbj?.type === "7004" && yxbj?.value) { pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales)); pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 - 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); @@ -734,9 +348,8 @@ const SvgBox = props => { pathList.push(createText(scaledWidth + scaledHeight / 2, scaledDeep * 0.3 + 10 * scales, 10 * scales, "W")); } pathList.forEach(x => { - g.appendChild(x); + svg.appendChild(x); }); - svg.appendChild(g); } else if (Number(svgType) === 2) { // 单折盒身 const rectangles = [ @@ -745,9 +358,8 @@ const SvgBox = props => { { x: 0 + scaledWidth + scaledHeight, y: 0, width: scaledWidth, height: scaledDeep }, ]; rectangles.forEach(rect => { - g.appendChild(createPathElement(rect.x, rect.y, rect.width, rect.height)); + svg.appendChild(createPathElement(rect.x, rect.y, rect.width, rect.height)); }); - svg.appendChild(g); let pathList = []; // 上方盒舌 pathList.push(createUpperBoxTongueLeft(sfhs?.type, scaledHeight, -dSFHS * scale, scaledWidth, 0)); @@ -760,18 +372,18 @@ const SvgBox = props => { pathList.push(createText(scaledWidth + scaledHeight / 2, scaledDeep + (dXFHS / 2 - 5) * scales, 10 * scales, dSFHS)); } // 左边贴边 - pathList.push(createTrapezoidLeft(zbtb?.type, scaledDeep, -dZTBW * scale, 0, 0, dSFHS * scale, dXFHS * scale)); + pathList.push(createTrapezoidLeft(zbtb?.type, scaledDeep, -dZTBW * scale, 0, 0)); if (zbtb?.type && dZTBW) { pathList.push(createText(-dZTBW / 2, scaledDeep / 2, 10 * scales, dZTBW)); } // 右边贴边 - pathList.push(createTrapezoidRight(ybtb?.type, scaledDeep, dYTBW * scale, scaledWidth * 2 + scaledHeight, 0, dSFHS * scale, dXFHS * scale)); + pathList.push(createTrapezoidRight(ybtb?.type, scaledDeep, dYTBW * scale, scaledWidth * 2 + scaledHeight, 0)); if (zbtb?.type && dYTBW) { pathList.push(createText(scaledWidth * 2 + scaledHeight + dYTBW / 2, scaledDeep / 2, 10 * scales, dYTBW)); } // 左上部件 pathList.push(createDynamicTopLeft(zsbj?.type, scaledWidth, -scaledHeight, -dZSCW * scale, 0, 0)); - if ((zsbj?.type === "3001" && zsbj?.value) || (zsbj?.type === "3006" && zsbj?.value) || (zsbj?.type === "3007" && zsbj?.value)) { + if (zsbj?.type === "3001" && zsbj?.value) { pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, -scaledHeight / 2, scales)); pathList.push(createText(scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); pathList.push(createText(scaledWidth / 2, -scaledHeight - dZSCW / 2 + 4, 10 * scales, dZSCW)); @@ -792,10 +404,10 @@ const SvgBox = props => { } // 右上部件 pathList.push(createDynamicTopLeft(ysbj?.type, scaledWidth, -scaledHeight, -dYSCW * scale, scaledWidth + scaledHeight, 0)); - if ((ysbj?.type === "6001" && ysbj?.value) || (ysbj?.type === "6006" && ysbj?.value) || (ysbj?.type === "6007" && ysbj?.value)) { + if (ysbj?.type === "6001" && ysbj?.value) { pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, -scaledHeight / 2, scales)); pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); - pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, -scaledHeight - dYSCW / 2, 10 * scales, dYSCW)); + pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, -scaledHeight - dYSCW / 2 + 4, 10 * scales, dYSCW)); } else if (ysbj?.type === "6004" && ysbj?.value) { pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, -scaledHeight / 2, scales)); pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); @@ -815,10 +427,10 @@ const SvgBox = props => { } // 左下部件- pathList.push(createDynamicTopLeft(zxbj?.type, scaledWidth, scaledHeight, dZXCW * scale, 0, scaledDeep)); - if ((zxbj?.type === "4001" && zxbj?.value) || (zxbj?.type === "4006" && zxbj?.value) || (zxbj?.type === "4007" && zxbj?.value)) { + if (zxbj?.type === "4001" && zxbj?.value) { pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales)); pathList.push(createText(scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); - pathList.push(createText(scaledWidth / 2, scaledDeep + scaledHeight + dZXCW / 2, 10 * scales, dZXCW)); + pathList.push(createText(scaledWidth / 2, scaledDeep + scaledHeight + dZXCW / 2 - 4, 10 * scales, dZXCW)); } else if (zxbj?.type === "4004" && zxbj?.value) { pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales)); pathList.push(createText(scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); @@ -835,7 +447,7 @@ const SvgBox = props => { } // 右下部件 pathList.push(createDynamicTopLeft(yxbj?.type, scaledWidth, scaledHeight, dYXCW, scaledWidth + scaledHeight, scaledDeep)); - if ((yxbj?.type === "7001" && yxbj?.value) || (yxbj?.type === "7006" && yxbj?.value) || (yxbj?.type === "7007" && yxbj?.value)) { + if (yxbj?.type === "7001" && yxbj?.value) { pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales)); pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, scaledDeep + scaledHeight + dYXCW / 2 - 4, 10 * scales, dYXCW)); @@ -875,9 +487,8 @@ const SvgBox = props => { } pathList.forEach(x => { - g.appendChild(x); + svg.appendChild(x); }); - svg.appendChild(g); } else if (Number(svgType) === 3) { // 双折盒 const rectangles = [ @@ -886,9 +497,8 @@ const SvgBox = props => { { x: 0 + scaledWidth + scaledHeight, y: 0, width: scaledHeight, height: scaledDeep }, ]; rectangles.forEach(rect => { - g.appendChild(createPathElement(rect.x, rect.y, rect.width, rect.height)); + svg.appendChild(createPathElement(rect.x, rect.y, rect.width, rect.height)); }); - svg.appendChild(g); let pathList = []; // 上方盒舌 pathList.push(createUpperBoxTongueLeft(sfhs?.type, scaledHeight, -dSFHS * scale, 0, 0)); @@ -905,18 +515,18 @@ const SvgBox = props => { pathList.push(createText(scaledWidth + scaledHeight + scaledHeight / 2, scaledDeep + (dXFHS / 2 - 5) * scales, 10 * scales, dXFHS)); } // 左边贴边 - pathList.push(createTrapezoidLeft(zbtb?.type, scaledDeep, -dZTBW * scale, 0, 0, dSFHS * scale, dXFHS * scale)); + pathList.push(createTrapezoidLeft(zbtb?.type, scaledDeep, -dZTBW * scale, 0, 0)); if (zbtb?.type && dZTBW) { pathList.push(createText(-dZTBW / 2, scaledDeep / 2, 10 * scales, dZTBW)); } // 右边贴边 - pathList.push(createTrapezoidRight(ybtb?.type, scaledDeep, dYTBW * scale, scaledWidth + scaledHeight * 2, 0, dSFHS * scale, dXFHS * scale)); + pathList.push(createTrapezoidRight(ybtb?.type, scaledDeep, dYTBW * scale, scaledWidth + scaledHeight * 2, 0)); if (zbtb?.type && dYTBW) { pathList.push(createText(scaledWidth + scaledHeight * 2 + dYTBW / 2, scaledDeep / 2, 10 * scales, dYTBW)); } // 左下部件- pathList.push(createDynamicTopLeft(zxbj?.type, scaledWidth, scaledHeight, dZXCW * scale, scaledHeight, scaledDeep)); - if ((zxbj?.type === "4001" && zxbj?.value) || (zxbj?.type === "4006" && zxbj?.value) || (zxbj?.type === "4007" && zxbj?.value)) { + if (zxbj?.type === "4001" && zxbj?.value) { pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales)); pathList.push(createText(scaledHeight + scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); pathList.push(createText(scaledHeight + scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); @@ -937,10 +547,10 @@ const SvgBox = props => { } // 右上部件 pathList.push(createDynamicTopLeft(ysbj?.type, scaledWidth, -scaledHeight, -dYSCW * scale, scaledHeight, 0)); - if ((ysbj?.type === "6001" && ysbj?.value) || (ysbj?.type === "6006" && ysbj?.value) || (ysbj?.type === "6007" && ysbj?.value)) { + if (ysbj?.type === "6001" && ysbj?.value) { pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.2, -scaledHeight / 2, scales)); pathList.push(createText(scaledHeight + scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); - pathList.push(createText(scaledHeight + scaledWidth * 0.5, -scaledHeight - dYSCW / 2, 10 * scales, dYSCW)); + pathList.push(createText(scaledHeight + scaledWidth * 0.5, -scaledHeight - dYSCW / 2 + 4, 10 * scales, dYSCW)); } else if (ysbj?.type === "6004" && ysbj?.value) { pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.2, -scaledHeight / 2, scales)); pathList.push(createText(scaledHeight + scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); @@ -970,12 +580,10 @@ const SvgBox = props => { } pathList.forEach(x => { - g.appendChild(x); + svg.appendChild(x); }); - svg.appendChild(g); - } else if (Number(svgType) === 4) { - g.appendChild(createFullTelescope(scaledWidth, scaledHeight, scaledDeep, 0, 0)); - svg.appendChild(g); + } else { + svg.appendChild(createFullTelescope(scaledWidth, scaledHeight, scaledDeep, 0, 0)); // createFullTelescope let pathList = []; // 上方盒舌 @@ -994,7 +602,7 @@ const SvgBox = props => { } // 上方部件 pathList.push(createDynamicTopLeft(zsbj?.type, scaledWidth, -scaledDeep, -dZSCW * scale, 0, -scaledDeep)); - if ((zsbj?.type === "3001" && zsbj?.value) || (zsbj?.type === "3006" && zsbj?.value) || (zsbj?.type === "3007" && zsbj?.value)) { + if (zsbj?.type === "3001" && zsbj?.value) { pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.2, -scaledDeep - scaledDeep / 2, scales)); pathList.push(createText(scaledWidth * 0.2 + 10 * scales, -scaledDeep - scaledDeep / 2, 10 * scales, "D")); // 插位值 @@ -1016,12 +624,10 @@ const SvgBox = props => { pathList.push(createText(scaledWidth * 0.1 + 10 * scales, -scaledDeep - scaledDeep / 2, 10 * scales, "D")); pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.8, -(scaledDeep * 2 + scaledDeep / 2), scales)); pathList.push(createText(scaledWidth * 0.8 + 10 * scales, -(scaledDeep * 2 + scaledDeep / 2), 10 * scales, "D")); - } else if (zsbj?.type && dZSCW) { - pathList.push(createText(scaledWidth / 2, -scaledDeep - dZSCW / 2 + 4, 10 * scales, dZSCW)); } // 左边部件 pathList.push(createFull(zxbj?.type, scaledHeight, -scaledDeep, -dZXCW, -scaledDeep, 0)); - if ((zxbj?.type === "4001" && dZXCW) || (zxbj?.type === "4006" && dZXCW) || (zxbj?.type === "4007" && dZXCW)) { + if (zxbj?.type === "4001" && dZXCW) { pathList.push(createHorizontalDoubleArrow(scaledDeep, -scaledDeep - scaledDeep / 2, scaledHeight * 0.8, scales)); pathList.push(createText(-scaledDeep - scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D")); pathList.push(createText(-scaledDeep - scaledDeep - dZXCW / 2, scaledHeight * 0.5, 10 * scales, dZXCW)); @@ -1042,7 +648,7 @@ const SvgBox = props => { } // 右边 pathList.push(createFull(ysbj?.type, scaledHeight, scaledDeep, dYSCW, scaledWidth + scaledDeep, 0)); - if ((ysbj?.type === "6001" && dYSCW) || (ysbj?.type === "6006" && dYSCW) || (ysbj?.type === "6007" && dYSCW)) { + if (ysbj?.type === "6001" && dYSCW) { pathList.push(createHorizontalDoubleArrow(scaledDeep, scaledWidth + scaledDeep + scaledDeep / 2, scaledHeight * 0.8, scales)); pathList.push(createText(scaledWidth + scaledDeep + scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D")); pathList.push(createText(scaledWidth + scaledDeep + scaledDeep + dYSCW / 2, scaledHeight * 0.5, 10 * scales, dYSCW)); @@ -1062,7 +668,7 @@ const SvgBox = props => { } // 下方部件 pathList.push(createDynamicTopLeft(yxbj?.type, scaledWidth, scaledDeep, dYXCW * scale, 0, scaledHeight + scaledDeep)); - if ((yxbj?.type === "7001" && yxbj?.value) || (yxbj?.type === "7006" && yxbj?.value) || (yxbj?.type === "7007" && yxbj?.value)) { + if (yxbj?.type === "7001" && yxbj?.value) { pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.2, scaledHeight + scaledDeep + scaledDeep / 2, scales)); pathList.push(createText(scaledWidth * 0.2 + 10 * scales, scaledHeight + scaledDeep + scaledDeep / 2, 10 * scales, "D")); // 插位值 @@ -1099,574 +705,452 @@ const SvgBox = props => { pathList.push(createText(-scaledDeep / 2, scaledHeight * 0.3 + 10, 10 * scales, "D")); } pathList.forEach(x => { - g.appendChild(x); - }); - svg.appendChild(g); - } else if (Number(svgType) === 5) { - const rectangles = [ - { x: 0, y: 0, width: scaledHeight, height: scaledWidth }, - { x: 0 + scaledHeight, y: 0, width: scaledDeep, height: scaledWidth }, - { x: 0 + scaledHeight + scaledDeep, y: 0, width: scaledHeight, height: scaledWidth }, - { x: 0 + scaledHeight * 2 + scaledDeep, y: 0, width: scaledDeep, height: scaledWidth }, - ]; - rectangles.forEach(rect => { - g.appendChild(createPathElement(rect.x, rect.y, rect.width, rect.height)); - }); - svg.appendChild(g); - let pathList = []; - // 上方盒舌 - pathList.push(createUpperBoxTongueLeft(sfhs?.type, scaledDeep, -dSFHS * scale, scaledHeight, 0)); - pathList.push(createUpperBoxTongueLeft(sfhs?.type, -scaledDeep, -dSFHS * scale, scaledHeight * 2 + scaledDeep * 2, 0)); - if (sfhs?.type && dSFHS) { - pathList.push(createText(scaledHeight + scaledDeep / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS)); - pathList.push(createText(scaledHeight * 2 + scaledDeep + scaledDeep / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS)); - } - // 下方盒舌 - - pathList.push(createUpperBoxTongueLeft(xfhs?.type, scaledDeep, dXFHS * scale, scaledHeight, scaledWidth)); - pathList.push(createUpperBoxTongueLeft(xfhs?.type, -scaledDeep, dXFHS * scale, scaledHeight * 2 + scaledDeep * 2, scaledWidth)); - if (xfhs?.type && dXFHS) { - pathList.push(createText(scaledHeight + scaledDeep / 2, scaledWidth + (dXFHS / 2) * scales, 10 * scales, dXFHS)); - pathList.push(createText(scaledHeight * 2 + scaledDeep + scaledDeep / 2, scaledWidth + (dXFHS / 2) * scales, 10 * scales, dXFHS)); - } - - // 左边贴边 - pathList.push(createTrapezoidLeft(zbtb?.type, scaledWidth, -dZTBW * scale, 0, 0, dSFHS * scale, dXFHS * scale)); - if (zbtb?.type && dZTBW) { - pathList.push(createText(-dZTBW * 0.4, scaledWidth / 2, 10 * scales, dZTBW)); - } - // 右边贴边 - pathList.push(createTrapezoidRight(ybtb?.type, scaledWidth, dYTBW * scale, scaledHeight * 2 + scaledDeep * 2, 0, dSFHS * scale, dXFHS * scale)); - if (ybtb?.type && dYTBW) { - pathList.push(createText(scaledHeight * 2 + scaledDeep * 2 + dYTBW * 0.4, scaledWidth / 2, 10 * scales, dYTBW)); - } - // 左上部件 - pathList.push(createDynamicTopLeft(zsbj?.type, scaledHeight, -scaledDeep, -dZSCW * scale, 0, 0)); - if ((zsbj?.type === "3001" && zsbj?.value) || (zsbj?.type === "3006" && zsbj?.value) || (zsbj?.type === "3007" && zsbj?.value)) { - pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.2, -scaledDeep / 2, scales)); - pathList.push(createText(scaledHeight * 0.2 + 10 * scales, -scaledDeep / 2, 10 * scales, "D")); - // 插位值 - pathList.push(createText(scaledHeight / 2, -scaledDeep - dZSCW / 2 + 4, 10 * scales, dZSCW)); - } else if (zsbj?.type === "3002" && dZSCW) { - pathList.push(createText(scaledHeight / 2, -dZSCW / 2 + 4, 10 * scales, dZSCW)); - } else if (zsbj?.type === "3003" && dZSCW) { - pathList.push(createText(scaledHeight / 2, -dZSCW / 2 + 4, 10 * scales, dZSCW)); - } else if (zsbj?.type === "3004" && zsbj?.value) { - pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.2, -scaledDeep / 2, scales)); - pathList.push(createText(scaledHeight * 0.2 + 10 * scales, -scaledDeep / 2, 10 * scales, "D")); - pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.85, -(scaledDeep + scaledDeep / 2), scales)); - pathList.push(createText(scaledHeight * 0.85 + 10 * scales, -(scaledDeep + scaledDeep / 2), 10 * scales, "D")); - pathList.push(createText(scaledHeight * 0.3, -(scaledDeep * 2) - dZSCW / 2 + 4, 10 * scales, dZSCW)); - } else if (zsbj?.type === "3005" && zsbj?.value) { - pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.1, -scaledDeep / 2, scales)); - pathList.push(createText(scaledHeight * 0.1 + 10 * scales, -scaledDeep / 2, 10 * scales, "D")); - pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.8, -(scaledDeep + scaledDeep / 2), scales)); - pathList.push(createText(scaledHeight * 0.8 + 10 * scales, -(scaledDeep + scaledHeight / 2), 10 * scales, "D")); - } else if (zsbj?.type && dZSCW) { - pathList.push(createText(scaledHeight / 2, -dZSCW / 2 + 4, 10 * scales, dZSCW)); - } - // 右上部件 - pathList.push(createDynamicTopLeft(ysbj?.type, scaledHeight, -scaledDeep, -dYSCW * scale, scaledHeight + scaledDeep, 0)); - if ((ysbj?.type === "6001" && ysbj?.value) || (ysbj?.type === "6006" && ysbj?.value) || (ysbj?.type === "6007" && ysbj?.value)) { - pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.2, -scaledDeep / 2, scales)); - pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.2 + 10 * scales, -scaledDeep / 2, 10 * scales, "D")); - pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.5, -scaledDeep - dYSCW / 2, 10 * scales, dYSCW)); - } else if (ysbj?.type === "6002" && dYSCW) { - pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW)); - } else if (ysbj?.type === "6003" && dYSCW) { - pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW)); - } else if (ysbj?.type === "6004" && ysbj?.value) { - pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.2, -scaledDeep / 2, scales)); - pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.2 + 10 * scales, -scaledDeep / 2, 10 * scales, "D")); - pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.85, -(scaledDeep + scaledDeep / 2), scales)); - pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.85 + 10 * scales, -(scaledDeep + scaledDeep / 2), 10 * scales, "D")); - pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.3, -(scaledDeep * 2) - dYSCW / 2 + 4, 10 * scales, dYSCW)); - } else if (ysbj?.type === "6005" && ysbj?.value) { - pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.1, -scaledDeep / 2, scales)); - pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.1 + 10 * scales, -scaledDeep / 2, 10 * scales, "D")); - pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.8, -(scaledDeep + scaledDeep / 2), scales)); - pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.8 + 10 * scales, -(scaledDeep + scaledDeep / 2), 10 * scales, "D")); - } else if (ysbj?.type && dYSCW) { - pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW)); - } - // 左下部件- - - if (!(hdzj && hdzj.type)) { - pathList.push(createDynamicTopLeft(zxbj?.type, scaledHeight, scaledDeep, dZXCW * scale, 0, scaledWidth)); - if ((zxbj?.type === "4001" && zxbj?.value) || (zxbj?.type === "4006" && zxbj?.value) || (zxbj?.type === "4007" && zxbj?.value)) { - pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.2, scaledWidth + scaledDeep / 2, scales)); - pathList.push(createText(scaledHeight * 0.2 + 10 * scales, scaledWidth + scaledDeep / 2, 10 * scales, "D")); - pathList.push(createText(scaledHeight / 2, scaledWidth + scaledDeep + dZXCW / 2 - 4, 10 * scales, dZXCW)); - } else if (zxbj?.type === "4002" && dZXCW) { - pathList.push(createText(scaledHeight / 2, scaledWidth + dZXCW / 2 - 4, 10 * scales, dZXCW)); - } else if (zxbj?.type === "4003" && dZXCW) { - pathList.push(createText(scaledHeight / 2, scaledWidth + dZXCW / 2 - 4, 10 * scales, dZXCW)); - } else if (zxbj?.type === "4004" && zxbj?.value) { - pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.2, scaledWidth + scaledDeep / 2, scales)); - pathList.push(createText(scaledHeight * 0.2 + 10 * scales, scaledWidth + scaledDeep / 2, 10 * scales, "D")); - pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.85, scaledWidth + (scaledDeep + scaledDeep / 2), scales)); - pathList.push(createText(scaledHeight * 0.85 + 10 * scales, scaledHeight + (scaledWidth + scaledWidth / 2), 10 * scales, "D")); - pathList.push(createText(scaledHeight * 0.3, scaledWidth + scaledDeep * 2 + dZXCW / 2 - 4, 10 * scales, dZXCW)); - } else if (zxbj?.type === "4005" && zxbj?.value) { - pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.1, scaledWidth + scaledDeep / 2, scales)); - pathList.push(createText(scaledHeight * 0.1 + 10 * scales, scaledWidth + scaledDeep / 2, 10 * scales, "D")); - pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.8, scaledWidth + (scaledDeep + scaledDeep / 2), scales)); - pathList.push(createText(scaledHeight * 0.8 + 10 * scales, scaledWidth + (scaledDeep + scaledDeep / 2), 10 * scales, "D")); - } else if (zxbj?.type && dZXCW) { - pathList.push(createText(scaledHeight / 2, scaledWidth + dZXCW / 2 - 4, 10 * scales, dZXCW)); - } - } - if (!(hdzj && hdzj.type)) { - pathList.push(createDynamicTopLeft(yxbj?.type, scaledHeight, scaledDeep, dYXCW * scale, scaledHeight + scaledDeep, scaledWidth)); - if ((yxbj?.type === "7001" && yxbj?.value) || (yxbj?.type === "7006" && yxbj?.value) || (yxbj?.type === "7007" && yxbj?.value)) { - pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.2, scaledWidth + scaledDeep / 2, scales)); - pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.2 + 10 * scales, scaledWidth + scaledDeep / 2, 10 * scales, "D")); - pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.5, scaledWidth + scaledDeep + dYXCW / 2, 10 * scales, dYXCW)); - } else if (yxbj?.type === "7004" && yxbj?.value) { - pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledDeep * 0.2, scaledWidth + scaledDeep / 2, scales)); - pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.2 - 10 * scales, scaledWidth + scaledDeep / 2, 10 * scales, "D")); - pathList.push( - createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.85, scaledWidth + (scaledDeep + scaledDeep / 2), scales) - ); - pathList.push( - createText(scaledHeight + scaledDeep + scaledHeight * 0.85 + 10 * scales, scaledWidth + (scaledDeep + scaledDeep / 2), 10 * scales, "D") - ); - pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.3, scaledWidth + scaledDeep * 2 + dYXCW / 2 - 4, 10 * scales, dYXCW)); - } else if (yxbj?.type === "7005" && yxbj?.value) { - pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.1, scaledWidth + scaledDeep / 2, scales)); - pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.1 + 10 * scales, scaledWidth + scaledDeep / 2, 10 * scales, "D")); - pathList.push( - createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.8, scaledWidth + (scaledDeep + scaledDeep / 2), scales) - ); - pathList.push( - createText(scaledHeight + scaledDeep + scaledHeight * 0.8 + 10 * scales, scaledWidth + (scaledDeep + scaledDeep / 2), 10 * scales, "D") - ); - } else if (dYXCW && yxbj?.type) { - pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.5, scaledWidth + dYXCW / 2 - 4, 10 * scales, dYXCW)); - } - } - // 右下部件 - - // 纵向 L - if (scaledDeep && scaledWidth && scaledHeight) { - pathList.push(createDoubleArrow(scaledWidth, scaledHeight * 0.8, scaledWidth / 2, scales)); - pathList.push(createText(scaledHeight * 0.8 - 10 * scales, scaledWidth / 2, 10 * scales, "L")); - - // 横向 L - pathList.push(createHorizontalDoubleArrow(scaledHeight, scaledHeight / 2, scaledWidth * 0.3, scales)); - pathList.push(createText(scaledHeight / 2, scaledWidth * 0.3 + 10 * scales, 10 * scales, "W")); - // W - pathList.push(createHorizontalDoubleArrow(scaledDeep, scaledHeight + scaledDeep / 2, scaledWidth * 0.5, scale)); - pathList.push(createText(scaledHeight + scaledDeep / 2, scaledWidth * 0.5 + 10 * scales, 10 * scales, "D")); - } - pathList.forEach(x => { - g.appendChild(x); - }); - svg.appendChild(g); - // g.setAttribute('transform', `rotate(90, ${viewBoxWidth/2}, ${viewBoxHeight/2})`); - } else if (Number(svgType) === 6) { - const rectangles = [{ x: 0, y: 0, width: scaledHeight, height: scaledWidth }]; - rectangles.forEach(rect => { - g.appendChild(createPathElements(rect.x, rect.y, rect.width, rect.height)); + svg.appendChild(x); }); - svg.appendChild(g); - } else if (Number(svgType) === 7) { - const rectangles = [{ x: 0, y: 0, width: scaledWidth, height: scaledHeight }]; - rectangles.forEach(rect => { - g.appendChild(createPathElement(rect.x, rect.y, rect.width, rect.height)); - }); - // svg.appendChild(g); - let pathList = []; - // 左上部件 - pathList.push(createDynamicTopLeft(zsbj?.type, scaledWidth, -scaledHeight, -dZSCW * scale, 0, 0)); - if ((zsbj?.type === "3001" && zsbj?.value) || (zsbj?.type === "3006" && zsbj?.value) || (zsbj?.type === "3007" && zsbj?.value)) { - pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, -scaledHeight / 2, scales)); - pathList.push(createText(scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); - pathList.push(createText(scaledWidth / 2, -scaledHeight - dZSCW / 2 + 4, 10 * scales, dZSCW)); - } else if (zsbj?.type === "3004" && zsbj?.value) { - pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, -scaledHeight / 2, scales)); - pathList.push(createText(scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); - pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.85, -(scaledHeight + scaledHeight / 2), scales)); - pathList.push(createText(scaledWidth * 0.85 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W")); - pathList.push(createText(scaledWidth * 0.3, -(scaledHeight * 2) - dZSCW / 2 + 4, 10 * scales, dZSCW)); - } else if (zsbj?.type === "3005" && zsbj?.value) { - pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.1, -scaledHeight / 2, scales)); - pathList.push(createText(scaledWidth * 0.1 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); - pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.8, -(scaledHeight + scaledHeight / 2), scales)); - pathList.push(createText(scaledWidth * 0.8 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W")); - pathList.push(createText(scaledWidth * 0.8 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W")); - } else if (zsbj?.type && dZSCW) { - pathList.push(createText(scaledWidth / 2, -(dZSCW / 2 - 5), 10 * scales, dZSCW)); - } - // 右下部件 - pathList.push(createDynamicTopLeft(yxbj?.type, scaledWidth, scaledHeight, dYXCW * scale, 0, scaledHeight)); - - // 右边 - pathList.push(createFull(ysbj?.type, scaledWidth, scaledHeight, dYSCW * scale, scaledWidth, 0)); - pathList.push(createFull(zxbj?.type, scaledWidth, -scaledHeight, -dZXCW * scale, 0, 0)); - - pathList.forEach(x => { - g.appendChild(x); - }); - svg.appendChild(g); - } else if (Number(svgType) === 8) { - const scaleHeadLength = headLength * scale; - const scaleHeadWidth = headWidth * scale; - const scaleOrderLength = orderLength * scale; - const scaleOrderWidth = orderWidth * scale; - // 获取他的偏移距离 - const leftOffect = boxList.find(x => x.sName === "左偏移")?.value || 0; - const rightOffect = boxList.find(x => x.sName === "右偏移")?.value || 0; - const rectangles = [{ x: 0, y: 0, width: scaleHeadLength, height: scaleHeadWidth }]; - rectangles.forEach(rect => { - g.appendChild(createPathElement(rect.x, rect.y, rect.width, rect.height)); - }); - const rectanglesLeft = [ - { x: scaleHeadLength / 2 - scaleOrderLength - Number(leftOffect), y: scaleHeadWidth, width: scaleOrderLength, height: scaleOrderWidth }, - ]; - rectanglesLeft.forEach(rect => { - g.appendChild(createPathElement(rect.x, rect.y, rect.width, rect.height)); - }); - const rectanglesRight = [{ x: scaleHeadLength / 2 + Number(rightOffect), y: scaleHeadWidth, width: scaleOrderLength, height: scaleOrderWidth }]; - rectanglesRight.forEach(rect => { - g.appendChild(createPathElement(rect.x, rect.y, rect.width, rect.height)); - }); - - // 处理双盒的插位组件 - let pathList = []; - // 获取左上 - const scw = boxList.find(x => x.sName === "上插位组件"); - const zscw = boxList.find(x => x.sName === "左上插位组件"); - const yscw = boxList.find(x => x.sName === "右上插位组件"); - const zcw = boxList.find(x => x.sName === "左插位组件"); - const ycw = boxList.find(x => x.sName === "右插位组件"); - const zxcw = boxList.find(x => x.sName === "左下插位组件"); - const yxcw = boxList.find(x => x.sName === "右下插位组件"); - const dSCW = scw?.value; - const dZSCW = zscw?.value; - const dYSCW = yscw?.value; - const dZCW = zcw?.value; - const dYCW = ycw?.value; - const dZXCW = zxcw?.value; - const dYXCW = yxcw?.value; - // 上插位 - pathList.push(createDynamicTopLeft(scw?.type, scaleHeadLength, -scaleHeadWidth, -dSCW * scale, 0, 0)); - if ((scw?.type === "11001" && scw?.value) || (scw?.type === "11006" && scw?.value) || (scw?.type === "11007" && scw?.value)) { - pathList.push(createDoubleArrow(scaleHeadWidth, scaleHeadWidth * 0.2, -scaleHeadWidth / 2, scales)); - pathList.push(createText(scaleHeadWidth * 0.2 + 10 * scales, -scaleHeadWidth / 2, 10 * scales, "dSHK")); - pathList.push(createText(scaleHeadLength / 2, -scaleHeadWidth - dSCW / 2 + 4, 10 * scales, dSCW)); - } else if (scw?.type === "11004" && scw?.value) { - pathList.push(createDoubleArrow(scaleHeadWidth, scaleHeadLength * 0.2, -scaleHeadWidth / 2, scales)); - pathList.push(createText(scaleHeadLength * 0.2 + 10 * scales, -scaleHeadWidth / 2, 10 * scales, "dSHK")); - pathList.push(createDoubleArrow(scaleHeadWidth, scaleHeadLength * 0.85, -(scaleHeadWidth + scaleHeadWidth / 2), scales)); - pathList.push(createText(scaleHeadLength * 0.5 + 10 * scales, -(scaleHeadWidth + scaleHeadWidth / 2), 10 * scales, "dSHK")); - pathList.push(createText(scaleHeadLength * 0.3, -(scaleHeadWidth * 2), 10 * scales, dSCW)); - } else if (scw?.type === "11005" && scw?.value) { - pathList.push(createDoubleArrow(scaleHeadWidth, scaleHeadLength * 0.1, -scaleHeadWidth / 2, scales)); - pathList.push(createText(scaleHeadLength * 0.1 + 10 * scales, -scaleHeadWidth / 2, 10 * scales, "dSHK")); - pathList.push(createDoubleArrow(scaleHeadWidth, scaleHeadLength * 0.8, -(scaleHeadWidth + scaleHeadWidth / 2), scales)); - pathList.push(createText(scaleHeadLength * 0.8 + 10 * scales, -(scaleHeadWidth + scaleHeadWidth / 2), 10 * scales, "dSHK")); - pathList.push(createText(scaleHeadLength * 0.8 + 10 * scales, -(scaleHeadWidth + scaleHeadWidth / 2), 10 * scales, "dSHK")); - } else if (scw?.type && dSCW) { - pathList.push(createText(scaleHeadLength / 2, -(dSCW / 2 - 5), 10 * scales, dSCW)); - } - // 左上插位 - pathList.push(createFull(zscw?.type, scaleHeadWidth, -scaleHeadWidth, -dZSCW * scale, 0, 0)); - // 左插位 - pathList.push( - createFull( - zcw?.type, - scaleOrderWidth, - -scaleOrderWidth, - -dZCW * scale, - scaleHeadLength / 2 - scaleOrderLength - Number(leftOffect), - scaleHeadWidth - ) - ); - // 左下 - pathList.push( - createDynamicTopLeft( - zxcw?.type, - scaleOrderLength, - scaleOrderWidth, - dZXCW * scale, - scaleHeadLength / 2 - scaleOrderLength - Number(leftOffect), - scaleHeadWidth + scaleOrderWidth - ) - ); - // 右上 - pathList.push(createFull(yscw?.type, scaleHeadWidth, scaleHeadWidth, dYSCW * scale, scaleHeadLength, 0)); - // 右插位 - pathList.push( - createFull( - ycw?.type, - scaleOrderWidth, - scaleOrderWidth, - dYCW * scale, - scaleHeadLength / 2 + Number(rightOffect) + scaleOrderLength, - scaleHeadWidth - ) - ); - // 右下 - pathList.push( - createDynamicTopLeft( - yxcw?.type, - scaleOrderLength, - scaleOrderWidth, - dYXCW * scale, - scaleHeadLength / 2 + Number(rightOffect), - scaleHeadWidth + scaleOrderWidth - ) - ); - if (scaleHeadLength && scaleHeadWidth) { - pathList.push(createDoubleArrow(scaleHeadWidth, scaleHeadLength * 0.8, scaleHeadWidth / 2, scales)); - pathList.push(createText(scaleHeadLength * 0.8 - 10 * scales, scaleHeadWidth / 2, 10 * scales, "dSHK")); - pathList.push(createHorizontalDoubleArrow(scaleHeadLength, scaleHeadLength / 2, scaleHeadWidth * 0.7, scales)); - pathList.push(createText(scaleHeadWidth / 2, scaleHeadLength * 0.3 + 10 * scales, 10 * scales, "dSHC")); - } - if (scaleOrderLength && scaleOrderWidth) { - pathList.push(createDoubleArrow(scaleOrderWidth, scaleOrderLength * 0.6 - (leftOffect ), scaleHeadWidth + scaleOrderWidth / 2, scales)); - pathList.push(createText(scaleOrderLength * 0.8 - 10 * scales - (leftOffect ), scaleHeadWidth + scaleOrderWidth / 2, 10 * scales, "dCHK")); - pathList.push(createHorizontalDoubleArrow(scaleOrderLength, scaleOrderLength / 2 - (leftOffect ), scaleHeadWidth + scaleOrderWidth * 0.7, scales)); - pathList.push(createText(scaleOrderWidth / 2 - (leftOffect ), scaleHeadWidth + scaleOrderLength * 0.8 * scales, 10 * scales, "dCHC")); - } - - pathList.forEach(x => { - g.appendChild(x); - }); - - svg.appendChild(g); } }; // 计算头部偏移 const topOffect = (list, length, width, height) => { - const val = list.filter(x => x.type); - const sfhs = val.find(x => x.sName === "上方盒舌"); - const zscw = val.find(x => x.sName === "左(上)插位组件"); - const yscw = val.find(x => x.sName === "右(上)插位组件"); - const box = val.find(x => x.sName === "盒身"); - const svg = Number(box?.type); - if (svg === 6) return 0; - - const dZ = Number(zscw?.value) || 0; - const dY = Number(yscw?.value) || 0; - - if (svg === 8) { - const scw = val.find(x => x.sName === "上插位组件"); - const topsMap = { - 11001: width + Number(scw?.value), - 11002: Number(scw?.value), - 11003: Number(scw?.value), - 11004: Number(scw?.value) + width * 2, - 11005: width * 2, - 11006: Number(scw?.value) + width, - 11007: Number(scw?.value) + width, - }; - return topsMap[scw?.type] ?? 0; - } - const one = ["6001", "3001", "4001", "7001", "3006", "4006", "6006", "7006", "3007", "4007", "6007", "7007"]; + // 判断code + const valueList = list.filter(x => x.type !== ("" || null)); + // const titleList = ['上方盒舌','左(上)插位组件','右(上)插位组件'] + const sfhs = valueList.find(x => x.sName === "上方盒舌"); + const zscw = valueList.find(x => x.sName === "左(上)插位组件"); + const yscw = valueList.find(x => x.sName === "右(上)插位组件"); + let top = 0; + const one = ["6001", "3001", "4001", "7001"]; const four = ["6004", "3004", "4004", "7004"]; const five = ["6005", "3005", "4005", "7005"]; - - const coef = box?.type === "5" ? height : width; - - const pick = (cw, d) => { - const t = cw?.type; - if (five.includes(t)) return 2 * coef; - if (four.includes(t)) return 2 * coef + d; - if (one.includes(t)) return coef + d; - return d; - }; - - let top = 0; + const dYSCW = Number(yscw?.value) || 0; + const dZSCW = Number(zscw?.value) || 0; + // 如果存在插位就不计算盒舌 if (zscw?.type && yscw?.type) { - const z = pick(zscw, dZ); - const y = pick(yscw, dY); - top = Math.max(z, y, sfhs?.value || 0); + const max = Math.max(dZSCW, dYSCW); + if (five.includes(zscw?.type) || five.includes(yscw?.type)) { + top = width * 2; + } else if (four.includes(zscw?.type) || four.includes(yscw?.type)) { + top = width * 2 + max; + } else if (one.includes(zscw?.type) || one.includes(yscw?.type)) { + top = width + max; + } else { + top = max; + } } else if (yscw?.type) { - top = Math.max(pick(yscw, dY), sfhs?.value || 0); + const max = dYSCW; + if (five.includes(zscw?.type) || five.includes(yscw?.type)) { + top = width * 2; + } else if (four.includes(zscw?.type) || four.includes(yscw?.type)) { + top = width * 2 + max; + } else if (one.includes(zscw?.type) || one.includes(yscw?.type)) { + top = width + max; + } else { + top = max; + } } else if (zscw?.type) { - top = Math.max(pick(zscw, dZ), sfhs?.value || 0); + const max = dZSCW; + if (five.includes(zscw?.type) || five.includes(yscw?.type)) { + top = width * 2; + } else if (four.includes(zscw?.type) || four.includes(yscw?.type)) { + top = width * 2 + max; + } else if (one.includes(zscw?.type) || one.includes(yscw?.type)) { + top = width + max; + } else { + top = max; + } } else { - top = sfhs?.value || 0; + top = sfhs?.value; } - - if (svg === 4) top += height; return isNaN(top) ? 0 : top; }; const bottomOffect = (list, length, width, height) => { - const val = list.filter(x => x.type); - const sfhs = val.find(x => x.sName === "下方盒舌"); - const zscw = val.find(x => x.sName === "左(下)插位组件"); - const yscw = val.find(x => x.sName === "右(下)插位组件"); - const hdzj = val.find(x => x.sName === "盒底组件"); - const box = val.find(x => x.sName === "盒身"); - const svg = Number(box?.type); - - if (svg === 6) return 0; - if (hdzj?.type) return Number(hdzj.value); - - const dZ = Number(zscw?.value) || 0; - const dY = Number(yscw?.value) || 0; - if (svg === 8) { - const zxcw = val.find(x => x.sName === "左下插位组件"); - const yxcw = val.find(x => x.sName === "右下插位组件"); - const topsMap = { - 14001: width + Number(zxcw?.value), - 14002: Number(zxcw?.value), - 14003: Number(zxcw?.value), - 14004: Number(zxcw?.value) + width * 2, - 14005: width * 2, - 14006: Number(zxcw?.value) + width, - 14007: Number(zxcw?.value) + width, - }; - const topsMapRight = { - 16001: width + Number(yxcw?.value), - 16002: Number(yxcw?.value), - 16003: Number(yxcw?.value), - 16004: Number(yxcw?.value) + width * 2, - 16005: width * 2, - 16006: Number(yxcw?.value) + width, - 16007: Number(yxcw?.value) + width, - }; - return Math.max(topsMap[zxcw?.type], topsMapRight[yxcw?.type]) ?? 0; - } - const one = ["6001", "3001", "4001", "7001", "3006", "4006", "6006", "7006", "3007", "4007", "6007", "7007"]; + // 判断code + const valueList = list.filter(x => x.type !== ("" || null)); + // const titleList = ['上方盒舌','左(上)插位组件','右(上)插位组件'] + const sfhs = valueList.find(x => x.sName === "下方盒舌"); + const zscw = valueList.find(x => x.sName === "左(下)插位组件"); + const yscw = valueList.find(x => x.sName === "右(下)插位组件"); + const hdzj = valueList.find(x => x.sName === "盒底组件"); + // 将找到的对象放入数组中,并过滤掉 undefined 值 + // 使用 reduce 方法比较 value 属性,找出最大的对象 + let top = 0; + const one = ["6001", "3001", "4001", "7001"]; const four = ["6004", "3004", "4004", "7004"]; const five = ["6005", "3005", "4005", "7005"]; - - const coef = box?.type === "5" ? height : width; - - const pick = (cw, d) => { - const t = cw?.type; - if (five.includes(t)) return 2 * coef; - if (four.includes(t)) return 2 * coef + d; - if (one.includes(t)) return coef + d; - return d; - }; - - let top = 0; + const dYSCW = Number(yscw?.value) || 0; + const dZSCW = Number(zscw?.value) || 0; + if (hdzj?.type) { + return Number(hdzj?.value); + } if (zscw?.type && yscw?.type) { - const z = pick(zscw, dZ); - const y = pick(yscw, dY); - top = Math.max(z, y, sfhs?.value || 0); + const max = Math.max(dZSCW, dYSCW); + if (five.includes(zscw?.type) || five.includes(yscw?.type)) { + top = width * 2; + } else if (four.includes(zscw?.type) || four.includes(yscw?.type)) { + top = width * 2 + max; + } else if (one.includes(zscw?.type) || one.includes(yscw?.type)) { + top = width + max; + } else { + top = max; + } } else if (yscw?.type) { - top = Math.max(pick(yscw, dY), sfhs?.value || 0); + const max = dYSCW; + if (five.includes(zscw?.type) || five.includes(yscw?.type)) { + top = width * 2; + } else if (four.includes(zscw?.type) || four.includes(yscw?.type)) { + top = width * 2 + max; + } else if (one.includes(zscw?.type) || one.includes(yscw?.type)) { + top = width + max; + } else { + top = max; + } } else if (zscw?.type) { - top = Math.max(pick(zscw, dZ), sfhs?.value || 0); + const max = dZSCW; + if (five.includes(zscw?.type) || five.includes(yscw?.type)) { + top = width * 2; + } else if (four.includes(zscw?.type) || four.includes(yscw?.type)) { + top = width * 2 + max; + } else if (one.includes(zscw?.type) || one.includes(yscw?.type)) { + top = width + max; + } else { + top = max; + } } else { - top = sfhs?.value || 0; + top = sfhs?.value; } + // if (five.includes(zscw?.type) || five.includes(yscw?.type)) { + // top = width * 2; + // } else if (four.includes(zscw?.type) || four.includes(yscw?.type)) { + // if (dZSCW && dYSCW) { + // const max = Math.max(dZSCW, dYSCW); + // top = width * 2 + max; + // } else if (dZSCW && !dYSCW) { + // top = width * 2 + dZSCW; + // } else if (!dZSCW && dYSCW) { + // top = width * 2 + dYSCW; + // } + // } else if (one.includes(zscw?.type) || one.includes(yscw?.type)) { + // if (dZSCW && dYSCW) { + // const max = Math.max(dZSCW, dYSCW); + // top = width + max; + // } else if (dZSCW && !dYSCW) { + // top = width + dZSCW; + // } else if (!dZSCW && dYSCW) { + // top = width + dYSCW; + // } + // } else { + // if (dZSCW && !dYSCW) { + // top = Number(dZSCW); + // } else if (!dZSCW && dYSCW) { + // top = Number(dYSCW); + // } else { + // top = Number(sfhs?.value); + // } + // } - if (svg === 4) top += height; return isNaN(top) ? 0 : top; }; // 上方盒舌左边 - const createUpperBoxTongueLeft = (type, w, h, ox, oy) => { - if (!h) return createNoneProject(); - const fnMap = { - 1001: createLineWeltTop, - 1002: createIsoscelesTrapezoidWeltTop, - 1003: createTrapezoidWeltTop, - 1004: createFoldWeltTop, - 1005: createRoundedCornersWeltTop, - 2001: createLineWeltTop, - 2002: createIsoscelesTrapezoidWeltTop, - 2003: createTrapezoidWeltTop, - 2004: createFoldWeltTop, - 2005: createRoundedCornersWeltTop, - }; - return (fnMap[type] || createNoneProject)(w, h, ox, oy); + const createUpperBoxTongueLeft = (upperBoxTongueType, width, height, offsetX, offsetY) => { + if (!height) return createNoneProject(); + // 根据不同类型创建不同形状的盒舌 upperBoxTongueType 如果null则返回 + let data = {}; + switch (upperBoxTongueType) { + case "1001": + data = createLineWeltTop(width, height, offsetX, offsetY); + break; + case "1002": + data = createIsoscelesTrapezoidWeltTop(width, height, offsetX, offsetY); + break; + case "1003": + data = createTrapezoidWeltTop(width, height, offsetX, offsetY); + break; + case "1004": + data = createFoldWeltTop(width, height, offsetX, offsetY); + break; + case "1005": + data = createRoundedCornersWeltTop(width, height, offsetX, offsetY); + break; + case "2001": + data = createLineWeltTop(width, height, offsetX, offsetY); + break; + case "2002": + data = createIsoscelesTrapezoidWeltTop(width, height, offsetX, offsetY); + break; + case "2003": + data = createTrapezoidWeltTop(width, height, offsetX, offsetY); + break; + case "2004": + data = createFoldWeltTop(width, height, offsetX, offsetY); + break; + case "2005": + data = createRoundedCornersWeltTop(width, height, offsetX, offsetY); + break; + default: + data = createNoneProject(); + break; + } + return data; + }; + // 右上方盒舌 + const createUpperBoxTongueRight = (upperBoxTongueType, width, height, deep, size, offsetX, offsetY) => { + if (!size) return createNoneProject(); + // 根据不同类型创建不同形状的盒舌 upperBoxTongueType 如果null则返回 + let data = {}; + switch (upperBoxTongueType) { + case "1001": + data = createTopTongueType1(-deep, offsetX, offsetY, -size, -3, -2); + break; + case 1: + data = createTopTongueType1(-deep, offsetX, offsetY, -size, -3, -2); + break; + default: + data = createNoneProject(); + break; + } + return data; }; - // 右上方盒舌 + const createBottomBoxTongueRight = (upperBoxTongueType, width, height, deep, size, offsetX, offsetY) => { + if (!size) return createNoneProject(); + // 根据不同类型创建不同形状的盒舌 upperBoxTongueType 如果null则返回 + let data = {}; + switch (upperBoxTongueType) { + case 0: + data = createTopTongue(-deep, offsetX, offsetY, size, -2, 5, 0, true); + break; + case 1: + data = createTopTongueType1(-deep, offsetX, offsetY, -size, -3, -2); + break; + default: + data = createNoneProject(); + break; + } + return data; + }; + const createBottomBoxTongueLeft = (upperBoxTongueType, width, height, deep, size, offsetX, offsetY) => { + if (!size) return createNoneProject(); + // 根据不同类型创建不同形状的盒舌 upperBoxTongueType 如果null则返回 + let data = {}; + switch (upperBoxTongueType) { + case 0: + data = createTopTongue(deep, offsetX, offsetY, size, 2, 5, 1, false); + break; + case 1: + data = createTopTongueType1(deep, offsetX, offsetY, -size, 3, 2); + break; + default: + data = createNoneProject(); + break; + } + return data; + }; // 左边贴位 - const createTrapezoidLeft = (trapezoidLeftType, height, size, offsetX, offsetY, dSFHS, dXFHS) => { + const createTrapezoidLeft = (trapezoidLeftType, height, size, offsetX, offsetY) => { if (!size) return createNoneProject(); - const fnMap = { - 8001: createWelt, - 8002: createWelt1, - 8003: createWelt2, - 8004: createWelt3, - 8005: createWelt4, - }; - const fn = fnMap[trapezoidLeftType]; - return fn - ? trapezoidLeftType === "8005" - ? fn(height, size, offsetX, offsetY, dSFHS, dXFHS) - : fn(height, size, offsetX, offsetY) - : createNoneProject(); + let data = {}; + switch (trapezoidLeftType) { + case "8001": + data = createWelt(height, size, offsetX, offsetY); + break; + case "8002": + data = createWelt1(height, size, offsetX, offsetY); + break; + case "8003": + data = createWelt2(height, size, offsetX, offsetY); + break; + case "8004": + data = createWelt3(height, size, offsetX, offsetY); + break; + default: + data = createNoneProject(); + break; + } + return data; }; // 右边贴位 - const createTrapezoidRight = (trapezoidLeftType, height, size, offsetX, offsetY, dSFHS, dXFHS) => { - const suffix = trapezoidLeftType; - const fnMap = { - 9001: createWelt, - 9002: createWelt1, - 9003: createWelt2Right, - 9004: createWelt3Right, - 9005: createWelt4Right, - }; - const fn = fnMap[suffix]; - return fn ? (suffix === "9005" ? fn(height, size, offsetX, offsetY, dSFHS, dXFHS) : fn(height, size, offsetX, offsetY)) : createNoneProject(); + const createTrapezoidRight = (trapezoidLeftType, height, size, offsetX, offsetY) => { + if (!size) return createNoneProject(); + let data = {}; + switch (trapezoidLeftType) { + case "9001": + data = createWelt(height, size, offsetX, offsetY); + break; + case "9002": + data = createWelt1(height, size, offsetX, offsetY); + break; + case "9003": + data = createWelt2Right(height, size, offsetX, offsetY); + break; + case "9004": + data = createWelt3Right(height, size, offsetX, offsetY); + break; + default: + data = createNoneProject(); + break; + } + return data; }; // 左上部件 const createDynamicTopLeft = (trapezoidLeftType, width, height, size, offsetX, offsetY) => { if (!size) return createNoneProject(); - - const suffix = trapezoidLeftType?.slice(-2); - const fnMap = { - "01": createBoxComponentNew, - "02": createBoxComponentNew1, - "03": createBoxComponentNew2, - "04": createBoxComponentNew3, - "05": createBoxComponentNew4, - "06": createBoxComponentNew5, - "07": createBoxComponentNew6, - }; - - const fn = fnMap[suffix]; - return fn ? fn(width, height, size, offsetX, offsetY) : createNoneProject(); + let data = {}; + switch (trapezoidLeftType) { + case "3001": + data = createBoxComponentNew(width, height, size, offsetX, offsetY); + break; + case "3002": + data = createBoxComponentNew1(width, height, size, offsetX, offsetY); + break; + case "3003": + data = createBoxComponentNew2(width, height, size, offsetX, offsetY); + break; + case "3004": + data = createBoxComponentNew3(width, height, size, offsetX, offsetY); + break; + case "3005": + data = createBoxComponentNew4(width, height, size, offsetX, offsetY); + break; + case "4001": + data = createBoxComponentNew(width, height, size, offsetX, offsetY); + break; + case "4002": + data = createBoxComponentNew1(width, height, size, offsetX, offsetY); + break; + case "4003": + data = createBoxComponentNew2(width, height, size, offsetX, offsetY); + break; + case "4004": + data = createBoxComponentNew3(width, height, size, offsetX, offsetY); + break; + case "4005": + data = createBoxComponentNew4(width, height, size, offsetX, offsetY); + break; + case "6001": + data = createBoxComponentNew(width, height, size, offsetX, offsetY); + break; + case "6002": + data = createBoxComponentNew1(width, height, size, offsetX, offsetY); + break; + case "6003": + data = createBoxComponentNew2(width, height, size, offsetX, offsetY); + break; + case "6004": + data = createBoxComponentNew3(width, height, size, offsetX, offsetY); + break; + case "6005": + data = createBoxComponentNew4(width, height, size, offsetX, offsetY); + break; + case "7001": + data = createBoxComponentNew(width, height, size, offsetX, offsetY); + break; + case "7002": + data = createBoxComponentNew1(width, height, size, offsetX, offsetY); + break; + case "7003": + data = createBoxComponentNew2(width, height, size, offsetX, offsetY); + break; + case "7004": + data = createBoxComponentNew3(width, height, size, offsetX, offsetY); + break; + case "7005": + data = createBoxComponentNew4(width, height, size, offsetX, offsetY); + break; + default: + data = createNoneProject(); + break; + } + return data; + }; + // 右上部件 + const createDynamicTopRight = (trapezoidLeftType, width, height, size, offsetX, offsetY) => { + if (!size) return createNoneProject(); + let data = {}; + switch (trapezoidLeftType) { + case "6001": + data = createBoxComponentNew(width, height, size, offsetX, offsetY); + break; + case 1: + break; + default: + data = createNoneProject(); + break; + } + return data; }; - // 盒底组件 特殊的盒底组件 const createBoxBottomComponent = (trapezoidLeftType, width, deep, size, offsetX, offsetY) => { - const suffix = trapezoidLeftType?.slice(-2); - const fnMap = { - "01": createRightAngleBoxBottomComponent, - "02": createBoxBottomComponent1, - "03": createBoxBottomComponent2, - "04": createBoxBottomComponent3, - "05": createBoxBottomComponent4, - "06": createBoxBottomComponent5, - "07": createBoxBottomComponent6, - }; - return (fnMap[suffix] || createNoneProject)(width, deep, size, offsetX, offsetY); + let data = {}; + switch (trapezoidLeftType) { + case "5001": + data = createRightAngleBoxBottomComponent(width, deep, size, offsetX, offsetY); + break; + case "5002": + data = createBoxBottomComponent1(width, deep, size, offsetX, offsetY); + break; + case "5003": + data = createBoxBottomComponent2(width, deep, size, offsetX, offsetY); + break; + case "5004": + data = createBoxBottomComponent3(width, deep, size, offsetX, offsetY); + break; + case "5005": + data = createBoxBottomComponent4(width, deep, size, offsetX, offsetY); + break; + case "5006": + data = createBoxBottomComponent5(width, deep, size, offsetX, offsetY); + break; + case "5007": + data = createBoxBottomComponent6(width, deep, size, offsetX, offsetY); + break; + default: + data = createNoneProject(); + break; + } + return data; }; + // 天地盒部件 const createFull = (trapezoidLeftType, width, deep, size, offsetX, offsetY) => { + let data = {}; if (!size) return createNoneProject(); + switch (trapezoidLeftType) { + case "4001": + data = createBoxComponentNewFull(width, deep, size, offsetX, offsetY); + break; + case "4002": + data = createBoxComponentNewFull1(width, size, offsetX, offsetY); + break; + case "4003": + data = createBoxComponentNewFull2(width, size, offsetX, offsetY); + break; + case "4004": + data = createBoxComponentNewFul3(width, deep, size, offsetX, offsetY); + break; + case "4005": + data = createBoxComponentNewFul4(width, deep, size, offsetX, offsetY); + break; - const suffix = trapezoidLeftType?.slice(-2); - switch (suffix) { - case "01": // 4001,10001,12001,13001,15001,6001 - return createBoxComponentNewFull(width, deep, size, offsetX, offsetY); - case "02": // 4002,10002,11002,12002,13002,15002,6002 - return createBoxComponentNewFull1(width, size, offsetX, offsetY); - case "03": // 4003,6003 - return createBoxComponentNewFull2(width, size, offsetX, offsetY); - case "04": // 4004,6004 - return createBoxComponentNewFul3(width, deep, size, offsetX, offsetY); - case "05": // 4005,6005 - return createBoxComponentNewFul4(width, deep, size, offsetX, offsetY); - case "06": // 4006,6006 - return createBoxComponentNewFul5(width, deep, size, offsetX, offsetY); - case "07": // 4007,6007 - return createBoxComponentNewFul6(width, deep, size, offsetX, offsetY); + case "6001": + data = createBoxComponentNewFull(width, deep, size, offsetX, offsetY); + break; + case "6002": + data = createBoxComponentNewFull1(width, size, offsetX, offsetY); + break; + case "6003": + data = createBoxComponentNewFull2(width, size, offsetX, offsetY); + break; + case "6004": + data = createBoxComponentNewFul3(width, deep, size, offsetX, offsetY); + break; + case "6005": + data = createBoxComponentNewFul4(width, deep, size, offsetX, offsetY); + break; default: - return createNoneProject(); + data = createNoneProject(); + break; } + return data; }; return (
{ } // 左上部件 pathList.push(createDynamicTopLeft(zsbj?.type, scaledWidth, -scaledHeight, -dZSCW * scale, 0, 0)); - if ((zsbj?.type === "3001" && zsbj?.value )|| (zsbj?.type === "3006" && zsbj?.value)) { + if (zsbj?.type === "3001" && zsbj?.value) { pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, -scaledHeight / 2, scales)); pathList.push(createText(scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); // 插位值 @@ -348,7 +347,7 @@ const SvgBox = props => { } // 左上部件 pathList.push(createDynamicTopLeft(zsbj?.type, scaledWidth, -scaledHeight, -dZSCW * scale, 0, 0)); - if ((zsbj?.type === "3001" && zsbj?.value )|| (zsbj?.type === "3006" && zsbj?.value)) { + if (zsbj?.type === "3001" && zsbj?.value) { pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, -scaledHeight / 2, scales)); pathList.push(createText(scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); pathList.push(createText(scaledWidth / 2, -scaledHeight - dZSCW / 2 + 4, 10 * scales, dZSCW)); @@ -577,7 +576,7 @@ const SvgBox = props => { const zscw = valueList.find(x => x.sName === "左(上)插位组件"); const yscw = valueList.find(x => x.sName === "右(上)插位组件"); let top = 0; - const one = ["6001", "3001", "4001", "7001", "3006", "4006", "6006", "7006"]; + const one = ["6001", "3001", "4001", "7001"]; const four = ["6004", "3004", "4004", "7004"]; const five = ["6005", "3005", "4005", "7005"]; const dYSCW = Number(yscw?.value) || 0; @@ -632,7 +631,7 @@ const SvgBox = props => { // 将找到的对象放入数组中,并过滤掉 undefined 值 // 使用 reduce 方法比较 value 属性,找出最大的对象 let top = 0; - const one = ["6001", "3001", "4001", "7001", "3006", "4006", "6006", "7006"]; + const one = ["6001", "3001", "4001", "7001"]; const four = ["6004", "3004", "4004", "7004"]; const five = ["6005", "3005", "4005", "7005"]; const dYSCW = Number(yscw?.value) || 0; @@ -870,9 +869,6 @@ const SvgBox = props => { case "3005": data = createBoxComponentNew4(width, height, size, offsetX, offsetY); break; - case "3006": - data = createBoxComponentNew5(width, height, size, offsetX, offsetY); - break; case "4001": data = createBoxComponentNew(width, height, size, offsetX, offsetY); break; @@ -888,9 +884,6 @@ const SvgBox = props => { case "4005": data = createBoxComponentNew4(width, height, size, offsetX, offsetY); break; - case "4006": - data = createBoxComponentNew5(width, height, size, offsetX, offsetY); - break; case "6001": data = createBoxComponentNew(width, height, size, offsetX, offsetY); break; @@ -906,9 +899,6 @@ const SvgBox = props => { case "6005": data = createBoxComponentNew4(width, height, size, offsetX, offsetY); break; - case "6006": - data = createBoxComponentNew5(width, height, size, offsetX, offsetY); - break; case "7001": data = createBoxComponentNew(width, height, size, offsetX, offsetY); break; @@ -924,9 +914,6 @@ const SvgBox = props => { case "7005": data = createBoxComponentNew4(width, height, size, offsetX, offsetY); break; - case "7006": - data = createBoxComponentNew5(width, height, size, offsetX, offsetY); - break; default: data = createNoneProject(); break; diff --git a/src/components/Common/BoxProject/index.js b/src/components/Common/BoxProject/index.js index bf79f4d..87058d7 100644 --- a/src/components/Common/BoxProject/index.js +++ b/src/components/Common/BoxProject/index.js @@ -4,7 +4,7 @@ import CommonBase from "../../Common/CommonBase"; /* 获取配置及数据 */ import CommonSales from "../../Common/CommonBillEvent"; /* 继承销售模块业务功能 */ import * as commonFunc from "../../Common/commonFunc"; /* 通用单据方法 */ /* 通用单据方法 */ import { Form } from "@ant-design/compatible"; -import { Spin, Tree, Select, Input } from "antd-v4"; +import { Spin, Tree, Select, Input } from "antd"; import styles from "./index.less"; import { ArrowLeftOutlined, FolderFilled, FolderOpenFilled, FileTextFilled, PlusOutlined, MinusOutlined } from "@ant-design/icons"; import SvgBox from "./svg"; @@ -37,6 +37,7 @@ const BoxProjectContent = Form.create({ return obj; }, })(props => { + console.log("🚀 ~ props:", props); const { updateBoxList, boxList } = props; // 获取父组件传递的更新方法 // 获取树形节点 const treeData = [ @@ -80,6 +81,7 @@ const BoxProjectContent = Form.create({ }, [updateBoxList] ); + console.log("🚀 ~ boxList:", boxList); const handleFocus = (e, index) => { if (boxList && boxList.length) { @@ -122,7 +124,6 @@ const BoxProjectContent = Form.create({ const svgProps = { ...props, boxList, - showNew:0 }; // const renderTreeNodes = data => { // return data.map(item => { diff --git a/src/components/Common/BoxProject/svg.js b/src/components/Common/BoxProject/svg.js index 9352674..4ec6e66 100644 --- a/src/components/Common/BoxProject/svg.js +++ b/src/components/Common/BoxProject/svg.js @@ -10,6 +10,7 @@ import { createNoneProject, } from "../BoxDesign/createAirplaneBox"; const SvgBox = props => { + console.log("🚀 ~ propsprops:", props); const svgContainerRef = useRef(null); const svgRef = useRef(null); const [boxKey, setBoxKey] = useState(new Date().getTime()); diff --git a/src/components/Common/BoxShowImgMaterial/index.css b/src/components/Common/BoxShowImgMaterial/index.css index 7f23e10..14cc0c2 100644 --- a/src/components/Common/BoxShowImgMaterial/index.css +++ b/src/components/Common/BoxShowImgMaterial/index.css @@ -4,5 +4,4 @@ } .box .materialBox { background-color: '#b7e0ff'; - border: 2px solid #333; } diff --git a/src/components/Common/BoxShowImgMaterial/index.js b/src/components/Common/BoxShowImgMaterial/index.js index ebe9413..00d2ee0 100644 --- a/src/components/Common/BoxShowImgMaterial/index.js +++ b/src/components/Common/BoxShowImgMaterial/index.js @@ -3,6 +3,7 @@ import React, { useEffect, useState, useRef } from "react"; import { VerticalLeftOutlined, VerticalRightOutlined } from "@ant-design/icons"; import styles from "./index.less"; import { bottom } from "react-grid-layout/build/utils"; +import { transform } from "@antv/g2/lib/util/transform"; const BoxShowImgMaterial = props => { const boxRef = useRef(null); @@ -168,7 +169,7 @@ const BoxShowImgMaterial = props => { // 计算材料利用率 const availability = ((((horizontalBoxes * verticalBoxes) * (Number(dMachineLength) * Number(dMachineWidth)) / (Number(dWlcd) * Number(dWlkd)))) * 100).toFixed(2); useEffect(() => { - // setBoxKey(new Date().getTime()); + setBoxKey(new Date().getTime()); setTimeout(() => { if (boxRef.current && textRef.current && textRefs.current && nTextRef.current && nTextRefs.current) { // 计算父元素的缩放因子 diff --git a/src/components/Common/BoxShowImgMaterial/index.less b/src/components/Common/BoxShowImgMaterial/index.less index 2d916dd..59b7ba2 100644 --- a/src/components/Common/BoxShowImgMaterial/index.less +++ b/src/components/Common/BoxShowImgMaterial/index.less @@ -4,6 +4,5 @@ .materialBox{ // position: absolute; background-color: '#b7e0ff'; - border: 2px solid #333; } } \ No newline at end of file diff --git a/src/components/Common/BoxShowImgMaterial/indexNew.js b/src/components/Common/BoxShowImgMaterial/indexNew.js deleted file mode 100644 index 9b55f54..0000000 --- a/src/components/Common/BoxShowImgMaterial/indexNew.js +++ /dev/null @@ -1,383 +0,0 @@ -/* eslint-disable */ -import React, { useEffect, useState, useRef } from "react"; -import { VerticalLeftOutlined, VerticalRightOutlined, ArrowRightOutlined } from "@ant-design/icons"; -import styles from "./index.less"; -import { bottom } from "react-grid-layout/build/utils"; -import { transform } from "@antv/g2/lib/util/transform"; -const BoxShowImgMaterial = props => { - const boxRef = useRef(null); - const textRef = useRef(null); - const textRefs = useRef(null); - const nTextRefs = useRef(null); - const nTextRef = useRef(null); - const [boxKey, setBoxKey] = useState(new Date().getTime()); - const { width, height, size } = props; - const clientWidth = width || 300; - const clientHeight = height || 250; - // 找出盒型信息 - const { slaveData, selectedNode } = props.state; - const { boxModel } = props; - const slaveDataDetail = slaveData?.find(item => item.sTreeNodeName === selectedNode.showName && item.sBoxModel === boxModel); - if (slaveDataDetail) { - // 最大上机长 上机宽 排版长 排版宽 材料长 材料宽 - var { dMaxLength, dMaxWidth, dMachineLength, dMachineWidth, dWlcd, dWlkd, dSBLB, dXBLB, dZBLB, dYBLB, scale } = slaveDataDetail; - } - // 计算可以放置的盒子数量 - const isJuantong = selectedNode.sTypeKey === "juantong"; - const horizontalBoxes = Math.floor(dWlcd / dMachineLength); - const verticalBoxes = Math.floor(dWlkd / dMachineWidth); - const scaleX = (clientWidth - 100) / Number(dWlcd); - const scaleY = (clientHeight - 70) / Number(dWlkd); - // 动态生成多个 materialBox - const generateMaterialBoxes = () => { - const boxes = []; - for (let i = 0; i < horizontalBoxes * verticalBoxes; i++) { - boxes.push( -
-
- -
- - {dMachineLength} - - -
-
-
- -
- - {dMachineWidth} - - - - -
-
- {/*
- {isJuantong ? "门幅方向" : ""} -
-
- -
*/} -
- ); - } - return boxes; - }; - // 计算材料利用率 - const availability = ( - ((horizontalBoxes * verticalBoxes * (Number(dMachineLength) * Number(dMachineWidth))) / (Number(dWlcd) * Number(dWlkd))) * - 100 - ).toFixed(2); - useEffect(() => { - setBoxKey(new Date().getTime()); - setTimeout(() => { - // if (boxRef.current && textRef.current && textRefs.current && nTextRef.current && nTextRefs.current) - if (boxRef.current && textRef.current && textRefs.current && nTextRef.current && nTextRefs.current) { - // 计算父元素的缩放因子 - // 对父元素应用缩放 - boxRef.current.style.transform = `scale(${scaleX}, ${scaleY})`; - boxRef.current.style.transformOrigin = "top left"; - // // 对子元素应用逆缩放 - textRef.current.style.transform = `scale(${1 / scaleX}, ${1 / scaleY})`; - textRef.current.style.transformOrigin = "top left"; - textRefs.current.style.transform = `scale(${1 / scaleX}, ${1 / scaleY})`; - textRefs.current.style.transformOrigin = "top left"; - } - }, 10); - }, [scaleX, scaleY]); - const isMax = slaveDataDetail?.dMaxWidth * slaveDataDetail?.dMaxLength > slaveDataDetail?.dMachineLength * slaveDataDetail?.dMachineWidth; - const isDPartsLength = slaveDataDetail?.dPartsLength < slaveDataDetail?.dMaxLength && slaveDataDetail?.dPartsWidth < slaveDataDetail?.dMaxWidth; - - const isShow = - isDPartsLength && slaveDataDetail && slaveDataDetail.dMachineLength && slaveDataDetail.dMaxWidth && slaveDataDetail.dMaxLength && isMax; - - return ( - <> - {isShow ? ( -
-
- -
- - - {dWlcd} - - - 材料利用率: - - - {availability}% - - - -
-
-
- -
- - {dWlkd} - - -
-
- {generateMaterialBoxes()} -
- ) : ( - "" - )} - - ); -}; -export default BoxShowImgMaterial; diff --git a/src/components/Common/CheckModel.js b/src/components/Common/CheckModel.js index fdffd16..efc1061 100644 --- a/src/components/Common/CheckModel.js +++ b/src/components/Common/CheckModel.js @@ -1,7 +1,7 @@ /* eslint-disable array-callback-return,no-undef */ import React, { Component } from 'react'; -import { Table, Button, Checkbox, Input, message } from 'antd-v4'; -import config from '@/utils/config'; +import { Table, Button, Checkbox, Input, message } from 'antd'; +import * as config from '@/utils/config'; import styles from '@/index.less'; import AntdDraggableModal from '@/components/Common/AntdDraggableModal'; diff --git a/src/components/Common/CommonBase.js b/src/components/Common/CommonBase.js index d5755aa..1d11210 100644 --- a/src/components/Common/CommonBase.js +++ b/src/components/Common/CommonBase.js @@ -8,7 +8,7 @@ import React, { Component } from 'react'; import { message } from '@/utils/common/message'; import moment from 'moment'; import lodash from 'lodash'; -import commonConfig from '../../utils/config'; +import * as commonConfig from '../../utils/config'; import * as commonUtils from '../../utils/utils'; import * as commonServices from '../../services/services'; import * as commonFunc from './commonFunc'; @@ -44,6 +44,7 @@ export default (ChildComponent) => { window.addEventListener('beforeunload', this.beforeunload); window.addEventListener('unload', this.unload); window.addEventListener('keydown', this.handleF9KeyPress); + console.log('sSrcModelsId', this.state.sSrcModelsId); } async componentWillMount() { @@ -451,7 +452,7 @@ export default (ChildComponent) => { } const url = `${commonConfig.server_host}business/getSelectLimit/${showConfig.sId}?sModelsId=${this.state.sModelsId}&sName=${formSrcRoute}`; /* 参数 */ - const nameNew = (name.includes('slaveUp') || name.includes('slaveDown')) ? 'slave' : name; + const nameNew = name.includes('slaveUp') ? 'slave' : name; const conditonValues = this.getSqlCondition(showConfig, nameNew, record); const body = { @@ -679,6 +680,7 @@ export default (ChildComponent) => { let sCopyToConfigMaster = {}; if(commonUtils.isNotEmptyArr(sCopyToConfigField) && commonUtils.isNotEmptyArr(tableConfig)) { sCopyToConfigMaster = tableConfig.gdsconfigformslave.filter(item => item.sControlName === sCopyToConfigField); + console.log(sCopyToConfigMaster, sCopyToConfigMaster); if(commonUtils.isNotEmptyArr(sCopyToConfigMaster)) { const sCopyToConfigMasterAssignField= sCopyToConfigMaster[0].sAssignField; const newCopyTo = {}; @@ -981,9 +983,6 @@ export default (ChildComponent) => { * 原代码: */ let billNum = ''; - let footTotalStr = ''; - const footTotal =commonFunc.showMessage(this.props.app.commonConst, 'footTotal') || - '当前显示 共${billNum}个单据 共${total}条记录'; if (dataReturn.dataset.billNum) { billNum = `共${dataReturn.dataset.billNum}个单据 `; } @@ -996,9 +995,8 @@ export default (ChildComponent) => { current: dataReturn.dataset.currentPageNo, pageSize: pageSize, showTotal: (total) => { - footTotalStr = footTotal.replace('${billNum}', dataReturn.dataset.billNum).replace('${total}', total); return ( - {footTotalStr} + {`当前显示 ${billNum}共${total}条记录`} ); }, }; @@ -1082,9 +1080,13 @@ export default (ChildComponent) => { if (commonUtils.isNotEmptyArr(tableDelData)) { addState[`${name}DelData`] = []; } + if (isWait) { + // console.log(addState,'----------'); + return addState; } else if (this.mounted) { + this.handleSaveState(addState); } } else { @@ -1769,56 +1771,62 @@ export default (ChildComponent) => { const sFiledConfig = tableConfig.gdsconfigformslave[iConfigIndex]; if (commonUtils.isNotEmptyObject(sFiledConfig)) { const tableDataRow = { ...tableData[iIndex], ...changeValue, handleType }; - const sRulesJson = sFiledConfig.sButtonEnabled; + const sRulesJson = sFiledConfig.sButtonEnabled; if (commonUtils.isNotEmptyObject(sRulesJson) && commonUtils.isJSON(sRulesJson)) { - const sRulesObj = JSON.parse(sRulesJson); - if (commonUtils.isNotEmptyObject(sRulesObj)) { - const { showColumn, hideColumn, condition } = sRulesObj; - if (commonUtils.isNotEmptyArr(condition)) { - let flag = false; - for (const item of condition) { - const { - bFilterName, bFilterCondition, bFilterValue, - } = item; - if (bFilterCondition === '>') { - if (tableDataRow[bFilterName] > bFilterValue) { - flag = true; - } - } else if (bFilterCondition === '=') { - if (tableDataRow[bFilterName] === bFilterValue) { - flag = true; - } - } else if (bFilterCondition === '<') { - if (tableDataRow[bFilterName] < bFilterValue) { - flag = true; + const sRulesObjArr = JSON.parse(sRulesJson); + if (commonUtils.isNotEmptyArr(sRulesObjArr)) { + sRulesObjArr.forEach((sRulesObj) => { + const { showColumn, hideColumn, condition } = sRulesObj; + if (commonUtils.isNotEmptyArr(condition)) { + let flag = false; + for (const item of condition) { + const { + bFilterName, bFilterCondition, bFilterValue, + } = item; + if (bFilterCondition === '>') { + if (Number(tableDataRow[bFilterName]) > Number(bFilterValue)) { + flag = true; + } + } else if (bFilterCondition === '=') { + if (tableDataRow[bFilterName].toString() === bFilterValue.toString() ) { + flag = true; + } + } else if (bFilterCondition === '!==') { + if (tableDataRow[bFilterName].toString() !== bFilterValue.toString()) { + flag = true; + } + } else if (bFilterCondition === '<') { + if (Number(tableDataRow[bFilterName]) < Number(bFilterValue)) { + flag = true; + } } } - } - if (flag) { - if (commonUtils.isNotEmptyArr(showColumn)) { - for (const column of showColumn) { - const iShowIndex = tableConfig.gdsconfigformslave.findIndex(item => item.sName === column); - if (iShowIndex > -1) { - const sFiledObj = tableConfig.gdsconfigformslave[iShowIndex]; - if (commonUtils.isNotEmptyObject(sFiledObj)) { - tableConfig.gdsconfigformslave[iShowIndex].bVisible = true; + if (flag) { + if (commonUtils.isNotEmptyArr(showColumn)) { + for (const column of showColumn) { + const iShowIndex = tableConfig.gdsconfigformslave.findIndex(item => item.sName === column); + if (iShowIndex > -1) { + const sFiledObj = tableConfig.gdsconfigformslave[iShowIndex]; + if (commonUtils.isNotEmptyObject(sFiledObj)) { + tableConfig.gdsconfigformslave[iShowIndex] = {...tableConfig.gdsconfigformslave[iShowIndex], bVisible: true }; + } } } } - } - if (commonUtils.isNotEmptyArr(hideColumn)) { - for (const column of hideColumn) { - const iHideIndex = tableConfig.gdsconfigformslave.findIndex(item => item.sName === column); - if (iHideIndex > -1) { - tableConfig.gdsconfigformslave[iHideIndex].bVisible = false; + if (commonUtils.isNotEmptyArr(hideColumn)) { + for (const column of hideColumn) { + const iHideIndex = tableConfig.gdsconfigformslave.findIndex(item => item.sName === column); + if (iHideIndex > -1) { + tableConfig.gdsconfigformslave[iHideIndex] = {...tableConfig.gdsconfigformslave[iHideIndex], bVisible: false }; + } } } - } - const tableColumn = commonFunc.getHeaderConfig(tableConfig); - this.handleSaveState({ [`${name}Config`]: tableConfig, [`${name}Column`]: tableColumn }); + const tableColumn = commonFunc.getHeaderConfig(tableConfig); + this.handleSaveState({ [`${name}Config`]: tableConfig, [`${name}Column`]: tableColumn }); + } } - } + }); } } } @@ -2938,6 +2946,7 @@ export default (ChildComponent) => { if (commonUtils.isNotEmptyObject(sRulesJson) && commonUtils.isJSON(sRulesJson)) { const sRulesObjArr = JSON.parse(sRulesJson); if (Array.isArray(sRulesObjArr) && commonUtils.isNotEmptyArr(sRulesObjArr)) { + console.log('sRulesObjArr:', sRulesObjArr); sRulesObjArr.forEach((sRulesObj) => { const { showColumn, hideColumn, condition, tbName, sConfigName, @@ -3140,6 +3149,7 @@ export default (ChildComponent) => { } const url = `${commonConfig.server_host}procedureCall/doGenericProcedureCall?sModelsId=${sModelsId}`; const dataReturn = (await commonServices.postValueService(app.token, value, url)).data; + console.log('dataReturn', dataReturn); if (dataReturn.code === 1) { if (commonUtils.isNotEmptyArr(slaveDataOld)) { slaveDataOld.forEach((item) => { @@ -3290,6 +3300,7 @@ export default (ChildComponent) => { if (commonUtils.isNotEmptyArr(allReturnMap.masterData) && Array.isArray(allReturnMap.masterData)) { allReturnMap.masterData = allReturnMap.masterData[0]; } + console.log('allReturnMap:', allReturnMap); this.setState({ ...allReturnMap }); } } else { diff --git a/src/components/Common/CommonBill/index.js b/src/components/Common/CommonBill/index.js index 3b71b43..0286845 100644 --- a/src/components/Common/CommonBill/index.js +++ b/src/components/Common/CommonBill/index.js @@ -3,7 +3,7 @@ import React, { Component } from 'react'; import { UploadOutlined } from '@ant-design/icons'; import { Form } from '@ant-design/compatible'; -// import '@ant-design/compatible/assets/index.css'; +import '@ant-design/compatible/assets/index.css'; import { Row, Col, @@ -17,7 +17,7 @@ import { Upload, Input, Modal -} from 'antd-v4'; +} from 'antd'; import { message } from '@/utils/common/message'; import CommonSales from '@/components/Common/CommonBillEvent';/* 继承销售模块业务功能 */ import * as commonFunc from '@/components/Common/commonFunc';/* 通用单据方法 */ /* 通用单据方法 */ @@ -27,7 +27,7 @@ import styles from '@/index.less'; import CommonView from '@/components/Common/CommonView'; import CommonBase from '@/components/Common/CommonBase';/* 获取配置及数据 */ import * as commonBusiness from '@/components/Common/commonBusiness';/* 单据业务功能 */ -import commonConfig from '@/utils/config'; +import * as commonConfig from '@/utils/config'; import * as commonUtils from '@/utils/utils';/* 通用方法 */ import * as commonServices from '@/services/services';/* 服务类 */ import CommonListSelect from '@/components/Common/CommonListSelect'; @@ -1708,8 +1708,7 @@ class CommonBill extends Component { if (Type === 'formSlave') { /* 根据从表勾选数据 生成从表数据 */ const { slaveSelectedRowKeys } = this.props; if (commonUtils.isEmptyObject(slaveSelectedRowKeys)) { - message.error(commonFunc.showMessage(this.props.app.commonConst, 'pleaseChooseData'));/* 请选择一条数据 */ - + message.warn('请选择数据'); return; } sId = slaveSelectedRowKeys; @@ -1823,7 +1822,7 @@ class CommonBill extends Component { let controlTableData = []; if(visibleModal) { if(commonUtils.isNotEmptyArr(slaveSelectedRowKeys)) { - controlTableData = controlData.filter(item => item.sControlId === slaveSelectedRowKeys[0]) + controlTableData = controlData.filter(item => item.sSlaveId === slaveSelectedRowKeys[0]); }else { controlTableData = controlData; } @@ -2530,12 +2529,9 @@ const BillComponent = Form.create({ } return Object.keys(controlGroup).map((tabNameKey) => { - let tabName = tabNameKey.replace(/\d+/g, ""); + const tabName = tabNameKey.replace(/\d+/g, ""); const num = tabNameKey.replace(/[^\d]/g, "").trim(); - const tableConfigArr = config?.gdsconfigformslave.filter(row => row.sControlName === tabNameKey.trim()); - if(commonUtils.isNotEmptyArr(tableConfigArr)) { - tabName= tableConfigArr[0].showName; - } + const viewProps = { ...props, viewConfigs: controlGroup[tabNameKey], diff --git a/src/components/Common/CommonBill/index.less b/src/components/Common/CommonBill/index.less index 26f8ca4..22322e8 100644 --- a/src/components/Common/CommonBill/index.less +++ b/src/components/Common/CommonBill/index.less @@ -1,4 +1,4 @@ -@import "~@/variable.less"; +@import "~antd/lib/style/themes/default.less"; .bShowImg{ position: fixed; width: 90px; diff --git a/src/components/Common/CommonBillDeliver.js b/src/components/Common/CommonBillDeliver.js index 0b64d0d..cd2d554 100644 --- a/src/components/Common/CommonBillDeliver.js +++ b/src/components/Common/CommonBillDeliver.js @@ -3,8 +3,8 @@ import React, { Component } from 'react'; import { UploadOutlined } from '@ant-design/icons'; import { Form } from '@ant-design/compatible'; -// import '@ant-design/compatible/assets/index.css'; -import { Row, Col, Checkbox, Layout, Spin, Tabs, Avatar, Button, message, Table, Input, Upload } from 'antd-v4'; +import '@ant-design/compatible/assets/index.css'; +import { Row, Col, Checkbox, Layout, Spin, Tabs, Avatar, Button, message, Table, Input, Upload } from 'antd'; import * as commonFunc from '@/components/Common/commonFunc';/* 通用单据方法 */ /* 通用单据方法 */ import Toolbar from '@/components/Common/ToolBar/ToolBarNew'; import StaticEditTable from '@/components/Common/CommonTable';/* 可编辑表格 */ @@ -12,7 +12,7 @@ import styles from '@/index.less'; import CommonView from '@/components/Common/CommonView'; import CommonBase from '@/components/Common/CommonBase';/* 获取配置及数据 */ import * as commonBusiness from '@/components/Common/commonBusiness';/* 单据业务功能 */ -import commonConfig from '@/utils/config'; +import * as commonConfig from '@/utils/config'; import * as commonUtils from '@/utils/utils';/* 通用方法 */ import * as commonServices from '@/services/services';/* 服务类 */ diff --git a/src/components/Common/CommonBillDeliverEvent.js b/src/components/Common/CommonBillDeliverEvent.js index 3ccafe1..2eea542 100644 --- a/src/components/Common/CommonBillDeliverEvent.js +++ b/src/components/Common/CommonBillDeliverEvent.js @@ -3,12 +3,12 @@ * Created by pm on 2021-08-17 用于送货单个性化. */ import React, { Component } from 'react'; -import { Modal, message } from 'antd-v4'; +import { Modal, message } from 'antd'; import moment from 'moment'; import * as commonUtils from '../../utils/utils'; /* 通用方法 */ import * as commonBusiness from './commonBusiness'; /* 单据业务功能 */ import * as commonServices from '../../services/services'; /* 服务类 */ -import commonConfig from '../../utils/config'; +import * as commonConfig from '../../utils/config'; import * as commonFunc from './commonFunc'; const { confirm } = Modal; @@ -47,7 +47,7 @@ export default (ChildComponent) => { employeeConfig: employeeConfigOld, } = nextProps; if (commonUtils.isEmptyObject(slaveConfigOld) && formData.length > 0 && (sModelsType !== 'cashier/financialTransfer' && sModelsType !== 'cashier/financialAdjustment' && sModelsType !== 'quality/accident' && sModelsType !== 'purchase/purchaseEnquiry' && sModelsType !== 'complaint/complaint' && sModelsType !== 'print/printLabel' && sModelsType !== 'commonBill/onlyMaster' && formRoute.indexOf('indexOee') === -1)) { - const sId = currentId || nextProps.masterData?.sId || ''; + const sId = currentId !== undefined ? currentId : ''; /* 数据Id */ const masterConfig = formData.filter(item => !item.bGrd)[0]; const BtnDesignFunctionConfig = commonUtils.isNotEmptyObject(masterConfig) ? masterConfig.gdsconfigformslave.filter(item => item.sControlName === 'BtnBsOperation.BtnDesignFunction') : {}; @@ -274,7 +274,7 @@ export default (ChildComponent) => { }); } else if (commonUtils.isEmptyObject(masterConfigOld) && formData.length === 1 && (sModelsType === 'cashier/financialTransfer' || sModelsType === 'purchase/purchaseEnquiry' || sModelsType === 'cashier/financialAdjustment' || sModelsType === 'print/printLabel' || sModelsType === 'complaint/complaint' || sModelsType === 'commonBill/onlyMaster') && formRoute.indexOf('indexOee') === -1) { const config = {}; - const sId = currentId || nextProps.masterData?.sId || ''; + const sId = currentId !== undefined ? currentId : ''; /* 数据Id */ const masterConfig = formData.filter(item => !item.bGrd)[0]; let addState = {}; @@ -296,7 +296,7 @@ export default (ChildComponent) => { masterConfig, sId, pageLoading: false, ...addState, }); } else if (commonUtils.isEmptyObject(slaveConfigOld) && commonUtils.isEmptyObject(masterConfigOld) && formData.length === 2 && (sModelsType === 'quality/accident') && formRoute.indexOf('indexOee') === -1) { - const sId = currentId || nextProps.masterData?.sId || ''; + const sId = currentId !== undefined ? currentId : ''; /* 数据Id */ const masterConfig = formData.filter(item => !item.bGrd)[0]; const slaveConfig = formData.filter(item => item.bGrd && item.sTbName === 'mftqualityaccidentSlave')[0]; @@ -319,7 +319,7 @@ export default (ChildComponent) => { }); } else if (formRoute.indexOf('indexOee') > -1 && commonUtils.isEmptyObject(employeeConfigOld) && commonUtils.isEmptyObject(slaveConfigOld) && formData.length > 0) { if (formRoute === '/indexOee/labelPrint' && commonUtils.isEmpty(slaveConfigOld)) { /* 入库标签打印 */ - const sId = currentId || nextProps.masterData?.sId || ''; + const sId = currentId !== undefined ? currentId : ''; /* 数据Id */ const masterConfig = formData[0]; const slaveConfig = formData[0]; @@ -507,7 +507,7 @@ export default (ChildComponent) => { /** 获取主表、从表、审核表数据 */ handleGetData = async (masterConfig, slaveConfig, checkConfig, bEditClick) => { const { currentId } = this.props; /* 当前页签数据 */ - const sId = currentId || this.props.masterData?.sId || ''; + const sId = currentId !== undefined ? currentId : ''; await this.props.handleGetDataOne({ name: 'master', configData: masterConfig, condition: { sId, pageSize: '', pageNum: '' }, bEditClick, }); @@ -544,7 +544,7 @@ export default (ChildComponent) => { /* 获取表数据 */ handleGetMemoData = async (controlConfig, materialsConfig, processConfig, colorConfig, packConfig) => { const { currentId, sModelsType } = this.props; /* 当前页签数据 */ - const sId = currentId || this.props.masterData?.sId || ''; /* 数据Id */ + const sId = currentId !== undefined ? currentId : ''; /* 数据Id */ const addStateControl = await this.props.handleGetDataSet({ name: 'control', configData: controlConfig, condition: { sSqlCondition: { sParentId: sId } }, isWait: true, }); @@ -597,7 +597,7 @@ export default (ChildComponent) => { /* 获取单张表数据 */ handleGetOneMemoData = (memoName, memoConfig) => { const { currentId } = this.props; /* 当前页签数据 */ - const sId = currentId || this.props.masterData?.sId || ''; /* 数据Id */ + const sId = currentId !== undefined ? currentId : ''; /* 数据Id */ if (commonUtils.isNotEmptyObject(sId)) { /* 解决detail数据没有问题 */ this.props.handleGetDataSet({ name: memoName, configData: memoConfig, condition: { sSqlCondition: { sParentId: sId } }, @@ -5135,8 +5135,8 @@ export default (ChildComponent) => { }; render() { - const { masterData, sModelsType, app } = this.props; - const imgSrc = commonBusiness.handleAddIcon(masterData, sModelsType, app); + const { masterData } = this.props; + const imgSrc = commonBusiness.handleAddIcon(masterData); return ( { slaveInfoList: slaveInfoListOld, } = nextProps; if (commonUtils.isEmptyObject(slaveConfigOld) && formData.length > 0 && (sModelsId === '12710101117024321284220' || (sModelsType !== 'cashier/financialTransfer' && sModelsType !== 'cashier/financialAdjustment' && sModelsType !== 'quality/accident' && sModelsType !== 'purchase/purchaseEnquiry' && sModelsType !== 'complaint/complaint' && sModelsType !== 'print/printLabel' && sModelsType !== 'commonBill/onlyMaster' && (formRoute.indexOf('indexOee') === -1 || formRoute === '/indexOee/commonOeeBill')))) { - const sId = currentId || nextProps.masterData?.sId || ''; + const sId = currentId !== undefined ? currentId : ''; /* 数据Id */ const masterConfig = formData.filter(item => !item.bGrd)[0]; const BtnDesignFunctionConfig = commonUtils.isNotEmptyObject(masterConfig) ? masterConfig.gdsconfigformslave.filter(item => item.sControlName === 'BtnBsOperation.BtnDesignFunction') : {}; @@ -488,13 +488,16 @@ export default (ChildComponent) => { } } } + if( sModelsId === '101801153119616631455287620' || sModelsType?.includes('commonOeeBillMaster')){ + addState.onlyMaster = true; + } this.props.onSaveState({ masterConfig, slaveConfig, slaveColumn, checkConfig, checkColumn, importConfig, importColumn, sId, pageLoading: false, ...addState, addStateMap, slaveInfoList, slaveChildInfoList, ...addOtherState }); } else if (commonUtils.isEmptyObject(masterConfigOld) && formData.length === 1 && (sModelsType === 'cashier/financialTransfer' || sModelsType === 'purchase/purchaseEnquiry' || sModelsType === 'cashier/financialAdjustment' || sModelsType === 'print/printLabel' || sModelsType === 'complaint/complaint' || sModelsType === 'commonBill/onlyMaster') && formRoute.indexOf('indexOee') === -1) { const config = {}; - const sId = currentId || nextProps.masterData?.sId || ''; + const sId = currentId !== undefined ? currentId : ''; /* 数据Id */ const masterConfig = formData.filter(item => !item.bGrd)[0]; let addState = {}; @@ -516,7 +519,7 @@ export default (ChildComponent) => { masterConfig, sId, pageLoading: false, ...addState, }); } else if (commonUtils.isEmptyObject(slaveConfigOld) && commonUtils.isEmptyObject(masterConfigOld) && formData.length === 2 && (sModelsType === 'quality/accident') && formRoute.indexOf('indexOee') === -1) { - const sId = currentId || nextProps.masterData?.sId || ''; + const sId = currentId !== undefined ? currentId : ''; /* 数据Id */ const masterConfig = formData.filter(item => !item.bGrd)[0]; const slaveConfig = formData.filter(item => item.bGrd && item.sTbName === 'mftqualityaccidentSlave')[0]; @@ -551,7 +554,7 @@ export default (ChildComponent) => { // employeeConfig, employeeColumn, masterConfig, ...addState, // }); if (formRoute === '/indexOee/labelPrint' && commonUtils.isEmpty(slaveConfigOld)) { /* 入库标签打印 */ - const sId = currentId || nextProps.masterData?.sId || ''; + const sId = currentId !== undefined ? currentId : ''; /* 数据Id */ const masterConfig = formData[0]; const slaveConfig = formData[0]; @@ -726,6 +729,13 @@ export default (ChildComponent) => { } } }; + + getMenuStatus = (menu) => { + if (menu.sControlName === 'BtnCalculation' || menu.sControlName === 'BtnCombine' || menu.sControlName === 'BtnChooseProcess' || + menu.sControlName === 'BtnChooseMaterials' || menu.sControlName === 'BtnBsOperation.BtnDraft') { + return !this.props.enabled; + } + }; handlePackDataAdd= (item, index, sControlId) => { const tableDataRow = {}; tableDataRow.sId = commonUtils.createSid(); @@ -764,8 +774,8 @@ export default (ChildComponent) => { /** 获取主表、从表、审核表数据 */ handleGetData = async (masterConfig, slaveConfig, checkConfig, bEditClick) => { - const { currentId, masterData = {} } = this.props; /* 当前页签数据 */ - const sId = currentId || masterData.sId || ''; + const { currentId } = this.props; /* 当前页签数据 */ + const sId = currentId !== undefined ? currentId : ''; this.props.handleGetDataOne({ name: 'master', configData: masterConfig, condition: { sId, pageSize: '', pageNum: '' }, bEditClick, slaveConfig }); // commonUtils.setStoreDropDownData(sModelsId, 'slave', 'sProductId', []); // commonUtils.setStoreDropDownData(sModelsId, 'slave', 'sProductNo', []); @@ -801,7 +811,7 @@ export default (ChildComponent) => { /* 获取表数据 */ handleGetMemoData = async (controlConfig, materialsConfig, processConfig, colorConfig, packConfig) => { const { currentId, sModelsType } = this.props; /* 当前页签数据 */ - const sId = currentId || this.props.masterData?.sId || ''; /* 数据Id */ + const sId = currentId !== undefined ? currentId : ''; /* 数据Id */ const addStateControl = await this.props.handleGetDataSet({ name: 'control', configData: controlConfig, condition: { sSqlCondition: { sParentId: sId } }, isWait: true, }); @@ -860,7 +870,7 @@ export default (ChildComponent) => { /* 获取单张表数据 */ handleGetOneMemoData = (memoName, memoConfig) => { const { currentId } = this.props; /* 当前页签数据 */ - const sId = currentId || this.props.masterData?.sId || ''; /* 数据Id */ + const sId = currentId !== undefined ? currentId : ''; /* 数据Id */ if (commonUtils.isNotEmptyObject(sId)) { /* 解决detail数据没有问题 */ this.props.handleGetDataSet({ name: memoName, configData: memoConfig, condition: { sSqlCondition: { sParentId: sId } }, @@ -2116,7 +2126,6 @@ export default (ChildComponent) => { const { sModelsId, masterData, app, masterConfig, slaveConfig, checkConfig, token, sModelsType, controlConfig, materialsConfig, processConfig, colorConfig, packConfig, slaveData, orderDetailConfig, } = this.props; - const FriendlyReminder = commonFunc.showLocalMessage(this.props, 'FriendlyReminder', '温馨提示'); const sSlaveIdArray = []; if (commonUtils.isNotEmptyArr(slaveData)) { slaveData.forEach((item) => { @@ -2161,7 +2170,7 @@ export default (ChildComponent) => { /* 接收返回值 */ const check = commonFunc.showMessage(app.commonConst, 'BtnExamine');/* 审核 */ const BtnCancelExamine = commonFunc.showMessage(app.commonConst, 'BtnCancelExamine');/* 销审 */ - if (returnData.code === 1) { /* 成功 */ + if (returnData.code === 1 || returnData.code === 2) { /* 成功 */ this.props.onSaveState({ loading: false, }); @@ -2176,7 +2185,7 @@ export default (ChildComponent) => { if (commonUtils.isNotEmptyObject(returnData.dataset)) { outData = returnData.dataset.rows[0].dataSet.outData; } - if (commonUtils.isNotEmptyStr(outData[0].sReturn)) { + if (false && commonUtils.isNotEmptyStr(outData[0].sReturn)) { const sReturnArray = outData[0].sReturn.split('|'); if (outData[0].sReturn.split('-').length < 2) { // 正常业务提示,非审核模板 @@ -2216,7 +2225,20 @@ export default (ChildComponent) => { } } } else { - message.success(check + returnData.msg); + if ( returnData.code === 2) { + Modal.info({ + title: '温馨提示:', + content: ( +
+ {returnData.msg} +
+ ), + okText: '确认', + onOk() {}, + }); + } else { + message.success(check + returnData.msg); + } } } else { /* 消审 */ @@ -2241,12 +2263,13 @@ export default (ChildComponent) => { } } else if(returnData.code === -8){ Modal.info({ - title: FriendlyReminder, + title: '温馨提示:', content: (
{this.handleGetMsg(returnData.msg)}
), + okText: '确认', onOk() {}, }); this.props.onSaveState({ @@ -2290,6 +2313,8 @@ export default (ChildComponent) => { }, onCancel() { }, + okText: '保存', + cancelText: '不保存', }); this.props.onSaveState({ loading: false, @@ -2345,7 +2370,7 @@ export default (ChildComponent) => { } } this.props.onSaveState({ - loading: false, slaveDelData: [], controlDelData: [], materialsDelData: [], processDelData: [], manyqtysDelData: [], colorDelData: [], packDelData: [] + loading: false, }); return true; } else { @@ -2381,8 +2406,8 @@ export default (ChildComponent) => { let bCheck = false; let iIndex = masterConfig.gdsconfigformslave.findIndex(item => item.sControlName === 'BtnCheck' || item.sControlName === 'BtnExamine' || item.sControlName === 'BtnSubmit'); /* 配置了表格允许为空 则不进行校验 */ - if (slaveConfig && slaveConfig.bNotCanEmpty ) { - message.error(`${slaveConfig.showName || ''}${commonFunc.showMessage(app.commonConst, 'slaveNotNull')}`); // 从表不能为空! + if (slaveConfig && slaveConfig.bNotCanEmpty && commonUtils.isEmptyArr(slaveData) ) { + message.error(`${slaveConfig.sChinese || ''}${commonFunc.showMessage(app.commonConst, 'slaveNotNull')}`); // 从表不能为空! this.props.onSaveState({ loading: false, }); @@ -2393,7 +2418,7 @@ export default (ChildComponent) => { bCheck = true; } if(bCheck) { - message.error(`${slaveConfig.showName || ''}${commonFunc.showMessage(app.commonConst, 'slaveNotNull')}`); // 从表不能为空! + message.error(`${slaveConfig.sChinese || ''}${commonFunc.showMessage(app.commonConst, 'slaveNotNull')}`); // 从表不能为空! this.props.onSaveState({ loading: false, }); @@ -2827,8 +2852,7 @@ export default (ChildComponent) => { /* 上一条、下一条、首条、末条 */ handleSearchData = async (handleType) => { const { - sModelsId, app, currentIndexFlag, currentPageNo, masterData, masterConfig, slaveConfig, checkConfig, - sSrcModelsId, + sModelsId, app, currentIndexFlag, currentPageNo, masterData, masterConfig, slaveConfig, checkConfig } = this.props; let { sBillIdsArray = []} = this.props; let { currentId } = this.props; @@ -2837,18 +2861,20 @@ export default (ChildComponent) => { this.handleSearchData1(handleType); return; } - const tipLast = commonFunc.showLocalMessage(this.props, 'tipLast', '当前已经是最后一条'); - const tipFirst = commonFunc.showLocalMessage(this.props, 'tipFirst', '当前已经是第一条'); const { currentPane, token } = app; const { pages, sFilterOrderBy, bFilter, sListFormmasterId, currentIndex, } = currentPane; - console.log('22page2222s2', pages); let currentPosition = currentIndexFlag ? currentPageNo : commonUtils.isEmptyObject(pages) ? 1 : (((pages.current - 1) * commonConfig.pageSize) + Number.parseInt(currentIndex, 10)) + 1; if (currentIndex === undefined) { currentPosition = 1; } + // if (handleType === 'first') { + // currentPosition = 1; + // } else if (handleType === 'end') { + // currentPosition = pages.total; + // } if (!commonUtils.isNum(currentPosition)) { // 如果是列表直接点增加,就跳到第一条去 currentPosition = 1; } @@ -2860,12 +2886,12 @@ export default (ChildComponent) => { if ("next".includes(handleType)) { currentPosition = index + 1; if(currentPosition > sBillIdsArray.length - 1 ){ - message.warn(tipLast); + message.warn('当前已经是最后一条'); return ; } } else if ("up".includes(handleType)) { if(index === 0){ - message.warn(tipFirst); + message.warn('当前已经是第一条!'); return ; } currentPosition = index - 1; @@ -2883,19 +2909,9 @@ export default (ChildComponent) => { } /* 如果是第一次请求 */ if(!bExist) { - const bFromList = commonUtils.isEmptyObject(pages) ? true: false; - if(bFromList) { - if(handleType ==='next' || handleType ==='end') { - message.warn(tipLast); - return ; - }else { - message.warn(tipFirst); - return ; - } - } const value = { - sClientType: '1', sFilterOrderBy, bFilter, sListFormmasterId, currentPosition, handleType, iCountSum: pages?.total, - sUpId: masterData?.sId, sParentModelId :sSrcModelsId, + sClientType: '1', sFilterOrderBy, bFilter, sListFormmasterId, currentPosition, handleType, iCountSum: pages.total, + sUpId: masterData?.sId, }; const url = `${commonConfig.server_host}business/getBusinessDataByIndex?sModelsId=${sModelsId}`; /* 接收返回值 */ @@ -3904,7 +3920,7 @@ export default (ChildComponent) => { handleTableChange = async (name, sFieldName, changeValue, sId, dropDownData, isWait) => { /* 从CommonBase获取默认参数 */ const { - [`${name}Data`]: tableData, sModelsType, sModelsId, token, app, slaveConfig, + [`${name}Data`]: tableData, sModelsType, sModelsId, token, app, slaveConfig, [`${name}Config`]: tableConfig, } = this.props; let { [`${name}InfoData`]: tableInfoData } = this.props; if (name === 'control' && sModelsType.includes('sales/salesOrder')) { @@ -4117,7 +4133,8 @@ export default (ChildComponent) => { ...controlReturnData, }); } - } else if ((sModelsType.includes('cashier/') || sModelsType.includes('sales/salesInvoice') || sModelsType.includes('purchase/purchaseInvoice') || sModelsType.includes('purchase/outsideInvoice')) && (sFieldName === 'dTotalMoney' || sFieldName === 'dRoundingMoney')) { /* 付款单、收款单,从表付款/收款金额改变,会自动汇总到主表付款金额中 */ + } else if ((sModelsType.includes('cashier/') || sModelsType.includes('sales/salesInvoice') || sModelsType.includes('purchase/purchaseInvoice') || sModelsType.includes('purchase/outsideInvoice')) && (sFieldName === 'dTotalMoney' || sFieldName === 'dTotalForeignMoney' + || sFieldName === 'dRoundingMoney' || sFieldName === 'dRoundForeignMoney')) { /* 付款单、收款单,从表付款/收款金额改变,会自动汇总到主表付款金额中 */ const addStata = {}; let { handleType } = masterData; handleType = commonUtils.isEmpty(handleType) ? 'update' : handleType; @@ -4163,6 +4180,28 @@ export default (ChildComponent) => { addStata.dRoundingMoney = commonUtils.convertFixNum(dMoney, 6) + commonUtils.convertFixNum(addStata.dRoundingMoney, 6); } }); + + /* 主表的外币舍入 */ + addStata.dRoundingForeignMoney = commonUtils.convertFixNum(dCurrencyRate !== 0 ? addStata.dRoundingMoney / dCurrencyRate : 0, dNetMoney); + /* 从表的外币舍入 */ + tableDataRow.dRoundForeignMoney = commonUtils.convertFixNum(dCurrencyRate !== 0 ? tableDataRow.dRoundingMoney / dCurrencyRate : 0, dNetMoney); + } else if (sFieldName === 'dRoundForeignMoney') { /* 从表输入外币舍入 */ + addStata.dRoundingForeignMoney = 0; + if (iIndex > -1) { /* 选中行 */ + let dMoney = commonUtils.isNotEmptyNumber(tableDataRow.dRoundForeignMoney) ? tableDataRow.dRoundForeignMoney : 0; + dMoney = commonUtils.convertStrToNumber(dMoney); + addStata.dRoundingForeignMoney = dMoney + commonUtils.convertStrToNumber(addStata.dRoundingForeignMoney); + } + tableData.forEach((item, index) => { /* 非选中行 */ + if (index !== iIndex) { + const dMoney = commonUtils.isNotEmptyNumber(item.dRoundForeignMoney) ? item.dRoundForeignMoney : 0; + addStata.dRoundingForeignMoney = commonUtils.convertFixNum(dMoney, 6) + commonUtils.convertFixNum(addStata.dRoundingForeignMoney, 6); + } + }); + /* 主表的本位币舍入 */ + addStata.dRoundingMoney = commonUtils.convertFixNum(dCurrencyRate !== 0 ? addStata.dRoundingForeignMoney * dCurrencyRate : 0, dNetMoney); + /* 从表的本位币舍入 */ + tableDataRow.dRoundingMoney = commonUtils.convertFixNum(dCurrencyRate !== 0 ? tableDataRow.dRoundForeignMoney * dCurrencyRate : 0, dNetMoney); } masterData = { ...masterData, ...addStata }; this.props.onSaveState({ masterData }); @@ -4591,20 +4630,26 @@ export default (ChildComponent) => { } /* 各种金额,税额,价格计算 */ let models = name === 'materials' ? 'Materials' : - sModelsType.includes('sales/') || sModelsType.includes('manufacture/') || sModelsType.includes('quotation/') || sModelsType.includes('cashier/') || sModelsType.includes('productStock/') ? 'Product' : 'Materials'; - - if(sModelsType.includes('cashier/receipt') ) { /* 收款单 */ - models = 'Product'; - } else if(sModelsType.includes('cashier/payment') ) { /* 付款单 */ - models = 'Materials'; - } - + sModelsType.includes('sales/') || sModelsType.includes('manufacture/') || sModelsType.includes('quotation/') || sModelsType.includes('productStock/') ? 'Product' : 'Materials'; if (sModelsType.includes('purchase/') || sModelsType.includes('quotation/') || sModelsType.includes('manufacture/') || sModelsType.includes('materialsStock/') || sModelsType.includes('outside/') || sModelsType.includes('semigoodsStock/') || sModelsType.includes('sales/materials') || sModelsType === 'sales/salesCheck') { if (sModelsType.includes('sales/materials') || sModelsType === 'sales/salesCheck') { tableDataRow.dAuxiliaryQty = tableDataRow.dProductQty; } - tableDataRow = await this.handleMaterialsChange(tableDataRow, sModelsId, masterData, changeValue, sFieldName, app, token, models); + /* 找到sFieldName对应的配置,判断是否是离开调用逻辑,若是离开调用, 则走离开调用逻辑,否则走原来的 */ + let bMoveSql = false; + if(commonUtils.isNotEmptyObject(tableConfig)){ + const iConfigIndex = tableConfig.gdsconfigformslave.findIndex(item => item.sName === sFieldName); + if (iConfigIndex > -1) { + const sDropDownType = tableConfig.gdsconfigformslave[iConfigIndex].sDropDownType; + if(sDropDownType === 'movesql') { + bMoveSql = true; + } + } + } + if(!bMoveSql) { + tableDataRow = await this.handleMaterialsChange(tableDataRow, sModelsId, masterData, changeValue, sFieldName, app, token, models); + } if (sModelsType.includes('sales/materials') || sModelsType === 'sales/salesCheck') { /* 如果是材料销售模块/销售对账 如果是材料 则用换算数量*单价 算金额 */ /* 材料逻辑计算 */ @@ -4624,6 +4669,7 @@ export default (ChildComponent) => { tableDataRow[`dN${modelsNew}Price`] = tableDataRow[`d${models}ForeignPrice`]; tableDataRow[`d${modelsNew}ForeignPrice`] = tableDataRow[`d${models}ForeignPrice`]; + tableDataRow[`d${modelsNew}NoTaxPrice`] = tableDataRow[`d${models}NoTaxPrice`]; tableDataRow[`d${modelsNew}Price`] = tableDataRow[`d${models}Price`]; tableDataRow[`dN${modelsNew}Money`] = tableDataRow[`dN${models}Price`]; tableDataRow[`dN${modelsNew}Money`] = tableDataRow[`d${models}ForeignMoney`]; @@ -4824,7 +4870,7 @@ export default (ChildComponent) => { } const { sModelsId, sModelsType, masterData: masterDataOld, app, masterConfig, slaveConfig, token, - controlData, materialsData, processData, slaveData, slaveSelectedRowKeys,controlSelectedRowKeys, + controlData, materialsData, processData, slaveData = [], slaveSelectedRowKeys,controlSelectedRowKeys, processSelectedRowKeys,materialsSelectedRowKeys,slaveInfoSelectedRowKeys, slaveInfoData, enabled, } = this.props; const addState = {}; @@ -5029,18 +5075,7 @@ export default (ChildComponent) => { tableDataRow = commonBusiness.getCalculateAllMoney(app, models, 'sTaxId', returnData.masterData, tableDataRow); } } else if (sFieldName === 'sCurrency' || sFieldName === 'dCurrencyRate' || sFieldName ==='sCurrencyName') { - let controlField =`d${models}ForeignPrice`; - if(sModelsType?.includes('cashier/')) { - tableDataRow.bSettleMoney = true; - tableDataRow[`d${models}ForeignPrice`] = tableDataRow.dTotalForeignPrice; - tableDataRow[`d${models}Money`] = tableDataRow.dTotalMoney; - - } - if( sModelsType === 'sales/adjust') { /* 财务调整单 */ - // tableDataRow.dProductMoney = tableDataRow.dTotalMoney; - controlField = 'dProductForeignMoney'; - } - tableDataRow = commonBusiness.getCalculateAllMoney(app, models, controlField, returnData.masterData, tableDataRow); + tableDataRow = commonBusiness.getCalculateAllMoney(app, models, `dN${models}Money`, returnData.masterData, tableDataRow); tableDataRow.handleType = commonUtils.isEmpty(tableDataRow.handleType) ? 'update' : tableDataRow.handleType; } if ((sFieldName === 'sWareHouseId' || sFieldName === 'sWareHouseNo' || sFieldName === 'sWareHouseName' || @@ -5137,7 +5172,6 @@ export default (ChildComponent) => { slaveDataNew.push(tableDataRow); }); addState.slaveData = slaveDataNew; - addState.slaveDelData = slaveDelData; } else { this.props.getServiceError(dataReturn); } @@ -5779,17 +5813,8 @@ export default (ChildComponent) => { }); } - let dTotalMoney = masterData.dTotalMoney !== undefined ? masterData.dTotalMoney : 0; - - if (dTotalMoney === 0) { - if (sModelsType === "cashier/payment") { - /* 付款单1 */ - dTotalMoney = masterData.dMaterialsMoney; - } else { - dTotalMoney = masterData.dProductMoney; - } - } - const models = sModelsType.includes("cashier/receipt") ? "Product" : "Materials"; + const dTotalMoney = masterData.dTotalMoney !== undefined ? masterData.dTotalMoney : 0; + const dRoundingMoney = masterData.dRoundingMoney !== undefined ? masterData.dRoundingMoney : 0; let minusSum = 0; /* 负数求和 */ let minusRoundingSum = 0; /* 负数舍入求和 */ const minusData = []; /* 负数集 */ @@ -5799,8 +5824,6 @@ export default (ChildComponent) => { if (commonUtils.isNotEmptyArr(slaveData) && slaveData.length > 0) { slaveData.forEach((child) => { child.dTotalMoney = 0; - child.dProductMoney = 0; - child.dMaterialsMoney = 0; child.handleType = commonUtils.isEmpty(child.handleType) ? 'update' : child.handleType; child.dRoundingMoney = commonUtils.isNum(child.dRoundingMoney) ? child.dRoundingMoney : 0; child.dBalanceMoney = commonUtils.convertFixNum(child.dBalanceMoney, dNetMoney); /* 根据系统设定位数格式未付款金额*/ @@ -5817,6 +5840,11 @@ export default (ChildComponent) => { } }); } + + // 计算外币金额和舍入外币金额 + const dCurrencyRate = commonUtils.convertIsNotNumToNumber1(masterData.dCurrencyRate); /* 汇率 */ + const dRoundingForeignMoney = commonUtils.convertFixNum(dCurrencyRate !== 0 ? dRoundingMoney / dCurrencyRate : 0, dNetMoney); /* 外币舍入金额 */ + if (commonUtils.convertFixNum(((minusSum - minusRoundingSum) + (positiveSum - positiveRoundingSum)) - dTotalMoney, dNetMoney) <= 0) { /* 够扣 */ positiveSum -= minusRoundingSum; @@ -5872,33 +5900,17 @@ export default (ChildComponent) => { minusData[i].dRoundingMoney = 0; minusData[i].handleType = commonUtils.isEmpty(minusData[i].handleType) ? 'update' : minusData[i].handleType; } - masterData.dAdvanceMoney = commonUtils.convertFixNum(Math.abs(positiveSum), dNetMoney); - masterData.bAdvance = true; + const advanceMoney = commonUtils.convertFixNum(Math.abs(positiveSum) - dRoundingMoney, dNetMoney); + masterData.dAdvanceMoney = advanceMoney > 0 ? advanceMoney : 0; + if(masterData.dAdvanceMoney > 0) { + masterData.bAdvance = true; + } } - const dCurrencyRate = commonUtils.convertIsNotNumToNumber1(masterData.dCurrencyRate); /* 汇率 */ /* 分摊算外币金额 */ if (commonUtils.isNotEmptyArr(slaveData) && slaveData.length > 0) { slaveData.forEach((item, index) => { slaveData[index].dTotalForeignMoney = commonUtils.convertFixNum(dCurrencyRate !== 0 ? item.dTotalMoney / dCurrencyRate : 0, dNetMoney); - slaveData[index].dProductForeignMoney = slaveData[index].dTotalForeignMoney; - slaveData[index].dMaterialsForeignMoney = slaveData[index].dTotalForeignMoney; - slaveData[index].dMaterialsMoney = slaveData[index].dTotalMoney; - slaveData[index].dProductMoney = slaveData[index].dTotalMoney; - console.log("111", slaveData[index]); - console.log("222", models); - if (models === "Materials" && commonUtils.isNotEmptyNumber(slaveData[index].dMaterialsQty)) { - const dQty = slaveData[index].dMaterialsQty; - const dMoney = slaveData[index].dMaterialsMoney; - slaveData[index].dMaterialsPrice = commonUtils.convertFixNum(dMoney / dQty, 6); - slaveData[index].dMaterialsForeignPrice = commonUtils.convertFixNum(slaveData[index].dMaterialsForeignMoney / dQty, 6); - } else if (commonUtils.isNotEmptyNumber(slaveData[index].dProductQty)) { - const dQty = slaveData[index].dProductQty; - const dMoney = slaveData[index].dProductMoney; - slaveData[index].dProductPrice = commonUtils.convertFixNum(dMoney / dQty, 6); - slaveData[index].dProductForeignPrice = commonUtils.convertFixNum(slaveData[index].dProductForeignMoney / dQty, 6); - } - - console.log("eeeee", slaveData[index]); + slaveData[index].dRoundForeignMoney = commonUtils.convertFixNum(dCurrencyRate !== 0 ? item.dRoundingMoney / dCurrencyRate : 0, dNetMoney); }); } masterData.handleType = commonUtils.isEmpty(masterData.handleType) ? 'update' : masterData.handleType; @@ -5936,28 +5948,11 @@ export default (ChildComponent) => { positiveData[i].handleType = commonUtils.isEmpty(positiveData[i].handleType) ? 'update' : positiveData[i].handleType; } } - const dCurrencyRate = commonUtils.convertIsNotNumToNumber1(masterData.dCurrencyRate); /* 汇率 */ /* 分摊算外币金额 */ if (commonUtils.isNotEmptyArr(slaveData) && slaveData.length > 0) { slaveData.forEach((item, index) => { slaveData[index].dTotalForeignMoney = commonUtils.convertFixNum(dCurrencyRate !== 0 ? item.dTotalMoney / dCurrencyRate : 0, dNetMoney); - slaveData[index].dProductForeignMoney = slaveData[index].dTotalForeignMoney; - slaveData[index].dMaterialsForeignMoney = slaveData[index].dTotalForeignMoney; - slaveData[index].dMaterialsMoney = slaveData[index].dTotalMoney; - slaveData[index].dProductMoney = slaveData[index].dTotalMoney; - console.log("333", slaveData[index].dMaterialsQty); - console.log("441", models); - if (models === "Materials" && commonUtils.isNotEmptyNumber(slaveData[index].dMaterialsQty)) { - const dQty = slaveData[index].dMaterialsQty; - const dMoney = slaveData[index].dMaterialsMoney; - slaveData[index].dMaterialsPrice = commonUtils.convertFixNum(dMoney / dQty, 6); - slaveData[index].dMaterialsForeignPrice = commonUtils.convertFixNum(slaveData[index].dMaterialsForeignMoney / dQty, 6); - } else if (commonUtils.isNotEmptyNumber(slaveData[index].dProductQty)) { - const dQty = slaveData[index].dProductQty; - const dMoney = slaveData[index].dProductMoney; - slaveData[index].dProductPrice = commonUtils.convertFixNum(dMoney / dQty, 6); - slaveData[index].dProductForeignPrice = commonUtils.convertFixNum(slaveData[index].dProductForeignMoney / dQty, 6); - } + slaveData[index].dRoundForeignMoney = commonUtils.convertFixNum(dCurrencyRate !== 0 ? item.dRoundingMoney / dCurrencyRate : 0, dNetMoney); }); } masterData.dAdvanceMoney = 0; @@ -5968,17 +5963,6 @@ export default (ChildComponent) => { } this.props.onSaveState({ masterData, slaveData }); } - // let allTotalMoney = 0; - // let allRoundingMoney = 0; - // slaveData.forEach((child) => { - // if (child.dTotalMoney !== undefined) { - // allTotalMoney += child.dTotalMoney * 1; - // } - // if (child.dRoundingMoney !== undefined) { - // allRoundingMoney += child.dRoundingMoney * 1; - // } - // }); - // this.props.onSaveState({ allTotalMoney, allRoundingMoney }); return masterData; }; @@ -6145,9 +6129,6 @@ export default (ChildComponent) => { /** 按钮操作事件 */ handleButtonClick = async (name) => { - - const FriendlyReminder = commonFunc.showLocalMessage(this.props, 'FriendlyReminder', '温馨提示'); - if (name === 'BtnOut') { this.handleOut(); } else if (name === 'BtnDesignFunction') { @@ -6406,12 +6387,13 @@ export default (ChildComponent) => { this.props.onSaveState({ ...allReturnMap, pageLoading:false, }); }else if (dataReturn.code === -8 || dataReturn.code === 2) { Modal.info({ - title: FriendlyReminder, + title: '温馨提示:', content: (
{this.handleGetMsg(dataReturn.msg)}
), + okText: '确认', onOk() {}, }); this.props.onSaveState({ ...allReturnMap, pageLoading:false, }); @@ -6600,7 +6582,7 @@ export default (ChildComponent) => { const { token } = this.props; const { processSelectedRowKeys } = this.props; /* 如果是材料 则校验必须选择工序 */ - if(name === 'materials') { + if(location.pathname?.includes('TableTreeNew') &&name === 'materials') { if (commonUtils.isEmptyArr(processSelectedRowKeys)) { message.warning('请选择对应工序'); return; @@ -6905,7 +6887,6 @@ export default (ChildComponent) => { }); } else if (name === 'process' && sName === 'sQuoParams') { // 产品工艺卡报价参数 const { processConfig, enabled, sModelsType } = this.props; - const NoQuoParameters = commonFunc.showLocalMessage(this.props, 'NoQuoParameters', '无报价参数!'); const slaveSelectOneData = record; let modalVisible = false; const sProcessParamsSelects = []; @@ -6915,7 +6896,7 @@ export default (ChildComponent) => { paramType = slaveSelectOneData.sProcessParam; } if(commonUtils.isEmpty(paramType)) { - message.warn(NoQuoParameters); + message.warn('无报价参数!'); return; } /* 工序参数以表格形式展示 列 */ @@ -6959,7 +6940,7 @@ export default (ChildComponent) => { /* 要把数据以表格的形式显示出来 */ const sParamJsonObj = JSON.parse(paramType); for (const key of Object.keys(sParamJsonObj)) { - if (key.includes('sParam') && !key.includes('DropDown') && !key.includes('Default') && !key.includes('FieldName')) { + if (key.includes('sParam') && !key.includes('DropDown') && !key.includes('Default')) { const obj = {}; obj.sId = commonUtils.createSid(); obj.sParamKey = key; @@ -7025,8 +7006,7 @@ export default (ChildComponent) => { paramType = slaveSelectOneData.sWorkOrderParam; } if(commonUtils.isEmpty(paramType)) { - const NoProcessParameters = commonFunc.showLocalMessage(this.props, 'NoProcessParameters', '无工艺参数!'); - message.warn(NoProcessParameters); + message.warn('无工艺参数!'); return; } /* 工序参数以表格形式展示 列 */ @@ -7390,7 +7370,6 @@ export default (ChildComponent) => { handleViewChoose= (name, sName, record) => { const { sId } = record; /* 控制表主键 */ const { enabled, processSelectedRowKeys } = this.props; - const NoProcessParameters = commonFunc.showLocalMessage(this.props, 'NoProcessParameters', '无工艺参数!'); const sisColorSelectedRowKeys = []; let jsonData = []; if (name === 'process' && sName === 'sColorSerialMemo') { @@ -7456,7 +7435,7 @@ export default (ChildComponent) => { paramType = slaveSelectOneData.sReportParam; /* 上报参数 */ } if (commonUtils.isEmpty(paramType)) { - message.warn(NoProcessParameters); + message.warn('无工艺参数!'); return; } /* 工序参数以表格形式展示 列 */ @@ -9144,7 +9123,7 @@ export default (ChildComponent) => { /* 找到放大镜复制到配置 */ /* 材料大类 */ - const copyToConfig = processConfig.gdsconfigformslave.filter(item => item.sControlName.toLowerCase() === `${selectConfig.sControlName}.materials0`.toLowerCase()); + const copyToConfig = processConfig.gdsconfigformslave.filter(item => item.sControlName.toLowerCase() === `${selectConfig.sControlName}`.toLowerCase()); const copyToAssignField = commonUtils.isNotEmptyArr(copyToConfig) ? copyToConfig[0].sAssignField : ''; /* 材料大类 */ const addState ={}; @@ -9159,7 +9138,7 @@ export default (ChildComponent) => { if (iIndex > -1) { newCopyTo.materials0 = item; } - let tableDataRowAdd = this.handleTableAdd('materials0', true); + let tableDataRowAdd = this.handleTableAdd('materials', true); item.handleType = 'add'; // tableDataRowAdd = { ...tableDataRowAdd, ...item }; // 取赋值字段 tableDataRowAdd = { ...tableDataRowAdd, ...commonFunc.getAssignFieldValue(copyToAssignField, item) }; // 取赋值字段 @@ -9270,6 +9249,57 @@ export default (ChildComponent) => { console.log('放大镜确认数据:',tbName, tableData, materials0Data) this.props.onSaveState({ materials0Data }); } + } else if(location.pathname && location.pathname.includes('quotationPackTableTree') && selectConfig.sControlName && selectConfig.sControlName.includes('BtnPopupMaterials')) { /* 报价单工序表放大镜 选择材料 */ + + let { materialsData = [], processData, processSelectedRowKeys } = this.props; + + const copyToConfig = processConfig.gdsconfigformslave.filter(item => item.sControlName.toLowerCase() === `${selectConfig.sControlName}`.toLowerCase()); + const copyToAssignField = commonUtils.isNotEmptyArr(copyToConfig) ? copyToConfig[0].sAssignField : ''; /* 材料大类 */ + + /* 找到放大镜复制到配置 */ + const iIndex = commonUtils.isNotEmptyArr(tableSelectedRowKeys) ? tableData.findIndex(item => item.sId === tableSelectedRowKeys[0]) : -1; + if (commonUtils.isNotEmptyArr(selectData)) { + let processRow = {}; + if(commonUtils.isNotEmptyArr(processData) && commonUtils.isNotEmptyArr(processSelectedRowKeys)) { + const iPIndex = processData.findIndex(item => processSelectedRowKeys.includes(item.sId)); + if(iPIndex > -1) { + processRow = processData[iPIndex]; + } + } + const selectFilterDataAll = selectData; /* 除了油墨,专色墨,电化铝之外的物料大类 */ + /* 全部材料 */ + if(commonUtils.isNotEmptyArr(selectFilterDataAll)) { + selectFilterDataAll.forEach((item, index) => { + const newCopyTo = {}; + newCopyTo.master = masterData; + if (iIndex > -1) { + newCopyTo.materials = item; + } + let tableDataRowAdd = this.handleTableAdd('materials', true); + item.handleType = 'add'; + tableDataRowAdd = { ...tableDataRowAdd, ...commonFunc.getAssignFieldValue(copyToAssignField, item) }; // 取赋值字段 + tableDataRowAdd.sId = commonUtils.createSid(); + tableDataRowAdd.sParentId = masterData.sId; + tableDataRowAdd.sParentSlaveId = tableData[iIndex].sId; /* 选中从表的sId */ + if(commonUtils.isNotEmptyObject(processRow)) { + if(commonUtils.isEmptyObject(tableDataRowAdd.sProcessId) ) { + tableDataRowAdd.sProcessId = processRow.sProcessId; /* 选中从表的sId */ + } + if(commonUtils.isEmptyObject(tableDataRowAdd.sProcessTbId) ) { + tableDataRowAdd.sProcessTbId = processRow.sId; /* 选中从表的sId */ + } + if(commonUtils.isEmptyObject(tableDataRowAdd.sControlId) ) { + tableDataRowAdd.sControlId = processRow.sControlId; /* 选中从表的sId */ + } + } + materialsData.push(tableDataRowAdd); + }); + } + + console.log('materialsData:', materialsData); + + this.props.onSaveState({ materialsData }); + } } else if(selectConfig.sControlName && selectConfig.sControlName.includes('BtnPopupMaterials')) { /* 报价单工序表放大镜 选择材料 */ /* materials1ChildData:油墨, materials2ChildData:电化铝 */ let { materials1Data, materials1ChildData, materials2Data, materials2ChildData, materials0Data, processData, processSelectedRowKeys } = this.props; @@ -9320,115 +9350,7 @@ export default (ChildComponent) => { if (commonUtils.isEmpty(materials2ChildData)) { materials2ChildData = []; } - // const selectFilterData1 = selectData.filter(item => item.sZmldlName === sMaterialsClassfiy.youmo); - // const selectFilterData1Left = selectData.filter(item => item.sZmldlName === sMaterialsClassfiy.zsm); - // // const selectFilterData1 = selectData.filter(item => item.sZmldlName === '纸张'); - // const selectFilterData2 = selectData.filter(item => item.sZmldlName === sMaterialsClassfiy.dhl ); - // - // const selectFilterDataOther = selectData.filter(item => item.sZmldlName !== sMaterialsClassfiy.youmo && - // item.sZmldlName !== sMaterialsClassfiy.zsm && item.sZmldlName !== sMaterialsClassfiy.dhl ); /* 除了油墨,专色墨,电化铝之外的物料大类 */ - // - // /* 自动专色墨 */ - // if(commonUtils.isNotEmptyArr(selectFilterData1Left)) { - // selectFilterData1Left.forEach((item, index) => { - // const newCopyTo = {}; - // newCopyTo.master = masterData; - // if (iIndex > -1) { - // newCopyTo.materials1Child = item; - // } - // let tableDataRowAdd = this.handleTableAdd('materials1', true); - // item.handleType = 'add'; - // // tableDataRowAdd = { ...tableDataRowAdd, ...item }; // 取赋值字段 - // tableDataRowAdd = { ...tableDataRowAdd, ...commonFunc.getAssignFieldValue(copyToAssignField1Left, item) }; // 取赋值字段 - // tableDataRowAdd.sId = commonUtils.createSid(); - // tableDataRowAdd.sParentId = masterData.sId; - // tableDataRowAdd.sParentSlaveId = tableData[iIndex].sId; /* 选中从表的sId */ - // materials1Data.push(tableDataRowAdd); - // }); - // } - // - // /* 油墨 */ - // if(commonUtils.isNotEmptyArr(selectFilterData1)) { - // selectFilterData1.forEach((item, index) => { - // const newCopyTo = {}; - // newCopyTo.master = masterData; - // if (iIndex > -1) { - // newCopyTo.materials1Child = item; - // } - // let tableDataRowAdd = this.handleTableAdd('materials1Child', true); - // item.handleType = 'add'; - // // tableDataRowAdd = { ...tableDataRowAdd, ...item }; // 取赋值字段 - // tableDataRowAdd = {...tableDataRowAdd, ...commonFunc.getAssignFieldValue(copyToAssignField1, item)}; // 取赋值字段 - // tableDataRowAdd.sId = commonUtils.createSid(); - // tableDataRowAdd.sParentId = masterData.sId; - // tableDataRowAdd.sParentSlaveId = tableData[iIndex].sId; /* 选中从表的sId */ - // materials1ChildData.push(tableDataRowAdd); - // }); - // } - // - // /* 电化铝 */ - // if(commonUtils.isNotEmptyArr(selectFilterData2)) { - // selectFilterData2.forEach((item, index) => { - // const newCopyTo = {}; - // newCopyTo.master = masterData; - // if (iIndex > -1) { - // newCopyTo.materials2Child = item; - // } - // let tableDataRowAdd = this.handleTableAdd('materials2Child', true); - // item.handleType = 'add'; - // // tableDataRowAdd = { ...tableDataRowAdd, ...item }; // 取赋值字段 - // tableDataRowAdd = { ...tableDataRowAdd, ...commonFunc.getAssignFieldValue(copyToAssignField2, item) }; // 取赋值字段 - // tableDataRowAdd.sId = commonUtils.createSid(); - // tableDataRowAdd.sParentId = masterData.sId; - // tableDataRowAdd.sParentSlaveId = tableData[iIndex].sId; /* 选中从表的sId */ - // materials2ChildData.push(tableDataRowAdd); - // }); - // } - // - // if(commonUtils.isNotEmptyArr(materials2ChildData)) { - // materials2ChildData.forEach((val) => { - // const iIndex = materials2Data.findIndex(item => item.sMaterialsId === val.sMaterialsId && item.sControlId === val.sControlId && item.sMaterialsStyle === val.sMaterialsStyle); - // if(iIndex === -1){ - // materials2Data.push(val); - // } - // }); - // } - // - // /* 其他材料 */ - // if(commonUtils.isNotEmptyArr(selectFilterDataOther)) { - // selectFilterDataOther.forEach((item, index) => { - // const newCopyTo = {}; - // newCopyTo.master = masterData; - // if (iIndex > -1) { - // newCopyTo.materials0 = item; - // } - // let tableDataRowAdd = this.handleTableAdd('materials0', true); - // item.handleType = 'add'; - // // tableDataRowAdd = { ...tableDataRowAdd, ...item }; // 取赋值字段 - // tableDataRowAdd = { ...tableDataRowAdd, ...commonFunc.getAssignFieldValue(copyToAssignField, item) }; // 取赋值字段 - // tableDataRowAdd.sId = commonUtils.createSid(); - // tableDataRowAdd.sParentId = masterData.sId; - // tableDataRowAdd.sParentSlaveId = tableData[iIndex].sId; /* 选中从表的sId */ - // if(commonUtils.isNotEmptyObject(processRow)) { - // if(commonUtils.isEmptyObject(tableDataRowAdd.sProcessId) ) { - // tableDataRowAdd.sProcessId = processRow.sProcessId; /* 选中从表的sId */ - // } - // if(commonUtils.isEmptyObject(tableDataRowAdd.sProcessTbId) ) { - // tableDataRowAdd.sProcessTbId = processRow.sId; /* 选中从表的sId */ - // } - // if(commonUtils.isEmptyObject(tableDataRowAdd.sControlId) ) { - // tableDataRowAdd.sControlId = processRow.sControlId; /* 选中从表的sId */ - // } - // } - // - // materialsOtherData.push(tableDataRowAdd); - // }); - // } - // const temp1Data = materials1Data.concat(materials1ChildData); - // const temp2Data = temp1Data.concat(materials2Data); - // - // materials0Data = temp2Data.concat(materialsOtherData); let processRow = {}; if(commonUtils.isNotEmptyArr(processData) && commonUtils.isNotEmptyArr(processSelectedRowKeys)) { const iPIndex = processData.findIndex(item => processSelectedRowKeys.includes(item.sId)); @@ -9461,6 +9383,7 @@ export default (ChildComponent) => { if(commonUtils.isEmptyObject(tableDataRowAdd.sControlId) ) { tableDataRowAdd.sControlId = processRow.sControlId; /* 选中从表的sId */ } + tableDataRowAdd.sMaterialsProcessNameOrder = processRow.sProcessName; /* 选中从表的sId */ } materials0Data.push(tableDataRowAdd); }); @@ -10021,16 +9944,14 @@ export default (ChildComponent) => { }else if (type === 'before') { if(iIndex === 0 || iIndex > len -1) { - const currentFirst = commonFunc.showMessage(props.app.commonConst, 'currentFirst') || '当前是首条'; - message.error(currentFirst); + message.error('当前是首条'); return; } tableDataRow = filterData[iIndex - 1]; }else if (type === 'next') { if(iIndex === len-1 || iIndex > len -1) { - const currentLast = commonFunc.showMessage(props.app.commonConst, 'currentLast') || '当前是末条'; - message.error(currentLast); + message.error('当前是末条'); return; } tableDataRow = filterData[iIndex + 1]; @@ -10059,9 +9980,531 @@ export default (ChildComponent) => { (commonUtils.isNotEmptyStr(record.sControlId) && record.sControlId.toString().toLowerCase().includes(value.toLowerCase())); } }; + + handleProcessSolutionRow = () => { + console.log('22222', 1111); + this.props.onSaveState({ + processSolutionVisible:true + }) + } + handleCloseProcessSolutionModal = () => { + this.props.onSaveState({ + processSolutionVisible:false + }) + } + /* 选择工艺流程 点确定 */ + handleSelectProcessSolution = async (name, selectConfig, selectData) => { + const { + [`${name}Data`]: tableData = [], [`${name}Config`]: tableConfig, masterConfig, controlSelectedRowKeys, sModelsId, token, slaveSelectedRowKeys, processSelectedRowKeys, + slaveConfig, controlConfig, materialsConfig, processConfig, colorConfig, packConfig, slaveData, controlData, materialsData: materialsDataOld, processData: processDataOld, colorData: colorDataOld, + controlDelData: controlDelDataOld, materialsDelData: materialsDelDataOld, processDelData: processDelDataOld, colorDelData: colorDelDataOld,slaveDelData: slaveDelDataOld, + } = this.props; + const controlDataOld = controlData.slice(0); + console.log('选择', selectData, selectConfig); + let { masterData } = this.props; + if(true){ + const { controlData } = this.props; + const iControlIndex = commonUtils.isNotEmptyArr(controlSelectedRowKeys) ? controlData.findIndex(item => item.sId === controlSelectedRowKeys[0]) : -1; + const bProcessAssort = name === 'process'; + let returnProcessAssort = []; + let processAssignAssort = ''; + let dropDownDataProcessName; + if (bProcessAssort) { + // 配套数据 */ + if (commonUtils.isJSON(localStorage.getItem(`${commonConfig.prefix}processAssort`)) && JSON.parse(localStorage.getItem(`${commonConfig.prefix}processAssort`)).length > 0) { + returnProcessAssort = JSON.parse(localStorage.getItem(`${commonConfig.prefix}processAssort`)); + } + if (commonUtils.isJSON(localStorage.getItem(`${commonConfig.prefix}dropDownDataProcess`)) && JSON.parse(localStorage.getItem(`${commonConfig.prefix}dropDownDataProcess`)).length > 0) { + dropDownDataProcessName = JSON.parse(localStorage.getItem(`${commonConfig.prefix}dropDownDataProcess`)); + } + if (!this.isProcessAssortApiCalled && commonUtils.isEmptyArr(returnProcessAssort)) { + this.isProcessAssortApiCalled = true; // 标记接口已调用 + const dataUrl = `${commonConfig.server_host}salesorder/getProcessAssort?sModelsId=${sModelsId}`; + const dataProcessAssort = (await commonServices.postValueService(token, {}, dataUrl)).data; + if (dataProcessAssort.code === 1) { + returnProcessAssort = dataProcessAssort.dataset.rows[0].processassort; + const iIndex = processConfig.gdsconfigformslave.findIndex(item => item.sName === 'sProcessName'); + if (iIndex > -1 && commonUtils.isEmptyArr(dropDownDataProcessName)) { + const sqlDropDownData = await this.props.getSqlDropDownData(sModelsId, 'slave', processConfig.gdsconfigformslave[iIndex]); + dropDownDataProcessName = sqlDropDownData.dropDownData; + processAssignAssort = processConfig.gdsconfigformslave[iIndex].sAssignField; + localStorage.setItem(`${commonConfig.prefix}dropDownDataProcess`, JSON.stringify(dropDownDataProcessName)); + } + localStorage.setItem(`${commonConfig.prefix}processAssort`, JSON.stringify(returnProcessAssort)); + } + } + } + if (commonUtils.isNotEmptyArr(selectData)) { + for (const item of selectData) { + const newCopyTo = {}; + newCopyTo.master = masterData; + if (iControlIndex > -1) { + newCopyTo.control = controlData[iControlIndex]; + } + let tableDataRow = commonFunc.getDefaultData(tableConfig, newCopyTo); // 取默认值 + tableDataRow = { ...tableDataRow, ...commonFunc.getAssignFieldValue(selectConfig.sAssignField, item, newCopyTo) }; // 取赋值字段 + tableDataRow.handleType = 'add'; + tableDataRow.sId = commonUtils.createSid(); + tableDataRow.sParentId = masterData.sId; + tableDataRow.key = tableDataRow.sId; + tableDataRow.sSlaveId = commonUtils.isNotEmptyObject(slaveSelectedRowKeys) ? slaveSelectedRowKeys[0] :'' ; + if (name === 'process') { + /* 设置工单参数下拉 */ + if (commonUtils.isNotEmptyObject(tableDataRow.sProcessParam)) { + tableDataRow = { ...tableDataRow, ...commonUtils.convertStrToObj(tableDataRow.sProcessParam) }; + tableDataRow.sQuoParams = item.sParams; + } + // 配套工序 + if (bProcessAssort) { + returnProcessAssort.filter(item => item.sParentId === tableDataRow.sProcessId).forEach(((itemProcessAssort) => { + const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId); + if (iIndex > -1) { + const iProcessIndex = selectData.findIndex(item => item.sId === itemProcessAssort.sProcessId); + const iNewProcessIndex = dropDownDataProcessName[iIndex].sType === '3' ? + tableData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId) : + tableData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId && item.sControlId === controlData[iControlIndex].sId); + if (iProcessIndex < 0 && iNewProcessIndex < 0) { + let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值 + processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段 + processRow.handleType = 'add'; + processRow.sId = commonUtils.createSid(); + processRow.sParentId = masterData.sId; + processRow.sType = dropDownDataProcessName[iIndex].sType; + if (iControlIndex > -1 && processRow.sType !== '3') { + processRow.sControlId = controlData[iControlIndex].sId; + processRow.sPartsName = controlData[iControlIndex].sPartsName; + } + // const iSlaveIndex = slaveData.findIndex(item => item.sId === slaveSelectedRowKeys[0]); + // if (iSlaveIndex > -1) { + // processRow.sSlaveId = slaveData[iSlaveIndex].sId; + // } + tableData.push(processRow); + + if (itemProcessAssort.sType === 'all') { + controlData.filter(item => item.sId !== controlData[iControlIndex].sId).forEach((controlTableRow) => { + const iNewProcessIndex = dropDownDataProcessName[iIndex].sType === '3' ? + tableData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId) : + tableData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId && item.sControlId === controlTableRow.sId); + if (iNewProcessIndex < 0) { + let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值 + processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段 + processRow.handleType = 'add'; + processRow.sId = commonUtils.createSid(); + processRow.sParentId = masterData.sId; + processRow.sType = dropDownDataProcessName[iIndex].sType; + // processRow.sSlaveId = slaveData[iSlaveIndex].sId; + if (iControlIndex > -1 && processRow.sType !== '3') { + processRow.sControlId = controlTableRow.sId; + processRow.sPartsName = controlTableRow.sPartsName; + } + // if (iSlaveIndex > -1) { + // processRow.sSlaveId = slaveData[iSlaveIndex].sId; + // } + tableData.push(processRow); + } + }); + } + } + } + })); + } + } else if(name ==='materials') { + /* 将工序选中行 作为对应工序给材料 */ + const iProcessIndex = commonUtils.isNotEmptyArr(processSelectedRowKeys) ? processDataOld.findIndex(item => item.sId === processSelectedRowKeys[0]) : -1; + let processRow = {}; + if (iProcessIndex > -1) { + processRow = processDataOld[iProcessIndex]; + tableDataRow.sProcessId = processRow.sProcessId; + tableDataRow.sProcessTbId = processRow.sId; + tableDataRow.sMaterialsProcessName = processRow.sProcessName; + } + } + if (iControlIndex > -1 && tableDataRow.sType !== '3') { + tableDataRow.sControlId = controlData[iControlIndex].sId; + tableDataRow.sPartsName = controlData[iControlIndex].sPartsName; + tableData.push(tableDataRow); + } else if (tableDataRow.sType === '3') { + tableData.push(tableDataRow); + } + } + } + const tableDataNew = this.sortData(controlData, tableData); + console.log('222', tableDataNew); + this.props.onSaveState({ + [`${name}Data`]: tableDataNew, [`${name}ChooseVisible`]: false, materialsConfig, materialsSelectedRowKeys: [], + }); + } + }; + + /* 选择成品工序 点确定 */ + handleSelectFinalProcessNew = async (name, selectConfig, selectData, slaveFinalSelectedData) => { + const targetname = 'process'; + const { + [`${targetname}Data`]: tableData, [`${targetname}Config`]: tableConfig, controlSelectedRowKeys, sModelsId, token, + materialsConfig, processConfig,masterConfig, + } = this.props; + const { masterData } = this.props; + if (name === 'chooseProductProcess') { + const { controlData } = this.props; + const iControlIndex = commonUtils.isNotEmptyArr(controlSelectedRowKeys) ? controlData.findIndex(item => item.sId === controlSelectedRowKeys[0]) : -1; + /* 取选择工序从表配置 */ + const slavesControlName = commonUtils.isNotEmptyObject(selectConfig.sControlName) ? `${selectConfig.sControlName}.slave` : ''; + let slaveSelectConfig = {}; + let slaveIndex = -1; + if (commonUtils.isNotEmptyObject(masterConfig)) { + slaveIndex = masterConfig.gdsconfigformslave.findIndex(item => item.sControlName === slavesControlName); + if (slaveIndex > -1) { + slaveSelectConfig = masterConfig.gdsconfigformslave[slaveIndex]; + } + } + /* 通过slaveFinalSelectedRowKeys找到slaveData数据 */ + if (commonUtils.isNotEmptyArr(slaveFinalSelectedData)) { + for (const slaveObj of slaveFinalSelectedData) { + if (commonUtils.isNotEmptyArr(selectData)) { + for (const item of selectData) { + const newCopyTo = {}; + newCopyTo.master = masterData; + if (iControlIndex > -1) { + newCopyTo.control = controlData[iControlIndex]; + } + let tableDataRow = commonFunc.getDefaultData(tableConfig, newCopyTo); // 取默认值 + tableDataRow = { ...tableDataRow, ...commonFunc.getAssignFieldValue(selectConfig.sAssignField, item, newCopyTo) }; // 取赋值字段 + if (commonUtils.isNotEmptyObject(slaveSelectConfig)) { + tableDataRow = { ...tableDataRow, ...commonFunc.getAssignFieldValue(slaveSelectConfig.sAssignField, slaveObj, newCopyTo) }; // 取从表赋值字段 + } + tableDataRow.handleType = 'add'; + tableDataRow.sId = commonUtils.createSid(); + tableDataRow.sParentId = masterData.sId; + + tableDataRow.sCombinePartsName = slaveObj.sId; /* 成品工序sCombinePartsName 为从表id */ + tableDataRow.sCombinePartsNameNew = slaveObj.sProductName; /* 成品工序sCombinePartsName 为从表产品名称 */ + // tableDataRow.sSlaveProductId = slaveObj.sId; + + tableDataRow.sType = '3'; + if (commonUtils.isNotEmptyObject(tableDataRow.sWorkOrderParam)) { + tableDataRow = { ...tableDataRow, ...commonUtils.convertStrToObj(tableDataRow.sWorkOrderParam) }; + } + if (targetname === 'process') { + const value = { sSqlCondition: { sParentId: item.sId } }; + const configDataId = '11811781131121915166093023980'; + const dataUrl = `${commonConfig.server_host}business/getBusinessDataByFormcustomId/${configDataId}?sModelsId=${sModelsId}`; + const returnData = (await commonServices.postValueService(token, value, dataUrl)).data; + if (returnData.code === 1) { + const eleprocessmachineData = returnData.dataset.rows[0].dataSet; + const newData = eleprocessmachineData.filter(item => item.bDefault); + if (commonUtils.isNotEmptyArr(newData)) { + tableDataRow.sMachineId = newData[0].sMachineId; + } + } + const bProcessAssort = false; + let returnProcessAssort = []; + let processAssignAssort = ''; + let dropDownDataProcessName; + if (bProcessAssort) { + const dataUrl = `${commonConfig.server_host}salesorder/getProcessAssort?sModelsId=${sModelsId}`; + const dataProcessAssort = (await commonServices.postValueService(token, {}, dataUrl)).data; + if (dataProcessAssort.code === 1) { + returnProcessAssort = dataProcessAssort.dataset.rows[0].processassort; + const iIndex = processConfig.gdsconfigformslave.findIndex(item => item.sName === 'sProcessName'); + if (iIndex > -1) { + const sqlDropDownData = await this.props.getSqlDropDownData(sModelsId, 'slave', processConfig.gdsconfigformslave[iIndex]); + dropDownDataProcessName = sqlDropDownData.dropDownData; + processAssignAssort = processConfig.gdsconfigformslave[iIndex].sAssignField; + } + } + } + // 配套工序 + if (bProcessAssort) { + returnProcessAssort.filter(item => item.sParentId === tableDataRow.sProcessId).forEach(((itemProcessAssort) => { + const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId); + if (iIndex > -1) { + const iProcessIndex = selectData.findIndex(item => item.sId === itemProcessAssort.sProcessId); + const iNewProcessIndex = tableDataRow.sType === '3' ? + tableData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId) : + tableData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId && item.sControlId === controlData[iControlIndex].sId); + if (iProcessIndex < 0 && iNewProcessIndex < 0) { + let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值 + processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段 + processRow.handleType = 'add'; + processRow.sId = commonUtils.createSid(); + processRow.sParentId = masterData.sId; + processRow.sType = dropDownDataProcessName[iIndex].sType; + + // 成品工序的配套工序带入产品名称-开始 + processRow.sCombinePartsName = slaveObj.sId; /* 成品工序sCombinePartsName 为从表id */ + processRow.sCombinePartsNameNew = slaveObj.sProductName; /* 成品工序sCombinePartsName 为从表产品名称 */ + processRow.sCombineProductNameNew = slaveObj.sProductName; /* 成品工序sCombinePartsName 为从表产品名称 */ + // processRow.sParentProcessId = item.sId; + // 成品工序的配套工序带入产品名称-结束 + + if (iControlIndex > -1 && processRow.sType !== '3') { + processRow.sControlId = controlData[iControlIndex].sId; + processRow.sPartsName = controlData[iControlIndex].sPartsName; + } + tableData.push(processRow); + + if (itemProcessAssort.sType === 'all') { + controlData.filter(item => item.sId !== controlData[iControlIndex].sId).forEach((controlTableRow) => { + const iNewProcessIndex = dropDownDataProcessName[iIndex].sType === '3' ? + tableData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId) : + tableData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId && item.sControlId === controlTableRow.sId); + if (iNewProcessIndex < 0) { + let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值 + processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段 + processRow.handleType = 'add'; + processRow.sId = commonUtils.createSid(); + processRow.sParentId = masterData.sId; + processRow.sType = dropDownDataProcessName[iIndex].sType; + + // 成品工序的配套工序带入产品名称-开始 + processRow.sCombinePartsName = slaveObj.sId; /* 成品工序sCombinePartsName 为从表id */ + processRow.sCombinePartsNameNew = slaveObj.sProductName; /* 成品工序sCombinePartsName 为从表产品名称 */ + processRow.sCombineProductNameNew = slaveObj.sProductName; /* 成品工序sCombinePartsName 为从表产品名称 */ + // processRow.sParentProcessId = item.sId; + // 成品工序的配套工序带入产品名称-结束 + + if (iControlIndex > -1 && processRow.sType !== '3') { + processRow.sControlId = controlTableRow.sId; + processRow.sPartsName = controlTableRow.sPartsName; + } + tableData.push(processRow); + } + }); + } + } + } + })); + } + } + // const processLen = commonBusiness.getTableTypes('process', this.props).data.filter(item => this.state.currentTab.process.split('-').indexOf(item.sType) !== -1).length; + // tableDataRow.iOrder = processLen; + if (iControlIndex > -1 && tableDataRow.sType !== '3') { + tableDataRow.sControlId = controlData[iControlIndex].sId; + tableDataRow.sPartsName = controlData[iControlIndex].sPartsName; + const processLen = tableData.filter(item => item.sType !== '3').length + 1; /* 工序序号自增 */ + tableDataRow.iOrder = processLen; + tableData.push(tableDataRow); + } else if (tableDataRow.sType === '3') { + const processLen = tableData.filter(item => item.sType === '3').length + 1; /* 工序序号自增 */ + tableDataRow.iOrder = processLen; + tableData.push(tableDataRow); + } + } + } + } + } else { + message.error('请选择产品!'); + return; + } + const tableDataNew = this.sortData(controlData, tableData); + this.props.onSaveState({ + [`${targetname}Data`]: tableDataNew, [`${name}ChooseVisible`]: false, materialsConfig, materialsSelectedRowKeys: [], + }); + } + } + + /* 选择成品材料 点确定 */ + handleSelectFinalMaterialsNew = async (name, selectConfig, selectData, slaveFinalSelectedData) => { + // 选择成品材料,将sType改为2 + if (name === 'productMaterials') { + selectData = selectData.map(val => ({ ...val, sType: '2' })); + name = 'materials0'; + } + const { + [`${name}Data`]: tableData = [], [`${name}Config`]: tableConfig, controlSelectedRowKeys, materialsConfig,masterConfig, + } = this.props; + const { masterData } = this.props; + const { controlData } = this.props; + const iControlIndex = commonUtils.isNotEmptyArr(controlSelectedRowKeys) ? controlData.findIndex(item => item.sId === controlSelectedRowKeys[0]) : -1; + /* 取选择工序从表配置 */ + const slavesControlName = commonUtils.isNotEmptyObject(selectConfig.sControlName) ? `${selectConfig.sControlName}.slave` : ''; + let slaveSelectConfig = {}; + let slaveIndex = -1; + if (commonUtils.isNotEmptyObject(masterConfig)) { + slaveIndex = masterConfig.gdsconfigformslave.findIndex(item => item.sControlName === slavesControlName); + if (slaveIndex > -1) { + slaveSelectConfig = masterConfig.gdsconfigformslave[slaveIndex]; + } + } + if (commonUtils.isNotEmptyArr(slaveFinalSelectedData)) { + for (const slaveObj of slaveFinalSelectedData) { + if (commonUtils.isNotEmptyArr(selectData)) { + for (const item of selectData) { + const newCopyTo = {}; + newCopyTo.master = masterData; + if (iControlIndex > -1) { + newCopyTo.control = controlData[iControlIndex]; + } + let tableDataRow = commonFunc.getDefaultData(tableConfig, newCopyTo); // 取默认值 + tableDataRow = { ...tableDataRow, ...commonFunc.getAssignFieldValue(selectConfig.sAssignField, item, newCopyTo) }; // 取赋值字段 + if (commonUtils.isNotEmptyObject(slaveSelectConfig)) { + tableDataRow = { ...tableDataRow, ...commonFunc.getAssignFieldValue(slaveSelectConfig.sAssignField, slaveObj, newCopyTo) }; // 取从表赋值字段 + } + tableDataRow.handleType = 'add'; + tableDataRow.sId = commonUtils.createSid(); + + tableDataRow.sParentId = masterData.sId; + tableDataRow.sCombinePartsName = slaveObj.sId; /* 成品材料sCombinePartsName 为从表id */ + tableDataRow.sCombinePartsNameNew = slaveObj.sProductName; + // tableDataRow.sSlaveProductId = slaveObj.sId; + + if (iControlIndex > -1 && tableDataRow.sType !== '2') { + tableDataRow.sControlId = controlData[iControlIndex].sId; + tableDataRow.sPartsName = controlData[iControlIndex].sPartsName; + tableData.push(tableDataRow); + } else if (tableDataRow.sType === '2') { + tableData.push(tableDataRow); + } + } + } + } + } else { + message.error('请选择产品!'); + return; + } + this.props.onSaveState({ + [`${name}Data`]: tableData, [`${name}ChooseVisible`]: false, materialsConfig, materialsSelectedRowKeys: [], + }); + } + + handleGetAllDelData = () => { + const { + slaveData = [], + slaveDelData: slaveDelDataOld = [], + controlData = [], + controlDelData: controlDelDataOld = [], + materialsData = [], + materialsDelData: materialsDelDataOld = [], + processData = [], + processDelData: processDelDataOld = [], + manyqtysData = [], + manyqtysDelData: manyqtysDelDataOld = [], + colorData = [], + colorDelData: colorDelDataOld = [], + packData = [], + packDelData: packDelDataOld = [], + } = props; + const addState = { + slaveDelData: [ + ...slaveDelDataOld, + ...slaveData.filter(item => !slaveDelDataOld.map(item1 => item1.sId).includes(item.sId)).map(item => ({ ...item, handleType: "del" })), + ], + controlDelData: [ + ...controlDelDataOld, + ...controlData.filter(item => !controlDelDataOld.map(item1 => item1.sId).includes(item.sId)).map(item => ({ ...item, handleType: "del" })), + ], + materialsDelData: [ + ...materialsDelDataOld, + ...materialsData + .filter(item => !materialsDelDataOld.map(item1 => item1.sId).includes(item.sId)) + .map(item => ({ ...item, handleType: "del" })), + ], + processDelData: [ + ...processDelDataOld, + ...processData.filter(item => !processDelDataOld.map(item1 => item1.sId).includes(item.sId)).map(item => ({ ...item, handleType: "del" })), + ], + manyqtysDelData: [ + ...manyqtysDelDataOld, + ...manyqtysData.filter(item => !manyqtysDelDataOld.map(item1 => item1.sId).includes(item.sId)).map(item => ({ ...item, handleType: "del" })), + ], + colorDelData: [ + ...colorDelDataOld, + ...colorData.filter(item => !colorDelDataOld.map(item1 => item1.sId).includes(item.sId)).map(item => ({ ...item, handleType: "del" })), + ], + packDelData: [ + ...packDelDataOld, + ...packData.filter(item => !packDelDataOld.map(item1 => item1.sId).includes(item.sId)).map(item => ({ ...item, handleType: "del" })), + ], + }; + return addState; + } + + /* 多数量段行刷新时 刷新整个数据 */ + handleTableReflesh = (name,index ,record) => { + const { masterData, masterConfig } = this.props; + const slaveNameList = []; + const allTableMap = {}; + const allReturnMap = {}; + console.log('record', record); + const sAllDataStr = record.sAllData; + if(commonUtils.isEmptyObject(sAllDataStr)) { + message.error('当前数据未返回全部数据!'); + return; + } + console.log('sAllDataStr', sAllDataStr); + const returnData = commonUtils.isJSON(record.sAllData) ? JSON.parse(record.sAllData) : []; + console.log('returnData', returnData); + /* 从props找到 所有的Config */ + if(commonUtils.isNotEmptyArr(this.props)) { + for (const key of Object.keys(this.props)) { + if(key.includes('Config') && !key.includes('onGet') && !key.includes('report') && + !key.includes('master')) { + const tablename = key.replace('Config', '').trim(); + if (this.props.sModelsType === 'manufacture/workOrder3') { + if (tablename === 'materials') continue; + } + slaveNameList.push(tablename); + } + } + } + if (commonUtils.isNotEmptyArr(slaveNameList)) { + slaveNameList.forEach((name, index) => { + const tableConfig = this.props[name +'Config']; /* 动态配置 */ + if(commonUtils.isNotEmptyObject(tableConfig)) { + const tableData = this.props[name +'Data']; /* 动态配置 */ + const tableSelectedRowKeys = this.props[name + 'SelectedRowKeys']; /* 选中Key */ + allTableMap[name +'.'+ tableConfig.sTbName] = tableData + } + }) + const masterTbName = masterConfig.sTbName; + allTableMap['master.'+ masterTbName] = masterData; + } + console.log('masterData', masterData); + slaveNameList.forEach((name, index) => { + const tableConfig = this.props[name +'Config']; /* 动态配置 */ + let tableDelData = this.props[name +'DelData']; + let tableAllData = this.props[name +'Data']; + if(commonUtils.isEmptyArr(tableDelData)) { + tableDelData = []; + } + let tableDelDataNew = [] + let tableData = []; + if(commonUtils.isNotEmptyObject(tableConfig)) { + // tableData = tableAllData; /* 动态配置 */ + if(commonUtils.isNotEmptyArr(tableAllData) && Array.isArray(tableAllData)) { + tableDelDataNew = tableAllData; + tableAllData.forEach((delObj) => { + const newRow = {...delObj}; + newRow.handleType = 'del'; + tableDelData.push(newRow); + }) + } + + const sTbName = `${tableConfig.sTbName.toLowerCase()}_tmp`; + tableData = returnData[sTbName]; /* 动态配置 */ + console.log({ name, sTbName, tableData }); + if(commonUtils.isNotEmptyArr(tableData)) { + tableData.forEach((item, index) => { + const newRow = {...item}; + newRow.sParentId = masterData.sId; + tableData[index]= newRow; + }) + allReturnMap[name +'Data'] = tableData; + allReturnMap[name +'DelData'] = tableDelData; + } + } + + }); + console.log('sAllDatareturnData', returnData); + console.log('allReturnMap', allReturnMap); + + this.props.onSaveState({ ...allReturnMap }); + + } + render() { - const { masterData, sModelsType, app } = this.props; - const imgSrc = commonBusiness.handleAddIcon(masterData, sModelsType, app); + const { masterData } = this.props; + const imgSrc = commonBusiness.handleAddIcon(masterData); return ( { isSColorSerialMemo={this.isSColorSerialMemo} onBtnParamPage ={this.handleBtnParamPage} onFilterData ={this.handleFilterData} + onSelectProcessSolution={this.handleSelectProcessSolution} + onProcessSolutionRow ={this.handleProcessSolutionRow} + onCancelProcessSolutionModal ={this.handleCloseProcessSolutionModal} + onSelectProductProcessNew={this.handleSelectFinalProcessNew} + onSelectProductMaterialsNew={this.handleSelectFinalMaterialsNew} + getMenuStatus={this.getMenuStatus} + onDataRowReflesh = {this.handleTableReflesh} /> ); } diff --git a/src/components/Common/CommonCalculator.js b/src/components/Common/CommonCalculator.js index 999fe2c..be22ffc 100644 --- a/src/components/Common/CommonCalculator.js +++ b/src/components/Common/CommonCalculator.js @@ -1,10 +1,10 @@ /* eslint-disable function-paren-newline */ import React, { Component } from 'react'; import { Form } from '@ant-design/compatible'; -// import '@ant-design/compatible/assets/index.css'; -import { Row, Col, Button } from 'antd-v4'; +import '@ant-design/compatible/assets/index.css'; +import { Row, Col, Button } from 'antd'; import * as commonUtils from '../../utils/utils'; -import commonConfig from '../../utils/config'; +import * as commonConfig from '../../utils/config'; import * as commonFunc from './commonFunc'; import styles from '../../index.less'; diff --git a/src/components/Common/CommonCheckBill/index.css b/src/components/Common/CommonCheckBill/index.css deleted file mode 100644 index 09a0410..0000000 --- a/src/components/Common/CommonCheckBill/index.css +++ /dev/null @@ -1,14 +0,0 @@ -.pdfContainer { - width: 100%; - height: 300px; -} -/* 处理分隔符间距 */ -:global { - /* 主表分隔符间距 */ -} -:global .commonCheckBillContainer .ant-divider-horizontal.ant-divider-with-text { - margin: 5px 0 10px 0!important; -} -:global .commonCheckBillContainer .flexArea .ant-divider-horizontal.ant-divider-with-text { - margin: -8px 0 !important; -} diff --git a/src/components/Common/CommonCheckBill/index.js b/src/components/Common/CommonCheckBill/index.js index a8bcace..b71f3ff 100644 --- a/src/components/Common/CommonCheckBill/index.js +++ b/src/components/Common/CommonCheckBill/index.js @@ -2,7 +2,7 @@ import React, { Component } from 'react'; import { UploadOutlined } from '@ant-design/icons'; import { Form } from '@ant-design/compatible'; -// import '@ant-design/compatible/assets/index.css'; +import '@ant-design/compatible/assets/index.css'; import { Row, Col, @@ -16,7 +16,7 @@ import { Input, Divider, Collapse, -} from 'antd-v4'; +} from 'antd'; import { message } from '@/utils/common/message'; import CommonSales from '@/components/Common/CommonCheckBillEvent';/* 继承销售模块业务功能 */ import * as commonFunc from '@/components/Common/commonFunc';/* 通用单据方法 */ /* 通用单据方法 */ @@ -28,7 +28,7 @@ import CommonViewFlex from '@/components/Common/CommonViewFlex'; import CommonViewTable from '@/components/Common/CommonViewTable'; import CommonBase from '@/components/Common/CommonBase';/* 获取配置及数据 */ import * as commonBusiness from '@/components/Common/commonBusiness';/* 单据业务功能 */ -import commonConfig from '@/utils/config'; +import * as commonConfig from '@/utils/config'; import * as commonUtils from '@/utils/utils';/* 通用方法 */ import * as commonServices from '@/services/services';/* 服务类 */ import CommonListSelect from '@/components/Common/CommonListSelect'; @@ -1985,12 +1985,6 @@ const BillComponent = Form.create({ // 匹配数字 // eslint-disable-next-line no-unused-vars const num = item.replace(/[^\d]/g, ' '); - let tabName = item.replace(/\d+/g,''); - /* 从主表配置 找到控件名=tabName,否则取他的showName */ - const tableConfigArr = masterConfig?.gdsconfigformslave.filter(row => row.sControlName === item.trim()); - if(commonUtils.isNotEmptyArr(tableConfigArr)) { - tabName=tableConfigArr[0].showName; - } return (
{item} @@ -1998,7 +1992,7 @@ const BillComponent = Form.create({ {...props} // 使高度和从表高度一直 isAutoHeight="ture" - tableConfigType={tabName} + tableConfigType={item} tableConfigTypeArr={diliverConfigTypeArr} />
diff --git a/src/components/Common/CommonCheckBill/index.less b/src/components/Common/CommonCheckBill/index.less index 78e7803..7d3507f 100644 --- a/src/components/Common/CommonCheckBill/index.less +++ b/src/components/Common/CommonCheckBill/index.less @@ -1,3 +1,4 @@ +@import "~antd/lib/style/themes/default.less"; .pdfContainer{ width: 100%; height: 300px; diff --git a/src/components/Common/CommonCheckBillEvent.js b/src/components/Common/CommonCheckBillEvent.js index d1ca1ed..f40f99e 100644 --- a/src/components/Common/CommonCheckBillEvent.js +++ b/src/components/Common/CommonCheckBillEvent.js @@ -1,12 +1,12 @@ /* eslint-disable */ import React, { Component } from 'react'; -import { Modal, Progress } from 'antd-v4'; +import { Modal, Progress } from 'antd'; import { message } from '@/utils/common/message'; import moment from 'moment'; import * as commonUtils from '@/utils/utils'; /* 通用方法 */ import * as commonBusiness from '@/components/Common/commonBusiness'; /* 单据业务功能 */ import * as commonServices from '@/services/services'; /* 服务类 */ -import commonConfig from '@/utils/config'; +import * as commonConfig from '@/utils/config'; import * as commonFunc from '@/components/Common/commonFunc'; import styles from '@/components/Common/ToolBar/index.less'; @@ -72,7 +72,7 @@ export default (ChildComponent) => { employeeConfig: employeeConfigOld, } = nextProps; if (commonUtils.isEmptyObject(slaveConfigOld) && formData.length > 0 && (sModelsType !== 'cashier/financialTransfer' && sModelsType !== 'cashier/financialAdjustment' && sModelsType !== 'quality/accident' && sModelsType !== 'purchase/purchaseEnquiry' && sModelsType !== 'complaint/complaint' && sModelsType !== 'print/printLabel' && sModelsType !== 'commonBill/onlyMaster' && (formRoute.indexOf('indexOee') === -1 || formRoute === '/indexOee/commonOeeBill'))) { - const sId = currentId || nextProps.masterData?.sId || ''; + const sId = currentId !== undefined ? currentId : ''; /* 数据Id */ const masterConfig = formData.filter(item => !item.bGrd)[0]; const BtnDesignFunctionConfig = commonUtils.isNotEmptyObject(masterConfig) ? masterConfig.gdsconfigformslave.filter(item => item.sControlName === 'BtnBsOperation.BtnDesignFunction') : {}; @@ -373,7 +373,7 @@ export default (ChildComponent) => { }); } else if (commonUtils.isEmptyObject(masterConfigOld) && formData.length === 1 && (sModelsType === 'cashier/financialTransfer' || sModelsType === 'purchase/purchaseEnquiry' || sModelsType === 'cashier/financialAdjustment' || sModelsType === 'print/printLabel' || sModelsType === 'complaint/complaint' || sModelsType === 'commonBill/onlyMaster') && formRoute.indexOf('indexOee') === -1) { const config = {}; - const sId = currentId || nextProps.masterData?.sId || ''; + const sId = currentId !== undefined ? currentId : ''; /* 数据Id */ const masterConfig = formData.filter(item => !item.bGrd)[0]; let addState = {}; @@ -395,7 +395,7 @@ export default (ChildComponent) => { masterConfig, sId, pageLoading: false, ...addState, }); } else if (commonUtils.isEmptyObject(slaveConfigOld) && commonUtils.isEmptyObject(masterConfigOld) && formData.length === 2 && (sModelsType === 'quality/accident') && formRoute.indexOf('indexOee') === -1) { - const sId = currentId || nextProps.masterData?.sId || ''; + const sId = currentId !== undefined ? currentId : ''; /* 数据Id */ const masterConfig = formData.filter(item => !item.bGrd)[0]; const slaveConfig = formData.filter(item => item.bGrd && item.sTbName === 'mftqualityaccidentSlave')[0]; @@ -430,7 +430,7 @@ export default (ChildComponent) => { // employeeConfig, employeeColumn, masterConfig, ...addState, // }); if (formRoute === '/indexOee/labelPrint' && commonUtils.isEmpty(slaveConfigOld)) { /* 入库标签打印 */ - const sId = currentId || nextProps.masterData?.sId || ''; + const sId = currentId !== undefined ? currentId : ''; /* 数据Id */ const masterConfig = formData[0]; const slaveConfig = formData[0]; @@ -618,7 +618,7 @@ export default (ChildComponent) => { /** 获取主表、从表、审核表数据 */ handleGetData = async (masterConfig, slaveConfig, checkConfig, bEditClick) => { const { currentId } = this.props; /* 当前页签数据 */ - const sId = currentId || this.props.masterData?.sId || ''; + const sId = currentId !== undefined ? currentId : ''; const addStateMaster = await this.props.handleGetDataOne({ name: 'master', configData: masterConfig, condition: { sId, pageSize: '', pageNum: '' }, isWait: true, bEditClick, }); @@ -669,7 +669,7 @@ export default (ChildComponent) => { /* 获取表数据 */ handleGetMemoData = async (controlConfig, materialsConfig, processConfig, colorConfig, packConfig) => { const { currentId, sModelsType } = this.props; /* 当前页签数据 */ - const sId = currentId || this.props.masterData?.sId || ''; /* 数据Id */ + const sId = currentId !== undefined ? currentId : ''; /* 数据Id */ let addStateControl = {}; if (commonUtils.isNotEmptyObject(controlConfig)) { addStateControl = await this.props.handleGetDataSet({ @@ -732,7 +732,7 @@ export default (ChildComponent) => { /* 获取单张表数据 */ handleGetOneMemoData = (memoName, memoConfig) => { const { currentId } = this.props; /* 当前页签数据 */ - const sId = currentId || this.props.masterData?.sId || ''; /* 数据Id */ + const sId = currentId !== undefined ? currentId : ''; /* 数据Id */ if (commonUtils.isNotEmptyObject(sId)) { /* 解决detail数据没有问题 */ this.props.handleGetDataSet({ name: memoName, configData: memoConfig, condition: { sSqlCondition: { sParentId: sId } }, @@ -5541,8 +5541,8 @@ export default (ChildComponent) => { } render() { - const { masterData, sModelsType, app } = this.props; - const imgSrc = commonBusiness.handleAddIcon(masterData, sModelsType, app); + const { masterData } = this.props; + const imgSrc = commonBusiness.handleAddIcon(masterData); return ( -1 - ? { labelCol: { span: 7, style: { color: "rgba(0, 0, 0, 0.65)", backgroundColor: "#BFEFFF" } }, wrapperCol: { span: 15 } } - : { - labelCol: { span: 7, style: { height: "27.82px", color: "rgba(0, 0, 0, 0.65)", backgroundColor: "#BFEFFF" } }, - wrapperCol: { span: 15 }, - }; /* 表格样式(主要是colspan和rowspan,数据格式:对象) */ + this.formItemLayout = commonUtils.isNotEmptyObject(props.formItemLayout) ? + props.formItemLayout : + location.pathname.toLowerCase().indexOf('oee') > -1 ? { labelCol: { span: 7, style: { color: 'rgba(0, 0, 0, 0.65)', backgroundColor: '#BFEFFF' } }, wrapperCol: { span: 15 } } : + { labelCol: { span: 7, style: { height: '27.82px', color: 'rgba(0, 0, 0, 0.65)', backgroundColor: '#BFEFFF' } }, wrapperCol: { span: 15 } }; /* 表格样式(主要是colspan和rowspan,数据格式:对象) */ this.isDropdownFilter = false; this.V = { value: props.dataValue }; this.myRef = createRef(); this.dropDownCount = 0; - this.bSpecial = location.pathname?.includes("ResearchTableTree") && props.showConfig.sName === "sProductName"; + this.bSpecial = location.pathname?.includes('ResearchTableTree') && props.showConfig.sName === 'sProductName'; } /** 渲染前只执行一次 */ componentWillMount() { this.mounted = true; - if (this.props.showConfig.sDropDownType === "const") { - /* 常量下拉 */ + if (this.props.showConfig.sDropDownType === 'const') { /* 常量下拉 */ /* 常量下拉其实只取一次数据就可以啦,去过数据的会给state中的dropDownData赋值,所以dropDownData有值的情况就不需要再获取了 */ - const showDropDown = commonUtils.isNotEmptyArr(this.props.showConfig.dropDownData) - ? this.props.showConfig.dropDownData - : typeof this.props.showConfig.showDropDown === "object" - ? this.props.showConfig.showDropDown - : commonUtils.objectToArr(commonUtils.convertStrToObj(this.props.showConfig.showDropDown)); + const showDropDown = commonUtils.isNotEmptyArr(this.props.showConfig.dropDownData) ? this.props.showConfig.dropDownData : + (typeof this.props.showConfig.showDropDown === 'object') ? this.props.showConfig.showDropDown : commonUtils.objectToArr(commonUtils.convertStrToObj(this.props.showConfig.showDropDown)); /* 给state赋值 */ if (this.mounted) { this.setState({ dropDownData: showDropDown, }); } - } else if (this.props.showConfig.sDropDownType === "sql" && !commonUtils.isEmptyArr(this.props.showConfig.dropDownData)) { + } else if (this.props.showConfig.sDropDownType === 'sql' && !commonUtils.isEmptyArr(this.props.showConfig.dropDownData)) { if (this.mounted) { this.setState({ dropDownData: this.props.showConfig.dropDownData, @@ -138,11 +126,11 @@ export default class CommonComponent extends Component { const selectInputNode = currentNode.querySelector("input[class*='ant-select-selection-search-input']"); const antInput = currentNode.querySelector("input[class*='ant-input']"); const oInput = selectInputNode || antInput; - if (oInput && !this.props.noDebounce) { - oInput.addEventListener("compositionstart", () => { + if (oInput) { + oInput.addEventListener('compositionstart', () => { this.chineseInputting = true; }); - oInput.addEventListener("compositionend", () => { + oInput.addEventListener('compositionend', () => { this.chineseInputting = false; if (this.handleCompleteInputEventCache) { this.handleCompleteInputEventCache(); @@ -151,20 +139,20 @@ export default class CommonComponent extends Component { } if (currentNode) { - if (["t", "m", "y"].includes(this.firstDataIndex)) { + if (['t', 'm', 'y'].includes(this.firstDataIndex)) { const oInput = currentNode.querySelector(`input[id*="${this.props.showConfig.sName}"]`); if (oInput) { let { sDateFormat } = this.props.showConfig; if (commonUtils.isEmptyStr(sDateFormat)) { - if (this.firstDataIndex === "m") { - sDateFormat = "YYYY-MM"; - } else if (this.firstDataIndex === "y") { - sDateFormat = "YYYY"; + if (this.firstDataIndex === 'm') { + sDateFormat = 'YYYY-MM'; + } else if (this.firstDataIndex === 'y') { + sDateFormat = 'YYYY'; } else { sDateFormat = this.props.getDateFormat(); } } - oInput.oninput = e => { + oInput.oninput = (e) => { const { value } = e.target; const isValidDate = moment(value, sDateFormat, true).isValid(); if (isValidDate) { @@ -174,24 +162,22 @@ export default class CommonComponent extends Component { } } } - document.addEventListener("mousedown", this.handleSelectClick); + document.addEventListener('mousedown', this.handleSelectClick); } /** props改变的时候触发 */ componentWillReceiveProps(nextProps) { /* 如果是下拉控件,则要获取数据(获取下拉数据前要先更新sqlCondition) */ - const { dataValue, enabled, sFieldName, bNotEmpty, showName, sDropDownType } = this.state; + const { + dataValue, enabled, sFieldName, bNotEmpty, showName, sDropDownType, + } = this.state; if (nextProps.showConfig === undefined || this.props.showConfig === undefined) return; this.firstDataIndex = nextProps.showConfig.sName.substring(0, 1); /* 控件首字母(数据格式:字符串) */ - if (nextProps.showConfig.sDropDownType === "const") { - /* 常量下拉 */ + if (nextProps.showConfig.sDropDownType === 'const') { /* 常量下拉 */ /* 常量下拉其实只取一次数据就可以啦,去过数据的会给state中的dropDownData赋值,所以dropDownData有值的情况就不需要再获取了 */ - const showDropDown = commonUtils.isNotEmptyArr(nextProps.showConfig.dropDownData) - ? nextProps.showConfig.dropDownData - : typeof nextProps.showConfig.showDropDown === "object" - ? nextProps.showConfig.showDropDown - : commonUtils.objectToArr(commonUtils.convertStrToObj(nextProps.showConfig.showDropDown)); + const showDropDown = commonUtils.isNotEmptyArr(nextProps.showConfig.dropDownData) ? nextProps.showConfig.dropDownData : + (typeof nextProps.showConfig.showDropDown === 'object') ? nextProps.showConfig.showDropDown : commonUtils.objectToArr(commonUtils.convertStrToObj(nextProps.showConfig.showDropDown)); // 对应工序单独处理 // if (this.props.showConfig.showName === '对应工序') { // showDropDown = nextProps.customDropData; @@ -202,7 +188,7 @@ export default class CommonComponent extends Component { dropDownData: showDropDown, }); } - } else if (nextProps.showConfig.sDropDownType === "sql" && !commonUtils.isEmptyArr(nextProps.showConfig.dropDownData)) { + } else if (nextProps.showConfig.sDropDownType === 'sql' && !commonUtils.isEmptyArr(nextProps.showConfig.dropDownData)) { if (this.mounted) { this.setState({ dropDownData: nextProps.showConfig.dropDownData, @@ -210,16 +196,7 @@ export default class CommonComponent extends Component { } } /* 把需要更新的数据setState */ - if ( - dataValue !== nextProps.dataValue || - enabled !== nextProps.enabled || - bNotEmpty !== nextProps.showConfig.bNotEmpty || - sFieldName !== nextProps.showConfig.sName || - showName !== nextProps.showConfig.showName || - !showName || - sDropDownType !== nextProps.showConfig.sDropDownType || - (this.bSpecial && this.props.record.sProductNo !== nextProps.record.sProductNo) - ) { + if (dataValue !== nextProps.dataValue || enabled !== nextProps.enabled || bNotEmpty !== nextProps.showConfig.bNotEmpty || sFieldName !== nextProps.showConfig.sName || (showName !== nextProps.showConfig.showName || !showName) || sDropDownType !== nextProps.showConfig.sDropDownType || (this.bSpecial && this.props.record.sProductNo !== nextProps.record.sProductNo)) { if (this.mounted) { if (commonUtils.isEmpty(nextProps.dataValue)) { this.lastValue = nextProps.dataValue; @@ -243,40 +220,20 @@ export default class CommonComponent extends Component { shouldComponentUpdate(nextProps, nextState) { const { - dataValue, - enabled, - dropDownData, - searchValue, - searchDropDownData, - sFieldName, - bNotEmpty, - sActiveDisplay, - sDropDownType, - spinState, - showConfig, + dataValue, enabled, dropDownData, searchValue, searchDropDownData, sFieldName, bNotEmpty, sActiveDisplay, sDropDownType, spinState, showConfig, } = this.state; - return ( - nextProps.showConfig !== undefined && - (dataValue !== nextState.dataValue || - enabled !== nextState.enabled || - sFieldName !== nextState.sFieldName || - sDropDownType !== nextState.sDropDownType || - bNotEmpty !== nextState.bNotEmpty || - JSON.stringify(dropDownData) !== JSON.stringify(nextState.dropDownData) || - searchValue !== nextState.searchValue || - JSON.stringify(searchDropDownData) !== JSON.stringify(nextState.searchDropDownData) || - JSON.stringify(sActiveDisplay) !== JSON.stringify(nextState.sActiveDisplay) || - nextProps.showTime !== this.props.showTime || - spinState !== nextState.spinState || - JSON.stringify(nextState.selectTableData) !== JSON.stringify(this.state.selectTableData) || - JSON.stringify(nextProps.showConfig) !== JSON.stringify(showConfig)) - ); + return nextProps.showConfig !== undefined && (dataValue !== nextState.dataValue || enabled !== nextState.enabled || + sFieldName !== nextState.sFieldName || sDropDownType !== nextState.sDropDownType || bNotEmpty !== nextState.bNotEmpty || JSON.stringify(dropDownData) !== JSON.stringify(nextState.dropDownData) || + searchValue !== nextState.searchValue || JSON.stringify(searchDropDownData) !== JSON.stringify(nextState.searchDropDownData) || + JSON.stringify(sActiveDisplay) !== JSON.stringify(nextState.sActiveDisplay) || nextProps.showTime !== this.props.showTime || + spinState !== nextState.spinState || JSON.stringify(nextState.selectTableData) !== JSON.stringify(this.state.selectTableData) || + JSON.stringify(nextProps.showConfig) !== JSON.stringify(showConfig)); } componentWillUnmount() { this.mounted = false; - document.removeEventListener("mousedown", this.handleSelectClick); + document.removeEventListener('mousedown', this.handleSelectClick); } onFocus = () => { @@ -284,26 +241,13 @@ export default class CommonComponent extends Component { this.setState({ sActiveDisplay: false }); }; - onBlur = event => { - if (this.onExecInstructSet("blur")) return; + onBlur = (event) => { + if (this.onExecInstructSet('blur')) return; this.isDropdownFilter = false; - if (commonUtils.isNotEmptyStr(this.props.showConfig.sTableTitleSql) && this.props.showConfig.iVisCount > 1) { - this.setState({ - searchPageNum: 1, - searchTotalPageCount: 1, - searchDropDownData: [], - searchValue: "", - spinState: false, - sActiveDisplay: true, - }); - } else if ( - this.state.searchValue !== "" && - this.props.showConfig.sDropDownType === "sql" && - commonUtils.isEmptyArr(this.props.showConfig.dropDownData) - ) { + if (this.state.searchValue !== '' && this.props.showConfig.sDropDownType === 'sql' && commonUtils.isEmptyArr(this.props.showConfig.dropDownData)) { if (!this.props.showConfig.bCanInput) { - this.handleSelectOptionEvent(""); + this.handleSelectOptionEvent(''); } this.setState({ searchPageNum: 1, @@ -319,10 +263,7 @@ export default class CommonComponent extends Component { }); } /* 若下拉配置了movesql 则离开时 调用下拉sql数据 */ - if ( - this.props.showConfig && - (this.props.showConfig.sDropDownType === "movesql" || commonUtils.isNotEmptyObject(this.props.showConfig.sButtonParam)) - ) { + if (this.props.showConfig && (this.props.showConfig.sDropDownType === 'movesql' || commonUtils.isNotEmptyObject(this.props.showConfig.sButtonParam))) { this.props.onDropDownBlur(this.props.name, this.props.showConfig.sName, this.props.record, this.props.showConfig); } @@ -331,34 +272,40 @@ export default class CommonComponent extends Component { }; onBlurText = (event, timeout = 0) => { - if (this.onExecInstructSet("blur")) return; + if (this.onExecInstructSet('blur')) return; const currentValue = event?.target?.value; if (currentValue === this.lastValue) return; setTimeout(() => { - const { name, record, sBtnSendDialogConfigList, onToolBarBtnClick } = this.props; - if (name !== "master") return; + const { + name, + record, + sBtnSendDialogConfigList, + onToolBarBtnClick, + } = this.props; + if (name !== 'master') return; if (commonUtils.isEmptyArr(sBtnSendDialogConfigList)) return; const { sName } = this.props.showConfig; if (!record[sName]) return; const { sActiveKey, sControlName } = - sBtnSendDialogConfigList.find(item => { - const { sActiveKey = "" } = item; - return sActiveKey.split(",").includes(`${name}.${sName}`); - }) || {}; - if (sControlName !== "BtnSendDialog") { + sBtnSendDialogConfigList.find((item) => { + const { sActiveKey = '' } = item; + return sActiveKey.split(',').includes(`${name}.${sName}`); + }) + || {}; + if (sControlName !== 'BtnSendDialog') { if (!sActiveKey) return; this.lastValue = currentValue; onToolBarBtnClick({ key: sControlName }); } }, timeout); - }; + } - onExecInstructSet = type => { + onExecInstructSet = (type) => { const { sInstruct: sInstructStr, showName, sOnChangeInstruct } = this.props.showConfig; const sInstruct = commonUtils.convertStrToObj(sInstructStr, {}); let { [type]: instructType } = sInstruct; - if (type === "change") { + if (type === 'change') { const onChangeNew = commonUtils.convertStrToObj(sOnChangeInstruct, {}); instructType = onChangeNew[type]; } @@ -367,46 +314,47 @@ export default class CommonComponent extends Component { this.props.onExecInstructSet({ type, sInstruct: instructType, - showName: `${showName}-${type === "blur" ? "离焦" : "变化"}`, + showName: `${showName}-${type === 'blur' ? '离焦' : '变化'}`, }); } else { - message.error("未定义调用指令集事件!"); + message.error('未定义调用指令集事件!'); } return true; } return false; - }; + } onCheckFields = () => { // 手机号、邮箱校验等校验 // setTimeout(() => { - const sDateFormatTypeList = ["phone", "mobile", "mail", "postcode"]; + const sDateFormatTypeList = ['phone', 'mobile', 'mail', 'postcode']; const { sName, showName, sDateFormat } = this.props.showConfig; const { record } = this.props; - const IncorrectFormat = commonFunc.showLocalMessage(this.props, "IncorrectFormat", "格式不正确"); - const value = record[sName]; - if (value !== undefined && value !== "" && sDateFormatTypeList.includes(sDateFormat)) { + const value = record?.[sName]; + if ( + value !== undefined && value !== '' && sDateFormatTypeList.includes(sDateFormat) + ) { let flag = false; - if (sDateFormat === "phone") { + if (sDateFormat === 'phone') { const reg = /^0\d{2,3}-\d{7,8}$/; const reg1 = /^1[0-9]{10}$/; const reg2 = /^0\d{2,3}-\d{7,8}-\d{1,8}$/; if (!reg.test(value) && !reg1.test(value) && !reg2.test(value)) { flag = true; } - } else if (sDateFormat === "mobile") { + } else if (sDateFormat === 'mobile') { const reg = /^0\d{2,3}-\d{7,8}$/; const reg1 = /^1[0-9]{10}$/; const reg2 = /^0\d{2,3}-\d{7,8}-\d{1,8}$/; if (!reg.test(value) && !reg1.test(value) && !reg2.test(value)) { flag = true; } - } else if (sDateFormat === "mail") { + } else if (sDateFormat === 'mail') { const reg = /^[a-zA-Z0-9]{1,20}@[a-zA-Z0-9]{1,5}\.[a-zA-Z0-9]{1,5}$/; if (!reg.test(value)) { flag = true; } - } else if (sDateFormat === "postcode") { + } else if (sDateFormat === 'postcode') { const reg = /^[1-9][0-9]{5}$/; if (!reg.test(value)) { flag = true; @@ -414,30 +362,26 @@ export default class CommonComponent extends Component { } if (flag) { - this.props.onChange( - this.props.name, - "verificationFailed", - { verificationFailed: true, verificationFailedMsg: `【${showName}】【${sName}】${IncorrectFormat}!` }, - this.props.sId, - [] - ); - message.warning(`【${showName}】【${sName}】${IncorrectFormat}!`); + this.props.onChange(this.props.name, 'verificationFailed', { verificationFailed: true, verificationFailedMsg: `【${showName}】【${sName}】格式不正确!` }, this.props.sId, []); + message.warning(`【${showName}】【${sName}】格式不正确!`); } else if (record.verificationFailed) { record.verificationFailed = undefined; } } // }, timeout); - }; + } /** 下拉时看是否要重新获取数据 */ - onDropdownVisibleChange = open => { - const { dropDownData, bNewRecord, pageNum: pageNumOld, totalPageCount: totalPageCountOld, searchValue, conditonValues } = this.state; + onDropdownVisibleChange = (open) => { + const { + dropDownData, bNewRecord, pageNum: pageNumOld, totalPageCount: totalPageCountOld, searchValue, conditonValues, + } = this.state; if (this.mounted && open) { const conditonValuesNew = this.props.getSqlCondition(this.props.showConfig, this.props.name, this.props.record); const pageNum = JSON.stringify(conditonValuesNew) !== JSON.stringify(conditonValues) ? 1 : pageNumOld === 0 ? 1 : pageNumOld; const totalPageCount = conditonValuesNew !== conditonValues ? 1 : totalPageCountOld; - if (pageNum === 1 && this.props.showConfig.sDropDownType === "sql" && commonUtils.isEmptyArr(this.props.showConfig.dropDownData)) { + if (pageNum === 1 && this.props.showConfig.sDropDownType === 'sql' && commonUtils.isEmptyArr(this.props.showConfig.dropDownData)) { this.setState({ spinState: true }); this.getDropDownData(pageNum, totalPageCount, searchValue, this.dropDownCount); } @@ -456,17 +400,14 @@ export default class CommonComponent extends Component { } this.props.onDropdownVisibleChange(open); } - }; + } onDoubleClick = () => { const sMemo = this.props.showConfig.sName; const title = this.props.showConfig.showName; - const bSParamValue = sMemo === "sParamValue"; - if ( - (commonUtils.isNotEmptyObject(sMemo) && sMemo.indexOf("Memo") > -1) || - (bSParamValue && !this.props.record.sDropDownData) || - (this.props.showConfig.sControlName && this.props.showConfig.sControlName.toLowerCase().indexOf("memo") > -1) - ) { + const bSParamValue = sMemo === 'sParamValue'; + if ((commonUtils.isNotEmptyObject(sMemo) && sMemo.indexOf('Memo') > -1) || (bSParamValue && !this.props.record.sDropDownData) || + (this.props.showConfig.sControlName && this.props.showConfig.sControlName.toLowerCase().indexOf('memo') > -1)) { const sCurrMemoProps = { title, name: this.props.name, @@ -482,20 +423,14 @@ export default class CommonComponent extends Component { } else if (this.props.onSaveState) { this.props.onSaveState({ sCurrMemoProps }); } - } else if (commonUtils.isNotEmptyObject(sMemo) && sMemo.indexOf("sName") > -1) { - /* 计算方案 变量设置双击弹出 */ - this.props.onFieldDoubleClick(this.props.record, this.state.dataValue, this.props.showConfig, this.props.name); - } else if (commonUtils.isNotEmptyObject(sMemo) && sMemo.indexOf("sValue") > -1) { - /* 计算方案 变量设置双击弹出 */ + } else if (commonUtils.isNotEmptyObject(sMemo) && sMemo.indexOf('sValue') > -1) { /* 计算方案 变量设置双击弹出 */ this.props.onFieldDoubleClick(this.props.record, this.state.dataValue, this.props.showConfig, this.props.name); - } else if (commonUtils.isNotEmptyObject(sMemo) && sMemo.indexOf("sAssignField") > -1) { - /* 赋值字段 变量设置双击弹出 */ + } else if (commonUtils.isNotEmptyObject(sMemo) && sMemo.indexOf('sAssignField') > -1) { /* 赋值字段 变量设置双击弹出 */ this.props.onFieldDoubleClick(this.state.dataValue, this.props.showConfig, this.props.name); - } else if (commonUtils.isNotEmptyObject(sMemo) && sMemo.indexOf("sInstruct") > -1) { - /* 赋值字段 变量设置双击弹出 */ + } else if (commonUtils.isNotEmptyObject(sMemo) && sMemo.indexOf('sInstruct') > -1) { /* 赋值字段 变量设置双击弹出 */ this.props.onFieldDoubleClick(this.state.dataValue, this.props.showConfig, this.props.name); } - }; + } onEditorClick = () => { // if (this.props.enabled) { @@ -511,44 +446,42 @@ export default class CommonComponent extends Component { config: this.props.showConfig, }; this.props.onSaveState({ curEditorProps }); - }; + } - onKeyUp = e => { + onKeyUp = (e) => { if (this.props.onKeyUp) { this.props.onKeyUp(e); } - }; + } - onKeyDown = e => { + onKeyDown = (e) => { // 如果输入的是字母数字或者中文 if (!this.state.bDropDownOpen && /^[a-zA-Z0-9\u4e00-\u9fa5]+$/.test(e.keyCode)) { this.setState({ bDropDownOpen: true }); } - if (e.ctrlKey && e.keyCode === 82) { - /* CTRL+ALT+R 代替右击事件 */ + if (e.ctrlKey && e.keyCode === 82) { /* CTRL+ALT+R 代替右击事件 */ this.onContextMenu(e); - } else if (e.key === "F10") { + } else if (e.key === 'F10') { message.info(this.props.showConfig.sName); - } else if (e.ctrlKey && (e.altKey || e.metaKey) && e.keyCode === 71) { - /* CTRL+ALT+G F7 设置界面 */ + } else if (e.ctrlKey && (e.altKey || e.metaKey) && e.keyCode === 71) { /* CTRL+ALT+G F7 设置界面 */ const { sType } = this.props?.app?.userinfo || {}; - if (!["sysadmin"].includes(sType)) { + if (!['sysadmin'].includes(sType)) { return; } if (commonUtils.isNotEmptyObject(this.props)) { - const { name, tableConfig, record, configName } = this.props; + const { + name, tableConfig, record, configName, + } = this.props; if (commonUtils.isNotEmptyObject(tableConfig)) { const myTableConfig = JSON.parse(JSON.stringify(tableConfig)); - myTableConfig.sActiveId = "16411004790004762980820285096000"; + myTableConfig.sActiveId = '16411004790004762980820285096000'; myTableConfig.sName = this.props.showConfig.sName; const myTableConfigArr = []; myTableConfigArr.push(myTableConfig); - if (this.props.name === "master") { - /* 主表 */ - this.props.onViewClick(name, "myTableConfig", record, 0, myTableConfigArr, configName); - } else { - /* 从表 */ - this.props.onViewClick(name, "myTableConfig", record, 0, myTableConfigArr, configName); + if (this.props.name === 'master') { /* 主表 */ + this.props.onViewClick(name, 'myTableConfig', record, 0, myTableConfigArr, configName); + } else { /* 从表 */ + this.props.onViewClick(name, 'myTableConfig', record, 0, myTableConfigArr, configName); } } } @@ -556,33 +489,28 @@ export default class CommonComponent extends Component { const { showConfig, record, name } = this.props; this.props.onKeyDown(e, record, showConfig.sName, name); } - }; + } /* CommonList列表onkeydown-F10处理 */ - onKeyDownDiv = e => { + onKeyDownDiv = (e) => { if (this.props.onKeyDown) { this.props.onKeyDown(e); } - if (e.key === "F10") { + if (e.key === 'F10') { message.info(this.props.showConfig.sName); } else if (e.ctrlKey && e.keyCode === 67) { - console.log("复制成功!"); + console.log('复制成功!'); } else if (e.ctrlKey && e.keyCode === 65) { - console.log("全选成功!"); + console.log('全选成功!'); } else { e.preventDefault(); return false; } - }; + } /* 单击右键全部更新,弹出窗选择后,更新此列所有数据 (只更新非只读字段) */ - onContextMenu = e => { - if ( - this.state.enabled && - commonUtils.isNotEmptyObject(this.props) && - this.props.name !== "master" && - commonUtils.isNotEmptyObject(this.props.showConfig) - ) { + onContextMenu = (e) => { + if (this.state.enabled && commonUtils.isNotEmptyObject(this.props) && this.props.name !== 'master' && commonUtils.isNotEmptyObject(this.props.showConfig)) { const { showConfig, name } = this.props; const { bReadonly } = showConfig; if (bReadonly) { @@ -594,47 +522,47 @@ export default class CommonComponent extends Component { this.props.onContextMenu(e, record, showConfig, name); } } - }; + } /* 字段选择弹窗 */ onFieldPopupModal = (showConfig, name, open) => { if (open !== undefined) { this.props.onFieldPopupModal(showConfig, name); } - }; + } /** 获取selectprops对象 */ getSelectProps = () => { /* 返回值声明 */ const obj = { id: `${this.props.showConfig.sName}${this.props.record ? this.props.record.sId : commonUtils.createSid()}`, - showSearch: true /* 是否有查找功能 */, + showSearch: true, /* 是否有查找功能 */ // disabled: !this.state.enabled /* 修改的时候传过来的数据 */ onSelect: () => { - if (this.state.mode !== "multiple") { + if (this.state.mode !== 'multiple') { this.setState({ bDropDownOpen: false, bNotFirstEnter: true }); } }, - onChange: this.handleSelectOptionEvent /* 选择触发事件 */, - filterOption: this.filterOption /* 搜索时过滤对应的 option 属性 */, + onChange: this.handleSelectOptionEvent, /* 选择触发事件 */ + filterOption: this.filterOption, /* 搜索时过滤对应的 option 属性 */ onDropdownVisibleChange: this.onDropdownVisibleChange, onPopupScroll: this.handlePopupScroll, onSearch: this.handleSearch, - notFoundContent: this.state.spinState ? : "暂无数据", + notFoundContent: this.state.spinState ? : '暂无数据', // getPopupContainer: this.props.name === 'slave' || this.props.name === 'searchColumnShow' ? this.getPopupContainer : null,/*解决下拉框不随浏览器滚动问题 */ onFocus: this.onFocus, // onBlur: this.onBlur, - onBlur: e => { + onBlur: (e) => { this.setState({ bDropDownOpen: false, bNotFirstEnter: false }); this.onBlur(e); }, mode: this.state.mode, - onPaste: event => { + onPaste: (event) => { if (this.props.showConfig.bMultipleChoice) { - const clipboardText = event.clipboardData.getData("text/plain").trim(); + const clipboardText = event.clipboardData.getData('text/plain').trim(); if (clipboardText) { - const { dataValue = "" } = this.state; + const { dataValue = '' } = this.state; let dataValueNew = dataValue; - if (dataValueNew === "") { + if (dataValueNew === '') { dataValueNew += clipboardText; } else { dataValueNew += `,${clipboardText}`; @@ -645,30 +573,22 @@ export default class CommonComponent extends Component { } }, }; - if (this.props.showConfig.sDropDownType === "sql") { - obj.optionLabelProp = "title"; + if (this.props.showConfig.sDropDownType === 'sql') { + obj.optionLabelProp = 'title'; } if (this.props.readOnly) { - obj.readOnly = "readOnly"; + obj.readOnly = 'readOnly'; } else { obj.disabled = !this.state.enabled; } obj.placeholder = this.props.showConfig.placeholder; /* 区分Oee设置字体与其他系统设置字体 */ - obj.dropdownStyle = - commonUtils.isNotEmptyObject(location.pathname) && location.pathname.toLowerCase().indexOf("oee") > -1 - ? { fontSize: "1.3rem" } - : { fontSize: "12px" }; - obj.dropdownClassName = - commonUtils.isNotEmptyObject(location.pathname) && location.pathname.toLowerCase().indexOf("oee") > -1 - ? location.pathname.toLowerCase().indexOf("loginoee") > -1 - ? "loginOeeDropDown" - : "oeeDropDown" - : ""; + obj.dropdownStyle = commonUtils.isNotEmptyObject(location.pathname) && location.pathname.toLowerCase().indexOf('oee') > -1 ? { fontSize: '1.3rem' } : { fontSize: '12px' }; + obj.dropdownClassName = commonUtils.isNotEmptyObject(location.pathname) && location.pathname.toLowerCase().indexOf('oee') > -1 ? (location.pathname.toLowerCase().indexOf('loginoee') > -1 ? 'loginOeeDropDown' : 'oeeDropDown') : ''; /* 主表时才赋值value */ if (this.props.bTable) { if (this.props.showConfig.bMultipleChoice) { - obj.value = !commonUtils.isEmpty(this.state.dataValue) ? this.state.dataValue.split(",") : []; /* 数据值 */ + obj.value = !commonUtils.isEmpty(this.state.dataValue) ? this.state.dataValue.split(',') : []; /* 数据值 */ } else { obj.value = this.state.dataValue; /* 数据值 */ } @@ -678,7 +598,7 @@ export default class CommonComponent extends Component { obj.dropdownMatchSelectWidth = false; /* true时 下拉菜单和选择器同宽。默认将设置 min-width,当值小于选择框宽度时会被忽略。 */ obj.dropdownStyle.width = this.props.showConfig.iDropWidth; } - obj.onInputKeyDown = e => { + obj.onInputKeyDown = (e) => { const { bDropDownOpen, bNotFirstEnter } = this.state; if (bDropDownOpen && [38, 40, 13].includes(e.keyCode)) { // eslint-disable-next-line no-console @@ -704,25 +624,17 @@ export default class CommonComponent extends Component { /* 返回值 */ return obj; }; - getLocalizedString = (jsonStr, language) => { - try { - const data = JSON.parse(jsonStr); - return data[language] || ""; - } catch (e) { - console.error("Error parsing JSON:", e); - return ""; - } - }; + getSelectTableProps = () => { const { currentPage, tempCurrentPage, searchValue } = this.state; - const pageNum = searchValue === "" ? currentPage : tempCurrentPage; + const pageNum = searchValue === '' ? currentPage : tempCurrentPage; /* 返回值声明 */ const obj = { id: `${this.props.showConfig.sName}${this.props.record ? this.props.record.sId : commonUtils.createSid()}`, dropdownMatchSelectWidth: false, - filterOption: this.filterOption /* 搜索时过滤对应的 option 属性 */, - onDropdownVisibleChange: open => { + filterOption: this.filterOption, /* 搜索时过滤对应的 option 属性 */ + onDropdownVisibleChange: (open) => { this.onDropdownVisibleChange(open); if (open === false) { clearTimeout(this.blurtimer); @@ -739,47 +651,41 @@ export default class CommonComponent extends Component { // onFocus: this.onFocus, // onBlur: this.onBlur, }; - if (this.props.showConfig.sDropDownType === "sql") { - obj.optionLabelProp = "title"; + if (this.props.showConfig.sDropDownType === 'sql') { + obj.optionLabelProp = 'title'; } if (this.props.readOnly) { - obj.readOnly = "readOnly"; + obj.readOnly = 'readOnly'; } else { obj.disabled = !this.state.enabled; } obj.placeholder = this.props.showConfig.placeholder; /* 区分Oee设置字体与其他系统设置字体 */ - obj.dropdownStyle = - commonUtils.isNotEmptyObject(location.pathname) && location.pathname.toLowerCase().indexOf("oee") > -1 - ? { fontSize: "1.3rem" } - : { fontSize: "12px" }; - obj.dropdownClassName = - commonUtils.isNotEmptyObject(location.pathname) && location.pathname.toLowerCase().indexOf("oee") > -1 - ? location.pathname.toLowerCase().indexOf("loginoee") > -1 - ? "loginOeeDropDown" - : "oeeDropDown" - : ""; + obj.dropdownStyle = commonUtils.isNotEmptyObject(location.pathname) && location.pathname.toLowerCase().indexOf('oee') > -1 ? { fontSize: '1.3rem' } : { fontSize: '12px' }; + obj.dropdownClassName = commonUtils.isNotEmptyObject(location.pathname) && location.pathname.toLowerCase().indexOf('oee') > -1 ? (location.pathname.toLowerCase().indexOf('loginoee') > -1 ? 'loginOeeDropDown' : 'oeeDropDown') : ''; /* 主表时才赋值value */ if (this.props.bTable) { - obj.value = - this.props.showConfig.bMultipleChoice && !commonUtils.isEmpty(this.state.dataValue) - ? this.state.dataValue.split(",") - : this.state.dataValue; /* 数据值 */ + obj.value = this.props.showConfig.bMultipleChoice && !commonUtils.isEmpty(this.state.dataValue) ? this.state.dataValue.split(',') : this.state.dataValue; /* 数据值 */ obj.className = this.props.costomClassName === undefined ? styles.editSelect : this.props.costomClassName; } if (this.props.showConfig.iDropWidth > 0) { obj.dropdownMatchSelectWidth = false; /* true时 下拉菜单和选择器同宽。默认将设置 min-width,当值小于选择框宽度时会被忽略。 */ } - obj.onInputKeyDown = e => { - const { selectTableData = [], selectTableIndex = 0, bDropDownOpen, bNotFirstEnter } = this.state; + obj.onInputKeyDown = (e) => { + const { + selectTableData = [], + selectTableIndex = 0, + bDropDownOpen, + bNotFirstEnter, + } = this.state; const { keyCode } = e; try { if (bDropDownOpen) { - const oTBody = this.selectTableRef1.querySelector(".ant-table-body"); + const oTBody = this.selectTableRef1.querySelector('.ant-table-body'); const { scrollTop } = oTBody; - const oTr = this.selectTableRef1.querySelector(".selected-record-row"); + const oTr = this.selectTableRef1.querySelector('.selected-record-row'); const trRect = oTr.getBoundingClientRect(); const tbodyRect = oTBody.getBoundingClientRect(); @@ -844,7 +750,7 @@ export default class CommonComponent extends Component { }; obj.onKeyUp = this.onKeyUp; /* eslint-disable */ - obj.dropdownRender = menu => ( + obj.dropdownRender = (menu) => ( <> {/*
this.selectTableSearch(e)}/> @@ -852,9 +758,7 @@ export default class CommonComponent extends Component { {menu}
{ - this.bInPagination = true; - }} + onMouseEnter={() => { this.bInPagination = true; }} onMouseLeave={() => { this.bInPagination = false; if (this.selectTableRef) { @@ -862,57 +766,50 @@ export default class CommonComponent extends Component { } }} > - this.selectTableChange(e)} - showSizeChanger={false} - current={pageNum} - pageSize={20} - size="small" - total={this.state.totalCount} - /> + this.selectTableChange(e)} showSizeChanger={false} current={pageNum} pageSize={20} size="small" total={this.state.totalCount} /> {this.props.showConfig.bFirstEmpty && ( - )} + ) + } {this.props.showConfig.bNewRecord && ( - )} + ) + }
- ); + ) /* eslint-enable */ /* 返回值 */ return obj; @@ -920,40 +817,33 @@ export default class CommonComponent extends Component { getSelectTableOption = () => { const { selectTableData, selectTableIndex = 0 } = this.state; - const { showConfig, app } = this.props; - const { userinfo } = app; - let { sTableTitleSql } = showConfig; - /* 根据用户配置语言 设置表格标题 */ - if (commonUtils.isJSON(sTableTitleSql) && sTableTitleSql.includes("Chinese")) { - sTableTitleSql = this.getLocalizedString(sTableTitleSql, userinfo.sLanguage); - } - const tempColumnArr = sTableTitleSql.split(","); + const { showConfig } = this.props; + const { sTableTitleSql } = showConfig; + const tempColumnArr = sTableTitleSql.split(','); let scrollX = 0; const columns = tempColumnArr.map((item, index) => { - const tempArr = item.split(":"); + const tempArr = item.split(':'); const [value, title, columnWidth] = tempArr; let width; - if (!Number.isNaN(Number(columnWidth))) { - // 如果配置了列宽 + if (!Number.isNaN(Number(columnWidth))) { // 如果配置了列宽 width = Number(columnWidth); - } else { - // 没有配置列宽,就根据字符数算宽度 + } else { // 没有配置列宽,就根据字符数算宽度 // 获取中文字数、非中文字数, 中文12px,其它8px const titleStr = title; const totalStringLen = titleStr.length; - const otherStrLen = titleStr.replace(/[^\x00-\xff]/g, "").length; // eslint-disable-line + const otherStrLen = titleStr.replace(/[^\x00-\xff]/g, '').length; // eslint-disable-line const chineseStrLen = totalStringLen - otherStrLen; - const defaultWidth = chineseStrLen * 12 + otherStrLen * 8; + const defaultWidth = (chineseStrLen * 12) + (otherStrLen * 8); const maxStrLen = selectTableData.reduce((res, pre) => { - let tempValue = pre[value] !== undefined ? pre[value] : ""; - if (tempValue === "") { + let tempValue = pre[value] !== undefined ? pre[value] : ''; + if (tempValue === '') { return res; } - tempValue = typeof tempValue === "string" ? tempValue : JSON.stringify(tempValue); + tempValue = typeof tempValue === 'string' ? tempValue : JSON.stringify(tempValue); const totalStringLen = tempValue.length; - const otherStrLen = tempValue.replace(/[^\x00-\xff]/g, "").length; // eslint-disable-line + const otherStrLen = tempValue.replace(/[^\x00-\xff]/g, '').length; // eslint-disable-line const chineseStrLen = totalStringLen - otherStrLen; - const tempWidth = chineseStrLen * 12 + otherStrLen * 8; + const tempWidth = (chineseStrLen * 12) + (otherStrLen * 8); return Math.max(tempWidth, res); }, defaultWidth); width = Math.min(maxStrLen + 8, 300); @@ -966,29 +856,20 @@ export default class CommonComponent extends Component { dataIndex: value, key: value, width: index !== tempColumnArr.length - 1 ? width : undefined, - render: text => { - return ( - - {text} - - ); + render: (text) => { + return ({text}); }, }; }); return (