Browse Source

钉钉顶部适配,全局修改

asd26269546 1 year ago
parent
commit
a149fbe683
34 changed files with 115 additions and 69 deletions
  1. 3 1
      src/main.js
  2. 2 1
      src/router/index.js
  3. 18 0
      src/utils/ddAdapter.js
  4. 1 1
      src/views/JXSK/mes/task/index.vue
  5. 1 1
      src/views/JXSK/salesContract/index.vue
  6. 1 1
      src/views/MES/produce/plan/index.vue
  7. 1 1
      src/views/MES/produce/task/index.vue
  8. 1 1
      src/views/MES/produceManage/completeProject/index.vue
  9. 1 1
      src/views/MES/produceManage/lineSide/index.vue
  10. 1 1
      src/views/MES/produceManage/reportWork/index.vue
  11. 1 1
      src/views/MES/workOrder/index.vue
  12. 2 1
      src/views/commonModule/contractTemplate/index.vue
  13. 1 0
      src/views/commonModule/multiCompanyConfig/index.vue
  14. 1 0
      src/views/email/inbox.vue
  15. 2 0
      src/views/email/write.vue
  16. 1 1
      src/views/home/feedback.vue
  17. 2 19
      src/views/login.vue
  18. 59 28
      src/views/main.vue
  19. 1 1
      src/views/procurementManagement/priceConfig/index.vue
  20. 1 1
      src/views/procurementManagement/procureList/index.vue
  21. 1 1
      src/views/procurementManagement/purchased/index.vue
  22. 1 1
      src/views/procurementManagement/subscribe/index.vue
  23. 1 0
      src/views/procurementManagement/supplierConfig/index.vue
  24. 1 0
      src/views/product-material/material-library/index.vue
  25. 1 0
      src/views/product-material/product-library/index.vue
  26. 1 0
      src/views/production/factory/index.vue
  27. 1 0
      src/views/production/workshop/index.vue
  28. 1 1
      src/views/purchase-sales/inbound-outbound/manualInbound/index.vue
  29. 1 1
      src/views/purchase-sales/inbound-outbound/manualOutbound/index.vue
  30. 1 1
      src/views/purchase-sales/inbound-outbound/transferWarehouse/index.vue
  31. 1 1
      src/views/system/dict/businessDict.vue
  32. 1 1
      src/views/system/dict/tenantDict.vue
  33. 1 0
      src/views/system/user/index.vue
  34. 1 1
      src/views/warehouse/warehouseConfig/index.vue

+ 3 - 1
src/main.js

