lsw 1 year ago
parent
commit
81b761347e

+ 47 - 0
admin-ui/src/assets/styles/extend.scss

@@ -407,3 +407,50 @@
     padding-right: 15px;
   }
 }
+.roleName {
+  padding-left: 5px;
+  padding-right: 5px;
+  color: #7a7a7a;
+}
+.dashboard-editor-container {
+  padding: 15px 20px 0px 20px;
+  .mtitle {
+    margin-bottom: 10px;
+    margin-top: -15px;
+  }
+  .chart-wrapper {
+    margin-top: 12px;
+    overflow: hidden;
+    .pop {
+      float: left;
+      width: 33.33%;
+      overflow: hidden;
+      .out {
+        margin: 10px 10px 20px 0px;
+        .int {
+          box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
+          background: white;
+          border-radius: 5px;
+          padding: 5px 15px 10px 15px;
+          overflow: hidden;
+        }
+      }
+    }
+    .noticeList {
+      margin-top: -10px;
+      .nitem {
+        padding: 9px 0px 9px 0px;
+        overflow: hidden;
+        cursor: pointer;
+        color: #5d5d5d;
+        .ntitle {
+          float: left;
+          width: 70%;
+        }
+        .ndate {
+          float: right;
+        }
+      }
+    }
+  }
+}

+ 6 - 0
admin-ui/src/store/modules/user.js

