guoyujia 4 天之前
父节点
当前提交
f81011b943
共有 4 个文件被更改,包括 56 次插入30 次删除
  1. 6 0
      api/sys/user.js
  2. 44 29
      pages/addNewBatch/index.vue
  3. 3 1
      utils/request.js
  4. 3 0
      utils/upload.js

+ 6 - 0
api/sys/user.js

@@ -14,4 +14,10 @@ export function getURL(data) {
 		method: 'POST',
 		data:data
 	})
+}
+export function getConfigKey(configKey) {
+  return req.request({
+    url: '/system/config/configKey/' + configKey,
+    method: 'get'
+  })
 }

+ 44 - 29
pages/addNewBatch/index.vue

@@ -179,6 +179,9 @@
 		getProcessList
 	} from '@/api/business/deptProcess.js'
 	import path from '@/api/base/path.js'
+	import {
+		getConfigKey
+	} from '@/api/sys/user.js'
 
 	const batchNoCheck = ref(null) // 批次号是否选中
 	const batchNoList = ref([]) // 批次号列表
@@ -194,11 +197,12 @@
 	const emit = defineEmits(['batchReporting-addBatch']);
 	const inpValue = ref('')
 	const loading = ref(false)
-
+	const dataSource = ref(false)
 	const curDept = ref(false) //判断当前工段是否是该批次的领料部门
 	const lotList = ref([])
 	const selectedProcess = ref(null)
 	const processList = ref([])
+	const url = ref("")
 
 	onLoad(() => {
 		// 处理特殊字符JSON解析失败报错
@@ -322,34 +326,43 @@
 			let header = {
 				Authorization: token
 			}
-			uni.request({
-				url: path.furnaceNoURL + '/business/furnaceNoInfo/getFurnaceNoInfo',
-				data: {
-					productionPlanNo: store.planDetails.productionPlanNo,
-					lineNumber: store.planDetails.lineNumber
-				},
-				method: 'GET',
-				header,
-				sslVerify: false,
-				success: (res) => {
-					if (res.data.code == 200 && res.data.data.length > 0) {
-						for (let i = 0; i < res.data.data.length; i++) {
-							furnaceNumberInfoList.value[i] = {
-								text: res.data.data[i].furnaceNumber + '  (' + res.data.data[i]
-									.incomingDate + ')',
-								// text: '2415800347000 (2024-05-06)',
-								value: res.data.data[i]
-							}
-						}
-
-						// basicInfo.value = res.data.data[0];
-						// dayWork.value.furnaceNoInfo = basicInfo.value;
-					}
-				},
-				fail: (err) => {
-					console.log(err)
-				}
-			})
+		//判断拉取数据源
+		 getConfigKey('switch_data_source').then(res => {
+		          dataSource.value = res.msg == 'true'
+				  if(dataSource.value){
+					console.log("切换数据源")
+				  }else{
+					  uni.request({
+					  	url: path.furnaceNoURL + '/business/furnaceNoInfo/getFurnaceNoInfo',
+					  	data: {
+					  		productionPlanNo: store.planDetails.productionPlanNo,
+					  		lineNumber: store.planDetails.lineNumber
+					  	},
+					  	method: 'GET',
+					  	header,
+					  	sslVerify: false,
+					  	success: (res) => {
+					  		if (res.data.code == 200 && res.data.data.length > 0) {
+					  			for (let i = 0; i < res.data.data.length; i++) {
+					  				furnaceNumberInfoList.value[i] = {
+					  					text: res.data.data[i].furnaceNumber + '  (' + res.data.data[i]
+					  						.incomingDate + ')',
+					  					// text: '2415800347000 (2024-05-06)',
+					  					value: res.data.data[i]
+					  				}
+					  			}
+					  
+					  			// basicInfo.value = res.data.data[0];
+					  			// dayWork.value.furnaceNoInfo = basicInfo.value;
+					  		}
+					  	},
+					  	fail: (err) => {
+					  		console.log(err)
+					  	}
+					  })
+				  }
+		        })
+			
 		} else {
 			isWasteRecyclingFlag.value = false
 			furnaceInfo.value.furnaceNumber = "废品回用"
@@ -487,6 +500,8 @@
 				//因为废品回用对工序进行单独的修改。所以重新查产品的工艺,如果该批不是废品回用,则查产品工序,如果是,则到
 				//对应表查
 				//通过批次号查
+				//切换数据源
+				data.tenantId = !store.tenantId ? store.userInfo.tenantId : store.tenantId
 				getProcessListByLot(data).then(response => {
 					let lotProcessList = response.data
 					let filteredData = lotProcessList.filter((item1) =>

+ 3 - 1
utils/request.js

@@ -13,8 +13,10 @@ function behindRequist({
 	method = "GET"
 }) {
 	let token = 'Bearer ' + getToken();
+	let tenantId = store.tenantId?store.tenantId:0
 	let header = {
-		Authorization: token
+		Authorization: token,
+		tenantId:tenantId
 	}
 	return new Promise((resolve, reject) => {
 		const urlList = uni.getStorageSync('baseUrl')

+ 3 - 0
utils/upload.js

@@ -1,4 +1,7 @@
 import { getToken } from '@/utils/auth'
+import {
+	store
+} from '@/store/index.js'
 // import baseURL from '@/api/base/path.js'
 
 function upload({url, data, method="POST"}) {