¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <el-dialog |
| | | :title="options.title" |
| | | append-to-body |
| | | :visible.sync="crudParams.isShowDialog" |
| | | width="65%" |
| | | destroy-on-close |
| | | @close="clearTableRowSelection" |
| | | style="height: 110vh; margin-top: -12vh; overflow-y: hidden"> |
| | | <avue-crud :option="crudParams.crudOption" |
| | | :table-loading="crudParams.crudLoading" |
| | | :data="crudParams.crudData" |
| | | :ref="crudParams.ref" |
| | | @row-click="selectedBtmTypeAttrRowClick" |
| | | @selection-change="selectionBtmTypeAttrChange" |
| | | @search-change="selectedBtmTypeAttrSrchChange" |
| | | @search-reset="selectedBtmTypeAttrSrchReset"> |
| | | </avue-crud> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="primary" @click="selectedBtmTypeAttr">ç¡® å®</el-button> |
| | | <el-button @click="crudParams.isShowDialog = false">å æ¶</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </template> |
| | | |
| | | <script> |
| | | import { gridAttributesByBtmId } from "@/api/code/referBtmType"; |
| | | export default { |
| | | name: "referSelectBtmAttrDialog", |
| | | props: { |
| | | // å¯¹è¯æ¡æ¾ç¤ºéèæ§å¶ |
| | | visible: { |
| | | type: "Boolean", |
| | | default: false, |
| | | }, |
| | | |
| | | |
| | | }, |
| | | watch: { |
| | | // çå¬ç¶ç»ä»¶ä¼ ççªå£æ¾ç¤ºéèçå¼ |
| | | visible (){ |
| | | this.crudParams.isShowDialog = this.visible; |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | |
| | | // è¡¨æ ¼ç¸å
³åæ° |
| | | crudParams: { |
| | | ref: "selectedAttrCrud", |
| | | isShowDialog: this.visible, //å¯¹è¯æ¡æ¾ç¤ºæ§å¶ |
| | | crudLoading: false, |
| | | crudOption: { |
| | | border: true, |
| | | height: '250px', |
| | | tip: false, |
| | | //searchShow: false, |
| | | index: true, |
| | | selection: true, |
| | | addBtn: false, |
| | | menu: false, |
| | | // refreshBtn: false, |
| | | searchShowBtn: false, |
| | | columnBtn: false, |
| | | dialogClickModal: false, |
| | | highlightCurrentRow: true, |
| | | searchMenuSpan: 5, |
| | | align: 'center', |
| | | menuAlign: 'center', |
| | | border: true, |
| | | column: [{ |
| | | label: '屿§è±æç¼å·', |
| | | width: 120, |
| | | search: true, |
| | | searchSpan: 8, |
| | | searchLabelWidth: 100, |
| | | prop: 'id' |
| | | },{ |
| | | label: '屿§ä¸æåç§°', |
| | | search: true, |
| | | searchSpan: 8, |
| | | searchLabelWidth: 100, |
| | | prop: 'name' |
| | | },{ |
| | | label: '屿§é¿åº¦', |
| | | search: false, |
| | | prop: 'attrLength' |
| | | },{ |
| | | label: '屿§ç±»å', |
| | | search: false, |
| | | prop: 'attrType' |
| | | }], |
| | | }, |
| | | crudData: [], |
| | | crudQuery: {}, |
| | | crudSelectedRowData: [], |
| | | }, |
| | | // è°ç¨æ¹ä¼ è¿æ¥çç¸å
³åæ° |
| | | options: {}, |
| | | |
| | | } |
| | | }, |
| | | methods: { |
| | | |
| | | // æ¸
空éä¸ |
| | | clearTableRowSelection(){ |
| | | this.crudParams.crudSelectedRow=''; |
| | | this.crudParams.crudSelectedRowData = ''; |
| | | this.$emit('update:visible', false); |
| | | }, |
| | | |
| | | // crudç¸å
³æ¹æ³ |
| | | selectedBtmTypeAttrOnLoad(params){ |
| | | this.options = params; |
| | | this.crudParams.crudLoading = true; |
| | | // è°ç¨apiè¯·æ± |
| | | const data = { |
| | | total: 2, |
| | | data: [{ |
| | | id: 'test', |
| | | name: 'æµè¯', |
| | | attrLength: 11, |
| | | attrType: 'å符串' |
| | | }, { |
| | | id: 'test1', |
| | | name: 'æµè¯1', |
| | | attrLength: 12, |
| | | attrType: 'æ°å' |
| | | }] |
| | | } |
| | | let param = {}; |
| | | // å¤ä¸ªconditionMapè¿æ ·ä¼ å |
| | | if(this.crudParams.crudQuery){ |
| | | Object.keys(crudParams.crudQuery).forEach(key=>{ |
| | | param['conditionMap['+key+']'] = crudParams.crudQuery[key]; |
| | | }); |
| | | } |
| | | gridAttributesByBtmId(1,-1,param).then(res=>{ |
| | | console.log(res); |
| | | }) |
| | | this.crudParams.crudData = data.data; |
| | | this.crudParams.crudLoading = false; |
| | | }, |
| | | selectedBtmTypeAttrSrchChange(params, done){ |
| | | this.crudParams.crudQuery = params; |
| | | this.selectedBtmTypeAttrOnLoad(this.options); |
| | | done(); |
| | | }, |
| | | selectedBtmTypeAttrSrchReset(){ |
| | | this.crudParams.crudQuery = {}; |
| | | this.selectedBtmTypeAttrOnLoad(this.options); |
| | | }, |
| | | selectedBtmTypeAttrRowClick(row){ |
| | | this.crudParams.crudSelectedRowData = row; |
| | | this.$refs[this.crudParams.ref].toggleSelection(); |
| | | this.$refs[this.crudParams.ref].setCurrentRow(row); |
| | | this.$refs[this.crudParams.ref].toggleRowSelection(row); //éä¸å½åè¡ |
| | | }, |
| | | selectionBtmTypeAttrChange(list){ |
| | | this.crudParams.crudSelectedRowData = list; |
| | | this.$refs[this.crudParams.ref].setCurrentRow(this.crudParams.crudSelectedRowData[list.length-1]); |
| | | //å½åéä¸è¡ä¸ºç©ºçæ¶åå°±å°ç 段管çè¡¨æ ¼æ°æ®ç½®ç©º |
| | | }, |
| | | // éä¸å±æ§ä¹å |
| | | selectedBtmTypeAttr(){ |
| | | if(this.crudParams.crudSelectedRowData.length<=0 || (this.options.condition == 'sortField' && this.crudParams.crudSelectedRowData.length!=1)) { |
| | | this.$message.warning("è¯·éæ©ä¸æ¡æ°æ®"); |
| | | return; |
| | | } |
| | | // æé åæ¾ç¶ç»ä»¶éè¦ä¼ éçç¸å
³åæ° |
| | | let data = { |
| | | selectedArrary: this.crudParams.crudSelectedRowData, |
| | | condition: this.options.condition |
| | | }; |
| | | this.$emit('echoSelectedAttr',data); |
| | | this.crudParams.isShowDialog = false; |
| | | }, |
| | | |
| | | }, |
| | | |
| | | } |
| | | </script> |
| | | |
| | | <style> |
| | | |
| | | </style> |