From-wh 2 лет назад
Родитель
Сommit
c534c5923c

+ 2 - 0
template/admin/src/pages/setting/systemMenus/index.vue

@@ -101,6 +101,7 @@
       @on-visible-change="modalchange"
     >
       <div class="search-rule">
+        <Alert>基础接口,可多选,并且添加后不会再展示出现;删除权限后才会出现;公共接口,可多选,并且添加后会继续展示;</Alert>
         <Input
           class="mr10"
           v-model="searchRule"
@@ -114,6 +115,7 @@
         <Button class="mr10" type="primary" @click="searchRules">搜索</Button>
         <Button @click="init">重置</Button>
       </div>
+
       <Tabs v-model="routeType" @on-click="changTab">
         <TabPane label="公共接口" name="1"></TabPane>
         <TabPane label="基础接口" name="0"></TabPane>

+ 11 - 1
template/admin/src/pages/system/codeGeneration/components/FoundationFor.vue

@@ -117,7 +117,8 @@
               </Select>
             </template>
             <template slot-scope="{ row, index }" slot="action">
-              <a @click="del(row, index)">删除</a>
+              <a v-if="!foundation.isTable" @click="del(row, index)">删除</a>
+              <span v-else>--</span>
             </template>
           </Table>
         </div>
@@ -196,6 +197,12 @@ export default {
           width: 70,
           align: 'center',
         },
+        {
+          title: '操作',
+          slot: 'action',
+          width: 70,
+          align: 'center',
+        },
       ],
       fromTypeList: [
         {
@@ -330,6 +337,9 @@ export default {
         this.columnTypeList = res.data.types;
       });
     },
+    del(index) {
+      this.tableField.splice(index, 1);
+    },
   },
 };
 </script>

+ 47 - 1
template/admin/src/pages/system/codeGeneration/list.vue

@@ -1,8 +1,8 @@
 <template>
   <div>
-
     <Card :bordered="false" dis-hover class="ivu-mt">
       <Button type="primary" @click="groupAdd()" class="mr20">代码生成</Button>
+      <Button type="success" @click="buildCode()" class="mr20">重新发布</Button>
       <Table
         :columns="columns1"
         :data="tabList"
@@ -84,6 +84,21 @@
         </div>
       </div>
     </Modal>
+    <Modal
+      v-model="buildModals"
+      scrollable
+      title="终端"
+      footer-hide
+      closable
+      :mask-closable="false"
+      width="60%"
+      :before-close="editModalChange"
+    >
+      <Alert type="warning">当前终端未运行于安装服务下,部分命令可能无法执行.</Alert>
+      <div>
+        <div v-for="(item, index) in codeBuildList" :key="index">{{ item }}</div>
+      </div>
+    </Modal>
   </div>
 </template>
 
@@ -91,6 +106,8 @@
 import { mapState } from 'vuex';
 import { crudList, crudDet } from '@/api/systemCodeGeneration';
 import * as monaco from 'monaco-editor';
+import { getCookies, removeCookies } from '@/libs/util';
+import Setting from '@/setting';
 
 export default {
   data() {
@@ -108,7 +125,9 @@ export default {
         title: '',
       },
       loading: false,
+      buildModals: false,
       tabList: [],
+      codeBuildList: [],
       total: 0,
       columns1: [
         {
@@ -163,7 +182,34 @@ export default {
   mounted() {
     this.getList();
   },
+  beforeDestroy() {
+    if (this.source) {
+      this.source.close(); //关闭EventSource
+    }
+  },
   methods: {
+    buildCode() {
+      this.buildModals = true;
+      if (typeof EventSource !== 'undefined') {
+        //支持eventSource
+        var postURL = Setting.apiBaseURL + '/system/crud/npm?token=' + getCookies('token');
+        this.source = new EventSource(postURL);
+        let self = this; //因EventSource中this的指向变了,所以要提前存储一下
+        this.source.onopen = function (res) {
+          console.log('项目链接Eventsource成功', res);
+        };
+        this.source.onmessage = function (data) {
+          //代码块
+          console.log(data);
+        };
+        this.source.onerror = function (err) {
+          console.log('项目Eventsource链接失败', err);
+          //链接失败后EventSource会每隔三秒左右重新发起链接
+        };
+      } else {
+        console.log('暂不支持EventSource');
+      }
+    },
     // 跳转到组合数据列表页面
     goList(row) {
       this.$router.push({