@@ -30,6 +30,9 @@ const user = {
     deptId: (state, deptId) => {
       state.deptId = deptId
     },
+    roleName: (state, roleName) => {
+      state.roleName = roleName
+    },
     deptNameStr: (state, deptNameStr) => {
       state.deptNameStr = deptNameStr
     },
@@ -85,6 +88,9 @@ const user = {
             commit('deptNameStr', user.dept.deptName||'')
             commit('deptId', user.dept.deptId);
           }
+          if(user.roles&&user.roles.length>0){
+             commit('roleName', user.roles[0].roleName);
+          }
           commit('SET_ID', user.userId)
           commit('SET_AVATAR', avatar)
           resolve(res)

+ 9 - 126
admin-ui/src/views/index.vue

@@ -1,140 +1,23 @@
 <template>
-  <div class="dashboard-editor-container">
-    <div class="mtitle">
-      <span style="font-size: 19px">欢迎使用,{{ user.nickName }}</span>
-      <iframe
-        allowtransparency="true"
-        frameborder="0"
-        width="180"
-        height="36"
-        scrolling="no"
-        style="padding-top: 10px"
-        src="//tianqi.2345.com/plugin/widget/index.htm?s=3&z=2&t=0&v=0&d=2&bd=0&k=&f=#545555&ltf=#545555&htf=ffffff&q=1&e=1&a=1&c=72036&w=180&h=36&align=center"
-      ></iframe>
-    </div>
-    <!--散货过车和重量监控-->
-    <div class="chart-wrapper">
-      <div class="pop" style="width: 70%">
-        <div class="out">
-          <div class="int">
-            <div class="bos" style="border: 0px">
-              <div class="lab">
-                <div class="bsg"></div>
-                <div class="tit">账户信息</div>
-              </div>
-              <companyInfo></companyInfo>
-            </div>
-          </div>
-        </div>
-        <div class="out">
-          <div class="int">
-            <div class="bos" style="border: 0px">
-              <div class="lab">
-                <div class="bsg"></div>
-                <div class="tit">账户信息</div>
-              </div>
-            </div>
-          </div>
-        </div>
-      </div>
-      <div class="pop" style="width: 30%">
-        <div class="out" style="margin-right: 0px">
-          <div class="int">
-            <div class="bos" style="border: 0px">
-              <div class="lab">
-                <div class="bsg"></div>
-                <div class="tit">用户信息</div>
-              </div>
-            </div>
-          </div>
-        </div>
-      </div>
-    </div>
-  </div>
+  <company v-if="user.companyId"></company>
+  <admin v-else></admin>
 </template>
 
 <script>
-import PanelGroup from './dashboard/PanelGroup';
-import BarChart from './dashboard/BarChart';
-import Vue from 'vue';
+import admin from '@/views/index_admin';
+import company from '@/views/index_company';
 export default {
   name: 'Index',
-  components: {
-    PanelGroup,
-    BarChart
+  components:{
+    admin,
+    company
   },
   data() {
     return {
-      user: this.$store.state.user,
-      data: { count: {}, pass: {} },
-      deptId: this.$store.state.user.deptId,
-      time: this.util.getDate('times'),
-      chartData1: [], //散货
-      chartData2: [] //集装箱
+      user: this.$store.state.user
     };
-  },
-  watch: {
-    deptId(val) {
-      this.getData();
-      this.getWeek();
-    }
-  },
-  created() {
-    //this.getData();
-    //this.getWeek();
-  },
-  methods: {
-    getData() {
-      this.ajax({ url: '/home/index', data: { deptId: this.deptId } }).then((response) => {
-        this.data = response.data;
-      });
-    },
-    getWeek() {
-      this.chartData1 = [];
-      this.chartData2 = [];
-      this.ajax({ url: '/home/weekSelect', data: { deptId: this.deptId } }).then((response) => {
-        response.data.s.forEach((item) => {
-          this.chartData1.push({ name: item.date, value: ((item.success / item.total) * 100).toFixed(0) });
-        });
-        response.data.j.forEach((item) => {
-          this.chartData2.push({ name: item.date, value: ((item.success / item.total) * 100).toFixed(0) });
-        });
-      });
-    }
   }
 };
 </script>
 
-<style lang="scss" scoped>
-.dashboard-editor-container {
-  padding: 15px 20px 0px 20px;
-  .mtitle {
-    margin-bottom: 20px;
-    margin-top: -15px;
-  }
-  .chart-wrapper {
-    margin-top: 12px;
-    overflow: hidden;
-    .pop {
-      float: left;
-      width: 33.33%;
-      overflow: hidden;
-      .out {
-        margin: 10px 10px 20px 0px;
-        .int {
-          box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
-          background: white;
-          border-radius: 5px;
-          padding: 15px 15px 10px 15px;
-          overflow: hidden;
-        }
-      }
-    }
-  }
-  .bos {
-    float: left;
-    padding: 0px 10px 0px 10px;
-    width: 100%;
-  }
-}
-</style>
+<style lang="scss" scoped></style>

+ 138 - 0
admin-ui/src/views/index_admin.vue

@@ -0,0 +1,138 @@
+<template>
+  <div class="dashboard-editor-container">
+    <div class="mtitle">
+      <span style="font-size: 19px">欢迎使用,{{ user.nickName }}</span>
+      <iframe
+        allowtransparency="true"
+        frameborder="0"
+        width="180"
+        height="36"
+        scrolling="no"
+        style="padding-top: 10px"
+        src="//tianqi.2345.com/plugin/widget/index.htm?s=3&z=2&t=0&v=0&d=2&bd=0&k=&f=#545555&ltf=#545555&htf=ffffff&q=1&e=1&a=1&c=72036&w=180&h=36&align=center"
+      ></iframe>
+    </div>
+    <div class="chart-wrapper">
+      <div class="pop" style="width: 70%">
+        <div class="out">
+          <div class="int">
+            <div class="bos" style="border: 0px">
+              <div class="lab">
+                <div class="bsg"></div>
+                <div class="tit">账户信息</div>
+              </div>
+              <companyInfo></companyInfo>
+            </div>
+          </div>
+        </div>
+        <div class="out">
+          <div class="int">
+            <div class="bos" style="border: 0px">
+              <div class="lab">
+                <div class="bsg"></div>
+                <div class="tit">账户信息</div>
+              </div>
+            </div>
+          </div>
+        </div>
+      </div>
+      <div class="pop" style="width: 30%">
+        <div class="out" style="margin-right: 0px">
+          <div class="int">
+            <div class="bos" style="border: 0px">
+              <div class="lab">
+                <div class="bsg"></div>
+                <div class="tit">用户信息</div>
+              </div>
+            </div>
+          </div>
+        </div>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+import PanelGroup from './dashboard/PanelGroup';
+import BarChart from './dashboard/BarChart';
+import Vue from 'vue';
+export default {
+  name: 'Index',
+  components: {
+    PanelGroup,
+    BarChart
+  },
+  data() {
+    return {
+      user: this.$store.state.user,
+      data: { count: {}, pass: {} },
+      time: this.util.getDate('times'),
+      chartData1: [], //散货
+      chartData2: [] //集装箱
+    };
+  },
+  watch: {
+    deptId(val) {
+      this.getData();
+      this.getWeek();
+    }
+  },
+  created() {
+    //this.getData();
+    //this.getWeek();
+  },
+  methods: {
+    getData() {
+      this.ajax({ url: '/home/index', data: { deptId: this.deptId } }).then((response) => {
+        this.data = response.data;
+      });
+    },
+    getWeek() {
+      this.chartData1 = [];
+      this.chartData2 = [];
+      this.ajax({ url: '/home/weekSelect', data: { deptId: this.deptId } }).then((response) => {
+        response.data.s.forEach((item) => {
+          this.chartData1.push({ name: item.date, value: ((item.success / item.total) * 100).toFixed(0) });
+        });
+        response.data.j.forEach((item) => {
+          this.chartData2.push({ name: item.date, value: ((item.success / item.total) * 100).toFixed(0) });
+        });
+      });
+    }
+  }
+};
+</script>
+
+<style lang="scss" scoped>
+.dashboard-editor-container {
+  padding: 15px 20px 0px 20px;
+  .mtitle {
+    margin-bottom: 20px;
+    margin-top: -15px;
+  }
+  .chart-wrapper {
+    margin-top: 12px;
+    overflow: hidden;
+    .pop {
+      float: left;
+      width: 33.33%;
+      overflow: hidden;
+      .out {
+        margin: 10px 10px 20px 0px;
+        .int {
+          box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
+          background: white;
+          border-radius: 5px;
+          padding: 15px 15px 10px 15px;
+          overflow: hidden;
+        }
+      }
+    }
+  }
+  .bos {
+    float: left;
+    padding: 0px 10px 0px 10px;
+    width: 100%;
+  }
+}
+</style>

+ 104 - 0
admin-ui/src/views/index_company.vue

@@ -0,0 +1,104 @@
+<template>
+  <div class="dashboard-editor-container">
+    <div class="mtitle">
+      <span style="font-size: 19px">
+        <span>{{ user.nickName }}</span>
+        <span class="roleName" v-if="user.roleName">({{ user.roleName }})</span>
+        <span>您好,欢迎使用承揽时代企业端</span>
+      </span>
+      <iframe
+        allowtransparency="true"
+        frameborder="0"
+        width="180"
+        height="36"
+        scrolling="no"
+        style="padding-top: 10px"
+        src="//tianqi.2345.com/plugin/widget/index.htm?s=3&z=2&t=0&v=0&d=2&bd=0&k=&f=#545555&ltf=#545555&htf=ffffff&q=1&e=1&a=1&c=72036&w=180&h=36&align=center"
+      ></iframe>
+    </div>
+    <div class="chart-wrapper">
+      <div class="pop" style="width: 65%">
+        <div class="out">
+          <div class="int">
+            <div class="bos">
+              <div class="lab">
+                <div class="bsg"></div>
+                <div class="tit">账户信息</div>
+              </div>
+              <companyInfo></companyInfo>
+            </div>
+          </div>
+        </div>
+        <div class="out">
+          <div class="int">
+            <div class="bos">
+              <div class="lab">
+                <div class="bsg"></div>
+                <div class="tit">账户信息</div>
+              </div>
+            </div>
+          </div>
+        </div>
+      </div>
+      <!--通知消息-->
+      <div class="pop" style="width: 35%">
+        <div class="out" style="margin-right: 0px">
+          <div class="int">
+            <div class="bos">
+              <div class="lab">
+                <div class="bsg"></div>
+                <div class="tit">通知消息</div>
+              </div>
+              <div class="noticeList" v-if="noticeList.length > 0">
+                <div class="nitem" v-for="(item, index) in noticeList" :key="item.id" @click="op('noticeDetail', item)">
+                  <div class="ntitle omit">{{ item.title }}</div>
+                  <div class="ndate">{{ item.createTime.substring(0, 11) }}</div>
+                </div>
+              </div>
+              <el-empty v-else description="暂无通知消息" :image-size="100"></el-empty>
+            </div>
+          </div>
+        </div>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+import noticeDetail from '@/views/work/notice/detail';
+export default {
+  components: {},
+  data() {
+    return {
+      user: this.$store.state.user,
+      noticeList: [],
+      data: {}
+    };
+  },
+  created() {
+    this.getData();
+  },
+  methods: {
+    getData() {
+      /* this.ajax({ url: '/home/index', data: { deptId: this.deptId } }).then((response) => {
+        this.data = response.data;
+      }); */
+      this.ajax({ url: '/work/notice/queryList' }).then((response) => {
+        this.noticeList = response.data;
+      });
+    },
+    op(tag, row) {
+      if (tag == 'noticeDetail') {
+        this.iframe({ obj: noticeDetail, param: { id: row.id }, title: row.title, width: '58%', height: '75%' });
+        return;
+      }
+    }
+  }
+};
+</script>
+
+<style lang="scss" scoped>
+.bos {
+  border: 0px;
+}
+</style>

+ 0 - 98
admin-ui/src/views/index_v1.vue

@@ -1,98 +0,0 @@
-<template>
-  <div class="dashboard-editor-container">
-
-    <panel-group @handleSetLineChartData="handleSetLineChartData" />
-
-    <el-row style="background:#fff;padding:16px 16px 0;margin-bottom:32px;">
-      <line-chart :chart-data="lineChartData" />
-    </el-row>
-
-    <el-row :gutter="32">
-      <el-col :xs="24" :sm="24" :lg="8">
-        <div class="chart-wrapper">
-          <raddar-chart />
-        </div>
-      </el-col>
-      <el-col :xs="24" :sm="24" :lg="8">
-        <div class="chart-wrapper">
-          <pie-chart />
-        </div>
-      </el-col>
-      <el-col :xs="24" :sm="24" :lg="8">
-        <div class="chart-wrapper">
-          <bar-chart />
-        </div>
-      </el-col>
-    </el-row>
-
-    
-  </div>
-</template>
-
-<script>
-import PanelGroup from './dashboard/PanelGroup'
-import LineChart from './dashboard/LineChart'
-import RaddarChart from './dashboard/RaddarChart'
-import PieChart from './dashboard/PieChart'
-import BarChart from './dashboard/BarChart'
-
-const lineChartData = {
-  newVisitis: {
-    expectedData: [100, 120, 161, 134, 105, 160, 165],
-    actualData: [120, 82, 91, 154, 162, 140, 145]
-  },
-  messages: {
-    expectedData: [200, 192, 120, 144, 160, 130, 140],
-    actualData: [180, 160, 151, 106, 145, 150, 130]
-  },
-  purchases: {
-    expectedData: [80, 100, 121, 104, 105, 90, 100],
-    actualData: [120, 90, 100, 138, 142, 130, 130]
-  },
-  shoppings: {
-    expectedData: [130, 140, 141, 142, 145, 150, 160],
-    actualData: [120, 82, 91, 154, 162, 140, 130]
-  }
-}
-
-export default {
-  name: 'Index',
-  components: {
-    PanelGroup,
-    LineChart,
-    RaddarChart,
-    PieChart,
-    BarChart
-  },
-  data() {
-    return {
-      lineChartData: lineChartData.newVisitis
-    }
-  },
-  methods: {
-    handleSetLineChartData(type) {
-      this.lineChartData = lineChartData[type]
-    }
-  }
-}
-</script>
-
-<style lang="scss" scoped>
-.dashboard-editor-container {
-  padding: 32px;
-  background-color: rgb(240, 242, 245);
-  position: relative;
-
-  .chart-wrapper {
-    background: #fff;
-    padding: 16px 16px 0;
-    margin-bottom: 32px;
-  }
-}
-
-@media (max-width:1024px) {
-  .chart-wrapper {
-    padding: 8px;
-  }
-}
-</style>

+ 43 - 0
admin-ui/src/views/work/notice/detail.vue

@@ -0,0 +1,43 @@
+<template>
+  <div class="cmain">
+    <div v-html="form.contents" class="mcontents"></div>
+  </div>
+</template>
+
+<script>
+export default {
+  data() {
+    return {
+      form: {}
+    };
+  },
+  props: {
+    param: {
+      type: Object,
+      default: () => {
+        return {};
+      }
+    },
+    layerid: {
+      type: String
+    }
+  },
+  mounted() {
+    if (this.param.id) {
+      this.ajax({ url: '/work/notice/detail/' + this.param.id }).then((response) => {
+        this.form = response.data;
+        this.form.contents = response.data.contents.replace(new RegExp('/profile/upload/', 'g'), this.baseUrl + '/profile/upload/');
+      });
+    }
+  },
+  methods: {}
+};
+</script>
+<style lang="scss">
+.mcontents {
+  padding: 0px 10px 10px 10px;
+  img {
+    width: 100%;
+  }
+}
+</style>

+ 1 - 0
admin-ui/src/views/work/notice/edit.vue

@@ -61,6 +61,7 @@ export default {
     if (this.param.id) {
       this.ajax({ url: '/work/notice/detail/' + this.param.id }).then((response) => {
         this.form = response.data;
+        this.form.contents = response.data.contents.replace(new RegExp('/profile/upload/', 'g'), this.baseUrl + '/profile/upload/');
       });
     }
   },

+ 0 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/work/controller/CompanyController.java

@@ -35,7 +35,6 @@ public class CompanyController extends BaseController {
         return getDataTable(list);
     }
 
-    @PreAuthorize("@ss.hasAnyPermi('work:money:index,work:statement:give')")
     @GetMapping("/index")
     public AjaxResult index() {
         Company company = companyService.getById(getLoginUser().getUser().getCompanyId());

+ 5 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/work/controller/NoticeController.java

@@ -36,7 +36,11 @@ public class NoticeController extends BaseController {
         return getDataTable(list);
     }
 
-    @PreAuthorize("@ss.hasPermi('work:notice:query')")
+    @GetMapping("/queryList")
+    public AjaxResult queryList(){
+        return AjaxResult.success(noticeService.queryList());
+    }
+
     @GetMapping(value = "/detail/{id}")
     public AjaxResult detail(@PathVariable("id") Long id){
         return AjaxResult.success(noticeService.getById(id));

+ 4 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/work/domain/Notice.java

@@ -55,4 +55,8 @@ public class Notice{
     @TableField(fill = FieldFill.UPDATE)
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date updateTime;
+
+    @TableField(exist = false)
+    private String Date;
+
 }

+ 4 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/work/service/INoticeService.java

@@ -10,7 +10,10 @@ import java.util.List;
  * @author 高伟森
  * @date 2024-04-18
  */
-public interface INoticeService extends IService<Notice>{
+public interface INoticeService extends IService<Notice> {
     List<Notice> selectList(Notice notice);
+
+    List<Notice> queryList();
+
     AjaxResult add(Notice notice);
 }

+ 5 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/work/service/impl/NoticeServiceImpl.java

@@ -25,6 +25,11 @@ public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> impleme
     }
 
     @Override
+    public List<Notice> queryList() {
+        return noticeMapper.queryList();
+    }
+
+    @Override
     public AjaxResult add(Notice notice) {
         Notice bean = noticeMapper.selectByTitle(notice.getTitle());
         notice.setContents(notice.getContents().replace("/dev-api", "").replace("/prod-api", ""));

+ 3 - 0
ruoyi-admin/src/main/resources/mapper/work/NoticeMapper.xml

@@ -11,4 +11,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="state != null "> and state = #{state}</if>
         </where>
     </select>
+    <select id="queryList" resultType="com.ruoyi.web.work.domain.Notice">
+        SELECT id,title,create_time FROM tb_notice WHERE state=0 ORDER BY top DESC,id DESC LIMIT 10
+    </select>
 </mapper>