123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626 |
- <template>
- <div class="detail">
- <mt-header class="detail_head" fixed title="TA的建议">
- <router-link to="" slot="left">
- <mt-button icon="back" v-on:click="jumpBack()"></mt-button>
- </router-link>
- <mt-button class="timePicker" slot="right" id="dateTime" v-on:click="timePicker()"><span class="dateTime">{{chooseTime}}</span> <img src="../../assets/image/pull_down.png"></mt-button>
- </mt-header>
- <div class="detail_body">
- <div class="noList" v-if="ideaList.length==0">
- <img src="../../assets/image/noList.png">
- </div>
- <ul v-else class="recordBox">
- <li v-for="(item,index) in ideaList" class="one_recordBox detailBox">
- <div>
- <div class="one_suggest_title">
- {{item.name}}
- <span v-if="item.ideaComment != null" class="areaday">已打分</span>
- <span v-if="power.indexOf('scoring')>-1 && item.isEvaluated == 0" class="edit" v-on:click="openSugPop(index)">打分</span>
- </div>
- <div style="color: #aaa;text-align:left;font-size:0.13rem;margin-bottom:0.12rem;">
- {{item.indate}}
- </div>
- <div class="one_suggest_body">
- {{item.content}}
- </div>
- <div class="one_suggest_reply" v-if="item.ideaComment != null">
- <div class="reply_title">来自领导的回复</div>
- <div class="reply_body">
- {{item.ideaComment.content}}
- <div>{{item.ideaComment.responder}} <span class="score">得分:<span>{{item.score==null?'0分':item.score + '分'}}</span></span></div>
- <div>{{item.ideaComment.indate}}
- <div v-if="power.indexOf('scoring')>-1" class="showMoreBtn" v-on:click.stop="showBtnList(item.id)">
- <img src="../../assets/image/loadMore.png">
- <div :id="'btn' + item.id" class="btn_list hide">
- <div v-on:click="openSugPop(index)"><img src="../../assets/image/register.png"><span>编辑</span></div>
- <div v-on:click="deleteScore(index)"><img src="../../assets/image/delete.png"><span>删除</span></div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </li>
- <div class="order" v-if="haveMore">
- <span class="line"></span>
- <span class="txt">没有更多了</span>
- <span class="line"></span>
- </div>
- </ul>
- </div>
- <mt-popup v-model="sugScorePop" position="middle" popup-transition="popup-fade">
- <div class="mint-popup-div">
- <h4>打分</h4>
- <mt-field label="" class="input" placeholder="请输入建议分" type="number" disableClear v-model="sugScore"></mt-field>
- <mt-field label="" class="input" placeholder="请输入得分原因" type="textarea" rows="4" v-model="sugContent"></mt-field>
- <div class="btns">
- <mt-button class="btn" size="small" v-on:click.native="submit(3)">确定</mt-button>
- <mt-button class="btn" size="small" v-on:click.native="closePop()">取消</mt-button>
- </div>
- </div>
- </mt-popup>
- </div>
- </template>
- <script>
- import { MessageBox } from 'mint-ui';
- export default {
- data() {
- return {
- user: JSON.parse(sessionStorage.getItem("user")),
- power: sessionStorage.getItem("power"),
- ideaList: [],
- pageNum: 1,
- pages: 1,
- haveMore: false,
- date: [],
- chooseTime: '',
- sugScore: 0,
- sugContent: '',
- sugScorePop: false,
- chooseSugNum: 0,
- canEdit: true,
- }
- },
- methods: {
- // 时间筛选
- timePicker() {
- var _this = this;
- var dataShippingSpace = this.date;
- var pickerDiv = document.getElementById("dateTime");
- var pickerView = new PickerView({
- bindElem: pickerDiv,
- data: dataShippingSpace,
- title: "时间选择",
- leftText: "取消",
- rightText: "确定",
- rightFn: function(selectArr) {
- _this.chooseTime = selectArr[0].name;
- _this.getList();
- if(_this.chooseTime == _this.date[0].name) {
- _this.canEdit = true
- } else {
- _this.canEdit = false
- }
- }
- });
- },
- // 消息列表
- getList() {
- this.$indicator.open();
- this.http.post(this.port.my.ideaListByUid, {
- 'uid': this.user.id,
- 'time': this.chooseTime,
- // 'pageNum': 1,
- } ,
- res => {
- this.$indicator.close();
- if (res.code == "ok") {
- // this.ideaList = res.data.list;
- this.ideaList = res.data;
- this.pages = res.data.pages==0?1:res.data.pages;
- } else {
- this.$toast({
- message: res.msg,
- duration: 2000
- });
- }
- }, error => {
- this.$indicator.close();
- this.$toast({
- message: error,
- duration: 2000
- });
- })
- },
- loadMore() {
- if(this.pageNum == this.pages) {
- this.haveMore = true;
- } else if(this.pageNum < this.pages) {
- this.$indicator.open();
- this.http.post(this.port.my.ideaListByUid, {
- 'uid': this.user.id,
- 'time': this.chooseTime,
- 'pageNum': ++this.pageNum
- } ,
- res => {
- this.$indicator.close();
- if (res.code == "ok") {
- this.pages = res.data.pages==0?1:res.data.pages;
- if(res.data.ideaList.length != 0) {
- for(var i in res.data.ideaList) {
- this.ideaList.push(res.data.list[i]);
- }
- }
- } else {
- this.$toast({
- message: res.msg,
- duration: 2000
- });
- }
- }, error => {
- this.$indicator.close();
- this.$toast({
- message: error,
- duration: 2000
- });
- })
- }
- },
- jumpBack() {
- this.$router.go(-1);
- },
- getDate() {
- const dateData = [];
- const date1 = new Date();
- for (let i = 0; i < 36; i++) {
- let cur = '';
- let tempYear = date1.getFullYear();
- let tempMonth = date1.getMonth() - i + 1;
- if (tempMonth <= 0) {
- tempYear = date1.getFullYear() - Math.floor(tempMonth / -12) - 1;
- tempMonth += (Math.floor(tempMonth / -12) + 1) * 12;
- }
- if (tempMonth < 10) {
- cur = tempYear+ '-0' + tempMonth;
- } else {
- cur = tempYear+ '-' + tempMonth;
- }
- dateData.push({
- name: cur
- });
- if(i == 0) {
- this.chooseTime = cur;
- }
- }
- this.date = dateData;
- this.getList();
- },
- openPop(type) {
- if(type == 1) {
- this.personalScore = this.detail.personalScore==null?0:this.detail.personalScore;
- this.score = true;
- } else if(type == 2) {
- this.reason = this.detail.reason==null?'':this.detail.reason;
- this.reasonPop = true;
- }
- },
- submit(type) {
- var reg = /^([0-9]|10)(\.\d)?$/;
- var scoreNum = 0;
- for(var i in this.ideaList) {
- if(this.ideaList[this.chooseSugNum].uid == this.ideaList[i].uid && this.ideaList[this.chooseSugNum].id != this.ideaList[i].id) {
- scoreNum += this.ideaList[i].score;
- }
- }
- if(!reg.test(this.sugScore)) {
- this.$toast({
- message: '分数区间为0 ~ 10',
- duration: 2000
- });
- return false;
- } else if((parseFloat(scoreNum) + parseFloat(this.sugScore)) > 10){
- this.$toast({
- message: '当前人员建议分总分不能超过10分',
- duration: 2000
- });
- return false;
- } else {
- var from = {};
- if(this.ideaList[this.chooseSugNum].ideaComment != null) {
- from = {
- "ideaId": this.ideaList[this.chooseSugNum].id,
- "score": this.sugScore,
- "content": this.sugContent,
- "responderId": this.user.id,
- "scoreId": this.ideaList[this.chooseSugNum].scoreId,
- "id": this.ideaList[this.chooseSugNum].ideaComment.id,
- }
- } else {
- from = {
- "ideaId": this.ideaList[this.chooseSugNum].id,
- "score": this.sugScore,
- "content": this.sugContent,
- "responderId": this.user.id,
- "scoreId": this.ideaList[this.chooseSugNum].scoreId,
- }
- }
- this.$indicator.open();
- this.http.post(this.port.my.leaderScore, from ,
- res => {
- this.$indicator.close();
- if (res.code == "ok") {
- this.$toast({
- message: "打分成功",
- duration: 2000
- });
- this.sugScorePop = false;
- this.getList();
- } else {
- this.$toast({
- message: res.msg,
- duration: 2000
- });
- }
- }, error => {
- this.$indicator.close();
- this.sugScorePop = false;
- this.$toast({
- message: error,
- duration: 2000
- });
- })
- }
- },
- closePop() {
- this.sugScorePop = false;
- },
- openSugPop(i) {
- this.sugScore = this.ideaList[i].score == null? 0 : this.ideaList[i].score;
- this.sugContent = this.ideaList[i].ideaComment == null? '' : this.ideaList[i].ideaComment.content;
- this.sugScorePop = true;
- this.chooseSugNum = i;
- },
- showBtnList(id) {
- if($("#btn" + id).attr("class").indexOf("hide") == -1) {
- $("#btn" + id).slideUp().addClass("hide");
- } else {
- $(".one_suggest_reply .showMoreBtn .btn_list").addClass("hide").slideUp();
- $("#btn" + id).slideDown().removeClass("hide");
- }
- },
- deleteScore(index) {
- MessageBox.confirm('', {
- message: '是否删除该分数、评论?',
- title: '',
- confirmButtonText: '确定',
- cancelButtonText: '取消'
- }).then(action => {
- if (action == 'confirm') { //确认的回调
- this.http.post(this.port.my.delScore, {
- 'id': this.ideaList[index].ideaComment.id,
- } ,
- res => {
- if (res.code == "ok") {
- this.$toast({
- message: "删除成功",
- duration: 2000
- });
- this.getList();
- } else {
- this.$toast({
- message: res.msg,
- duration: 2000
- });
- }
- }, error => {
- this.$toast({
- message: error,
- duration: 2000
- });
- })
- }
- }).catch(err => {
- });
- },
- globalClick(callback) {
- document.getElementById('allocation').onclick = function () {
- $(".one_suggest_reply .showMoreBtn .btn_list").addClass("hide").slideUp();
- }
- }
- },
- created() {
- this.getDate();
- },
- mounted() {
-
- }
- }
- </script>
- <style scoped>
- body {
- background: #EFEFEF!important;
- }
- .context_router {
- background: #EFEFEF;
- }
-
- .detail {
- background: #EFEFEF;
- }
- .detail_head {
- background: #fff;
- color: #333;
- height: 0.4rem;
- }
- .detail_body {
- margin-top: 0.4rem;
- padding-bottom: 0.15rem;
- background: #efefef;
- }
- .detailBox {
- background: #fff;
- margin-bottom: 0.1rem;
- }
- .one_recordBox {
- padding: 0.12rem 0.2rem;
- }
- .record_head {
- padding: 0 0 0.1rem 0;
- line-height: 0.25rem;
- border-bottom: 1px solid #ccc;
- }
- .record_head > div {
- width: 100%;
- display: inline-block;
- vertical-align: middle;
- line-height: 0.4rem;
- }
- .record_head > div img {
- width:0.12rem;
- float:right;
- margin: 0.135rem 0 0 0;
- }
- .record_head > div span {
- color: #5FA1F0;
- margin-left: 0.2rem;
- float: right;
- margin-right: 0.05rem;
- }
- .record_body {
- color: #5FA1F0;
- font-size: 0.14rem;
- margin: 0.12rem 0 0 0;
- }
- .record_body .toDetail {
- float: right;
- margin-right: 0.05rem;
- }
- .record_body .toDetail img {
- width: 0.12rem;
- }
- .one_suggest_title {
- line-height: 0.3rem;
- }
- .one_suggest_title span {
- float: right;
- font-size: 0.13rem;
- }
- .one_suggest_title span.areaday {
- color: #ccc;
- }
- .one_suggest_title span.edit {
- color:#5FA1F0;
- }
- .one_suggest_body {
- font-size: 0.13rem;
- line-height: 0.2rem;
- color: #333;
- }
- .one_suggest_reply {
- margin-top: 0.12rem;
- }
- .reply_title {
- font-size: 0.12rem;
- color: #999;
- margin-bottom: 0.08rem;
- }
- .reply_body {
- padding: 0.1rem;
- background: #EEE;
- color: #333;
- }
- .reply_body > div {
- color: #333;
- line-height: 0.2rem;
- font-size: 0.13rem;
- color: #777;
- }
- .reply_body > div:nth-child(1) {
- margin-top: 0.1rem;
- }
- .reply_body .score {
- float: right;
- }
- .reply_body .score span {
- color: #5FA1F0;
- }
- .mint-popup {
- width: 70%;
- box-sizing: content-box;
- }
- .mint-popup-div {
- padding: 0.12rem;
- background: #fff;
- }
- .mint-popup-div h4 {
- margin: 0;
- padding: 0;
- }
- .mint-popup-div .mint-cell {
- margin: 0.2rem 0;
- }
- .mint-popup-div > div.btns {
- height: 0.3rem;
- }
- .mint-popup-div .btn {
- float: right;
- margin-right: 0.1rem;
- background: #fff;
- box-shadow: none;
- width: 50%;
- margin: 0;
- }
- .mint-popup-div .btn:nth-child(1) {
- color: #f00;
- }
- .allocation {
- width: 100%;
- height: 100%;
- }
- .noList {
- text-align: center;
- padding: 1.5rem 0;
- }
- .noList img {
- width: 1.2rem;
- height: 1.2rem;
- }
- .order {
- height: 0.6rem;
- line-height: 0.6rem;
- text-align: center;
- }
- .order .line {
- display: inline-block;
- width: 1.2rem;
- border-top: 1px solid #ccc ;
- vertical-align: middle;
- }
- .order .txt {
- color: #ccc;
- font-size: 0.13rem;
- vertical-align: middle;
- }
-
- .showMoreBtn {
- display: inline-block;
- float: right;
- position: relative;
- }
- .showMoreBtn img {
- width: 0.23rem;
- }
- .btn_list {
- position: absolute;
- right: -0.04rem;
- top: 0.30rem;
- border:#aaa;
- background: #fcfcfc;
- box-shadow: 5px 5px 10px #ccc;
- z-index: 105;
- }
- .btn_list:before {
- display: inline-block;
- width: 0;
- height: 0;
- border: solid transparent;
- border-width: 10px;
- border-bottom-color: #fcfcfc;
- content: "";
- position: absolute;
- top: -20px;
- right: 0.06rem;
- }
- .btn_list > div {
- width: 0.6rem;
- font-size: 0.13rem;
- padding: 0.1rem 0.15rem;
- border-bottom: 1px solid #efefef;
- text-align: center;
- }
- .btn_list > div img {
- width: 0.14rem;
- height: 0.14rem;
- vertical-align: middle;
- margin-right: 0.05rem;
- }
- .btn_list > div span {
- height: 0.15rem;
- line-height: 0.15rem;
- vertical-align: middle;
- }
- .hide {
- display: none;
- }
- </style>
- <style>
- .mint-popup-div input {
- border: 1px solid #ddd;
- border-radius: 5px;
- padding: 0.08rem;
- }
- </style>
|