From e3410e9cdb22cfea4e46537d34db303612411e93 Mon Sep 17 00:00:00 2001 From: ludc Date: 星期日, 21 五月 2023 23:22:45 +0800 Subject: [PATCH] 代码整合 --- Source/UBCS-WEB/src/components/code-dialog-page/referConfigDialog.vue | 1157 ++++++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 936 insertions(+), 221 deletions(-) diff --git a/Source/UBCS-WEB/src/components/code-dialog-page/referConfigDialog.vue b/Source/UBCS-WEB/src/components/code-dialog-page/referConfigDialog.vue index 120dca7..23f3bcc 100644 --- a/Source/UBCS-WEB/src/components/code-dialog-page/referConfigDialog.vue +++ b/Source/UBCS-WEB/src/components/code-dialog-page/referConfigDialog.vue @@ -5,6 +5,7 @@ append-to-body :visible.sync="isShowReferConfig" width="90%" + id="refer-config" @close="recoveryDataAndForm('initData')" style="height: 115vh; margin-top: -14vh; overflow-y: hidden"> <el-tabs v-model="activeName" @tab-click="handleClick"> @@ -12,15 +13,28 @@ <div style="width: 100%; overflow-y: auto; height: 65vh"> <el-row> <avue-form ref="form" :option="formOption" v-model="form" class="referTypeForm"> - <template> - <el-input - ref="referType" + <template #referTypeName="{disabled,size}"> + <el-input :disabled="disabled" + :size="size" + v-model="form.referTypeName" + ref="referTypeName" placeholder="璇烽�夋嫨 鍙傜収鐨勪笟鍔$被鍨�" prefix-icon="el-icon-search" readonly="true" - v-model="form.referType" - @focus="openAttrSelectOrGetValue('referType')"> - <i slot="suffix" class="el-icon-circle-close" @click="clearAttrDataByIcon('referType')" style="margin-right: 5px;cursor: pointer;"></i> + @focus="openSelectionTable('referType')"> + <i v-show="!disabled" slot="suffix" class="el-icon-circle-close" @click="clearSelectionTable('referType')" style="margin-right: 5px;cursor: pointer;"></i> + </el-input> + </template> + <template #sortField="{disabled,size}"> + <el-input :disabled="disabled" + :size="size" + v-model="form.sortField" + ref="sortField" + placeholder="璇烽�夋嫨 鎺掑簭瀛楁" + prefix-icon="el-icon-search" + readonly="true" + @focus="openSelectionTable('sortField')"> + <i slot="suffix" class="el-icon-circle-close" @click="clearSelectionTable('sortField')" style="margin-right: 5px;cursor: pointer;"></i> </el-input> </template> </avue-form> @@ -28,8 +42,9 @@ <el-row v-show="form.type=='default' || form.type=='grid'"> <avue-crud ref="crudAttr" + class="crud-attr" :option="attrOption" - @cell-click="clicktest" + @cell-click="clickAttrEdit" :data="attrData"> <!-- 琛ㄦ牸鍐呮搷浣滄寜閽� --> <template slot="menu" slot-scope="scope"> @@ -52,15 +67,28 @@ <el-button type="primary" size="small" icon="el-icon-plus" - @click="openAddSearchOrAttrDialog('selectAttr')">閫夋嫨灞炴�� + @click="openSelectionTable('selectAttr')">閫夋嫨灞炴�� </el-button> + <div class="tag-group" style="display: inline"> + <el-tag + v-for="item in attrData" + v-show="item.isquery && item.title!=''" + style="margin-left: 3px" + :key="item.title" + type="info" + size="small" + effect="dark"> + {{ item.title }} + </el-tag> + </div> </template> </avue-crud> </el-row> - <el-row> + <el-row style="margin-top: 10px"> <avue-crud ref="crudAddCondition" :option="addSearchCondtionOption" + @cell-click="clickAddSearchCondtionEdit" :data="addSearchCondtionData"> <!-- 琛ㄦ牸鍐呮搷浣滄寜閽� --> <template slot="menu" slot-scope="scope"> @@ -76,7 +104,7 @@ <el-button type="primary" size="small" icon="el-icon-plus" - @click="openAddSearchOrAttrDialog('addSearchCondition')"> + @click="openSelectionTable('addSearchCondition')"> 娣诲姞鏌ヨ鏉′欢 </el-button> </template> @@ -87,7 +115,7 @@ <el-tab-pane label="鐩存帴閫夊彇鍙傜収閰嶇疆" name="second"> <div style="width: 100%; overflow-y: auto; height: 65vh"> <avue-crud - :option="optionSelectReferConfig" + :option="selectReferConfigOption" :table-loading="selectReferConfigLoading" :data="selectReferConfigData" :page.sync="selectReferConfigPage" @@ -109,6 +137,110 @@ <el-button @click="recoveryDataAndForm('initForm')">娓呯┖鍐呭</el-button> <el-button @click="isShowReferConfig = false">鍙� 娑�</el-button> </div> + + <el-dialog title="涓恒�愬弬鐓х殑涓氬姟绫诲瀷銆戦�夊彇鍊�" + append-to-body + :visible.sync="isShowReferBtmType" + width="70%" + destroy-on-close + @close="clearTableRowSelection('referType')" + style="height: 110vh; margin-top: -12vh; overflow-y: hidden"> + <avue-crud :option="selectionReferBtmTypeOption" + :table-loading="selectReferBtmTypeLoading" + :data="selectReferBtmTypeData" + :page.sync="selectReferBtmTypePage" + ref="selectReferBtmTypeCrud" + class="referBtmType-crud" + @row-click="referBtmTypeRowClick" + @search-change="referBtmTypeSearchChange" + @search-reset="referBtmTypeSearchReset" + @current-change="referBtmTypeCurrentChange" + @size-change="referBtmTypeSizeChange"> + <template #radio="{row}"> + <el-radio v-model="referBtmTypeSelectRow" + :label="row.$index"> + - + </el-radio> + </template> + </avue-crud> + <div slot="footer" class="dialog-footer"> + <el-button type="primary" @click="selectedReferBtmType">纭� 瀹�</el-button> + <el-button @click="isShowReferBtmType = false">鍙� 娑�</el-button> + </div> + </el-dialog> + + <el-dialog title="涓恒�愭帓搴忓瓧娈点�戦�夊彇鍊�" + append-to-body + :visible.sync="isShowSortField" + width="70%" + destroy-on-close + @close="clearTableRowSelection('sortField')" + style="height: 110vh; margin-top: -12vh; overflow-y: hidden"> + <avue-crud :option="selectionSortFieldOption" + :table-loading="selectSortFieldLoading" + :data="selectSortFieldData" + :page.sync="selectSortFieldPage" + ref="selectSortFieldCrud" + @row-click="sortFieldRowClick" + @search-change="sortFieldChange" + @search-reset="sortFieldSearchReset" + @current-change="sortFieldCurrentChange" + @size-change="sortFieldSizeChange"> + <template #radio="{row}"> + <el-radio v-model="sortFieldSelectRow" + :label="row.$index"> + - + </el-radio> + </template> + </avue-crud> + <div slot="footer" class="dialog-footer"> + <el-button type="primary" @click="selectedSortField">纭� 瀹�</el-button> + <el-button @click="isShowSortField = false">鍙� 娑�</el-button> + </div> + </el-dialog> + + <el-dialog title="閫夋嫨鏄剧ず瀛楁" + append-to-body + :visible.sync="isShowShowField" + width="70%" + destroy-on-close + style="height: 110vh; margin-top: -12vh; overflow-y: hidden"> + <avue-crud :option="selectionShowFieldOption" + :table-loading="selectShowFieldLoading" + :data="selectShowFieldData" + ref="selectShowFieldCrud" + @row-click="showFieldRowClick" + @selection-change="selectionShowFieldDataChange" + @search-change="showFieldSearchChange" + @search-reset="showFieldSearchReset"> + </avue-crud> + <div slot="footer" class="dialog-footer"> + <el-button type="primary" @click="selectedShowField">纭� 瀹�</el-button> + <el-button @click="isShowShowField = false">鍙� 娑�</el-button> + </div> + </el-dialog> + + <el-dialog title="閫夋嫨鏌ヨ鏉′欢" + append-to-body + :visible.sync="isShowSearchCondition" + width="70%" + destroy-on-close + style="height: 110vh; margin-top: -12vh; overflow-y: hidden"> + <avue-crud :option="selectionSearchConditionOption" + :table-loading="selectSearchConditionLoading" + :data="selectSearchConditionData" + ref="selectSearchConditionCrud" + @row-click="searchConditionRowClick" + @selection-change="searchConditionDataChange" + @search-change="searchConditionSearchChange" + @search-reset="searchConditionSearchReset"> + </avue-crud> + <div slot="footer" class="dialog-footer"> + <el-button type="primary" @click="selectedSearchCondition">纭� 瀹�</el-button> + <el-button @click="isShowSearchCondition = false">鍙� 娑�</el-button> + </div> + </el-dialog> + </el-dialog> </template> @@ -123,13 +255,43 @@ }, }, data() { + let element = ''; return { + //娴嬭瘯琛ㄦ牸琛岀紪杈戞晥鏋� + // tableData:[{ + // field: 'id', + // title: '缂栧彿', + // fieldType: 'text', + // fieldTypeText: '鏂囨湰妗�', + // sort: true, + // sortField: 'id', + // width: '150', + // isquery: true, + // $cellEdit: false + // },{ + // field: 'name', + // title: '鍚嶇О', + // fieldType: 'text', + // fieldTypeText: '鏂囨湰妗�', + // sort: true, + // sortField: 'name', + // width: '180', + // isquery: true, + // $cellEdit: false + // }], + // tableOption:{ + // tableData:[], //琛ㄦ牸鏁版嵁 + // options:[] //琛ㄦ牸閰嶇疆椤逛俊鎭紙琛ㄥご锛宭abel瀹藉害绛夛級 + // }, + activeName: 'first', //褰撳墠娲诲姩鐨則abs labelWidth: '150', // 鏍囬瀹藉害 - isShowReferConfig: false, // 瀵硅瘽妗嗘樉绀洪殣钘忔帶鍒� + isShowReferConfig: false, // 绗竴灞傚璇濇鏄剧ず闅愯棌鎺у埗 + referTypeIsReadOnly: false, // 琛ㄥ崟瀵硅薄 form: { - referType: '', + referTypeName: '', //鏄剧ず鐨勫�� + referType: '', //瀹為檯瀛樺偍鐨勫�� textField: 'name', valueField: 'oid', type: 'default', //鍙傜収绐楀彛绫诲瀷 @@ -140,7 +302,8 @@ useFormKey: '', paramForFormKey: '', isMuti: false, - mapFields: '', + mapFields: '', + // 鏌ヨ鏉′欢鍒楄〃 // limit: '15', // sortField: '', // sortType: 'asc', @@ -152,29 +315,9 @@ // loadType: 'all', // onlyLeaf: false, }, - attrData: [ - { - field: 'id', - title: '缂栧彿', - fieldType: 'text', - fieldTypeText: '鏂囨湰妗�', - sort: "true", - sortField: 'id', - width: '150', - isquery: true, - },{ - field: 'name', - title: '鍚嶇О', - fieldType: 'text', - fieldTypeText: '鏂囨湰妗�', - sort: "true", - sortField: 'name', - width: '180', - isquery: true, - } - ], + attrData: [], attrOption: { - height:'150', + height:'180', tip: false, addBtn: false, editBtn: false, @@ -194,49 +337,76 @@ { label: "鍒楀瓧娈�(*)", prop: "field", + cell: true, + clearable: false, + blur: (value) => this.updateAttrBlur(value), },{ label: "鍒楀悕(*)", prop: "title", + cell: true, + clearable: false, + blur: (value) => this.updateAttrBlur(value), },{ label: "瀛楁绫诲瀷(*)", prop: "fieldTypeText", + cell: true, + clearable: false, + type:"select", + value: 'text', + dicData: [{ + value: 'text', label: '鏂囨湰妗�' + }, { + value: 'combox', label: '涓嬫媺鑿滃崟' + }, { + value: 'radio',label: '鍗曢��' + }, { + value: 'swtich', label: '寮�鍏�' + }, { + value: 'date', label: '鏃堕棿' + }, { + value: 'textarea', label: '鏂囨湰鍩�' + }], + blur: (value) => this.updateAttrBlur(value), },{ label: "鍒楄〃鍙帓搴�", prop: "sort", + cell: true, + clearable: false, + type:"switch", + width: '80px', + value: true, + blur: (value) => this.updateAttrBlur(value), },{ label: "鎺掑簭瀛楁", prop: "sortField", + cell: true, + clearable: false, + blur: (value) => this.updateAttrBlur(value), },{ label: "瀛楁瀹藉害", prop: "width", + cell: true, + clearable: false, + blur: (value) => this.updateAttrBlur(value), },{ label: "鍒楀浐瀹氫綅缃�", prop: "fixedText", + cell: true, + type:"select", + clearable: false, + value: 'noFixed', + dicData: [{value: 'noFixed', label: '涓嶅浐瀹�'}, {value: 'left', label: '宸﹁竟'}, {value: 'right', label: '鍙宠竟'}], + blur: (value) => this.updateAttrBlur(value), },{ label: "js鏄剧ず浠g爜", prop: "templet", + cell: true, + clearable: false, + blur: (value) => this.updateAttrBlur(value), }, ] }, - addSearchCondtionData: [ - { - id: 'test', - cate: 'test', - value: 1 - },{ - id: 'test1', - cate: 'test1', - value: 2 - },{ - id: 'test2', - cate: 'test2', - value: 3 - },{ - id: 'test4', - cate: 'test4', - value: 4 - } - ], + addSearchCondtionData: [], addSearchCondtionOption: { height:'150', tip: false, @@ -257,18 +427,40 @@ column: [ { label: "绛涢�夊瓧娈�", - prop: "id", + prop: "filterField", + cell: true, + clearable: false, },{ label: "绛涢�夌被鍨�", - prop: "cate", + prop: "filterType", + type: "select", + cell: true, + clearable: false, + dicData: [{ + value: 'like', label: '鍖呭惈' + }, { + value: '=', label: '绛変簬' + }, { + value: '>', label: '澶т簬' + }, { + value: '<', label: '灏忎簬' + }, { + value: '!=', label: '涓嶇瓑浜�' + }, { + value: '>=', label: '澶т簬绛変簬' + }, { + value: '<=', label: '灏忎簬绛変簬' + }] },{ label: "绛涢�夊��", - prop: "value", + prop: "filterValue", + cell: true, + clearable: false, } ] }, - optionSelectReferConfig: { + selectReferConfigOption: { height:'auto', tip: false, addBtn: false, @@ -342,6 +534,217 @@ }, selectReferConfigQuery: {}, + //涓恒�愬弬鐓х殑涓氬姟绫诲瀷銆戦�夊彇鍊煎璇濇 + selectionReferBtmTypeOption: { + border: true, + height: '260', + tip: false, + //searchShow: false, + index: true, + selection: false, + menu: false, + addBtn: false, + refreshBtn: false, + searchShowBtn: false, + columnBtn: false, + dialogClickModal: false, + highlightCurrentRow: true, + align: 'center', + menuAlign: 'center', + column: [{ + label: '-', + prop: 'radio', + width: 60, + hide: false + },{ + label: '涓氬姟绫诲瀷缂栧彿', + width: 120, + search: true, + searchSpan: 8, + searchLabelWidth: 100, + prop: 'id' + },{ + label: '涓氬姟绫诲瀷鍚嶇О', + search: true, + searchSpan: 8, + searchLabelWidth: 100, + prop: 'name' + },{ + label: '鎻忚堪', + search: false, + prop: 'description' + }], + }, + selectReferBtmTypeLoading: false, + selectReferBtmTypeData: [], + selectReferBtmTypePage: { + pageSize: 10, + currentPage: 1, + total: 0 + }, + referBtmTypeQuery: {}, + isShowReferBtmType: false, + referBtmTypeSelectRowData: '', + referBtmTypeSelectRow: '', + + + // 涓恒�愭帓搴忓瓧娈点�戦�夊彇鍊煎璇濇 + isShowSortField: false, + selectionSortFieldOption: { + border: true, + height: '220px', + tip: false, + //searchShow: false, + index: true, + selection: false, + addBtn: false, + menu: false, + refreshBtn: false, + searchShowBtn: false, + columnBtn: false, + dialogClickModal: false, + highlightCurrentRow: true, + align: 'center', + menuAlign: 'center', + border: true, + column: [{ + label: '-', + prop: 'radio', + width: 60, + hide: false + },{ + 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' + }], + }, + selectSortFieldLoading: false, + selectSortFieldData: [], + selectSortFieldPage: { + pageSize: 10, + currentPage: 1, + total: 0 + }, + sortFieldQuery: {}, + sortFieldSelectRow: '', + sortFieldSelectRowData: '', + + + //閫夋嫨鏄剧ず瀛楁 + isShowShowField: false, + selectionShowFieldOption: { + border: true, + height: '220px', + tip: false, + //searchShow: false, + index: true, + selection: true, + addBtn: false, + menu: false, + refreshBtn: false, + searchShowBtn: false, + columnBtn: false, + dialogClickModal: false, + highlightCurrentRow: true, + 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' + }], + }, + showFieldQuery: {}, + selectShowFieldLoading: false, + selectShowFieldData: [], + showFieldSelectList: [], + + //娣诲姞鏌ヨ鏉′欢 + isShowSearchCondition: false, + selectionSearchConditionOption: { + border: true, + height: '220px', + tip: false, + //searchShow: false, + index: true, + selection: true, + addBtn: false, + menu: false, + refreshBtn: false, + searchShowBtn: false, + columnBtn: false, + dialogClickModal: false, + highlightCurrentRow: true, + 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' + }], + }, + selectSearchConditionLoading: false, + selectSearchConditionData: [], + searchConditionQuery: {}, + searchConditionSelectList: [], + + //涓婁竴娆$偣鍑荤殑琛岀紪杈戞暟鎹� + preClickAttrRow: '', + preClickAddSearchConditionRow: '', + }; }, // 琛ㄥ崟鐣岄潰鏄剧ず鍐呭閰嶇疆 @@ -364,93 +767,17 @@ column: [ { label: '鍙傜収鐨勪笟鍔$被鍨�', - prop: 'referType', + prop: 'referTypeName', span: 7, + disabled: this.referTypeIsReadOnly, + clearable: !this.referTypeIsReadOnly, tip: '鍙傜収鏁版嵁鏌ヨ鐨勪笟鍔$被鍨嬨��', tipPlacement: 'right', - type: 'input', rules: [{ required: true, message: "(鍙傜収鐨勪笟鍔$被鍨�)蹇呭~椤逛笉鑳戒负绌�", - trigger: "blur", + trigger: ["blur","change"], }], - children: { - border: true, - height: '200px', - tip: false, - //searchShow: false, - index: true, - selection: true, - //refreshBtn: false, - //columnBtn: false, - dialogClickModal: false, - highlightCurrentRow: 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: 'description' - }], - }, - // formatter: (row) => { - // console.log(row.name); - // if (!row.name) - // return '' - // return row.name; - // }, - // onLoad: ({ page, value, data }, callback) => { - // console.log(page); - // console.log(value); - // console.log(data); - // //棣栨鍔犺浇鍘绘煡璇㈠搴旂殑鍊� - // if (value) { - // console.log(111+"======="+ value); - // this.$message.success('棣栨鏌ヨ' + value) - // callback({ - // id: 't1', - // name: 'test1', - // description: 'test1', - // }) - // return; - // } - // if (data) { - // console.log(111+"======="+ data); - // this.$message.success('鎼滅储鏌ヨ鍙傛暟' + JSON.stringify(data)) - // } - // if (page) { - // console.log(111+"======="+ page); - // this.$message.success('鍒嗛〉鍙傛暟' + JSON.stringify(page)) - // } - // //鍒嗛〉鏌ヨ淇℃伅 - // callback({ - // total: 2, - // data: [{ - // id: 't2', - // name: 'test2', - // description: 'test2', - // }, { - // id: 't3', - // name: 'test3', - // description: 'test3', - // }] - // }) - // }, - // props: { - // label: 'name', - // value: 'id', - // } },{ label: '鏄剧ず鐨勫睘鎬�', prop: 'textField', @@ -654,36 +981,9 @@ label: '鎺掑簭瀛楁', prop: 'sortField', span: 7, - type: 'table', tip: '鏌ヨ鏁版嵁鏃剁殑鎺掑簭瀛楁', + //clearable: false, tipPlacement: 'right', - children: { - 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' - }], - }, - // 杩欏効闇�瑕佹坊鍔犱笟鍔$被鍨嬫帴鍙� - },{ label: '鎺掑簭绫诲瀷', prop: 'sortType', @@ -776,32 +1076,34 @@ label: '鎺掑簭瀛楁', prop: 'sortField', span: 7, - type: 'table', - children: { - 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' - }], - }, + //type: 'table', + tip: '鏌ヨ鏁版嵁鏃剁殑鎺掑簭瀛楁', + tipPlacement: 'right', + // children: { + // 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' + // }], + // }, // 杩欏効闇�瑕佹坊鍔犱笟鍔$被鍨嬫帴鍙h姹傚疄鐜板脊绐楃晫闈㈣〃鏍兼覆鏌� },{ label: '鎺掑簭绫诲瀷', @@ -820,18 +1122,75 @@ ] } }, + + }, + mounted() { + // 楹荤殑杩欎釜鍦版柟璋冩鎴戜簡 + this.element = document.getElementById('refer-config'); + this.element.addEventListener("click", (e) => { + //<table cellspacing="0" cellpadding="0" border="0" class="el-table__body" style="width: 911px;"> + //console.log(e.target); + // console.log(this.$refs.crudAttr); + // console.log(this.$refs.crudAttr.$el.contains(e.target)); + //console.log(!this.$refs.crudAttr.$el.contains(e.target) && this.preClickAttrRow != null); + if (!this.$refs.crudAttr.$el.contains(e.target) && + this.preClickAttrRow != '') { + this.preClickAttrRow.$cellEdit = false; + } + if (!this.$refs.crudAddCondition.$el.contains(e.target) && + this.preClickAddSearchConditionRow != '') { + this.preClickAddSearchConditionRow.$cellEdit = false; + } + }); + }, + watch: { + // 璐煎潙锛屽垏鎹㈢被鍨嬫椂琛ㄦ牸锛岄殣钘忓啀鏄剧ず灏变細鍑虹幇琛ㄦ牸閿欎綅闂锛� + 'form.type'(val) { + //console.log(val); + this.onloadAttrData(); + } }, methods: { - clicktest(cell){ + + // 鍗曞嚮琛ㄦ牸瀹炵幇琛ㄦ牸琛岀紪杈� + clickAttrEdit(row, column, event){ + if(this.preClickAttrRow && this.preClickAttrRow != row){ + //console.log(this.attrData[this.preClickAttrRow.$index]); + this.attrData[this.preClickAttrRow.$index].$cellEdit = false; + } + row.$cellEdit = true; + this.preClickAttrRow = row; + }, + // 灞炴�ц〃鏍艰缂栬緫澶卞幓鐒︾偣鏃朵繚瀛樻柟娉� + updateAttrBlur(value){ + //console.log(this.attrData[0]); - //cell.$cellEdit = true; + }, + // 鍗曞嚮琛ㄦ牸瀹炵幇琛ㄦ牸琛岀紪杈� + clickAddSearchCondtionEdit(row, column, event){ + if(this.preClickAddSearchConditionRow && this.preClickAddSearchConditionRow != row){ + //console.log(this.attrData[this.preClickAttrRow.$index]); + this.addSearchCondtionData[this.preClickAddSearchConditionRow.$index].$cellEdit = false; + } + row.$cellEdit = true; + this.preClickAddSearchConditionRow = row; + }, + //涓婁竴涓〉闈㈠凡缁忛�変腑鍙傜収搴旂敤鐨勪笟鍔$被鍨嬬殑鎯呭喌锛屽拰涓婁竴娆″凡缁忛厤缃繃鍙傜収閰嶇疆鐨勬儏鍐典笅杩涜椤甸潰鍒濆鍖栨覆鏌� + initPageData(val){ + let value = JSON.parse(val); + if(value != null || value != 'undefined' ){ + this.form = value; + //console.log(val); + this.referTypeIsReadOnly = true; + } + //console.log(localStorage.getItem("userId")); }, // 鍒囨崲褰撳墠娲诲姩鐨則abs handleClick(tab, event) { if(tab.index=='0'){ this.onloadAttrData(); }else{ - this.onloadselectReferConfigData(); + //this.onloadSelectReferConfigData(); } }, // 閫夋嫨瀹屽弬鐓ч厤缃箣鍚庣偣鍑讳繚瀛樻寜閽Е鍙� @@ -839,13 +1198,11 @@ //琛ㄥ崟楠岃瘉 this.$refs.form.validate((valid, done, msg) => { if (valid) { + // 鏍规嵁绫诲瀷瀵筬orm琛ㄥ崟涓殑鍙傛暟杩涜杩囨护锛屽彧淇濈暀闈炵┖涓旈渶瑕佺殑灞炴�� let submitForm = this.filterForm(); //console.log(submitForm); - //杞崲鎴怞SON瀛楃涓茶繘琛岀埗缁勪欢鍥炴樉 - let submitFormJson = JSON.stringify(submitForm); - //console.log(submitFormJson); - this.$emit('echoReferConfig', submitFormJson) // 瑙﹀彂update:data灏嗗瓙缁勪欢鍊间紶閫掔粰鐖剁粍浠� - //this.isShowReferConfig = false; + this.$emit('echoReferConfig', submitForm) // 瑙﹀彂update:data灏嗗瓙缁勪欢鍊间紶閫掔粰鐖剁粍浠� + this.isShowReferConfig = false; done() } else { for(let attr in msg) { @@ -857,12 +1214,40 @@ } }) }, + //浠庣紦瀛樹腑閭orm琛ㄥ崟瀵硅薄 + getLocalStoregeForm(){ + localStorage.getItem("userId"); + + }, /** 鍏跺疄閫夊彇灞炴�ц〃鏍肩殑榛樿鏁版嵁涓嶉渶瑕佸姞杞斤紝 浣嗘槸寮圭獥鎵撳紑浼氭湁琛ㄦ牸閿欒闂鎵�浠ラ渶瑕佸湪杩欒皟鐢╠oLayout鏂规硶*/ onloadAttrData(){ this.$nextTick(() => { this.$refs.crudAttr.doLayout() }) + this.attrData = [ + { + field: 'id', + title: '缂栧彿', + fieldType: 'text', + fieldTypeText: '鏂囨湰妗�', + sort: true, + sortField: 'id', + width: '150', + isquery: true, + $cellEdit: false + },{ + field: 'name', + title: '鍚嶇О', + fieldType: 'text', + fieldTypeText: '鏂囨湰妗�', + sort: true, + sortField: 'name', + width: '180', + isquery: true, + $cellEdit: false + } + ]; }, // 灞炴�ч�夋嫨琛ㄦ牸涓殑绉婚櫎鎸夐挳鍔熻兘 removeCurrentRow(row,condition){ @@ -875,33 +1260,25 @@ // 璇ョ晫闈㈢殑鏁版嵁杩涜鍒濆鍖栧鍘� recoveryDataAndForm(condition){ if(condition=='initForm'){ + this.referTypeIsReadOnly = false; let currentType = this.form.type; this.form = this.$options.data().form; this.form.type = currentType; - console.log(this.form); // this.form.referContent = ''; // this.form.displayTable = ''; return; } - Object.assign(this.$data,this.$options.data()); - }, - // 鎵撳紑娣诲姞鏌ヨ鏉′欢瀵硅瘽妗� - openAddSearchOrAttrDialog(condition){ - if(condition=='addSearchCondition'){ - console.log('this is open addSearchCondition'); - }else { - if(this.form.referType == '' || this.form.referType == null){ - this.$message.warning("璇疯緭鍏ュ弬鐓х殑涓氬姟绫诲瀷") - return; - } - - console.log('this is open selectAttr'); - } + Object.assign(this.$data,this.$options.data()); + // 绉婚櫎缁戝畾鍦ㄨ椤甸潰瀵硅瘽妗嗕笂鐨勫叏灞�鐩戝惉浜嬩欢 + if(this.element != ''){ + let te = window.removeEventListener('click', this.element) + } }, // 鎻愪氦琛ㄥ崟涔嬪墠杩囨护鎺夌┖鎴栦笉闇�瑕佺殑琛ㄥ崟鏁版嵁 filterForm(){ const oldForm = this.form; let submittDefaultForm = [ + 'referTypeName', 'referType', 'textField', 'valueField', @@ -914,6 +1291,7 @@ 'paramForFormKey', 'isMuti', 'mapFields', + 'searchCondition', ]; let addArray = []; let newForm ={}; @@ -934,27 +1312,364 @@ ]; } submittDefaultForm = submittDefaultForm.concat(addArray); + if(!this.checkArrayIsUndefined(this.addSearchCondtionData)){ + newForm = { + searchCondition: this.addSearchCondtionData, + } + } + if((oldForm.type == 'default' || oldForm.type == 'grid') && (this.attrData.length >= 0 && !this.checkArrayIsUndefined(this.addSearchCondtionData))){ + newForm = Object.assign(newForm,{attrData:this.attrData}); + } + // 杩囨护鍑虹┖鍊煎睘鎬у拰涓嶉渶瑕佺殑灞炴�� submittDefaultForm.forEach(item=>{ - //console.log(item); - if(item == 'isMuti' || item == 'onlyLeaf' || oldForm[item] != '' || oldForm[item] != ''){ - newForm = Object.assign(newForm,{[item]:oldForm[item]}); + // console.log(!this.checkStringIsEmpty(oldForm[item]) || !this.checkArrayIsUndefined(oldForm[item])); + if((item == 'isMuti' || item == 'onlyLeaf') || (!this.checkStringIsEmpty(oldForm[item]) || !this.checkArrayIsUndefined(oldForm[item]))){ + //console.log(item,oldForm[item]); + newForm = Object.assign(newForm,{[item]:oldForm[item]}); } }); // console.log(newForm); return newForm; }, - onloadselectReferConfigData(){ + /** + * 涓虹┖ + * @param val + * @returns {boolean} + */ + checkStringIsEmpty(val){ + if ( + val === null || + typeof val === 'undefined' || + (typeof val === 'string' && val === "" && val !== 'undefined') + ) { + return true; + } + return false; + }, + /** + * 鏄惁涓哄畾涔� + * @param val + * @returns {boolean} + */ + checkArrayIsUndefined(val){ + return typeof val === 'array' && (val.length === 0 ||val === null || typeof val === 'undefined'); + }, + onloadSelectReferConfigData(){ this.$nextTick(() => { this.$refs.selectReferConfigCrud.doLayout() }) + this.selectReferConfigData = [{ + field: 'id', + title: '缂栧彿', + fieldType: 'text', + fieldTypeText: '鏂囨湰妗�', + sort: "true", + sortField: 'id', + width: '150', + isquery: true, + },{ + field: 'name', + title: '鍚嶇О', + fieldType: 'text', + fieldTypeText: '鏂囨湰妗�', + sort: "true", + sortField: 'name', + width: '180', + isquery: true, + }]; }, - + // 鎵撳紑琛ㄦ牸閫夋嫨妗� + openSelectionTable(condition){ + if (condition == 'referType'){ + this.isShowReferBtmType = true; + this.referBtmTypeOnLoad(); + }else if (condition == 'sortField'){ + this.isShowSortField = true; + this.sortFieldOnLoad(); + }else { + if(this.form.referType == '' || this.form.referType == null){ + this.$message.warning("璇疯緭鍏ュ弬鐓х殑涓氬姟绫诲瀷") + return; + } + if(condition == 'addSearchCondition'){ + this.isShowSearchCondition = true; + this.selectSearchConditionDataOnload(); + }else { + this.isShowShowField = true; + this.selectShowFieldDataOnload(); + } + } + }, + // 娓呯┖琛ㄦ牸閫夋嫨妗� + clearSelectionTable(condition){ + if(condition == 'referType'){ + this.form.referType = ''; + this.form.referTypeName = ''; + }else { + this.form.sortField = ''; + } + }, + // 鍏抽棴瀵硅瘽妗嗘椂瀵归�変腑鍐呭杩涜娓呯┖锛屽苟瑙g粦鍏ㄥ眬鐩戝惉浜嬩欢 + clearTableRowSelection(condition){ + if(condition == 'sortField'){ + this.sortFieldSelectRow = ''; + this.sortFieldSelectRowData = ''; + }else if(condition == 'referType'){ + this.referBtmTypeSelectRow=''; + this.referBtmTypeSelectRowData = ''; + } + + }, + + // 涓恒�愬弬鐓х殑涓氬姟绫诲瀷銆戦�夊彇鍊� + referBtmTypeOnLoad(page, params = {}){ + this.selectReferBtmTypeLoading = true; + // 璋冪敤api璇锋眰 + const data = { + total: 2, + data: [{ + id: 't2', + name: 'test2', + description: 'test2', + }, { + id: 't3', + name: 'test3', + description: 'test3', + }] + } + this.selectReferBtmTypeData = data.data; + this.selectReferBtmTypePage.total = data.total; + this.selectReferBtmTypeLoading = false; + }, + referBtmTypeSizeChange(pageSize){ + this.selectReferBtmTypePage.pageSize = pageSize; + }, + referBtmTypeSearchChange(params, done){ + this.referBtmTypeQuery = params; + this.selectReferBtmTypePage.currentPage = 1; + this.referBtmTypeOnLoad(this.page, params); + done(); + }, + referBtmTypeSearchReset(){ + this.referBtmTypeQuery = {}; + this.referBtmTypeOnLoad(this.selectReferBtmTypePage); + }, + referBtmTypeRowClick(row){ + this.referBtmTypeSelectRowData = row; + this.referBtmTypeSelectRow = row.$index + //console.log( this.referBtmTypeSelectRowData); + }, + referBtmTypeCurrentChange(currentPage){ + this.selectReferBtmTypePage.currentPage = currentPage; + }, + selectedReferBtmType(){ + if(!this.referBtmTypeSelectRowData) { + this.$message.warning("璇烽�夋嫨涓�鏉℃暟鎹�"); + return; + } + this.form.referTypeName = this.referBtmTypeSelectRowData.name; + this.form.referType = this.referBtmTypeSelectRowData.id; + this.isShowReferBtmType = false; + }, + + // 涓恒�愭帓搴忓瓧娈点�戦�夊彇鍊� + sortFieldOnLoad(page, params = {}){ + this.selectSortFieldLoading = true; + // 璋冪敤api璇锋眰 + const data = { + total: 2, + data: [{ + id: 'test', + name: '娴嬭瘯', + attrLength: 11, + attrType: '瀛楃涓�' + }, { + id: 'test1', + name: '娴嬭瘯1', + attrLength: 12, + attrType: '鏁板瓧' + }] + } + this.selectSortFieldData = data.data; + this.selectSortFieldPage.total = data.total; + this.selectSortFieldLoading = false; + }, + sortFieldSizeChange(pageSize){ + this.selectSortFieldPage.pageSize = pageSize; + }, + sortFieldSearchChange(params, done){ + this.sortFieldQuery = params; + this.selectSortFieldPage.currentPage = 1; + this.sortFieldOnLoad(this.page, params); + done(); + }, + sortFieldSearchReset(){ + this.sortFieldQuery = {}; + this.sortFieldOnLoad(this.selectSortFieldPage); + }, + sortFieldRowClick(row){ + this.sortFieldSelectRowData = row; + this.sortFieldSelectRow = row.$index + //console.log( this.sortFieldSelectRowData); + }, + sortFieldCurrentChange(currentPage){ + this.selectReferBtmTypePage.currentPage = currentPage; + }, + selectedSortField(){ + if(!this.sortFieldSelectRowData) { + this.$message.warning("璇烽�夋嫨涓�鏉℃暟鎹�"); + return; + } + this.form.sortField = this.sortFieldSelectRowData.id; + this.isShowSortField = false; + }, + + // 閫夋嫨鏄剧ず瀛楁 + selectShowFieldDataOnload(params = {}){ + this.selectShowFieldLoading = true; + // 璋冪敤api璇锋眰 + const data = { + total: 2, + data: [{ + id: 'test', + name: '娴嬭瘯', + attrLength: 11, + attrType: 'text', + attrTypeText: '鏂囨湰妗�' + }, { + id: 'test1', + name: '娴嬭瘯1', + attrLength: 12, + attrType: 'number', + attrTypeText: '鏁板瓧' + }, { + id: 'test2', + name: '娴嬭瘯2', + attrLength: 13, + attrType: 'date', + attrTypeText: '鏃ユ湡' + }] + } + this.selectShowFieldData = data.data; + this.selectShowFieldLoading = false; + }, + selectionShowFieldDataChange(list){ + this.showFieldSelectList = list; + this.$refs.selectShowFieldCrud.setCurrentRow(this.showFieldSelectList[list.length-1]); + }, + showFieldRowClick(row){ + //this.showFieldSelectList.push(row); + this.$refs.selectShowFieldCrud.setCurrentRow(row); + this.$refs.selectShowFieldCrud.toggleRowSelection(row); //閫変腑褰撳墠琛� + }, + showFieldSearchChange(params, done){ + this.showFieldQuery = params; + this.selectShowFieldDataOnload(params); + done(); + }, + showFieldSearchReset(){ + this.showFieldQuery = {}; + this.sortFieldOnLoad(); + }, + selectedShowField(){ + //console.log(this.showFieldSelectList); + if(this.showFieldSelectList.length <= 0) { + this.$message.warning("璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹�"); + return; + } + //this.showFieldSelectList; + this.showFieldSelectList.forEach(item => { + this.attrData.push( + { + field: item.id, + title: item.id, + fieldType: item.attrType, + fieldTypeText: item.attrTypeText, + sort: false, + sortField: item.id, + width: item.attrLength, + isquery: false, + $cellEdit: false + } + ) + + }) + this.isShowShowField = false; + }, + + + // 閫夋嫨鏌ヨ鏉′欢 + selectSearchConditionDataOnload(params = {}){ + this.selectSearchConditionLoading = true; + // 璋冪敤api璇锋眰 + this.selectSearchConditionData = [{ + id: 'test', + name: '娴嬭瘯', + attrLength: 11, + attrType: '瀛楃涓�', + $cellEdit: false, + }, { + id: 'test1', + name: '娴嬭瘯1', + attrLength: 12, + attrType: '鏁板瓧', + $cellEdit: false, + }, { + id: 'test2', + name: '娴嬭瘯2', + attrLength: 13, + attrType: '鏃ユ湡', + $cellEdit: false, + }]; + this.selectSearchConditionLoading = false; + }, + searchConditionRowClick(row){ + this.$refs.selectSearchConditionCrud.setCurrentRow(row); + this.$refs.selectSearchConditionCrud.toggleRowSelection(row); //閫変腑褰撳墠琛� + }, + searchConditionDataChange(list){ + this.searchConditionSelectList = list; + this.$refs.selectSearchConditionCrud.setCurrentRow(this.searchConditionSelectList[list.length-1]); + }, + searchConditionSearchChange(params, done){ + this.searchConditionQuery = params; + this.selectSearchConditionDataOnload(params); + done(); + }, + searchConditionSearchReset(){ + this.searchConditionQuery = {}; + this.sortFieldOnLoad(); + }, + selectedSearchCondition(){ + console.log(this.searchConditionSelectList); + if(this.searchConditionSelectList.length <= 0) { + this.$message.warning("璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹�"); + return; + } + this.searchConditionSelectList.forEach(item => { + this.addSearchCondtionData.push( + { + filterField: item.id, + filterType: '=', + filterValue: '', + $cellEdit: false + } + ) + + }) + this.isShowSearchCondition = false; + }, + } }; </script> <style> + .referBtmType-crud > .el-card > .el-card__body > .avue-crud__menu { + display: none!important; + } + /* 鎻愮ず鏂囨湰鍑虹幇鐨勯�熷害 */ .el-tooltip__popper{ width: 200px !important; -- Gitblit v1.9.3