소스 검색

首页【友情链接】完成(缺少真实数据录入)

liangyan0105 2 년 전
부모
커밋
dc6c7fa4a2

+ 3 - 0
src/assets/less/drawer.css

@@ -74,6 +74,9 @@
   background-color: rgba(19, 116, 206, 0.5);
   border-radius: 10px;
 }
+.searchLine .LevelOneMenu {
+  margin-top: 6px;
+}
 .searchLine .LevelTwoMenu {
   display: flex;
   flex-flow: row wrap;

+ 5 - 0
src/assets/less/drawer.less

@@ -82,8 +82,13 @@
     background-color: rgba(19, 116, 206, 0.5);
     border-radius: 10px;
   }
+  .LevelOneMenu {
+    // background-color: orange;
+    margin-top: 6px;
+  }
   // 二级菜单
   .LevelTwoMenu {
+    // background-color: pink;
     display: flex;
     flex-flow: row wrap;
     box-sizing: border-box;

+ 9 - 3
src/assets/less/mytodo.css

@@ -46,7 +46,7 @@
   flex-flow: row wrap;
   box-sizing: border-box;
 }
-#home .secondLine .links button {
+#home .secondLine .links .itemLink {
   float: left;
   border-radius: 2px;
   border: none;
@@ -57,9 +57,15 @@
   justify-content: center;
   align-items: center;
 }
-#home .secondLine .links button a {
+#home .secondLine .links .itemLink a {
   color: white;
-  font-size: 18px;
+  font-size: 16px;
+}
+#home .secondLine .links .itemLink a span {
+  display: block;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
 }
 #home .secondLine .links button:hover {
   background-color: #003049;

+ 8 - 3
src/assets/less/mytodo.less

@@ -58,7 +58,7 @@
       flex-flow: row wrap;
       // justify-content: space-between;
       box-sizing: border-box;
