Browse Source

执法端-计划

dev-V1.0.1
庄锐波 6 months ago
parent
commit
aec5ba381c
  1. 5
      zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/service/impl/EfcodeCpPlanServiceImpl.java
  2. 6
      zdxt-web-client/zdxt-efcode-enforcement-app/src/api/enforcement/index.js
  3. 111
      zdxt-web-client/zdxt-efcode-enforcement-app/src/views/enforcement/login.vue
  4. 2
      zdxt-web-client/zdxt-efcode-enforcement-app/vite-config/index.js
  5. 2
      zdxt-web-client/zdxt-efcode-enforcement-app/vite-env/.env.enforcement-dev

5
zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/service/impl/EfcodeCpPlanServiceImpl.java

@ -134,9 +134,8 @@ public class EfcodeCpPlanServiceImpl implements IEfcodeCpPlanService {
return;
}
for (EfcodeCpPlanVo vo : records) {
// 默认:待预约状态均可预约
vo.setCanReserve(true);
// TODO 后续可扩展:例如判断当天计划已过期、人员已满等业务规则
// 只有联合执法的计划才可以预约
vo.setCanReserve(vo.getIsUnion() != null && vo.getIsUnion() == 1L);
}
}

6
zdxt-web-client/zdxt-efcode-enforcement-app/src/api/enforcement/index.js

@ -1,11 +1,11 @@
import { _get, _post } from "@/http/index";
const baseUrl = "/api/app-enf";
const baseUrl = "/app-enf";
// region 认证模块
export const enforcementLogin = (params, success, error) => _post(baseUrl + "/login/szyptLogin", params, success, error);
// export const enforcementLogin = (params, success, error) => _post(baseUrl + "/login/szyptLogin", params, success, error);
export const enforcementLogin = (params, success, error) => _post(baseUrl + "/login/do", params, success, error);
// endregion
// region 企业模块

111
zdxt-web-client/zdxt-efcode-enforcement-app/src/views/enforcement/login.vue

