diff --git a/.env.development b/.env.development index bbcf73c6f0b65929be28eaffa1040cfe4766c9b0..053a7e391875df47812f428f8833f73cde9630f9 100644 --- a/.env.development +++ b/.env.development @@ -1,4 +1,4 @@ # 配置文档参考 https://taro-docs.jd.com/docs/next/env-mode-config # TARO_APP_ID="开发环境下的小程序appid" -TARO_APP_ID="wxc0e4cfce130fe788" \ No newline at end of file +TARO_APP_ID="wx43d3e4316396041c" \ No newline at end of file diff --git a/.env.production b/.env.production index 3e24617bb659c0d5bab11431966d71caa31c97a6..517127640ecc9b825f8a0275a63bd21c242d4a38 100644 --- a/.env.production +++ b/.env.production @@ -1,3 +1,3 @@ # TARO_APP_ID="生产环境下的小程序appid" -TARO_APP_ID="wxc0e4cfce130fe788" \ No newline at end of file +TARO_APP_ID="wx43d3e4316396041c" \ No newline at end of file diff --git a/.env.test b/.env.test index 0fcf1e5a29a86bf3c4df0cad1827d2b5d664bfcd..87ef691f2043d7d9563158ba641f34b559e2c2a8 100644 --- a/.env.test +++ b/.env.test @@ -1,3 +1,3 @@ # TARO_APP_ID="测试环境下的小程序appid" -TARO_APP_ID="wxc0e4cfce130fe788" \ No newline at end of file +TARO_APP_ID="wx43d3e4316396041c" \ No newline at end of file diff --git a/babel.config.js b/babel.config.js index d54a01baa5a2c67526281f6d0fff6f7fedd9690c..1a571adc2be5cd047ca5d060c14a9c5a1f4b9b17 100644 --- a/babel.config.js +++ b/babel.config.js @@ -2,9 +2,34 @@ // https://github.com/NervJS/taro/blob/next/packages/babel-preset-taro/README.md module.exports = { presets: [ - ['taro', { - framework: 'react', - ts: false - }] - ] -} + [ + "taro", + { + framework: "react", + ts: false, + }, + ], + ], + + plugins: [ + [ + "import", + { + libraryName: "@taroify/core", + libraryDirectory: "", + style: true, + }, + "@taroify/core", + ], + [ + "import", + { + libraryName: "@taroify/icons", + libraryDirectory: "", + camel2DashComponentName: false, + style: () => "@taroify/icons/style", + }, + "@taroify/icons", + ], + ], +}; diff --git a/config/index.js b/config/index.js index 05280c2619ab34e9b33715b85d2ba10709dfc6f6..c0eb0f209cfbcbaba4f6624b57aa50ffba91a90a 100644 --- a/config/index.js +++ b/config/index.js @@ -6,7 +6,7 @@ import prodConfig from "./prod"; // https://taro-docs.jd.com/docs/next/config#defineconfig-辅助函数 export default defineConfig(async (merge, { command, mode }) => { const baseConfig = { - projectName: "approve-pass-managemnt-miniApp", + projectName: "approve-pass-management-miniApp", date: "2024-7-12", designWidth: 1125, deviceRatio: { @@ -50,6 +50,9 @@ export default defineConfig(async (merge, { command, mode }) => { }, }, }, + sass: { + data: "$hd: 3;", + }, h5: { publicPath: "/", staticDirectory: "static", @@ -62,6 +65,7 @@ export default defineConfig(async (merge, { command, mode }) => { filename: "css/[name].[hash].css", chunkFilename: "css/[name].[chunkhash].css", }, + esnextModules: ["@taroify"], postcss: { autoprefixer: { enable: true, diff --git a/package.json b/package.json index 07b469c093b63f8cbb88d3e984d3fac357d36870..0ab43b844600ca4b6dd8d8b809811ae9acc5f77d 100644 --- a/package.json +++ b/package.json @@ -40,47 +40,52 @@ "author": "", "dependencies": { "@babel/runtime": "^7.21.5", + "@taroify/core": "^0.3.1-alpha.0", "@tarojs/components": "3.6.33", "@tarojs/helper": "3.6.33", - "@tarojs/plugin-platform-weapp": "3.6.33", + "@tarojs/plugin-framework-react": "3.6.33", "@tarojs/plugin-platform-alipay": "3.6.33", - "@tarojs/plugin-platform-tt": "3.6.33", - "@tarojs/plugin-platform-swan": "3.6.33", - "@tarojs/plugin-platform-jd": "3.6.33", - "@tarojs/plugin-platform-qq": "3.6.33", "@tarojs/plugin-platform-h5": "3.6.33", "@tarojs/plugin-platform-harmony-hybrid": "3.6.33", + "@tarojs/plugin-platform-jd": "3.6.33", + "@tarojs/plugin-platform-qq": "3.6.33", + "@tarojs/plugin-platform-swan": "3.6.33", + "@tarojs/plugin-platform-tt": "3.6.33", + "@tarojs/plugin-platform-weapp": "3.6.33", + "@tarojs/react": "3.6.33", "@tarojs/runtime": "3.6.33", "@tarojs/shared": "3.6.33", "@tarojs/taro": "3.6.33", - "@tarojs/plugin-framework-react": "3.6.33", - "@tarojs/react": "3.6.33", + "classnames": "^2.5.1", + "lodash": "^4.17.21", + "react": "^18.0.0", "react-dom": "^18.0.0", - "react": "^18.0.0" + "zustand": "^4.5.4" }, "devDependencies": { "@babel/core": "^7.8.0", + "@pmmmwh/react-refresh-webpack-plugin": "^0.5.5", "@tarojs/cli": "3.6.33", - "@types/webpack-env": "^1.13.6", - "@tarojs/test-utils-react": "^0.1.1", - "@types/react": "^18.0.0", - "webpack": "5.78.0", "@tarojs/taro-loader": "3.6.33", + "@tarojs/test-utils-react": "^0.1.1", "@tarojs/webpack5-runner": "3.6.33", + "@types/jest": "^29.3.1", + "@types/node": "^18.15.11", + "@types/react": "^18.0.0", + "@types/webpack-env": "^1.13.6", + "babel-plugin-import": "^1.13.8", "babel-preset-taro": "3.6.33", - "eslint-config-taro": "3.6.33", "eslint": "^8.12.0", - "@pmmmwh/react-refresh-webpack-plugin": "^0.5.5", - "react-refresh": "^0.11.0", - "eslint-plugin-react": "^7.8.2", + "eslint-config-taro": "3.6.33", "eslint-plugin-import": "^2.12.0", + "eslint-plugin-react": "^7.8.2", "eslint-plugin-react-hooks": "^4.2.0", - "stylelint": "^14.4.0", + "jest": "^29.3.1", + "jest-environment-jsdom": "^29.5.0", "postcss": "^8.4.18", + "react-refresh": "^0.11.0", + "stylelint": "^14.4.0", "ts-node": "^10.9.1", - "@types/node": "^18.15.11", - "@types/jest": "^29.3.1", - "jest": "^29.3.1", - "jest-environment-jsdom": "^29.5.0" + "webpack": "5.78.0" } } diff --git a/project.config.json b/project.config.json index 08b3326079d8cd7c696e51a83e9d5e3bfe14eeb8..bba4057f3e4b36b00fe91d52ae3bea6e40c27c83 100644 --- a/project.config.json +++ b/project.config.json @@ -2,7 +2,7 @@ "miniprogramRoot": "dist/", "projectname": "approve-pass-managemnt-miniApp", "description": "", - "appid": "wxc0e4cfce130fe788", + "appid": "wx43d3e4316396041c", "setting": { "urlCheck": true, "es6": false, diff --git a/project.private.config.json b/project.private.config.json index 51e2631708cd053300ef1644595888a3b7c3bb37..a1a2ceba6bbc3d0f315522d5b15066a74a97be3a 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -2,6 +2,34 @@ "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", "projectname": "approve-pass-managemnt-miniApp", "setting": { - "compileHotReLoad": true + "compileHotReLoad": true, + "urlCheck": false + }, + "condition": { + "miniprogram": { + "list": [ + { + "name": "pages/manage/index", + "pathName": "pages/manage/index", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "pages/detail/index", + "pathName": "pages/detail/index", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "pages/list/index", + "pathName": "pages/list/index", + "query": "", + "launchMode": "default", + "scene": null + } + ] + } } } \ No newline at end of file diff --git a/src/app.config.js b/src/app.config.js index 15c683b2964dc5190fe59aa5007731bb8788f8d7..a39ee2401ca3af10b0b7e377cbfd34ecc3290410 100644 --- a/src/app.config.js +++ b/src/app.config.js @@ -1,11 +1,14 @@ export default defineAppConfig({ pages: [ - 'pages/index/index' + "pages/index/index", + "pages/list/index", + "pages/detail/index", + "pages/manage/index", ], window: { - backgroundTextStyle: 'light', - navigationBarBackgroundColor: '#fff', - navigationBarTitleText: 'WeChat', - navigationBarTextStyle: 'black' - } -}) + backgroundTextStyle: "light", + navigationBarBackgroundColor: "#fff", + navigationBarTitleText: "WeChat", + navigationBarTextStyle: "black", + }, +}); diff --git a/src/app.css b/src/app.css index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..9570bb13ce030afce13212538558290e29dfef55 100644 --- a/src/app.css +++ b/src/app.css @@ -0,0 +1,42 @@ +page { + width: 100%; + height: 100%; + background-color: #eff2f6; + position: relative; +} + +.actionWrapper { + position: absolute; + bottom: 0; + /* height: 368px; */ + background-color: #fff; + width: 100%; + display: flex; + justify-content: flex-end; + gap: 24px; + padding: 60px; + padding-bottom: 80px; + box-sizing: border-box; +} + +.okBtn { + width: 357px; + height: 119px; + border-radius: 10px; + background-color: #edf1f7; + display: flex; + align-items: center; + justify-content: center; + color: rgba(46, 108, 255, 1); +} + +.cancelBtn { + width: 357px; + height: 119px; + border-radius: 10px; + background-color: #edf1f7; + display: flex; + align-items: center; + justify-content: center; + color: rgba(252, 74, 99, 1); +} diff --git a/src/app.js b/src/app.js index ae024b6afc79c25c3dba48972dd4fe06aad36847..f14a9e22b3e510bab4cfca33202a21f709bc0a08 100644 --- a/src/app.js +++ b/src/app.js @@ -1,15 +1,13 @@ - -import { useLaunch } from '@tarojs/taro' -import './app.css' +import { useLaunch } from "@tarojs/taro"; +import "./app.css"; function App({ children }) { - useLaunch(() => { - console.log('App launched.') - }) + console.log("App launched."); + }); // children 是将要会渲染的页面 - return children + return children; } -export default App +export default App; diff --git a/src/assets/file.png b/src/assets/file.png new file mode 100644 index 0000000000000000000000000000000000000000..b06aece61ea2de76cc785626d6205be47b939358 Binary files /dev/null and b/src/assets/file.png differ diff --git a/src/assets/image.png b/src/assets/image.png new file mode 100644 index 0000000000000000000000000000000000000000..0ce0b5454d39374ad10e39f70fffc7445b64f521 Binary files /dev/null and b/src/assets/image.png differ diff --git a/src/assets/pdf.png b/src/assets/pdf.png new file mode 100644 index 0000000000000000000000000000000000000000..8a7ae8c35e47ef75da0dd153029b7dbd05567c08 Binary files /dev/null and b/src/assets/pdf.png differ diff --git a/src/components/FormCheckbox/index.jsx b/src/components/FormCheckbox/index.jsx new file mode 100644 index 0000000000000000000000000000000000000000..b970332ef370afff19b39500a524201c4af2d3ed --- /dev/null +++ b/src/components/FormCheckbox/index.jsx @@ -0,0 +1,53 @@ +import { View, Textarea } from "@tarojs/components"; +import { isEqual } from "lodash"; +import { Checkbox } from "@taroify/core"; +import { useState, useEffect } from "react"; +const FormCheckbox = (props) => { + const { value, onChange, options } = props; + + const [selected, setSelected] = useState([]); + + useEffect(() => { + if (typeof value === "object" && !isEqual(value, selected)) { + setSelected(value); + } + }, [value]); + + if (!options || options.length === 0) { + return ( + onChange(e.target.value)} + > + ); + } + + let optionTemp = [...options]; + optionTemp = optionTemp.map((v) => { + if (typeof v === "string") return { label: v, value: v }; + return v; + }); + // console.log(value); + return ( + + { + setSelected(e); + onChange(e.join(",")); + }} + > + {optionTemp.map((item) => { + return ( + + {item.label} + + ); + })} + + + ); +}; + +export default FormCheckbox; diff --git a/src/components/FormComponentRender/index.css b/src/components/FormComponentRender/index.css new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/components/FormComponentRender/index.jsx b/src/components/FormComponentRender/index.jsx new file mode 100644 index 0000000000000000000000000000000000000000..9550118f0263ccfc7682dbc124dad9d12147c64c --- /dev/null +++ b/src/components/FormComponentRender/index.jsx @@ -0,0 +1,44 @@ +import { useMemo } from "react"; +import FormInput from "../FormInput/index"; +import FormDatePicker from "../FormDatePicker/index"; +import FormTextarea from "../FormTextarea/index"; +import FormRadio from "../FormRadio/index"; +import FormCheckbox from "../FormCheckbox/index"; +import FormImgUpload from "../FormImgUpload/index"; +import FormFileUpload from "../FormFileUpload/index"; +import Radio from "@taroify/core/radio/radio"; + +const RenderComponent = (props) => { + const { config, componentType, ...newProps } = props; + + const componentsRegister = useMemo(() => { + const composeProps = { ...newProps, ...config }; + + switch (componentType) { + case "TextInput": + return ; + case "NumberInput": + return ; + case "DatePicker": + return ; + case "TextAreaInput": + return ; + case "Radio": + return ; + case "Checkbox": + return ; + case "FileUpload": + return ; + case "ImgUpload": + return ; + case "PhoneInput": + return ; + default: + return ""; + } + }, [props]); + + return componentsRegister; +}; + +export default RenderComponent; diff --git a/src/components/FormDatePicker/index.css b/src/components/FormDatePicker/index.css new file mode 100644 index 0000000000000000000000000000000000000000..99131d61cb0e3569cd27fbfb92b9e23bd8d1d304 --- /dev/null +++ b/src/components/FormDatePicker/index.css @@ -0,0 +1,4 @@ +.date_container { + width: 100%; + height: 100%; +} diff --git a/src/components/FormDatePicker/index.jsx b/src/components/FormDatePicker/index.jsx new file mode 100644 index 0000000000000000000000000000000000000000..2e5edc74f3d2e48e32ff53658a5b78170e9f7a62 --- /dev/null +++ b/src/components/FormDatePicker/index.jsx @@ -0,0 +1,98 @@ +import { View } from "@tarojs/components"; +import { Popup, DatetimePicker } from "@taroify/core"; +import { useEffect, useMemo, useState } from "react"; +import "./index.css"; +const FormDatePicker = (props) => { + const { isRange, value, onChange, picker = "month" } = props; + const [show, setShow] = useState(false); + const [date, setDate] = useState(new Date()); + + const info = useMemo(() => { + if (picker === "time") { + let dateDesc = undefined; + if (value instanceof Date) { + const hour = value.getHours(); + const min = value.getMinutes(); + const second = value.getSeconds(); + dateDesc = `${hour}:${min}:${second}`; + } + return { + type: "time", + title: "选择时间", + value: dateDesc, + }; + } + if (picker === "date") { + let dateDesc = undefined; + if (value instanceof Date) { + const year = value.getFullYear(); + const month = value.getMonth() + 1; + const day = value.getDate(); + dateDesc = `${year}-${month > 9 ? month : "0" + month}-${day}`; + } + return { + type: "date", + title: "选择日期", + value: dateDesc, + }; + } + if (picker === "month") { + let dateDesc = undefined; + if (value instanceof Date) { + const year = value.getFullYear(); + const month = value.getMonth() + 1; + dateDesc = `${year}-${month > 9 ? month : "0" + month}`; + } + return { + type: "year-month", + title: "选择月份", + value: dateDesc, + }; + } + }, [picker, value]); + + useEffect(() => { + if (value instanceof Date) { + setDate(value); + } + }, [value]); + + const openModal = () => { + setShow(true); + }; + return ( + <> + + {info.value ? ( + info.value + ) : ( + 请选择时间 + )} + + + { + setDate(e); + }} + onCancel={() => { + setShow(false); + }} + onConfirm={() => { + onChange(date); + setShow(false); + }} + > + + 取消 + {info.title} + 确认 + + + + + ); +}; + +export default FormDatePicker; diff --git a/src/components/FormFileUpload/index.css b/src/components/FormFileUpload/index.css new file mode 100644 index 0000000000000000000000000000000000000000..e3f42f3653b0150a39033344e4e3af8ca722d110 --- /dev/null +++ b/src/components/FormFileUpload/index.css @@ -0,0 +1,9 @@ +.fileUpload { + /* width: 90px; */ + height: 90px; + background-color: #f7f8fa; + padding: 0 24px; + display: flex; + align-items: center; + color: #646566; +} diff --git a/src/components/FormFileUpload/index.jsx b/src/components/FormFileUpload/index.jsx new file mode 100644 index 0000000000000000000000000000000000000000..c2dd5724451e1cd4b6b36836152a2fced55ff584 --- /dev/null +++ b/src/components/FormFileUpload/index.jsx @@ -0,0 +1,47 @@ +import { Uploader } from "@taroify/core"; +import Taro from "@tarojs/taro"; +import { View } from "@tarojs/components"; +import { head } from "lodash"; +import { useState } from "react"; +import "./index.css"; +import { BackTop } from "@taroify/icons"; +const FormFileUpload = (props) => { + const [file, setFile] = useState(); + const { value, onChange } = props; + + function onUpload() { + Taro.chooseMessageFile({ + count: 1, + type: "file", + }).then(({ tempFiles }) => { + setFile({ + url: tempFiles[0].path, + type: tempFiles[0].type, + name: tempFiles[0]?.name, + }); + Taro.uploadFile({ + url: "http://192.168.2.21:21610/oss/upload?bucketName=cgtf", + name: "file", + filePath: tempFiles[0].path, + success: (res) => { + const resData = JSON.parse(res.data); + if (resData.code === 200) { + onChange(resData.data); + } + }, + }); + }); + } + + return ( + + + + 上传文件 + + {file?.name} + + ); +}; + +export default FormFileUpload; diff --git a/src/components/FormImgUpload/index.jsx b/src/components/FormImgUpload/index.jsx new file mode 100644 index 0000000000000000000000000000000000000000..1816ec18298254b995e525f36e6945485c8f6ec2 --- /dev/null +++ b/src/components/FormImgUpload/index.jsx @@ -0,0 +1,35 @@ +import { Uploader } from "@taroify/core"; +import Taro from "@tarojs/taro"; +import { useState } from "react"; +const FormImgUpload = (props) => { + const [file, setFile] = useState(); + const { value, onChange } = props; + function onUpload() { + Taro.chooseImage({ + count: 1, + sizeType: ["original", "compressed"], + sourceType: ["album", "camera"], + }).then(({ tempFiles }) => { + setFile({ + url: tempFiles[0].path, + type: tempFiles[0].type, + name: tempFiles[0].originalFileObj?.name, + }); + Taro.uploadFile({ + url: "http://192.168.2.21:21610/oss/upload?bucketName=cgtf", + name: "file", + filePath: tempFiles[0].path, + success: (res) => { + const resData = JSON.parse(res.data); + if (resData.code === 200) { + onChange(resData.data); + } + }, + }); + }); + } + + return ; +}; + +export default FormImgUpload; diff --git a/src/components/FormInput/index.jsx b/src/components/FormInput/index.jsx new file mode 100644 index 0000000000000000000000000000000000000000..0d80d8344a3376620e5f988fba4f64f5e62f5f37 --- /dev/null +++ b/src/components/FormInput/index.jsx @@ -0,0 +1,25 @@ +import { View } from "@tarojs/components"; +import { Flex, Input } from "@taroify/core"; + +const FormInput = (props) => { + const { placeholder, type, value, onChange, prefix, suffix } = props; + return ( + + {prefix} + { + const value = e.detail.value; + if (onChange) { + onChange(value); + } + }} + /> + {suffix} + + ); +}; + +export default FormInput; diff --git a/src/components/FormRadio/index.jsx b/src/components/FormRadio/index.jsx new file mode 100644 index 0000000000000000000000000000000000000000..93e1f0651f33495bb4bd5e4654d3becf5b049fe9 --- /dev/null +++ b/src/components/FormRadio/index.jsx @@ -0,0 +1,24 @@ +import { View, Textarea } from "@tarojs/components"; +import { Radio } from "@taroify/core"; + +const FormRadio = (props) => { + const { value, onChange, option } = props; + + let optionTemp = [...option]; + optionTemp = optionTemp.map((v) => { + if (typeof v === "string") return { label: v, value: v }; + return v; + }); + + return ( + + onChange(e)} value={value}> + {optionTemp.map((item) => { + return {item.label}; + })} + + + ); +}; + +export default FormRadio; diff --git a/src/components/FormTextarea/index.jsx b/src/components/FormTextarea/index.jsx new file mode 100644 index 0000000000000000000000000000000000000000..61581df4ae4848f0455a05ad783ad332daeab36f --- /dev/null +++ b/src/components/FormTextarea/index.jsx @@ -0,0 +1,25 @@ +import { View, Textarea } from "@tarojs/components"; +// import { Textarea } from "@taroify/core"; + +const FormTextarea = (props) => { + const { placeholder, value, onChange } = props; + return ( + + + + {fileList?.map((item) => { + return ( + + + { + Taro.previewImage({ + current: composeImgUrl(item), + urls: [composeImgUrl(item)], + }); + }} + style={{ width: "100%", height: "100%" }} + > + + ); + })} + + + + + + + {actionObj.nodeName === "审批节点" && ( + + )} + + + + + + ); +}; + +export default Manage; diff --git a/src/service/index.js b/src/service/index.js new file mode 100644 index 0000000000000000000000000000000000000000..90f0fe78eb7be83e9ea6a032ae4bfdbe59c2eee5 --- /dev/null +++ b/src/service/index.js @@ -0,0 +1,131 @@ +import Taro from "@tarojs/taro"; + +const dev = "http://192.168.2.21:21610"; +const loginDev = "http://192.168.2.21:21590"; +/** 对象转参数 */ +function objectToQuery(obj) { + return Object.keys(obj) + .map((k) => encodeURIComponent(k) + "=" + encodeURIComponent(obj[k])) + .join("&"); +} + +/** 简单封装 */ +const request = { + post: (url, option = {}) => { + const params = option.params; + let newUrl = dev + url; + if (params) { + newUrl += "?" + objectToQuery(params); + } + return new Promise((resolve, reject) => { + Taro.request({ + url: newUrl, + method: "POST", + ...option, + header: { + Authorization: "Bearer " + Taro.getStorageSync("token"), + ...(option?.header ?? {}), + }, + success: (res) => { + resolve(res.data); + }, + fail: (err) => { + reject(err); + }, + }); + }); + }, + get: (url, option = {}) => { + let newUrl = dev + url; + return new Promise((resolve, reject) => { + Taro.request({ + url: newUrl, + method: "GET", + header: { + Authorization: "Bearer" + Taro.getStorageSync("token"), + }, + ...option, + success: (res) => { + resolve(res.data); + }, + fail: (err) => { + reject(err); + }, + }); + }); + }, +}; + +/** 获取模版配置 */ +async function getTemplateConfig(id) { + return request.post("/hncy/matterInfo/getInfo", { + params: { + id, + }, + }); +} + +/** 获取申请内容 */ +async function getApplicationFormDetail(id) { + return request.post("/hncy/record/getDetails", { + params: { id }, + }); +} +/** 登录 */ +async function login(password, username) { + const params = { + username: username, + password: password, + grant_type: "password", + client_id: "cgtf", + client_secret: "cgtf", + }; + return request.post("", { + url: loginDev + "/auth/oauth/token" + "?" + objectToQuery(params), + header: {}, + }); +} +/** 获取全部待办 */ +async function getBacklog(params) { + return request.post("/hncy/record/list", { + params: params, + }); +} + +async function getBacklogHistory(params) { + return request.post("/hncy/record/list", { + params: { ...params, done: true }, + }); +} + +async function getExamineHistory(id) { + return request.get("/hncy/flow/approve-history-list", { + data: { + businessId: id, + }, + }); +} +export function completeExamine(data) { + return request.post("/hncy/flow/complete", { + header: { + "content-type": "application/x-www-form-urlencoded", + }, + data, + }); +} +export function submitForm(data) { + return request.post("/hncy/record/approveEditReportContent", { + data, + }); +} + +export default { + login, + getBacklog, + getTemplateConfig, + getApplicationFormDetail, + getExamineHistory, + completeExamine, + submitForm, + getBacklogHistory, +}; diff --git a/src/store/useUserStore.js b/src/store/useUserStore.js new file mode 100644 index 0000000000000000000000000000000000000000..8a6daefc60b883e40127e0f8edb09a1ec3e1e643 --- /dev/null +++ b/src/store/useUserStore.js @@ -0,0 +1,16 @@ +import { create } from "zustand"; + +/** 全局状态管理 */ +const useGlobalStore = create()((set) => ({ + actionObj: undefined, + configSource: undefined, + /** 更新 */ + updateActionObj: (obj) => { + set({ actionObj: obj }); + }, + updateConfigSource: (obj) => { + set({ configSource: obj }); + }, +})); + +export default useGlobalStore; diff --git a/src/utils/index.js b/src/utils/index.js new file mode 100644 index 0000000000000000000000000000000000000000..708cbff59302831973ebb25b04f3d8aa05bbc0a2 --- /dev/null +++ b/src/utils/index.js @@ -0,0 +1,39 @@ +export function buildListByGroupId(target) { + const groupList = []; + + const groupMap = {}; + + target.forEach((formConfig) => { + if (!groupMap[formConfig?.groupId]) { + groupMap[formConfig?.groupId] = []; + } + groupMap[formConfig?.groupId].push(formConfig); + }); + + for (const groupTitle in groupMap) { + if (groupMap.hasOwnProperty(groupTitle)) { + groupList.push({ + title: groupTitle, + list: groupMap[groupTitle], + }); + } + } + + return groupList; +} + +export function composeImgUrl(imgStr) { + return `http://192.168.2.24:9000${imgStr}`; +} + +export function inversionSerializationRule(inputStr) { + let value = JSON.parse(inputStr); + + if (Array.isArray(value) && value.length > 0) { + // + const regexString = value[0].pattern.slice(1, -1); + value[0].pattern = new RegExp(regexString); + } + + return value; +} diff --git a/yarn.lock b/yarn.lock index d06fa90d7f307f28bc9c58ce9cd90e7355eeaaa8..7432a5e31e15a655c3c1989a290892c9185dd441 100644 --- a/yarn.lock +++ b/yarn.lock @@ -154,7 +154,7 @@ "@babel/traverse" "^7.24.8" "@babel/types" "^7.24.8" -"@babel/helper-module-imports@^7.24.7": +"@babel/helper-module-imports@^7.0.0", "@babel/helper-module-imports@^7.24.7": version "7.24.7" resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.24.7.tgz#f2f980392de5b84c3328fc71d38bd81bbb83042b" integrity sha512-8AyH3C+74cgCVVXow/myrynrAGv+nTVg5vKu2nZph9x7RcRwzmh0VFallJuFTZ9mx6u4eSdXZfcOzSqTUm0HCA== @@ -1158,7 +1158,7 @@ core-js-pure "^3.30.2" regenerator-runtime "^0.14.0" -"@babel/runtime@^7.14.5", "@babel/runtime@^7.21.5", "@babel/runtime@^7.7.6", "@babel/runtime@^7.8.4": +"@babel/runtime@^7.14.5", "@babel/runtime@^7.21.5", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.6", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7": version "7.24.8" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.24.8.tgz#5d958c3827b13cc6d05e038c07fb2e5e3420d82e" integrity sha512-5F7SDGs1T72ZczbRwbGO9lQi0NLjQxzl6i4lJxLxfW9U5UluCSyEJeniWvnhl3/euNiqQVbo8zruhsDfid0esA== @@ -1901,6 +1901,34 @@ dependencies: defer-to-connect "^1.0.1" +"@taroify/core@^0.3.1-alpha.0": + version "0.3.1-alpha.0" + resolved "https://registry.yarnpkg.com/@taroify/core/-/core-0.3.1-alpha.0.tgz#f1618f1cc4a7e3b9a226059d1494e2d55fd6568d" + integrity sha512-V8tRQ5ZeX1uIrjp84grD2UR1WiDMIr9A5aQIu40r2c8zx/YsSRqx0J/FLkhO0Zvo9sX3A7y+BP+fz06EW0xegw== + dependencies: + "@taroify/hooks" "^0.3.1-alpha.0" + "@taroify/icons" "^0.3.1-alpha.0" + classnames "^2.2.6" + lodash "^4.17.21" + promise "^8.1.0" + raf "^3.4.1" + react-is "^18.2.0" + react-transition-group "^4.4.1" + +"@taroify/hooks@^0.3.1-alpha.0": + version "0.3.1-alpha.0" + resolved "https://registry.yarnpkg.com/@taroify/hooks/-/hooks-0.3.1-alpha.0.tgz#b4d7b9cac278405f7da55a0b169b21d01db2213f" + integrity sha512-Ag8iYIgAeBW3etBDTZl6VxgaqXTYmww7g2IknAGa4U8oxjXaI6U3ukiINGXrY0VMLxoTkoRakDb0YeKj4laS4w== + dependencies: + "@vant/area-data" "^1.2.1" + +"@taroify/icons@^0.3.1-alpha.0": + version "0.3.1-alpha.0" + resolved "https://registry.yarnpkg.com/@taroify/icons/-/icons-0.3.1-alpha.0.tgz#9709fd7eb0c056da8cbb88b30415730d693f5baf" + integrity sha512-NDysyREjLb0UZOTKx4pOSyUcWs+ZJ7IofQgkckX6OF0TbsNA+1YlSiI0HKB0kWUNi4oL/71jvt21U3qdrsbpEg== + dependencies: + classnames "^2.2.6" + "@tarojs/api@3.6.33": version "3.6.33" resolved "https://registry.yarnpkg.com/@tarojs/api/-/api-3.6.33.tgz#e787c7d2c28d89cb99896adca5af781c094e875d" @@ -2874,6 +2902,11 @@ resolved "https://registry.yarnpkg.com/@ungap/structured-clone/-/structured-clone-1.2.0.tgz#756641adb587851b5ccb3e095daf27ae581c8406" integrity sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ== +"@vant/area-data@^1.2.1": + version "1.5.1" + resolved "https://registry.yarnpkg.com/@vant/area-data/-/area-data-1.5.1.tgz#bdd943b9b569476cb04133a8323bd04aa35be2c2" + integrity sha512-gR5TPEzTbxN1cTK1aDhCoyikSCLX7DAacxyXoKyI4SAsYYTZrDl/nLgQFIm9vLsvWzlPIda8xV8/U3x7M9k6ww== + "@vue/compiler-core@3.4.31": version "3.4.31" resolved "https://registry.yarnpkg.com/@vue/compiler-core/-/compiler-core-3.4.31.tgz#b51a76f1b30e9b5eba0553264dff0f171aedb7c6" @@ -3409,6 +3442,11 @@ arrify@^2.0.1: resolved "https://registry.yarnpkg.com/arrify/-/arrify-2.0.1.tgz#c9655e9331e0abcd588d2a7cad7e9956f66701fa" integrity sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug== +asap@~2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" + integrity sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA== + asn1@~0.2.3: version "0.2.6" resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.6.tgz#0d3a7bb6e64e02a90c0303b31f292868ea09a08d" @@ -3521,6 +3559,13 @@ babel-plugin-dynamic-import-node@2.3.3: dependencies: object.assign "^4.1.0" +babel-plugin-import@^1.13.8: + version "1.13.8" + resolved "https://registry.yarnpkg.com/babel-plugin-import/-/babel-plugin-import-1.13.8.tgz#782c517f6bbf2de3b1f75aaafd6d20a491c4878c" + integrity sha512-36babpjra5m3gca44V6tSTomeBlPA7cHUynrE2WiQIm3rEGD9xy28MKsx5IdO45EbnpJY7Jrgd00C6Dwt/l/2Q== + dependencies: + "@babel/helper-module-imports" "^7.0.0" + babel-plugin-istanbul@^6.1.1: version "6.1.1" resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz#fa88ec59232fd9b4e36dbbc540a8ec9a9b47da73" @@ -4055,7 +4100,7 @@ cjs-module-lexer@^1.0.0: resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-1.3.1.tgz#c485341ae8fd999ca4ee5af2d7a1c9ae01e0099c" integrity sha512-a3KdPAANPbNE4ZUv9h6LckSl9zLsYOP4MBmhIPkRaeyybt+r4UghLvq+xw/YwUcC1gqylCkL4rdVs3Lwupjm4Q== -classnames@^2.2.5: +classnames@^2.2.5, classnames@^2.2.6, classnames@^2.5.1: version "2.5.1" resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.5.1.tgz#ba774c614be0f016da105c858e7159eae8e7687b" integrity sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow== @@ -5002,6 +5047,14 @@ dom-converter@^0.2.0: dependencies: utila "~0.4" +dom-helpers@^5.0.1: + version "5.2.1" + resolved "https://registry.yarnpkg.com/dom-helpers/-/dom-helpers-5.2.1.tgz#d9400536b2bf8225ad98fe052e029451ac40e902" + integrity sha512-nRCa7CK3VTrM2NmGkIy4cbK7IZlgBE/PYMn55rrXefr5xXDP0LdtfPnblFDoVdcAfslJ7or6iqAUnx0CCGIWQA== + dependencies: + "@babel/runtime" "^7.8.7" + csstype "^3.0.2" + dom-serializer@^1.0.1: version "1.4.1" resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-1.4.1.tgz#de5d41b1aea290215dc45a6dae8adcf1d32e2d30" @@ -9856,6 +9909,13 @@ promise-polyfill@^7.1.0: resolved "https://registry.yarnpkg.com/promise-polyfill/-/promise-polyfill-7.1.2.tgz#ab05301d8c28536301622d69227632269a70ca3b" integrity sha512-FuEc12/eKqqoRYIGBrUptCBRhobL19PS2U31vMNTfyck1FxPyMfgsXyW4Mav85y/ZN1hop3hOwRlUDok23oYfQ== +promise@^8.1.0: + version "8.3.0" + resolved "https://registry.yarnpkg.com/promise/-/promise-8.3.0.tgz#8cb333d1edeb61ef23869fbb8a4ea0279ab60e0a" + integrity sha512-rZPNPKTOYVNEEKFaq1HqTgOwZD+4/YHS5ukLzQCypkj+OkYx7iv0mA91lJlpPPZ8vMau3IIGj5Qlwrx+8iiSmg== + dependencies: + asap "~2.0.6" + prompts@^2.0.1: version "2.4.2" resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.4.2.tgz#7b57e73b3a48029ad10ebd44f74b01722a4cb069" @@ -9864,7 +9924,7 @@ prompts@^2.0.1: kleur "^3.0.3" sisteransi "^1.0.5" -prop-types@^15.8.1: +prop-types@^15.6.2, prop-types@^15.8.1: version "15.8.1" resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.8.1.tgz#67d87bf1a694f48435cf332c24af10214a3140b5" integrity sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg== @@ -9982,6 +10042,13 @@ quick-lru@^4.0.1: resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-4.0.1.tgz#5b8878f113a58217848c6482026c73e1ba57727f" integrity sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g== +raf@^3.4.1: + version "3.4.1" + resolved "https://registry.yarnpkg.com/raf/-/raf-3.4.1.tgz#0742e99a4a6552f445d73e3ee0328af0ff1ede39" + integrity sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA== + dependencies: + performance-now "^2.1.0" + randombytes@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" @@ -10042,7 +10109,7 @@ react-is@^17.0.1: resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0" integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w== -react-is@^18.0.0: +react-is@^18.0.0, react-is@^18.2.0: version "18.3.1" resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.3.1.tgz#e83557dc12eae63a99e003a46388b1dcbb44db7e" integrity sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg== @@ -10065,6 +10132,16 @@ react-refresh@^0.4.0: resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.4.3.tgz#966f1750c191672e76e16c2efa569150cc73ab53" integrity sha512-Hwln1VNuGl/6bVwnd0Xdn1e84gT/8T9aYNL+HAKDArLCS7LWjwr7StE30IEYbIkx0Vi3vs+coQxe+SQDbGbbpA== +react-transition-group@^4.4.1: + version "4.4.5" + resolved "https://registry.yarnpkg.com/react-transition-group/-/react-transition-group-4.4.5.tgz#e53d4e3f3344da8521489fbef8f2581d42becdd1" + integrity sha512-pZcd1MCJoiKiBR2NRxeCRg13uCXbydPnmB4EOeRrY7480qNWO8IIgQG6zlDkm6uRMsURXPuKq0GWtiM59a5Q6g== + dependencies: + "@babel/runtime" "^7.5.5" + dom-helpers "^5.0.1" + loose-envify "^1.4.0" + prop-types "^15.6.2" + react@^18.0.0: version "18.3.1" resolved "https://registry.yarnpkg.com/react/-/react-18.3.1.tgz#49ab892009c53933625bd16b2533fc754cab2891" @@ -11801,6 +11878,11 @@ url-to-options@^1.0.1: resolved "https://registry.yarnpkg.com/url-to-options/-/url-to-options-1.0.1.tgz#1505a03a289a48cbd7a434efbaeec5055f5633a9" integrity sha512-0kQLIzG4fdk/G5NONku64rSH/x32NOA39LVQqlK8Le6lvTF6GGRJpqaQFGgU+CLwySIqBSMdwYM0sYcW9f6P4A== +use-sync-external-store@1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz#7dbefd6ef3fe4e767a0cf5d7287aacfb5846928a" + integrity sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA== + util-deprecate@^1.0.1, util-deprecate@^1.0.2, util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" @@ -12390,3 +12472,10 @@ yup@^1.2.0: tiny-case "^1.0.3" toposort "^2.0.2" type-fest "^2.19.0" + +zustand@^4.5.4: + version "4.5.4" + resolved "https://registry.yarnpkg.com/zustand/-/zustand-4.5.4.tgz#63abdd81edfb190bc61e0bbae045cc4d52158a05" + integrity sha512-/BPMyLKJPtFEvVL0E9E9BTUM63MNyhPGlvxk1XjrfWTUlV+BR8jufjsovHzrtR6YNcBEcL7cMHovL1n9xHawEg== + dependencies: + use-sync-external-store "1.2.0"