| | |
| | | </template> |
| | | <!--topåºåæé®--> |
| | | <template slot="menuLeft" slot-scope="scope"> |
| | | <dynamic-button :butttonList="componentVO.buttons" :selectList="selectList" LocationType="top" |
| | | type="table"></dynamic-button> |
| | | <dynamic-button :butttonList="componentVO.buttons" :selectList="TreeSelectList" LocationType="top" |
| | | type="TreeTable"></dynamic-button> |
| | | </template> |
| | | |
| | | <!--menuåºåæé®--> |
| | | <template slot="menu" slot-scope="scope"> |
| | | <dynamic-button :butttonList="componentVO.buttons" :scope="scope" :selectList="selectList" LocationType="menu" |
| | | type="table"></dynamic-button> |
| | | <dynamic-button :butttonList="componentVO.buttons" :scope="scope" :selectList="TreeSelectList" LocationType="menu" default="default" |
| | | type="TreeTable"></dynamic-button> |
| | | </template> |
| | | </avue-crud> |
| | | </div> |
| | |
| | | comment: 'æ ' |
| | | }, |
| | | ], |
| | | TreeSelectList: [] |
| | | TreeSelectList: [], |
| | | // è¡¨åæ°æ® |
| | | formList: [ |
| | | { |
| | | comboxKey: null, |
| | | customClass: null, |
| | | data: null, |
| | | dateFormate: null, |
| | | defaultValue: "", |
| | | displayExtension: "", |
| | | extendAttrMap: null, |
| | | extendAttrString: null, |
| | | field: "name", |
| | | hidden: false, |
| | | keyAttr: true, |
| | | prefix: null, |
| | | readOnly: false, |
| | | referConfig: null, |
| | | required: true, |
| | | selectLibFlag: null, |
| | | showField: null, |
| | | suffix: '$', |
| | | text: "åç§°", |
| | | tooltips: 'åç§°', |
| | | type: "text", |
| | | unique: false, |
| | | verify: "" |
| | | }, |
| | | { |
| | | comboxKey: null, |
| | | customClass: null, |
| | | data: null, |
| | | dateFormate: null, |
| | | defaultValue: "", |
| | | displayExtension: "", |
| | | extendAttrMap: null, |
| | | extendAttrString: null, |
| | | field: "code", |
| | | hidden: false, |
| | | keyAttr: false, |
| | | prefix: null, |
| | | readOnly: false, |
| | | referConfig: null, |
| | | required: false, |
| | | selectLibFlag: null, |
| | | showField: null, |
| | | suffix: null, |
| | | disabled: true, |
| | | text: "ç¼ç ", |
| | | tooltips: null, |
| | | type: "text", |
| | | unique: false, |
| | | verify: "" |
| | | }, |
| | | { |
| | | comboxKey: "EnumReviewType", |
| | | customClass: null, |
| | | data: null, |
| | | dateFormate: null, |
| | | defaultValue: "department", |
| | | displayExtension: "", |
| | | extendAttrMap: null, |
| | | extendAttrString: null, |
| | | field: "reviewtype", |
| | | hidden: false, |
| | | keyAttr: false, |
| | | prefix: null, |
| | | readOnly: false, |
| | | referConfig: null, |
| | | required: false, |
| | | selectLibFlag: null, |
| | | showField: null, |
| | | suffix: null, |
| | | text: "ç±»å", |
| | | tooltips: null, |
| | | type: "combox", |
| | | unique: false, |
| | | verify: "", |
| | | dicData: [{ |
| | | label: 'æµè¯1', |
| | | value: 'department' |
| | | }, { |
| | | label: 'æµè¯2', |
| | | value: 'departments' |
| | | }] |
| | | }, |
| | | { |
| | | comboxKey: null, |
| | | customClass: null, |
| | | data: null, |
| | | dateFormate: null, |
| | | defaultValue: "", |
| | | displayExtension: "", |
| | | extendAttrMap: null, |
| | | extendAttrString: null, |
| | | field: "creator", |
| | | hidden: true, |
| | | keyAttr: false, |
| | | prefix: null, |
| | | readOnly: true, |
| | | referConfig: null, |
| | | required: false, |
| | | selectLibFlag: null, |
| | | showField: null, |
| | | suffix: null, |
| | | text: "å建人", |
| | | tooltips: null, |
| | | type: "text", |
| | | unique: false, |
| | | verify: "" |
| | | }, |
| | | { |
| | | comboxKey: null, |
| | | customClass: null, |
| | | data: null, |
| | | dateFormate: "yyyy-MM-dd HH:mm:ss", |
| | | defaultValue: "", |
| | | displayExtension: "", |
| | | extendAttrMap: null, |
| | | extendAttrString: null, |
| | | field: "createtime", |
| | | hidden: true, |
| | | keyAttr: false, |
| | | prefix: null, |
| | | readOnly: false, |
| | | referConfig: null, |
| | | required: false, |
| | | selectLibFlag: null, |
| | | showField: null, |
| | | suffix: null, |
| | | text: "å建æ¶é´", |
| | | tooltips: null, |
| | | type: "datetime", |
| | | unique: false, |
| | | verify: "" |
| | | }, |
| | | { |
| | | comboxKey: null, |
| | | customClass: null, |
| | | data: null, |
| | | dateFormate: null, |
| | | defaultValue: "", |
| | | displayExtension: "", |
| | | extendAttrMap: null, |
| | | extendAttrString: null, |
| | | field: "content", |
| | | hidden: false, |
| | | keyAttr: false, |
| | | prefix: null, |
| | | readOnly: false, |
| | | referConfig: null, |
| | | required: false, |
| | | selectLibFlag: null, |
| | | showField: null, |
| | | suffix: null, |
| | | text: "夿³¨", |
| | | tooltips: null, |
| | | type: "textarea", |
| | | unique: false, |
| | | verify: "" |
| | | }, |
| | | ], |
| | | formName: '', |
| | | visible:false |
| | | } |
| | | }, |
| | | watch: { |
| | |
| | | methods: { |
| | | TreeSelectChange(row) { |
| | | this.TreeSelectList = row; |
| | | } |
| | | }, |
| | | } |
| | | } |
| | | </script> |
| | |
| | | <template> |
| | | <div> |
| | | <!--è¡¨æ ¼åºç¡æé®--> |
| | | <div v-if="type === 'table'"> |
| | | <!--topå±ç¤ºè¡¨æ ¼ä¸æ¹åºå menuå±ç¤ºè¡¨æ ¼æä½æ åºå --> |
| | | <div v-if="type === 'table' || type === 'TreeTable'"> |
| | | <!--topå±ç¤ºè¡¨æ ¼ä¸æ¹åºå menuå±ç¤ºè¡¨æ ¼æä½æ åºå æ å°±æ¯é»è®¤ --> |
| | | <el-button v-for="item in basicButtonList.top" |
| | | v-if="LocationType === 'top'" |
| | | :key="item.oid" :icon="item.paramVOS.webUiButtonIcon" |
| | |
| | | {{ item.name }} |
| | | </el-button> |
| | | |
| | | <el-button type="text" @click="handleDefaultAddChildren(scope.row)" v-if="(LocationType === 'menu' && this.default === 'default')">æ°å¢å级</el-button> |
| | | <el-button v-for="item in basicButtonList.menu" |
| | | v-if="LocationType === 'menu'" |
| | | :key="item.oid" |
| | |
| | | @click="buttonClick(item)"> |
| | | {{ item.name }} |
| | | </el-button> |
| | | |
| | | |
| | | <!-- è¡¨æ ¼å
æé®æä½å¯¹è¯æ¡è¡¨å --> |
| | | <dynamic-table-form ref="dynamicForm" :formList="formList" :title="formName" :visible.sync="visible" |
| | | style="display: none"></dynamic-table-form> |
| | |
| | | type: Array |
| | | }, |
| | | selectList: { |
| | | type: Array |
| | | type: Array, |
| | | default: [] |
| | | }, |
| | | default:{ |
| | | type:String, |
| | | } |
| | | }, |
| | | data() { |
| | |
| | | |
| | | if (this.type === 'form') { |
| | | return basicColumn; |
| | | } else if (this.type === 'table') { |
| | | } else if (this.type === 'table' || this.type === 'TreeTable') { |
| | | const top = basicColumn.filter(item => item.paramVOS.webUiButtonLocation === 'top' || func.isEmpty(item.paramVOS.webUiButtonLocation)); // è¿æ»¤åºæ¥è¡¨æ ¼ä¸é¢åºåå±ç¤ºçæé® |
| | | const menu = basicColumn.filter(item => item.paramVOS.webUiButtonLocation === 'menu'); // è¿æ»¤åºæ¥æä½æ å±ç¤ºçæé® |
| | | return { |
| | |
| | | } |
| | | }, |
| | | methods: { |
| | | //è¡¨æ ¼æ é»è®¤æ°å¢å项 |
| | | handleDefaultAddChildren(row){ |
| | | this.visible = true; |
| | | this.formName = 'æ°å¢å级' |
| | | this.$refs.dynamicForm.form = row; |
| | | }, |
| | | buttonClick(item) { |
| | | this.formName = item.name; |
| | | |
| | | function handleAdd() { |
| | | this.visible = true; |
| | | } |
| | | |
| | | function handleEdit() { |
| | | const location = item.paramVOS.webUiButtonLocation; |
| | | if (location === 'menu') { |
| | | this.visible = true; |
| | | this.$refs.dynamicForm.form = this.scope.row; |
| | | } else if (location === 'top' && this.selectList.length === 1) { |
| | | this.visible = true; |
| | | this.$refs.dynamicForm.form = this.selectList[0]; |
| | | } else { |
| | | const messageText = this.selectList.length > 1 ? 'åªè½éæ©ä¸æ¡æ°æ®è¿è¡ç¼è¾ï¼' : 'è¯·éæ©ä¸æ¡æ°æ®è¿è¡ç¼è¾ï¼'; |
| | | this.$message.warning(messageText); |
| | | } |
| | | } |
| | | |
| | | function handleDelete() { |
| | | const location = item.paramVOS.webUiButtonLocation; |
| | | if (location === 'top') { |
| | | if (this.selectList.length <= 0) { |
| | | this.$message.warning('请è³å°éæ©ä¸æ¡æ°æ®ï¼') |
| | | } else { |
| | | this.$message.success('å 餿åï¼'); |
| | | } |
| | | } else if (location === 'menu') { |
| | | this.$message.success('å 餿åï¼'); |
| | | } |
| | | } |
| | | |
| | | const methodHandlers = { |
| | | add: handleAdd.bind(this), |
| | | edit: handleEdit.bind(this), |
| | | delete: handleDelete.bind(this), |
| | | }; |
| | | |
| | | const method = item.paramVOS.webUiButtonMethods; |
| | | const handler = methodHandlers[method]; |
| | | if (handler) { |
| | | handler(); |
| | | } else { |
| | | this.$message.error('è¯·éæ°é
ç½®æé®ï¼') |
| | | // æ ¹æ® type æ¡ä»¶å¨æå¼å
¥ä¸åçJSæä»¶ï¼å¹¶ä¼ é item this åæ° |
| | | if (this.type === 'table') { |
| | | import('@/views/base/buttonTable').then(module => { |
| | | const buttonClickTable = module.default; |
| | | buttonClickTable.buttonClick(item,this); |
| | | }) |
| | | } else if (this.type === 'form') { |
| | | import('@/views/base/buttonForm').then(module => { |
| | | const buttonClickForm = module.default; |
| | | buttonClickForm.buttonClick(item,this); |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | } |
| | | </script> |
| | | |
| | |
| | | } |
| | | }, |
| | | created() { |
| | | debugger; |
| | | this.components["my-dynamic-component"] = import(this.componentPath); |
| | | // debugger; |
| | | // this.components["my-dynamic-component"] = import(this.componentPath); |
| | | } |
| | | } |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | export default { |
| | | buttonClick(item,that) { |
| | | this.formName = item.name; |
| | | const method = item.paramVOS.webUiButtonMethods; |
| | | |
| | | const handlers = { |
| | | add: () => this.handleAdd(that), |
| | | edit: () => this.handleEdit(that), |
| | | delete: () => this.handleDelete(that), |
| | | }; |
| | | |
| | | const handler = handlers[method]; |
| | | if (handler) { |
| | | handler(); |
| | | } else { |
| | | that.$message.error('è¯·éæ°é
ç½®æé®ï¼'); |
| | | } |
| | | }, |
| | | |
| | | handleAdd(that) { |
| | | that.$message.success('è¡¨åæ·»å ') |
| | | }, |
| | | |
| | | handleEdit(that) { |
| | | that.$message.success('表åç¼è¾') |
| | | }, |
| | | |
| | | handleDelete(that) { |
| | | that.$message.success('表åå é¤') |
| | | }, |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | export default { |
| | | buttonClick(item,that) { |
| | | that.formName = item.name; |
| | | const location = item.paramVOS.webUiButtonLocation; |
| | | const method = item.paramVOS.webUiButtonMethods; |
| | | const messageOnlyText = that.selectList.length > 1 ? 'åªè½éæ©ä¸æ¡æ°æ®è¿è¡ç¼è¾ï¼' : 'è¯·éæ©ä¸æ¡æ°æ®è¿è¡ç¼è¾ï¼'; |
| | | const messageAllText = '请è³å°éæ©ä¸æ¡æ°æ®ï¼' |
| | | |
| | | const handlers = { |
| | | add: () => this.handleAdd(that,location), |
| | | edit: () => this.handleEdit(that,location, messageOnlyText), |
| | | delete: () => this.handleDelete(that,location, messageAllText), |
| | | }; |
| | | |
| | | const handler = handlers[method]; |
| | | if (handler) { |
| | | handler(); |
| | | } else { |
| | | that.$message.error('è¯·éæ°é
ç½®æé®ï¼'); |
| | | } |
| | | }, |
| | | |
| | | handleAdd(that,location) { |
| | | if (location === 'top') { |
| | | that.visible = true; |
| | | } else { |
| | | that.$message.warning('è¯·éæ°é
ç½®æé®è³ä¸æ¹åºåï¼'); |
| | | } |
| | | |
| | | }, |
| | | |
| | | handleEdit(that,location, messageOnlyText) { |
| | | if (location === 'menu') { |
| | | that.visible = true; |
| | | that.$refs.dynamicForm.form = that.scope.row; |
| | | console.log(that.scope.row) |
| | | } else if (location === 'top' && that.selectList.length === 1) { |
| | | that.visible = true; |
| | | that.$refs.dynamicForm.form = that.selectList[0]; |
| | | } else { |
| | | that.$message.warning(messageOnlyText); |
| | | } |
| | | |
| | | }, |
| | | |
| | | handleDelete(that,location, messageAllText) { |
| | | if (location === 'top') { |
| | | if (that.selectList.length <= 0) { |
| | | that.$message.warning(messageAllText); |
| | | } else { |
| | | that.$message.success('å 餿åï¼'); |
| | | } |
| | | } else if (location === 'menu') { |
| | | that.$message.success('å 餿åï¼'); |
| | | } |
| | | |
| | | }, |
| | | menuConfigurationWarning(location) { |
| | | if (location === 'menu') { |
| | | this.$message.warning('è¯·éæ°é
ç½®æé®è³ä¸æ¹åºå'); |
| | | return |
| | | } |
| | | }, |
| | | topConfigurationWarning(location) { |
| | | if (location === ' top') { |
| | | this.$message.warning('è¯·éæ°é
ç½®æé®è³æä½åºå'); |
| | | return |
| | | } |
| | | } |
| | | } |