From ffd0af47ee31a9592cfab56a907e9841a9113c52 Mon Sep 17 00:00:00 2001 From: ludc Date: 星期四, 20 七月 2023 10:37:17 +0800 Subject: [PATCH] 代码提交,前端代码打包 --- Source/UBCS-WEB/dist/src/views/tool/code.vue | 624 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 624 insertions(+), 0 deletions(-) diff --git a/Source/UBCS-WEB/dist/src/views/tool/code.vue b/Source/UBCS-WEB/dist/src/views/tool/code.vue new file mode 100644 index 0000000..bfc79ce --- /dev/null +++ b/Source/UBCS-WEB/dist/src/views/tool/code.vue @@ -0,0 +1,624 @@ +<template> + <basic-container> + <avue-crud :option="option" + :table-loading="loading" + :data="data" + ref="crud" + v-model="form" + :permission="permissionList" + :page.sync="page" + @row-del="rowDel" + @row-update="rowUpdate" + @row-save="rowSave" + :before-open="beforeOpen" + @search-change="searchChange" + @search-reset="searchReset" + @selection-change="selectionChange" + @current-change="currentChange" + @size-change="sizeChange" + @refresh-change="refreshChange" + @on-load="onLoad"> + <template slot="menuLeft"> + <el-button type="danger" + size="small" + icon="el-icon-delete" + v-if="permission.code_delete" + plain + @click="handleDelete">鍒� 闄� + </el-button> + <el-button type="primary" + size="small" + plain + icon="el-icon-refresh" + @click="handleBuild">浠g爜鐢熸垚 + </el-button> + </template> + <template slot-scope="scope" slot="menu"> + <el-button type="text" + size="small" + icon="el-icon-document-copy" + v-if="permission.code_edit" + class="none-border" + @click.stop="handleCopy(scope.row)">澶嶅埗 + </el-button> + </template> + </avue-crud> + </basic-container> +</template> + +<script> + import {getList, getCode, build, remove, add, update, copy} from "@/api/tool/code"; + import {getDetail as modelDetail, prototypeDetail} from "@/api/tool/model"; + import {templateDic} from "@/const/tool/model"; + import {validatenull} from "@/util/validate"; + import {mapGetters} from "vuex"; + + export default { + data() { + return { + form: {}, + selectionList: [], + loading: true, + query: {}, + page: { + pageSize: 10, + currentPage: 1, + total: 0 + }, + option: { + height: 'auto', + calcHeight: 30, + dialogWidth: 900, + tip: false, + searchShow: true, + searchMenuSpan: 6, + border: true, + index: true, + selection: true, + labelWidth: 120, + menuWidth: 300, + viewBtn: true, + dialogClickModal: false, + tabs: true, + column: [ + { + label: "妯″潡鍚�", + prop: "codeName", + search: true, + display: false, + }, + { + label: '妯$増绫诲瀷', + prop: 'templateType', + type: "select", + dicData: templateDic, + display: false, + }, + { + label: "琛ㄥ悕", + prop: "tableName", + search: true, + display: false, + }, + { + label: "鏈嶅姟鍚�", + prop: "serviceName", + search: true, + display: false, + }, + { + label: "鍖呭悕", + prop: "packageName", + display: false, + }, + ], + group: [ + { + label: '妯″瀷閰嶇疆', + prop: 'modelSetting', + icon: 'el-icon-tickets', + column: [ + { + label: "鏁版嵁妯″瀷", + prop: "modelId", + search: true, + span: 24, + type: "select", + dicUrl: "/api/ubcs-develop/model/select", + props: { + label: "modelName", + value: "id" + }, + rules: [{ + required: true, + message: "璇烽�夋嫨鏁版嵁妯″瀷", + trigger: "blur" + }] + }, + { + label: "妯″潡鍚�", + prop: "codeName", + search: true, + rules: [{ + required: true, + message: "璇疯緭鍏ユā鍧楀悕", + trigger: "blur" + }] + }, + { + label: "鏈嶅姟鍚�", + prop: "serviceName", + search: true, + rules: [{ + required: true, + message: "璇疯緭鍏ユ湇鍔″悕", + trigger: "blur" + }] + }, + { + label: "琛ㄥ悕", + prop: "tableName", + rules: [{ + required: true, + message: "璇疯緭鍏ヨ〃鍚�", + trigger: "blur" + }] + }, + { + label: "琛ㄥ墠缂�", + prop: "tablePrefix", + hide: true, + rules: [{ + required: true, + message: "璇疯緭鍏ヨ〃鍓嶇紑", + trigger: "blur" + }] + }, + { + label: "涓婚敭鍚�", + prop: "pkName", + hide: true, + rules: [{ + required: true, + message: "璇疯緭鍏ヤ富閿悕", + trigger: "blur" + }] + }, + { + label: "鍖呭悕", + prop: "packageName", + overHidden: true, + rules: [{ + required: true, + message: "璇疯緭鍏ュ寘鍚�", + trigger: "blur" + }] + }, + ] + }, + { + label: '妯$増閰嶇疆', + prop: 'templateSetting', + icon: 'el-icon-copy-document', + column: [ + { + label: '妯$増绫诲瀷', + prop: 'templateType', + type: "select", + dicData: templateDic, + value: "crud", + rules: [{ + required: true, + message: "璇烽�夋嫨妯$増绫诲瀷", + trigger: "blur" + }] + }, + { + label: "浣滆�呬俊鎭�", + prop: "author", + value: "BladeX", + rules: [{ + required: true, + message: "璇疯緭鍏ヤ綔鑰�", + trigger: "blur" + }] + }, + { + label: "瀛愯〃妯″瀷", + prop: "subModelId", + type: "select", + dicUrl: "/api/ubcs-develop/model/select", + props: { + label: "modelName", + value: "id" + }, + display: false, + hide: true, + }, + { + label: "瀛愯〃澶栭敭", + prop: "subFkId", + display: false, + hide: true, + }, + { + label: "鏍戜富閿瓧娈�", + prop: "treeId", + type: "select", + dicData: [], + props: { + label: "comment", + value: "jdbcName" + }, + display: false, + hide: true, + }, + { + label: "鏍戠埗涓婚敭瀛楁", + prop: "treePid", + type: "select", + dicData: [], + props: { + label: "comment", + value: "jdbcName" + }, + display: false, + hide: true, + }, + { + label: "鏍戝悕绉板瓧娈�", + prop: "treeName", + type: "select", + dicData: [], + props: { + label: "comment", + value: "jdbcName" + }, + display: false, + hide: true, + }, + ] + }, + { + label: '鐢熸垚閰嶇疆', + prop: 'codingSetting', + icon: 'el-icon-printer', + column: [ + { + label: "鍩虹涓氬姟", + labelTip:'閰嶇疆鏄惁浣跨敤BladeX灏佽鐨凚aseService瑙i攣鏇村鍔熻兘', + prop: "baseMode", + type: 'radio', + dicUrl: "/api/ubcs-system/dict/dictionary?code=yes_no", + props: { + label: "dictValue", + value: "dictKey" + }, + value: 2, + dataType: "number", + hide: true, + rules: [{ + required: true, + message: "璇烽�夋嫨鍩虹涓氬姟", + trigger: "blur" + }] + }, + { + label: "鍖呰鍣�", + labelTip:'閰嶇疆鏄惁浣跨敤Wrapper鍖呰鍣ㄦ潵鎷撳睍Controller杩斿洖鍒楄〃鐨勫瓧娈�', + prop: "wrapMode", + type: 'radio', + dicUrl: "/api/ubcs-system/dict/dictionary?code=yes_no", + props: { + label: "dictValue", + value: "dictKey" + }, + value: 2, + dataType: "number", + hide: true, + rules: [{ + required: true, + message: "璇烽�夋嫨鍖呰鍣�", + trigger: "blur" + }] + }, + { + label: "杩滅▼璋冪敤", + labelTip:'閰嶇疆鏄惁浣跨敤Feign杩滅▼璋冪敤', + prop: "feignMode", + type: 'radio', + dicUrl: "/api/ubcs-system/dict/dictionary?code=yes_no", + props: { + label: "dictValue", + value: "dictKey" + }, + value: 1, + dataType: "number", + hide: true, + rules: [{ + required: true, + message: "璇烽�夋嫨鍩虹涓氬姟", + trigger: "blur" + }] + }, + { + label: "浠g爜椋庢牸", + labelTip:'閫夋嫨涓嶅悓搴曞眰瀹炵幇鐨勪唬鐮佹ā鐗�', + prop: "codeStyle", + type: 'radio', + dicData: [ + { + label: "saber", + value: "saber" + }, + { + label: "element", + value: "element" + } + ], + value: "saber", + hide: true, + rules: [{ + required: true, + message: "璇烽�夋嫨浠g爜椋庢牸", + trigger: "blur" + }] + }, + { + label: "鍚庣鐢熸垚璺緞", + prop: "apiPath", + span: 24, + hide: true, + rules: [{ + required: true, + message: "璇疯緭鍏ュ悗绔敓鎴愯矾寰�", + trigger: "blur" + }] + }, + { + label: "鍓嶇鐢熸垚璺緞", + prop: "webPath", + span: 24, + hide: true, + rules: [{ + required: true, + message: "璇疯緭鍏ュ墠绔敓鎴愯矾寰�", + trigger: "blur" + }] + } + ] + } + ] + }, + data: [] + }; + }, + watch: { + 'form.modelId'() { + if (!validatenull(this.form.modelId)) { + // 鑾峰彇鏁版嵁妯″瀷淇℃伅 + modelDetail(this.form.modelId).then(res => { + const result = res.data; + if (result.success) { + const {modelName, modelTable, modelCode} = result.data; + if (validatenull(this.form.tablePrefix)) { + this.form.tablePrefix = modelTable.split("_")[0] + "_"; + } + if (validatenull(this.form.tableName)) { + this.form.tableName = modelTable; + } + if (validatenull(this.form.codeName)) { + this.form.codeName = modelName; + } + if (validatenull(this.form.serviceName)) { + this.form.serviceName = `ubcs-${modelCode}`; + } + if (validatenull(this.form.pkName)) { + this.form.pkName = "id"; + } + if (validatenull(this.form.packageName)) { + this.form.packageName = `org.springblade.${modelCode}`; + } + if (validatenull(this.form.subFkId) && !validatenull(this.form.tablePrefix)) { + this.form.subFkId = modelTable.replace(this.form.tablePrefix, "") + "_id"; + } + + // 鑾峰彇鏁版嵁鍘熷瀷淇℃伅 + prototypeDetail(this.form.modelId).then(res => { + const result = res.data; + if (result.success) { + const columnTreeId = this.findObject(this.option.group, "treeId"); + const columnTreePid = this.findObject(this.option.group, "treePid"); + const columnTreeName = this.findObject(this.option.group, "treeName"); + columnTreeId.dicData = result.data; + columnTreePid.dicData = result.data; + columnTreeName.dicData = result.data; + } + }); + } + }); + } + }, + 'form.templateType'() { + // 妯$増绫诲瀷 + const type = this.form.templateType; + + // 涓诲瓙琛ㄥ瓧娈垫樉闅� + const columnSubModelId = this.findObject(this.option.group, "subModelId"); + const columnSubFkId = this.findObject(this.option.group, "subFkId"); + columnSubModelId.display = type === "sub"; + columnSubFkId.display = type === "sub"; + + // 鏍戣〃瀛楁鏄鹃殣 + const columnTreeId = this.findObject(this.option.group, "treeId"); + const columnTreePid = this.findObject(this.option.group, "treePid"); + const columnTreeName = this.findObject(this.option.group, "treeName"); + columnTreeId.display = type === "tree"; + columnTreePid.display = type === "tree"; + columnTreeName.display = type === "tree"; + + } + }, + computed: { + ...mapGetters(["permission"]), + permissionList() { + return { + addBtn: this.vaildData(this.permission.code_add, false), + viewBtn: this.vaildData(this.permission.code_view, false), + delBtn: this.vaildData(this.permission.code_delete, false), + editBtn: this.vaildData(this.permission.code_edit, false) + }; + }, + ids() { + let ids = []; + this.selectionList.forEach(ele => { + ids.push(ele.id); + }); + return ids.join(","); + } + }, + methods: { + rowSave(row, done, loading) { + add(row).then(() => { + this.onLoad(this.page); + this.$message({ + type: "success", + message: "鎿嶄綔鎴愬姛!" + }); + done(); + }, error => { + window.console.log(error); + loading(); + }); + }, + rowUpdate(row, index, done, loading) { + update(row).then(() => { + this.onLoad(this.page); + this.$message({ + type: "success", + message: "鎿嶄綔鎴愬姛!" + }); + done(); + }, error => { + window.console.log(error); + loading(); + }); + }, + rowDel(row) { + this.$confirm("纭畾灏嗛�夋嫨鏁版嵁鍒犻櫎?", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning" + }) + .then(() => { + return remove(row.id); + }) + .then(() => { + this.onLoad(this.page); + this.$message({ + type: "success", + message: "鎿嶄綔鎴愬姛!" + }); + }); + }, + searchReset() { + this.query = {}; + this.onLoad(this.page); + }, + searchChange(params, done) { + this.query = params; + this.page.currentPage = 1; + this.onLoad(this.page, params); + done(); + }, + selectionChange(list) { + this.selectionList = list; + }, + selectionClear() { + this.selectionList = []; + this.$refs.crud.toggleSelection(); + }, + handleDelete() { + if (this.selectionList.length === 0) { + this.$message.warning("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�"); + return; + } + this.$confirm("纭畾灏嗛�夋嫨鏁版嵁鍒犻櫎?", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning" + }) + .then(() => { + return remove(this.ids); + }) + .then(() => { + this.onLoad(this.page); + this.$message({ + type: "success", + message: "鎿嶄綔鎴愬姛!" + }); + this.$refs.crud.toggleSelection(); + }); + }, + handleBuild() { + if (this.selectionList.length === 0) { + this.$message.warning("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�"); + return; + } + this.$confirm("鏄惁鐢熸垚閫変腑妯″潡鐨勪唬鐮�?", { + title: "浠g爜鐢熸垚纭", + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning" + }) + .then(() => { + return build(this.ids); + }) + .then(() => { + this.onLoad(this.page); + this.$message({ + type: "success", + message: "鎿嶄綔鎴愬姛!" + }); + this.$refs.crud.toggleSelection(); + }); + }, + handleCopy(row) { + copy(row.id).then(() => { + this.onLoad(this.page); + this.$message({ + type: "success", + message: "澶嶅埗鎴愬姛!" + }); + }); + }, + beforeOpen(done, type) { + if (["edit", "view"].includes(type)) { + getCode(this.form.id).then(res => { + this.form = res.data.data; + }); + } + done(); + }, + currentChange(currentPage) { + this.page.currentPage = currentPage; + }, + sizeChange(pageSize) { + this.page.pageSize = pageSize; + }, + refreshChange() { + this.onLoad(this.page, this.query); + }, + onLoad(page, params = {}) { + this.loading = true; + getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => { + const data = res.data.data; + this.page.total = data.total; + this.data = data.records; + this.loading = false; + this.selectionClear(); + }); + } + } + }; +</script> -- Gitblit v1.9.3