From aa869225a5f2054cb0253d8f037863aaec866c6e Mon Sep 17 00:00:00 2001 From: wangting <675591594@qq.com> Date: 星期五, 27 九月 2024 09:51:36 +0800 Subject: [PATCH] UI定义页面 --- Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/uiDefine/index.vue | 660 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 635 insertions(+), 25 deletions(-) diff --git a/Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/uiDefine/index.vue b/Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/uiDefine/index.vue index 308c333..c9a1e4b 100644 --- a/Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/uiDefine/index.vue +++ b/Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/uiDefine/index.vue @@ -1,33 +1,17 @@ <template> <el-container> - <el-aside> <basic-container> - <div ref="TreeBox" style="height: calc(100vh - 144px);!important;"> - <div class="headerCon"> - <el-button icon="el-icon-plus" plain size="small" type="primary" @click="addClickHandler">鍒涘缓 - </el-button> - <el-button icon="el-icon-edit" plain size="small" type="primary" @click="editClickHandler">淇敼 - </el-button> - <el-button icon="el-icon-delete" plain size="small" type="danger" @click="delClickHandler">鍒犻櫎 - </el-button> - <el-button icon="el-icon-download" plain size="small" type="primary" @click="exportClickHandler">瀵煎嚭 - </el-button> - <el-button icon="el-icon-upload2" plain size="small" type="primary" @click="uploadClickHandler">瀵煎叆 - </el-button> - <el-button class="smallBtn" plain size="small" type="primary" - @click="checkViewClickHandler">鏌ョ湅浣跨敤鑼冨洿 - </el-button> - </div> + <div ref="TreeBox" style="height: calc(100vh - 154px);!important;"> <!-- 宸︿晶鏍� --> - <div style="height: calc(100vh - 280px);"> + <div style="height: calc(100vh - 190px);"> <avue-tree :data="treeData" :option="treeOption" @node-click="nodeClick"> - <span slot-scope="{ node, data }" class="el-tree-node__label"> - <span style="font-size: 15px"> - <i class="el-icon-s-promotion"></i> - {{ (node || {}).label }} - </span> - </span> + <span slot-scope="{ node, data }" class="el-tree-node__label"> + <span style="font-size: 15px"> + <i class="el-icon-s-promotion"></i> + {{ (node || {}).label }} + </span> + </span> </avue-tree> </div> </div> @@ -36,15 +20,641 @@ <el-main> <basic-container> + <avue-crud + ref="crud" + :data="data" + :option="option" + :page.sync="page" + :table-loading="tableLoading" + @size-change="sizeChange" + @current-change="currentChange" + @selection-change="selectChangeHandler" + @search-change="handleSearch" + @search-reset="handleReset" + @row-click="rowClickHandler"> + <template slot="menuLeft"> + <el-button icon="el-icon-plus" size="small" type="primary" @click="addHandler">鍒涘缓</el-button> + <el-button icon="el-icon-edit" plain size="small" type="primary" @click="editHandler">淇敼</el-button> + <el-button icon="el-icon-delete" plain size="small" type="danger" @click="delHandler">鍒犻櫎</el-button> + <el-button icon="el-icon-download" plain size="small" type="primary" @click="exportClickHandler">瀵煎嚭</el-button> + <el-button icon="el-icon-upload2" plain size="small" type="primary" @click="upLoadClickHandler">瀵煎叆</el-button> + <el-button icon="el-icon-place" plain size="small" type="primary" @click="">鎺堟潈</el-button> + </template> + <template slot="menu" slot-scope="scope"> + <el-button icon="el-icon-edit" size="small" type="text" @click="rowEditBtnClick(scope.row)">缂栬緫 + </el-button> + <el-button icon="el-icon-delete" size="small" type="text" @click="rowDeleteHandler(scope.row)">鍒犻櫎 + </el-button> + <el-button icon="el-icon-document-copy" size="small" type="text" @click="rowCloneHandler(scope.row)">鍏嬮殕</el-button> + </template> + <template slot="plName" slot-scope="{row}"> + <el-link type="primary" @click="linkClickHandler(row)">{{ row.plName }}</el-link> + </template> + </avue-crud> + <!-- 鍒涘缓缂栬緫鑷畾涔夊璇濇 --> + <el-dialog + v-dialogDrag + v-loading="dialogLoading" + :title="dialogType === 'add' ? ' 鍒涘缓 涓婁笅鏂�' : '缂栬緫 涓婁笅鏂�'" + :visible.sync="dialogVisible" + append-to-body="true" + class="avue-dialog" + :close-on-click-modal="false" + width="500px" + @close="dialogClose" + > + <el-form ref="form" :model="form" :rules="rules" label-width="95px" size="small"> + <el-form-item label="鍚嶇О锛�" prop="plName"> + <el-input v-model="form.plName"></el-input> + </el-form-item> + <el-form-item label="UI涓婁笅鏂囷細" prop="plCode"> + <el-input v-model="form.plCode"></el-input> + </el-form-item> + <el-form-item label="鏄剧ず锛�" prop="plIsShow"> + <el-checkbox-group v-model="form.plIsShow"> + <el-checkbox label="瀵艰埅鍖�"></el-checkbox> + <el-checkbox label="鎺у埗鍖�"></el-checkbox> + <el-checkbox label="鎿嶄綔鍖�"></el-checkbox> + </el-checkbox-group> + </el-form-item> + <el-form-item label="鎻忚堪锛�" prop="plDesc"> + <el-input type="textarea" :rows="5" v-model="form.plDesc"></el-input> + </el-form-item> + </el-form> + <span slot="footer" class="dialog-footer"> + <el-button @click="dialogClose">鍙� 娑�</el-button> + <el-button type="primary" @click="saveHandler">纭� 瀹�</el-button> + </span> + </el-dialog> + <!-- 鍏嬮殕 --> + <el-dialog + key="cloneDialog" + v-dialogDrag + title="鍏嬮殕" + :visible.sync="cloneDialogVisible" + append-to-body="true" + class="avue-dialog" + width="500px" + @close="cloneDialogClose" + > + <avue-form ref="cloneForm" :option="cloneOption" v-model="cloneForm"></avue-form> + <span slot="footer" class="dialog-footer"> + <el-button @click="cloneDialogClose">鍙� 娑�</el-button> + <el-button type="primary" @click="cloneSaveHandler">纭� 瀹�</el-button> + </span> + </el-dialog> + <!-- 瀵煎嚭 --> + <el-dialog + key="cloneDialog" + v-dialogDrag + title="瀵煎嚭" + :visible.sync="expDialogVisible" + append-to-body="true" + class="avue-dialog" + width="500px" + @close="expDialogVisible=false" + > + <div style="height: 70%;min-height: 300px"> + <avue-tree ref="expTree" :data="expTreeData" :option="expOption"></avue-tree> + </div> + <span slot="footer" class="dialog-footer"> + <el-button @click="expDialogVisible=false">鍙� 娑�</el-button> + <el-button type="primary" @click="exportData">纭� 瀹�</el-button> + </span> + </el-dialog> </basic-container> + <!-- 瀵煎叆 --> + <upload-file ref="upload" :fileType="upFileType" :fileUrl="fileUrl" :tipList="tipList" :fileData="fileData" title="瀵煎叆" + @updata="getTableList" @upfaildata="upFail"></upload-file> + <el-dialog v-dialogDrag + :title="dialog.title" + :visible.sync="dialog.showDialog" + :fullscreen="true" + :append-to-body="true" + class="avue-dialog" + :destroy-on-close="true" + :close-on-click-modal="false" + @close="dialog.showDialog=false"> + <pl-show :uiDefineData="dialog.uiDefineData"></pl-show> + </el-dialog> </el-main> </el-container> </template> <script> +import {getBizTree,gridUIContextData,saveUIContextData,updateUIContextData,delUIContextData, cloneUIContextData ,getExpContextTree,expUIContextData} from "@/api/UI/uiDefine"; +import basicOption from "@/util/basic-option"; +import func from "@/util/func"; +import plShow from "@/views/modelingMenu/ui/uiDefine/plShow"; export default { - name: "index" + name: "index", + components:{plShow}, + data() { + return { + dialog: { + showDialog: false, + title: "涓婁笅鏂囪鎯�", + loading: false, + uiDefineData:null + }, + tipList: [], + upFileType: ['xls'], + fileUrl: 'api/uiManagerController/impUIContextData', + fileData:{}, + lastIndex: null, + treeOption: { + height: 'auto', + defaultExpandAll: true, + menu: false, + addBtn: false, + props: { + label: 'text', + value: 'oid', + children: 'children' + } + }, + nodeRow: {}, + treeData: [], + searchParams: { + 'conditionMap[txtName]': '', + 'conditionMap[txtCode]': '', + }, + tableLoading: false, + page: { + currentPage: 1, + pageSize: 50, + total: 0, + pageSizes: [10, 30, 50, 100], + }, + selectList: [], + option: { + ...basicOption, + calcHeight: -40, + addBtn: false, + editBtn: false, + delBtn: false, + tip: false, + searchMenuSpan: 6, + align:'left', + column: [{ + label: '鍚嶇О', + prop: 'plName', + search: true + }, { + label: 'UI涓婁笅鏂�', + prop: 'plCode', + search: true, + sortable: true, + }, { + label: '瀵艰埅鍖�', + prop: 'plIsShowNavigator', + width: 130, + align:'center', + formatter: function (row, value) { + if (row.plIsShowNavigator == 0) { + return '涓嶆樉绀�' + } else { + return '鏄剧ず' + } + } + }, { + label: '鎺у埗鍖�', + prop: 'plIsShowForm', + width: 130, + align:'center', + formatter: function (row, value) { + if (row.plIsShowForm == 0) { + return '涓嶆樉绀�' + } else { + return '鏄剧ず' + } + } + }, { + label: '鎿嶄綔鍖�', + prop: 'plIsShowTab', + width: 130, + align:'center', + formatter: function (row, value) { + if (row.plIsShowTab == 0) { + return '涓嶆樉绀�' + } else { + return '鏄剧ず' + } + } + }] + }, + data: [], + dialogLoading: false, + dialogVisible: false, + dialogType: '', + form: { + plName: '', + plCode: '', + plIsShow: [], + }, + rules: { + plName: [{ + required: true, + message: '璇疯緭鍏ュ悕绉�', + trigger: 'blur' + }], + plCode: [{ + required: true, + message: '璇疯緭鍏I涓婁笅鏂�', + trigger: 'blur' + }], + plIsShow: [{ + required: true, + message: '璇烽�夋嫨鏄剧ず鍖哄煙', + trigger: 'blur' + }] + }, + cloneDialogVisible:false, + cloneOption: { + submitBtn:false, + emptyBtn:false, + column: [{ + label: '鍏嬮殕鐩爣', + prop: 'cloneTargetName', + span:24, + type: 'tree', + clearable: true, + dicData: [], + defaultExpandAll:true, + rules: [ + { + required: true, + message: '璇烽�夋嫨鍏嬮殕鐩爣', + trigger: 'blur' + } + ] + }, { + label: 'UI鍚嶇О', + prop: 'cloneName', + span:24, + type: 'input', + rules: [ + { + required: true, + message: '璇疯緭鍏I鍚嶇О', + trigger: 'blur' + } + ] + }, { + label: 'UI涓婁笅鏂�', + prop: 'cloneContextCode', + span:24, + type: 'input', + rules: [ + { + required: true, + message: '璇疯緭鍏I涓婁笅鏂�', + trigger: 'blur' + } + ] + }] + }, + cloneForm:{ + //鍏嬮殕鐨勬簮瀵硅薄鐨勪俊鎭� + sourcePLUILayout:null, + cloneTargetName:'n', + cloneName:'', + cloneContextCode:'' + }, + expDialogVisible:false, + expTreeData:[], + expOption:{ + height: 'auto', + filter:false, + multiple:true, + defaultExpandAll: true, + menu: false, + addBtn: false, + props: { + label: 'text', + value: 'oid', + children: 'children' + } + } + } + }, + created() { + this.getTreeList(); + }, + methods: { + //鏍戣〃鏌ヨ + getTreeList() { + const loading = this.$loading({}); + getBizTree().then(res => { + this.treeData=[res.data.obj]; + const dicData = res.data.obj.children.map(item => { + item.label=item.attributes.name; + item.value=item.attributes.name; + return item; + }); + this.cloneOption.column[0].dicData=[{ + label:'涓氬姟绫诲瀷鏍�', + value:'涓氬姟绫诲瀷鏍�', + disabled: true, + children:dicData + }]; + loading.close(); + }).catch(error => { + loading.close(); + }) + }, + // 鏍戠偣鍑� + nodeClick(row) { + if (row.oid) { + this.nodeRow = row; + this.tableLoading = true; + this.getTableList(); + } + }, + getTableList(){ + const params = Object.assign(this.searchParams,{ + 'conditionMap[btmName]': this.nodeRow.attributes.name, + }) + gridUIContextData(this.page.currentPage, this.page.pageSize, params).then(res => { + this.data = res.data.data; + this.page.total = res.data.total; + this.$refs.crud.clearSelection(); + this.tableLoading = false; + }) + }, + linkClickHandler(row){ + this.dialog.title='銆�'+row.plName+' - '+row.plCode+'銆戣鎯�' + this.dialog.uiDefineData=row; + this.dialog.showDialog=true; + return false; + this.$router.push({ + path: '/UIDefineShow/:'+row.plOId, + name: row.plName+'璇︽儏' + }); + }, + sizeChange(val) { + this.page.pageSize = val; + }, + // 椤电爜 + currentChange(val) { + this.page.currentPage = val; + }, + // 澶氶�� + selectChangeHandler(row) { + this.selectList = row; + }, + // 鎼滅储 + handleSearch(params, done) { + this.searchParams = { + 'conditionMap[txtName]': params.plName, + 'conditionMap[txtCode]': params.plCode, + }; + this.getTableList() + done(); + }, + + // 閲嶇疆鎼滅储鏉′欢 + handleReset() { + this.searchParams = {}; + this.getTableList(); + }, + // 琛岀偣鍑� + rowClickHandler(row) { + func.rowClickHandler( + row, + this.$refs.crud, + this.lastIndex, + (newIndex) => { + this.lastIndex = newIndex; + }, + () => { + this.selectList = []; + } + ); + }, + + //鍒涘缓 + addHandler(){ + if(this.nodeRow && this.nodeRow.oid){ + this.form.plIsShow=[]; + this.form.plRelatedType=this.nodeRow.attributes.name; + this.dialogType = 'add'; + this.dialogVisible = true; + }else { + this.$message.error('璇烽�夋嫨涓氬姟绫诲瀷'); + } + + }, + editHandler(){ + if(this.selectList.length!=0){ + this.rowEditBtnClick(this.selectList[0]); + }else { + this.$message.error('璇烽�夋嫨涓�鏉℃暟鎹繘琛岀紪杈�'); + } + }, + delHandler(){ + if (this.selectList.length <= 0) { + this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹�'); + return; + } + const params = { + oids: this.selectList.map(item => item.plOId).join(',') + } + this.$confirm('鎮ㄧ‘瀹氳鍒犻櫎鎵�閫夋嫨鐨勬暟鎹悧锛�', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + delUIContextData(params).then(res => { + if (res.data.code === 200) { + this.$message.success('鍒犻櫎鎴愬姛'); + this.getTableList(); + } + }) + }).catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑堝垹闄�' + }); + }); + }, + + // 鍏抽棴瀵硅瘽妗� + dialogClose() { + this.dialogVisible = false; + this.$refs.form.clearValidate(); + this.form = { + plName: '', + plCode: '', + plDesc:'', + plIsShow: [], + } + }, + // 淇濆瓨UI涓婁笅鏂� + saveHandler() { + this.$refs.form.validate((valid,done) => { + if (valid) { + let params = { + ...this.form + } + if(this.form.plIsShow.includes('瀵艰埅鍖�')){ + params.plIsShowNavigator=1 + }else { + params.plIsShowNavigator=0 + } + if(this.form.plIsShow.includes('鎺у埗鍖�')){ + params.plIsShowForm=1; + }else { + params.plIsShowForm=0; + } + if(this.form.plIsShow.includes('鎿嶄綔鍖�')){ + params.plIsShowTab=1; + }else { + params.plIsShowTab=0; + } + delete params.plIsShow; + if (this.dialogType === 'add') { + saveUIContextData(params).then(res => { + if (res.data.code === 200) { + this.$message.success('娣诲姞鎴愬姛'); + this.dialogClose(); + this.getTableList(); + } + }) + } else if (this.dialogType === 'edit') { + updateUIContextData(params).then(res => { + if (res.data.code === 200) { + this.$message.success('淇敼鎴愬姛'); + this.dialogClose() + this.getTableList(); + } + }) + } + } else { + return false; + } + }); + }, + // 瀵煎嚭 + exportClickHandler() { + if (this.selectList.length <= 0) { + this.$message.error('璇烽�夋嫨鏁版嵁'); + return; + } + const params = { + expDatas: this.selectList.map(item => item.plOId).join(',') + } + getExpContextTree(params).then(res => { + this.expTreeData=[res.data.obj]; + }) + this.expDialogVisible=true; + }, + exportData(){ + const params = {} + const checkedDatas=this.$refs.expTree.getCheckedNodes(); + if (checkedDatas.length <= 0) { + this.$message.error('璇烽�夋嫨鏁版嵁'); + return; + } + this.selectList.forEach(item=>{ + params[item.plOId]=checkedDatas.filter(checkitem => checkitem.parentId==item.plOId).map(checkitem => checkitem.oid).join(',') + }) + expUIContextData(params).then(res => { + func.downloadFileByBlobHandler(res); + this.$message.success('瀵煎嚭鎴愬姛'); + this.expDialogVisible=false; + }).catch(err => { + this.$message.error(err); + }); + }, + + // 瀵煎叆 + upLoadClickHandler() { + this.fileData={ + isCovered:false, + selectBtm:this.nodeRow.attributes.name + } + this.$refs.upload.visible = true; + }, + //瀵煎叆澶辫触 + upFail(response){ + + }, + // 缂栬緫鎸夐挳 + rowEditBtnClick(row) { + this.form={ + ...row, + plIsShow: [], + }; + if(row.plIsShowNavigator){ + this.form.plIsShow.push('瀵艰埅鍖�') + } + if(row.plIsShowForm){ + this.form.plIsShow.push('鎺у埗鍖�') + } + if(row.plIsShowTab){ + this.form.plIsShow.push('鎿嶄綔鍖�') + } + this.dialogType = 'edit'; + this.dialogVisible = true; + }, + // 鍒犻櫎鎸夐挳 + rowDeleteHandler(row) { + this.$confirm('鎮ㄧ‘瀹氳鍒犻櫎鎵�閫夋嫨鐨勬暟鎹悧锛�', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + delUIContextData({oids: row.plOId}).then(res => { + if (res.data.code === 200) { + this.$message.success('鍒犻櫎鎴愬姛'); + this.getTableList(); + } + }) + }).catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑堝垹闄�' + }); + }); + }, + //鍏嬮殕 + rowCloneHandler(row){ + this.cloneForm={ + sourcePLUILayout:row, + cloneTargetName:'', + cloneName:row.plName+'_copy(0)', + cloneContextCode:row.plCode+'_copy(0)', + } + this.cloneDialogVisible=true; + }, + cloneSaveHandler(){ + this.$refs.cloneForm.validate((valid,done) => { + if (valid) { + cloneUIContextData(this.cloneForm).then(res => { + if (res.data.code === 200) { + this.$message.success('鍏嬮殕鎴愬姛'); + this.cloneDialogClose(); + this.getTableList(); + } + }) + } else { + return false; + } + }); + }, + cloneDialogClose(){ + this.cloneDialogVisible=false; + this.cloneForm= { + //鍏嬮殕鐨勬簮瀵硅薄鐨勪俊鎭� + sourcePLUILayout: null, + cloneTargetName: '', + cloneName: '', + cloneContextCode: '' + } + } + } } </script> -- Gitblit v1.9.3