| | |
| | | required: item.required, |
| | | message: `请è¾å
¥${item.text}!`, |
| | | trigger: "blur" |
| | | },{ |
| | | required: item.required, |
| | | message: `请è¾å
¥${item.text}!`, |
| | | trigger: "submit" |
| | | }]):[] |
| | | }; |
| | | if(!this.isEdit){ |
| | |
| | | |
| | | <script> |
| | | import uiView from "@/views/base/UIContentViewerInDialog" |
| | | import {parseEventByUrl} from "@/actions/base/BaseAction" |
| | | import {parseEventByUrl} from "@/components/actions/base/BaseAction" |
| | | import {getFormDefineById,dataForm} from "@/api/base/ui"; |
| | | import {addSave,editSave} from "@/api/base/actions" |
| | | import {validatenull} from "@/util/validate" |
ÎļþÃû´Ó Source/ProjectWeb/src/actions/base/BaseAction.js ÐÞ¸Ä |
| | |
| | | //éç¨action |
| | | const handlers = { |
| | | //æ¥ç |
| | | view: () => {}, |
| | | view: () => {import("@/components/actions/base/TabViewAction").then(module => { |
| | | module.doAction(options,callback); |
| | | })}, |
| | | //å建 |
| | | add: () => {import("@/actions/base/AddAction").then(module => { |
| | | add: () => {import("@/components/actions/base/AddAction").then(module => { |
| | | module.doAction(options,callback); |
| | | })}, |
| | | //ä¿®æ¹ |
| | | edit: () => {import("@/actions/base/EditAction").then(module => { |
| | | edit: () => {import("@/components/actions/base/EditAction").then(module => { |
| | | module.doAction(options,callback); |
| | | })}, |
| | | //å é¤ |
| | | delete: () => {import("@/actions/base/DeleteAction").then(module => { |
| | | delete: () => {import("@/components/actions/base/DeleteAction").then(module => { |
| | | module.doAction(options,callback); |
| | | })}, //å é¤ |
| | | del: () => {import("@/components/actions/base/DeleteAction").then(module => { |
| | | module.doAction(options,callback); |
| | | })}, |
| | | }; |
ÎļþÃû´Ó Source/ProjectWeb/src/actions/base/DeleteAction.js ÐÞ¸Ä |
| | |
| | | * @param callback åè° |
| | | */ |
| | | export const doBefore = (options,callback)=> { |
| | | Vue.prototype.$message.success('æ§è¡å é¤åç½®äºä»¶'); |
| | | console.log('æ§è¡å é¤åç½®äºä»¶'); |
| | | if(callback){ |
| | | callback(options); |
| | | } |
| | |
| | | * @param callback åè° |
| | | */ |
| | | export const doAfter = (options,callback,actionType)=> { |
| | | Vue.prototype.$message.success('æ§è¡å é¤åç½®äºä»¶'); |
| | | console.log('æ§è¡å é¤åç½®äºä»¶'); |
| | | if(callback){ |
| | | callback(actionType); |
| | | } |
ÎļþÃû´Ó Source/ProjectWeb/src/actions/base/EditAction.js ÐÞ¸Ä |
| | |
| | | * @param callback åè° |
| | | */ |
| | | export const doBefore = (options,callback)=> { |
| | | Vue.prototype.$message.success('æ§è¡ä¿®æ¹åç½®äºä»¶'); |
| | | console.log('æ§è¡ä¿®æ¹åç½®äºä»¶'); |
| | | if(callback){ |
| | | callback(options); |
| | | } |
| | |
| | | * @param callback åè° |
| | | */ |
| | | export const doAfter = (options,callback,actionType)=> { |
| | | Vue.prototype.$message.success('æ§è¡ä¿®æ¹åç½®äºä»¶'); |
| | | console.log('æ§è¡ä¿®æ¹åç½®äºä»¶'); |
| | | if(callback){ |
| | | callback(actionType); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /** |
| | | * æé®å¤ç 页é¢å±ç¤ºä¸ºtabéé¡¹å¡ |
| | | */ |
| | | import {paramLow,callPreEvent,callPostEvent,replaceFreeMarker} from './BaseAction'; |
| | | import {validatenull} from "@/util/validate"; |
| | | import Vue from "vue"; |
| | | import AddEditDialog from "@/components/actions/AddEditDialog"; |
| | | import Layout from "@/router/page"; |
| | | import router from '@/router/router'; |
| | | |
| | | export const doAction = (options,callback) => { |
| | | const paramVOS = Object.assign({ |
| | | getdataurl: '/api/uiDataController/dataFormQuery', |
| | | getdatamethod: 'post', |
| | | url: '/api/uiDataController/editSave', |
| | | method: 'put', |
| | | uploadfileurl: 'vciFileUploadController/uploadFile' |
| | | }, options.paramVOS) |
| | | options.paramVOS = paramVOS; |
| | | |
| | | options.sourceData = options.sourceData || {}; |
| | | options.dataStore = options.dataStore || []; |
| | | if (!options.dataStore || options.dataStore.length < 1) { |
| | | Vue.prototype.$message.error("è¯·éæ©éè¦æµè§çæ°æ®"); |
| | | return false; |
| | | } |
| | | if (!paramVOS.multi && options.dataStore.length > 1) { |
| | | Vue.prototype.$message.error("ä»
è½éæ©ä¸æ¡æ°æ®æ¥æä½"); |
| | | return false; |
| | | } |
| | | |
| | | callPreEvent(options, doBefore, function (options) { |
| | | doView(options, function (type,formData) { |
| | | callPostEvent(options, doAfter,type, callback); |
| | | }); |
| | | }); |
| | | }; |
| | | |
| | | /** |
| | | * æ§è¡ |
| | | * @param options æé®çé
ç½®ä¿¡æ¯ |
| | | * @param callback åè° |
| | | */ |
| | | export const doView = (options,callback)=> { |
| | | const paramVOS = options.paramVOS; |
| | | let component = '@/views/base/UIContentViewerInDialog'; |
| | | if (!validatenull(paramVOS.customurl)) { |
| | | //èªå®ä¹js |
| | | component = `@/views/custom-ui/` + paramVOS.customurl; |
| | | }else{ |
| | | if (!paramVOS['type'] || !paramVOS['context']) { |
| | | Vue.prototype.$message.error("æé®é
ç½®ä¸æ£ç¡®"); |
| | | return false; |
| | | } |
| | | } |
| | | let name="æ¥çæ°æ®" |
| | | if(paramVOS.showname){ |
| | | name=replaceFreeMarker(paramVOS.showname,options.dataStore,options.sourceData) |
| | | } |
| | | router.addRoutes({ |
| | | path: '/view-form'+options.dataStore[0].oid, |
| | | name: name, |
| | | component: Layout, |
| | | meta: { |
| | | keepAlive: true, |
| | | isTab: true |
| | | }, |
| | | children: [ |
| | | { |
| | | path: '', // 空路å¾è¡¨ç¤ºè®¿é® '/dynamic-form' æ¶å è½½ Layout ç»ä»¶ |
| | | component: () => import(component), |
| | | props: true |
| | | } |
| | | ] |
| | | }) |
| | | } |
| | | /** |
| | | * åç½®äºä»¶ |
| | | * @param options æé®çé
ç½®ä¿¡æ¯ |
| | | * @param callback åè° |
| | | */ |
| | | export const doBefore = (options,callback)=> { |
| | | console.log('æ§è¡æ¥çåç½®äºä»¶'); |
| | | if(callback){ |
| | | callback(options); |
| | | } |
| | | } |
| | | /** |
| | | * åç½®äºä»¶ |
| | | * @param options æé®çé
ç½®ä¿¡æ¯ |
| | | * @param callback åè° |
| | | */ |
| | | export const doAfter = (options,callback,actionType)=> { |
| | | console.log('æ§è¡æ¥çåç½®äºä»¶'); |
| | | if(callback){ |
| | | callback(actionType); |
| | | } |
| | | } |
| | |
| | | <!--topå±ç¤ºè¡¨æ ¼ä¸æ¹åºå menuå±ç¤ºè¡¨æ ¼æä½æ åºå æ å°±æ¯é»è®¤ --> |
| | | <el-button v-for="item in basicButtonList.top" |
| | | v-if="LocationType === 'top'" |
| | | :key="item.oid" :icon="item.paramVOS.webUiButtonIcon" |
| | | :type="item.paramVOS.webUiButtonType || 'primary'" plain |
| | | :key="item.oid" :icon="item.paramVOS.icon" |
| | | :type="item.paramVOS.btnType || 'primary'" plain |
| | | size="small" |
| | | @click="buttonClick(item)"> |
| | | {{ item.name }} |
| | | </el-button> |
| | | |
| | | <el-button type="text" @click="handleDefaultAddChildren(scope.row)" v-if="(LocationType === 'menu' && this.default === 'default')">æ°å¢å级</el-button> |
| | | <el-button type="text" @click="handleDefaultAddChildren(scope.row)" v-if="(LocationType === 'menu' && type === 'TreeTable')">æ°å¢å级</el-button> |
| | | <el-button type="text" icon="el-icon-view" size="small" plain @click="$emit('rowView',scope.row,scope.index)" v-if="LocationType === 'menu'">æ¥ç</el-button> |
| | | <el-button v-for="item in basicButtonList.menu" |
| | | v-if="LocationType === 'menu'" |
| | | :key="item.oid" |
| | | :icon="item.paramVOS.webUiButtonIcon ? item.paramVOS.webUiButtonIcon : (item.paramVOS.webUiButtonMethods === 'edit' ? 'el-icon-edit' : (item.paramVOS.webUiButtonMethods === 'delete' ? 'el-icon-delete' : ''))" |
| | | :type="item.paramVOS.webUiButtonType || 'text'" plain |
| | | :icon="item.paramVOS.icon ? item.paramVOS.icon : (item.id === 'edit' ? 'el-icon-edit' : (item.id === 'delete' ||item.id === 'del' ? 'el-icon-delete' : ''))" |
| | | :type="item.paramVOS.btnType || 'text'" plain |
| | | size="small" |
| | | @click="buttonClick(item)"> |
| | | @click="buttonClick(item,scope.row)"> |
| | | {{ item.name }} |
| | | </el-button> |
| | | |
| | |
| | | <div v-else-if="type === 'form'"> |
| | | <el-button v-for="item in basicButtonList" |
| | | :key="item.oid" |
| | | :icon="item.paramVOS.webUiButtonIcon" |
| | | :type="(item.paramVOS.webUiButtonType !== 'text' ? item.paramVOS.webUiButtonType : 'primary') || 'primary'" |
| | | :icon="item.paramVOS.icon" |
| | | :type="item.paramVOS.btnType || 'primary'" |
| | | plain |
| | | size="small" |
| | | @click="buttonClick(item)"> |
| | |
| | | <div v-else-if="type === 'tree'" class="tree-buttons"> |
| | | <el-button v-for="item in basicButtonList" |
| | | :key="item.oid" |
| | | :icon="item.paramVOS.webUiButtonIcon" |
| | | :type="(item.paramVOS.webUiButtonType !== 'text' ? item.paramVOS.webUiButtonType : 'primary') || 'primary'" |
| | | :icon="item.paramVOS.icon" |
| | | :type="item.paramVOS.btnType || 'primary'" |
| | | plain |
| | | size="small" |
| | | @click="buttonClick(item)"> |
| | | {{ item.name }} |
| | | </el-button> |
| | | <el-button type="primary" |
| | | plain |
| | | size="small" |
| | | @click="$emit('refresh')"> |
| | | å·æ° |
| | | </el-button> |
| | | </div> |
| | | </div> |
| | |
| | | <script> |
| | | import func from "@/util/func"; |
| | | import {validatenull} from "@/util/validate"; |
| | | import {doAction} from '@/actions/base/BaseAction'; |
| | | import {doAction} from '@/components/actions/base/BaseAction'; |
| | | import Vue from "vue"; |
| | | |
| | | export default { |
| | |
| | | }, |
| | | butttonList: { |
| | | type: Array |
| | | }, |
| | | default:{ |
| | | type:String, |
| | | }, |
| | | sourceData: { |
| | | //æé®æå±åºåçä¸ä¸åºåé䏿°æ® |
| | |
| | | return basicColumn; |
| | | } else if (this.type === 'table' || this.type === 'TreeTable') { |
| | | const top = basicColumn.filter(item => { |
| | | return item.paramVOS && (item.paramVOS.webUiButtonLocation === 'top' || func.isEmpty(item.paramVOS.webUiButtonLocation)); |
| | | if (item.paramVOS && item.paramVOS.webUiButtonLocation && item.paramVOS.webUiButtonLocation !== 'menu') { |
| | | return true; |
| | | } else if (item.id != "edit" && item.id != "del" && item.id != "delete" && item.id != "refresh") { |
| | | return true; |
| | | } |
| | | return false |
| | | }); |
| | | const menu = basicColumn.filter(item => { |
| | | return item.paramVOS && item.paramVOS.webUiButtonLocation === 'menu'; |
| | | if (item.paramVOS && item.paramVOS.webUiButtonLocation && item.paramVOS.webUiButtonLocation === 'menu') { |
| | | return true |
| | | } else if (item.id == "edit" || item.id == "del" || item.id == "delete"){ |
| | | return true; |
| | | } |
| | | return false; |
| | | }); |
| | | return { |
| | | top: top, |
| | |
| | | this.formName = 'æ°å¢å级' |
| | | this.$refs.dynamicForm.form = row; |
| | | }, |
| | | buttonClick(buttonitem) { |
| | | buttonClick(buttonitem,rowData) { |
| | | const paramVOS = buttonitem.paramVOS; |
| | | const DefineVO = this.componentVO.treeDefineVO || this.componentVO.tableDefineVO || this.componentVO.treeTableDefineVO || this.componentVO.formDefineVO; |
| | | if (!paramVOS['title']) { |
| | |
| | | //paramVOS.customBtn //å¼¹çªé»è®¤æä¿åæé®,customBtn为trueæ¶å
容å±ç¤ºèªå®ä¹æé® |
| | | doAction(buttonitem, { |
| | | paramVOS: paramVOS, |
| | | dataStore: this.dataStore || [], |
| | | dataStore: rowData || this.dataStore || [], |
| | | sourceData: this.sourceData || {} |
| | | }, function (actionType,data) { |
| | | that.$emit("afterMethod",actionType,data); |
| | |
| | | } |
| | | if (Object.keys(this.sourceData).length>0 && this.isShow && this.actionType!="add") { |
| | | this.loading = true; |
| | | dataForm(this.params).then(res => { |
| | | dataForm(this.params, this.paramVOS.getdataurl, this.paramVOS.getdatamethod).then(res => { |
| | | this.form = res.data.obj; |
| | | this.loading = false; |
| | | }).catch(error => { |
| | |
| | | @size-change="sizeChange" |
| | | @row-click="rowClickChange" |
| | | @search-change='searchChange' |
| | | @filter-change="filterChange" |
| | | @filter="filterChange" |
| | | @selection-change="selectChange"> |
| | | <!--topåºåæé®--> |
| | | <template slot="menuLeft" slot-scope="scope"> |
| | |
| | | <dynamic-button :componentVO="componentVO" :butttonList="componentVO.buttons" :scope="scope" :dataStore="selectList" :sourceData="sourceData" |
| | | LocationType="menu" |
| | | @afterMethod="handleRefresh" |
| | | @rowView="rowView" |
| | | type="table"></dynamic-button> |
| | | </template> |
| | | <template slot="menuRight" slot-scope="scope"> |
| | |
| | | filterBtn:false, |
| | | selection: true, |
| | | tip: false, |
| | | menuWidth:260, |
| | | height: '100%', |
| | | calcHeight: 15, |
| | | indexFixed: false, |
| | |
| | | onLoad(page, params = {}) { |
| | | if (Object.keys(this.sourceData).length>0 && this.isShow) { |
| | | this.loading = true; |
| | | getList(page.currentPage, page.pageSize, Object.assign(params,this.params,this.query)).then(res => { |
| | | getList(page.currentPage, page.pageSize, Object.assign({},this.params,this.query,params)).then(res => { |
| | | let data = []; |
| | | if (res.data && res.data.data) { |
| | | data = res.data.data; |
| | |
| | | }); |
| | | } |
| | | }, |
| | | rowView(row,index){ |
| | | this.$refs.dataTable.rowView(row,index) |
| | | }, |
| | | rowClickChange(row){ |
| | | this.$refs.dataTable.toggleRowSelection(row); |
| | | }, |
| | |
| | | this.page.pageSize = pageSize; |
| | | }, |
| | | searchChange(params,done){ |
| | | this.query = params; |
| | | this.query = {}; |
| | | for (let i in params) { |
| | | this.query['conditionMap["' + i + '"]'] = "*" + params[i] + "*"; |
| | | } |
| | | this.page.currentPage = 1; |
| | | this.onLoad(this.page); |
| | | done(); |
| | | }, |
| | | filterChange(result){ |
| | | debugger; |
| | | |
| | | let parms={} |
| | | for (let i in result) { |
| | | if(!validatenull(result[i][2])) { |
| | | const fieldVal = result[i][2] |
| | | if (result[i][1] == "=") { |
| | | parms['conditionMap["' + result[i][0] + '"]'] = fieldVal; |
| | | } else if (result[i][1] == "â ") { |
| | | parms['conditionMap["' + result[i][0] + '"]'] = '!=' + fieldVal; |
| | | } else if (result[i][1] == "like") { |
| | | parms['conditionMap["' + result[i][0] + '"]'] = "*" + fieldVal + "*"; |
| | | } else if (result[i][1] == "â") { |
| | | parms['conditionMap["' + result[i][0] + '"]'] = "*" + fieldVal + "*"; |
| | | } else { |
| | | parms['conditionMap["' + result[i][0] + '"]'] = result[i][1] + fieldVal; |
| | | } |
| | | } |
| | | } |
| | | this.onLoad(this.page,parms); |
| | | }, |
| | | searchReset() { |
| | | this.query = {}; |
| | |
| | | } |
| | | }, |
| | | handleRefresh(type) { |
| | | this.onLoad(this.page, this.query); |
| | | this.onLoad(this.page); |
| | | }, |
| | | rowExcel() { |
| | | //å¯¼åº |
| | |
| | | :key="areasName+'buttons-'+componentVO.oid" |
| | | :butttonList="componentVO.buttons" :dataStore="checkDatas" |
| | | @afterMethod="handleRefresh" |
| | | @refresh="initData" |
| | | :sourceData="sourceData" type="tree" style="margin-bottom: 5px;"></dynamic-button> |
| | | <el-input |
| | | placeholder="è¾å
¥å
³é®åè¿è¡è¿æ»¤" |
| | |
| | | } |
| | | }, |
| | | created() { |
| | | this.getParams(); |
| | | if (!this.lazy) { |
| | | this.initData(); |
| | | } |
| | | }, |
| | | mounted() { |
| | | if(this.componentVO.buttons && this.componentVO.buttons.length>0){ |
| | |
| | | this.params = Object.assign({}, treeParams, sourceDataMapList); |
| | | }, |
| | | initData() { |
| | | this.data=[]; |
| | | if (Object.keys(this.sourceData).length > 0 && this.isShow) { |
| | | getTree(null, null, Object.assign({ |
| | | queryRoot: true |