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

优化组件

parent 6a7a2f9e
......@@ -2,20 +2,28 @@
<div>
<hsTable
maxHeight='500px'
:elInfo="elInfo"
:allSourceData='allSourceData'
></hsTable>
</div>
</template>
<script>
import apiUc from "./apiUc";
import request from "../packages/funTools/requestConfigComponent";
export default {
mixins: [apiUc],
data() {
return {
elInfo: {
position: "tt",
el: "hsTable",
page: "A",
sAppCode: "tyCode"
},
allSourceData: {
config: {
highlightCurrentRow:false,
hover:{hoverBackground:'',leaveBackground:''},
highlightCurrentRow: false,
hover: { hoverBackground: "", leaveBackground: "" },
showIndex: false, // 是否显示 序号
hsConfig: {
default_type: 1 // mes风格
......@@ -110,18 +118,42 @@ export default {
}
]
},
sourceData: []//表格数据
sourceData: [] //表格数据
}
};
},
mounted() {
this.init();
this.getTableConfig();
},
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() {
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'
import './packages/index'
import ElementUI from 'element-ui'
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.use(ElementUI)
new Vue({
......
......@@ -51,7 +51,7 @@ function parseUrlQueryBIDyncAppcodePageName() {
}
// 解析动态菜单参数和全局参数MenuParams GlobalParams
function parseMenuGlobalParams(str, params) {
const { menuParam, globalParam, otherParam } = params
const { menuParam, globalParam, currentRowParam, mainParam, searchParam, indexParam, currentParam } = params
const empyt = [undefined]
if (typeof str !== 'string' || !str.includes('{') || !str.includes('}')) return str
const reg = /\{(.*?)\}/g // /(?<=\{).*?(?=\})/g
......@@ -74,11 +74,35 @@ function parseMenuGlobalParams(str, params) {
} else {
pt = globalParam[propStr]
}
} else if (sourceStr === 'mainParam') {
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 {
if (empyt.includes(otherParam[propStr])) {
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
} else {
pt = otherParam[propStr]
pt = currentRowParam[propStr]
}
}
pt = decodeURIComponent(pt)
......@@ -95,8 +119,9 @@ function recursiveDyncParam(obj, otherOBj = {}) {
const parseUrlQueryParams = parseUrlQueryString() || {}
const parseGlobalParams_ = parseGlobalParams() || {}
const parms = {
menuParam: parseUrlQueryParams, globalParam: parseGlobalParams_, otherParam: otherOBj
menuParam: parseUrlQueryParams, globalParam: parseGlobalParams_
}
Object.assign(parms, otherOBj)
const objType = typeof obj
if (Array.isArray(obj)) {
obj.forEach((item, index) => {
......@@ -270,13 +295,21 @@ function recursiveReplaceAction(obj, activeManager) {
}
}
function replaceItemAction(item, activeManager) {
const actionProps = ['isHide', 'click', 'disabled', 'changed', 'cleared']
const actionProps = ['isHide', 'click', 'clicked', 'disabled', 'changed', 'cleared']
actionProps.forEach(k => {
const type = typeof item[k]
if (type === 'string' && !item[k].startsWith('$')) {
const funName = '$' + item[k]
if (!activeManager[funName]) {
alert(`action---${funName},不存在 `)
console.error(`action---${funName},不存在 `)
item[k] = () => {
console.log(`action---${funName},不存在 `)
}
} else {
item[k] = activeManager[funName]
}
}
})
}
export default {
......
......@@ -326,9 +326,9 @@ const API = {
const control_type = (elInfo && elInfo.el) || ''
const { appCode, page, isMock, dbName: db_Name, db_code } = getPageParms()
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 sAppCode = sAppCode_ || appCode
const sAppCode = sAppCode_ || (elInfo && elInfo.sAppCode) || appCode
var sIsMock
if (parseInt(is_mock) === 0 || parseInt(is_mock) === 1) {
sIsMock = is_mock
......
This diff is collapsed.
......@@ -104,6 +104,7 @@
:elInfo='item.elInfo'
:readonly='disabled'
:prop='item.prop'
:uploadFileFun='item.uploadFileFun'
:containerType='type'
>
</hsFile>
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -61,18 +61,53 @@ module.exports = {
hotOnly: false,
// http 代理配置
proxy: {
'/api': {
target: 'http://127.0.0.1:3000/api',
'/fileresourceAPI': {
target: fileresourceAPI,
changeOrigin: true,
pathRewrite: {
'^/api': ''
'^/fileresourceAPI': ''
}
},
'/fileresourceAPI': {
target: fileresourceAPI,
'/GQLAPI': {
target: GQLAPI,
changeOrigin: true,
pathRewrite: {
'^/fileresourceAPI': ''
'^/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,
pathRewrite: {
'^/authAPI': ''
}
},
'/toolAPI': {
target: toolAPI,
changeOrigin: true,
pathRewrite: {
'^/toolAPI': ''
}
},
'/commonUtilAPI': {
......@@ -81,6 +116,13 @@ module.exports = {
pathRewrite: {
'^/commonUtilAPI': ''
}
},
'/ipCommonAPI': {
target: ipCommonAPI,
changeOrigin: true,
pathRewrite: {
'^/ipCommonAPI': ''
}
}
},
before: (app) => {}
......
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