¤NameÀ¤User¤Name«kuailedexin¤Icon¤GuidÙ$c31ddba0-7e1f-4b4f-b27a-1f3ac1232ffc¢Id §ServiceÀ«TimeCreated×ÿNÜ hÑ}¢IdÙ$fb3e59de-cb8b-42eb-8e39-7d5831f8b63a¢IdÙ4Microsoft.VisualStudio.Conversations.Chat.HelpWindow¨Metadata¨IsThreadðConversationMode°ExperimentalChatªResponders¤Name®GitHub Copilot¤Icon¤GuidÙ$ae27a6b0-e345-4288-96df-5eaf394ee369¢IdÍͧService¤NameÙ7Microsoft.VisualStudio.Copilot.CopilotChatAgentProvider§Version£0.3 CorrelationIdÙ$a5fb63e9-34a5-442a-820c-7c5aeba4f45f©MessageIdÙ$0468d97b-894c-4f45-8f32-b208b3f61339§Context®ValueContainerÙMicrosoft.VisualStudio.Copilot.DocumentContext, Microsoft.VisualStudio.Copilot, Version=17.14.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3aÅCöÒ
§ContentÚCqimport App from './App'
|
|
// #ifndef VUE3
|
import Vue from 'vue'
|
import './uni.promisify.adaptor'
|
import globalMixin from "@/common/globalMixin.js"
|
|
import store from './store'
|
|
//éªè¯ç¨æ·ï¼æ²¡æç»å½çè¯ç´æ¥å°ç¨æ·è¸¢åå°ç»å½çé¢
|
// Vue.mixin(globalMixin)
|
|
Vue.config.productionTip = false
|
|
|
Vue.prototype.$store = store
|
|
Vue.prototype.$company = "å¹¿æ·±ç§æ"; //å
¬å¸å
|
Vue.prototype.$esp = "/b/esp"; //åå¨è¿ç¨è·¯å¾
|
Vue.prototype.$api = "/api"; //APIæ¥å£ï¼ç¨äºä¸å¡è¯·æ±çapi
|
|
|
/**
|
* * ç¨æ·ä¿¡æ¯
|
*/
|
Vue.prototype.$loginInfo = {
|
appName: "GSMESAP", //appåç§°
|
sysNumber: 'GSMESAP', //MESç³»ç»ä¸ç»´æ¤çAPPç³»ç»ç¼å·
|
forcedLogin: true, //æ¯å¦éè¦å¼ºå¶ç»å½
|
hasLogin: false, //æ¯å¦å·²ç»ç»å½
|
account: uni.getStorageSync('account') || '', //ç¨æ·id
|
userName: uni.getStorageSync('userName') || '', //ç¨æ·åç§°
|
deptNo: uni.getStorageSync('deptNo') || '', //é¨é¨å·
|
chineseName: uni.getStorageSync('chineseName') || '', //䏿å
|
id: uni.getStorageSync('id') || '' //ç¨æ·id
|
}
|
|
/**
|
* * ç»å½
|
*/
|
Vue.prototype.$login = function () {
|
this.$loginInfo.hasLogin = true;
|
//åå
¥é
ç½®æä»¶
|
try {
|
uni.setStorageSync('account', this.$loginInfo.account);
|
uni.setStorageSync('userName', this.$loginInfo.userName);
|
uni.setStorageSync('deptNo', this.$loginInfo.deptNo);
|
uni.getStorageSync('chineseName', this.$loginInfo.chineseName); //䏿å
|
uni.getStorageSync('id', this.$loginInfo.id); //ç¨æ·id
|
} catch (e) {
|
|
}
|
}
|
|
/**
|
* * 设置ç¨åºæ é¢
|
*/
|
Vue.prototype.$setTitle = function (option) {
|
if (option.title) {
|
this.navTitle = option.title;
|
uni.setNavigationBarTitle({
|
title: this.navTitle
|
});
|
}
|
}
|
|
/**
|
* * messageBox
|
*/
|
Vue.prototype.$showMessage = function (msg, interval) {
|
if (!msg) {
|
console.log('å¼¹æ¡ä¿¡æ¯ä½ç©ºï¼ä¸è¿è¡å®é
å¼¹æ¡æä½')
|
return;
|
}
|
if (!interval) {
|
interval = 3000; //ä¸ç§
|
}
|
uni.showToast({
|
icon: 'none',
|
title: msg,
|
duration: interval,
|
});
|
}
|
/**
|
* * dialog
|
*/
|
Vue.prototype.$showDialog = function (pars) {
|
uni.showModal({
|
title: pars.title || "æç¤º",
|
content: pars.content || "ç¡®è®¤è¦æä½?",
|
success: (conf) => {
|
if (conf.confirm) {
|
if (pars.success) pars.success();
|
} else {
|
if (pars.fail) pars.fail();
|
}
|
}
|
});
|
}
|
Vue.prototype.$showMessage_async = async function (msg, interval) {
|
this.$showMessage(msg, interval, interval);
|
}
|
/**
|
* * ç»åº
|
*/
|
Vue.prototype.$logout = function () {
|
this.$loginInfo.userName = "";
|
this.$loginInfo.hasLogin = false;
|
}
|
/**
|
* * è·åç¨åºèå
|
*/
|
Vue.prototype.$getUserMenu = function (data) { //å¾å°ç¨æ·çèå
|
let _this = this;
|
uni.request({
|
url: _this.$store.state.serverInfo.serverAPI + '/login/getUserMenu',
|
method: "POST",
|
header: {
|
'content-type': "application/json"
|
},
|
data: {
|
name: _this.$loginInfo.account //ç¨æ·ç¼å·
|
},
|
success: (res) => {
|
// console.log("è·åèå");
|
// console.log(res);
|
if (res.data.status == 0) {
|
if (data.success)
|
data.success(res.data.data.tbBillList);
|
} else {
|
if (data.fail) {
|
data.fail(res.data);
|
} else {
|
_this.$showMessage(res.data.message);
|
}
|
}
|
},
|
fail(err) {
|
_this.$showMessage("æå¡å¨æå¼");
|
},
|
complete: () => {
|
if (data.complete) {
|
data.complete();
|
}
|
}
|
})
|
}
|
|
//è·åurlä¸çåæ°ï¼ç¨äºé¡µé¢è·³è½¬åå¤ç主页é¢åå页é¢ä¼ å
|
//ä¾å¦å½url为http://localhost:8080/#/pages/QC/ListDemo/detail?id=5031279æ¶
|
//è·åå°çå°±æ¯params{ "id":"5031279" }
|
//ç¶åéè¿ params["id"]å°±å¯ä»¥è·åå°idçå¼
|
//å
è®¸æ¼æ¥å¤ä¸ªåæ°
|
//http://localhost:8080/#/pages/QC/ListDemo/detail?id=5031279&daa001=HSC02-2308190001-1
|
//è·åå°çå°±æ¯ params{ "id":"5031279","daa001":"HSC02-2308190001-1" }
|
Vue.prototype.$getUrlParams = function (url) {
|
let params = {};
|
url.replace(/[?&]+([^=&]+)=([^&]*)/gi, function (_, key, value) {
|
params[key] = value;
|
});
|
return params;
|
}
|
|
Vue.prototype.$getDate = function (format) {
|
const date = new Date();
|
|
const year = date.getFullYear();
|
const month = String(date.getMonth() + 1).padStart(2, '0');
|
const day = String(date.getDate()).padStart(2, '0');
|
const hours = String(date.getHours()).padStart(2, '0');
|
const minutes = String(date.getMinutes()).padStart(2, '0');
|
const seconds = String(date.getSeconds()).padStart(2, '0');
|
|
if (format === 'yyyy-mm-dd hh24:mi:ss') {
|
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
} else if (format === 'yyyy-mm-dd') {
|
return `${year}-${month}-${day}`;
|
} else {
|
return 'Invalid format';
|
}
|
}
|
|
Vue.prototype.$get = function (params) {
|
params.method = "get";
|
params.showLoading = params.showLoading ?? true
|
return this.$uni_request(params);
|
}
|
|
Vue.prototype.$post = function (params) {
|
params.method = "post";
|
params.showLoading = params.showLoading ?? true
|
return this.$uni_request(params);
|
}
|
|
Vue.prototype.$postSyncPost = function (url, data) {
|
return new Promise((resolve, reject) => {
|
uni.request({
|
url: this.$store.state.serverInfo.serverAPI + url,
|
method: 'POST',
|
data: data,
|
header: {
|
'content-type': 'application/json'
|
},
|
success: (res) => {
|
resolve(res.data);
|
},
|
fail: (err) => {
|
reject(err);
|
}
|
});
|
});
|
}
|
|
Vue.prototype.$sendPostRequest = function (params) {
|
params.method = "post";
|
params.showLoading = params.showLoading ?? true
|
return this.$toERP(params);
|
}
|
|
//弿¥æ¹æ³
|
Vue.prototype.$toERP = function (params) {
|
|
if (params.showLoading) {
|
uni.showLoading({
|
mask: true,
|
title: (params.showLoadingTitle ? params.showLoadingTitle : "å è½½ä¸...")
|
});
|
}
|
|
let url = params.url;
|
let method = params.method || "post";
|
let data = params.data || {};
|
|
let header = {
|
'Content-Type': params.contentType
|
}
|
|
let _this = this;
|
|
return new Promise((resolve, reject) => {
|
|
uni.request({
|
url: url,
|
method: method,
|
header: header,
|
data: data,
|
success(response) {
|
const res = response
|
// æ ¹æ®è¿åçç¶æç ååºå¯¹åºçæä½
|
// è·åæå
|
console.log(res);
|
if (res.statusCode == 200) {
|
resolve(res.data);
|
} else {
|
uni.clearStorageSync()
|
switch (res.statusCode) {
|
case 404:
|
uni.showToast({
|
title: '请æ±å°åä¸åå¨...',
|
duration: 2000,
|
})
|
break;
|
default:
|
uni.showToast({
|
title: '请éè¯...',
|
duration: 2000,
|
})
|
break;
|
}
|
}
|
},
|
fail(err) {
|
console.log(err)
|
if (err.errMsg.indexOf('request:fail') !== -1) {
|
uni.showToast({
|
title: 'ç½ç»å¼å¸¸',
|
icon: "error",
|
duration: 2000
|
})
|
} else {
|
uni.showToast({
|
title: 'æªç¥å¼å¸¸',
|
duration: 2000
|
})
|
}
|
reject(err);
|
},
|
complete() {
|
// ä¸ç®¡æåè¿æ¯å¤±è´¥é½ä¼æ§è¡
|
uni.hideLoading();
|
}
|
});
|
});
|
}
|
|
|
//弿¥æ¹æ³
|
Vue.prototype.$uni_request = function (params) {
|
|
if (params.showLoading) {
|
uni.showLoading({
|
mask: true,
|
title: (params.showLoadingTitle ? params.showLoadingTitle : "å è½½ä¸...")
|
});
|
}
|
|
let url = params.url;
|
let method = params.method || "post";
|
let data = params.data || {};
|
|
let header = {}
|
if (method == "post") {
|
header = {
|
'Content-Type': 'application/json'
|
};
|
}
|
|
let _this = this;
|
|
return new Promise((resolve, reject) => {
|
|
uni.request({
|
url: _this.$store.state.serverInfo.serverAPI + url,
|
method: method,
|
header: header,
|
data: data,
|
success(response) {
|
const res = response
|
// æ ¹æ®è¿åçç¶æç ååºå¯¹åºçæä½
|
// è·åæå
|
console.log(res);
|
if (res.statusCode == 200) {
|
if (res.data.status == 0) {
|
// uni.showToast({
|
// title: 'æä½æå',
|
// //å°å¼è®¾ç½®ä¸º success æè
ç´æ¥ä¸ç¨åiconè¿ä¸ªåæ°
|
// icon: 'success',
|
// //æ¾ç¤ºæç»æ¶é´ä¸º 2ç§
|
// duration: 1000
|
// })
|
resolve(res.data);
|
} else {
|
uni.showToast({
|
icon: "none",
|
title: res.data.message,
|
duration: 5000,
|
});
|
resolve(res.data);
|
}
|
} else {
|
uni.clearStorageSync()
|
switch (res.statusCode) {
|
case 404:
|
uni.showToast({
|
title: '请æ±å°åä¸åå¨...',
|
duration: 2000,
|
})
|
break;
|
default:
|
uni.showToast({
|
title: '请éè¯...',
|
duration: 2000,
|
})
|
break;
|
}
|
}
|
},
|
fail(err) {
|
console.log(err)
|
if (err.errMsg.indexOf('request:fail') !== -1) {
|
uni.showToast({
|
title: 'ç½ç»å¼å¸¸',
|
icon: "error",
|
duration: 2000
|
})
|
} else {
|
uni.showToast({
|
title: 'æªç¥å¼å¸¸',
|
duration: 2000
|
})
|
}
|
reject(err);
|
},
|
complete() {
|
// ä¸ç®¡æåè¿æ¯å¤±è´¥é½ä¼æ§è¡
|
uni.hideLoading();
|
}
|
});
|
});
|
}
|
|
|
Vue.prototype.$uni_requestNew = function (params) {
|
|
if (params.showLoading) {
|
uni.showLoading({
|
mask: true,
|
title: (params.showLoadingTitle ? params.showLoadingTitle : "å è½½ä¸...")
|
});
|
}
|
|
let url = params.url;
|
let method = params.method || "post";
|
let data = params.data || {};
|
|
let header = {}
|
if (method == "post") {
|
header = {
|
'Content-Type': 'application/json'
|
};
|
}
|
|
let _this = this;
|
|
return new Promise((resolve, reject) => {
|
|
uni.request({
|
url: url,
|
method: method,
|
header: header,
|
data: data,
|
success(response) {
|
const res = response
|
// æ ¹æ®è¿åçç¶æç ååºå¯¹åºçæä½
|
// è·åæå
|
console.log(res);
|
if (res.statusCode == 200) {
|
resolve(res);
|
} else {
|
uni.clearStorageSync()
|
switch (res.statusCode) {
|
case 404:
|
uni.showToast({
|
title: '请æ±å°åä¸åå¨...',
|
duration: 2000,
|
})
|
break;
|
default:
|
uni.showToast({
|
title: '请éè¯...',
|
duration: 2000,
|
})
|
break;
|
}
|
}
|
},
|
fail(err) {
|
console.log(err)
|
if (err.errMsg.indexOf('request:fail') !== -1) {
|
uni.showToast({
|
title: 'ç½ç»å¼å¸¸',
|
icon: "error",
|
duration: 2000
|
})
|
} else {
|
uni.showToast({
|
title: 'æªç¥å¼å¸¸',
|
duration: 2000
|
})
|
}
|
reject(err);
|
},
|
complete() {
|
// ä¸ç®¡æåè¿æ¯å¤±è´¥é½ä¼æ§è¡
|
uni.hideLoading();
|
}
|
});
|
});
|
}
|
|
|
/**
|
* * ç¸åéæ©æè
ç
§ç¸æºæç
§
|
*/
|
Vue.prototype.$camera = function (params) {
|
var cusMsg = {
|
data: '',
|
message: '',
|
status: 0
|
}
|
uni.chooseImage({
|
sizeType: params.sizeType ? params.sizeType : "original", //original åå¾ï¼compressed åç¼©å¾ ,é»è®¤ä¸ºåå¾
|
sourceType: params.sourceType ? params.sourceType : ['camera'],
|
success: (chooseImageRes) => {
|
console.log(chooseImageRes);
|
var tempFilePaths = chooseImageRes.tempFilePaths;
|
if (!params.data) params.data = {};
|
params.data.files = tempFilePaths;
|
if (params.isUpload) {
|
this.$upload(params);
|
} else {
|
cusMsg.status = true;
|
cusMsg.message = "OK";
|
cusMsg.data = tempFilePaths;
|
if (params.success) params.success(cusMsg);
|
}
|
},
|
fail: (err) => {
|
cusMsg.status = false;
|
cusMsg.message = "è°ç¨å¤±è´¥";
|
cusMsg.data = [];
|
if (params.fail) params.fail(cusMsg);
|
},
|
complete: () => {
|
if (params.complete) params.complete();
|
}
|
});
|
}
|
|
Vue.prototype.$fileUpload = function (data) {
|
console.log(data)
|
return new Promise((resolve, reject) => {
|
uni.getFileSystemManager().readFile({
|
filePath: data, // è¦è¯»åçæä»¶è·¯å¾
|
encoding: 'base64', // ç¼ç æ ¼å¼
|
success: function (res) {
|
const imageData = {
|
ImageData: 'data:image/png;base64,' + res.data,
|
qsType: data.qsType,
|
fid: data.fid
|
};
|
// è°ç¨ä½ èªå·±çä¸ä¼ å¾çæ¥å£
|
uni.request({
|
url: _this.$store.state.serverInfo.serverAPI + "/Base/saveImage", // ä½ çä¸ä¼ å¾çæ¥å£å°å
|
method: 'POST',
|
data: imageData,
|
success: function (uploadRes) {
|
console.log(uploadRes, 'ä¸ä¼ å¾ç');
|
if (uploadRes.statusCode == 200) {
|
let group = uploadRes.data;
|
uni.showToast({
|
title: "ä¸ä¼ æå",
|
icon: "success"
|
});
|
resolve(group); // è¿åå¤çåæ°æ®
|
}
|
},
|
fail: function (error) {
|
reject(error);
|
}
|
});
|
}
|
});
|
});
|
}
|
|
|
App.mpType = 'app'
|
const app = new Vue({
|
store,
|
...App
|
})
|
app.$mount()
|
// #endif
|
|
// #ifdef VUE3
|
import {
|
createSSRApp
|
} from 'vue'
|
import {
|
func
|
} from 'prop-types'
|
|
export function createApp() {
|
const app = createSSRApp(App)
|
return {
|
app
|
}
|
}
|
|
// #endif¯OriginalContentÀªSelections¨FilePathÙ7F:\å
¬å¸é¡¹ç®è½¯ä»¶\GIT\01齿轮设计\å端\main.js¨LanguageªJavaScript¯CopilotTypeName¯DocumentContext¨TypeName¤Name¯DocumentContext§IsArray¢IdÙ$c61039ac-a356-4580-b93b-37dcfe343a71¯ProviderMoniker¤NameÙ6Microsoft.VisualStudio.Copilot.DocumentContextProvider§Version£0.3¦SourceÙ6Microsoft.VisualStudio.Copilot.DocumentContextProvider©Relevance¦Member¤file©CanReduceéRequestIdÙ$a5fb63e9-34a5-442a-820c-7c5aeba4f45f©ReferenceÀ¦Traits«IsEphemeral§Content
¢IdÄ1lCµP·ÜªVisibility«Annotations§Content¯å¯å¨é¡¹ç»è°¨Mentions¨Metadata¬EventMessageÀ¦IntentÀ¨GuidanceÀ¥Model¦Family§gpt-4.1§ModelId§gpt-4.1¬Capabilities §Purpose²DirectedResponders¤NameÙ7Microsoft.VisualStudio.Copilot.CopilotChatAgentProvider§Version£0.3©FunctionsCorrelationIdÙ$a5fb63e9-34a5-442a-820c-7c5aeba4f45f©MessageIdÙ$2588b807-dfd5-47be-99a1-86a2d3375344§Context®ValueContainerÙMicrosoft.VisualStudio.Copilot.DocumentContext, Microsoft.VisualStudio.Copilot, Version=17.14.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3aÅCöÒ
§ContentÚCqimport App from './App'
|
|
// #ifndef VUE3
|
import Vue from 'vue'
|
import './uni.promisify.adaptor'
|
import globalMixin from "@/common/globalMixin.js"
|
|
import store from './store'
|
|
//éªè¯ç¨æ·ï¼æ²¡æç»å½çè¯ç´æ¥å°ç¨æ·è¸¢åå°ç»å½çé¢
|
// Vue.mixin(globalMixin)
|
|
Vue.config.productionTip = false
|
|
|
Vue.prototype.$store = store
|
|
Vue.prototype.$company = "å¹¿æ·±ç§æ"; //å
¬å¸å
|
Vue.prototype.$esp = "/b/esp"; //åå¨è¿ç¨è·¯å¾
|
Vue.prototype.$api = "/api"; //APIæ¥å£ï¼ç¨äºä¸å¡è¯·æ±çapi
|
|
|
/**
|
* * ç¨æ·ä¿¡æ¯
|
*/
|
Vue.prototype.$loginInfo = {
|
appName: "GSMESAP", //appåç§°
|
sysNumber: 'GSMESAP', //MESç³»ç»ä¸ç»´æ¤çAPPç³»ç»ç¼å·
|
forcedLogin: true, //æ¯å¦éè¦å¼ºå¶ç»å½
|
hasLogin: false, //æ¯å¦å·²ç»ç»å½
|
account: uni.getStorageSync('account') || '', //ç¨æ·id
|
userName: uni.getStorageSync('userName') || '', //ç¨æ·åç§°
|
deptNo: uni.getStorageSync('deptNo') || '', //é¨é¨å·
|
chineseName: uni.getStorageSync('chineseName') || '', //䏿å
|
id: uni.getStorageSync('id') || '' //ç¨æ·id
|
}
|
|
/**
|
* * ç»å½
|
*/
|
Vue.prototype.$login = function () {
|
this.$loginInfo.hasLogin = true;
|
//åå
¥é
ç½®æä»¶
|
try {
|
uni.setStorageSync('account', this.$loginInfo.account);
|
uni.setStorageSync('userName', this.$loginInfo.userName);
|
uni.setStorageSync('deptNo', this.$loginInfo.deptNo);
|
uni.getStorageSync('chineseName', this.$loginInfo.chineseName); //䏿å
|
uni.getStorageSync('id', this.$loginInfo.id); //ç¨æ·id
|
} catch (e) {
|
|
}
|
}
|
|
/**
|
* * 设置ç¨åºæ é¢
|
*/
|
Vue.prototype.$setTitle = function (option) {
|
if (option.title) {
|
this.navTitle = option.title;
|
uni.setNavigationBarTitle({
|
title: this.navTitle
|
});
|
}
|
}
|
|
/**
|
* * messageBox
|
*/
|
Vue.prototype.$showMessage = function (msg, interval) {
|
if (!msg) {
|
console.log('å¼¹æ¡ä¿¡æ¯ä½ç©ºï¼ä¸è¿è¡å®é
å¼¹æ¡æä½')
|
return;
|
}
|
if (!interval) {
|
interval = 3000; //ä¸ç§
|
}
|
uni.showToast({
|
icon: 'none',
|
title: msg,
|
duration: interval,
|
});
|
}
|
/**
|
* * dialog
|
*/
|
Vue.prototype.$showDialog = function (pars) {
|
uni.showModal({
|
title: pars.title || "æç¤º",
|
content: pars.content || "ç¡®è®¤è¦æä½?",
|
success: (conf) => {
|
if (conf.confirm) {
|
if (pars.success) pars.success();
|
} else {
|
if (pars.fail) pars.fail();
|
}
|
}
|
});
|
}
|
Vue.prototype.$showMessage_async = async function (msg, interval) {
|
this.$showMessage(msg, interval, interval);
|
}
|
/**
|
* * ç»åº
|
*/
|
Vue.prototype.$logout = function () {
|
this.$loginInfo.userName = "";
|
this.$loginInfo.hasLogin = false;
|
}
|
/**
|
* * è·åç¨åºèå
|
*/
|
Vue.prototype.$getUserMenu = function (data) { //å¾å°ç¨æ·çèå
|
let _this = this;
|
uni.request({
|
url: _this.$store.state.serverInfo.serverAPI + '/login/getUserMenu',
|
method: "POST",
|
header: {
|
'content-type': "application/json"
|
},
|
data: {
|
name: _this.$loginInfo.account //ç¨æ·ç¼å·
|
},
|
success: (res) => {
|
// console.log("è·åèå");
|
// console.log(res);
|
if (res.data.status == 0) {
|
if (data.success)
|
data.success(res.data.data.tbBillList);
|
} else {
|
if (data.fail) {
|
data.fail(res.data);
|
} else {
|
_this.$showMessage(res.data.message);
|
}
|
}
|
},
|
fail(err) {
|
_this.$showMessage("æå¡å¨æå¼");
|
},
|
complete: () => {
|
if (data.complete) {
|
data.complete();
|
}
|
}
|
})
|
}
|
|
//è·åurlä¸çåæ°ï¼ç¨äºé¡µé¢è·³è½¬åå¤ç主页é¢åå页é¢ä¼ å
|
//ä¾å¦å½url为http://localhost:8080/#/pages/QC/ListDemo/detail?id=5031279æ¶
|
//è·åå°çå°±æ¯params{ "id":"5031279" }
|
//ç¶åéè¿ params["id"]å°±å¯ä»¥è·åå°idçå¼
|
//å
è®¸æ¼æ¥å¤ä¸ªåæ°
|
//http://localhost:8080/#/pages/QC/ListDemo/detail?id=5031279&daa001=HSC02-2308190001-1
|
//è·åå°çå°±æ¯ params{ "id":"5031279","daa001":"HSC02-2308190001-1" }
|
Vue.prototype.$getUrlParams = function (url) {
|
let params = {};
|
url.replace(/[?&]+([^=&]+)=([^&]*)/gi, function (_, key, value) {
|
params[key] = value;
|
});
|
return params;
|
}
|
|
Vue.prototype.$getDate = function (format) {
|
const date = new Date();
|
|
const year = date.getFullYear();
|
const month = String(date.getMonth() + 1).padStart(2, '0');
|
const day = String(date.getDate()).padStart(2, '0');
|
const hours = String(date.getHours()).padStart(2, '0');
|
const minutes = String(date.getMinutes()).padStart(2, '0');
|
const seconds = String(date.getSeconds()).padStart(2, '0');
|
|
if (format === 'yyyy-mm-dd hh24:mi:ss') {
|
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
} else if (format === 'yyyy-mm-dd') {
|
return `${year}-${month}-${day}`;
|
} else {
|
return 'Invalid format';
|
}
|
}
|
|
Vue.prototype.$get = function (params) {
|
params.method = "get";
|
params.showLoading = params.showLoading ?? true
|
return this.$uni_request(params);
|
}
|
|
Vue.prototype.$post = function (params) {
|
params.method = "post";
|
params.showLoading = params.showLoading ?? true
|
return this.$uni_request(params);
|
}
|
|
Vue.prototype.$postSyncPost = function (url, data) {
|
return new Promise((resolve, reject) => {
|
uni.request({
|
url: this.$store.state.serverInfo.serverAPI + url,
|
method: 'POST',
|
data: data,
|
header: {
|
'content-type': 'application/json'
|
},
|
success: (res) => {
|
resolve(res.data);
|
},
|
fail: (err) => {
|
reject(err);
|
}
|
});
|
});
|
}
|
|
Vue.prototype.$sendPostRequest = function (params) {
|
params.method = "post";
|
params.showLoading = params.showLoading ?? true
|
return this.$toERP(params);
|
}
|
|
//弿¥æ¹æ³
|
Vue.prototype.$toERP = function (params) {
|
|
if (params.showLoading) {
|
uni.showLoading({
|
mask: true,
|
title: (params.showLoadingTitle ? params.showLoadingTitle : "å è½½ä¸...")
|
});
|
}
|
|
let url = params.url;
|
let method = params.method || "post";
|
let data = params.data || {};
|
|
let header = {
|
'Content-Type': params.contentType
|
}
|
|
let _this = this;
|
|
return new Promise((resolve, reject) => {
|
|
uni.request({
|
url: url,
|
method: method,
|
header: header,
|
data: data,
|
success(response) {
|
const res = response
|
// æ ¹æ®è¿åçç¶æç ååºå¯¹åºçæä½
|
// è·åæå
|
console.log(res);
|
if (res.statusCode == 200) {
|
resolve(res.data);
|
} else {
|
uni.clearStorageSync()
|
switch (res.statusCode) {
|
case 404:
|
uni.showToast({
|
title: '请æ±å°åä¸åå¨...',
|
duration: 2000,
|
})
|
break;
|
default:
|
uni.showToast({
|
title: '请éè¯...',
|
duration: 2000,
|
})
|
break;
|
}
|
}
|
},
|
fail(err) {
|
console.log(err)
|
if (err.errMsg.indexOf('request:fail') !== -1) {
|
uni.showToast({
|
title: 'ç½ç»å¼å¸¸',
|
icon: "error",
|
duration: 2000
|
})
|
} else {
|
uni.showToast({
|
title: 'æªç¥å¼å¸¸',
|
duration: 2000
|
})
|
}
|
reject(err);
|
},
|
complete() {
|
// ä¸ç®¡æåè¿æ¯å¤±è´¥é½ä¼æ§è¡
|
uni.hideLoading();
|
}
|
});
|
});
|
}
|
|
|
//弿¥æ¹æ³
|
Vue.prototype.$uni_request = function (params) {
|
|
if (params.showLoading) {
|
uni.showLoading({
|
mask: true,
|
title: (params.showLoadingTitle ? params.showLoadingTitle : "å è½½ä¸...")
|
});
|
}
|
|
let url = params.url;
|
let method = params.method || "post";
|
let data = params.data || {};
|
|
let header = {}
|
if (method == "post") {
|
header = {
|
'Content-Type': 'application/json'
|
};
|
}
|
|
let _this = this;
|
|
return new Promise((resolve, reject) => {
|
|
uni.request({
|
url: _this.$store.state.serverInfo.serverAPI + url,
|
method: method,
|
header: header,
|
data: data,
|
success(response) {
|
const res = response
|
// æ ¹æ®è¿åçç¶æç ååºå¯¹åºçæä½
|
// è·åæå
|
console.log(res);
|
if (res.statusCode == 200) {
|
if (res.data.status == 0) {
|
// uni.showToast({
|
// title: 'æä½æå',
|
// //å°å¼è®¾ç½®ä¸º success æè
ç´æ¥ä¸ç¨åiconè¿ä¸ªåæ°
|
// icon: 'success',
|
// //æ¾ç¤ºæç»æ¶é´ä¸º 2ç§
|
// duration: 1000
|
// })
|
resolve(res.data);
|
} else {
|
uni.showToast({
|
icon: "none",
|
title: res.data.message,
|
duration: 5000,
|
});
|
resolve(res.data);
|
}
|
} else {
|
uni.clearStorageSync()
|
switch (res.statusCode) {
|
case 404:
|
uni.showToast({
|
title: '请æ±å°åä¸åå¨...',
|
duration: 2000,
|
})
|
break;
|
default:
|
uni.showToast({
|
title: '请éè¯...',
|
duration: 2000,
|
})
|
break;
|
}
|
}
|
},
|
fail(err) {
|
console.log(err)
|
if (err.errMsg.indexOf('request:fail') !== -1) {
|
uni.showToast({
|
title: 'ç½ç»å¼å¸¸',
|
icon: "error",
|
duration: 2000
|
})
|
} else {
|
uni.showToast({
|
title: 'æªç¥å¼å¸¸',
|
duration: 2000
|
})
|
}
|
reject(err);
|
},
|
complete() {
|
// ä¸ç®¡æåè¿æ¯å¤±è´¥é½ä¼æ§è¡
|
uni.hideLoading();
|
}
|
});
|
});
|
}
|
|
|
Vue.prototype.$uni_requestNew = function (params) {
|
|
if (params.showLoading) {
|
uni.showLoading({
|
mask: true,
|
title: (params.showLoadingTitle ? params.showLoadingTitle : "å è½½ä¸...")
|
});
|
}
|
|
let url = params.url;
|
let method = params.method || "post";
|
let data = params.data || {};
|
|
let header = {}
|
if (method == "post") {
|
header = {
|
'Content-Type': 'application/json'
|
};
|
}
|
|
let _this = this;
|
|
return new Promise((resolve, reject) => {
|
|
uni.request({
|
url: url,
|
method: method,
|
header: header,
|
data: data,
|
success(response) {
|
const res = response
|
// æ ¹æ®è¿åçç¶æç ååºå¯¹åºçæä½
|
// è·åæå
|
console.log(res);
|
if (res.statusCode == 200) {
|
resolve(res);
|
} else {
|
uni.clearStorageSync()
|
switch (res.statusCode) {
|
case 404:
|
uni.showToast({
|
title: '请æ±å°åä¸åå¨...',
|
duration: 2000,
|
})
|
break;
|
default:
|
uni.showToast({
|
title: '请éè¯...',
|
duration: 2000,
|
})
|
break;
|
}
|
}
|
},
|
fail(err) {
|
console.log(err)
|
if (err.errMsg.indexOf('request:fail') !== -1) {
|
uni.showToast({
|
title: 'ç½ç»å¼å¸¸',
|
icon: "error",
|
duration: 2000
|
})
|
} else {
|
uni.showToast({
|
title: 'æªç¥å¼å¸¸',
|
duration: 2000
|
})
|
}
|
reject(err);
|
},
|
complete() {
|
// ä¸ç®¡æåè¿æ¯å¤±è´¥é½ä¼æ§è¡
|
uni.hideLoading();
|
}
|
});
|
});
|
}
|
|
|
/**
|
* * ç¸åéæ©æè
ç
§ç¸æºæç
§
|
*/
|
Vue.prototype.$camera = function (params) {
|
var cusMsg = {
|
data: '',
|
message: '',
|
status: 0
|
}
|
uni.chooseImage({
|
sizeType: params.sizeType ? params.sizeType : "original", //original åå¾ï¼compressed åç¼©å¾ ,é»è®¤ä¸ºåå¾
|
sourceType: params.sourceType ? params.sourceType : ['camera'],
|
success: (chooseImageRes) => {
|
console.log(chooseImageRes);
|
var tempFilePaths = chooseImageRes.tempFilePaths;
|
if (!params.data) params.data = {};
|
params.data.files = tempFilePaths;
|
if (params.isUpload) {
|
this.$upload(params);
|
} else {
|
cusMsg.status = true;
|
cusMsg.message = "OK";
|
cusMsg.data = tempFilePaths;
|
if (params.success) params.success(cusMsg);
|
}
|
},
|
fail: (err) => {
|
cusMsg.status = false;
|
cusMsg.message = "è°ç¨å¤±è´¥";
|
cusMsg.data = [];
|
if (params.fail) params.fail(cusMsg);
|
},
|
complete: () => {
|
if (params.complete) params.complete();
|
}
|
});
|
}
|
|
Vue.prototype.$fileUpload = function (data) {
|
console.log(data)
|
return new Promise((resolve, reject) => {
|
uni.getFileSystemManager().readFile({
|
filePath: data, // è¦è¯»åçæä»¶è·¯å¾
|
encoding: 'base64', // ç¼ç æ ¼å¼
|
success: function (res) {
|
const imageData = {
|
ImageData: 'data:image/png;base64,' + res.data,
|
qsType: data.qsType,
|
fid: data.fid
|
};
|
// è°ç¨ä½ èªå·±çä¸ä¼ å¾çæ¥å£
|
uni.request({
|
url: _this.$store.state.serverInfo.serverAPI + "/Base/saveImage", // ä½ çä¸ä¼ å¾çæ¥å£å°å
|
method: 'POST',
|
data: imageData,
|
success: function (uploadRes) {
|
console.log(uploadRes, 'ä¸ä¼ å¾ç');
|
if (uploadRes.statusCode == 200) {
|
let group = uploadRes.data;
|
uni.showToast({
|
title: "ä¸ä¼ æå",
|
icon: "success"
|
});
|
resolve(group); // è¿åå¤çåæ°æ®
|
}
|
},
|
fail: function (error) {
|
reject(error);
|
}
|
});
|
}
|
});
|
});
|
}
|
|
|
App.mpType = 'app'
|
const app = new Vue({
|
store,
|
...App
|
})
|
app.$mount()
|
// #endif
|
|
// #ifdef VUE3
|
import {
|
createSSRApp
|
} from 'vue'
|
import {
|
func
|
} from 'prop-types'
|
|
export function createApp() {
|
const app = createSSRApp(App)
|
return {
|
app
|
}
|
}
|
|
// #endif¯OriginalContentÀªSelections¨FilePathÙ7F:\å
¬å¸é¡¹ç®è½¯ä»¶\GIT\01齿轮设计\å端\main.js¨LanguageªJavaScript¯CopilotTypeName¯DocumentContext¨TypeName¤Name¯DocumentContext§IsArray¢IdÙ$c61039ac-a356-4580-b93b-37dcfe343a71¯ProviderMoniker¤NameÙ6Microsoft.VisualStudio.Copilot.DocumentContextProvider§Version£0.3¦SourceÙ6Microsoft.VisualStudio.Copilot.DocumentContextProvider©Relevance¦Member¤file©CanReduceéRequestIdÙ$a5fb63e9-34a5-442a-820c-7c5aeba4f45f©ReferenceÀ¦Traits«IsEphemeral®ValueContainerÙ£Microsoft.VisualStudio.Copilot.Core.IDEContext.IdeContext, Microsoft.VisualStudio.Copilot.Core, Version=17.14.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3aİIsDebuggerPaused«CurrentFileÙ7F:\å
¬å¸é¡¹ç®è½¯ä»¶\GIT\01齿轮设计\å端\main.js©OpenFilesÙ7F:\å
¬å¸é¡¹ç®è½¯ä»¶\GIT\01齿轮设计\å端\main.js¯CopilotTypeNameªIdeContext¨TypeName¤NameªIdeContext§IsArray¢IdÙ$07241d38-50a8-4e97-afa6-5e40c0d24e4d¯ProviderMoniker¤NameÙ)Microsoft.VisualStudio.Copilot.IdeContext§Version£0.3¦SourceÙ)Microsoft.VisualStudio.Copilot.IdeContext©Relevance¦Member¨idestate©CanReduce©RequestIdÙ$a5fb63e9-34a5-442a-820c-7c5aeba4f45f©ReferenceÀ¦Traits«IsEphemeralçContent
¢IdÄ´ ÇnÆCtG°52t=hSªVisibility«Annotations§ContentÙcå¨ä½ ç `main.js` æä»¶ä¸ï¼å¯å¨é¡¹ï¼å³åºç¨çå
¥å£ï¼æ¯éè¿ä»¥ä¸ä»£ç å®ç°çï¼
|
¨Mentions¢IdÄyó¾+ÎE¢P÷) תVisibility«Annotations§ContentÙNApp.mpType = 'app'
|
const app = new Vue({
|
store,
|
...App
|
})
|
app.$mount()¨LanguageªJavaScriptºLanguageMarkdownIdentifierªjavascript¬IsRefinement¤File§main.js§OptionsÀ¨Commands
¢IdÄÖrÈÇK¾lO¸s¿ªVisibility«Annotations§ContentÚb
|
è¿éï¼`App` æ¯ä½ ç主ç»ä»¶ï¼éå¸¸æ¯ `App.vue`ï¼ï¼å®è¢«ä½ä¸ºå¯å¨é¡¹ä¼ éç» `Vue` å®ä¾ãæç»éè¿ `app.$mount()` æè½½åºç¨ã
|
|
**ç»è®ºï¼**
|
å¯å¨é¡¹ç»äº `App`ï¼å³ä½ ç主åºç¨ç»ä»¶ãææé¡µé¢åé»è¾é½ä» `App` ç»ä»¶å¼å§å è½½åæ¸²æã
|
|
å¦éæ´æ¹å¯å¨é¡¹ï¼åªéä¿®æ¹ `App` çå¼ç¨æå
容å³å¯ã¨Mentions¨Metadata¬EventMessageÀ©SessionIdÙ$fb3e59de-cb8b-42eb-8e39-7d5831f8b63a¢IdÙ4Microsoft.VisualStudio.Conversations.Chat.HelpWindow¦Author¤Name®GitHub Copilot¤Icon¤GuidÙ$ae27a6b0-e345-4288-96df-5eaf394ee369¢IdÍͧService¤NameÙ7Microsoft.VisualStudio.Copilot.CopilotChatAgentProvider§Version£0.3¦Status¦Quotas¤Type©Timestamp×ÿWàhÑ©ResetTimeÖÿhÜo ¥UsageÀ¥LimitÀ®OverageAllowed¤Type©Timestamp×ÿWàhÑ©ResetTimeÖÿhÜo ¥UsageÀ¥LimitÀ®OverageAllowed¤Type©Timestamp×ÿWàhÑ©ResetTimeÖÿhÜo ¥UsageË ¥LimitË@rÀ ®OverageAllowedéFollowUps§MessageÙ,å¦ä½å¨ `main.js` 䏿·»å å
¨å±æ··å
¥ï¼¯SendImmediately¨CanRetryÃ
|