From 13784d753399fa4dc1d96217976f15b831ff63a1 Mon Sep 17 00:00:00 2001 From: wujingjing <gersonwu@qq.com> Date: 星期一, 23 九月 2024 09:39:50 +0800 Subject: [PATCH] preRun;bakOld; preview选项 --- .gitignore | 2 deploy/deploy.config.js | 66 +++++++++++++--------- package.json | 2 src/views/project/yw/lowCode/sqlAmis/edit/SqlAmisEdit.vue | 86 ++++++++++++++++------------ 4 files changed, 91 insertions(+), 65 deletions(-) diff --git a/.gitignore b/.gitignore index 71a3d58..d6b730e 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,7 @@ customer_list/*/deploy.json customer_list/yw/static/config/globalConfig.js - +deploy/deploy.config.extend.js # local env files .env.local .env.*.local diff --git a/deploy/deploy.config.js b/deploy/deploy.config.js index c43270f..2d879fb 100644 --- a/deploy/deploy.config.js +++ b/deploy/deploy.config.js @@ -1,28 +1,40 @@ -const deployJson = require('../customer_list/yw/deploy.json') +const deployJson = require('../customer_list/yw/deploy.json'); module.exports = { - privateKey: '', // 鏈湴绉侀挜鍦板潃锛屼綅缃竴鑸湪C:/Users/xxx/.ssh/id_rsa锛岄潪蹇呭~锛屾湁绉侀挜鍒欓厤缃� - passphrase: '', // 鏈湴绉侀挜瀵嗙爜锛岄潪蹇呭~锛屾湁绉侀挜鍒欓厤缃� - projectName: '', // 椤圭洰鍚嶇О - // 鏍规嵁闇�瑕佽繘琛岄厤缃紝濡傚彧闇�閮ㄧ讲prod绾夸笂鐜锛岃鍒犻櫎dev娴嬭瘯鐜閰嶇疆锛屽弽涔嬩害鐒讹紝鏀寔澶氱幆澧冮儴缃� - dev: { // 娴嬭瘯鐜 - name: '娴嬭瘯鐜', - script: "npm run build", // 娴嬭瘯鐜鎵撳寘鑴氭湰 - host: deployJson.test.host, // 娴嬭瘯鏈嶅姟鍣ㄥ湴鍧� - port: 22, // ssh port锛屼竴鑸粯璁�22 - username: deployJson.test.username, // 鐧诲綍鏈嶅姟鍣ㄧ敤鎴峰悕 - password: deployJson.test.password, // 鐧诲綍鏈嶅姟鍣ㄥ瘑鐮� - distPath: 'dist', // 鏈湴鎵撳寘dist鐩綍 - webDir: deployJson.test.path.slice(1), // // 娴嬭瘯鐜鏈嶅姟鍣ㄥ湴鍧� - }, - prod: { // 绾夸笂鐜 - name: '绾夸笂鐜', - script: "npm run build", // 绾夸笂鐜鎵撳寘鑴氭湰 - host: deployJson.product.host, // 娴嬭瘯鏈嶅姟鍣ㄥ湴鍧� - port: 22, // ssh port锛屼竴鑸粯璁�22 - username: deployJson.product.username, // 鐧诲綍鏈嶅姟鍣ㄧ敤鎴峰悕 - password: deployJson.product.password, // 鐧诲綍鏈嶅姟鍣ㄥ瘑鐮� - distPath: 'dist', // 鏈湴鎵撳寘dist鐩綍 - webDir: deployJson.product.path.slice(1), // // 娴嬭瘯鐜鏈嶅姟鍣ㄥ湴鍧� - } - // 鍐嶈繕鏈夊浣欑殑鐜鎸夌収杩欎釜鏍煎紡鍐欏嵆鍙� -} + privateKey: 'C:/ssh/id_rsa', // 鏈湴绉侀挜鍦板潃锛屼綅缃竴鑸湪C:/Users/xxx/.ssh/id_rsa锛岄潪蹇呭~锛屾湁绉侀挜鍒欓厤缃� + passphrase: '', // 鏈湴绉侀挜瀵嗙爜锛岄潪蹇呭~锛屾湁绉侀挜鍒欓厤缃� + projectName: '', // 椤圭洰鍚嶇О + // 鏍规嵁闇�瑕佽繘琛岄厤缃紝濡傚彧闇�閮ㄧ讲prod绾夸笂鐜锛岃鍒犻櫎dev娴嬭瘯鐜閰嶇疆锛屽弽涔嬩害鐒讹紝鏀寔澶氱幆澧冮儴缃� + dev: { + // 娴嬭瘯鐜 + name: '娴嬭瘯鐜', + preRun: '', // 娴嬭瘯鐜鎵撳寘鑴氭湰 + host: deployJson.test.host, // 娴嬭瘯鏈嶅姟鍣ㄥ湴鍧� + port: 22, // ssh port锛屼竴鑸粯璁�22 + username: deployJson.test.username, // 鐧诲綍鏈嶅姟鍣ㄧ敤鎴峰悕 + password: deployJson.test.password, // 鐧诲綍鏈嶅姟鍣ㄥ瘑鐮� + distPath: 'dist', // 鏈湴鎵撳寘dist鐩綍 + webDir: deployJson.test.path.slice(1), // // 娴嬭瘯鐜鏈嶅姟鍣ㄥ湴鍧� + bakOld: true, // 鏄惁澶囦唤鏃х殑锛屼繚鐣欎笂涓�浠芥棫鐨� + // 閮ㄧ讲棰勮 + preview: { + url: 'http://101.133.133.173:9096/', // 閮ㄧ讲鍚庢鏌ラ儴缃叉晥鏋滐紝鏌ョ湅鐨勭綉椤靛湴鍧� + openInBrowser: true, // 閮ㄧ讲瀹屾垚鍚庢槸鍚﹁嚜鍔ㄦ墦寮�閮ㄧ讲鐨勭綉椤靛湴鍧� + }, + }, + prod: { + // 绾夸笂鐜 + name: '绾夸笂鐜', + preRun: '', // 绾夸笂鐜鎵撳寘鑴氭湰 + host: deployJson.product.host, // 娴嬭瘯鏈嶅姟鍣ㄥ湴鍧� + port: 22, // ssh port锛屼竴鑸粯璁�22 + username: deployJson.product.username, // 鐧诲綍鏈嶅姟鍣ㄧ敤鎴峰悕 + password: deployJson.product.password, // 鐧诲綍鏈嶅姟鍣ㄥ瘑鐮� + distPath: 'dist', // 鏈湴鎵撳寘dist鐩綍 + webDir: deployJson.product.path.slice(1), // // 娴嬭瘯鐜鏈嶅姟鍣ㄥ湴鍧� + preview: { + url: 'http://47.100.245.85:8192/', + openInBrowser: false, + }, + }, + // 鍐嶈繕鏈夊浣欑殑鐜鎸夌収杩欎釜鏍煎紡鍐欏嵆鍙� +}; diff --git a/package.json b/package.json index ae4604a..a2c1e8a 100644 --- a/package.json +++ b/package.json @@ -93,7 +93,7 @@ "vite-plugin-compression": "^0.5.1", "vite-plugin-vue-setup-extend-plus": "^0.1.0", "vue-eslint-parser": "^9.1.0", - "yw-deploy-cli": "^1.0.2" + "yw-deploy-cli": "^1.0.3" }, "browserslist": [ "> 1%", diff --git a/src/views/project/yw/lowCode/sqlAmis/edit/SqlAmisEdit.vue b/src/views/project/yw/lowCode/sqlAmis/edit/SqlAmisEdit.vue index 236e7b0..2db9c92 100644 --- a/src/views/project/yw/lowCode/sqlAmis/edit/SqlAmisEdit.vue +++ b/src/views/project/yw/lowCode/sqlAmis/edit/SqlAmisEdit.vue @@ -1,6 +1,6 @@ <template> - <div class="h-full flex flex-col"> - <titleBox class="flex-0" style="background-color: #fff" :title="supervisor?.title"> + <div class="h-full flex flex-col bg-white"> + <titleBox class="flex-0 my-3.5" style="background-color: #fff" :title="supervisor?.title"> <template v-slot:left> <el-button icon="ele-ArrowLeft" @@ -10,6 +10,10 @@ @click="backLastPage" > </el-button> + </template> + + <template #right> + <el-button type="primary" size="large" @click="saveClick">淇濆瓨</el-button> </template> </titleBox> @@ -37,7 +41,7 @@ <Pane :size="35" class="flex-col flex"> <div class="flex-0 flex justify-between items-center mb-1 ml-1 h-[36px]"> <span class="font-bold">鍙傛暟</span> - <el-button type="primary" @click="addArg">娣诲姞</el-button> + <el-button type="default" @click="addArg">娣诲姞鍙傛暟</el-button> </div> <el-table class="flex-auto" :data="args" border> <el-table-column prop="name" width="150" label="鍚嶇О" show-overflow-tooltip> @@ -109,14 +113,11 @@ :data="otherSqlList" highlight-current-row > - <el-table-column prop="id" label="id" width="220" fixed="left" show-overflow-tooltip> </el-table-column> <el-table-column label="鏁版嵁搴�" prop="database" show-overflow-tooltip> - - <template #default="scope"> - {{ getMapDatabase(scope.row.database)?.title }} - </template> - + <template #default="scope"> + {{ getMapDatabase(scope.row.database)?.title }} + </template> </el-table-column> <el-table-column label="鎿嶄綔" width="120" fixed="right" show-overflow-tooltip> @@ -198,7 +199,8 @@ currentDockConfig.value.database = val; } sqlActiveTab.value = SqlTabType.LinkSql; - updateSqlAndRs(currentDockConfig.value.id, currentDockConfig.value); + updateSql(currentDockConfig.value.id, currentDockConfig.value); + // updateSqlAndRs(currentDockConfig.value.id, currentDockConfig.value); }; const backLastPage = () => { // setTimeout(() => { @@ -378,7 +380,7 @@ return !foundWithNoDatabase; }; -const updateSqlAndRs = (id?, sqlValue?: { database?: string; sql?: string; type?: AmisDockType }) => { +const updateSqlAndRs = () => { const apiConfig = configList.value.filter((item) => item.type === AmisDockType.Sql); if (!checkValid(true)) { @@ -391,6 +393,23 @@ rec_id: item.recordId, })); + updateSqlApi( + { + id: props.supervisor.id, + def_rs_json: dockConfigList.value.length === 0 ? null : JSON.stringify(dockConfigList.value), + async_rs_json: asyncRsList.length === 0 ? null : JSON.stringify(asyncRsList), + args: args.value.length === 0 ? null : JSON.stringify(args.value), + }, + { + loading: false, + } + ).then(() => { + ElMessage.success('淇濆瓨鎴愬姛') + emit('updatePublished', props.supervisor.id, SupervisorPublished.N); + }); +}; + +const updateSql = (id?, sqlValue?: { database?: string; sql?: string; type?: AmisDockType }) => { if (id && sqlValue) { const foundIndex = dockConfigList.value?.findIndex((item) => item.id === id); if (foundIndex > -1) { @@ -416,20 +435,6 @@ } } } - - updateSqlApi( - { - id: props.supervisor.id, - def_rs_json: dockConfigList.value.length === 0 ? null : JSON.stringify(dockConfigList.value), - async_rs_json: asyncRsList.length === 0 ? null : JSON.stringify(asyncRsList), - args: args.value.length === 0 ? null : JSON.stringify(args.value), - }, - { - loading: false, - } - ).then(() => { - emit('updatePublished', props.supervisor.id, SupervisorPublished.N); - }); }; const sqlCodeChange = debounce((val) => { @@ -440,7 +445,11 @@ return; } } - updateSqlAndRs(currentDockConfig.value.id, currentDockConfig.value); + + const id = currentDockConfig.value.id; + const sqlValue = currentDockConfig.value; + updateSql(id, sqlValue); + // updateSqlAndRs(); }, 1000); const dockConfigList = ref([]); const rsTableRef = ref<TableInstance>(null); @@ -479,7 +488,7 @@ //#region ====================== 鍙紪杈戣〃鏍� ====================== const args = ref([]); const debounceUpdateInput = debounce(() => { - updateSqlAndRs(); + // updateSqlAndRs(); }, 400); const argsInput = (val) => { debounceUpdateInput(); @@ -496,20 +505,20 @@ args.value.push(initData); } - updateSqlAndRs(); + // updateSqlAndRs(); }; const deleteArg = (index) => { args.value.splice(index, 1); - updateSqlAndRs(); + // updateSqlAndRs(); }; const databaseList = ref([]); -const getMapDatabase = (id:string)=>{ - const foundItem = databaseList.value.find(item=>item.id===id); +const getMapDatabase = (id: string) => { + const foundItem = databaseList.value.find((item) => item.id === id); return foundItem; -} +}; //#endregion onMounted(async () => { xmlJson = await supervisorApi.getLowCodeJson({ @@ -536,14 +545,14 @@ rsTableRef.value.setCurrentRow(configList.value[0]); } - if (!configList || configList.value.length === 0) { + if (!configList.value || configList.value.length === 0) { ElMessage.warning('鏆傛棤瀵规帴閰嶇疆'); } const isRsUpdate = checkRsUpdate(originConfig, configList.value); if (isRsUpdate) { // 鑷姩鏇存柊Rs - updateSqlAndRs(); + // updateSqlAndRs(); } }); //#region ====================== sql 淇濆瓨鍘嗗彶 ====================== @@ -565,7 +574,7 @@ type: 'warning', }).then(async () => { dockConfigList.value = dockConfigList.value.filter((item) => item.id !== row.id); - updateSqlAndRs(); + // updateSqlAndRs(); }); }; // 鍒犻櫎鏈繛鎺� @@ -579,7 +588,7 @@ const recordIds = apiConfig?.map((item) => item.recordId) ?? []; // 杩囨护鍑� apiConfig 涓湁鐨剅ecord; dockConfigList.value = dockConfigList.value?.filter((item) => recordIds.includes(item.id)) ?? []; - updateSqlAndRs(); + // updateSqlAndRs(); }); }; @@ -590,6 +599,11 @@ optDlgIsShow.value = true; }; +const saveClick = () => { + + updateSqlAndRs(); +}; + //#endregion // watch(() => sqlCodemirrorRef.value, (codeMirrorRef) => { // codeMirrorRef. -- Gitblit v1.9.3