This commit is contained in:
TimSpan 2024-09-30 10:22:06 +08:00
commit c412126bf7
100 changed files with 1233 additions and 1368 deletions

8
.idea/modules.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/policeSecurity.iml" filepath="$PROJECT_DIR$/.idea/policeSecurity.iml" />
</modules>
</component>
</project>

12
.idea/policeSecurity.iml Normal file
View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
<excludeFolder url="file://$MODULE_DIR$/temp" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -1,2 +1,3 @@
# 配置文档参考 https://taro-docs.jd.com/docs/next/env-mode-config
TARO_APP_ID="wx0acd1c4fcf94bdd3" TARO_APP_ID="wx0acd1c4fcf94bdd3"
TARO_APP_BASE_API="http://172.10.10.93:8765" TARO_APP_BASE_API="http://172.10.10.93:8765"

View File

@ -1,2 +1 @@
TARO_APP_ID="wx24cc8a872b57ac79" # TARO_APP_ID="生产环境下的小程序appid"
TARO_APP_BASE_API="http://172.10.10.207:7000"

View File

@ -5,6 +5,15 @@
"taro/vue3" "taro/vue3"
], ],
"rules": { "rules": {
"vue/multi-word-component-names": "off" // 添加组件命名忽略规则
"vue/multi-word-component-names": [
"error",
{
//需要忽略的组件名
"ignores": [
"index"
]
}
]
} }
} }

View File

@ -5,8 +5,9 @@ deploy_versions/
node_modules/ node_modules/
.DS_Store .DS_Store
.swc .swc
yarn.lock
components.d.ts
package-lock.json
.idea .idea
components.d.ts
package-lock.json
yarn.lock

View File

@ -1,124 +1,9 @@
// import type { UserConfigExport } from "@tarojs/cli"; import type { UserConfigExport } from "@tarojs/cli";
// export default { export default {
// logger: { logger: {
// quiet: false, quiet: false,
// stats: true stats: true
// },
// mini: {},
// h5: {}
// } satisfies UserConfigExport
import {defineConfig, type UserConfigExport} from '@tarojs/cli'
import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin'
import devConfig from './dev'
import prodConfig from './prod'
import ComponentsPlugin from 'unplugin-vue-components/webpack'
import NutUIResolver from '@nutui/auto-import-resolver'
// https://taro-docs.jd.com/docs/next/config#defineconfig-辅助函数
export default defineConfig(async (merge, {command, mode}) => {
const baseConfig: UserConfigExport = {
projectName: 'collect_information',
date: '2024-4-12',
designWidth(input: any) {
// 配置 NutUI 375 尺寸
if (input?.file?.replace(/\\+/g, '/').indexOf('@nutui') > -1) {
return 375
}
// 全局使用 Taro 默认的 750 尺寸
return 750
}, },
deviceRatio: { mini: {},
640: 2.34 / 2, h5: {}
750: 1, } satisfies UserConfigExport
828: 1.81 / 2,
375: 2
},
sourceRoot: 'src',
outputRoot: 'dist',
plugins: ['@tarojs/plugin-html'],
defineConstants: {},
copy: {
patterns: [],
options: {}
},
framework: 'vue3',
compiler: 'webpack5',
cache: {
enable: false // Webpack 持久化缓存配置建议开启。默认配置请参考https://docs.taro.zone/docs/config-detail#cache
},
mini: {
miniCssExtractPluginOption: {
ignoreOrder: true
},
postcss: {
pxtransform: {
enable: true,
config: {}
},
url: {
enable: true,
config: {
limit: 1024 // 设定转换尺寸上限
}
},
cssModules: {
enable: false, // 默认为 false如需使用 css modules 功能,则设为 true
config: {
namingPattern: 'module', // 转换模式,取值为 global/module
generateScopedName: '[name]__[local]___[hash:base64:5]'
}
}
},
webpackChain(chain) {
chain.resolve.plugin('tsconfig-paths').use(TsconfigPathsPlugin)
chain.plugin('unplugin-vue-components').use(ComponentsPlugin({
resolvers: [NutUIResolver({taro: true})]
}))
}
},
h5: {
publicPath: '/',
staticDirectory: 'static',
output: {
filename: 'js/[name].[hash:8].js',
chunkFilename: 'js/[name].[chunkhash:8].js'
},
miniCssExtractPluginOption: {
ignoreOrder: true,
filename: 'css/[name].[hash].css',
chunkFilename: 'css/[name].[chunkhash].css'
},
postcss: {
autoprefixer: {
enable: true,
config: {}
},
cssModules: {
enable: false, // 默认为 false如需使用 css modules 功能,则设为 true
config: {
namingPattern: 'module', // 转换模式,取值为 global/module
generateScopedName: '[name]__[local]___[hash:base64:5]'
}
}
},
webpackChain(chain) {
chain.resolve.plugin('tsconfig-paths').use(TsconfigPathsPlugin)
}
},
rn: {
appName: 'taroDemo',
postcss: {
cssModules: {
enable: false, // 默认为 false如需使用 css modules 功能,则设为 true
}
}
}
}
if (process.env.NODE_ENV === 'development') {
// 本地开发构建配置(不混淆压缩)
return merge({}, baseConfig, devConfig)
}
// 生产构建配置(默认开启压缩混淆等)
return merge({}, baseConfig, prodConfig)
})

View File

