Commit 06cfbc6f authored by 何虹's avatar 何虹 💬

优化参照

parent 1d2d4145
......@@ -5,7 +5,7 @@ import commonUtility from './commonUtility'
import _ from 'lodash'
import hswebapp2frame from 'hswebapp2frame'
let fullLoading
function showLoading () {
function showLoading() {
fullLoading = Loading.service({
lock: true,
text: '加载中...',
......@@ -16,17 +16,17 @@ function showLoading () {
fullLoading.close()
}, 10000)
}
function closeLoading () {
function closeLoading() {
fullLoading && fullLoading.close()
}
let loading_request_count = 0
function show_full_screen_loading () {
function show_full_screen_loading() {
if (loading_request_count === 0) {
showLoading()
}
loading_request_count++
}
function hide_full_screen_loading () {
function hide_full_screen_loading() {
if (loading_request_count <= 0) return
loading_request_count--
if (loading_request_count === 0) {
......@@ -35,7 +35,7 @@ function hide_full_screen_loading () {
}
// 增加一个response拦截器
axios.interceptors.response.use(
function (response) {
function(response) {
hide_full_screen_loading()
if (response.data) {
const { error_detail, error_title } = response.data
......@@ -58,7 +58,7 @@ axios.interceptors.response.use(
return response
}
},
function (error) {
function(error) {
hide_full_screen_loading()
if (self === top) {
dyncInnerErrorDel(error)
......@@ -68,7 +68,7 @@ axios.interceptors.response.use(
return Promise.reject(error)
}
)
function dyncInnerErrorDel (error) {
function dyncInnerErrorDel(error) {
if (error.message === 'Network Error') {
Notification.error({
title: '错误信息!',
......@@ -104,7 +104,7 @@ function dyncInnerErrorDel (error) {
})
}
}
function response_error_del (error) {
function response_error_del(error) {
const { response, code } = error
const { status, statusText, data } = response || {}
let error_title = '错误信息'
......@@ -134,8 +134,8 @@ function response_error_del (error) {
// 这条判断是解决 下载文件返回流的情况 要把流转成json
const reader = new FileReader()
reader.readAsText(data)
const dealFileReader = async function () {
const result = await new Promise(function (resolve, reject) {
const dealFileReader = async function() {
const result = await new Promise(function(resolve, reject) {
reader.onload = e => {
resolve(JSON.parse(e.target.result))
}
......@@ -198,7 +198,7 @@ const bill_close_bills = `${commonUtilAPI}close_bills/`
const bill_un_close_bills = `${commonUtilAPI}un_close_bills/`
const bill_send_bills = `${commonUtilAPI}send_bills/`
const bill_un_send_bills = `${commonUtilAPI}un_send_bills/`
function getPageParms () {
function getPageParms() {
const { db_name, is_mock, db_code } = commonUtility.parseUrlQueryString()
const { appCode, pagename } = commonUtility.parseUrlQueryBIDyncAppcodePageName()
const isMock = emptyList.includes(is_mock) ? 1 : is_mock
......@@ -213,9 +213,9 @@ function getPageParms () {
return obj
}
const API = {
runAsync (url, routerParms = {}, on_off = false) {
runAsync(url, routerParms = {}, on_off = false) {
let str = ''
var p = new Promise(function (resolve, reject) {
var p = new Promise(function(resolve, reject) {
if (!on_off) {
const { page, isMock, dbName, db_code } = getPageParms()
const sPag = routerParms.page || page
......@@ -265,7 +265,7 @@ const API = {
})
return p
},
getData (data) { // routerParms: page路由 position位置 other参数
getData(data) { // routerParms: page路由 position位置 other参数
const { appCode, page, isMock, dbName: db_Name, db_code } = getPageParms()
const { sAppCode: sAppCode_, sPage: sPage_, sControl: sControl_, isMock: is_mock, dbName, elInfo: elInfo_, other } = data
const db_name = dbName || db_Name || ''
......@@ -274,7 +274,7 @@ const API = {
const sAppCode = sAppCode_ || appCode
const sControl = sControl_ || elInfo.position
const isMock_ = typeof is_mock !== 'undefined' ? is_mock : (isMock || 1)
var p = new Promise(function (resolve, reject) {
var p = new Promise(function(resolve, reject) {
const postData = {
exec_sql: `EXEC dbo.spappCommonQuery_Data @sAppCode='${sAppCode}',@sPage='${sPage}',@sControl='${sControl}',@sParam='${other ? JSON.stringify(other) : '0x'}',@bMockData=${isMock_}`,
db_name: db_name,
......@@ -298,7 +298,7 @@ const API = {
})
return p
},
getConfig (data) {
getConfig(data) {
const { appCode, page, dbName: db_Name, db_code } = getPageParms()
const { sAppCode: sAppCode_, sPage: sPage_, sControl: sControl_, dbName, elInfo: elInfo_, other } = data
const elInfo = elInfo_ || {}
......@@ -307,7 +307,7 @@ const API = {
const sAppCode = sAppCode_ || appCode
const sControl = sControl_ || elInfo.position
const otherParm = other ? JSON.stringify(other) : '0x'
var p = new Promise(function (resolve, reject) {
var p = new Promise(function(resolve, reject) {
const postData = {
exec_sql: `EXEC dbo.spappCommonQuery_Config @sAppCode='${sAppCode}',@sPage='${sPage}',@sControl='${sControl}',@sParam='${otherParm}'`,
db_name: db_name,
......@@ -321,11 +321,11 @@ const API = {
})
return p
},
runSave (data) { // routerParms: page路由 position位置 other参数, sConfig 配置json sData 数据json
runSave(data) { // routerParms: page路由 position位置 other参数, sConfig 配置json sData 数据json
const { sAppCode: sAppCode_, sPage: sPage_, sControl: sControl_, sConfig, sData, sQuerySql, is_mock, dbName, elInfo } = data
const control_type = (elInfo && elInfo.el) || ''
const { appCode, page, isMock, dbName: db_Name, db_code } = getPageParms()
var p = new Promise(function (resolve, reject) {
var p = new Promise(function(resolve, reject) {
const db_name = dbName || (elInfo && elInfo.db_name) || db_Name || ''
const sPage = sPage_ || (elInfo && elInfo.page) || page || ''
const sAppCode = sAppCode_ || (elInfo && elInfo.sAppCode) || appCode
......@@ -366,12 +366,12 @@ const API = {
})
return p
},
getSql (data) {
getSql(data) {
const { sAppCode: sAppCode_, sPage: sPage_, sControl: sControl_, dbName } = data
const { appCode, page, dbName: db_Name, db_code } = getPageParms()
const globalParams = commonUtility.parseGlobalParams()
const user_id = globalParams.user_id || 1
var p = new Promise(function (resolve, reject) {
var p = new Promise(function(resolve, reject) {
const db_name = dbName || db_Name || ''
const sAppCode = sAppCode_ || appCode
const sPage = sPage_ || page || ''
......@@ -387,7 +387,7 @@ const API = {
})
return p
},
download (name, data) {
download(name, data) {
var urlObject = window.URL || window.webkitURL || window
var downloadData = new Blob([data])
var save_link = document.createElementNS('http://www.w3.org/1999/xhtml', 'a')
......@@ -395,7 +395,7 @@ const API = {
save_link.download = name
this.fake_click(save_link)
},
fake_click (obj) {
fake_click(obj) {
var ev = document.createEvent('MouseEvents')
ev.initMouseEvent(
'click', true, false, window, 0, 0, 0, 0, 0
......@@ -403,7 +403,7 @@ const API = {
)
obj.dispatchEvent(ev)
},
downSql (data) {
downSql(data) {
const { sAppCode: sAppCode_, sPage: sPage_, dbName } = data
const { appCode, page, dbName: db_Name, db_code } = getPageParms()
const db_name = dbName || db_Name || ''
......@@ -420,7 +420,7 @@ const API = {
this.download(`spappWebChartConfig_Upgrade_${sAppCode}_${sPage}.sql`, r_d)
})
},
execSql (data) {
execSql(data) {
var postData = {}
const { dbName: db_Name, db_code } = getPageParms()
if (typeof data === 'object') {
......@@ -438,20 +438,20 @@ const API = {
db_code
}
}
var p = new Promise(function (resolve, reject) {
var p = new Promise(function(resolve, reject) {
axios.post(module_url, postData).then(res => {
resolve(res.data)
})
})
return p
},
getPageLog (data) {
getPageLog(data) {
const { sAppCode: sAppCode_, sPage: sPage_, dbName, sControl } = data
const { appCode, page, dbName: db_Name, db_code } = getPageParms()
const db_name = dbName || db_Name || ''
const sAppCode = sAppCode_ || appCode
const sPage = sPage_ || page || ''
var p = new Promise(function (resolve, reject) {
var p = new Promise(function(resolve, reject) {
const postData = {
exec_sql: `EXEC dbo.spappWebChartConfig_QueryLog @sAppCode='${sAppCode}',@sPageName='${sPage}',@sControlName='${sControl}'`,
db_name: db_name,
......@@ -471,7 +471,7 @@ const API = {
})
return p
},
revertPageLog (data) {
revertPageLog(data) {
const { sAppCode: sAppCode_, sPage: sPage_, dbName, sControl, version: version_ } = data
const { appCode, page, dbName: db_Name, db_code } = getPageParms()
const db_name = dbName || db_Name || ''
......@@ -479,7 +479,7 @@ const API = {
const sAppCode = sAppCode_ || appCode
const sPage = sPage_ || page || ''
const version = version_ || ''
var p = new Promise(function (resolve, reject) {
var p = new Promise(function(resolve, reject) {
const postData = {
exec_sql: `EXEC dbo.spappWebChartConfig_Revert @sAppCode='${sAppCode}',@sPageName='${sPage}',@sControlName='${sControl}',@iVersion='${version}'`,
db_name: db_name,
......@@ -491,7 +491,7 @@ const API = {
})
return p
},
getPageInfo (data) {
getPageInfo(data) {
const queryString = commonUtility.parseUrlQueryString()
const { sAppCode: sAppCode_, sPage: sPage_, dbName, control_name, param, return_type, dbCode } = data
const { appCode, page, dbName: db_Name, db_code } = getPageParms()
......@@ -525,7 +525,7 @@ const API = {
if (user_id) {
datas.user_id = user_id
}
var p = new Promise(function (resolve, reject) {
var p = new Promise(function(resolve, reject) {
axios.post(`${module_query_page}`, datas).then(res => {
if (!res) {
resolve([])
......@@ -540,7 +540,7 @@ const API = {
})
return p
},
getGqlData (data, url = module_Gql_query) {
getGqlData(data, url = module_Gql_query) {
const { dbName: db_Name } = getPageParms()
let url_ = url
if (!url_.includes('?')) {
......@@ -555,7 +555,7 @@ const API = {
}
return axios.post(url_, data)
},
saveGqlData (data, url = module_Gql_query_save) {
saveGqlData(data, url = module_Gql_query_save) {
const { dbName: db_Name } = getPageParms()
let url_ = url
if (!url.includes('?')) {
......@@ -571,7 +571,7 @@ const API = {
}
return axios.post(url_, data_)
},
parseUrlParams (queryParms = {}) {
parseUrlParams(queryParms = {}) {
const urlQueryParams = commonUtility.parseUrlQueryString()
let queryParms_str = ''
if (queryParms && typeof queryParms === 'object') {
......@@ -586,7 +586,7 @@ const API = {
return queryParms_str
},
// 通过主键id 来查询值
queryByParimaryKey (parms) {
queryByParimaryKey(parms) {
const { tableName, id, appCode: appCode_, queryParms, group, dyncQueryParms } = parms
const menuParams = getPageParms()
const appCode__ = appCode_ || menuParams.appCode
......@@ -600,7 +600,7 @@ const API = {
return axios.get(url_)
},
// 保存
save (data) {
save(data) {
const { tableName, appCode: appCode_, bodyData, group, parms } = data
const { appCode } = getPageParms()
const queryParms_str = this.parseUrlParams(parms)
......@@ -612,7 +612,7 @@ const API = {
url = url + '?' + queryParms_str
return axios.post(url, bodyData)
},
put (data) {
put(data) {
const { tableName, appCode: appCode_, bodyData, group, parms } = data
const { appCode } = getPageParms()
const queryParms_str = this.parseUrlParams(parms)
......@@ -625,7 +625,7 @@ const API = {
return axios.put(url, bodyData)
},
// 查询列表
queryList (parms) {
queryList(parms) {
const { tableName, appCode: appCode_, queryParms, group, bodyData } = parms
const { appCode } = getPageParms()
const appCode__ = appCode_ || appCode
......@@ -642,7 +642,7 @@ const API = {
}
},
// 批量删除
deleteList (parms) {
deleteList(parms) {
const { tableName, appCode: appCode_, bodyData } = parms
const { appCode } = getPageParms()
const queryParms_str = this.parseUrlParams()
......@@ -652,9 +652,10 @@ const API = {
data: bodyData
})
},
importExcel (formData, data) {
const { table_name, queryParms } = data
importExcel(formData, data) {
const { table_name, queryParms, appCode: appCode_ } = data
const { appCode, dbName } = getPageParms()
const appCode__ = appCode_ || appCode
let strParms = ''
if (queryParms) {
const itemParms_ = _.cloneDeep(queryParms)
......@@ -664,16 +665,17 @@ const API = {
strParms += `&${key}=${itemParms_[key]}`
}
}
const url = `${module_toolAPI}${appCode}/${table_name}/import_excel/?db_name=${dbName}${strParms}`
const url = `${module_toolAPI}${appCode__}/${table_name}/import_excel/?db_name=${dbName}${strParms}`
return axios.post(url, formData)
},
getNewId (number) {
getNewId(number) {
const number_ = number || 100
return axios.get(module_tool + `common/new_id/${number_}/`)
},
importDataIframe (data, parms) {
importDataIframe(data, parms) {
const { dbName, appCode } = getPageParms()
const { table_name, import_name, queryParms } = parms
const { table_name, import_name, queryParms, appCode: appCode_ } = parms
const appCode__ = appCode_ || appCode
let strParms = ''
if (queryParms) {
const itemParms_ = _.cloneDeep(queryParms)
......@@ -683,11 +685,11 @@ const API = {
strParms += `&${key}=${itemParms_[key]}`
}
}
const url_ = `${module_toolAPI}${appCode}/${table_name}/${import_name}/?db_name=${dbName}${strParms}`
const url_ = `${module_toolAPI}${appCode__}/${table_name}/${import_name}/?db_name=${dbName}${strParms}`
return axios.post(url_, data)
},
// 单据流控制
billHandleCommon (obj) {
billHandleCommon(obj) {
const { data, type } = obj
let url = ''
switch (type) {
......@@ -712,7 +714,7 @@ const API = {
}
return axios.post(url, data)
},
queryBillpbWebDyncCode (parms) {
queryBillpbWebDyncCode(parms) {
const { appCode: appCode_, queryParms, tableName } = parms
const { appCode, page } = getPageParms()
const appCode__ = appCode_ || appCode
......@@ -722,20 +724,20 @@ const API = {
return axios.get(url_)
},
// action打印
printTask (data) {
printTask(data) {
const url = `${module_tool}common/print_task/`
return axios.post(url, data)
},
// 默认单据类型打印
TypePrintTask (data) {
TypePrintTask(data) {
const url = `${module_tool}common/print_task_by_bill_type/`
return axios.post(url, data)
},
get (url) {
get(url) {
return axios.get(url)
},
// 上传附件
uploadFile (formData) {
uploadFile(formData) {
const { appCode } = getPageParms()
return axios.post(`fileresourceAPI/file/${appCode}/`, formData)
}
......
......@@ -67,13 +67,13 @@
</el-date-picker>
</template>
<template v-if="item.type==='elSwitch'">
<hsSwitch
<hs-switch
style="width:100%"
size='mini'
:disabled='disabled'
v-model="formParms[item.prop]"
>
</hsSwitch>
</hs-switch>
</template>
<template v-if="item.type==='elCheckbox'">
<el-checkbox
......
......@@ -289,6 +289,8 @@ export default {
const value = writeProp[key]
this.$set(this.writeBackObject, key, data[value])
}
this.initValue(this.value)
console.log(data, 'link out select')
this.dialogIframeVisible = false
},
jumpSelect() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment