123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267 |
- <template>
- <section>
- <!--工具条-->
- <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
- <el-form :inline="true">
- <el-col :span="2">
- <el-form-item>消息中心</el-form-item>
- </el-col>
- </el-form>
- </el-col>
- <!--选项卡-->
- <el-col :span="24">
- <el-tabs v-model="activePage" @tab-click="handleClick" type="card">
- <el-tab-pane name="0" label="审批">
- <div :style="heightString">
- <span v-if="messages[0].length == 0">目前暂无消息</span>
- <div
- class="message-div"
- v-for="item,index in messages[0]"
- :key="index"
- @click="locationHerf(item.id, item.refId, item.noticeType, item.belongType)"
- >
- <p>
- <span class="message-title isRead" v-if="item.isRead == 1">{{item.projectName}}</span>
- <span class="message-title" v-else>{{item.projectName}}</span>
- <span class="message-time">{{item.indate}}</span>
- </p>
- <p class="message-article">{{item.content}}</p>
- </div>
- </div>
- <!--分页1-->
- <el-col :span="24" class="toolbar">
- <el-pagination
- @size-change="handleSizeChange0"
- @current-change="handleCurrentChange0"
- :page-sizes="[20 , 50 , 80 , 100 , 200]"
- :page-size="20"
- layout="total, sizes, prev, pager, next"
- :total="total[0]"
- style="float:right;"
- ></el-pagination>
- </el-col>
- </el-tab-pane>
- <el-tab-pane name="1" label="警告">
- <div :style="heightString">
- <span v-if="messages[1].length == 0">目前暂无消息</span>
- <div
- class="message-div"
- v-for="item,index in messages[1]"
- :key="index"
- @click="locationHerf(item.id, item.refId, item.noticeType, null)"
- >
- <p>
- <span class="message-title isRead" v-if="item.isRead == 1">{{item.projectName}}</span>
- <span class="message-title" v-else>{{item.projectName}}</span>
- <span class="message-time">{{item.indate}}</span>
- </p>
- <p class="message-article">{{item.content}}</p>
- </div>
- </div>
- <!--分页2-->
- <el-col :span="24" class="toolbar">
- <el-pagination
- @size-change="handleSizeChange1"
- @current-change="handleCurrentChange1"
- :page-sizes="[20 , 50 , 80 , 100 , 200]"
- :page-size="20"
- layout="total, sizes, prev, pager, next"
- :total="total[1]"
- style="float:right;"
- ></el-pagination>
- </el-col>
- </el-tab-pane>
- <el-tab-pane name="2" label="保养">
- <div :style="heightString">
- <span v-if="messages[2].length == 0">目前暂无消息</span>
- <div
- class="message-div"
- v-for="item,index in messages[2]"
- :key="index"
- @click="locationHerf(item.id, item.refId, item.noticeType, null)"
- >
- <p>
- <span class="message-title isRead" v-if="item.isRead == 1">{{item.projectName}}</span>
- <span class="message-title" v-else>{{item.projectName}}</span>
- <span class="message-time">{{item.indate}}</span>
- </p>
- <p class="message-article">{{item.content}}</p>
- </div>
- </div>
- <!--分页3-->
- <el-col :span="24" class="toolbar">
- <el-pagination
- @size-change="handleSizeChange2"
- @current-change="handleCurrentChange2"
- :page-sizes="[20 , 50 , 80 , 100 , 200]"
- :page-size="20"
- layout="total, sizes, prev, pager, next"
- :total="total[2]"
- style="float:right;"
- ></el-pagination>
- </el-col>
- </el-tab-pane>
- </el-tabs>
- </el-col>
- </section>
- </template>
- <script>
- import util from "../common/js/util";
- export default {
- data() {
- return {
- messages: [[], [], []],
- page0: 1,
- page1: 1,
- page2: 1,
- size: 20,
- total: [0, 0, 0],
- tableHeight: 0,
- activePage: 0,
- heightString: ""
- };
- },
- methods: {
- //分页1
- handleCurrentChange0(val) {
- this.page0 = val;
- this.loadNotice();
- },
- handleSizeChange0(val) {
- this.size1 = val;
- this.loadNotice();
- },
- //分页2
- handleCurrentChange1(val) {
- this.page2 = val;
- this.loadNotice();
- },
- handleSizeChange1(val) {
- this.size = val;
- this.loadNotice();
- },
- //分页3
- handleCurrentChange2(val) {
- this.page = val;
- this.loadNotice();
- },
- handleSizeChange2(val) {
- this.size = val;
- this.loadNotice();
- },
- //标签页面切换时
- handleClick(tab, event) {
- this.activeTab = tab.name;
- },
- //读取消息提示
- loadNotice() {
- this.http.post(
- this.port.notice.list,
- {
- pageNum: this.page,
- pageSize: this.size
- },
- res => {
- if (res.code == "ok") {
- this.messages = [];
- this.messages.push(res.data[0].approvelList.list);
- this.messages.push(res.data[1].matainList.list);
- this.messages.push(res.data[2].emergencyList.list);
- this.total[0] = res.data[0].approvelList.total;
- this.total[1] = res.data[1].matainList.total;
- this.total[2] = res.data[2].emergencyList.total;
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- }
- );
- },
- //点击消息的跳转
- locationHerf(id, refid, type, approval) {
- this.http.post(
- this.port.notice.read,
- {
- id: id
- },
- res => {
- if (res.code == "ok") {
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- }
- );
- if (type == 0) {
- //审批 跳转到模具详情
- this.$router.push("/moldList/" + refid + "/" + approval);
- } else if (type == 1) {
- //警告 跳转到运行监测
- this.$router.push("/detection");
- } else if (type == 2) {
- //保养 跳转到运行监测详情
- this.$router.push("/detection/" + refid);
- }
- }
- },
- created() {
- let height = window.innerHeight;
- this.tableHeight = height - 260;
- this.heightString = "height: " + this.tableHeight + "px";
- },
- mounted() {
- this.loadNotice();
- }
- };
- </script>
- <style scoped>
- .message-div {
- cursor: pointer;
- padding: 5px 0;
- }
- .message-div > p {
- line-height: 25px;
- margin: 0;
- }
- .message-type {
- font-weight: 700;
- }
- .message-time {
- padding-left: 30px;
- color: #777;
- }
- .message-title {
- color: #409eff;
- }
- .message-article {
- color: #555;
- }
- .isRead {
- color: #999 !important;
- }
- </style>
|