@ -3,13 +3,13 @@ import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin'
import devConfig from './dev' import devConfig from './dev'
import prodConfig from './prod' import prodConfig from './prod'
import ComponentsPlugin from 'unplugin-vue-components/webpack' import ComponentsPlugin from 'unplugin-vue-components/webpack'
import NutUIResolver from '@nutui/auto-import-resolver' import NutUIResolver from "@nutui/auto-import-resolver";
// https://taro-docs.jd.com/docs/next/config#defineconfig-辅助函数 // https://taro-docs.jd.com/docs/next/config#defineconfig-辅助函数
export default defineConfig(async (merge, {command, mode}) => { export default defineConfig(async (merge, {command, mode}) => {
const baseConfig: UserConfigExport = { const baseConfig: UserConfigExport = {
projectName: 'collect_information', projectName: 'collect_information',
date: '2024-4-12', date: '2024-9-14',
designWidth(input: any) { designWidth(input: any) {
// 配置 NutUI 375 尺寸 // 配置 NutUI 375 尺寸
if (input?.file?.replace(/\\+/g, '/').indexOf('@nutui') > -1) { if (input?.file?.replace(/\\+/g, '/').indexOf('@nutui') > -1) {
@ -26,6 +26,7 @@ export default defineConfig(async (merge, {command, mode}) => {
}, },
sourceRoot: 'src', sourceRoot: 'src',
outputRoot: 'dist', outputRoot: 'dist',
// 开启 HTML 插件
plugins: ['@tarojs/plugin-html'], plugins: ['@tarojs/plugin-html'],
defineConstants: {}, defineConstants: {},
copy: { copy: {

View File

@ -2,7 +2,7 @@
"name": "collect_information", "name": "collect_information",
"version": "1.0.0", "version": "1.0.0",
"private": true, "private": true,
"description": "警保联勤联动小程序", "description": "警保联动小程序",
"templateInfo": { "templateInfo": {
"name": "default", "name": "default",
"typescript": true, "typescript": true,
@ -40,47 +40,44 @@
"author": "", "author": "",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.21.5", "@babel/runtime": "^7.21.5",
"@nutui/icons-vue-taro": "^0.0.9", "@nutui/nutui-taro": "^4.3.13",
"@nutui/nutui-taro": "^4.3.5", "@tarojs/components": "3.6.26",
"@tarojs/components": "3.6.25", "@tarojs/helper": "3.6.26",
"@tarojs/helper": "3.6.25", "@tarojs/plugin-framework-vue3": "3.6.26",
"@tarojs/plugin-framework-vue3": "3.6.25",
"@tarojs/plugin-html": "^3.6.26", "@tarojs/plugin-html": "^3.6.26",
"@tarojs/plugin-platform-alipay": "3.6.25", "@tarojs/plugin-platform-alipay": "3.6.26",
"@tarojs/plugin-platform-h5": "3.6.25", "@tarojs/plugin-platform-h5": "3.6.26",
"@tarojs/plugin-platform-harmony-hybrid": "3.6.25", "@tarojs/plugin-platform-harmony-hybrid": "3.6.26",
"@tarojs/plugin-platform-jd": "3.6.25", "@tarojs/plugin-platform-jd": "3.6.26",
"@tarojs/plugin-platform-qq": "3.6.25", "@tarojs/plugin-platform-qq": "3.6.26",
"@tarojs/plugin-platform-swan": "3.6.25", "@tarojs/plugin-platform-swan": "3.6.26",
"@tarojs/plugin-platform-tt": "3.6.25", "@tarojs/plugin-platform-tt": "3.6.26",
"@tarojs/plugin-platform-weapp": "3.6.25", "@tarojs/plugin-platform-weapp": "3.6.26",
"@tarojs/runtime": "3.6.25", "@tarojs/runtime": "3.6.26",
"@tarojs/shared": "3.6.25", "@tarojs/shared": "3.6.26",
"@tarojs/taro": "3.6.25", "@tarojs/taro": "3.6.26",
"dayjs": "^1.11.10", "dayjs": "^1.11.13",
"pinia": "^2.1.7", "pinia": "^2.2.2",
"pinia-plugin-persistedstate": "^4.0.1",
"vue": "^3.0.0" "vue": "^3.0.0"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.8.0", "@babel/core": "^7.8.0",
"@nutui/auto-import-resolver": "^1.0.0", "@nutui/auto-import-resolver": "^1.0.0",
"@tarojs/cli": "3.6.25", "@tarojs/cli": "3.6.26",
"@tarojs/taro-loader": "3.6.25", "@tarojs/taro-loader": "3.6.26",
"@tarojs/test-utils-vue3": "^0.1.1", "@tarojs/test-utils-vue3": "^0.1.1",
"@tarojs/webpack5-runner": "3.6.25", "@tarojs/webpack5-runner": "3.6.26",
"@types/jest": "^29.3.1", "@types/jest": "^29.3.1",
"@types/node": "^18.15.11", "@types/node": "^18.15.11",
"@types/qrcode": "^1.5.5",
"@types/webpack-env": "^1.13.6", "@types/webpack-env": "^1.13.6",
"@typescript-eslint/eslint-plugin": "^6.2.0", "@typescript-eslint/eslint-plugin": "^6.2.0",
"@typescript-eslint/parser": "^6.2.0", "@typescript-eslint/parser": "^6.2.0",
"@vue/babel-plugin-jsx": "^1.0.6", "@vue/babel-plugin-jsx": "^1.0.6",
"@vue/compiler-sfc": "^3.0.0", "@vue/compiler-sfc": "^3.0.0",
"babel-preset-taro": "3.6.25", "babel-preset-taro": "3.6.26",
"css-loader": "3.4.2", "css-loader": "3.4.2",
"eslint": "^8.12.0", "eslint": "^8.12.0",
"eslint-config-taro": "3.6.25", "eslint-config-taro": "3.6.26",
"eslint-plugin-vue": "^8.0.0", "eslint-plugin-vue": "^8.0.0",
"jest": "^29.3.1", "jest": "^29.3.1",
"jest-environment-jsdom": "^29.5.0", "jest-environment-jsdom": "^29.5.0",
@ -90,8 +87,8 @@
"ts-node": "^10.9.1", "ts-node": "^10.9.1",
"tsconfig-paths-webpack-plugin": "^4.1.0", "tsconfig-paths-webpack-plugin": "^4.1.0",
"typescript": "^5.1.0", "typescript": "^5.1.0",
"unplugin-vue-components": "^0.26.0", "unplugin-vue-components": "^0.27.4",
"vue-loader": "^17.0.0", "vue-loader": "^17.1.0",
"webpack": "5.78.0" "webpack": "5.78.0"
} }
} }

View File

@ -1,32 +1,15 @@
{ {
"miniprogramRoot": "dist/", "miniprogramRoot": "./dist",
"projectname": "collect_information", "projectname": "collect_information",
"description": "警保联勤联动小程序", "description": "警保联动小程序",
"appid": "touristappid",
"setting": { "setting": {
"urlCheck": false, "urlCheck": false,
"es6": false, "es6": false,
"enhance": false, "enhance": false,
"compileHotReLoad": true, "compileHotReLoad": false,
"postcss": false, "postcss": false,
"minified": false, "minified": false
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
}, },
"ignoreUploadUnusedFiles": true "compileType": "miniprogram"
},
"compileType": "miniprogram",
"libVersion": "3.5.0",
"srcMiniprogramRoot": "dist/",
"packOptions": {
"ignore": [],
"include": []
},
"condition": {},
"editorSetting": {
"tabIndent": "insertSpaces",
"tabSize": 2
},
"appid": "wx8902ddbfddb820d1"
} }

View File

@ -1,62 +0,0 @@
{
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"projectname": "collect_information",
"setting": {
"compileHotReLoad": true
},
"condition": {
"miniprogram": {
"list": [
{
"name": "pages/projectManager/myProject/myProject",
"pathName": "pages/projectManager/myProject/myProject",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "",
"pathName": "pages/mine/mine",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "",
"pathName": "pages/login/login",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "",
"pathName": "pages/mine/mine",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "",
"pathName": "pages/index/index",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "",
"pathName": "pages/index/dataEntry/buildFloorEntry/buildFloorEntry",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "",
"pathName": "pages/register/register",
"query": "",
"launchMode": "default",
"scene": null
}
]
}
}
}

View File

@ -1,58 +1,38 @@
import {MINI_PROGRAM_USER_CONFIG} from "@/config";
const tabBarItems = Object.values(MINI_PROGRAM_USER_CONFIG).map(item => item.tabBarList).flat()
export default defineAppConfig({ export default defineAppConfig({
pages: [ pages: [
'pages/login/login', 'pages/login/login',
'pages/register/register', 'pages/register/register',
'pages/projectManager/index/index', ...tabBarItems.map(i => i.pagePath)
'pages/policeManager/index/index', ],
'pages/mine/mine', subPackages: [
'pages/employeeInfo/employeeInfo', {
root: "subPages/projectManager",
pages: [
'myProject/myProject',
'myProject/projectDetails/projectDetails',
'securityUserForm/securityUserForm',
]
}, {
root: "subPages/police",
pages: [
'myEnterprisesUnit/myEnterprisesUnit',
'myEnterprisesUnit/projectDetails/projectDetails'
]
}
], ],
window: { window: {
backgroundTextStyle: 'light', backgroundTextStyle: 'light',
navigationBarBackgroundColor: '#4e87ff', navigationBarBackgroundColor: '#4e87ff',
navigationBarTitleText: '', navigationBarTitleText: '',
navigationBarTextStyle:'white', navigationBarTextStyle: 'white',
}, },
subpackages: [
{
root: "subPages",
pages: [
'pages/policeManager/index',
'pages/policeDetails/index',
'pages/myProject/myProject',
'pages/projectDetails/projectDetails',
'pages/form/form'
]
}
],
tabBar: { tabBar: {
custom: true, custom: true,
list: [ list: tabBarItems
{
pagePath: 'pages/projectManager/index/index',
text: '首页',
iconPath: "assets/mine/punch.png",
selectedIconPath: "assets/mine/punch-active.png"
},
{
pagePath: 'pages/policeManager/index/index',
text: '首页',
iconPath: "assets/mine/punch.png",
selectedIconPath: "assets/mine/punch-active.png"
},
{
pagePath: 'pages/employeeInfo/employeeInfo',
text: '员工信息',
iconPath: "assets/mine/punch.png",
selectedIconPath: "assets/mine/punch-active.png"
},
{
pagePath: 'pages/mine/mine',
text: '我的',
iconPath: "assets/mine/my.png",
selectedIconPath: "assets/mine/my-active.png"
},
]
} }
}) })

View File

@ -1,4 +0,0 @@
*{
margin: 0;
padding: 0;
}

View File

@ -1,35 +1,28 @@
import {createApp} from 'vue' import {createApp} from 'vue'
import {createPinia} from 'pinia' import '@/app.scss'
import {useCounterStore} from '@/store' import '@/assets/css/main.css'
import './app.scss' import {pinia} from "@/store";
import './assets/scss/colorui.scss'
import Taro from "@tarojs/taro"; import Taro from "@tarojs/taro";
import {MINI_PROGRAM_USER_CONFIG} from "@/config";
import {useUserStore} from "@/store/userStore";
import {initEnum} from "@/enums";
const pinia = createPinia()
// import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
// pinia.use(piniaPluginPersistedstate)
const App = createApp({ const App = createApp({
onShow(options) { onLaunch(opt) {
// try { initEnum()
// const store = useCounterStore() if (opt.path === 'subPages/projectManager/securityUserForm/securityUserForm' && opt.query.type === 'QcCodeInput') {
// const token = Taro.getStorageSync('token') return
// console.log(token) }
// if (token) { const tokenInfo = useUserStore().getTokenInfo();
// Taro.switchTab({ if (tokenInfo) {
// url: '/pages/mine/mine' Taro.switchTab({
// // url: '/pages/projectManager/index/index' url: MINI_PROGRAM_USER_CONFIG[tokenInfo.extData.identity.value].toIndex
// })
// }) } else {
// store.setSelected(2) Taro.navigateTo({
// } else { url: '/pages/login/login',
// console.log(2222) })
// } }
// console.log('App onShow.')
// } catch (err) {
// console.log(err)
//
// }
}, },
// 入口组件不需要实现 render 方法,即使实现了也会被 taro 所覆盖 // 入口组件不需要实现 render 方法,即使实现了也会被 taro 所覆盖
}) })

Binary file not shown.

After

Width:  |  Height:  |  Size: 500 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -0,0 +1,46 @@
import {UserConfig} from "@/types/config";
/**
*
*/
export const CLIENT_TYPE = 'MINI_PROGRAM'
/**
*
*/
export const MINI_PROGRAM_USER_CONFIG: Record<MiniProgramUserIdentity, UserConfig> = {
police: {
toIndex: '/pages/police/index/index',
tabBarList: [
{
pagePath: 'pages/police/index/index',
text: '首页',
iconPath: "assets/mine/punch.png",
selectedIconPath: "assets/mine/punch-active.png"
},
{
pagePath: 'pages/police/mine/index',
text: '警察我的',
iconPath: "assets/mine/my.png",
selectedIconPath: "assets/mine/my-active.png"
},
]
},
project_manager: {
toIndex: '/pages/projectManager/index/index',
tabBarList: [
{
pagePath: 'pages/projectManager/index/index',
text: '首页',
iconPath: "assets/mine/punch.png",
selectedIconPath: "assets/mine/punch-active.png"
},
{
pagePath: 'pages/projectManager/mine/index',
text: '项目经理我的',
iconPath: "assets/mine/my.png",
selectedIconPath: "assets/mine/my-active.png"
},
]
}
}

View File

@ -1,34 +1,42 @@
<template> <template>
<!--https://developers.weixin.qq.com/community/develop/doc/000c84de0cc590bbe54b97edf5e414?highLine=%25E8%2587%25AA%25E5%25AE%259A%25E4%25B9%2589tabbar--> <cover-view class="tab-bar">
<!--微信官方 回复 关于 自定义tabbar切换时会闪烁--> <cover-view class="tab-bar-border"></cover-view>
<cover-view
<view class="tab-bar"> class="tab-bar-item"
<view class="tab-bar-border"></view> v-for="(item, index) in tabBarList"
<view v-for="(item, index) in list" :key="index" class="tab-bar-item" @tap="switchTab(index, item.pagePath)"> :key="item.pagePath"
<image :src="selected === index ? item.selectedIconPath : item.iconPath"/> @tap="switchTab(index, item.pagePath)">
<view :style="{ color: selected === index ? selectedColor : color }">{{ item.text }}</view> <cover-image :src="selected === index ? '/' + item.selectedIconPath : '/' + item.iconPath"/>
</view> <cover-view :style="{ color: selected === index ? selectedColor : color }">{{ item.text }}</cover-view>
</view> </cover-view>
</cover-view>
</template> </template>
<script setup> <script setup lang="ts">
import Taro from '@tarojs/taro' import {MINI_PROGRAM_USER_CONFIG} from "@/config";
import {computed} from 'vue' import Taro from "@tarojs/taro";
import {useCounterStore} from '@/store' import {useTabBarStore} from "@/store/tabBarStore";
import {storeToRefs} from "pinia";
import {useUserStore} from "@/store/userStore";
import {computed} from "vue";
const {tokenInfo} = storeToRefs(useUserStore())
/**
* 默认 TabBar 与自定义 TabBar 的最大不同点在于 <p>默认 TabBar 在所有 TabBar 页共享一个组件实例而自定义 TabBar 在各个 TabBar 页面初始化时都会创建一个新的组件实例</p>
* 也就是说各个 TabBar 页内的自定义 TabBar 组件实例的状态是不共享的因此对 TabBar 的状态管理例如 selected 选中态则尤为重要
*/
const tabBarStore = useTabBarStore()
const {selected} = storeToRefs(tabBarStore)
const store = useCounterStore()
const selected = computed(() => store.getSelected)
const color = '#000000' const color = '#000000'
const selectedColor = '#DC143C' const selectedColor = '#DC143C'
const list = computed(() => store.getList)
function switchTab(index, url) { const tabBarList = computed(() => tokenInfo.value ? MINI_PROGRAM_USER_CONFIG[tokenInfo.value.extData.identity.value].tabBarList : []);
setSelected(index)
Taro.switchTab({url})
}
function setSelected(index) { const switchTab = (index: number, path: string) => {
store.setSelected(index) // 使 Pinia action tabBarStore.setSelected(index)
Taro.switchTab({url: '/' + path})
} }
</script> </script>
@ -63,12 +71,12 @@ function setSelected(index) {
flex-direction: column; flex-direction: column;
} }
.tab-bar-item image { .tab-bar-item cover-image {
width: 54px; width: 54px;
height: 54px; height: 54px;
} }
.tab-bar-item view { .tab-bar-item cover-view {
font-size: 20px; font-size: 20px;
} }
</style> </style>

View File

@ -1,34 +1,40 @@
export const SEX: SelectNode<number>[] = [ import api from "@/request";
{ import Taro from "@tarojs/taro";
value: 0,
label: "男",
},
{
value: 1,
label: "女",
},
{
value: 2,
label: "隐藏",
}
];
export const IDENTITY: SelectNode<string>[] = [ type EnumType =
{ 'CheckStatus'
label: "公安", | 'DeleteFlag'
value: "police" | 'IsEnable'
}, | 'IsOrNot'
{ | 'Sex'
label: "项目经理", | 'ServiceProjectType'
value: "project_manager" | 'MiniProgramUserIdentity'
},
]
export const getLabelByEnumValue = (enums: SelectNode<any>[], value: any): string => { export const initEnum = () => {
for (let i = 0; i < enums.length; i++) { api.get<Record<EnumType, SelectNodeVo<any>[]>>('/common/enums').then(resp => {
if (enums[i].value === value) { Taro.setStorageSync('enumMap', resp.data)
return enums[i].label })
};
export const enumSelectNodes = <T, >(enumType: EnumType): SelectNodeVo<T>[] => Taro.getStorageSync('enumMap')?.[enumType]
export const getEnumByValue = <T, >(enumType: EnumType, value: T): null | SelectNodeVo<T> => {
const enumList = enumSelectNodes<T>(enumType);
if (!enumList) {
return null;
}
for (let i = 0; i < enumList.length; i++) {
if (value === enumList[i].value) {
return enumList[i]
} }
} }
return null;
};
export const getEnumLabelByValue = <T, >(enumType: EnumType, value: T): string => {
const enums = getEnumByValue(enumType, value)
if (!enums) {
return '-' return '-'
} }
return enums.label;
};

View File

@ -1,4 +0,0 @@
export default definePageConfig({
// navigationBarTitleText: '自定义导航栏',
navigationStyle: "custom"
})

View File

@ -1,21 +0,0 @@
<template>
<view style="height: 42px;background: #3d69dc"></view>
<view></view>
<view></view>
</template>
<script setup lang="ts">
import Taro, {useLoad } from "@tarojs/taro";
import './employeeInfo.scss'
useLoad(() => {
// TaroSetNavigationBarTitle()
})
</script>
<style scoped lang="scss">
.dropdown{
background: red;
height: 100px;
}
</style>

View File

@ -1,73 +1,45 @@
<template> <template>
<view class="SignMultiple"> <view class="content">
<view class="urlIndex"> <view class="bg"></view>
<view class="urlTitle"> <view class="bg2"></view>
<view class="urlWelcome"> <view class="tips">
<view style="font-size: 26px">Welcome</view> <text class="title">登录</text>
<view class="urlHibiscus"> <text class="subtitle">欢迎再次回来~</text>
<view class="contact">
<image
src='https://img12.360buyimg.com/imagetools/jfs/t1/196430/38/8105/14329/60c806a4Ed506298a/e6de9fb7b8490f38.png'
mode="scaleToFill"
class="image"
/>
<text>欢迎</text>
</view>
</view>
</view>
</view>
</view>
<view class="SignItem">
<view class="Cancel">
<nut-button block type="success" @click="onLogin">一键授权</nut-button>
</view> </view>
<view class="form-box">
<image src="@/assets/logo/guohui.png"/>
<view class="btn margin-top-lg" @click="login">一键登录</view>
</view> </view>
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import "./login.scss"; import Taro from "@tarojs/taro";
import Taro, {useLoad} from "@tarojs/taro"; import api from "@/request";
import api from "@/request/index"; import {CLIENT_TYPE, MINI_PROGRAM_USER_CONFIG} from "@/config";
import {useUserStore} from "@/store/userStore";
import {useCounterStore} from '@/store' const {saveTokenInfo} = useUserStore()
const login = () => {
const store = useCounterStore()
useLoad(() => {});
const onLogin = () => {
Taro.login({ Taro.login({
success: (res) => { success: (res) => {
if (res.code) { if (res.code) {
api.post<LoginUserInfo>("/login", { api.post<TokenInfo>("/login", {
clientType: 'MINI_PROGRAM', clientType: CLIENT_TYPE,
loginParams: { loginParams: {
code: res.code code: res.code
} }
}).then(async (resp) => { }, {loading: true}).then(async ({data: tokenInfo}) => {
const { //
extData: { saveTokenInfo(tokenInfo!)
identity: {value} //
} await Taro.switchTab({
} = resp.data url: MINI_PROGRAM_USER_CONFIG[tokenInfo!.extData.identity.value].toIndex
if (value === 'police') {
store.updateHomePagePath('/pages/policeManager/index/index') //
} else {
store.updateHomePagePath('/pages/projectManager/index/index') //
}
// list Pinia
await Taro.setStorageSync('list', store.list)
await Taro.setStorage({
key: "token",
data: resp.data,
success(res) {
Taro.switchTab({
// url: '/pages/projectManager/index/index'
url: store.list[0].pagePath
}) })
}, }).catch(err => {
}) //
}).catch((error) => { if (err.code === 402) {
if (error.code === 402) { //
Taro.navigateTo({ Taro.navigateTo({
url: "/pages/register/register", url: "/pages/register/register",
}); });
@ -78,3 +50,81 @@ const onLogin = () => {
}); });
}; };
</script> </script>
<style lang="scss">
.content {
width: 100vw;
height: 100vh;
background-color: #ffffff;
.tips {
padding-top: 200rpx;
padding-left: 80rpx;
display: flex;
flex-direction: column;
.title {
line-height: 70rpx;
font-weight: bold;
font-size: 50rpx;
}
.subtitle {
line-height: 70rpx;
font-size: 35rpx;
font-weight: bold;
color: #b0b0b1;
}
}
.bg {
position: fixed;
top: -250rpx;
right: -250rpx;
width: 600rpx;
height: 600rpx;
border-radius: 100%;
background-color: #00baef;
z-index: 2
}
.bg2 {
position: fixed;
top: -150rpx;
right: -300rpx;
width: 600rpx;
height: 600rpx;
border-radius: 100%;
background-color: #ade8f9;
z-index: 1;
}
.form-box {
padding-top: 180rpx;
padding-left: 70rpx;
width: 610rpx;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
image {
width: 200px;
height: 200px;
}
.btn {
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100rpx;
border-radius: 100rpx;
color: #FFFFFF;
background: linear-gradient(to right, #00c6fc, #9adcf1);
}
}
}
</style>

View File

@ -1,5 +0,0 @@
export default definePageConfig({
navigationBarTitleText: '我的',
navigationBarBackgroundColor:'#3d69dc',
navigationBarTextStyle:'white'
})

View File

@ -1,84 +0,0 @@
.message {
height: 100vh;
background-color: #fff;
}
.login-container {
height: 205rpx;
display: flex;
align-items: center;
background-image: url('../../assets/images/banner.jpg');
background-repeat: no-repeat;
background-position: right;
overflow: hidden;
padding: 18rpx;
box-sizing: border-box;
.contact {
height: 100rpx;
width: 100rpx;
border-radius: 50%;
border: solid 1px gray;
.image {
width: 100%;
height: 100%;
border-radius: 50%
}
}
.tips-text {
display: flex;
font-size: 28rpx;
color: #fff;
line-height: 50rpx;
margin-left: 20rpx;
flex-direction: column;
justify-content: space-evenly;
}
}
.userIndex {
.exit {
height: 100rpx;
line-height: 40px;
border-bottom: solid 0.5px #ebebf7;
box-sizing: border-box;
display: flex;
justify-content: space-between;
align-items: center;
// margin-bottom: 30rpx;
color: #7d7d7d;
.exitItem {
display: flex;
align-items: center;
margin-left: 30rpx;
}
.exitItemIndex {
height: 40rpx;
width: 40rpx;
border-radius: 50%;
// border: solid 1px gray;
display: block;
line-height: 48rpx;
image {
width: 100%;
height: 100%;
}
}
.iconScope {
width: 8px;
height: 8px;
display: inline-block;
border: solid 2px #ccc;
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
border-bottom: white;
border-left: white;
}
}
}

View File

@ -1,17 +0,0 @@
<template>
<view class="message">
我的我的我的我的
</view>
</template>
<script setup lang="ts">
import './mine.scss'
import {ref} from "vue";
import Taro, {useLoad,useDidShow} from "@tarojs/taro";
</script>

View File

@ -1,4 +1,3 @@
export default definePageConfig({ export default definePageConfig({
navigationBarTitleText: '首页', navigationBarTitleText: '首页',
}) })

View File

@ -0,0 +1,47 @@
.swiperDemoItem {
color: #3886d0;
display: flex;
padding: 20px 0 0 50px;
overflow: hidden;
height: 70rpx;
.swiperDemoIndex {
width: 15px;
height: 45px;
background-image: linear-gradient(to bottom, #5d9cf9, #317ad9);
//background: rgb();
border-radius: 20px;
margin-right: 15px;
}
}
.subModule {
display: flex;
align-items: center;
flex-wrap: wrap;
margin-right: -3px;
margin-left: -1px;
.subModuleItem {
width: 33%;
height: 180rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding-bottom: 10rpx;
border: 1px solid #ccc;
border-left: 0;
margin-top: -1px;
.subModuleIndex {
width: 65rpx;
height: 65rpx;
image {
width: 100%;
height: 100%;
}
}
}
}

View File

@ -0,0 +1,58 @@
<template>
<view>
<view class="swiperDemo">
<nut-swiper ref="swiperRef" pagination-visible pagination-color="#e53e31" :auto-play="3000" :init-page="0">
<nut-swiper-item v-for="(item, index) in list" :key="index" style="height: 180px">
<image src="@/assets/images/01.png" alt="" style="height: 100%; width: 100%" draggable="false"/>
</nut-swiper-item>
</nut-swiper>
</view>
<view class="swiperDemoItem">
<view class="swiperDemoIndex"></view>
<view>请选择</view>
</view>
<!--九宫格-->
<view>
<view class="subModule">
<view class="subModuleItem" v-for="item in subModuleList" :key="item.id" @click="subNavigation(item.url)">
<view class="subModuleIndex">
<image :src="item.icon"></image>
</view>
<view style=" font-size: 12px;color: #414141;margin-top: 9px">{{ item.name }}</view>
</view>
</view>
</view>
</view>
</template>
<script setup lang="ts">
import {ref} from 'vue'
import Taro from "@tarojs/taro";
import icon from '@/assets/images/project.png'
import './index.scss'
const list = ref(['https://storage.360buyimg.com/jdc-article/NutUItaro34.jpg',])
const swiperRef = ref() //
const subModuleList = ref([
{
id: 0,
icon: icon,
name: '企事业单位',
url: '/subPages/police/myEnterprisesUnit/myEnterprisesUnit'
},
{
id: 1,
icon: icon,
name: '警保风采',
url: ''
},
{
id: 2,
icon: icon,
name: '待定',
url: ''
}
])
const subNavigation = async (url: string) => Taro.navigateTo({url})
</script>

View File

@ -0,0 +1,3 @@
export default definePageConfig({
navigationBarTitleText: '首页',
})

View File

@ -0,0 +1,9 @@
<template>
<view>
警察我的
</view>
</template>
<script setup lang="ts">
</script>

View File

@ -1,39 +0,0 @@
page {
background-color: #f0f0f0;
}
.content {
width: 702rpx;
margin: 10rpx auto;
background-color: #fff;
border-radius: 10rpx;
height: 500rpx;
display: grid;
/* 定义两列每列占据50%的宽度 */
grid-template-columns: repeat(2, 1fr);
/* 定义两行每行占据1fr分数单位表示剩余空间的一部分 */
grid-template-rows: repeat(2, 1fr);
/* 可选:增加一些间隙 */
gap: 10px;
.grid-item {
//width: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
.grid-item-image {
height: 150rpx;
width: 150rpx;
background-color: #f0f0f0;
border-radius: 50%;
}
.grid-item-text {
}
}
}

View File

@ -1,85 +0,0 @@
<template>
<view>
<view class="swiper-demo">
<nut-swiper ref="swiperRef" pagination-visible pagination-color="#e53e31" :auto-play="3000" :init-page="0">
<nut-swiper-item v-for="(item, index) in list" :key="index" style="height: 150px">
<img :src="item" alt="" style="height: 100%; width: 100%" draggable="false"/>
</nut-swiper-item>
</nut-swiper>
</view>
<view class="margin-top">
<nut-grid :column-num="3">
<nut-grid-item
text="企事业单位"
@click="Taro.navigateTo({url: '/subPages/pages/policeManager/index'})">
</nut-grid-item>
<nut-grid-item
text="警保风采"
@click="Taro.navigateTo({url: '/pages/index/dataEntry/personnelInformationEntry/personnelInformationEntry'})">
</nut-grid-item>
<nut-grid-item text=".....">
</nut-grid-item>
</nut-grid>
</view>
</view>
</template>
<script setup lang="ts">
import './index.scss'
import {ref} from 'vue'
import Taro from "@tarojs/taro";
const list = ref([
'https://storage.360buyimg.com/jdc-article/NutUItaro34.jpg',
'https://storage.360buyimg.com/jdc-article/NutUItaro2.jpg',
'https://storage.360buyimg.com/jdc-article/welcomenutui.jpg',
'https://storage.360buyimg.com/jdc-article/fristfabu.jpg'
])
const swiperRef = ref()
</script>
<!--<template>-->
<!-- <view>-->
<!-- <view class="content">-->
<!-- <div @tap="routerPush(1)" class="grid-item">-->
<!-- <image class="grid-item-image"></image>-->
<!-- <view class="grid-item-text">企事业单位</view>-->
<!-- </div>-->
<!-- <div class="grid-item">-->
<!-- <image class="grid-item-image"></image>-->
<!-- <view class="grid-item-text">监督考核</view>-->
<!-- </div>-->
<!-- <div class="grid-item">-->
<!-- <image class="grid-item-image"></image>-->
<!-- <view class="grid-item-text">警保风采</view>-->
<!-- </div>-->
<!-- <div class="grid-item">-->
<!-- <image class="grid-item-image"></image>-->
<!-- <view class="grid-item-text">三色预警</view>-->
<!-- </div>-->
<!-- </view>-->
<!-- </view>-->
<!--</template>-->
<!--<script setup lang="ts">-->
<!--import Taro from "@tarojs/taro";-->
<!--const routerPush = (path) => {-->
<!-- switch (path) {-->
<!-- case 1:-->
<!-- Taro.navigateTo({-->
<!-- url: '/subPages/pages/policeManager/index',-->
<!-- })-->
<!-- }-->
<!--}-->
<!--import './index.scss'-->
<!--</script>-->
<!--<style scoped lang="scss">-->
<!--</style>-->

View File

@ -1,4 +1,3 @@
export default definePageConfig({ export default definePageConfig({
navigationBarTitleText: '首页', navigationBarTitleText: '首页',
}) })

View File

@ -0,0 +1,48 @@
.swiperDemoItem {
color: #3886d0;
display: flex;
padding: 20px 0 0 50px;
overflow: hidden;
height: 70rpx;
.swiperDemoIndex {
width: 15px;
height: 45px;
background-image: linear-gradient(to bottom, #5d9cf9, #317ad9);
//background: rgb();
border-radius: 20px;
margin-right: 15px;
}
}
.subModule {
display: flex;
align-items: center;
flex-wrap: wrap;
margin-right: -3px;
margin-left: -1px;
.subModuleItem {
width: 33%;
height: 180rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding-bottom: 10rpx;
border: 1px solid #ccc;
border-left: 0;
margin-top: -1px;
.subModuleIndex {
width: 65rpx;
height: 65rpx;
image {
width: 100%;
height: 100%;
}
}
}
}

View File

@ -1,41 +1,58 @@
<template> <template>
<view> <view>
<view class="swiper-demo"> <view class="swiperDemo">
<nut-swiper ref="swiperRef" pagination-visible pagination-color="#e53e31" :auto-play="3000" :init-page="0"> <nut-swiper ref="swiperRef" pagination-visible pagination-color="#e53e31" :auto-play="3000" :init-page="0">
<nut-swiper-item v-for="(item, index) in list" :key="index" style="height: 150px"> <nut-swiper-item v-for="(item, index) in list" :key="index" style="height: 180px">
<img :src="item" alt="" style="height: 100%; width: 100%" draggable="false"/> <image src="@/assets/images/01.png" alt="" style="height: 100%; width: 100%" draggable="false"/>
</nut-swiper-item> </nut-swiper-item>
</nut-swiper> </nut-swiper>
</view> </view>
<view class="margin-top"> <view class="swiperDemoItem">
<nut-grid :column-num="3"> <view class="swiperDemoIndex"></view>
<nut-grid-item <view>请选择</view>
text="我的项目" </view>
@click="Taro.navigateTo({url: '/subPages/pages/myProject/myProject'})"> <!--九宫格-->
</nut-grid-item> <view>
<nut-grid-item <view class="subModule">
text="警保风采" <view class="subModuleItem" v-for="item in subModuleList" :key="item.id" @click="subNavigation(item.url)">
@click="Taro.navigateTo({url: '/pages/index/dataEntry/personnelInformationEntry/personnelInformationEntry'})"> <view class="subModuleIndex">
</nut-grid-item> <image :src="item.icon"></image>
<nut-grid-item text="....."> </view>
</nut-grid-item> <view style=" font-size: 12px;color: #414141;margin-top: 9px">{{ item.name }}</view>
</nut-grid> </view>
</view>
</view> </view>
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import './index.scss'
import {ref} from 'vue' import {ref} from 'vue'
import Taro from "@tarojs/taro"; import Taro from "@tarojs/taro";
import icon from '@/assets/images/project.png'
import './index.scss'
const list = ref([ const list = ref(['https://storage.360buyimg.com/jdc-article/NutUItaro34.jpg',])
'https://storage.360buyimg.com/jdc-article/NutUItaro34.jpg', const swiperRef = ref() //
'https://storage.360buyimg.com/jdc-article/NutUItaro2.jpg', const subModuleList = ref([
'https://storage.360buyimg.com/jdc-article/welcomenutui.jpg', {
'https://storage.360buyimg.com/jdc-article/fristfabu.jpg' id: 0,
icon: icon,
name: '我的项目',
url: '/subPages/projectManager/myProject/myProject'
},
{
id: 1,
icon: icon,
name: '警保风采',
url: ''
},
{
id: 2,
icon: icon,
name: '待定',
url: ''
}
]) ])
const swiperRef = ref()
const subNavigation = async (url: string) => Taro.navigateTo({url})
</script> </script>

View File

@ -0,0 +1,3 @@
export default definePageConfig({
navigationBarTitleText: '我的',
})

View File

@ -0,0 +1,9 @@
<template>
<view>
项目经理我的
</view>
</template>
<script setup lang="ts">
</script>

View File

@ -1,3 +1,3 @@
export default definePageConfig({ export default definePageConfig({
navigationBarTitleText: '用户注册' navigationBarTitleText: '注册'
}) })

View File

@ -47,7 +47,7 @@
</nut-form-item> </nut-form-item>
<nut-form-item label="单位:" name="unitId"> <nut-form-item label="单位:" name="unitId">
<view @click="unitsList" style="color: #808080"> <view @click="unitsList" style="color: #808080">
{{ selectedLabel || '请选择单位'}} {{ selectedLabel || '请选择单位' }}
</view> </view>
</nut-form-item> </nut-form-item>
</nut-form> </nut-form>
@ -75,19 +75,23 @@
<script setup lang="ts"> <script setup lang="ts">
import './register.scss' import './register.scss'
import {onMounted, ref, watch} from "vue"; import {onMounted, ref, watch} from "vue";
import {IDENTITY, SEX} from "@/enums"; import {enumSelectNodes} from "@/enums";
import Taro from "@tarojs/taro"; import Taro from "@tarojs/taro";
import api from '@/request/index' import api from '@/request/index'
import type {FormInstance} from "@nutui/nutui-taro"; import type {FormInstance} from "@nutui/nutui-taro";
import {FormRules} from "@nutui/nutui-taro/dist/types/__VUE/form/types"; import {FormRules} from "@nutui/nutui-taro/dist/types/__VUE/form/types";
import {RegisterParams} from "@/types/pages/register";
const IDENTITY = enumSelectNodes('MiniProgramUserIdentity')
const SEX = enumSelectNodes('Sex')
const formData = ref<RegisterParams>({ const formData = ref<RegisterParams>({
avatar: "https://img12.360buyimg.com/imagetools/jfs/t1/196430/38/8105/14329/60c806a4Ed506298a/e6de9fb7b8490f38.png", avatar: "https://img12.360buyimg.com/imagetools/jfs/t1/196430/38/8105/14329/60c806a4Ed506298a/e6de9fb7b8490f38.png",
name: "", name: "",
sex:0, sex: 0,
telephone:'', telephone: '',
identity: 'police', identity: 'police',
unitId:'' unitId: ''
}); });
const show = ref(false) const show = ref(false)
const visible = ref(false) const visible = ref(false)
@ -95,7 +99,7 @@ const TreeValue = ref<Record<string, any>[]>([])
const TreeData = ref(['']); const TreeData = ref(['']);
const streetCommunitySmallCommunityLabel = ref<string>(""); const streetCommunitySmallCommunityLabel = ref<string>("");
const getAdministrativeDivisionTree = async () => { const getAdministrativeDivisionTree = async () => {
const resp = await api.get<TreeNode<string>[]>('/common/administrativeDivisionTree') const resp = await api.get<TreeNodeVo<string>[]>('/common/administrativeDivisionTree')
TreeData.value = resp.data as any TreeData.value = resp.data as any
console.log(resp.data) console.log(resp.data)
} }
@ -105,34 +109,34 @@ const change = (value: string, pathNodes: Record<string, any>[]) => {
} }
const columns = ref([]) const columns = ref([])
const unitsList = async () => { const unitsList = async () => {
if(streetCommunitySmallCommunityLabel.value !== ''){ if (streetCommunitySmallCommunityLabel.value !== '') {
show.value = true show.value = true
const queryUnitListByIdentityQueryParams = { const queryUnitListByIdentityQueryParams = {
identity: formData.value.identity, identity: formData.value.identity,
administrativeDivisionCodes: TreeValue.value administrativeDivisionCodes: TreeValue.value
} }
const resp = await api.post<TreeNode<string>[]>('/common/queryUnitListByIdentity', queryUnitListByIdentityQueryParams) const resp = await api.post<TreeNodeVo<string>[]>('/common/queryUnitListByIdentity', queryUnitListByIdentityQueryParams)
columns.value = resp.data as any columns.value = resp.data as any
}else{ } else {
Taro.showToast({ Taro.showToast({
title:'请先选择行政区划', title: '请先选择行政区划',
}) })
} }
} }
const selectedLabel = ref ('') const selectedLabel = ref('')
const confirm = ({selectedOptions, selectedValue}) => { const confirm = ({selectedOptions, selectedValue}) => {
Object.keys(selectedOptions).forEach((e)=>{ Object.keys(selectedOptions).forEach((e) => {
selectedLabel.value = selectedOptions[e].label selectedLabel.value = selectedOptions[e].label
formData.value.unitId = selectedOptions[e].value formData.value.unitId = selectedOptions[e].value
}) })
console.log(formData.value.unitId,selectedLabel.value) console.log(formData.value.unitId, selectedLabel.value)
show.value = false show.value = false
} }
// //
watch(()=>formData.value.identity,(value)=>{ watch(() => formData.value.identity, (value) => {
formData.value.unitId = '' formData.value.unitId = ''
selectedLabel.value = '' selectedLabel.value = ''
}) })
@ -149,7 +153,7 @@ const register = async () => {
telephone: formData.value.telephone, telephone: formData.value.telephone,
sex: formData.value.sex, sex: formData.value.sex,
identity: formData.value.identity, identity: formData.value.identity,
unitId:formData.value.unitId unitId: formData.value.unitId
} }
const resp = await api.post<string>('/miniProgramUser/register', miniProgramUserRegisterParams, {loading: true}) const resp = await api.post<string>('/miniProgramUser/register', miniProgramUserRegisterParams, {loading: true})
Taro.showToast({ Taro.showToast({
@ -167,7 +171,7 @@ const register = async () => {
}) })
}, },
}) })
}else{ } else {
Taro.showToast({ Taro.showToast({
title: res.errMsg, title: res.errMsg,
icon: 'error', icon: 'error',
@ -181,7 +185,7 @@ const register = async () => {
const rules: FormRules = { const rules: FormRules = {
name: [ name: [
{ required: true, message: "请输入姓名" }, {required: true, message: "请输入姓名"},
{ {
validator: (value) => { validator: (value) => {
return !(value.length < 2 || value.length >= 20); return !(value.length < 2 || value.length >= 20);
@ -189,9 +193,9 @@ const rules: FormRules = {
message: "名字在2~20字符之间", message: "名字在2~20字符之间",
}, },
], ],
sex: [{ required: true, message: "请选择性别" }], sex: [{required: true, message: "请选择性别"}],
telephone: [ telephone: [
{ required: true, message: "请输入手机号码" }, {required: true, message: "请输入手机号码"},
{ {
regex: /^400(-?)[0-9]{7}$|^1\d{10}$|^0[0-9]{2,3}-[0-9]{7,8}$/, regex: /^400(-?)[0-9]{7}$|^1\d{10}$|^0[0-9]{2,3}-[0-9]{7,8}$/,
message: "手机格式错误", message: "手机格式错误",
@ -207,11 +211,10 @@ const onChooseAvatar = (e) => {
// //
const getNickname = (e) => { const getNickname = (e) => {
formData.value.name = e.detail.value formData.value.name = e.detail.value
console.log( formData.value.name) console.log(formData.value.name)
} }
onMounted(async () => { onMounted(async () => {
await getAdministrativeDivisionTree() await getAdministrativeDivisionTree()
}) })
</script> </script>

View File

@ -1,26 +1,33 @@
import Taro from "@tarojs/taro"; import Taro from "@tarojs/taro";
import {ApiOptions} from "../../types/request"; import {ApiOptions} from "@/types/request";
import {type} from "os"; import {useUserStore} from "@/store/userStore";
/**
*
* @param chain
*/
const requestInterceptor = (chain: Taro.Chain) => { const requestInterceptor = (chain: Taro.Chain) => {
const requestParams = chain.requestParams const requestParams = chain.requestParams
const token = Taro.getStorageSync('token') const tokenInfo = useUserStore().getTokenInfo()
if (token) { const {header} = requestParams;
const customHeader: Record<string, any> = {}
//添加token
tokenInfo && (customHeader[tokenInfo.name] = tokenInfo.value);
requestParams.header = { requestParams.header = {
...requestParams.header, ...header,
token: token.value ...customHeader
}
} }
return chain.proceed(requestParams) return chain.proceed(requestParams)
} }
class CustomRequest { //所有的拦截器
BASE_API: string const interceptors = [requestInterceptor];
//注册拦截器
interceptors.forEach((interceptorItem) => Taro.addInterceptor(interceptorItem));
public constructor() { class CustomRequest {
this.BASE_API = process.env.TARO_APP_BASE_API BASE_API: string = process.env.TARO_APP_BASE_API;
Taro.addInterceptor(requestInterceptor)
}
private request<T>(url: string, method: keyof Taro.request.Method, options: ApiOptions, params?: object,): Promise<JsonResult<T>> { private request<T>(url: string, method: keyof Taro.request.Method, options: ApiOptions, params?: object,): Promise<JsonResult<T>> {
return new Promise<JsonResult<T>>((resolve, reject) => { return new Promise<JsonResult<T>>((resolve, reject) => {
@ -29,7 +36,6 @@ class CustomRequest {
title: '请求中...', title: '请求中...',
}).then() }).then()
} }
Taro.request<JsonResult<T>, object>({ Taro.request<JsonResult<T>, object>({
url: this.BASE_API + url, url: this.BASE_API + url,
data: params, data: params,
@ -37,10 +43,14 @@ class CustomRequest {
...options, ...options,
success: (result) => { success: (result) => {
Taro.hideLoading() Taro.hideLoading()
if (result.header['Content-Type'] === 'application/octet-stream') {
resolve(result.data)
return
}
const jsonResult = result.data const jsonResult = result.data
if (jsonResult.code !== 200) { if (jsonResult.code !== 200) {
if ([401].includes(jsonResult.code)) { if ([401].includes(jsonResult.code)) {
//todo 重新登录 跳转登录页 提示错误 // 重新登录 跳转登录页 提示错误
} }
Taro.showToast({ Taro.showToast({
title: jsonResult.message, title: jsonResult.message,
@ -49,8 +59,9 @@ class CustomRequest {
duration: 2000 duration: 2000
}).then() }).then()
reject(jsonResult); reject(jsonResult);
} } else {
resolve(jsonResult); resolve(jsonResult);
}
}, },
fail: (res) => { fail: (res) => {
Taro.hideLoading() Taro.hideLoading()
@ -61,13 +72,16 @@ class CustomRequest {
duration: 2000 duration: 2000
}).then() }).then()
reject(res.errMsg); reject(res.errMsg);
console.log(res.errMsg, '000')
} }
}) })
}) })
} }
get<T>(url: string, params?: object, options: ApiOptions = {loading: false}): Promise<JsonResult<T>> { get<T>(url: string, params?: object, options: ApiOptions = {loading: false}): Promise<JsonResult<T>> {
options.header = {
...options.header,
"content-type": 'application/x-www-form-urlencoded'
}
return this.request<T>(url, "GET", options, params) return this.request<T>(url, "GET", options, params)
} }
@ -76,12 +90,17 @@ class CustomRequest {
} }
delete<T>(url: string, params?: object, options: ApiOptions = {loading: false}): Promise<JsonResult<T>> { delete<T>(url: string, params?: object, options: ApiOptions = {loading: false}): Promise<JsonResult<T>> {
options.header = {
...options.header,
"content-type": 'application/x-www-form-urlencoded'
}
return this.request(url, "DELETE", options, params) return this.request(url, "DELETE", options, params)
} }
put<T>(url: string, params?: object, options: ApiOptions = {loading: false}): Promise<JsonResult<T>> { put<T>(url: string, params?: object, options: ApiOptions = {loading: false}): Promise<JsonResult<T>> {
return this.request(url, "PUT", options, params) return this.request(url, "PUT", options, params)
} }
} }
const api = new CustomRequest(); const api = new CustomRequest();

View File

@ -1,51 +1,3 @@
import {defineStore} from 'pinia' import {createPinia} from 'pinia'
import Taro from '@tarojs/taro'
export const useCounterStore = defineStore('counter', {
state: () => {
return {
userInfo: {},
selected: 0,
list: Taro.getStorageSync('list') || [
{
pagePath: '/pages/projectManager/index/index',
text: '首页',
iconPath: "/assets/mine/punch.png",
selectedIconPath: "/assets/mine/punch-active.png"
},
{
pagePath: '/pages/employeeInfo/employeeInfo',
text: '员工信息',
iconPath: "/assets/mine/punch.png",
selectedIconPath: "/assets/mine/punch-active.png"
},
{
pagePath: '/pages/mine/mine',
text: '我的',
iconPath: "/assets/mine/my.png",
selectedIconPath: "/assets/mine/my-active.png"
},
]
}
},
actions: {
setSelected(index: number) {
this.selected = index
},
updateHomePagePath(newPath: string) {
this.list[0].pagePath = newPath
// 更新 list 后存储到小程序本地存储
Taro.setStorageSync('list', this.list)
}
},
getters: {
getSelected: (state) => state.selected,
getList: (state) => state.list
},
persist: {
// key: 'my-store', // 存储到 localStorage 的 key
// storage: localStorage, // 持久化方式为 localStorage
// paths: ['list'] // 持久化 list
}
})
export const pinia = createPinia()

View File

@ -0,0 +1,14 @@
import {defineStore} from "pinia";
import {ref} from "vue";
export const useTabBarStore = defineStore('tabBar', () => {
const selected = ref<number>(0)
const setSelected = (index: number) => {
selected.value = index;
}
return {
selected,
setSelected
}
})

View File

@ -0,0 +1,40 @@
import {defineStore} from "pinia";
import {ref} from "vue";
import Taro from "@tarojs/taro";
export const useUserStore = defineStore('userStore', () => {
/** 获取token信息 **/
const getTokenInfo = (): TokenInfo | null => {
const ti = Taro.getStorageSync('tokenInfo')
// 如果 ti 存在且不是空字符串,则返回 ti否则返回 null
return (ti !== undefined && ti !== null && ti !== '') ? ti : null;
}
/** 用户token信息 **/
const tokenInfo = ref<TokenInfo | null>(getTokenInfo())
/** 保存token信息 **/
const saveTokenInfo = (t: TokenInfo) => {
tokenInfo.value = t;
Taro.setStorageSync('tokenInfo', tokenInfo.value)
}
/** 清楚token信息 */
const clearTokenInfo = () => {
tokenInfo.value = null
Taro.removeStorageSync('tokenInfo')
}
/**
*
* 退
*/
const resetUserInfo = () => {
clearTokenInfo()
}
return {
tokenInfo,
saveTokenInfo,
getTokenInfo,
resetUserInfo
}
})

View File

@ -1,3 +0,0 @@
export default definePageConfig({
navigationBarTitleText: '项目人员录入',
})

View File

@ -1,8 +0,0 @@
.form{
.formButton{
display: flex;
margin-top: auto;
justify-content: space-around;
margin-bottom: 30px
}
}

View File

@ -1,3 +0,0 @@
export default definePageConfig({
navigationBarTitleText: '我的项目',
})

View File

@ -1,31 +0,0 @@
.myProject{
height: 100vh;
overflow: hidden;
background: #f1f1f1;
.myProjectItem{
//height: 20%;
margin: 20px;
border-radius: 10px;
background: #ffffff;
padding: 15px;
font-size: 28px;
line-height: 50px;
color: #333333;
.myProjectIndex{
color: #9b9b9f;
}
.project{
display: flex;
justify-content: space-between;
flex-flow: wrap;
text-align: center;
view{
width: 45%;
height: 100rpx;
border: 1px solid #cccccc;
line-height: 100rpx;
margin: 8px 0 8px 0;
}
}
}
}

View File

@ -1,4 +1,3 @@
export default definePageConfig({ export default definePageConfig({
navigationBarTitleText: '企事业单位', navigationBarTitleText: '企事业单位',
}) })

View File

@ -13,8 +13,9 @@
<text>电话{{ item?.contactPersonInfo.telephone }}</text> <text>电话{{ item?.contactPersonInfo.telephone }}</text>
</view> </view>
<view class="project"> <view class="project">
<view @click="projectClick(items,item?.name)" v-for="(items,index) in item.serviceProjectList" :key="index"> <view @click="projectClick(item?.name,serviceProject)" v-for="(serviceProject,index) in item.serviceProjectList"
{{ items.name }} :key="index">
{{ serviceProject.name }}
</view> </view>
</view> </view>
</view> </view>
@ -25,33 +26,21 @@
import api from "@/request/index"; import api from "@/request/index";
import {onMounted, ref} from "vue"; import {onMounted, ref} from "vue";
import Taro from "@tarojs/taro"; import Taro from "@tarojs/taro";
import './index.scss' import './myEnterprisesUnit.scss'
import {MyProjectList, ServiceProjectList} from "@/types/subPages/projectManager/myProject";
const myProjectList = ref<MyProjectList[]>() const myProjectList = ref<MyProjectList[]>()
const getMyServiceProject = async () => { const getMyServiceProject = async () => {
const token = Taro.getStorageSync('token') const resp = await api.get<MyProjectList[]>(`/policeIndex/getUnitServiceProjectList`)
const resp = await api.get<MyProjectList[]>(`/policeIndex/getUnitServiceProjectList`, {
token: token.value
})
myProjectList.value = resp.data myProjectList.value = resp.data
console.log(resp.data)
} }
const projectClick = (items: ServiceProjectList, name: string) => { const projectClick = (enterprisesUnitName: string, serviceProject: ServiceProjectList) => {
console.log(name, JSON.stringify(items))
Taro.navigateTo({ Taro.navigateTo({
url: `/subPages/police/myEnterprisesUnit/projectDetails/projectDetails?enterprisesUnitName=${enterprisesUnitName}&serviceProject=${JSON.stringify(serviceProject)}`,
url: `/subPages/pages/policeDetails/index?name=${name}&item=${JSON.stringify(items)}`,
}) })
} }
onMounted(async () => { onMounted(async () => {
await getMyServiceProject() await getMyServiceProject()
}) })
</script> </script>

View File

@ -1,10 +1,11 @@
.projectDetails{ .projectDetails {
height: 100vh; height: 100vh;
overflow: hidden; overflow: hidden;
background: #f1f1f1; background: #f1f1f1;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
.projectDetailsItem{
.projectDetailsItem {
margin: 10px 20px 10px 20px; margin: 10px 20px 10px 20px;
border-radius: 10px; border-radius: 10px;
background: #ffffff; background: #ffffff;
@ -12,19 +13,23 @@
font-size: 28px; font-size: 28px;
line-height: 65px; line-height: 65px;
color: #333333; color: #333333;
.projectDetailsIndex{
.projectDetailsIndex {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
line-height: 44rpx; line-height: 44rpx;
margin-bottom: 20px; margin-bottom: 20px;
.content{
.content {
color: #9b9b9f; color: #9b9b9f;
} }
} }
} }
.projectDetailsTableDrop{
.projectDetailsTableDrop {
height: 80%; height: 80%;
.projectDetailsTable{
.projectDetailsTable {
margin: 20px; margin: 20px;
border-radius: 10px; border-radius: 10px;
background: #ffffff; background: #ffffff;
@ -32,18 +37,21 @@
font-size: 28px; font-size: 28px;
line-height: 50px; line-height: 50px;
color: #333333; color: #333333;
.projectDetailsTableItem{
.projectDetailsTableItem {
//display: flex; //display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
flex-wrap: wrap; flex-wrap: wrap;
font-size: 24px; font-size: 24px;
margin-bottom: 15px; margin-bottom: 15px;
.projectDetailsTableIndex{
.projectDetailsTableIndex {
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
text-align: center; text-align: center;
view{
view {
width: 70px; width: 70px;
margin-right: 20px; margin-right: 20px;
} }
@ -51,7 +59,8 @@
} }
} }
} }
.projectDetailsButton{
.projectDetailsButton {
position: fixed; position: fixed;
bottom: 19px; bottom: 19px;
display: flex; display: flex;
@ -60,12 +69,11 @@
right: 0; right: 0;
width: 100%; width: 100%;
} }
.nutPopup{
.nutPopup {
width: 300px; width: 300px;
height: 100px; height: 100px;
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
} }
} }

View File

@ -1,4 +1,3 @@
export default definePageConfig({ export default definePageConfig({
navigationBarTitleText: '项目详情', navigationBarTitleText: '项目详情',
}) })

View File

@ -3,14 +3,14 @@
<view class="projectDetailsItem" style="line-height: 50rpx"> <view class="projectDetailsItem" style="line-height: 50rpx">
<view> <view>
<view style="display: flex;justify-content: space-between"> <view style="display: flex;justify-content: space-between">
<text style="font-size: 18px">{{ nameValue ? nameValue : '' }}{{ '-----' + detailsList?.name }}项目</text> <text style="font-size: 18px">{{ enterprisesUnitName }}-----{{ serviceProject?.name }}项目</text>
<!-- <text>进行中</text>--> <!-- <text>进行中</text>-->
</view> </view>
<view> <view>
<view style="float: left;width: 50%;" class="content"> <view style="float: left;width: 50%;" class="content">
经理名称:{{ detailsList?.projectManagerMiniProgramUserInfo.name }} 经理名称:{{ serviceProject?.projectManagerMiniProgramUserInfo.name }}
</view> </view>
<view class="content">手机号:{{ detailsList?.projectManagerMiniProgramUserInfo.telephone }}</view> <view class="content">手机号:{{ serviceProject?.projectManagerMiniProgramUserInfo.telephone }}</view>
</view> </view>
</view> </view>
</view> </view>
@ -18,28 +18,28 @@
<view class="projectDetailsIndex"> <view class="projectDetailsIndex">
<nut-row> <nut-row>
<nut-col :span="24"> <nut-col :span="24">
<view class="content">保安证件号{{ detailsList?.idNumber }}</view> <view class="content">保安证件号{{ serviceProject?.idNumber }}</view>
</nut-col> </nut-col>
</nut-row> </nut-row>
<nut-row> <nut-row>
<nut-col :span="12"> <nut-col :span="12">
<view class="content">工作人员数量:{{ detailsList?.staffTotal }}</view> <view class="content">工作人员数量:{{ serviceProject?.staffTotal }}</view>
</nut-col> </nut-col>
<nut-col :span="12"> <nut-col :span="12">
<view class="content">保安人员数量:{{ detailsList?.securityUserTotal }}</view> <view class="content">保安人员数量:{{ serviceProject?.securityUserTotal }}</view>
</nut-col> </nut-col>
</nut-row> </nut-row>
<nut-row> <nut-row>
<nut-col :span="12"> <nut-col :span="12">
<view class="content">服务区域面积:{{ detailsList?.serviceArea }}</view> <view class="content">服务区域面积:{{ serviceProject?.serviceArea }}</view>
</nut-col> </nut-col>
<nut-col :span="12"> <nut-col :span="12">
<view class="content">楼栋数量:{{ detailsList?.buildingTotal }}</view> <view class="content">楼栋数量:{{ serviceProject?.buildingTotal }}</view>
</nut-col> </nut-col>
</nut-row> </nut-row>
<nut-row> <nut-row>
<nut-col :span="4"> <nut-col :span="4">
<view class="content">户数:{{ detailsList?.houseTotal }}</view> <view class="content">户数:{{ serviceProject?.houseTotal }}</view>
</nut-col> </nut-col>
</nut-row> </nut-row>
</view> </view>
@ -51,7 +51,7 @@
:scroll-into-view="toView" :scroll-top="scrollTop" :refresherEnabled="true" :scroll-into-view="toView" :scroll-top="scrollTop" :refresherEnabled="true"
@refresherrefresh="onRefresherRefresh" :refresher-triggered="isRefresher" @refresherrefresh="onRefresherRefresh" :refresher-triggered="isRefresher"
> >
<view class="projectDetailsTable" v-for="(item,index) in projectData" :key="index"> <view class="projectDetailsTable" v-for="(item,index) in securityUserList" :key="index">
<view> <view>
<view class="projectDetailsTableItem"> <view class="projectDetailsTableItem">
<view> <view>
@ -79,17 +79,19 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import Taro, {useLoad} from "@tarojs/taro"; import Taro, {useLoad} from "@tarojs/taro";
import './index.scss' import './projectDetails.scss'
import {ref} from "vue"; import {ref} from "vue";
import api from "@/request/index"; import api from "@/request/index";
import * as dayjs from 'dayjs' import dayjs from 'dayjs'
import {ServiceProjectSecurityUserPagerVo} from "@/types/subPages/projectManager/myProject";
const detailsList = ref() const serviceProject = ref()
const nameValue = ref('') const enterprisesUnitName = ref('')
const projectData = ref<Records<string>[]>([]) const securityUserList = ref<ServiceProjectSecurityUserPagerVo[]>([])
useLoad(async (options: MyProjectList) => { useLoad(async (options) => {
nameValue.value = options.name enterprisesUnitName.value = options.enterprisesUnitName
detailsList.value = await JSON.parse(options.item) serviceProject.value = JSON.parse(options.serviceProject)
console.log(serviceProject.value);
await projectDetailsTable() await projectDetailsTable()
}) })
const projectDetailsTable = async () => { const projectDetailsTable = async () => {
@ -99,22 +101,20 @@ const projectDetailsTable = async () => {
}) })
const queryParams = { const queryParams = {
params: { params: {
serviceProjectId: detailsList.value?.snowFlakeId, serviceProjectId: serviceProject.value.snowFlakeId,
}, },
page: { page: {
size: 4, size: 4,
current: current.value current: current.value
} }
} }
const resp = await api.post<ProjectData>('/miniProgramUser/securityUserPager', queryParams) const resp = await api.post<PagerVo<ServiceProjectSecurityUserPagerVo>>('/miniProgramUser/securityUserPager', queryParams)
projectData.value = [...projectData.value, ...resp?.data.records] securityUserList.value = [...securityUserList.value, ...resp.data!.records]
total.value = resp?.data.total total.value = resp.data!.total
isRefresher.value = false isRefresher.value = false
Taro.hideLoading() Taro.hideLoading()
} }
const formAdd = () => {
Taro.navigateTo({url: `/subPages/pages/form/form?item=${JSON.stringify(detailsList.value)}`})
}
const total = ref<any>(null) const total = ref<any>(null)
const current = ref(1) const current = ref(1)
const isRefresher = ref(false) const isRefresher = ref(false)
@ -124,17 +124,16 @@ const upper = (e) => {
console.log('到顶了:', e) console.log('到顶了:', e)
} }
// / // /
const lower = (e) => { const lower = () => {
if (total.value === projectData.value.length) return if (total.value === securityUserList.value.length) return
if (total.value > projectData.value.length) { if (total.value > securityUserList.value.length) {
console.log('触底了:', e)
current.value = current.value + 1 current.value = current.value + 1
projectDetailsTable() projectDetailsTable()
} }
} }
// //
const onRefresherRefresh = (e) => { const onRefresherRefresh = (e) => {
projectData.value = [] securityUserList.value = []
total.value = null total.value = null
current.value = 1 // current.value = 1 //
isRefresher.value = true isRefresher.value = true
@ -142,4 +141,3 @@ const onRefresherRefresh = (e) => {
projectDetailsTable() projectDetailsTable()
} }
</script> </script>

View File

@ -0,0 +1,35 @@
.myProject {
height: 100vh;
overflow: hidden;
background: #f1f1f1;
.myProjectItem {
//height: 20%;
margin: 20px;
border-radius: 10px;
background: #ffffff;
padding: 15px;
font-size: 28px;
line-height: 50px;
color: #333333;
.myProjectIndex {
color: #9b9b9f;
}
.project {
display: flex;
justify-content: space-between;
flex-flow: wrap;
text-align: center;
view {
width: 45%;
height: 100rpx;
border: 1px solid #cccccc;
line-height: 100rpx;
margin: 8px 0 8px 0;
}
}
}
}

View File

@ -0,0 +1,3 @@
export default definePageConfig({
navigationBarTitleText: '我的项目',
})

View File

@ -4,7 +4,6 @@
<view class="myProjectItem" v-for="(item,index) in myProjectList" :key="index"> <view class="myProjectItem" v-for="(item,index) in myProjectList" :key="index">
<view style="display: flex;justify-content: space-between"> <view style="display: flex;justify-content: space-between">
<text>{{ item?.name }}</text> <text>{{ item?.name }}</text>
<!--<text>进行中</text>-->
</view> </view>
<view class="myProjectIndex">地址 <view class="myProjectIndex">地址
<text>{{ item?.provinceName }}{{ item.cityName }}{{ item.districtsName }}{{ item.streetName }}</text> <text>{{ item?.provinceName }}{{ item.cityName }}{{ item.districtsName }}{{ item.streetName }}</text>
@ -14,13 +13,14 @@
<text>电话{{ item?.contactPersonInfo.telephone }}</text> <text>电话{{ item?.contactPersonInfo.telephone }}</text>
</view> </view>
<view class="project"> <view class="project">
<view @click="projectClick(items,item?.name)" v-for="(items,index) in item.serviceProjectList" :key="index"> <view @click="projectClick(item.name,serviceProject)"
{{ items.name }} v-for="(serviceProject,index) in item.serviceProjectList" :key="index">
{{ serviceProject.name }}
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view v-else class="myProject" > <view v-else class="myProject">
<nut-empty image="empty" description="暂无项目"> <nut-empty image="empty" description="暂无项目">
<div style="margin-top: 10px"> <div style="margin-top: 10px">
</div> </div>
@ -33,7 +33,8 @@
import api from "@/request/index"; import api from "@/request/index";
import {onMounted, ref} from "vue"; import {onMounted, ref} from "vue";
import Taro from "@tarojs/taro"; import Taro from "@tarojs/taro";
import './myproject.scss' import './myProject.scss'
import {MyProjectList, ServiceProjectList} from "@/types/subPages/projectManager/myProject";
const myProjectList = ref<MyProjectList[]>() const myProjectList = ref<MyProjectList[]>()
@ -41,20 +42,15 @@ const number = ref(0)
const getMyServiceProject = async () => { const getMyServiceProject = async () => {
const resp = await api.get<MyProjectList[]>(`/projectManageIndex/getMyServiceProject`) const resp = await api.get<MyProjectList[]>(`/projectManageIndex/getMyServiceProject`)
myProjectList.value = resp.data myProjectList.value = resp.data
number.value = resp.data.length number.value = (resp.data?.length || 0)
} }
const projectClick = (items: ServiceProjectList, name: string) => { const projectClick = (enterprisesUnitName: string, serviceProject: ServiceProjectList) => {
console.log(items)
Taro.navigateTo({ Taro.navigateTo({
url: `/subPages/pages/projectDetails/projectDetails?name=${name}&item=${JSON.stringify(items)}`, url: `/subPages/projectManager/myProject/projectDetails/projectDetails?enterprisesUnitName=${enterprisesUnitName}&serviceProject=${JSON.stringify(serviceProject)}`,
}) })
} }
onMounted(async () => { onMounted(async () => {
await getMyServiceProject() await getMyServiceProject()
}) })
</script> </script>
<!--<style scoped lang="scss">-->
<!--</style>-->

View File

@ -1,10 +1,11 @@
.projectDetails{ .projectDetails {
height: 100vh; height: 100vh;
overflow: hidden; overflow: hidden;
background: #f1f1f1; background: #f1f1f1;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
.projectDetailsItem{
.projectDetailsItem {
margin: 10px 20px 10px 20px; margin: 10px 20px 10px 20px;
border-radius: 10px; border-radius: 10px;
background: #ffffff; background: #ffffff;
@ -12,19 +13,23 @@
font-size: 28px; font-size: 28px;
line-height: 65px; line-height: 65px;
color: #333333; color: #333333;
.projectDetailsIndex{
.projectDetailsIndex {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
line-height: 44rpx; line-height: 44rpx;
margin-bottom: 20px; margin-bottom: 20px;
.content{
.content {
color: #9b9b9f; color: #9b9b9f;
} }
} }
} }
.projectDetailsTableDrop{
.projectDetailsTableDrop {
height: 80%; height: 80%;
.projectDetailsTable{
.projectDetailsTable {
margin: 20px; margin: 20px;
border-radius: 10px; border-radius: 10px;
background: #ffffff; background: #ffffff;
@ -32,18 +37,21 @@
font-size: 28px; font-size: 28px;
line-height: 50px; line-height: 50px;
color: #333333; color: #333333;
.projectDetailsTableItem{
.projectDetailsTableItem {
//display: flex; //display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
flex-wrap: wrap; flex-wrap: wrap;
font-size: 24px; font-size: 24px;
margin-bottom: 15px; margin-bottom: 15px;
.projectDetailsTableIndex{
.projectDetailsTableIndex {
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
text-align: center; text-align: center;
view{
view {
width: 70px; width: 70px;
margin-right: 20px; margin-right: 20px;
} }
@ -51,7 +59,8 @@
} }
} }
} }
.projectDetailsButton{
.projectDetailsButton {
position: fixed; position: fixed;
bottom: 19px; bottom: 19px;
display: flex; display: flex;
@ -60,33 +69,37 @@
right: 0; right: 0;
width: 100%; width: 100%;
} }
.nutPopup{
.nutPopup {
width: 300px; width: 300px;
height: 100px; height: 100px;
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
} }
.qrcodeVisibleUrl{
.qrcodeVisibleUrl {
margin-bottom: 5px; margin-bottom: 5px;
image { image {
width: 100%; width: 100%;
} }
} }
.warp{
.warp {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
height: 100vh; height: 100vh;
.warpItem{
.warpItem {
width: 90%; width: 90%;
height: 50%; height: 50%;
text-align: center; text-align: center;
.rect{
.rect {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
} }
} }
} }

View File

@ -1,4 +1,3 @@
export default definePageConfig({ export default definePageConfig({
navigationBarTitleText: '项目详情', navigationBarTitleText: '项目详情',
}) })

View File

@ -3,17 +3,15 @@
<view class="projectDetailsItem" style="line-height: 50rpx"> <view class="projectDetailsItem" style="line-height: 50rpx">
<view> <view>
<view style="display: flex;justify-content: space-between"> <view style="display: flex;justify-content: space-between">
<text style="font-size: 18px">{{ nameValue ? nameValue : '' }}{{ <text style="font-size: 18px">{{ enterprisesUnitName }}-----{{ serviceProject?.name }}
'-----' + serviceProjectDetails?.name
}}项目
</text> </text>
<text>进行中</text> <text>进行中</text>
</view> </view>
<view> <view>
<view style="float: left;width: 50%;" class="content"> <view style="float: left;width: 50%;" class="content">
经理名称:{{ serviceProjectDetails?.projectManagerMiniProgramUserInfo.name }} 经理名称:{{ serviceProject?.projectManagerMiniProgramUserInfo.name }}
</view> </view>
<view class="content">手机号:{{ serviceProjectDetails?.projectManagerMiniProgramUserInfo.telephone }}</view> <view class="content">手机号:{{ serviceProject?.projectManagerMiniProgramUserInfo.telephone }}</view>
</view> </view>
</view> </view>
</view> </view>
@ -21,28 +19,28 @@
<view class="projectDetailsIndex"> <view class="projectDetailsIndex">
<nut-row> <nut-row>
<nut-col :span="24"> <nut-col :span="24">
<view class="content">保安证件号{{ serviceProjectDetails?.idNumber }}</view> <view class="content">保安证件号{{ serviceProject?.idNumber }}</view>
</nut-col> </nut-col>
</nut-row> </nut-row>
<nut-row> <nut-row>
<nut-col :span="12"> <nut-col :span="12">
<view class="content">工作人员数量:{{ serviceProjectDetails?.staffTotal }}</view> <view class="content">工作人员数量:{{ serviceProject?.staffTotal }}</view>
</nut-col> </nut-col>
<nut-col :span="12"> <nut-col :span="12">
<view class="content">保安人员数量:{{ serviceProjectDetails?.securityUserTotal }}</view> <view class="content">保安人员数量:{{ serviceProject?.securityUserTotal }}</view>
</nut-col> </nut-col>
</nut-row> </nut-row>
<nut-row> <nut-row>
<nut-col :span="12"> <nut-col :span="12">
<view class="content">服务区域面积:{{ serviceProjectDetails?.serviceArea }}</view> <view class="content">服务区域面积:{{ serviceProject?.serviceArea }}</view>
</nut-col> </nut-col>
<nut-col :span="12"> <nut-col :span="12">
<view class="content">楼栋数量:{{ serviceProjectDetails?.buildingTotal }}</view> <view class="content">楼栋数量:{{ serviceProject?.buildingTotal }}</view>
</nut-col> </nut-col>
</nut-row> </nut-row>
<nut-row> <nut-row>
<nut-col :span="4"> <nut-col :span="4">
<view class="content">户数:{{ serviceProjectDetails?.houseTotal }}</view> <view class="content">户数:{{ serviceProject?.houseTotal }}</view>
</nut-col> </nut-col>
</nut-row> </nut-row>
</view> </view>
@ -54,7 +52,7 @@
:scroll-into-view="toView" :scroll-top="scrollTop" :refresherEnabled="true" :scroll-into-view="toView" :scroll-top="scrollTop" :refresherEnabled="true"
@refresherrefresh="onRefresherRefresh" :refresher-triggered="isRefresher" @refresherrefresh="onRefresherRefresh" :refresher-triggered="isRefresher"
> >
<view class="projectDetailsTable" v-for="(item,index) in projectData" :key="index"> <view class="projectDetailsTable" v-for="(item,index) in securityUserList" :key="index">
<view> <view>
<view class="projectDetailsTableItem"> <view class="projectDetailsTableItem">
<view> <view>
@ -74,7 +72,7 @@
</view> </view>
<view class="projectDetailsTableIndex"> <view class="projectDetailsTableIndex">
<view style="color: #3a6bbe" @click="detail(item)">详情</view> <view style="color: #3a6bbe" @click="detail(item)">详情</view>
<view style="color: #ffa60d" @click="projectEdit(item)">编辑</view> <view style="color: #ffa60d" @click="securityUserEdit(item)">编辑</view>
<view style="color: red" @click="deleteUssrID(item.snowFlakeId)">删除</view> <view style="color: red" @click="deleteUssrID(item.snowFlakeId)">删除</view>
</view> </view>
</view> </view>
@ -98,10 +96,10 @@
<nut-dialog no-cancel-btn content="详情" v-model:visible="detailVisible"> <nut-dialog no-cancel-btn content="详情" v-model:visible="detailVisible">
<slot> <slot>
<view style="margin-bottom: 5px"> <view style="margin-bottom: 5px">
<view>籍贯{{ content.nativePlace }}</view> <view>籍贯{{ securityUserDetail.nativePlace }}</view>
<view>公司{{ content.securityUnitName }}</view> <view>公司{{ securityUserDetail.securityUnitName }}</view>
<view>家庭地址{{ content.homeAddress }}</view> <view>家庭地址{{ securityUserDetail.homeAddress }}</view>
<view>备注{{ content.remark }}</view> <view>备注{{ securityUserDetail.remark }}</view>
</view> </view>
</slot> </slot>
</nut-dialog> </nut-dialog>
@ -111,7 +109,8 @@
<nut-dialog no-cancel-btn content="二维码" v-model:visible="qrcodeVisible"> <nut-dialog no-cancel-btn content="二维码" v-model:visible="qrcodeVisible">
<slot> <slot>
<view class="qrcodeVisibleUrl" @click="showImage"> <view class="qrcodeVisibleUrl" @click="showImage">
<image style="width: 100%" show-menu-by-longpress='1' :lazy-load="true" :src="qrCodeImage" mode="aspectFit" /> <image style="width: 100%" show-menu-by-longpress='1' :lazy-load="true" :src="qrCodeImage"
mode="aspectFit"/>
</view> </view>
</slot> </slot>
</nut-dialog> </nut-dialog>
@ -120,8 +119,9 @@
<view class="warp"> <view class="warp">
<view class="warpItem"> <view class="warpItem">
<movable-area :scale-area="true"> <movable-area :scale-area="true">
<movable-view direction="all" style="width: 348px; height: 300px;" :scale="true" :scale-min="1" :scale-max="4" :scale-value="1" :x="2" :y="10"> <movable-view direction="all" style="width: 348px; height: 300px;" :scale="true" :scale-min="1"
<image class="rect" show-menu-by-longpress='1' :src="qrCodeImage" mode="widthFix" /> :scale-max="4" :scale-value="1" :x="2" :y="10">
<image class="rect" show-menu-by-longpress='1' :src="qrCodeImage" mode="widthFix"/>
</movable-view> </movable-view>
</movable-area> </movable-area>
</view> </view>
@ -134,21 +134,24 @@ import Taro, {useDidShow, useLoad} from "@tarojs/taro";
import './projectDetails.scss' import './projectDetails.scss'
import {ref} from "vue"; import {ref} from "vue";
import api from "@/request/index"; import api from "@/request/index";
import * as dayjs from 'dayjs' import dayjs from 'dayjs'
import {ServiceProjectSecurityUserPagerVo} from "@/types/subPages/projectManager/myProject";
import {SecurityUserFormParams} from "@/types/subPages/projectManager/securityUserForm";
const serviceProjectDetails = ref() const serviceProject = ref()
const nameValue = ref('') const enterprisesUnitName = ref('')
const projectData = ref<Records[]>([]) const securityUserList = ref<ServiceProjectSecurityUserPagerVo[]>([])
const content = ref<Records>({} as any)
const securityUserDetail = ref<ServiceProjectSecurityUserPagerVo>({} as any)
// //
const confirmVisible = ref(false); const confirmVisible = ref(false);
const detailVisible = ref(false) const detailVisible = ref(false)
const qrcodeVisible = ref(false) const qrcodeVisible = ref(false)
const showOverlay = ref(false) const showOverlay = ref(false)
useLoad(async (options: MyProjectList) => { useLoad((options) => {
nameValue.value = options.name enterprisesUnitName.value = options.enterprisesUnitName
serviceProjectDetails.value = await JSON.parse(options.item) serviceProject.value = JSON.parse(options.serviceProject)
}) })
useDidShow(async () => { useDidShow(async () => {
initServiceProjectSecurityUserList() initServiceProjectSecurityUserList()
@ -159,24 +162,24 @@ const projectDetailsTable = async () => {
}) })
const queryParams = { const queryParams = {
params: { params: {
serviceProjectId: serviceProjectDetails.value?.snowFlakeId, serviceProjectId: serviceProject.value.snowFlakeId,
}, },
page: { page: {
size: 4, size: 4,
current: current.value current: current.value
} }
} }
const resp = await api.post<ProjectData>('/miniProgramUser/securityUserPager', queryParams) const resp = await api.post<PagerVo<ServiceProjectSecurityUserPagerVo>>('/miniProgramUser/securityUserPager', queryParams)
projectData.value = [...projectData.value, ...resp?.data.records] securityUserList.value = [...securityUserList.value, ...resp.data!.records]
total.value = resp?.data.total total.value = resp.data!.total
isRefresher.value = false isRefresher.value = false
Taro.hideLoading() Taro.hideLoading()
} }
const formAdd = () => { const formAdd = () => {
const params = { const params = {
serviceProjectId: serviceProjectDetails.value.snowFlakeId,
securityUnitId:serviceProjectDetails.value.securityUnitId,
snowFlakeId: undefined, snowFlakeId: undefined,
serviceProjectId: serviceProject.value.snowFlakeId,
securityUnitId: serviceProject.value.securityUnitId,
name: '', name: '',
workPost: '', workPost: '',
sex: 0, sex: 0,
@ -186,9 +189,9 @@ const formAdd = () => {
securityNumber: '', securityNumber: '',
remark: '', remark: '',
homeAddress: '', homeAddress: '',
telephone:'' telephone: ''
} } as SecurityUserFormParams
Taro.navigateTo({url: `/subPages/pages/form/form?item=${JSON.stringify(params)}&&id=${1}`}) Taro.navigateTo({url: `/subPages/projectManager/securityUserForm/securityUserForm?securityUser=${JSON.stringify(params)}&&type=formInput`})
} }
const total = ref<any>(null) const total = ref<any>(null)
const current = ref(1) const current = ref(1)
@ -196,15 +199,15 @@ const isRefresher = ref(false)
const scrollTop = ref(0) const scrollTop = ref(0)
const toView = ref('demo2') const toView = ref('demo2')
// / // /
const lower = (e) => { const lower = () => {
if (total.value === projectData.value.length) return if (total.value === securityUserList.value.length) return
if (total.value > projectData.value.length) { if (total.value > securityUserList.value.length) {
current.value = current.value + 1 current.value = current.value + 1
projectDetailsTable() projectDetailsTable()
} }
} }
const initServiceProjectSecurityUserList = () => { const initServiceProjectSecurityUserList = () => {
projectData.value = [] securityUserList.value = []
total.value = null total.value = null
current.value = 1 // current.value = 1 //
isRefresher.value = true isRefresher.value = true
@ -212,7 +215,7 @@ const initServiceProjectSecurityUserList = () => {
} }
// //
const onRefresherRefresh = (e) => { const onRefresherRefresh = () => {
initServiceProjectSecurityUserList() initServiceProjectSecurityUserList()
} }
@ -225,55 +228,43 @@ const deleteUssrID = (snowFlakeId: string) => {
} }
// //
const dialogOk = async () => { const dialogOk = async () => {
await api.delete(`/projectManageIndex/deleteSecurityUserByServiceProjectId`, {securityUserId: securityUserId.value}, { await api.delete(`/projectManageIndex/deleteSecurityUserByServiceProjectId`, {securityUserId: securityUserId.value})
header: {
"content-type": 'application/x-www-form-urlencoded'
}
})
initServiceProjectSecurityUserList() initServiceProjectSecurityUserList()
} }
// //
const detail = (item) => { const detail = (item: ServiceProjectSecurityUserPagerVo) => {
detailVisible.value = true detailVisible.value = true
content.value = item securityUserDetail.value = item
} }
const projectEdit = (item) => { const securityUserEdit = (item: ServiceProjectSecurityUserPagerVo) => {
const params = {...item, sex: item.sex.value} const params = {...item, sex: item.sex.value}
Taro.navigateTo({url: `/subPages/pages/form/form?item=${JSON.stringify(params)}`}) Taro.navigateTo({url: `/subPages/projectManager/securityUserForm/securityUserForm?securityUser=${JSON.stringify(params)}&type=formInput`})
} }
const qrCodeImage = ref('') const qrCodeImage = ref('')
const generateMiniProgramQRCode = ()=>{ const generateMiniProgramQRCode = async () => {
const params = {
securityUnitId:serviceProjectDetails.value.securityUnitId,
serviceProjectId:serviceProjectDetails.value.snowFlakeId
}
const value = JSON.stringify(params)
const paramsData = { const paramsData = {
path:`/subPages/pages/form/form?item=${value}&id=${2}`, path: `/subPages/projectManager/securityUserForm/securityUserForm?uid=${serviceProject.value.securityUnitId}&pid=${serviceProject.value.snowFlakeId}&type=QcCodeInput`,
width:200, width: 200,
} }
qrcodeVisible.value = true qrcodeVisible.value = true
Taro.request({ const resp = await api.get('/projectManageIndex/shareForm_QR_Code', paramsData, {
url: 'http://172.10.10.93:8765/projectManageIndex/shareForm_QR_Code', header: {
method:'GET', "content-type": 'application/x-www-form-urlencoded'
data:paramsData, },
responseType: 'arraybuffer', responseType: 'arraybuffer'
success(res) {
const base64 = Taro.arrayBufferToBase64(res.data);
qrCodeImage.value = 'data:image/jpeg;base64,' + base64
}
}) })
qrCodeImage.value = 'data:image/jpeg;base64,' + Taro.arrayBufferToBase64(resp as unknown as ArrayBuffer);
} }
const showImage = ()=>{ const showImage = () => {
showOverlay.value = true showOverlay.value = true
qrcodeVisible.value = false qrcodeVisible.value = false
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
</style> </style>

View File

@ -0,0 +1,8 @@
.form {
.formButton {
display: flex;
margin-top: auto;
justify-content: space-around;
margin-bottom: 30px
}
}

View File

@ -0,0 +1,3 @@
export default definePageConfig({
navigationBarTitleText: '项目人员录入',
})

View File

@ -17,7 +17,7 @@
<nut-form-item label="出生日期" prop="dateOfBirth"> <nut-form-item label="出生日期" prop="dateOfBirth">
<view @click="showPicker = true"> <view @click="showPicker = true">
{{ {{
dayjs(formData.dateOfBirth).isValid() ? dayjs(formData.dateOfBirth).format('YYYY-MM-DD') : '请选择出生年月' formData.dateOfBirth ? dayjs(formData.dateOfBirth).format('YYYY-MM-DD') : '请选择出生年月'
}} }}
</view> </view>
</nut-form-item> </nut-form-item>
@ -43,7 +43,7 @@
</nut-form> </nut-form>
<view class="formButton"> <view class="formButton">
<nut-button style="width: 45%" type="success" size="small" @click="submit">提交</nut-button> <nut-button style="width: 45%" type="success" size="small" @click="submit">提交</nut-button>
<nut-button style="width: 45%" size="small" @click="formRef.value?.reset()">重置表单</nut-button> <nut-button style="width: 45%" size="small" @click="formRef?.reset()">重置表单</nut-button>
</view> </view>
<nut-popup v-model:visible="showPicker" position="bottom"> <nut-popup v-model:visible="showPicker" position="bottom">
<nut-date-picker <nut-date-picker
@ -59,19 +59,23 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import {ref} from "vue"; import {ref} from "vue";
import {SEX} from "@/enums"; import {enumSelectNodes} from "@/enums";
import {FormRules} from "@nutui/nutui-taro/dist/types/__VUE/form/types"; import {FormRules} from "@nutui/nutui-taro/dist/types/__VUE/form/types";
import api from "@/request"; import api from "@/request";
import './form.scss' import './securityUserForm.scss'
import Taro, {useLoad} from "@tarojs/taro"; import Taro, {useLoad} from "@tarojs/taro";
import dayjs from "dayjs"; import dayjs from "dayjs";
import {SecurityUserFormParams} from "@/types/subPages/projectManager/securityUserForm";
import {FormInstance} from "@nutui/nutui-taro";
const SEX = enumSelectNodes('Sex')
const showPicker = ref(false) const showPicker = ref(false)
const formData = ref<formDate>({} as any) const type = ref<'formInput' | 'QcCodeInput'>(null!);
const formRef = ref(null)
const qrcodeId = ref() const formData = ref<SecurityUserFormParams>({} as any)
const formRef = ref<FormInstance>(null!)
const rules: FormRules = { const rules: FormRules = {
name: [ name: [
@ -85,31 +89,23 @@ const rules: FormRules = {
message: "身份证格式错误", message: "身份证格式错误",
}, },
], ],
telephone:[ telephone: [
{required: true, message: "请输入手机号"}, {required: true, message: "请输入手机号"},
] ]
}; };
useLoad((options) => { useLoad((options) => {
qrcodeId.value = options type.value = options.type;
console.log(JSON.parse(options.item)) if (type.value === 'QcCodeInput') {
if(options.id === '2'){
formData.value = { formData.value = {
serviceProjectId: JSON.parse(options.item).serviceProjectId, serviceProjectId: options.pid,
securityUnitId:JSON.parse(options.item).securityUnitId, securityUnitId: options.uid,
name: '',
workPost: '',
sex: 0, sex: 0,
nativePlace: '',
idCard: '', idCard: '',
dateOfBirth: null, dateOfBirth: null
securityNumber: '',
remark: '',
homeAddress: '',
telephone:''
} }
}else{ } else {
formData.value = JSON.parse(options.item) formData.value = JSON.parse(options.securityUser)
} }
}) })
@ -126,17 +122,16 @@ const idCardBlur = (e: any) => {
formData.value.dateOfBirth = new Date(parseInt(year), parseInt(month) - 1, parseInt(day)) formData.value.dateOfBirth = new Date(parseInt(year), parseInt(month) - 1, parseInt(day))
} }
const url = ref('')
const submit = () => { const submit = () => {
formRef.value?.validate().then(async ({valid}) => { formRef.value?.validate().then(async ({valid}) => {
if (valid) { if (valid) {
if( qrcodeId.value.id === '1'){ let url: string;
url.value = '/projectManageIndex/saveOrUpdateSecurityUser' if (type.value === 'formInput') {
}else{ url = '/projectManageIndex/saveOrUpdateSecurityUser'
url.value = '/miniProgramUser/qrCodeFormInputSecurityUser' } else {
url = '/miniProgramUser/qrCodeFormInputSecurityUser'
} }
console.log(formData.value) const resp = await api.post(url, formData.value)
const resp = await api.post(`${ url.value}`, formData.value)
Taro.showToast({ Taro.showToast({
title: resp.message, title: resp.message,
icon: 'success', icon: 'success',
@ -146,7 +141,7 @@ const submit = () => {
formData.value = { formData.value = {
snowFlakeId: undefined, snowFlakeId: undefined,
serviceProjectId: formData.value.serviceProjectId, serviceProjectId: formData.value.serviceProjectId,
securityUnitId:formData.value.securityUnitId, securityUnitId: formData.value.securityUnitId,
name: '', name: '',
workPost: '', workPost: '',
telephone: '', telephone: '',
@ -162,7 +157,3 @@ const submit = () => {
}) })
} }
</script> </script>
<style scoped lang="scss">
</style>

View File

@ -1,67 +0,0 @@
import Taro from "@tarojs/taro";
/**
*
* @param {*} scope
* @param {*} successCallback
* @param {*} failCallback
*/
export function pullAuth(scope, successCallback, failCallback) {
const map = new Map([
['scope.userInfo', '用户信息'],
['scope.userLocation', '地理位置'],
['scope.userLocationBackground', '后台定位'],
['scope.address', '通信地址'],
['scope.record', '录音功能'],
['scope.writePhotosAlbum', '保存到相册'],
['scope.camera', '摄像头'],
['scope.invoice', '获取发票'],
['scope.invoiceTitle', '发票抬头'],
['scope.werun', '微信运动步数'],
])
Taro.getSetting({
success(res) {
if (!res.authSetting[scope]) {
Taro.authorize({
scope,
success(){ // 允许授权
successCallback()
},
fail(){ // 拒绝授权
if (map.has(scope)) {
let word = map.get(scope)
Taro.showModal({
content:`检测到您没打开${word}权限,是否去设置打开?`,
confirmText: "确认",
cancelText:'取消',
success: (res) => {
if(res.confirm){
Taro.openSetting({
success: (res) => {
successCallback()
},
fail: () => {
failCallback()
},
})
}else{
failCallback()
}
}
})
} else {
Taro.showToast({
title: '无此授权功能'
})
failCallback()
}
}
})
} else {
successCallback()
}
}
})
}

View File

@ -9,9 +9,9 @@
"noImplicitAny": false, "noImplicitAny": false,
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"outDir": "lib", "outDir": "lib",
"noUnusedLocals": false, "noUnusedLocals": true,
"noUnusedParameters": false, "noUnusedParameters": true,
"strictNullChecks": false, "strictNullChecks": true,
"sourceMap": true, "sourceMap": true,
"rootDir": ".", "rootDir": ".",
"jsx": "preserve", "jsx": "preserve",
@ -21,8 +21,12 @@
"node_modules/@types" "node_modules/@types"
], ],
"paths": { "paths": {
// TS5090 leading './'
"@/*": [ "@/*": [
"src/*" "./src/*"
],
"@/types/*": [
"./types/*"
] ]
} }
}, },

View File

@ -0,0 +1,8 @@
import Taro from "@tarojs/taro";
export interface UserConfig {
/** 跳转的首页地址 **/
toIndex: string;
/** 身份对应的tabBar列表 **/
tabBarList: Taro.TabBarItem[]
}

View File

@ -22,7 +22,8 @@ declare namespace NodeJS {
* @description env `TARO_APP_ID`便 appid dist/project.config.json * @description env `TARO_APP_ID`便 appid dist/project.config.json
* @see https://taro-docs.jd.com/docs/next/env-mode-config#特殊环境变量-taro_app_id * @see https://taro-docs.jd.com/docs/next/env-mode-config#特殊环境变量-taro_app_id
*/ */
TARO_APP_ID: string, TARO_APP_ID: string
/** 后台服务接口地址 **/
TARO_APP_BASE_API: string TARO_APP_BASE_API: string
} }
} }
@ -31,18 +32,37 @@ declare module '@tarojs/components' {
export * from '@tarojs/components/types/index.vue3' export * from '@tarojs/components/types/index.vue3'
} }
/**
*
*/
type MiniProgramUserIdentity = 'police' | 'project_manager'
/** /**
* *
*/ */
interface SelectNode<T> { interface SelectNodeVo<T, E = Record<string, any>> {
value: T, value: T;
label: string, label: string;
options?: SelectNode<T>[] orderIndex?: number;
orderIndex?: number, disabled?: boolean;
disabled?: boolean, extData?: E
extData?: Record<string, any>
} }
/**
*
*/
interface TreeNodeVo<T, E = Record<string, any>> {
value: T;
parentValue: T;
label: string;
orderIndex?: number;
children?: TreeNodeVo<T>[]
extData?: E;
}
/**
*
*/
interface JsonResult<T> { interface JsonResult<T> {
code: number; code: number;
data?: T; data?: T;
@ -50,22 +70,28 @@ interface JsonResult<T> {
} }
/** /**
* *
*/ */
interface TreeNode<T> { interface PagerVo<T> {
value: T, size: number,
parentValue: T, total: number;
label: string, current: number;
orderIndex?: number, records: T[]
extData?: Record<string, any>,
children?: TreeNode<T>[]
} }
/**
interface TokenInfo<T = Record<string, any>> { * token信息
*/
interface TokenInfo {
/** token名称 **/
name: string; name: string;
/** token值 **/
value: string; value: string;
extData?: T /** 拓展属性 **/
extData: {
/** 身份 **/
identity: BaseEnum<MiniProgramUserIdentity>
}
} }
/** /**

View File

@ -1,39 +0,0 @@
interface PersonnelInformation {
name: string,
sex: number,
dataOfBirth: Date | string,
idCard: string,
phone: string,
householdRegistrationAddress: string,
streetCommunitySmallCommunityIds: string[],
buildingFloorHouseIds: string[]
}
interface EnterUserInfoSaveOrUpdateParams {
snowFlakeId?: string,
streetId?: string,
communityId?: string,
smallCommunityId?: string,
buildingId?: string,
floorId?: string,
houseId?: string,
name: string,
sex: number,
dateOfBirth?: Date | string
idCard: string
phone: string
householdRegistrationAddress?: string
optFlag: null | 0 | 1
}
interface SystemExitsPopulationInformationVo {
snowFlakeId: string,
name: string,
sex: number,
residentialDivisionDetail: string,
createTime: string,
createUserName: string
}

View File

@ -1,5 +0,0 @@
interface LoginUserInfo {
clientType?: string;
avatar?: string;
}

View File

@ -1,45 +0,0 @@
interface MyProjectList {
item?:any,
address?: string;
city?: string;
cityName?: string;
contactPersonInfo:ContactPersonInfo;
districts?: string;
districtsName?: string;
name: string;
province?: string;
provinceName: string;
remark?: string;
serviceProjectList: ServiceProjectList[];
snowFlakeId?: string;
securityUnitId:string;
street?: string;
streetName?:string;
}
interface ContactPersonInfo{
name:string;
telephone:string
}
interface ServiceProjectList {
buildingTotal?: number;
houseTotal?: number;
idNumber?: string;
isRecruitSecurity?: null;
name?: string;
remark?: string;
securityUserTotal?: number;
serviceArea?: number;
snowFlakeId?: string;
staffTotal?: number;
type?:string;
projectManagerMiniProgramUserInfo?:ProgramUserInfo
}
interface ProgramUserInfo{
idCard: null
name: string
telephone: string
}

View File

@ -1,29 +0,0 @@
interface Records{
createTime?: string;
dateOfBirth?: string;
homeAddress?: string;
idCard?: string;
name?: string;
nativePlace?: string;
remark?: string;
securityNumber?: string;
securityUnitId?: string;
securityUnitName?: string;
serviceProjectId?: string;
snowFlakeId:string;
workPost?:string;
sex?:Sex
}
interface ProjectData<T> {
current?:string;
pages?:string;
records?: Records[];
size?: string;
total?: string;
data: Records[];
}
interface Sex {
value:number,
label:string
}

View File

@ -1,8 +0,0 @@
interface RegisterParams {
avatar: string;
name: string;
sex:number,
telephone:string,
identity: string;
unitId: any
}

View File

@ -0,0 +1,8 @@
export interface RegisterParams {
avatar: string;
name: string;
sex: number,
telephone: string,
identity: string;
unitId: string
}

View File

@ -1,9 +0,0 @@
import Taro from "@tarojs/taro";
export interface ApiOptions
extends Omit<
Taro.request.Option,
"url" | "method" | "data" | "success" | "fail"
> {
loading?: boolean;
}

View File

@ -0,0 +1,5 @@
import Taro from "@tarojs/taro";
export interface ApiOptions extends Omit<Taro.request.Option, "url" | "method" | "data" | "success" | "fail"> {
loading?: boolean;
}

View File

@ -0,0 +1,61 @@
export interface MyProjectList {
item?: any,
address?: string;
city?: string;
cityName?: string;
contactPersonInfo: ContactPersonInfo;
districts?: string;
districtsName?: string;
name: string;
province?: string;
provinceName: string;
remark?: string;
serviceProjectList: ServiceProjectList[];
snowFlakeId?: string;
securityUnitId: string;
street?: string;
streetName?: string;
}
export interface ContactPersonInfo {
name: string;
telephone: string
}
export interface ServiceProjectList {
buildingTotal?: number;
houseTotal?: number;
idNumber?: string;
isRecruitSecurity?: null;
name?: string;
remark?: string;
securityUserTotal?: number;
serviceArea?: number;
snowFlakeId?: string;
staffTotal?: number;
type?: string;
projectManagerMiniProgramUserInfo?: ProgramUserInfo
}
export interface ProgramUserInfo {
idCard: null
name: string
telephone: string
}
export interface ServiceProjectSecurityUserPagerVo {
createTime?: string;
dateOfBirth?: string;
homeAddress?: string;
idCard?: string;
name?: string;
nativePlace?: string;
remark?: string;
securityNumber?: string;
securityUnitId?: string;
securityUnitName?: string;
serviceProjectId?: string;
snowFlakeId: string;
workPost?: string;
sex: BaseEnum<number>
}

View File

@ -1,6 +1,6 @@
interface formDate { export interface SecurityUserFormParams {
snowFlakeId?: string; snowFlakeId?: string;
securityUnitId:string; securityUnitId: string;
serviceProjectId: string; serviceProjectId: string;
name?: string; name?: string;
workPost?: string; workPost?: string;
@ -8,7 +8,7 @@ interface formDate {
sex: number; sex: number;
nativePlace?: string; nativePlace?: string;
idCard: string; idCard: string;
dateOfBirth?: Date; dateOfBirth?: Date | null;
securityNumber?: string; securityNumber?: string;
remark?: string; remark?: string;
homeAddress?: string homeAddress?: string

View File

@ -41,6 +41,8 @@ public class WebConfig implements WebMvcConfigurer {
whiteList.add("/management/getCheckStatus"); whiteList.add("/management/getCheckStatus");
//微信小程序注册 //微信小程序注册
whiteList.add("/miniProgramUser/register"); whiteList.add("/miniProgramUser/register");
//二维码表单录入保安人员
whiteList.add("/miniProgramUser/qrCodeFormInputSecurityUser");
} }
@Override @Override

View File

@ -3,6 +3,7 @@ package com.changhu.module.miniProgram.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.common.annotation.JsonBody; import com.changhu.common.annotation.JsonBody;
import com.changhu.module.miniProgram.pojo.params.MiniProgramUserRegisterParams; import com.changhu.module.miniProgram.pojo.params.MiniProgramUserRegisterParams;
import com.changhu.module.miniProgram.pojo.params.SaveOrUpdateSecurityUserParams;
import com.changhu.module.miniProgram.pojo.queryParams.ServiceProjectSecurityUserPagerQueryParams; import com.changhu.module.miniProgram.pojo.queryParams.ServiceProjectSecurityUserPagerQueryParams;
import com.changhu.module.miniProgram.pojo.vo.ServiceProjectSecurityUserPagerVo; import com.changhu.module.miniProgram.pojo.vo.ServiceProjectSecurityUserPagerVo;
import com.changhu.module.miniProgram.service.MiniProgramUserService; import com.changhu.module.miniProgram.service.MiniProgramUserService;
@ -34,6 +35,12 @@ public class MiniProgramUserController {
miniProgramUserService.register(params); miniProgramUserService.register(params);
} }
@Operation(summary = "二维码表单录入保安人员")
@PostMapping("/qrCodeFormInputSecurityUser")
public void qrCodeFormInputSecurityUser(@RequestBody @Valid SaveOrUpdateSecurityUserParams params) {
miniProgramUserService.qrCodeFormInputSecurityUser(params);
}
@Operation(summary = "服务项目保安人员分页") @Operation(summary = "服务项目保安人员分页")
@PostMapping("/securityUserPager") @PostMapping("/securityUserPager")
public Page<ServiceProjectSecurityUserPagerVo> securityUserPager(@RequestBody PageParams<ServiceProjectSecurityUserPagerQueryParams, ServiceProjectSecurityUserPagerVo> queryParams) { public Page<ServiceProjectSecurityUserPagerVo> securityUserPager(@RequestBody PageParams<ServiceProjectSecurityUserPagerQueryParams, ServiceProjectSecurityUserPagerVo> queryParams) {

View File

@ -9,7 +9,11 @@ import com.changhu.module.miniProgram.service.ProjectManageIndexService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.Resource;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;
@ -42,7 +46,15 @@ public class ProjectManageIndexController {
@Operation(summary = "保存或更新保安人员") @Operation(summary = "保存或更新保安人员")
@PostMapping("/saveOrUpdateSecurityUser") @PostMapping("/saveOrUpdateSecurityUser")
public void saveOrUpdateSecurityUser(@RequestBody SaveOrUpdateSecurityUserParams params) { public void saveOrUpdateSecurityUser(@RequestBody @Valid SaveOrUpdateSecurityUserParams params) {
projectManageIndexService.saveOrUpdateSecurityUser(params); projectManageIndexService.saveOrUpdateSecurityUser(params);
} }
@JsonBody(value = false)
@Operation(summary = "获取表单分享二维码")
@GetMapping(value = "/shareForm_QR_Code")
public ResponseEntity<Resource> shareForm_QR_Code(@Schema(description = "要生成的路径") @RequestParam String path,
@Schema(description = "生成二维码的宽度") @RequestParam(defaultValue = "430") Integer width) {
return projectManageIndexService.shareForm_QR_Code(path, width);
}
} }

View File

@ -23,6 +23,10 @@ public class SaveOrUpdateSecurityUserParams {
@Schema(description = "服务项目id") @Schema(description = "服务项目id")
private Long serviceProjectId; private Long serviceProjectId;
@NotNull(message = "保安单位不能为空")
@Schema(description = "保安单位id")
private Long securityUnitId;
@NotBlank(message = "名字不能为空") @NotBlank(message = "名字不能为空")
@Schema(description = "名称") @Schema(description = "名称")
private String name; private String name;

View File

@ -53,6 +53,8 @@ public class IndexServiceProjectListVo {
static class ServiceProjectVo { static class ServiceProjectVo {
@Schema(description = "服务项目id") @Schema(description = "服务项目id")
private Long snowFlakeId; private Long snowFlakeId;
@Schema(description = "保安单位id")
private Long securityUnitId;
@Schema(description = "项目经理信息") @Schema(description = "项目经理信息")
private Dict projectManagerMiniProgramUserInfo; private Dict projectManagerMiniProgramUserInfo;
@Schema(description = "服务项目名称") @Schema(description = "服务项目名称")

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.changhu.module.miniProgram.pojo.entity.MiniProgramUser; import com.changhu.module.miniProgram.pojo.entity.MiniProgramUser;
import com.changhu.module.miniProgram.pojo.params.MiniProgramUserRegisterParams; import com.changhu.module.miniProgram.pojo.params.MiniProgramUserRegisterParams;
import com.changhu.module.miniProgram.pojo.params.SaveOrUpdateSecurityUserParams;
import com.changhu.module.miniProgram.pojo.queryParams.ServiceProjectSecurityUserPagerQueryParams; import com.changhu.module.miniProgram.pojo.queryParams.ServiceProjectSecurityUserPagerQueryParams;
import com.changhu.module.miniProgram.pojo.vo.ServiceProjectSecurityUserPagerVo; import com.changhu.module.miniProgram.pojo.vo.ServiceProjectSecurityUserPagerVo;
import com.changhu.support.mybatisplus.pojo.params.PageParams; import com.changhu.support.mybatisplus.pojo.params.PageParams;
@ -29,4 +30,11 @@ public interface MiniProgramUserService extends IService<MiniProgramUser> {
* @return 保安人员 * @return 保安人员
*/ */
Page<ServiceProjectSecurityUserPagerVo> securityUserPager(PageParams<ServiceProjectSecurityUserPagerQueryParams, ServiceProjectSecurityUserPagerVo> queryParams); Page<ServiceProjectSecurityUserPagerVo> securityUserPager(PageParams<ServiceProjectSecurityUserPagerQueryParams, ServiceProjectSecurityUserPagerVo> queryParams);
/**
* 二维码表单录入保安人员
*
* @param params 参数
*/
void qrCodeFormInputSecurityUser(SaveOrUpdateSecurityUserParams params);
} }

View File

@ -2,6 +2,9 @@ package com.changhu.module.miniProgram.service;
import com.changhu.module.miniProgram.pojo.params.SaveOrUpdateSecurityUserParams; import com.changhu.module.miniProgram.pojo.params.SaveOrUpdateSecurityUserParams;
import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo; import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.core.io.Resource;
import org.springframework.http.ResponseEntity;
import java.util.List; import java.util.List;
@ -31,4 +34,9 @@ public interface ProjectManageIndexService {
* @param params 保安人员参数 * @param params 保安人员参数
*/ */
void saveOrUpdateSecurityUser(SaveOrUpdateSecurityUserParams params); void saveOrUpdateSecurityUser(SaveOrUpdateSecurityUserParams params);
/**
* 分享表单录入的二维码
*/
ResponseEntity<Resource> shareForm_QR_Code(String path, Integer width);
} }

View File

@ -13,9 +13,11 @@ import com.changhu.module.miniProgram.mapper.SecurityUserMapper;
import com.changhu.module.miniProgram.pojo.entity.MiniProgramUser; import com.changhu.module.miniProgram.pojo.entity.MiniProgramUser;
import com.changhu.module.miniProgram.pojo.entity.SecurityUser; import com.changhu.module.miniProgram.pojo.entity.SecurityUser;
import com.changhu.module.miniProgram.pojo.params.MiniProgramUserRegisterParams; import com.changhu.module.miniProgram.pojo.params.MiniProgramUserRegisterParams;
import com.changhu.module.miniProgram.pojo.params.SaveOrUpdateSecurityUserParams;
import com.changhu.module.miniProgram.pojo.queryParams.ServiceProjectSecurityUserPagerQueryParams; import com.changhu.module.miniProgram.pojo.queryParams.ServiceProjectSecurityUserPagerQueryParams;
import com.changhu.module.miniProgram.pojo.vo.ServiceProjectSecurityUserPagerVo; import com.changhu.module.miniProgram.pojo.vo.ServiceProjectSecurityUserPagerVo;
import com.changhu.module.miniProgram.service.MiniProgramUserService; import com.changhu.module.miniProgram.service.MiniProgramUserService;
import com.changhu.module.miniProgram.service.ProjectManageIndexService;
import com.changhu.support.mybatisplus.pojo.params.PageParams; import com.changhu.support.mybatisplus.pojo.params.PageParams;
import me.chanjar.weixin.common.error.WxErrorException; import me.chanjar.weixin.common.error.WxErrorException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -35,6 +37,9 @@ public class MiniProgramUserServiceImpl extends ServiceImpl<MiniProgramUserMappe
@Autowired @Autowired
private SecurityUserMapper securityUserMapper; private SecurityUserMapper securityUserMapper;
@Autowired
private ProjectManageIndexService projectManageIndexService;
@Override @Override
public void register(MiniProgramUserRegisterParams params) { public void register(MiniProgramUserRegisterParams params) {
MiniProgramUser miniProgramUser = BeanUtil.copyProperties(params, MiniProgramUser.class); MiniProgramUser miniProgramUser = BeanUtil.copyProperties(params, MiniProgramUser.class);
@ -61,4 +66,9 @@ public class MiniProgramUserServiceImpl extends ServiceImpl<MiniProgramUserMappe
public Page<ServiceProjectSecurityUserPagerVo> securityUserPager(PageParams<ServiceProjectSecurityUserPagerQueryParams, ServiceProjectSecurityUserPagerVo> queryParams) { public Page<ServiceProjectSecurityUserPagerVo> securityUserPager(PageParams<ServiceProjectSecurityUserPagerQueryParams, ServiceProjectSecurityUserPagerVo> queryParams) {
return securityUserMapper.securityUserPager(queryParams.getPage(), queryParams.getParams()); return securityUserMapper.securityUserPager(queryParams.getPage(), queryParams.getParams());
} }
@Override
public void qrCodeFormInputSecurityUser(SaveOrUpdateSecurityUserParams params) {
projectManageIndexService.saveOrUpdateSecurityUser(params);
}
} }

View File

@ -1,5 +1,7 @@
package com.changhu.module.miniProgram.service.impl; package com.changhu.module.miniProgram.service.impl;
import cn.binarywang.wx.miniapp.api.WxMaQrcodeService;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.extension.toolkit.Db; import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.changhu.common.exception.MessageException; import com.changhu.common.exception.MessageException;
@ -10,9 +12,18 @@ import com.changhu.module.miniProgram.pojo.params.SaveOrUpdateSecurityUserParams
import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo; import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo;
import com.changhu.module.miniProgram.service.ProjectManageIndexService; import com.changhu.module.miniProgram.service.ProjectManageIndexService;
import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; import com.changhu.support.mybatisplus.pojo.entity.BaseEntity;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.error.WxErrorException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.io.*;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
@ -21,12 +32,16 @@ import java.util.Optional;
* @createTime 2024/9/10 下午3:50 * @createTime 2024/9/10 下午3:50
* @desc ProjectManageIndexServiceImpl... * @desc ProjectManageIndexServiceImpl...
*/ */
@Slf4j
@Service @Service
public class ProjectManageIndexServiceImpl implements ProjectManageIndexService { public class ProjectManageIndexServiceImpl implements ProjectManageIndexService {
@Autowired @Autowired
private ServiceProjectMapper serviceProjectMapper; private ServiceProjectMapper serviceProjectMapper;
@Autowired
private WxMaService wxMaService;
@Override @Override
public List<IndexServiceProjectListVo> getMyServiceProjectList() { public List<IndexServiceProjectListVo> getMyServiceProjectList() {
return serviceProjectMapper.getServiceProjectList(null, UserUtil.getUserId()); return serviceProjectMapper.getServiceProjectList(null, UserUtil.getUserId());
@ -43,8 +58,6 @@ public class ProjectManageIndexServiceImpl implements ProjectManageIndexService
@Override @Override
public void saveOrUpdateSecurityUser(SaveOrUpdateSecurityUserParams params) { public void saveOrUpdateSecurityUser(SaveOrUpdateSecurityUserParams params) {
SecurityUser securityUser = BeanUtil.copyProperties(params, SecurityUser.class); SecurityUser securityUser = BeanUtil.copyProperties(params, SecurityUser.class);
//填充保安单位
securityUser.setSecurityUnitId(UserUtil.getUnitId());
//新增的情况 //新增的情况
Long snowFlakeId = securityUser.getSnowFlakeId(); Long snowFlakeId = securityUser.getSnowFlakeId();
if (snowFlakeId == null) { if (snowFlakeId == null) {
@ -74,4 +87,18 @@ public class ProjectManageIndexServiceImpl implements ProjectManageIndexService
throw new MessageException(); throw new MessageException();
} }
} }
@Override
public ResponseEntity<Resource> shareForm_QR_Code(String path, Integer width) {
WxMaQrcodeService qrcodeService = wxMaService.getQrcodeService();
try {
File qrcodeFile = qrcodeService.createQrcode(path, width);
return ResponseEntity.ok()
.header(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + qrcodeFile.getName())
.contentType(MediaType.APPLICATION_OCTET_STREAM)
.body(new FileSystemResource(qrcodeFile));
} catch (WxErrorException e) {
throw new MessageException("生成表单二维码失败:{}", e.getMessage());
}
}
} }

View File

@ -90,10 +90,10 @@ spring:
cache-names: common cache-names: common
data: data:
redis: redis:
database: 10 database: 1
password: lonsung301 password: redis_csPDNr
port: 6380 port: 6380
host: 172.10.10.238 host: 118.253.177.137
timeout: 10s timeout: 10s
lettuce: lettuce:
pool: pool:
@ -144,9 +144,9 @@ sa-token:
wx: wx:
miniapp: miniapp:
#微信小程序的appid #微信小程序的appid
appid: wx8902ddbfddb820d1 appid: wx0acd1c4fcf94bdd3
#微信小程序的Secret #微信小程序的Secret
secret: 8674decea33df3362245937444944596 secret: 4b700dbacb42ef258537ddc61d964a17
msgDataFormat: JSON msgDataFormat: JSON
project: project:

View File

@ -48,6 +48,7 @@
ad4.name as 'streetName', ad4.name as 'streetName',
JSON_ARRAYAGG(JSON_OBJECT( JSON_ARRAYAGG(JSON_OBJECT(
'snowFlakeId', sp.snow_flake_id, 'snowFlakeId', sp.snow_flake_id,
'securityUnitId',sp.security_unit_id,
'name', sp.name, 'name', sp.name,
'type', sp.type, 'type', sp.type,
'isRecruitSecurity', sp.is_recruit_security, 'isRecruitSecurity', sp.is_recruit_security,

View File

@ -2,11 +2,12 @@ import {createApp} from 'vue'
import App from '@/App.vue' import App from '@/App.vue'
import '@/reset.css' import '@/reset.css'
import './index.css' import './index.css'
// iconfont css
import "@/assets/iconfont/iconfont.css";
// 公共样式 // 公共样式
import '@/assets/scss/common.scss' import '@/assets/scss/common.scss'
import '@/assets/scss/myAntD.scss' import '@/assets/scss/myAntD.scss'
// iconfont css
import "@/assets/iconfont/iconfont.css";
// vue Router // vue Router
import router from "@/router"; import router from "@/router";
// pinia stores // pinia stores

View File

@ -126,17 +126,17 @@ const columns: TableProps['columns'] = [
dataIndex:'isRecruitSecurity', dataIndex:'isRecruitSecurity',
title: '是否自招保安', title: '是否自招保安',
customRender: ({text}) => <a-tag>{text?.label}</a-tag>, customRender: ({text}) => <a-tag>{text?.label}</a-tag>,
width:100 width:120
}, },
{ {
dataIndex:'idNumber', dataIndex:'idNumber',
title: '件号', title: '保安服务许可证',
width:170 width:170
}, },
{ {
dataIndex:'serviceArea', dataIndex:'serviceArea',
title:'服务区域面积', title:'服务区域面积',
width:100 width:120
}, },
{ {
dataIndex:'buildingTotal', dataIndex:'buildingTotal',
@ -151,17 +151,17 @@ const columns: TableProps['columns'] = [
{ {
dataIndex:'staffTotal', dataIndex:'staffTotal',
title:'工作人员数量', title:'工作人员数量',
width:100 width:120
}, },
{ {
dataIndex:'securityUserTotal', dataIndex:'securityUserTotal',
title:'保安人员数量', title:'保安人员数量',
width:100 width:120
}, },
{ {
dataIndex:'createUserName', dataIndex:'createUserName',
title:'创建人名称', title:'创建人名称',
width:100 width:110
}, },
{ {
dataIndex: 'createTime', dataIndex: 'createTime',
@ -190,7 +190,7 @@ const columns: TableProps['columns'] = [
message.success(resp.message) message.success(resp.message)
await tableRef.value?.requestGetTableData() await tableRef.value?.requestGetTableData()
}}> }}>
<a-button type="primary" danger>删除</a-button> <a-button danger>删除</a-button>
</a-popconfirm> </a-popconfirm>
<a-button type="primary" onClick={ async ()=>{ <a-button type="primary" onClick={ async ()=>{
// console.log(record) // console.log(record)
@ -275,6 +275,7 @@ const formItemOptions = ref<FormProMaxItemOptions<serviceProjectSaveOrUpdatePara
enterprisesUnitId:{ enterprisesUnitId:{
type:'select', type:'select',
label:'企事业单位', label:'企事业单位',
required: true,
options:enterprisesUnitIdList, options:enterprisesUnitIdList,
componentsProps:{ componentsProps:{
allowClear:true, allowClear:true,
@ -316,7 +317,7 @@ const formItemOptions = ref<FormProMaxItemOptions<serviceProjectSaveOrUpdatePara
}, },
idNumber: { idNumber: {
type: 'input', type: 'input',
label: '件号', label: '保安服务许可证',
componentsProps:{ componentsProps:{
disabled:idNumberDisabled as any disabled:idNumberDisabled as any
} }

View File

@ -96,10 +96,20 @@ const columns: TableProps['columns'] = [
</a-popconfirm> </a-popconfirm>
</a-space> </a-space>
} }
return <a-space > return (
<a-button record.isEnable.value === 0?<a-button
danger
onClick={async () => {
const resp = await api.post('/management/disableOrEnableMiniProgramUser', {
dataId: record.snowFlakeId,
unitOptType: UNIT_TYPE.security
})
message.success(resp.message)
await tableRef.value?.requestGetTableData()
}}
>{record.isEnable.value === 0 ? '禁用' : '启用'}
</a-button>:<a-button
type="primary" type="primary"
className={record.isEnable.value === 0 ? 'btn-danger' : 'btn-success'}
onClick={async () => { onClick={async () => {
const resp = await api.post('/management/disableOrEnableMiniProgramUser', { const resp = await api.post('/management/disableOrEnableMiniProgramUser', {
dataId: record.snowFlakeId, dataId: record.snowFlakeId,
@ -110,7 +120,7 @@ const columns: TableProps['columns'] = [
}} }}
>{record.isEnable.value === 0 ? '禁用' : '启用'} >{record.isEnable.value === 0 ? '禁用' : '启用'}
</a-button> </a-button>
</a-space> )
} }
}, },
] ]