Browse Source

修改快捷菜单的加载位置+部分友情链接

liangyan0105 2 years ago
parent
commit
fc32628c9b

+ 4 - 4
src/components/page/GlobalNavFooter.vue

@@ -66,7 +66,8 @@
                   v-for="item in selectList"
                   :closable="true"
                   @close="() => handleClose(item)"
-                  class="selectedItem">
+                  class="selectedItem"
+                >
                   <span style="width: 8em">
                     {{ item.name }}
                   </span>
@@ -164,7 +165,6 @@ export default {
     },
     created () {
         this.getFooterNav() // 获取快捷导航
-        this.getMenuList() // 所有菜单
     },
     methods: {
     // 底部菜单跳转
@@ -223,7 +223,6 @@ export default {
             await addBatch({ bottomMenuList: this.selectList }).then(res => {
                 if (res.success) {
                     // 无需其他操作
-                    // this.getMenuList()
                     this.$message.success('快捷菜单保存成功')
                     this.visible = false
                 }
@@ -264,8 +263,9 @@ export default {
         },
         // 设置快捷
         showDrawer () {
+            // 每次打开抽屉时,加载所有菜单
+            this.getMenuList()
             this.visible = true
-            this.getFooterNav() // 获取nav
         },
 
         // 底部导航 显示隐藏

+ 17 - 28
src/views/dashboard/MyToDo.vue

@@ -58,7 +58,7 @@
 
     <!-- 第二行-->
     <a-row :gutter="24" class="secondLine" style="height:360px;">
-      <!-- 公告 -->
+      <!-- 企业公告 -->
       <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="9" :style="{ marginBottom: '8px', paddingRight: 0 }">
         <a-card title="企业公告" :bordered="false" style="height:370px;">
           <template #extra>
@@ -75,8 +75,8 @@
       <div style="height:350">
         <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="7" :style="{ marginBottom: '8px' }">
           <a-row :gutter="24">
+            <!-- 我的计划 -->
             <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" :style="{ marginBottom: '8px', paddingRight: 0 }">
-              <!-- height:196px; -->
               <a-card title="我的计划" :bordered="false" style="width:100%;">
                 <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="12" :style="{ marginBottom: '8px', paddingRight: 0 }">
                   <p>
@@ -101,21 +101,11 @@
                 </a-col>
               </a-card>
             </a-col>
-<!-- height:196px; -->
+            <!-- 友情链接 -->
             <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" :style="{ marginBottom: '8px', paddingRight: 0 }">
               <a-card title="友情链接" :bordered="false" style="width:100%;" class="links">
                 <template #extra><a href="javascript:void(0);" @click="openMyLinks">更多</a></template>
                 <button><a href="https://www.yonyou.com/" target="_blank">用友</a></button>
-                <button><a href="http://www.dakabg.com/" target="_blank">哒咔办公</a></button>
-                <button>
-                  <a href="https://www.dingtalk.com/" target="_blank">钉钉</a>
-                </button>
-                <button><a href="https://www.11467.com" target="_blank">品医</a></button>
-                <button><a href="https://www.antgroup.com/" target="_blank">蚂蚁集团</a></button>
-                <button><a href="https://www.yonyou.com/" target="_blank">用友</a></button>
-                <button>
-                  <a href="https://www.dingtalk.com/" target="_blank">钉钉</a>
-                </button>
               </a-card>
             </a-col>
           </a-row>
@@ -190,6 +180,7 @@ import JEditor from '../../components/jeecg/JEditor.vue'
 import '@/assets/less/dataVTable.less' // 修改首页 DataV 轮播表样式
 import { getUserPermissionByTokenBottom, getListByCreateBy } from '@api/api.js'
 import { ACCESS_TOKEN } from '@/store/mutation-types'
+import { linksList } from '@api/oa/cd_links.js'
 export default {
   name: 'Mytodo',
   components: {
@@ -315,9 +306,9 @@ export default {
     this.getScheduleData() //查询日程数据
     this.getDataList() //待办数据
     this.getActiveKeyAll() //OA按钮
-    this.getAnnList() //渲染公告(已发布的)
-    this.getMenuList() // 所有菜单
+    this.getAnnList() //渲染公告(已发布)
     this.getFooterNav() // 获取快捷导航
+    this.getMyLinks() //友情链接(已发布)
   },
   computed: {
     // 系统消息计算
@@ -346,6 +337,14 @@ export default {
     this.getAnnList()
   },
   methods: {
+    // 获取友情链接
+    async getMyLinks() {
+      // params:{xx1:'',xx2:'',......}
+      await linksList().then(res => {
+        console.log('友情链接后台返回结果', res)
+      })
+    },
+
     // 获取快捷菜单
     async getFooterNav() {
       await getListByCreateBy().then(res => {
@@ -355,17 +354,6 @@ export default {
         }
       })
     },
-    // 抽屉所有菜单
-    async getMenuList() {
-      let token = Vue.ls.get(ACCESS_TOKEN)
-      let params = { token: token }
-      await getUserPermissionByTokenBottom(params).then(res => {
-        if (res.success) {
-          this.menuALL = res.result.menu
-          // console.log('所有菜单res---->', res)
-        }
-      })
-    },
 
     // 公告数据 ----|**查询条件:已发布、数据条数**|------
     async getAnnList() {
@@ -585,9 +573,10 @@ export default {
 </script>
 
 <style lang="less" scoped>
-// 单独创建页面写样式  如下
-@import '~@assets/less/mytodo.less';
 @import '~@assets/less/common.less';
+// 单独首页样式
+@import '~@assets/less/mytodo.less';
+
 .contain {
   position: absolute;
   left: 0;

+ 78 - 42
src/views/oa/my-links/add/addLinksModal.vue

@@ -3,23 +3,29 @@
     :title="title"
     v-model="addLinksModVis"
     :confirmLoading="confirmLoading"
-    @ok="handleOk"
+    @ok="onSubmit"
     @cancel="handleCancel"
     width="86%"
   >
-    <!-- tabel 加载  :form="addLinkform" -->
+    <!-- tabel 加载 -->
     <a-spin :spinning="confirmLoading">
-      <a-form :model="linkForm" :label-col="{ span: 4 }" :wrapper-col="{ span: 18 }">
+      <a-form :form="addLinkform" :label-col="{ span: 4 }" :wrapper-col="{ span: 18 }">
         <!-- 名称 地址 -->
         <a-row :gutter="24">
           <a-col :span="12">
             <a-form-item label="名称">
-              <a-input v-model="linkForm.name" placeholder="请输入名称" />
+              <a-input
+                v-decorator="['name', { rules: [{ required: true, message: '请输入名称' }] }]"
+                placeholder="请输入名称"
+              />
             </a-form-item>
           </a-col>
           <a-col :span="12">
             <a-form-item label="地址">
-              <a-input v-model="linkForm.address" placeholder="请输入地址" />
+              <a-input
+                v-decorator="['address', { rules: [{ required: true, message: '请输入地址' }] }]"
+                placeholder="请输入地址"
+              />
             </a-form-item>
           </a-col>
         </a-row>
@@ -29,7 +35,7 @@
           <a-row :gutter="24">
             <a-col :span="12">
               <a-form-item label="创建人">
-                <a-input disabled v-model="linkForm.createBy" placeholder="系统回显" />
+                <a-input disabled placeholder="系统回显" />
               </a-form-item>
             </a-col>
 
@@ -43,7 +49,6 @@
                   placeholder="系统回显"
                   @change="createTimeChange"
                   @ok="createTimeOk"
-                  v-model="linkForm.createBy"
                 />
               </a-form-item>
             </a-col>
@@ -55,23 +60,20 @@
           <a-row :gutter="24">
             <a-col :span="12">
               <a-form-item label="创建人">
-                <a-input disabled v-model="linkForm.createBy" placeholder="回显创建人" />
+                <a-input disabled placeholder="回显创建人" />
               </a-form-item>
             </a-col>
 
             <a-col :span="12">
-              <a-form-item label="创建时间">
-                <a-form-item label="创建日期">
-                  <a-date-picker
-                    disabled
-                    v-model="linkForm.createTime"
-                    style="width:100%"
-                    showTime
-                    format="YYYY-MM-DD HH:mm:ss"
-                    @change="createTimeChange"
-                    @ok="createTimeOk"
-                  />
-                </a-form-item>
+              <a-form-item label="创建日期">
+                <a-date-picker
+                  disabled
+                  style="width:100%"
+                  showTime
+                  format="YYYY-MM-DD HH:mm:ss"
+                  @change="createTimeChange"
+                  @ok="createTimeOk"
+                />
               </a-form-item>
             </a-col>
           </a-row>
@@ -80,12 +82,16 @@
         <a-row :gutter="24">
           <a-col :span="12">
             <a-form-item label="简介:" style="marginBottom:0;">
-              <a-textarea v-model="memo" placeholder="请输入简介" style="minHeight:200px;width:1200px;" />
+              <a-textarea
+                v-decorator="['memo', { rules: [{ required: true, message: '请输入入简介' }] }]"
+                placeholder="请输入简介"
+                style="minHeight:200px;width:1200px;"
+              />
             </a-form-item>
           </a-col>
           <a-col :span="12">
             <a-form-item label="是否发布:">
-              <a-radio-group v-model="linkForm.isRelease">
+              <a-radio-group v-decorator="['isRelease', { rules: [{ required: true, message: '请选择发布状态' }] }]">
                 <a-radio value="0">
                   仅存稿
                 </a-radio>
@@ -102,39 +108,69 @@
 </template>
 
 <script>
-import { Moment } from 'moment'
-// import { defineComponent } from 'vue'
-import RichText from '@views/jeecg/RichText.vue'
+import moment from 'moment'
+import 'moment/locale/zh-cn'
+import { linksUpdate, linksAdd } from '@api/oa/cd_links.js'
 export default {
     name: 'AddLinksModal',
     components: {
-        RichText
+    // RichText
     },
     data () {
         return {
-            // addLinkform: this.$form.createForm(this),
-            linkForm: {
-                name: '',
-                address: '',
-                createBy: '',
-                createTime: {},
-                isRelease: '',
-                memo: ''
-            },
+            addLinkform: this.$form.createForm(this),
+            title: '', // 弹框标题
             confirmLoading: false,
             addLinksModVis: false,
-            memo: '', // 简介
-            title: '',
-            formData: {}
+            linkInfo: {} // 表单数据(回显)
         }
     },
     created () {},
     methods: {
-    // 弹框保存
-        handleOk () {
-            // 触发表单验证 判断是否有空值  包含 简介 赋值到表单上 判断是编辑还是新增 或者没有输入
-            console.log('弹框点击了保存')
+    // 弹框确定
+        onSubmit () {
+            this.addLinkform.validateFields((err, res) => {
+                console.log('err, res', err, res)
+                if (res) {
+                    console.log('>>>>>>', res)
+                    var linkObj = {}
+                    linkObj.name = res.name
+                    linkObj.address = res.address
+                    linkObj.createBy = res.createBy
+                    linkObj.isRelease = res.isRelease
+                    linkObj.memo = this.memo
+                    // 编辑--------------------------------------
+                    if (this.linkInfo.id) {
+                        linkObj.id = this.linkInfo.id
+                        console.log('这是修改')
+                        linksUpdate(linkObj).then(res => {
+                            if (res.success) {
+                                this.$message.success('修改成功')
+                                this.addLinksModVis = false
+                                this.addLinkform.resetFields() // 清空表单
+                                this.fatherGetList() // 调用父组件的查询方法
+                            }
+                        })
+                    } else {
+                        // 新增--------------------------------------
+                        linksAdd(linkObj).then(res => {
+                            if (res.success) {
+                                console.log('新增的内容', res)
+                                this.addLinksModVis = false
+                                this.$message.success('新增成功')
+                                this.addLinkform.resetFields() // 清空
+                                this.memo = '' // 清空富文本
+                                this.fatherGetList()
+                            }
+                        })
+                    }
+                } else {
+                    this.addLinkform.resetFields() // 清空表单
+                    this.$message.error('请填写友情链接必要信息')
+                }
+            })
         },
+
         close () {
             this.$emit('close')
             this.visible = false

+ 7 - 6
src/views/oa/myLinks.vue

@@ -40,6 +40,7 @@
         <a style="margin-left: 24px" @click="onClearSelected">清空</a>
       </div>
 
+      <!-- 友情链接表 -->
       <a-row>
         <a-table
           bordered
@@ -100,7 +101,7 @@
     </div>
 
     <!-- 新增弹框 组件 -->
-    <addLinks-modal ref="AddLinksModal" @ok="modalFormOk"></addLinks-modal>
+    <addLinks-modal ref="AddLinksModal" :fatherGetList="getLinksList" @ok="modalFormOk"></addLinks-modal>
   </a-card>
 </template>
 
@@ -163,7 +164,7 @@ export default {
         }
     },
     created () {
-        this.getLinksList()
+        this.getLinksList() // 友情链接
     },
     methods: {
     // 勾选
@@ -171,14 +172,14 @@ export default {
             this.selectedRowKeys = keys
             this.selectedRows = rows
         },
+        // 友情链接 查询
         getLinksList () {
             this.$nextTick(() => {
                 linksList(this.queryParam).then(res => {
                     // console.log('>>>>', this.queryParam)
                     if (res.success) {
                         this.annList = res.result.records
-                        console.log('链接公告=====', this.annList)
-
+                        console.log('链接公告==', this.annList)
                         this.pagination = {
                             total: res.result.total,
                             current: res.result.current,
@@ -218,8 +219,8 @@ export default {
         // 分页、排序、筛选变化时触发
         handleTableChange (pagination, filters, sorter) {
             console.log('当前页信息>>>>', pagination)
-            // this.queryParam.pageNo = pagination.current
-            // this.getLinksList()
+            this.queryParam.pageNo = pagination.current
+            this.getLinksList()
         },
 
         // 发布