提交 3c1e38ad authored 作者: 刘旭's avatar 刘旭

换一个版本,记录代码

上级 c64396ed
{
"extends": [
"development"
]
}
\ No newline at end of file
...@@ -37,32 +37,33 @@ ...@@ -37,32 +37,33 @@
"type-check": "vue-tsc --noEmit" "type-check": "vue-tsc --noEmit"
}, },
"dependencies": { "dependencies": {
"@dcloudio/uni-app": "3.0.0-alpha-3061620221230002", "@dcloudio/uni-app": "3.0.0-alpha-3070720230316001",
"@dcloudio/uni-app-plus": "3.0.0-alpha-3061620221230002", "@dcloudio/uni-app-plus": "3.0.0-alpha-3070720230316001",
"@dcloudio/uni-components": "3.0.0-alpha-3061620221230002", "@dcloudio/uni-components": "3.0.0-alpha-3070720230316001",
"@dcloudio/uni-h5": "3.0.0-alpha-3061620221230002", "@dcloudio/uni-h5": "3.0.0-alpha-3070720230316001",
"@dcloudio/uni-mp-alipay": "3.0.0-alpha-3061620221230002", "@dcloudio/uni-mp-alipay": "3.0.0-alpha-3070720230316001",
"@dcloudio/uni-mp-baidu": "3.0.0-alpha-3061620221230002", "@dcloudio/uni-mp-baidu": "3.0.0-alpha-3070720230316001",
"@dcloudio/uni-mp-kuaishou": "3.0.0-alpha-3061620221230002", "@dcloudio/uni-mp-jd": "3.0.0-alpha-3070720230316001",
"@dcloudio/uni-mp-lark": "3.0.0-alpha-3061620221230002", "@dcloudio/uni-mp-kuaishou": "3.0.0-alpha-3070720230316001",
"@dcloudio/uni-mp-qq": "3.0.0-alpha-3061620221230002", "@dcloudio/uni-mp-lark": "3.0.0-alpha-3070720230316001",
"@dcloudio/uni-mp-toutiao": "3.0.0-alpha-3061620221230002", "@dcloudio/uni-mp-qq": "3.0.0-alpha-3070720230316001",
"@dcloudio/uni-mp-weixin": "3.0.0-alpha-3061620221230002", "@dcloudio/uni-mp-toutiao": "3.0.0-alpha-3070720230316001",
"@dcloudio/uni-quickapp-webview": "3.0.0-alpha-3061620221230002", "@dcloudio/uni-mp-weixin": "3.0.0-alpha-3070720230316001",
"@dcloudio/uni-quickapp-webview": "3.0.0-alpha-3070720230316001",
"vue": "^3.2.45", "vue": "^3.2.45",
"vue-i18n": "^9.1.9" "vue-i18n": "^9.1.9"
}, },
"devDependencies": { "devDependencies": {
"@dcloudio/types": "^3.2.7", "@dcloudio/types": "^3.2.7",
"@dcloudio/uni-automator": "3.0.0-alpha-3061620221230002", "@dcloudio/uni-automator": "3.0.0-alpha-3070720230316001",
"@dcloudio/uni-cli-shared": "3.0.0-alpha-3061620221230002", "@dcloudio/uni-cli-shared": "3.0.0-alpha-3070720230316001",
"@dcloudio/uni-stacktracey": "3.0.0-alpha-3061620221230002", "@dcloudio/uni-stacktracey": "3.0.0-alpha-3070720230316001",
"@dcloudio/vite-plugin-uni": "3.0.0-alpha-3061620221230002", "@dcloudio/vite-plugin-uni": "3.0.0-alpha-3070720230316001",
"@vue/tsconfig": "^0.1.3", "@vue/tsconfig": "^0.1.3",
"typescript": "^4.9.4",
"sass": "^1.54.8", "sass": "^1.54.8",
"sass-loader": "^13.0.2", "sass-loader": "^13.0.2",
"vite": "4.0.4", "typescript": "^4.9.4",
"vite": "4.0.3",
"vue-tsc": "^1.0.24" "vue-tsc": "^1.0.24"
} }
} }
export const ApiUrl: string = 'http://192.168.0.90/ndr'
// export const ApiUrl = 'http://192.168.0.242/k3Cloud'
export const corp_id: string = 'wwe94781e7973de14c' // 企业id
// export const corp_id: string = 'wwdc9c13d0a3ace384' // 客户企业id
export const redirect_uri: string = 'qyex' // 重定向路径
export const agentid: string = '-_fg5_i0F3c1sJtK1r00JLRpq_3aTYD9dbEve8_VznA'// 企业应用id
// export const agentid: string = 'xcQbgs-h6I1Fys_YzV-p6b-fJJJ9iyT3HRTJsSnMnaQ' // 客户企业应用id
\ No newline at end of file
...@@ -11,11 +11,13 @@ ...@@ -11,11 +11,13 @@
<script setup lang='ts'> <script setup lang='ts'>
import { ref } from 'vue' import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'; import { onLoad } from '@dcloudio/uni-app';
import { ApiUrl } from '@/config';
import formList from './formList.vue'; import formList from './formList.vue';
const selectList = ref([] as any[]) const selectList = ref([] as any[])
const formListRef = ref() const formListRef = ref()
const fid = ref() const fid = ref()
onLoad((options: any) => { onLoad((options: any) => {
let option = JSON.parse(options.row) let option = JSON.parse(options.row)
fid.value = option.FID fid.value = option.FID
...@@ -34,12 +36,7 @@ const initSelect = () => { ...@@ -34,12 +36,7 @@ const initSelect = () => {
mask: true mask: true
}) })
uni.request({ uni.request({
// #ifdef MP-WEIXIN url: ApiUrl + '/LQKJ.K3.NDR.WebApiBusinessServicePlugIn.WebApi.ExecuteCmdSelect,LQKJ.K3.NDR.WebApiBusinessServicePlugIn.common.kdsvc',
url: 'http://192.168.0.90/ndr/LQKJ.K3.NDR.WebApiBusinessServicePlugIn.WebApi.ExecuteCmdSelect,LQKJ.K3.NDR.WebApiBusinessServicePlugIn.common.kdsvc',
// #endif
// #ifdef H5
url: '/ndr/LQKJ.K3.NDR.WebApiBusinessServicePlugIn.WebApi.ExecuteCmdSelect,LQKJ.K3.NDR.WebApiBusinessServicePlugIn.common.kdsvc',
// #endif
method: 'GET', method: 'GET',
success(res: any) { success(res: any) {
uni.hideLoading() uni.hideLoading()
...@@ -73,19 +70,11 @@ const onSave = () => { ...@@ -73,19 +70,11 @@ const onSave = () => {
"FNumber": res.number "FNumber": res.number
}, },
"F_LQKJ_WORKTIME": res.Hours, "F_LQKJ_WORKTIME": res.Hours,
"F_LQKJ_FDEPARTMENT": {
"FName": "销售三部"
},
// "F_LQKJ_Date2": "2023-01-01",
"F_LQKJ_WORKCONTAINER": "",
// "F_LQKJ_FNAME": {
// "FName": "杨梦姝"
// }
} }
} }
} }
uni.request({ uni.request({
url: '/ndr/LQKJ.K3.NDR.WebApiBusinessServicePlugIn.WebApi.ExecuteCmdEdit,LQKJ.K3.NDR.WebApiBusinessServicePlugIn.common.kdsvc', url: ApiUrl + '/LQKJ.K3.NDR.WebApiBusinessServicePlugIn.WebApi.ExecuteCmdEdit,LQKJ.K3.NDR.WebApiBusinessServicePlugIn.common.kdsvc',
method: 'POST', method: 'POST',
data, data,
success(res: any) { success(res: any) {
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
<script setup lang='ts'> <script setup lang='ts'>
import { ref, reactive } from 'vue' import { ref, reactive } from 'vue'
import { ApiUrl } from '@/config';
import popup from './popup.vue'; import popup from './popup.vue';
const props = defineProps({ const props = defineProps({
...@@ -117,7 +118,7 @@ const handleClick = () => { ...@@ -117,7 +118,7 @@ const handleClick = () => {
const inputValue = (value: string) => { const inputValue = (value: string) => {
initSelect(value) initSelect(value)
} }
const initSelect = (FName?: string) => { const initSelect = (FName?: string) => {
uni.showLoading({ uni.showLoading({
...@@ -129,7 +130,7 @@ const initSelect = (FName?: string) => { ...@@ -129,7 +130,7 @@ const initSelect = (FName?: string) => {
url: 'http://192.168.0.90/ndr/LQKJ.K3.NDR.WebApiBusinessServicePlugIn.WebApi.ExecuteCmdSelect,LQKJ.K3.NDR.WebApiBusinessServicePlugIn.common.kdsvc', url: 'http://192.168.0.90/ndr/LQKJ.K3.NDR.WebApiBusinessServicePlugIn.WebApi.ExecuteCmdSelect,LQKJ.K3.NDR.WebApiBusinessServicePlugIn.common.kdsvc',
// #endif // #endif
// #ifdef H5 // #ifdef H5
url: '/ndr/LQKJ.K3.NDR.WebApiBusinessServicePlugIn.WebApi.ExecuteCmdSelect,LQKJ.K3.NDR.WebApiBusinessServicePlugIn.common.kdsvc', url: ApiUrl + '/LQKJ.K3.NDR.WebApiBusinessServicePlugIn.WebApi.ExecuteCmdSelect,LQKJ.K3.NDR.WebApiBusinessServicePlugIn.common.kdsvc',
// #endif // #endif
method: 'POST', method: 'POST',
data: { FName }, data: { FName },
......
<template> <template>
<h1>{{ isExistStorage }}</h1>
<view class="queryRecords" @tap="toQueryPage"><text>项目工时登记</text></view> <view class="queryRecords" @tap="toQueryPage"><text>项目工时登记</text></view>
<view class="container"> <view class="container">
<view class="header"> <view class="header">
...@@ -29,12 +30,16 @@ ...@@ -29,12 +30,16 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted } from 'vue' import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app';
import { ApiUrl, corp_id, redirect_uri, agentid } from '../../config/index'
import formList from './components/formList.vue'; import formList from './components/formList.vue';
const date: any = ref('') const date: any = ref('')
const disabled = ref(false) const disabled = ref(false)
const userId = ref() const userId = ref()
const testName = 'xh.' // 定义测试userid
const isExistStorage = ref()
const placeholderList: any = ref([ const placeholderList: any = ref([
{ placeholder: '项目1' }, { placeholder: '项目1' },
...@@ -74,29 +79,22 @@ const newDate = () => { ...@@ -74,29 +79,22 @@ const newDate = () => {
} }
const onSubmit = () => { const onSubmit = () => {
if (!userId.value) return uni.showToast({
title: '请先绑定用户姓名'
})
submitData.value = [] submitData.value = []
formListRef.value?.map((item: any) => { formListRef.value?.map((item: any) => {
let obj = { let obj = {
"F_LQKJ_FITEM": { F_LQKJ_FITEM: {
"FNumber": ""//项目编号 FNumber: ""//项目编号
}, },
"F_LQKJ_WORKTIME": 0,//工时 F_LQKJ_WORKTIME: 0,//工时
// "F_LQKJ_FDEPARTMENT": { F_LQKJ_Date2: "",//工时发生日期
// "FName": ""//部门编号
// },
"F_LQKJ_Date2": "",//工时发生日期
// "F_LQKJ_WORKCONTAINER": "",//工作内容
// "F_LQKJ_FNAME": {
// "FName": ""//员工编号
// }
} }
item.submit().then((res: any) => { item.submit().then((res: any) => {
obj.F_LQKJ_WORKTIME = res.Hours obj.F_LQKJ_WORKTIME = res.Hours
// obj.F_LQKJ_WORKCONTAINER = res.workContent
obj.F_LQKJ_FITEM.FNumber = res.number obj.F_LQKJ_FITEM.FNumber = res.number
obj.F_LQKJ_Date2 = date obj.F_LQKJ_Date2 = date
// obj.F_LQKJ_FNAME.FName = res.employeeNumber
// obj.F_LQKJ_FDEPARTMENT.FName = res.departmentNo
submitData.value.push(obj) submitData.value.push(obj)
}) })
}) })
...@@ -130,7 +128,7 @@ const onSubmit = () => { ...@@ -130,7 +128,7 @@ const onSubmit = () => {
success: function (res) { success: function (res) {
if (res.confirm) { if (res.confirm) {
uni.request({ uni.request({
url: '/ndr/LQKJ.K3.NDR.WebApiBusinessServicePlugIn.WebApi.ExecuteCmdAdd,LQKJ.K3.NDR.WebApiBusinessServicePlugIn.common.kdsvc', url: ApiUrl + '/LQKJ.K3.NDR.WebApiBusinessServicePlugIn.WebApi.ExecuteCmdAdd,LQKJ.K3.NDR.WebApiBusinessServicePlugIn.common.kdsvc',
method: 'POST', method: 'POST',
data: { data: {
parmeters: { parmeters: {
...@@ -159,18 +157,17 @@ const onBind = () => { ...@@ -159,18 +157,17 @@ const onBind = () => {
icon: 'none' icon: 'none'
}) })
let data = { let data = {
// ID: 'xh.',
parmeters: { parmeters: {
Model: { Model: {
F_LQKJ_FNANEM: { F_LQKJ_FNANEM: {
FName: userId.value FName: userId.value
}, },
F_LQKJ_ID: 'xh.' F_LQKJ_ID: testName
} }
} }
} }
uni.request({ uni.request({
url: '/ndr/LQKJ.K3.NDR.WebApiBusinessServicePlugIn.WebApi.addUser,LQKJ.K3.NDR.WebApiBusinessServicePlugIn.common.kdsvc', url: ApiUrl + '/LQKJ.K3.NDR.WebApiBusinessServicePlugIn.WebApi.addUser,LQKJ.K3.NDR.WebApiBusinessServicePlugIn.common.kdsvc',
data, data,
method: 'POST', method: 'POST',
success: (res: any) => { success: (res: any) => {
...@@ -189,49 +186,45 @@ const onBind = () => { ...@@ -189,49 +186,45 @@ const onBind = () => {
}) })
} }
const login = () => { const getAccessToken = () => {
uni.showLoading({ uni.showLoading({
title: '加载中...', title: '加载中...',
mask: true mask: true
}); });
uni.request({ uni.request({
// #ifdef MP-WEIXIN url: ApiUrl + '/LQKJ.K3.NDR.WebApiBusinessServicePlugIn.WebApi.RequestToken,LQKJ.K3.NDR.WebApiBusinessServicePlugIn.common.kdsvc',
url: 'http://192.168.0.90/ndr/Kingdee.BOS.WebApi.ServicesStub.AuthService.ValidateUser.common.kdsvc',
// #endif
// #ifdef H5
url: '/ndr/Kingdee.BOS.WebApi.ServicesStub.AuthService.ValidateUser.common.kdsvc',
// #endif
method: 'POST', method: 'POST',
data: { data: { corpid: corp_id, corpsecret: agentid },
parameters: ["640aea3709a243", "Administrator", "kingdee$2023", 2052]
},
success(res: any) {
formListRef.value?.map((item: any) => item.initRules())
// getAccessToken()
handleIsExist()
}
})
}
const getAccessToken = () => {
uni.request({
url: '/ndr/LQKJ.K3.NDR.WebApiBusinessServicePlugIn.WebApi.RequestToken,LQKJ.K3.NDR.WebApiBusinessServicePlugIn.common.kdsvc',
method: 'GET',
success(res: any) { success(res: any) {
console.log(res); const { access_token, errcode } = res.data
const { access_token } = res.data if (errcode === 0) {
localStorage.setItem('token', access_token) formListRef.value?.map((item: any) => item.initRules())
handleIsExist() localStorage.setItem('token', access_token)
let path = location.href
// 获取用户code
// const login_url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${corp_id}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`
// uni.redirectTo({ url: login_url })
console.log('getAccessToken', path);
// getUserInfo({ token: access_token, id: path })
handleIsExist()
} else {
uni.hideLoading()
uni.showToast({
title: '请连接内网使用',
icon: 'none'
})
}
} }
}) })
} }
const getUserInfo = () => { const getUserInfo = (data: any) => {
uni.request({ uni.request({
url: '/ndr/LQKJ.K3.NDR.WebApiBusinessServicePlugIn.WebApi.Request,LQKJ.K3.NDR.WebApiBusinessServicePlugIn.common.kdsvc', url: ApiUrl + '/LQKJ.K3.NDR.WebApiBusinessServicePlugIn.WebApi.Request,LQKJ.K3.NDR.WebApiBusinessServicePlugIn.common.kdsvc',
method: 'POST', method: 'POST',
data,
success(res: any) { success(res: any) {
console.log(res); console.log(res, 'getUserInfo');
// const { access_token } = res // const { access_token } = res
// localStorage.setItem('token', access_token) // localStorage.setItem('token', access_token)
} }
...@@ -240,14 +233,15 @@ const getUserInfo = () => { ...@@ -240,14 +233,15 @@ const getUserInfo = () => {
const handleIsExist = () => { const handleIsExist = () => {
uni.request({ uni.request({
url: '/ndr/LQKJ.K3.NDR.WebApiBusinessServicePlugIn.WebApi.selectUser,LQKJ.K3.NDR.WebApiBusinessServicePlugIn.common.kdsvc', url: ApiUrl + '/LQKJ.K3.NDR.WebApiBusinessServicePlugIn.WebApi.selectUser,LQKJ.K3.NDR.WebApiBusinessServicePlugIn.common.kdsvc',
method: 'GET', method: 'POST',
data: { ID: 'xh.' }, data: { ID: testName },
success: (res: any) => { success: (res: any) => {
uni.hideLoading() uni.hideLoading()
console.log('handleIsExist', location.href);
const { data } = res const { data } = res
if (data.code === 200) { if (data.code === 200) {
console.log(data); userId.value = data.data[0].FNAME
disabled.value = true disabled.value = true
} else { } else {
disabled.value = false disabled.value = false
...@@ -257,10 +251,36 @@ const handleIsExist = () => { ...@@ -257,10 +251,36 @@ const handleIsExist = () => {
}) })
} }
onMounted(() => { onLoad((options: any) => {
login() const { code } = options
console.log('options', options);
alert(localStorage.getItem('isStorage'))
if (code) alert(code)
getAccessToken()
date.value = newDate() date.value = newDate()
localStorage.setItem('userId', 'xh.')
localStorage.setItem('isStorage', '测试成功')
}) })
// const login = () => {
// uni.showLoading({
// title: '加载中...',
// mask: true
// });
// uni.request({
// url: ApiUrl + '/Kingdee.BOS.WebApi.ServicesStub.AuthService.ValidateUser.common.kdsvc',
// method: 'POST',
// withCredentials: true,
// data: {
// parameters: ["640aea3709a243", "Administrator", "kingdee$2023", 2052]
// // parameters: ["64103088059f53", "Administrator", "kingdee@123", 2052]
// },
// success(res: any) {
// getAccessToken()
// }
// })
// }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
<script setup lang='ts'> <script setup lang='ts'>
import { ref } from 'vue' import { ref } from 'vue'
import { ApiUrl } from '@/config';
const list = ref() const list = ref()
...@@ -37,14 +38,9 @@ const init = () => { ...@@ -37,14 +38,9 @@ const init = () => {
mask: true mask: true
}) })
uni.request({ uni.request({
// #ifdef MP-WEIXIN url: ApiUrl + '/LQKJ.K3.NDR.WebApiBusinessServicePlugIn.WebApi.ExecuteCmdSelectName,LQKJ.K3.NDR.WebApiBusinessServicePlugIn.common.kdsvc',
url: 'http://192.168.0.90/ndr/LQKJ.K3.NDR.WebApiBusinessServicePlugIn.WebApi.ExecuteCmdSelectName,LQKJ.K3.NDR.WebApiBusinessServicePlugIn.common.kdsvc',
// #endif
// #ifdef H5
url: '/ndr/LQKJ.K3.NDR.WebApiBusinessServicePlugIn.WebApi.ExecuteCmdSelectName,LQKJ.K3.NDR.WebApiBusinessServicePlugIn.common.kdsvc',
// #endif
method: 'POST', method: 'POST',
data: { Name: 0 }, data: { Name: localStorage.getItem('userId') },
success(res: any) { success(res: any) {
uni.hideLoading() uni.hideLoading()
const { data } = res const { data } = res
......
...@@ -9,11 +9,11 @@ export default defineConfig({ ...@@ -9,11 +9,11 @@ export default defineConfig({
port: 7879, port: 7879,
open: true, open: true,
strictPort: false, // 端口被占用直接退出 strictPort: false, // 端口被占用直接退出
proxy: { // proxy: {
'/ndr': { // '/ndr': {
target: 'http://192.168.0.90/', // target: 'http://192.168.0.90/',
}, // },
}, // },
}, },
build: { build: {
minify: 'terser', minify: 'terser',
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论