Parcourir la source

Merge branch 'master' of http://117.72.14.118:3000/kl/zj-mobile-oa

liranlong il y a 2 mois
Parent
commit
da2a741f78

+ 1 - 8
App.vue

@@ -1,14 +1,7 @@
 <script>
 	export default {
 		onLaunch: function() {
-			// uni.setTabBarBadge({
-			// 	index: 2,
-			// 	text: 56
-			// })
-			// uni.showTabBarRedDot({
-			// 	index: 4
-			// })
-			
+			// console.log(plus);
 			// let loginValue = uni.getStorageSync("isLogin");
 			// if (!isLogin) {
 			// 	uni.reLaunch({

+ 17 - 3
components/myTable/myTable.vue

@@ -21,7 +21,7 @@
 			<uni-td align="center" width="180">
 				<view class="uni-group">
 					<button class="uni-button" size="mini" type="primary" @click="handleBL(item)">办理</button>
-					<button class="uni-button" size="mini" type="warn">删除</button>
+					<button class="uni-button" size="mini" type="warn" @click="handleDel(item)">删除</button>
 				</view>
 			</uni-td>
 		</uni-tr>
@@ -34,6 +34,7 @@
 
 <script setup>
 	import {ref} from "vue"
+	const emits = defineEmits(['pageChange'])
 	const props = defineProps({
 		column:{
 			type: Array,
@@ -68,8 +69,8 @@
 	const table = ref()
 	
 	
-	function change(){
-		
+	function change(e){
+		emits('pageChange', e.current)
 	}
 	
 	function handleBL(item){
@@ -77,6 +78,19 @@
 			url: props.blUrl + '&name=' + item.name
 		})
 	}
+	
+	function handleDel(item){
+		uni.showModal({
+			title: "提示",
+			content: "再次确认是否删除",
+			confirmColor: "#ff1919",
+			success: (e)=>{
+				if(e.confirm){
+					console.log(item);
+				}
+			}
+		})
+	}
 </script>
 
 <style lang="scss" scope>

+ 3 - 0
index.html

@@ -17,5 +17,8 @@
   <body>
     <div id="app"><!--app-html--></div>
     <script type="module" src="/main.js"></script>
+	<script src="./utils/sm4.js"></script>
+	<script src="./utils/apiUrl.js"></script>
+	<script src="./utils/base64.js"></script>
   </body>
 </html>

+ 2 - 1
pages.json

@@ -59,7 +59,8 @@
 		"navigationBarTitleText": "住建OA",
 		"navigationBarBackgroundColor": "rgb(238,238,238)",
 		"backgroundColor": "#F8F8F8",
-		"navigationStyle": "custom"
+		"navigationStyle": "custom",
+		"pageOrientation": "landscape"
 	},
 	"tabBar": {
 		"color": "#999",

+ 2 - 10
pages/digitalHousing/digitalHousing.vue

@@ -84,19 +84,11 @@
 			"address": "上海市普陀区金沙江路 1516 弄"
 		}
 	])
-
-	const subList = ref([
-		{
-			name: '待发货',
-			num: 10
-		}, 
-		{
-			name: '待付款'
-		}
-	])
+	
 	function link1() {
 		console.log(123)
 	}
+	
 	function link2() {
 		console.log(4562)
 	}

+ 75 - 39
pages/handleFile/handleFile.vue

@@ -1,7 +1,7 @@
 <template>
 	<scroll-view style="flex:1">
 		<view class="tableTop">
-			<u-subsection bg-color="rgb(215,224,233)" button-color="rgb(0,99,208)" active-color="white" :list="list" ></u-subsection>
+			<u-subsection bg-color="rgb(215,224,233)" button-color="rgb(0,99,208)" active-color="white" :list="list" @change="subChange"></u-subsection>
 			<view class="operation">
 				<uni-easyinput placeholder="请输入编号"></uni-easyinput>
 				<u-button type="primary" size="medium" ripple>查询</u-button>
@@ -9,53 +9,89 @@
 			</view>
 		</view>
 		<u-line length="95%" margin="auto" color="#000"/>
-		<myTable :column="column" :tableData="tableData" blUrl="/pages/information/information?url=/pages/handleFile/handleFile"></myTable>
+		<myTable
+			:column="column" 
+			:tableData="tableData" 
+			:pageCurrent="pageCurrent"
+			:pageSize="pageSize"
+			:total="total"
+			blUrl="/pages/information/information?url=/pages/handleFile/handleFile"
+			@pageChange="pageChange"
+		>
+		</myTable>
 	</scroll-view>
 </template>
 
 <script setup>
 	import { ref } from 'vue';
-	import { onLoad, onReady } from"@dcloudio/uni-app"
+	import { onReady } from"@dcloudio/uni-app"
 	import { ApiRequest } from "@/utils/request.js"
 
-	const list = ref([
-		{
-			name: '待办',
-			num: 2
-		}, 
-		{
-			name: '已办'
-		}, 
-		{
-			name: '办结',
-			num: 6
-		}
-	])
-		
+	const list = ref([{name: '待办'}, {name: '已办'}, {name: '办结'}])
+	
+	const currentUrl = ref('/g2work/routeinfo/queryDataTodoWithPage')
+	const pageCurrent = ref(1)
+	const pageSize = ref(15)
+	const total = ref(0)
 	const column = ref(["紧急程度", "公文种类", "标题", "发文字号", "主办处室", "是否已阅", "操作"])
-	const tableData = ref([
-		{
-			
-			"date": "不紧急",
-			"name": "Dcloud1",
-			"address": "上海市普陀区金沙江路 1518 弄",
-			"fwzh": "1322",
-			"zbcs": "政务处",
-			"sfyy": "是"
-		},
-		{
-			"date": "不紧急",
-			"name": "Dcloud2",
-			"address": "上海市普陀区金沙江路 1518 弄",
-			"fwzh": "1322",
-			"zbcs": "政务处",
-			"sfyy": "是"
+	const tableData = ref([])
+	
+	//切换页签
+	function subChange(e){
+		pageCurrent.value = 1 //重置当前页码
+		switch (e){
+			case 0: //待办
+				currentUrl.value = '/g2work/routeinfo/queryDataTodoWithPage'
+				getTableList('/g2work/routeinfo/queryDataTodoWithPage')
+				break;
+			case 1: //已办
+				currentUrl.value = '/g2work/routeinfo/queryDataDoneWithPage'
+				getTableList('/g2work/routeinfo/queryDataDoneWithPage')
+				break;
+			case 2: //办结
+				currentUrl.value = '/g2work/routeinfo/queryDataFinishWithPage'
+				getTableList('/g2work/routeinfo/queryDataFinishWithPage')
+				break;
 		}
-	])
-
-
-	onLoad(()=>{
-		console.log('onLoad获取页面传参');
+	}
+	
+	function getTableList(url, pageno){
+		ApiRequest({
+			url: url,
+			method: 'POST',
+			data:{
+				pageno: pageno || pageCurrent.value,
+				pagesize: pageSize.value,
+				userid: uni.getStorageSync('GlWorkPlatform-userid'),
+				querycondition: "[]",
+				ordercondition:  "",
+				flowid: "AA20|AA03|AA10|AA55|AA56|AA57|AA08|AA23|AA77|AA06"
+			}
+		}).then(res=>{
+			if(res.code === 0 && res.success){
+				tableData.value = res.data.map(item=>{
+					return {
+						'FW_WFH.JJCDCAPTION': item['FW_WFH.JJCDCAPTION'],
+						'FLOWNAME': item['FLOWNAME'],
+						'FW_WFH.BT': item['FW_WFH.BT'],
+						'FW_WFH.FWZH': item['FW_WFH.FWZH'],
+						'FW_WFH.ZS': item['FW_WFH.ZS'],
+						'FW_WFH.SFXYJDCAPTION': item['FW_WFH.SFXYJDCAPTION']
+					}
+				})
+				total.value = res.meta.totalCount
+			}
+		})
+	}
+	
+	//更改页码
+	function pageChange(val){
+		pageCurrent.value = val
+		getTableList(currentUrl.value, val)
+	}
+	
+	onReady(()=>{
+		getTableList('/g2work/routeinfo/queryDataTodoWithPage')
 	})
 </script>
 

+ 77 - 32
pages/handleMeeting/handleMeeting.vue

@@ -1,7 +1,7 @@
 <template>
 	<scroll-view style="flex:1">
 		<view class="tableTop">
-			<u-subsection bg-color="rgb(215,224,233)" button-color="rgb(0,99,208)" active-color="white" :list="list" ></u-subsection>
+			<u-subsection bg-color="rgb(215,224,233)" button-color="rgb(0,99,208)" active-color="white" :list="list" @change="subChange"></u-subsection>
 			<view class="operation">
 				<uni-easyinput placeholder="请输入编号"></uni-easyinput>
 				<u-button type="primary" size="medium" ripple>查询</u-button>
@@ -9,43 +9,88 @@
 			</view>
 		</view>
 		<u-line length="95%" margin="auto" color="#000"/>
-		<myTable :column="column" :tableData="tableData"></myTable>
+		<myTable 
+			:column="column" 
+			:tableData="tableData"
+			:pageCurrent="pageCurrent"
+			:pageSize="pageSize"
+			:total="total"
+			blUrl="/pages/information/information?url=/pages/handleMeeting/handleMeeting"
+		></myTable>
 	</scroll-view>
 </template>
 
 <script setup>
 	import { ref } from 'vue';
+	import { onReady } from"@dcloudio/uni-app"
+	import { ApiRequest } from "@/utils/request.js"
 
-	const list = ref([
-			{
-				name: '待办',
-				num: 2
-			}, 
-			{
-				name: '已办',
-				num: 2
-			}, 
-			{
-				name: '办结',
-				num: 6
-			},
-		])
-		
-		const column = ref(["紧急程度", "流程名称", "编号", "承办部门", "标题", "会议室", "参会人数", "当前节点", "接收时间", "操作"])
-		const tableData = ref([
-			{
-				"date": "不紧急",
-				"name": "无",
-				"address": "00747",
-				"fwzh": "住建部",
-				"zbcs": "海河英才计划",
-				"sfyy": "办公室",
-				"count":"28",
-				"node": "sd",
-				"time": "2020-50-93"
-			},
-		
-		])
+	const list = ref([{name: '待办'}, {name: '已办'}, {name: '办结'}])
+	
+	const currentUrl = ref('/g2work/routeinfo/queryDataTodoWithPage')
+	const pageCurrent = ref(1)
+	const pageSize = ref(15)
+	const total = ref(0)
+	const column = ref(["紧急程度", "流程名称", "编号", "承办部门", "标题", "会议室", "参会人数", "当前节点", "接收时间", "操作"])
+	const tableData = ref([])
+	
+	//切换页签
+	function subChange(e){
+		pageCurrent.value = 1 //重置当前页码
+		switch (e){
+			case 0: //待办
+				currentUrl.value = '/g2work/routeinfo/queryDataTodoWithPage'
+				getTableList('/g2work/routeinfo/queryDataTodoWithPage')
+				break;
+			case 1: //已办
+				currentUrl.value = '/g2work/routeinfo/queryDataDoneWithPage'
+				getTableList('/g2work/routeinfo/queryDataDoneWithPage')
+				break;
+			case 2: //办结
+				currentUrl.value = '/g2work/routeinfo/queryDataFinishWithPage'
+				getTableList('/g2work/routeinfo/queryDataFinishWithPage')
+				break;
+		}
+	}
+	
+	function getTableList(url, pageno){
+		ApiRequest({
+			url: url,
+			method: 'POST',
+			data:{
+				pageno: pageno || pageCurrent.value,
+				pagesize: pageSize.value,
+				userid: uni.getStorageSync('GlWorkPlatform-userid'),
+				querycondition: "[]",
+				ordercondition:  "",
+				flowid: "AA20|AA03|AA10|AA55|AA56|AA57|AA08|AA23|AA77|AA06"
+			}
+		}).then(res=>{
+			if(res.code === 0 && res.success){
+				tableData.value = res.data.map(item=>{
+					return {
+						'FW_WFH.JJCDCAPTION': item['FW_WFH.JJCDCAPTION'],
+						'FLOWNAME': item['FLOWNAME'],
+						'FW_WFH.BT': item['FW_WFH.BT'],
+						'FW_WFH.FWZH': item['FW_WFH.FWZH'],
+						'FW_WFH.ZS': item['FW_WFH.ZS'],
+						'FW_WFH.SFXYJDCAPTION': item['FW_WFH.SFXYJDCAPTION']
+					}
+				})
+				total.value = res.meta.totalCount
+			}
+		})
+	}
+	
+	//更改页码
+	function pageChange(val){
+		pageCurrent.value = val
+		getTableList(currentUrl.value, val)
+	}
+	
+	onReady(()=>{
+		getTableList('/g2work/routeinfo/queryDataTodoWithPage')
+	})
 </script>
 
 <style lang="scss" scoped>

+ 82 - 15
pages/login/login.vue

@@ -10,33 +10,100 @@
 		<view class="operation">
 			<uni-easyinput prefixIcon="person-filled" v-model="username" placeholder="请输入登录账号" ></uni-easyinput>
 			<uni-easyinput prefixIcon="locked-filled" v-model="password" placeholder="请输入登录密码" type="password"></uni-easyinput>
-			<button type="primary" @click="handleLogin" :loading="loading" :disabled="loading">登录</button>
+			<button type="primary" :loading="loading" :disabled="loading" @click="handleLogin">登录</button>
 		</view>
-		
 	</view>
+	
+	<u-top-tips ref="uTips" navbar-height="0"></u-top-tips>
 </template>
 
 <script setup>
-	import {ref} from "vue";
+	import {ref} from "vue"
+	import {ApiRequest} from "@/utils/request.js"
 
+	const uTips = ref()
 	const username = ref('')
 	const password = ref('')
 	const loading = ref(false)
+	const s4 = new SM4Util()
+	const base64 = new Base64() //声明base解码和编码类 
 
 
 	function handleLogin(){
-		loading.value = true
-		console.log(username.value)
-		console.log(password.value)
-		uni.showToast({
-			title: "登录中...",
-			icon: "loading",
-			mask: true
-		})
-		uni.switchTab({url: "/pages/handleFile/handleFile"})
-
+		if(!username.value){
+			uTips.value.show({
+				title: '请输入登录账号',
+				type: 'error',
+				duration: '2300'
+			})
+		}else if(!password.value){
+			uTips.value.show({
+				title: '请输入登录密码',
+				type: 'error',
+				duration: '2300'
+			})
+		}else{
+			ApiRequest({
+				url: "/connect/token",
+				method: "POST",
+				data: JSON.stringify({
+					data: s4.encryptData_CBC(JSON.stringify({
+						client_id: "androidclient",
+						grant_type: "password",
+						scope: "openid profile email RefineAPI",
+						username: username.value,
+						password: password.value
+					}))
+				})
+			}).then(obj=>{
+				let res = strToJson(s4.decryptData_CBC(obj.data))
+				uni.setStorageSync('GlWorkPlatform-AccessToken', res.access_token) //token
+				let getBase = base64.decode(res.access_token.split(".")[1])
+				getBase = getBase.substring(0, getBase.lastIndexOf("}") + 1)
+				let getBaseSet = JSON.parse(getBase)
+				uni.setStorageSync('GlWorkPlatform-userid', getBaseSet.sub) //用户id
+				getUserInfo() //获取用户信息
+			}).catch(err=>{
+				uTips.value.show({
+					title: '登录失败,用户名号或密码输入错误!',
+					type: 'error',
+					duration: '3000'
+				})
+			})
+		}
+	}
+	
+	function getUserInfo(){
+		ApiRequest({
+			url: "/api/User/UserInfo",
+			method: "POST",
+		}).then(obj=>{
+			let res = strToJson(s4.decryptData_CBC(obj.data))
+			 if (res.data.ukind == "禁用") {
+				uTips.value.show({
+					title: '您好,该用户已被禁用,请联系管理员!',
+					type: 'error',
+					duration: '3000'
+				})
+			}else{
+				if(res.code === 0 && res.success){
+					uni.setStorageSync('GlWorkPlatform-chineseName', res.data.ushowname)
+					loading.value = true
+					uni.showLoading({
+						title: '登录中...',
+						mask: true
+					})
+					uni.switchTab({url: "/pages/handleFile/handleFile"})
+				}
+			}
+		}).catch(err=>{
+			uTips.value.show({
+				title: '获取用户信息错误!',
+				type: 'error',
+				duration: '3000'
+			})
+		}).finally(()=> uni.hideLoading())
 	}
-
 </script>
 
 <style lang="scss">
@@ -45,7 +112,7 @@
 	}
 	.topBar{
 		width: 100vw;
-		height: 400rpx;
+		height: 300rpx;
 	}
 	.login{
 		color: #005492;

+ 1 - 0
pages/myOwn/myOwn.vue

@@ -5,6 +5,7 @@
 <script setup>
 
 function handleLogout(){
+	uni.clearStorageSync()
 	uni.navigateTo({
 		url: "/pages/login/login"
 	})

+ 45 - 0
utils/apiUrl.js

@@ -0,0 +1,45 @@
+//首先: special命名为sp
+var apiurljs = window.NameSpace || {};
+
+apiurljs.login = "http://192.168.3.152:8088/glwork/";
+apiurljs.login1 = "http://192.168.3.152:8088/glwork1/";
+
+apiurljs.onePic = "http://10.149.1.56:8077/"
+
+apiurljs.yzFcscloud = "http://192.168.3.152:8088/glwork/"
+apiurljs.yzFileWo = "http://192.168.3.152:8088/wo/";
+
+//老OA公文地址
+apiurljs.seeyon = "http://192.168.1.113:86/seeyon"
+
+apiurljs.refineapi = "";
+
+apiurljs.dpt = "http://10.149.1.35:8001/api/"
+//sm4解码字符串转对象
+function strToJson(str) {
+    var obj = str.replace(/\u0000|\u0001|\u0002|\u0003|\u0004|\u0005|\u0006|\u0007|\u0008|\u0009|\u000a|\u000b|\u000c|\u000d|\u000e|\u000f|\u0010|\u0011|\u0012|\u0013|\u0014|\u0015|\u0016|\u0017|\u0018|\u0019|\u001a|\u001b|\u001c|\u001d|\u001e|\u001f|\u007F/g, "")
+    var json = eval('(' + obj + ')');
+    return json;
+}
+
+// if (sessionStorage.getItem("GlWorkPlatform-uploadformat") == null) {
+//     $.ajax({
+//         url: apiurljs.login + "g2app/dataabase/queryCodeData",
+//         type: 'post',
+//         dataType: 'json',
+//         contentType: 'application/json',
+//         headers: { Authorization: "Bearer " + localStorage.getItem("GlWorkPlatform-AccessToken") },
+//         data: JSON.stringify({
+//             tablename: "CODE_UPLOADFORMAT"
+//         }),
+//         success: function (res) {
+//             apiurljs.uploadformat = res.data;
+//             sessionStorage.setItem("GlWorkPlatform-uploadformat", apiurljs.uploadformat)
+//         }
+//     })
+// } else {
+//     apiurljs.uploadformat = sessionStorage.getItem("GlWorkPlatform-uploadformat")
+// }
+apiurljs.zwType = ["doc", "docx", "wps", "xls", "xlsx", "et"]
+
+apiurljs.zhType = ["doc", "docx", "wps", "xls", "xlsx", "et", "pdf", "ofd", "png", "jpg", "jpeg", "gif", "bmp", "jfif", "svg", "tif", "tiff"]//, "DOC", "DOCX", "WPS", "XLS", "XLSX", "ET", "PDF", "OFD", "PNG", "JPG", "JPEG", "GIF", "BMP", "JFIF", "SVG", "TIF", "TIFF"]

+ 103 - 0
utils/base64.js

@@ -0,0 +1,103 @@
+function Base64() {
+
+    // private property
+    _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
+
+    // public method for encoding
+    this.encode = function (input) {
+        var output = "";
+        var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
+        var i = 0;
+        input = _utf8_encode(input);
+        while (i < input.length) {
+            chr1 = input.charCodeAt(i++);
+            chr2 = input.charCodeAt(i++);
+            chr3 = input.charCodeAt(i++);
+            enc1 = chr1 >> 2;
+            enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
+            enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
+            enc4 = chr3 & 63;
+            if (isNaN(chr2)) {
+                enc3 = enc4 = 64;
+            } else if (isNaN(chr3)) {
+                enc4 = 64;
+            }
+            output = output +
+                _keyStr.charAt(enc1) + _keyStr.charAt(enc2) +
+                _keyStr.charAt(enc3) + _keyStr.charAt(enc4);
+        }
+        return output;
+    }
+
+    // public method for decoding
+    this.decode = function (input) {
+        var output = "";
+        var chr1, chr2, chr3;
+        var enc1, enc2, enc3, enc4;
+        var i = 0;
+        input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
+        while (i < input.length) {
+            enc1 = _keyStr.indexOf(input.charAt(i++));
+            enc2 = _keyStr.indexOf(input.charAt(i++));
+            enc3 = _keyStr.indexOf(input.charAt(i++));
+            enc4 = _keyStr.indexOf(input.charAt(i++));
+            chr1 = (enc1 << 2) | (enc2 >> 4);
+            chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
+            chr3 = ((enc3 & 3) << 6) | enc4;
+            output = output + String.fromCharCode(chr1);
+            if (enc3 != 64) {
+                output = output + String.fromCharCode(chr2);
+            }
+            if (enc4 != 64) {
+                output = output + String.fromCharCode(chr3);
+            }
+        }
+        output = _utf8_decode(output);
+        return output;
+    }
+
+    // private method for UTF-8 encoding
+    _utf8_encode = function (string) {
+        string = string.replace(/\r\n/g,"\n");
+        var utftext = "";
+        for (var n = 0; n < string.length; n++) {
+            var c = string.charCodeAt(n);
+            if (c < 128) {
+                utftext += String.fromCharCode(c);
+            } else if((c > 127) && (c < 2048)) {
+                utftext += String.fromCharCode((c >> 6) | 192);
+                utftext += String.fromCharCode((c & 63) | 128);
+            } else {
+                utftext += String.fromCharCode((c >> 12) | 224);
+                utftext += String.fromCharCode(((c >> 6) & 63) | 128);
+                utftext += String.fromCharCode((c & 63) | 128);
+            }
+
+        }
+        return utftext;
+    }
+
+    // private method for UTF-8 decoding
+    _utf8_decode = function (utftext) {
+        var string = "";
+        var i = 0;
+        var c = c1 = c2 = 0;
+        while ( i < utftext.length ) {
+            c = utftext.charCodeAt(i);
+            if (c < 128) {
+                string += String.fromCharCode(c);
+                i++;
+            } else if((c > 191) && (c < 224)) {
+                c2 = utftext.charCodeAt(i+1);
+                string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
+                i += 2;
+            } else {
+                c2 = utftext.charCodeAt(i+1);
+                c3 = utftext.charCodeAt(i+2);
+                string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
+                i += 3;
+            }
+        }
+        return string;
+    }
+}

+ 8 - 3
utils/request.js

@@ -1,4 +1,4 @@
-const BASE_URL = 'http://localhost:5173'
+const BASE_URL = 'http://192.168.3.152:8088/glwork'
 
 export function ApiRequest(config = {}){
 	let {
@@ -8,7 +8,9 @@ export function ApiRequest(config = {}){
 		header={} 
 	} = config
 	url = BASE_URL + url
-	header['token'] = uni.getStorageSync('token')
+	if(uni.getStorageSync('GlWorkPlatform-AccessToken')){
+		header['Authorization'] = 'Bearer ' + uni.getStorageSync('GlWorkPlatform-AccessToken')
+	}
 	return new Promise((resolve, reject)=>{
 		uni.request({
 			url: url,
@@ -17,10 +19,13 @@ export function ApiRequest(config = {}){
 			header: header,
 			timeout: 60000,
 			success: (res)=>{
-				resolve(res)
+				resolve(res.data)
 			},
 			fail: (err) => {
 				reject(err)
+			},
+			complete: (event)=>{
+				
 			}
 		})
 	})