-      button {
+      .itemLink {
         float: left;
         border-radius: 2px;
         border: none;
@@ -71,8 +71,13 @@
         align-items: center;
         a {
           color: white;
-          font-size: 18px;
-          // padding: 2px;
+          font-size: 16px;
+          span {
+            display: block;
+            overflow: hidden;
+            text-overflow: ellipsis;
+            white-space: nowrap;
+          }
         }
       }
       button:hover {

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

@@ -105,7 +105,7 @@
           <a-card title="" :bordered="false" class="searchLine">
             <!-- 一级菜单 -->
             <a-row v-for="menu in menuALL" :key="menu.name">
-              <a-col :span="4">
+              <a-col :span="4" class="LevelOneMenu">
                 <span>{{ menu.name }}:</span>
               </a-col>
               <!-- 二级菜单 -->
@@ -327,9 +327,6 @@ export default {
         font-size: 12px;
         color: white;
         font-weight: 700;
-        overflow: hidden;
-        white-space: nowrap;
-        text-overflow: ellipsis;
       }
     }
     a.setBtn:hover,

+ 7 - 5
src/views/dashboard/MyToDo.vue

@@ -71,7 +71,7 @@
         </a-card>
       </a-col>
 
-      <!-- 计划  友情链接 style="height:350"-->
+      <!-- 计划  友情链接 -->
       <div>
         <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="7" :style="{ marginBottom: '8px' }">
           <a-row :gutter="24">
@@ -105,9 +105,11 @@
             <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%;height:188px">
                 <template #extra><a href="javascript:void(0);" @click="openMyLinks">更多</a></template>
-                <div v-for="item in linksList" :key="item.id" class="links">
-                  <button>
-                    <a href="https://www.yonyou.com/" target="_blank">{{ item.name }}</a>
+                <div v-for="item in linksList.slice(0, 8)" :key="item.id" class="links">
+                  <button class="itemLink">
+                    <a href="https://www.yonyou.com/" target="_blank">
+                      <span width="2em"> {{ item.name }}</span>
+                    </a>
                   </button>
                 </div>
               </a-card>
@@ -345,7 +347,7 @@ export default {
     // 获取友情链接
     async getMyLinks() {
       // params:{xx1:'',xx2:'',......}
-      await linksList().then(res => {
+      await linksList({isRelease:'1'}).then(res => {
         console.log('友情链接后台返回结果', res)
         this.linksList = res.result.records
         console.log('this.linksList', this.linksList)

+ 50 - 10
src/views/oa/my-links/add/addLinksModal.vue

@@ -23,7 +23,7 @@
           <a-col :span="12">
             <a-form-item label="地址">
               <a-input
-                v-decorator="['address', { rules: [{ required: true, message: '请输入地址' }] }]"
+                v-decorator="['link', { rules: [{ required: true, message: '请输入地址' }] }]"
                 placeholder="请输入地址"
               />
             </a-form-item>
@@ -60,7 +60,11 @@
           <a-row :gutter="24">
             <a-col :span="12">
               <a-form-item label="创建人">
-                <a-input disabled placeholder="回显创建人" />
+                <!-- <a-input disabled placeholder="回显创建人" /> -->
+                <a-input
+                  v-decorator="['createBy', { rules: [{ required: false, message: '请输入创建人' }] }]"
+                  disabled
+                />
               </a-form-item>
             </a-col>
 
@@ -73,6 +77,7 @@
                   format="YYYY-MM-DD HH:mm:ss"
                   @change="createTimeChange"
                   @ok="createTimeOk"
+                  v-decorator="['createTime', { rules: [{ required: false, message: '请选择紧创建日期' }] }]"
                 />
               </a-form-item>
             </a-col>
@@ -83,7 +88,7 @@
           <a-col :span="12">
             <a-form-item label="简介:" style="marginBottom:0;">
               <a-textarea
-                v-decorator="['memo', { rules: [{ required: true, message: '请输入入简介' }] }]"
+                v-decorator="['briefIntroduction', { rules: [{ required: true, message: '请输入入简介' }] }]"
                 placeholder="请输入简介"
                 style="minHeight:200px;width:1200px;"
               />
@@ -119,26 +124,58 @@ export default {
     data () {
         return {
             addLinkform: this.$form.createForm(this),
-            title: '', // 弹框标题
             confirmLoading: false,
             addLinksModVis: false,
-            linkInfo: {} // 表单数据(回显)
+            linkInfo: {}, // 表单数据(回显)
+            title: '' // 弹框标题
+        }
+    },
+    // 接收父组件查询友情链接的方法
+    props: {
+        fatherGetList: {
+            type: Function,
+            default: null
         }
     },
     created () {},
     methods: {
-    // 弹框确定
+    // 回显表单
+        getLinkInfo () {
+            this.$nextTick(() => {
+                // 判断是否回显(创建人、创建日期)
+                if (this.title == '新增友情链接') {
+                    this.addLinkform.setFieldsValue({
+                        name: this.linkInfo.name,
+                        link: this.linkInfo.link,
+                        // createBy: this.linkInfo.createBy,
+                        // createTime: this.linkInfo.createTime,
+                        briefIntroduction: this.linkInfo.briefIntroduction,
+                        isRelease: this.linkInfo.isRelease
+                    })
+                } else {
+                    this.addLinkform.setFieldsValue({
+                        name: this.linkInfo.name,
+                        link: this.linkInfo.link,
+                        briefIntroduction: this.linkInfo.briefIntroduction,
+                        isRelease: this.linkInfo.isRelease,
+                        createBy: this.linkInfo.createBy,
+                        createTime: moment(this.linkInfo.createTime, 'YYYY-MM-DD HH:mm:ss')
+                    })
+                }
+            })
+        },
+        // 弹框确定
         onSubmit () {
             this.addLinkform.validateFields((err, res) => {
                 console.log('err, res', err, res)
-                if (res) {
+                if (res && res !== '') {
                     console.log('>>>>>>', res)
                     var linkObj = {}
                     linkObj.name = res.name
-                    linkObj.address = res.address
+                    linkObj.link = res.link
                     linkObj.createBy = res.createBy
                     linkObj.isRelease = res.isRelease
-                    linkObj.memo = this.memo
+                    linkObj.briefIntroduction = res.briefIntroduction // 简要介绍
                     // 编辑--------------------------------------
                     if (this.linkInfo.id) {
                         linkObj.id = this.linkInfo.id
@@ -159,7 +196,7 @@ export default {
                                 this.addLinksModVis = false
                                 this.$message.success('新增成功')
                                 this.addLinkform.resetFields() // 清空
-                                this.memo = '' // 清空富文本
+                                this.briefIntroduction = '' // 简要介绍
                                 this.fatherGetList()
                             }
                         })
@@ -177,6 +214,9 @@ export default {
         },
         handleCancel () {
             this.close()
+            // this.$emit('close')
+            // this.visible = false
+            // this.addLinkform.resetFields() // 清空表单
         },
         createTimeChange (value, dateString) {
             console.log('选择的时间:', value)

+ 58 - 23
src/views/oa/myLinks.vue

@@ -54,10 +54,10 @@
         >
           <!-- 发布 -->
           <span slot="isReleaseSlot" slot-scope="text, record">
-            <a-tag color="orange" v-if="record.isRelease == '0'">
+            <a-tag color="#f50" v-if="record.isRelease == '0'">
               未发布
             </a-tag>
-            <a-tag color="green" v-else>
+            <a-tag color="#87d068" v-else>
               已发布
             </a-tag>
           </span>
@@ -107,7 +107,7 @@
 
 <script>
 import AddLinksModal from '@views/oa/my-links/add/addLinksModal.vue'
-import { linksList } from '@api/oa/cd_links'
+import { linksList, linksQueryById, linksDelete, linksReleseUpdate } from '@api/oa/cd_links'
 export default {
     name: 'MyLinks',
     components: {
@@ -137,7 +137,12 @@ export default {
                 },
                 {
                     title: '地址',
-                    dataIndex: 'address',
+                    dataIndex: 'link',
+                    align: 'center'
+                },
+                {
+                    title: '简要介绍',
+                    dataIndex: 'briefIntroduction',
                     align: 'center'
                 },
                 {
@@ -167,19 +172,14 @@ export default {
         this.getLinksList() // 友情链接
     },
     methods: {
-    // 勾选
-        onSelectChange (keys, rows) {
-            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)
+                        this.linksData = res.result.records
+                        console.log('链接公告==', this.linksData)
                         this.pagination = {
                             total: res.result.total,
                             current: res.result.current,
@@ -190,6 +190,11 @@ export default {
             })
         },
 
+        // 查询
+        searchQuery () {
+            this.getLinksList()
+        },
+
         // 新增
         addOpen () {
             console.log('点击新增,负责打开弹框,剩下功能在子组件的保存按钮')
@@ -199,16 +204,25 @@ export default {
         },
         // 编辑
         editLinks (obj) {
-            console.log('点击了编辑,该项公共的ID是:', obj)
+            console.log('点击编辑,该链接是:', obj)
             this.$refs.AddLinksModal.addLinksModVis = true
             this.$refs.AddLinksModal.title = '编辑友情链接'
-            this.$refs.AddLinksModal.formData = obj
-        },
-        // 查询
-        searchQuery () {
-            this.getLinksList()
+            // 根据 ID 查询对应友情链接 params:{id:''}
+            linksQueryById({ id: obj.id }).then(res => {
+                if (res.success) {
+                    console.log('根据id查询res:', res)
+                    this.$refs.AddLinksModal.linkInfo = res.result
+                    console.log('this.$refs.AddLinksModal.linkInfo:', this.$refs.AddLinksModal.linkInfo)
+                    this.$refs.AddLinksModal.getLinkInfo()
+                }
+            })
         },
 
+        // 勾选
+        onSelectChange (keys, rows) {
+            this.selectedRowKeys = keys
+            this.selectedRows = rows
+        },
         // 批量删除
         batchDel () {},
         // 清空
@@ -216,7 +230,6 @@ export default {
         // ??
         modalFormOk () {},
         // 分页、排序、筛选变化时触发
-        // 分页、排序、筛选变化时触发
         handleTableChange (pagination, filters, sorter) {
             console.log('当前页信息>>>>', pagination)
             this.queryParam.pageNo = pagination.current
@@ -225,16 +238,38 @@ export default {
 
         // 发布
         sendLinks (id) {
-            console.log('点击了发布')
+            console.log('发布')
+            linksReleseUpdate({ id: id, isRelease: '1' }).then(res => {
+                if (res.success) {
+                    this.getLinksList()
+                    this.$message.success('发布成功')
+                }
+            })
+        },
+        // 取消发布
+        saveLinks (id) {
+            console.log('取消发布')
+            linksReleseUpdate({ id: id, isRelease: '0' }).then(res => {
+                if (res.success) {
+                    this.$message.success('取消发布')
+                    this.getLinksList()
+                }
+            })
         },
-        saveLinks () {},
         // 撤销
         backLinks (id) {
             console.log('点击了撤销')
         },
         // 操作  删除
-        delLinks () {
-            console.log('点击了删除,需要发请求、确定提示、重新渲染')
+        delLinks (record) {
+            // console.log('点击了删除,需要发请求、确定提示、重新渲染')
+            linksDelete({ id: record.id }).then(res => {
+                if (res.success) {
+                    console.log('res', res)
+                    this.getLinksList()
+                    this.$message.success('删除成功')
+                }
+            })
         }
     },
     computed: {