Commit c05f2bd7 authored by 何虹's avatar 何虹 💬

优化组件

parent 6a7a2f9e
...@@ -2,20 +2,28 @@ ...@@ -2,20 +2,28 @@
<div> <div>
<hsTable <hsTable
maxHeight='500px' maxHeight='500px'
:elInfo="elInfo"
:allSourceData='allSourceData' :allSourceData='allSourceData'
></hsTable> ></hsTable>
</div> </div>
</template> </template>
<script> <script>
import apiUc from "./apiUc"; import apiUc from "./apiUc";
import request from "../packages/funTools/requestConfigComponent";
export default { export default {
mixins: [apiUc], mixins: [apiUc],
data() { data() {
return { return {
elInfo: {
position: "tt",
el: "hsTable",
page: "A",
sAppCode: "tyCode"
},
allSourceData: { allSourceData: {
config: { config: {
highlightCurrentRow:false, highlightCurrentRow: false,
hover:{hoverBackground:'',leaveBackground:''}, hover: { hoverBackground: "", leaveBackground: "" },
showIndex: false, // 是否显示 序号 showIndex: false, // 是否显示 序号
hsConfig: { hsConfig: {
default_type: 1 // mes风格 default_type: 1 // mes风格
...@@ -110,18 +118,42 @@ export default { ...@@ -110,18 +118,42 @@ export default {
} }
] ]
}, },
sourceData: []//表格数据 sourceData: [] //表格数据
} }
}; };
}, },
mounted() { mounted() {
this.init(); this.init();
this.getTableConfig();
}, },
methods: { methods: {
async getTableConfig() {
// 初始化main上面的工具栏
const data = {
control_name: this.elInfo.position,
sAppCode: this.elInfo.sAppCode,
sPage: this.elInfo.page,
return_type: 1
};
const res = await request.getPageInfo(data);
if (res.length) {
this.allSourceData.config = JSON.parse(res[0].json_config);
}
},
init() { init() {
this.allSourceData.sourceData = [ this.allSourceData.sourceData = [
{ customer_name: 1, style_code: 2, order_size: "0",_styleRowSetting_:{"color":"blue","background":"red"} }, {
{ customer_name: 1, style_code: 2, order_size: "0",_styleRowSetting_:{"color":"blue","background":"blue"} } customer_name: 1,
style_code: 2,
order_size: "0",
_styleRowSetting_: { color: "blue", background: "red" }
},
{
customer_name: 1,
style_code: 2,
order_size: "0",
_styleRowSetting_: { color: "blue", background: "blue" }
}
]; ];
} }
} }
......
...@@ -3,6 +3,9 @@ import App from './App.vue' ...@@ -3,6 +3,9 @@ import App from './App.vue'
import './packages/index' import './packages/index'
import ElementUI from 'element-ui' import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css' import 'element-ui/lib/theme-chalk/index.css'
import 'jsoneditor/dist/jsoneditor.min.css'
import jsoneditor from 'jsoneditor'
Vue.prototype.$jsoneditor = jsoneditor
Vue.config.productionTip = false Vue.config.productionTip = false
Vue.use(ElementUI) Vue.use(ElementUI)
new Vue({ new Vue({
......
...@@ -51,7 +51,7 @@ function parseUrlQueryBIDyncAppcodePageName() { ...@@ -51,7 +51,7 @@ function parseUrlQueryBIDyncAppcodePageName() {
} }
// 解析动态菜单参数和全局参数MenuParams GlobalParams // 解析动态菜单参数和全局参数MenuParams GlobalParams
function parseMenuGlobalParams(str, params) { function parseMenuGlobalParams(str, params) {
const { menuParam, globalParam, otherParam } = params const { menuParam, globalParam, currentRowParam, mainParam, searchParam, indexParam, currentParam } = params
const empyt = [undefined] const empyt = [undefined]
if (typeof str !== 'string' || !str.includes('{') || !str.includes('}')) return str if (typeof str !== 'string' || !str.includes('{') || !str.includes('}')) return str
const reg = /\{(.*?)\}/g // /(?<=\{).*?(?=\})/g const reg = /\{(.*?)\}/g // /(?<=\{).*?(?=\})/g
...@@ -74,11 +74,35 @@ function parseMenuGlobalParams(str, params) { ...@@ -74,11 +74,35 @@ function parseMenuGlobalParams(str, params) {
} else { } else {
pt = globalParam[propStr] pt = globalParam[propStr]
} }
} else { } else if (sourceStr === 'mainParam') {
if (empyt.includes(otherParam[propStr])) { if (empyt.includes(mainParam[propStr])) {
pt = p
} else {
pt = mainParam[propStr]
}
} else if (sourceStr === 'searchParam') {
if (empyt.includes(searchParam[propStr])) {
pt = p
} else {
pt = searchParam[propStr]
}
} else if (sourceStr === 'indexParam') {
if (empyt.includes(indexParam[propStr])) {
pt = p
} else {
pt = indexParam[propStr]
}
} else if (sourceStr === 'currentParam') {
if (empyt.includes(currentParam[propStr])) {
pt = p
} else {
pt = currentParam[propStr]
}
} else if (sourceStr === 'currentRowParam') {
if (empyt.includes(currentParam[propStr])) {
pt = p pt = p
} else { } else {
pt = otherParam[propStr] pt = currentRowParam[propStr]
} }
} }
pt = decodeURIComponent(pt) pt = decodeURIComponent(pt)
...@@ -95,8 +119,9 @@ function recursiveDyncParam(obj, otherOBj = {}) { ...@@ -95,8 +119,9 @@ function recursiveDyncParam(obj, otherOBj = {}) {
const parseUrlQueryParams = parseUrlQueryString() || {} const parseUrlQueryParams = parseUrlQueryString() || {}
const parseGlobalParams_ = parseGlobalParams() || {} const parseGlobalParams_ = parseGlobalParams() || {}
const parms = { const parms = {
menuParam: parseUrlQueryParams, globalParam: parseGlobalParams_, otherParam: otherOBj menuParam: parseUrlQueryParams, globalParam: parseGlobalParams_
} }
Object.assign(parms, otherOBj)
const objType = typeof obj const objType = typeof obj
if (Array.isArray(obj)) { if (Array.isArray(obj)) {
obj.forEach((item, index) => { obj.forEach((item, index) => {
...@@ -270,12 +295,20 @@ function recursiveReplaceAction(obj, activeManager) { ...@@ -270,12 +295,20 @@ function recursiveReplaceAction(obj, activeManager) {
} }
} }
function replaceItemAction(item, activeManager) { function replaceItemAction(item, activeManager) {
const actionProps = ['isHide', 'click', 'disabled', 'changed', 'cleared'] const actionProps = ['isHide', 'click', 'clicked', 'disabled', 'changed', 'cleared']
actionProps.forEach(k => { actionProps.forEach(k => {
const type = typeof item[k] const type = typeof item[k]
if (type === 'string' && !item[k].startsWith('$')) { if (type === 'string' && !item[k].startsWith('$')) {
const funName = '$' + item[k] const funName = '$' + item[k]
item[k] = activeManager[funName] if (!activeManager[funName]) {
alert(`action---${funName},不存在 `)
console.error(`action---${funName},不存在 `)
item[k] = () => {
console.log(`action---${funName},不存在 `)
}
} else {
item[k] = activeManager[funName]
}
} }
}) })
} }
......
...@@ -326,9 +326,9 @@ const API = { ...@@ -326,9 +326,9 @@ const API = {
const control_type = (elInfo && elInfo.el) || '' const control_type = (elInfo && elInfo.el) || ''
const { appCode, page, isMock, dbName: db_Name, db_code } = getPageParms() 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 || db_Name || '' const db_name = dbName || (elInfo && elInfo.db_name) || db_Name || ''
const sPage = sPage_ || (elInfo && elInfo.page) || page || '' const sPage = sPage_ || (elInfo && elInfo.page) || page || ''
const sAppCode = sAppCode_ || appCode const sAppCode = sAppCode_ || (elInfo && elInfo.sAppCode) || appCode
var sIsMock var sIsMock
if (parseInt(is_mock) === 0 || parseInt(is_mock) === 1) { if (parseInt(is_mock) === 0 || parseInt(is_mock) === 1) {
sIsMock = is_mock sIsMock = is_mock
......
This diff is collapsed.
...@@ -104,6 +104,7 @@ ...@@ -104,6 +104,7 @@
:elInfo='item.elInfo' :elInfo='item.elInfo'
:readonly='disabled' :readonly='disabled'
:prop='item.prop' :prop='item.prop'
:uploadFileFun='item.uploadFileFun'
:containerType='type' :containerType='type'
> >
</hsFile> </hsFile>
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -60,26 +60,68 @@ module.exports = { ...@@ -60,26 +60,68 @@ module.exports = {
https: false, https: false,
hotOnly: false, hotOnly: false,
// http 代理配置 // http 代理配置
proxy: { proxy: {
'/api': { '/fileresourceAPI': {
target: 'http://127.0.0.1:3000/api', target: fileresourceAPI,
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {
'^/api': '' '^/fileresourceAPI': ''
} }
}, },
'/fileresourceAPI': { '/GQLAPI': {
target: fileresourceAPI, target: GQLAPI,
changeOrigin: true,
pathRewrite: {
'^/GQLAPI': ''
}
},
'/mainAPI': {
target: mainAPI,
changeOrigin: true,
pathRewrite: {
'^/mainAPI': ''
}
},
'/menuAPI': {
target: menuAPI,
changeOrigin: true,
pathRewrite: {
'^/menuAPI': ''
}
},
'/mockAPI': {
target: mockAPI,
changeOrigin: true,
pathRewrite: {
'^/mockAPI': ''
}
},
'/authAPI': {
target: authAPI,
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {
'^/fileresourceAPI': '' '^/authAPI': ''
}
},
'/toolAPI': {
target: toolAPI,
changeOrigin: true,
pathRewrite: {
'^/toolAPI': ''
} }
}, },
'/commonUtilAPI': { '/commonUtilAPI': {
target: commonUtilAPI, target: commonUtilAPI,
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {
'^/commonUtilAPI': '' '^/commonUtilAPI': ''
}
},
'/ipCommonAPI': {
target: ipCommonAPI,
changeOrigin: true,
pathRewrite: {
'^/ipCommonAPI': ''
} }
} }
}, },
......
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