@@ -11,13 +11,15 @@ import {
 const app = createApp(App)
 app.use(router)
 app.use(i18n).mount('#app')
-
+import { uploadDdRightBtn } from '@/utils/ddAdapter'
 import {
   post,
   get
 } from '@/utils/axios'
+
 app.config.globalProperties.get = get
 app.config.globalProperties.post = post
 app.config.globalProperties.moneyFormat = moneyFormat
 app.config.globalProperties.getDictOne = getDictOne
+app.config.globalProperties.uploadDdRightBtn = uploadDdRightBtn
 export default app

+ 2 - 1
src/router/index.js

@@ -269,7 +269,8 @@ const routes = [{
 			{
 				path: 'manualInbound',
 				name: '手动入库',
-				component: () => import('../views/purchase-sales/inbound-outbound/manualInbound/index.vue')
+				component: () => import('../views/purchase-sales/inbound-outbound/manualInbound/index.vue'),
+				addPath: '/manualInboundAdd'
 			},
 			{
 				path: 'manualInboundAdd',

+ 18 - 0
src/utils/ddAdapter.js

@@ -0,0 +1,18 @@
+
+import * as dd from 'dingtalk-jsapi'
+export function uploadDdRightBtn(onclick,text) {
+    const corpId = window.localStorage.getItem('corpId')
+    if(!corpId) {
+        return
+    }
+    dd.biz.navigation.setRight({
+		show: true, // 控制按钮显示, true 显示, false 隐藏, 默认true
+		control: true, // 是否控制点击事件,true 控制,false 不控制, 默认false
+		text: text || '添加', // 控制显示文本,空字符串表示显示默认文本
+		onSuccess: (result) => {
+            
+			onclick()
+		},
+		onFail: (err) => console.log(err),
+	})
+}

+ 1 - 1
src/views/JXSK/mes/task/index.vue

@@ -86,7 +86,7 @@ const onClickLeft = () => proxy.$router.push("/main/working");
 const onClickRight = () => {
   proxy.$router.push("/main/jxskTaskAdd");
 };
-
+proxy.uploadDdRightBtn(onClickRight,'添加')
 const toDtl = (row) => {
   proxy.$router.push({
     path: "/main/jxskTaskAdd",

+ 1 - 1
src/views/JXSK/salesContract/index.vue

@@ -77,7 +77,7 @@ const onClickRight = () => {
     },
   });
 };
-
+proxy.uploadDdRightBtn(onClickRight,'添加')
 const toDtl = (row) => {
   proxy.$router.push({
     path: "jxskSalesContractAdd",

+ 1 - 1
src/views/MES/produce/plan/index.vue

@@ -81,7 +81,7 @@ const onClickLeft = () => proxy.$router.push("/main/working");
 const onClickRight = () => {
   proxy.$router.push("/main/planAdd");
 };
-
+proxy.uploadDdRightBtn(onClickRight,'添加')
 const toDtl = (row) => {
   proxy.$router.push({
     path: "planDtl",

+ 1 - 1
src/views/MES/produce/task/index.vue

@@ -85,7 +85,7 @@ const onClickLeft = () => proxy.$router.push("/main/working");
 const onClickRight = () => {
   proxy.$router.push("/main/taskAdd");
 };
-
+proxy.uploadDdRightBtn(onClickRight,'添加')
 // const toDtl = (row) => {
 //   proxy.$router.push({
 //     path: "taskDtl",

+ 1 - 1
src/views/MES/produceManage/completeProject/index.vue

@@ -78,7 +78,7 @@ const onClickLeft = () => proxy.$router.push("/main/working");
 const onClickRight = () => {
   proxy.$router.push("/main/completeProjectAdd");
 };
-
+proxy.uploadDdRightBtn(onClickRight,'添加')
 const toDtl = (row) => {
   proxy.$router.push({
     path: "completeProjectAdd",

+ 1 - 1
src/views/MES/produceManage/lineSide/index.vue

@@ -77,7 +77,7 @@ const onClickLeft = () => proxy.$router.push("/main/working");
 const onClickRight = () => {
   proxy.$router.push("/main/lineSideAdd");
 };
-
+proxy.uploadDdRightBtn(onClickRight,'添加')
 const toDtl = (row) => {
   proxy.$router.push({
     path: "lineSideEdit",

+ 1 - 1
src/views/MES/produceManage/reportWork/index.vue

@@ -74,7 +74,7 @@ const onClickLeft = () => proxy.$router.push("/main/working");
 const onClickRight = () => {
   proxy.$router.push("/main/reportWorkAdd");
 };
-
+proxy.uploadDdRightBtn(onClickRight,'报工')
 const toDtl = (row) => {
   proxy.$router.push({
     path: "reportWorkAdd",

+ 1 - 1
src/views/MES/workOrder/index.vue

@@ -85,7 +85,7 @@ const onClickLeft = () => proxy.$router.push("/main/working");
 const onClickRight = () => {
   proxy.$router.push("/main/workOrderAdd");
 };
-
+proxy.uploadDdRightBtn(onClickRight,'添加')
 const toDtl = (row) => {
   proxy.$router.push({
     path: "workOrderDtl",

+ 2 - 1
src/views/commonModule/contractTemplate/index.vue

@@ -15,7 +15,6 @@
 import { ref, getCurrentInstance } from "vue";
 import commonList from "@/components/common-list.vue";
 import { useRoute } from "vue-router";
-
 const loading = ref(false);
 const router = useRoute();
 const req = ref({
@@ -50,6 +49,7 @@ const onLoad = () => {
   getClassification();
 };
 const onClickLeft = () => proxy.$router.push("/main/working");
+
 const onClickRight = () => {
   proxy.$router.push({
     path: "contractTemplateAdd",
@@ -58,6 +58,7 @@ const onClickRight = () => {
     },
   });
 };
+proxy.uploadDdRightBtn(onClickRight,'添加')
 const toDtl = (row) => {
   proxy.$router.push({
     path: "contractTemplateAdd",

+ 1 - 0
src/views/commonModule/multiCompanyConfig/index.vue

@@ -58,6 +58,7 @@ const onClickRight = () => {
     },
   });
 };
+proxy.uploadDdRightBtn(onClickRight,'添加')
 const toDtl = (row) => {
   proxy.$router.push({
     path: "multiCompanyConfigAdd",

+ 1 - 0
src/views/email/inbox.vue

@@ -108,6 +108,7 @@ const onClickRight = () => {
 		query: {},
 	}) 
 }
+proxy.uploadDdRightBtn(onClickRight,'添加')
 
 const toDtl = (row) => {
 	proxy.$router.push({

+ 2 - 0
src/views/email/write.vue

@@ -218,6 +218,8 @@ const onClickRight = () => {
 		})
 }
 
+proxy.uploadDdRightBtn(onClickRight,'发送')
+
 onMounted(() => {
 	console.log(router)
 })

+ 1 - 1
src/views/home/feedback.vue

@@ -91,7 +91,7 @@ const onClickLeft = () => proxy.$router.push('/main/working')
 const onClickRight = () => {
 	proxy.$router.push('/main/feedbackSubmit')
 }
-
+proxy.uploadDdRightBtn(onClickRight,'反馈')
 const toDtl = (row) => {
 	console.log(row)
 	proxy.$router.push({

+ 2 - 19
src/views/login.vue

@@ -206,6 +206,7 @@ const ddLoginInit = () => {
 		proxy.$router.push('/main')
 	}
 	dd.ready(function () {
+		
 		dd.runtime.permission.requestAuthCode({
 			corpId: route.query.id, // 企业id
 			onSuccess: function (info) {
@@ -215,6 +216,7 @@ const ddLoginInit = () => {
 					.post('/open/dingApi/getUserToken', { code: code.value,corpId:route.query.id })
 					.then((res) => {
 						window.localStorage.setItem('corpId',route.query.id)
+						dd.ui.webViewBounce.disable();
 						setToken(res.data)
 						getInfo()
 					})
@@ -226,23 +228,4 @@ const ddLoginInit = () => {
 	})
 }
 ddLoginInit()
-
-const a = {
-	EventType: 'SYNC_HTTP_PUSH_HIGH',
-	bizData: [
-		{
-			gmt_create: 1683253790000,
-			biz_type: 2,
-			open_cursor: 0,
-			subscribe_id: '30319001_0',
-			id: 19780,
-			gmt_modified: 1683253790000,
-			biz_id: '30319001',
-			biz_data:
-				'{"eventId":"443aea2dc1f740d4bb8b4f629a8141b7","syncAction":"suite_ticket","suiteTicket":"Kn3hJvJR34e8rUEob0W7nqxK2YHqobAyPsuIQXYR35SsJMp6rE5XQBz9nwXTrJRZaVmXc4z9KjYkzXdkUdS8O3","syncSeq":"8506A9FE673B908159397DC8"}',
-			corp_id: 'ding53d823e205604918a39a90f97fcb1e09',
-			status: 0,
-		},
-	],
-}
 </script>

+ 59 - 28
src/views/main.vue

@@ -2,54 +2,85 @@
 	<div class="main">
 		<div class="footer">
 			<van-tabbar v-model="tabType">
-				<van-tabbar-item icon="home-o" to="/main/message">消息</van-tabbar-item>
-				<van-tabbar-item icon="search" to="/main/working">工作台</van-tabbar-item>
+				<van-tabbar-item icon="home-o" to="/main/message"
+					>消息</van-tabbar-item
+				>
+				<van-tabbar-item icon="search" to="/main/working"
+					>工作台</van-tabbar-item
+				>
 				<van-tabbar-item
 					icon="friends-o"
-					:to="tenantId == 'xmhjc' ? '/main/xiamenList' : '/main/equipment'"
-				>物联网</van-tabbar-item>
-				<van-tabbar-item
-					icon="setting-o"
-					to="/main/home"
-				>我的</van-tabbar-item>
+					:to="
+						tenantId == 'xmhjc'
+							? '/main/xiamenList'
+							: '/main/equipment'
+					"
+					>物联网</van-tabbar-item
+				>
+				<van-tabbar-item icon="setting-o" to="/main/home"
+					>我的</van-tabbar-item
+				>
 			</van-tabbar>
 		</div>
 	</div>
-    <router-view/>
+	<router-view />
 </template>
 <script setup>
-import { ref, getCurrentInstance } from 'vue'
-import { getUserInfo } from '@/utils/auth';
-import {lang} from '@/lang/cn'
+import { ref, getCurrentInstance, watch } from 'vue'
+import { getUserInfo } from '@/utils/auth'
+import { useRouter } from 'vue-router'
+import { lang } from '@/lang/cn'
+import * as dd from 'dingtalk-jsapi'
 import '@/assets/icon/iconfont.css'
-import 'vant/lib/index.css';
+import 'vant/lib/index.css'
 import axios from 'axios'
+import { uploadDdRightBtn } from '@/utils/ddAdapter'
 const tenantId = getUserInfo().tenantId
 const proxy = getCurrentInstance().proxy
 const tabType = ref('home')
+
 //判断是否为开发环境.如果是开发环境,则同步前后台中文配置表
 const isDev = process.env.NODE_ENV === 'development'
-if(isDev) {
-	
+if (isDev) {
 	let networkLang = window.localStorage.getItem('lang')
-	if(networkLang || networkLang != JSON.stringify(lang)){
+	if (networkLang || networkLang != JSON.stringify(lang)) {
 		try {
 			networkLang = JSON.parse(networkLang)
 			networkLang.app.cn = lang
-			proxy.post('/open/multilingual/setJson',{configValue:JSON.stringify(networkLang)}).then(res=>{
-				console.log(res)
-			})
-		} catch (error) {
-			
-		}
+			proxy
+				.post('/open/multilingual/setJson', {
+					configValue: JSON.stringify(networkLang),
+				})
+				.then((res) => {})
+		} catch (error) {}
 	}
-	
-
 }
-
+const corpId = window.localStorage.getItem('corpId')
+//监听路由变化
+const router = useRouter()
+watch(router.currentRoute, (to, from) => {
+	console.log(dd.biz,123123138713827)
+	dd.biz.navigation.setTitle({
+		title : router.currentRoute.value.name,
+		onSuccess : function(result) {
+		},
+		onFail : function(err) {}
+	});
+	
+	//获取元素的绑定事件
+	setTimeout(() => {
+		if(!corpId) {
+			return
+		}
+		let el = document.getElementsByClassName('van-nav-bar__content')[0]
+		if(el) {
+			//删除el元素
+			el.parentNode.removeChild(el)
+		}
+	}, 100)
+})
 </script>
 <style lang="scss">
-	.footer{
-		
-	}
+.footer {
+}
 </style>

+ 1 - 1
src/views/procurementManagement/priceConfig/index.vue

@@ -81,7 +81,7 @@
       },
     });
   };
-  
+  proxy.uploadDdRightBtn(onClickRight,'添加')
   const toDtl = (row) => {
     proxy.$router.push({
       path: "priceConfigEdit",

+ 1 - 1
src/views/procurementManagement/procureList/index.vue

@@ -94,7 +94,7 @@ const onClickRight = () => {
 		},
 	})
 }
-
+proxy.uploadDdRightBtn(onClickRight,'采购')
 const toDtl = (row) => {
 	proxy.$router.push({
 		path: 'procureListAdd',

+ 1 - 1
src/views/procurementManagement/purchased/index.vue

@@ -78,7 +78,7 @@ const onClickLeft = () => proxy.$router.push("/main/working");
 const onClickRight = () => {
   proxy.$router.push("/main/purchasedAdd");
 };
-
+proxy.uploadDdRightBtn(onClickRight,'新增采购')
 const toDtl = (row) => {
   proxy.$router.push({
     path: "purchasedAdd",

+ 1 - 1
src/views/procurementManagement/subscribe/index.vue

@@ -74,7 +74,7 @@ const onClickLeft = () => proxy.$router.push("/main/working");
 const onClickRight = () => {
   proxy.$router.push("/main/subscribeAdd");
 };
-
+proxy.uploadDdRightBtn(onClickRight,'发起申购')
 const toDtl = (row) => {
   proxy.$router.push({
     path: "subscribeAdd",

+ 1 - 0
src/views/procurementManagement/supplierConfig/index.vue

@@ -58,6 +58,7 @@
       },
     });
   };
+  proxy.uploadDdRightBtn(onClickRight,'添加')
   const toDtl = (row) => {
     proxy.$router.push({
       path: "supplierConfigAdd",

+ 1 - 0
src/views/product-material/material-library/index.vue

@@ -58,6 +58,7 @@ const onClickRight = () => {
     },
   });
 };
+proxy.uploadDdRightBtn(onClickRight,'添加')
 const toDtl = (row) => {
   proxy.$router.push({
     path: "materialLibraryAdd",

+ 1 - 0
src/views/product-material/product-library/index.vue

@@ -58,6 +58,7 @@ const onClickRight = () => {
     },
   });
 };
+proxy.uploadDdRightBtn(onClickRight,'添加')
 const toDtl = (row) => {
   proxy.$router.push({
     path: "productLibraryAdd",

+ 1 - 0
src/views/production/factory/index.vue

@@ -92,6 +92,7 @@ const onClickRight = () => {
 		},
 	})
 }
+proxy.uploadDdRightBtn(onClickRight,'添加')
 const toDtl = (row) => {
 	proxy.$router.push({
 		path: 'factoryAdd',

+ 1 - 0
src/views/production/workshop/index.vue

@@ -93,6 +93,7 @@ const onClickRight = () => {
 		},
 	})
 }
+proxy.uploadDdRightBtn(onClickRight,'添加')
 const toDtl = (row) => {
 	proxy.$router.push({
 		path: 'workshopAdd',

+ 1 - 1
src/views/purchase-sales/inbound-outbound/manualInbound/index.vue

@@ -74,7 +74,7 @@ const onClickLeft = () => proxy.$router.push("/main/working");
 const onClickRight = () => {
   proxy.$router.push("/main/manualInboundAdd");
 };
-
+proxy.uploadDdRightBtn(onClickRight,'添加')
 const toDtl = (row) => {
   proxy.$router.push({
     path: "manualInboundAdd",

+ 1 - 1
src/views/purchase-sales/inbound-outbound/manualOutbound/index.vue

@@ -74,7 +74,7 @@ const onClickLeft = () => proxy.$router.push("/main/working");
 const onClickRight = () => {
   proxy.$router.push("/main/manualOutboundAdd");
 };
-
+proxy.uploadDdRightBtn(onClickRight,'添加')
 const toDtl = (row) => {
   console.log(row);
   proxy.$router.push({

+ 1 - 1
src/views/purchase-sales/inbound-outbound/transferWarehouse/index.vue

@@ -74,7 +74,7 @@ const onClickLeft = () => proxy.$router.push("/main/working");
 const onClickRight = () => {
   proxy.$router.push("/main/sendTransferWarehouse");
 };
-
+proxy.uploadDdRightBtn(onClickRight,'添加')
 const toDtl = (row) => {
   console.log(row);
   proxy.$router.push({

+ 1 - 1
src/views/system/dict/businessDict.vue

@@ -71,7 +71,7 @@ const onClickLeft = () => proxy.$router.push('/main/working')
 const onClickRight = () => {
 	proxy.$router.push('/main/businessAdd')
 }
-
+proxy.uploadDdRightBtn(onClickRight,'添加')
 const toDtl = (row) => {
 	console.log(row)
 	proxy.$router.push({

+ 1 - 1
src/views/system/dict/tenantDict.vue

@@ -82,7 +82,7 @@ const onClickRight = () => {
         },
 	})
 }
-
+proxy.uploadDdRightBtn(onClickRight,'添加')
 const toDtl = (row) => {
 	console.log(row)
 	proxy.$router.push({

+ 1 - 0
src/views/system/user/index.vue

@@ -93,6 +93,7 @@ const onClickRight = () => {
 		},
 	})
 }
+proxy.uploadDdRightBtn(onClickRight,'添加')
 const toDtl = (row) => {
 	proxy.$router.push({
 		path: 'userAdd',

+ 1 - 1
src/views/warehouse/warehouseConfig/index.vue

@@ -66,7 +66,7 @@ const onClickLeft = () => proxy.$router.push('/main/working')
 const onClickRight = () => {
 	proxy.$router.push('/main/warehouseConfigAdd')
 }
-
+proxy.uploadDdRightBtn(onClickRight,'添加')
 const toDtl = (row) => {
 	console.log(row)
 	proxy.$router.push({