Merge branch 'dev' into feature/CF2-87-Archive-page-redesign

This commit is contained in:
goodmice 2021-11-17 14:16:29 +05:00
commit 70a7812e81
14 changed files with 416 additions and 103 deletions

159
package-lock.json generated
View File

@ -42,14 +42,32 @@
} }
}, },
"@apidevtools/json-schema-ref-parser": { "@apidevtools/json-schema-ref-parser": {
"version": "9.0.7", "version": "9.0.9",
"resolved": "https://registry.npmjs.org/@apidevtools/json-schema-ref-parser/-/json-schema-ref-parser-9.0.7.tgz", "resolved": "https://registry.npmjs.org/@apidevtools/json-schema-ref-parser/-/json-schema-ref-parser-9.0.9.tgz",
"integrity": "sha512-QdwOGF1+eeyFh+17v2Tz626WX0nucd1iKOm6JUTUvCZdbolblCOOQCxGrQPY0f7jEhn36PiAWqZnsC2r5vmUWg==", "integrity": "sha512-GBD2Le9w2+lVFoc4vswGI/TjkNIZSVp7+9xPf+X3uidBfWnAeUWmquteSyt0+VCrhNMWj/FTABISQrD3Z/YA+w==",
"dev": true, "dev": true,
"requires": { "requires": {
"@jsdevtools/ono": "^7.1.3", "@jsdevtools/ono": "^7.1.3",
"@types/json-schema": "^7.0.6",
"call-me-maybe": "^1.0.1", "call-me-maybe": "^1.0.1",
"js-yaml": "^3.13.1" "js-yaml": "^4.1.0"
},
"dependencies": {
"argparse": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
"dev": true
},
"js-yaml": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
"integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
"dev": true,
"requires": {
"argparse": "^2.0.1"
}
}
} }
}, },
"@babel/code-frame": { "@babel/code-frame": {
@ -2416,9 +2434,9 @@
"integrity": "sha512-1z8k4wzFnNjVK/tlxvrWuK5WMt6mydWWP7+zvH5eFep4oj+UkrfiJTRtjCeBXNpwaA/FYqqtb4/QS4ianFpIRA==" "integrity": "sha512-1z8k4wzFnNjVK/tlxvrWuK5WMt6mydWWP7+zvH5eFep4oj+UkrfiJTRtjCeBXNpwaA/FYqqtb4/QS4ianFpIRA=="
}, },
"@types/minimist": { "@types/minimist": {
"version": "1.2.1", "version": "1.2.2",
"resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.1.tgz", "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.2.tgz",
"integrity": "sha512-fZQQafSREFyuZcdWFAExYjBiCL7AUCdgsk80iO0q4yihYYdcIiH28CcuPTGFgLOCC8RlW49GSQxdHwZP+I7CNg==", "integrity": "sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==",
"dev": true "dev": true
}, },
"@types/node": { "@types/node": {
@ -7335,6 +7353,12 @@
"resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz",
"integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==" "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA=="
}, },
"globalyzer": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/globalyzer/-/globalyzer-0.1.0.tgz",
"integrity": "sha512-40oNTM9UfG6aBmuKxk/giHn5nQ8RVz/SS4Ir6zgzOv9/qC3kKZ9v4etGTcJbEl/NyVQH7FGU7d+X1egr57Md2Q==",
"dev": true
},
"globby": { "globby": {
"version": "11.0.3", "version": "11.0.3",
"resolved": "https://registry.npmjs.org/globby/-/globby-11.0.3.tgz", "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.3.tgz",
@ -7348,6 +7372,12 @@
"slash": "^3.0.0" "slash": "^3.0.0"
} }
}, },
"globrex": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/globrex/-/globrex-0.1.2.tgz",
"integrity": "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==",
"dev": true
},
"graceful-fs": { "graceful-fs": {
"version": "4.2.6", "version": "4.2.6",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz",
@ -9891,12 +9921,12 @@
"integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM="
}, },
"json-schema-ref-parser": { "json-schema-ref-parser": {
"version": "9.0.7", "version": "9.0.9",
"resolved": "https://registry.npmjs.org/json-schema-ref-parser/-/json-schema-ref-parser-9.0.7.tgz", "resolved": "https://registry.npmjs.org/json-schema-ref-parser/-/json-schema-ref-parser-9.0.9.tgz",
"integrity": "sha512-uxU9Ix+MVszvCTvBucQiIcNEny3oAEFg7EQHSZw2bquCCuqUqEPEczIdv/Uqo1Zv4/wDPZqOI+ulrMk1ncMtjQ==", "integrity": "sha512-qcP2lmGy+JUoQJ4DOQeLaZDqH9qSkeGCK3suKWxJXS82dg728Mn3j97azDMaOUmJAN4uCq91LdPx4K7E8F1a7Q==",
"dev": true, "dev": true,
"requires": { "requires": {
"@apidevtools/json-schema-ref-parser": "9.0.7" "@apidevtools/json-schema-ref-parser": "9.0.9"
} }
}, },
"json-schema-traverse": { "json-schema-traverse": {
@ -10245,9 +10275,9 @@
"integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=" "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8="
}, },
"map-obj": { "map-obj": {
"version": "4.2.0", "version": "4.3.0",
"resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.2.0.tgz", "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz",
"integrity": "sha512-NAq0fCmZYGz9UFEQyndp7sisrow4GroyGeKluyKC/chuITZsPyOyC1UJZPJlVFImhXdROIP5xqouRLThT3BbpQ==", "integrity": "sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ==",
"dev": true "dev": true
}, },
"map-visit": { "map-visit": {
@ -10340,14 +10370,23 @@
"lru-cache": "^6.0.0" "lru-cache": "^6.0.0"
} }
}, },
"is-core-module": {
"version": "2.8.0",
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.0.tgz",
"integrity": "sha512-vd15qHsaqrRL7dtH6QNuy0ndJmRDrS9HAM1CAiSifNUFv4x1a0CCVsj18hJ1mShxIG6T2i1sO78MkP56r0nYRw==",
"dev": true,
"requires": {
"has": "^1.0.3"
}
},
"normalize-package-data": { "normalize-package-data": {
"version": "3.0.2", "version": "3.0.3",
"resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-3.0.2.tgz", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-3.0.3.tgz",
"integrity": "sha512-6CdZocmfGaKnIHPVFhJJZ3GuR8SsLKvDANFp47Jmy51aKIr8akjAWTSxtpI+MBgBFdSMRyo4hMpDlT6dTffgZg==", "integrity": "sha512-p2W1sgqij3zMMyRC067Dg16bfzVH+w7hyegmpIvZ4JNjqtGOVAIvLmjBx3yP7YTe9vKJgkoNOPjwQGogDoMXFA==",
"dev": true, "dev": true,
"requires": { "requires": {
"hosted-git-info": "^4.0.1", "hosted-git-info": "^4.0.1",
"resolve": "^1.20.0", "is-core-module": "^2.5.0",
"semver": "^7.3.4", "semver": "^7.3.4",
"validate-npm-package-license": "^3.0.1" "validate-npm-package-license": "^3.0.1"
} }
@ -10365,8 +10404,9 @@
}, },
"dependencies": { "dependencies": {
"hosted-git-info": { "hosted-git-info": {
"version": "2.8.8", "version": "2.8.9",
"resolved": "", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz",
"integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==",
"dev": true "dev": true
}, },
"normalize-package-data": { "normalize-package-data": {
@ -10414,16 +10454,6 @@
} }
} }
}, },
"resolve": {
"version": "1.20.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz",
"integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==",
"dev": true,
"requires": {
"is-core-module": "^2.2.0",
"path-parse": "^1.0.6"
}
},
"semver": { "semver": {
"version": "7.3.5", "version": "7.3.5",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz",
@ -10440,9 +10470,9 @@
"dev": true "dev": true
}, },
"yargs-parser": { "yargs-parser": {
"version": "20.2.7", "version": "20.2.9",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.7.tgz", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz",
"integrity": "sha512-FiNkvbeHzB/syOjIUxFDCnhSfzAL8R5vs40MgLFBorXACCOAEaWu0gRZl14vG8MR9AOJIZbmkjhusqBYZ3HTHw==", "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==",
"dev": true "dev": true
} }
} }
@ -11184,16 +11214,18 @@
} }
}, },
"openapi-typescript": { "openapi-typescript": {
"version": "3.2.0", "version": "3.4.1",
"resolved": "https://registry.npmjs.org/openapi-typescript/-/openapi-typescript-3.2.0.tgz", "resolved": "https://registry.npmjs.org/openapi-typescript/-/openapi-typescript-3.4.1.tgz",
"integrity": "sha512-7tdJ5iL9dpk7/1njKp5Oh3Ue1uYoes5kv87JmYgH6fgC7EcrJxyp328SwQnQUg9+fF+nhMNYhZ4SJ0zK8z+Udg==", "integrity": "sha512-d84pa1OLdL9lHByP9NdxGFfEnUxletlGbUZgsLl4WUb0I3izIMOr5JCJVLTOeBdOfgYkUI/+q2rhTkZK9bkGzA==",
"dev": true, "dev": true,
"requires": { "requires": {
"js-yaml": "^4.0.0", "hosted-git-info": "^3.0.8",
"kleur": "^4.1.3", "js-yaml": "^4.1.0",
"kleur": "^4.1.4",
"meow": "^9.0.0", "meow": "^9.0.0",
"mime": "^2.5.2", "mime": "^2.5.2",
"prettier": "^2.2.1" "prettier": "^2.3.0",
"tiny-glob": "^0.2.9"
}, },
"dependencies": { "dependencies": {
"argparse": { "argparse": {
@ -11202,10 +11234,19 @@
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
"dev": true "dev": true
}, },
"hosted-git-info": {
"version": "3.0.8",
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-3.0.8.tgz",
"integrity": "sha512-aXpmwoOhRBrw6X3j0h5RloK4x1OzsxMPyxqIHyNfSe2pypkVTZFpEiRoSipPEPlMrh0HW/XsjkJ5WgnCirpNUw==",
"dev": true,
"requires": {
"lru-cache": "^6.0.0"
}
},
"js-yaml": { "js-yaml": {
"version": "4.0.0", "version": "4.1.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.0.0.tgz", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
"integrity": "sha512-pqon0s+4ScYUvX30wxQi3PogGFAlUyH0awepWvwkj4jD4v+ova3RiYw8bmA6x2rDrEaj8i/oWKoRxpVNW+Re8Q==", "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
"dev": true, "dev": true,
"requires": { "requires": {
"argparse": "^2.0.1" "argparse": "^2.0.1"
@ -11218,9 +11259,9 @@
"dev": true "dev": true
}, },
"mime": { "mime": {
"version": "2.5.2", "version": "2.6.0",
"resolved": "https://registry.npmjs.org/mime/-/mime-2.5.2.tgz", "resolved": "https://registry.npmjs.org/mime/-/mime-2.6.0.tgz",
"integrity": "sha512-tqkh47FzKeCPD2PUiPB6pkbMzsCasjxAfC62/Wap5qrUWcb+sFasXUC5I3gYM5iBM8v/Qpn4UK0x+j0iHyFPDg==", "integrity": "sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==",
"dev": true "dev": true
} }
} }
@ -11253,9 +11294,9 @@
"dev": true "dev": true
}, },
"js-yaml": { "js-yaml": {
"version": "4.0.0", "version": "4.1.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.0.0.tgz", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
"integrity": "sha512-pqon0s+4ScYUvX30wxQi3PogGFAlUyH0awepWvwkj4jD4v+ova3RiYw8bmA6x2rDrEaj8i/oWKoRxpVNW+Re8Q==", "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
"dev": true, "dev": true,
"requires": { "requires": {
"argparse": "^2.0.1" "argparse": "^2.0.1"
@ -12703,9 +12744,9 @@
"integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=" "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw="
}, },
"prettier": { "prettier": {
"version": "2.2.1", "version": "2.4.1",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.2.1.tgz", "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.4.1.tgz",
"integrity": "sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==", "integrity": "sha512-9fbDAXSBcc6Bs1mZrDYb3XKzDLm4EXXL9sC1LqKP5rZkT6KRr/rf9amVUcODVXgguK/isJz0d0hP72WeaKWsvA==",
"dev": true "dev": true
}, },
"pretty-bytes": { "pretty-bytes": {
@ -15655,6 +15696,16 @@
"resolved": "https://registry.npmjs.org/timsort/-/timsort-0.3.0.tgz", "resolved": "https://registry.npmjs.org/timsort/-/timsort-0.3.0.tgz",
"integrity": "sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q=" "integrity": "sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q="
}, },
"tiny-glob": {
"version": "0.2.9",
"resolved": "https://registry.npmjs.org/tiny-glob/-/tiny-glob-0.2.9.tgz",
"integrity": "sha512-g/55ssRPUjShh+xkfx9UPDXqhckHEsHr4Vd9zX55oSdGZc/MD0m3sferOkwWtp98bv+kcVfEHtRJgBVJzelrzg==",
"dev": true,
"requires": {
"globalyzer": "0.1.0",
"globrex": "^0.1.2"
}
},
"tiny-invariant": { "tiny-invariant": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.1.0.tgz", "resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.1.0.tgz",
@ -15871,9 +15922,9 @@
"integrity": "sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw==" "integrity": "sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw=="
}, },
"uglify-js": { "uglify-js": {
"version": "3.13.3", "version": "3.14.3",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.13.3.tgz", "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.14.3.tgz",
"integrity": "sha512-otIc7O9LyxpUcQoXzj2hL4LPWKklO6LJWoJUzNa8A17Xgi4fOeDC8FBDOLHnC/Slo1CQgsZMcM6as0M76BZaig==", "integrity": "sha512-mic3aOdiq01DuSVx0TseaEzMIVqebMZ0Z3vaeDhFEh9bsc24hV1TFvN74reA2vs08D0ZWfNjAcJ3UbVLaBss+g==",
"dev": true, "dev": true,
"optional": true "optional": true
}, },

View File

@ -27,12 +27,14 @@
"start": "craco start", "start": "craco start",
"build": "craco build", "build": "craco build",
"test": "craco test", "test": "craco test",
"update_openapi":"npx openapi -i http://127.0.0.1:5000/swagger/v1/swagger.json -o src/services/api",
"update_openapi_server":"npx openapi -i http://192.168.1.70:5000/swagger/v1/swagger.json -o src/services/api",
"react_start": "react-scripts start", "react_start": "react-scripts start",
"react_build": "react-scripts build", "react_build": "react-scripts build",
"react_test": "react-scripts test", "react_test": "react-scripts test",
"eject": "react-scripts eject" "eject": "react-scripts eject"
}, },
"proxy": "http://192.168.1.70:5000", "proxy": "http://192.168.1.58:5000",
"eslintConfig": { "eslintConfig": {
"extends": [ "extends": [
"react-app", "react-app",
@ -53,7 +55,7 @@
}, },
"devDependencies": { "devDependencies": {
"@types/react": "^17.0.3", "@types/react": "^17.0.3",
"openapi-typescript": "^3.2.0", "openapi-typescript": "^3.4.1",
"openapi-typescript-codegen": "^0.9.3" "openapi-typescript-codegen": "^0.9.3"
} }
} }

25
src/components/Mark.jsx Normal file
View File

@ -0,0 +1,25 @@
import {Tooltip, Tag, Typography, Popconfirm, Button } from 'antd'
import {UserView} from './UserView'
const markTypes = {
0 : {color:"orange", text : "неизвестно"},
1 : {color:"green", text : "согласовано"},
}
const {Text} = Typography
export const Mark = ({mark, onDelete}) => {
const markType = markTypes[mark.idMarkType]??markTypes[0]
return <Tooltip title={<UserView user={mark.user}/>}>
<Tag color={markType.color}>
<Text delete={mark?.isDeleted}>
{`${markType.text} ${new Date(mark.dateCreated).toLocaleString()}`}
</Text>
{(!mark?.isDeleted)&&
<Popconfirm title="Отозвать согласование?" onConfirm={onDelete}>
<Button type="link">x</Button>
</Popconfirm>
}
</Tag >
</Tooltip>
}

View File

@ -201,7 +201,7 @@ export const ChartTimeBase: React.FC<ChartTimeBaseProps> = ({options, dataParams
let thisOptions = {} let thisOptions = {}
Object.assign(thisOptions, defaultOptions, options) Object.assign(thisOptions, defaultOptions, options)
let newChart = new Chart(chartRef.current, { let newChart = new Chart(chartRef.current ?? "", {
type: 'line', type: 'line',
plugins: [ChartDataLabels], plugins: [ChartDataLabels],
options: thisOptions, options: thisOptions,

View File

@ -17,7 +17,7 @@ const pageSize = 12
const { RangePicker } = DatePicker const { RangePicker } = DatePicker
const { Search } = Input const { Search } = Input
export default function DocumentsTemplate({ idCategory, idWell, accept, headerChild, onChange }) { export default function DocumentsTemplate({ idCategory, idWell, accept, headerChild, customColumns, beforeTable, onChange}) {
const [page, setPage] = useState(1) const [page, setPage] = useState(1)
const [filterDataRange, setFilterDataRange] = useState([]) const [filterDataRange, setFilterDataRange] = useState([])
const [filterCompanyName, setFilterCompanyName] = useState([]) const [filterCompanyName, setFilterCompanyName] = useState([])
@ -79,6 +79,7 @@ export default function DocumentsTemplate({ idCategory, idWell, accept, headerCh
key: "company", key: "company",
render: (_, record) => <CompanyView company={record?.author?.company}/> render: (_, record) => <CompanyView company={record?.author?.company}/>
}, },
...(customColumns??[])
] ]
const update = () => { const update = () => {
@ -174,7 +175,7 @@ export default function DocumentsTemplate({ idCategory, idWell, accept, headerCh
&nbsp;&nbsp; &nbsp;&nbsp;
{headerChild} {headerChild}
</div> </div>
{beforeTable}
<EditableTable <EditableTable
columns={columns} columns={columns}
dataSource={files} dataSource={files}

View File

@ -1,19 +1,24 @@
import {Button, Tooltip} from 'antd' import {Popconfirm, Button, Tooltip, Typography} from 'antd'
import { FileExcelOutlined } from '@ant-design/icons' import { FileExcelOutlined } from '@ant-design/icons'
import { useEffect, useState } from "react" import { useEffect, useState } from "react"
import {invokeWebApiWrapperAsync, download} from '../../components/factory' import {invokeWebApiWrapperAsync, download, formatBytes} from '../../components/factory'
import DocumentsTemplate from './DocumentsTemplate' import DocumentsTemplate from './DocumentsTemplate'
import LoaderPortal from '../../components/LoaderPortal' import LoaderPortal from '../../components/LoaderPortal'
import { Flex } from '../../components/Grid' import { Flex } from '../../components/Grid'
import {DrillingProgramService, WellService} from '../../services/api' import {DrillingProgramService, WellService} from '../../services/api'
import {Mark} from '../../components/Mark'
import {UserView} from '../../components/UserView'
const idFileCategoryDrillingProgramItems = 13; const idFileCategoryDrillingProgramItems = 13;
const {Text} = Typography
export default function DrillingProgram({idWell}) { export default function DrillingProgram({idWell}) {
const [downloadButtonEnabled, selDownloadButtonEnabled] = useState(false) const [downloadButtonEnabled, selDownloadButtonEnabled] = useState(false)
const [showLoader, setShowLoader] = useState(false) const [showLoader, setShowLoader] = useState(false)
const [tooltip, setTooltip] = useState('нет файлов для формирования') const [tooltip, setTooltip] = useState('нет файлов для формирования')
const [wellLabel, setWellLabel] = useState(`${idWell}`) const [wellLabel, setWellLabel] = useState(`${idWell}`)
const [childKey, setChildKey] = useState();
const [lastUpdatedFile, setLastUpdatedFile] = useState();
useEffect(() => invokeWebApiWrapperAsync( useEffect(() => invokeWebApiWrapperAsync(
async () => { async () => {
@ -33,8 +38,11 @@ export default function DrillingProgram({idWell}) {
"Не удалось загрузить программу бурения") "Не удалось загрузить программу бурения")
const openProgramPreview = () => invokeWebApiWrapperAsync(async()=>{ const openProgramPreview = () => invokeWebApiWrapperAsync(async()=>{
const filWebUrl = await DrillingProgramService.getFileWebLink(idWell) const filWebUrl = await DrillingProgramService.getOrCreateSharedUrl(idWell)
window.open(filWebUrl, '_blank') if(filWebUrl && filWebUrl.length > 0)
window.open(filWebUrl, '_blank');
else
throw new Error("Сервер вернул плохую ссылку")
}, },
setShowLoader, setShowLoader,
"Не удалось создать быстрый просмотр программы") "Не удалось создать быстрый просмотр программы")
@ -46,13 +54,53 @@ export default function DrillingProgram({idWell}) {
return return
} }
if(files.every(fileInfo => fileInfo?.name.toLowerCase().endsWith('.xlsx'))){ const isAllFilesAreExcel = files.every(fileInfo => fileInfo?.name.toLowerCase().endsWith('.xlsx'))
const isAnyFileMarked = files.some(file => file?.fileMarks.some(m => m?.idMarkType === 1 && !m?.isDeleted))
if(isAllFilesAreExcel && isAnyFileMarked){
setTooltip('Программа доступна для скачивания') setTooltip('Программа доступна для скачивания')
selDownloadButtonEnabled(true) selDownloadButtonEnabled(true)
} }
else{ else{
setTooltip('Список файлов содержит недопустимые типы файлов') setTooltip('Список файлов содержит недопустимые типы файлов')
} }
const last = files.reduce((pre, cur) => pre.uploadDate > cur.uploadDate ? pre : cur)
setLastUpdatedFile(last);
}
const customColumns = [
{
title: "Метки",
key: "fileMarks",
render: (_, record) => renderMarksColumn(record?.id, record?.fileMarks)
},
]
const renderMarksColumn=(idFile, marks)=>{
const validMarks = marks?.filter(m => !(m?.isDeleted))
if(validMarks?.length)
return validMarks.map(mark => <Mark mark = {mark} onDelete={() => deleteMark(mark.id)}/>)
return true &&
<Popconfirm title="Согласовать файл?" onConfirm={() => addMarkToFile(idFile)}>
<Button type="link">Согласовать</Button>
</Popconfirm>
}
const addMarkToFile = async (idFile) => {
const mark = {
idFile: idFile,
idMarkType: 1,
isDeleted:false,
comment: ''}
await DrillingProgramService.createFileMark(idWell, mark)
selDownloadButtonEnabled(true)
setChildKey(Date.now())
}
const deleteMark = async (idMark) => {
await DrillingProgramService.deleteFileMark(idWell, idMark)
setChildKey(Date.now())
} }
const downloadButton = <div> const downloadButton = <div>
@ -66,32 +114,40 @@ export default function DrillingProgram({idWell}) {
Сформировать и скачать Сформировать и скачать
</Button> </Button>
</Tooltip> </Tooltip>
<Tooltip title={tooltip}> <Tooltip title="Просмотреть через GoogleDrive">
<Button <Popconfirm
type="link" title="Загрузить файл на GoogleDrive для просмотра?"
onClick={downloadProgram} onConfirm={openProgramPreview}
disabled={!downloadButtonEnabled}> disabled={!downloadButtonEnabled}>
<FileExcelOutlined /> <Button
Программа бурения {wellLabel}.xlsx type="link"
</Button>
</Tooltip>
<Tooltip title="Перед просмотром программы бурения сначала сформируйте ее.">
<Button
type="primary"
onClick={openProgramPreview}
disabled={!downloadButtonEnabled}> disabled={!downloadButtonEnabled}>
Сформировать и просмотреть <FileExcelOutlined />
</Button> Программа бурения {wellLabel}.xlsx
</Button>
</Popconfirm>
</Tooltip> </Tooltip>
</Flex> </Flex>
</div> </div>
const lastUpdatedFileView = lastUpdatedFile &&
<Text type="secondary">
<b>Последнее изменние:</b>
&nbsp;"{lastUpdatedFile.name}"
&nbsp;[{formatBytes(lastUpdatedFile.size)}]
&nbsp;загружен: {new Date(lastUpdatedFile.uploadDate).toLocaleString()}
&nbsp;автор: <UserView user={lastUpdatedFile.author}/>
</Text>
return(<LoaderPortal show={showLoader}> return(<LoaderPortal show={showLoader}>
<DocumentsTemplate <DocumentsTemplate
beforeTable={lastUpdatedFileView}
idWell={idWell} idWell={idWell}
idCategory={idFileCategoryDrillingProgramItems} idCategory={idFileCategoryDrillingProgramItems}
accept='.xlsx' accept='.xlsx'
headerChild={downloadButton} headerChild={downloadButton}
onChange={filesUpdated} /> onChange={filesUpdated}
customColumns = {customColumns}
key = {childKey}/>
</LoaderPortal>) </LoaderPortal>)
} }

View File

@ -17,6 +17,7 @@ export type { DrillParamsDto } from './models/DrillParamsDto';
export type { EventDto } from './models/EventDto'; export type { EventDto } from './models/EventDto';
export type { FileInfoDto } from './models/FileInfoDto'; export type { FileInfoDto } from './models/FileInfoDto';
export type { FileInfoDtoPaginationContainer } from './models/FileInfoDtoPaginationContainer'; export type { FileInfoDtoPaginationContainer } from './models/FileInfoDtoPaginationContainer';
export type { FileMarkDto } from './models/FileMarkDto';
export type { FilePublishInfoDto } from './models/FilePublishInfoDto'; export type { FilePublishInfoDto } from './models/FilePublishInfoDto';
export type { MeasureDto } from './models/MeasureDto'; export type { MeasureDto } from './models/MeasureDto';
export type { MessageDto } from './models/MessageDto'; export type { MessageDto } from './models/MessageDto';
@ -69,6 +70,7 @@ export { FileService } from './services/FileService';
export { MeasureService } from './services/MeasureService'; export { MeasureService } from './services/MeasureService';
export { MessageService } from './services/MessageService'; export { MessageService } from './services/MessageService';
export { ReportService } from './services/ReportService'; export { ReportService } from './services/ReportService';
export { RequerstTrackerService } from './services/RequerstTrackerService';
export { TelemetryAnalyticsService } from './services/TelemetryAnalyticsService'; export { TelemetryAnalyticsService } from './services/TelemetryAnalyticsService';
export { TelemetryDataSaubService } from './services/TelemetryDataSaubService'; export { TelemetryDataSaubService } from './services/TelemetryDataSaubService';
export { TelemetryDataSpinService } from './services/TelemetryDataSpinService'; export { TelemetryDataSpinService } from './services/TelemetryDataSpinService';

View File

@ -2,6 +2,7 @@
/* tslint:disable */ /* tslint:disable */
/* eslint-disable */ /* eslint-disable */
import type { FileMarkDto } from './FileMarkDto';
import type { FilePublishInfoDto } from './FilePublishInfoDto'; import type { FilePublishInfoDto } from './FilePublishInfoDto';
import type { UserDto } from './UserDto'; import type { UserDto } from './UserDto';
@ -15,4 +16,5 @@ export type FileInfoDto = {
size?: number; size?: number;
publishInfo?: FilePublishInfoDto; publishInfo?: FilePublishInfoDto;
author?: UserDto; author?: UserDto;
fileMarks?: Array<FileMarkDto> | null;
} }

View File

@ -0,0 +1,15 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { UserDto } from './UserDto';
export type FileMarkDto = {
id?: number;
idFile?: number;
idMarkType?: number;
dateCreated?: string;
comment?: string | null;
isDeleted?: boolean;
user?: UserDto;
}

View File

@ -3,10 +3,9 @@
/* eslint-disable */ /* eslint-disable */
export type TelemetryDataSaubDto = { export type TelemetryDataSaubDto = {
id?: number; idTelemetry?: number;
date?: string; date?: string;
mode?: number | null; mode?: number | null;
idTelemetry?: number;
user?: string | null; user?: string | null;
wellDepth?: number | null; wellDepth?: number | null;
bitDepth?: number | null; bitDepth?: number | null;

View File

@ -3,7 +3,6 @@
/* eslint-disable */ /* eslint-disable */
export type TelemetryDataSpinDto = { export type TelemetryDataSpinDto = {
id?: number;
idTelemetry?: number; idTelemetry?: number;
date?: string; date?: string;
topDriveSpeed?: number | null; topDriveSpeed?: number | null;

View File

@ -1,6 +1,7 @@
/* istanbul ignore file */ /* istanbul ignore file */
/* tslint:disable */ /* tslint:disable */
/* eslint-disable */ /* eslint-disable */
import type { FileMarkDto } from '../models/FileMarkDto';
import { request as __request } from '../core/request'; import { request as __request } from '../core/request';
export class DrillingProgramService { export class DrillingProgramService {
@ -22,12 +23,12 @@ export class DrillingProgramService {
} }
/** /**
* Возвращает ссылку на файл программы бурения в облаке * Создает программу бурения
* @param idWell id скважины * @param idWell id скважины
* @returns string Success * @returns string Success
* @throws ApiError * @throws ApiError
*/ */
public static async getFileWebLink( public static async getOrCreateSharedUrl(
idWell: number, idWell: number,
): Promise<string> { ): Promise<string> {
const result = await __request({ const result = await __request({
@ -37,4 +38,44 @@ export class DrillingProgramService {
return result.body; return result.body;
} }
/**
* Создает метку для файла входящего в проргамму бурения
* @param idWell id скважины
* @param requestBody метка файла
* @returns any Success
* @throws ApiError
*/
public static async createFileMark(
idWell: number,
requestBody?: FileMarkDto,
): Promise<any> {
const result = await __request({
method: 'POST',
path: `/api/well/${idWell}/drillingProgram/fileMark`,
body: requestBody,
});
return result.body;
}
/**
* Помечает метку у файла входящего, в проргамму бурения, как удаленную
* @param idWell id скважины
* @param idMark id метки
* @returns number Success
* @throws ApiError
*/
public static async deleteFileMark(
idWell: number,
idMark?: number,
): Promise<number> {
const result = await __request({
method: 'DELETE',
path: `/api/well/${idWell}/drillingProgram/fileMark`,
query: {
'idMark': idMark,
},
});
return result.body;
}
} }

View File

@ -1,8 +1,8 @@
/* istanbul ignore file */ /* istanbul ignore file */
/* tslint:disable */ /* tslint:disable */
/* eslint-disable */ /* eslint-disable */
import type { FileInfoDto } from '../models/FileInfoDto';
import type { FileInfoDtoPaginationContainer } from '../models/FileInfoDtoPaginationContainer'; import type { FileInfoDtoPaginationContainer } from '../models/FileInfoDtoPaginationContainer';
import type { FileMarkDto } from '../models/FileMarkDto';
import { request as __request } from '../core/request'; import { request as __request } from '../core/request';
export class FileService { export class FileService {
@ -70,24 +70,6 @@ export class FileService {
return result.body; return result.body;
} }
/**
* Возвращает информацию о файлах для скважины в выбраной категории
* @param idWell id скважины
* @param idCategory id категории файла
* @returns FileInfoDto Success
* @throws ApiError
*/
public static async getInfosByCategory(
idWell: number,
idCategory: number,
): Promise<Array<FileInfoDto>> {
const result = await __request({
method: 'GET',
path: `/api/well/${idWell}/files/category/${idCategory}`,
});
return result.body;
}
/** /**
* Возвращает файл с диска на сервере * Возвращает файл с диска на сервере
* @param idWell id скважины * @param idWell id скважины
@ -124,4 +106,44 @@ export class FileService {
return result.body; return result.body;
} }
/**
* Создает метку для файла
* @param idWell id скважины
* @param requestBody метка файла
* @returns any Success
* @throws ApiError
*/
public static async createFileMark(
idWell: number,
requestBody?: FileMarkDto,
): Promise<any> {
const result = await __request({
method: 'POST',
path: `/api/well/${idWell}/files/fileMark`,
body: requestBody,
});
return result.body;
}
/**
* Помечает метку у файла как удаленную
* @param idWell id скважины
* @param idMark id метки
* @returns number Success
* @throws ApiError
*/
public static async deleteFileMark(
idWell: number,
idMark?: number,
): Promise<number> {
const result = await __request({
method: 'DELETE',
path: `/api/well/${idWell}/files/fileMark`,
query: {
'idMark': idMark,
},
});
return result.body;
}
} }

View File

@ -0,0 +1,98 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import { request as __request } from '../core/request';
export class RequerstTrackerService {
/**
* @param take
* @returns any Success
* @throws ApiError
*/
public static async getAll(
take: number = 512,
): Promise<any> {
const result = await __request({
method: 'GET',
path: `/api/RequerstTracker`,
query: {
'take': take,
},
});
return result.body;
}
/**
* @param take
* @returns any Success
* @throws ApiError
*/
public static async getFast(
take: number = 512,
): Promise<any> {
const result = await __request({
method: 'GET',
path: `/api/RequerstTracker/fast`,
query: {
'take': take,
},
});
return result.body;
}
/**
* @param take
* @returns any Success
* @throws ApiError
*/
public static async getSlow(
take: number = 512,
): Promise<any> {
const result = await __request({
method: 'GET',
path: `/api/RequerstTracker/slow`,
query: {
'take': take,
},
});
return result.body;
}
/**
* @param take
* @returns any Success
* @throws ApiError
*/
public static async getError(
take: number = 512,
): Promise<any> {
const result = await __request({
method: 'GET',
path: `/api/RequerstTracker/error`,
query: {
'take': take,
},
});
return result.body;
}
/**
* @param take
* @returns any Success
* @throws ApiError
*/
public static async getUsersStat(
take: number = 512,
): Promise<any> {
const result = await __request({
method: 'GET',
path: `/api/RequerstTracker/users`,
query: {
'take': take,
},
});
return result.body;
}
}