@ -11,14 +11,17 @@
<van-form @submit="onSubmit">
<van-field v-model="loginParam.secretName" name="secretName" label="用户名" placeholder="用户名"
:rules="[{ required: true, message: '请填写用户名' }]"/>
<van-field v-model="loginParam.secretKey" type="password" name="secretKey" label="密码" placeholder="密码"
<van-field v-model="loginParam.secretKey" type="password" name="secretKey" label="密码"
placeholder="密码"
:rules="[{ required: true, message: '请填写密码' }]"/>
<div style="margin: 0.42rem">
<van-button block type="primary" native-type="submit">登录</van-button>
</div>
</van-form>
<div style="margin: 0.42rem 0.42rem 0; text-align: center;">
<van-button plain type="default" size="small" @click="showTestPicker = true" style="background-color: darkred;color: white">选择测试用户</van-button>
<van-button plain type="default" size="small" @click="showTestPicker = true"
style="background-color: darkred;color: white">选择测试用户
</van-button>
</div>
<van-action-sheet v-model:show="showTestPicker" title="选择测试用户">
<div class="test-enterprise-list">
@ -68,61 +71,23 @@
// 直接触发登录
doLogin(item.account, item.password);
}
const doLogin = (secretName, secretKey) => {
const encryptedKey = Encrypt(secretKey);
enforcementLogin({code: '12346678985288799'}, response => {
if (response.code === 200) {
// // 验证关键组织信息
// if (!response.data.deptId) {
// showFailToast("该用户未关联部门,无法登录");
// return;
// }
// if (!response.data.organId) {
// showFailToast("该用户未关联认证机构,无法登录");
// return;
// }
// if (!response.data.bureauUnitId) {
// showFailToast("该用户未关联执法单位,无法登录");
// return;
// }
// 执法端登录成功 → 赋值用户基本信息
useCommon.SET_USER_PHONENUMBER(response.data.phonenumber || "");
useCommon.SET_USER_ID(response.data.userId);
useCommon.SET_USER_NAME(response.data.userName || "");
useCommon.SET_NICK_NAME(response.data.nickName || "");
useCommon.SET_TOKEN(response.data.token);
useCommon.SET_DEPT_ID(response.data.deptId);
useCommon.SET_DEPT_NAME(response.data.deptName || "");
useCommon.SET_ORGAN_ID(response.data.organId);
useCommon.SET_ORGAN_NAME(response.data.organName || "");
useCommon.SET_BUREAU_UNIT_ID(response.data.bureauUnitId);
useCommon.SET_BUREAU_UNIT_NAME(response.data.bureauUnitName || "");
console.log("enforcement login success", useCommon.userId);
router.push({name: "enforcementHome"});
} else {
showFailToast(response.msg || "登录失败");
}
}, error => {
showFailToast(error?.msg || "登录失败,请检查网络");
})
};
// const doLogin = (secretName, secretKey) => {
// const encryptedKey = Encrypt(secretKey);
// enforcementLogin({"secretName": secretName, "secretKey": encryptedKey}, response => {
// enforcementLogin({code: '12346678985288799'}, response => {
// if (response.code === 200) {
// // 验证关键组织信息
// if (!response.data.deptId) {
// showFailToast("该用户未关联部门,无法登录");
// return;
// }
// if (!response.data.organId) {
// showFailToast("该用户未关联认证机构,无法登录");
// return;
// }
// if (!response.data.bureauUnitId) {
// showFailToast("该用户未关联执法单位,无法登录");
// return;
// }
// // // 验证关键组织信息
// // if (!response.data.deptId) {
// // showFailToast("该用户未关联部门,无法登录");
// // return;
// // }
// // if (!response.data.organId) {
// // showFailToast("该用户未关联认证机构,无法登录");
// // return;
// // }
// // if (!response.data.bureauUnitId) {
// // showFailToast("该用户未关联执法单位,无法登录");
// // return;
// // }
// // 执法端登录成功 → 赋值用户基本信息
// useCommon.SET_USER_PHONENUMBER(response.data.phonenumber || "");
// useCommon.SET_USER_ID(response.data.userId);
@ -144,6 +109,44 @@
// showFailToast(error?.msg || "登录失败,请检查网络");
// })
// };
const doLogin = (secretName, secretKey) => {
const encryptedKey = Encrypt(secretKey);
enforcementLogin({"secretName": secretName, "secretKey": encryptedKey}, response => {
if (response.code === 200) {
// 验证关键组织信息
if (!response.data.deptId) {
showFailToast("该用户未关联部门,无法登录");
return;
}
if (!response.data.organId) {
showFailToast("该用户未关联认证机构,无法登录");
return;
}
if (!response.data.bureauUnitId) {
showFailToast("该用户未关联执法单位,无法登录");
return;
}
// 执法端登录成功 → 赋值用户基本信息
useCommon.SET_USER_PHONENUMBER(response.data.phonenumber || "");
useCommon.SET_USER_ID(response.data.userId);
useCommon.SET_USER_NAME(response.data.userName || "");
useCommon.SET_NICK_NAME(response.data.nickName || "");
useCommon.SET_TOKEN(response.data.token);
useCommon.SET_DEPT_ID(response.data.deptId);
useCommon.SET_DEPT_NAME(response.data.deptName || "");
useCommon.SET_ORGAN_ID(response.data.organId);
useCommon.SET_ORGAN_NAME(response.data.organName || "");
useCommon.SET_BUREAU_UNIT_ID(response.data.bureauUnitId);
useCommon.SET_BUREAU_UNIT_NAME(response.data.bureauUnitName || "");
console.log("enforcement login success", useCommon.userId);
router.push({name: "enforcementHome"});
} else {
showFailToast(response.msg || "登录失败");
}
}, error => {
showFailToast(error?.msg || "登录失败,请检查网络");
})
};
const onSubmit = async () => {
doLogin(loginParam.secretName, loginParam.secretKey);

2
zdxt-web-client/zdxt-efcode-enforcement-app/vite-config/index.js

@ -43,7 +43,7 @@ const baseCfg = (viteEnv = {}) => {
cors: true,
proxy: {
'/api': {
target: 'http://139.186.148.21:8080',
target: 'http://localhost:17000',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '')
},

2
zdxt-web-client/zdxt-efcode-enforcement-app/vite-env/.env.enforcement-dev

@ -1,5 +1,5 @@
# 执法端开发环境
VITE_PORT = 12002
VITE_BASE_URL = '/'
VITE_BASE_URL = '/api/enf-ep'
VITE_DEFAULT_LOGIN = '/enforcement/login'
VITE_APP_ENV = 'dev'

Loading…
Cancel
Save