| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298 |
- <template>
- <view class="m_right">
- <img src="../../assets/home/topImg.jpg" class="s_logo" mode=""></img>
- <view class="m_right_container">
- <table style="width: 100%;border: 1px solid #DDDDDD;border-collapse: collapse">
- <thead class="m-table-hander">
- <tr>
- <th>项目</th>
- <th>名称</th>
- <th>类型</th>
- <th>创建人</th>
- <th>查看</th>
- <th>是否为公共</th>
- </tr>
- </thead>
- <tbody>
- <tr v-for="(item,index) in tabledata" :key="index">
- <th>{{item.Id}}</th>
- <th>{{item.ProjectName}}</th>
- <th>{{item.Type}}</th>
- <th>{{item.CreateUserName}}</th>
- <th style="position: relative;"><button type="default" @click="find(item,index)" size="mini" class="m_delete">查看</button></th>
- <th>
- <checkbox-group>
- <label>
- <checkbox :checked="Boolean(item.IsPublic)" disabled="false"/>
- </label>
- </checkbox-group>
- </th>
- </tr>
- </tbody>
- </table>
-
- <view class="m_right_footer">
- <view class="m_paging">
- <text class="m_paging_item m_paging_upper" v-show="bShowLastPageBtn" @click="last()">上一页</text>
- <text class="m_paging_item" :key="i" v-for="i in pageTotalNum" @click="paging(i)" :class="i==currentPage?'p_act':''">
- {{i}}
- </text>
- <text class="m_paging_item m_paging_lower" v-show="bShowNextPageBtn" @click="next()">下一页</text>
- </view>
- </view>
- </view>
-
- </view>
- </template>
-
- <script>
- export default {
- name: "student_table",
- data() {
- return {
- index: 1,
- tabledata: [],
- pageTotalNum:1,
- currentPage:1,
- totalItem:2,
- bShowLastPageBtn:false,
- bShowNextPageBtn:false,
- }
- },
- methods: {
- // paging(obj) {
- // this.index = obj;
- // },
- paging(i) {
- uni.showLoading({
- title: '加载中'
- });
-
- let fromIndex = this.totalItem*(i-1);
- let toIndex = fromIndex+this.totalItem;
-
- let data = {
- "UserID": mydata_userInfo.UserID,
- "BeginNum": fromIndex, //用户数组索引
- "EndNum": toIndex, //用户数组索引结束
- }
-
- uni.request({
- header: {
- 'Content-Type': 'application/json;charset=UTF-8'
- },
- url: mydata_api + '/project/getprojects',
- method: 'POST',
- data: data,
- dataType: 'json',
- success: (res) => {
- //100成功
- if (res.data.Code == 100) {
- console.log("请求全部资产", res);
- this.tabledata = res.data.Items;
- this.pageTotalNum = Math.ceil(res.data.TotalNum/this.totalItem);
- this.currentPage = i;
- this.showNextOrLastPageBtn();
- }
- //200失败
- else {
- console.log('suc200', res);
- }
- uni.hideLoading();
- },
- fail: (res) => {
- console.log("请求失败****");
- uni.hideLoading();
- }
- });
- },
- initPage() {
- this.paging(1);
- },
- last()
- {
- this.currentPage--;
- this.paging(this.currentPage);
- },
- next()
- {
- this.currentPage++;
- this.paging(this.currentPage);
- },
- showNextOrLastPageBtn()
- {
- if(this.pageTotalNum==this.currentPage)
- {
- this.bShowLastPageBtn = true;
- this.bShowNextPageBtn = false;
- // console.log('11111')
- }
- else if(1==this.currentPage)
- {
- this.bShowLastPageBtn = false;
- this.bShowNextPageBtn = true;
- // console.log('2222')
- }
- else
- {
- this.bShowLastPageBtn = true;
- this.bShowNextPageBtn = true;
- // console.log('333333')
- }
-
- if(this.pageTotalNum==1){
- this.bShowLastPageBtn = false;
- this.bShowNextPageBtn = false;
- // console.log('444444')
- }
- },
- getList() {
- // uni.request({
- // url: mydata_api + "/project/getprojects",
- // data: {
- // "UserID": mydata_userInfo.UserID
- // },
- // method: "POST",
- // dataType: "json",
- // success: res => {
-
- // this.tabledata = res.data.Projects
- // // console.log('tabledata=',this.tabledata)
- // this.$forceUpdate();//强制刷新页面
- // }
- // })
- this.initPage(1);
- },
- find(obj,index){
- this.$emit('viewProject',obj,index);
- }
- }
- }
- </script>
- <style lang="scss">
- .m_right {
- width: 100%;
- margin-top: 5rpx;
- // padding: 0 150rpx;
- background-color: #fff;
- box-shadow: 3px 0px 6px 0px rgba(0, 0, 0, 0.1);
- .m_right_container {
- padding: 150rpx;
- }
- .s_logo {
- width: 100%;
- }
- .m_right_hander {
- text-align: right;
- height: 250rpx;
- position: relative;
- .m_btn_red {
- position: absolute;
- height: 80rpx;
- line-height: 80rpx;
- padding: 0 40rpx;
- right: 0;
- top: 50%;
- transform: translateY(-50%);
- background: #EA252C;
- color: #fff;
- }
- }
- }
- tbody tr {
- border-top: 2rpx solid #DDDDDD !important;
- }
- tbody tr th:first-child {
- position: relative;
- }
- tbody tr th {
- font-weight: 400 !important;
- height: 140rpx;
- line-height: 140rpx;
- }
- tbody tr:hover {
- // color: #fff;
- background: #FDEBEC;
- // opacity: 0.08;
- }
- .m-table-hander {
- background-color: #FFF8F7;
- height: 140rpx;
- line-height: 140rpx;
- font-family: MicrosoftYaHei-Bold, MicrosoftYaHei;
- font-weight: bold;
- }
- .m_edit {
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- background: rgb(67, 127, 250);
- color: rgb(255, 255, 255);
- min-width: 130rpx;
- }
- .m_delete {
- position: absolute;
- top: 50%;
- left: 50%;
- min-width: 130rpx;
- transform: translate(-50%, -50%);
- background: rgb(234, 37, 44);
- color: rgb(255, 255, 255);
- z-index: 100;
- }
- .m_right_footer {
- margin-top: 80rpx;
- }
- .m_logoimg {
- width: 80rpx;
- height: 80rpx;
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- }
- .m_paging {
- text-align: right;
- .m_paging_item {
- padding: 10rpx 18rpx;
- border: 1rpx solid #DDDDDD;
- border-radius: 8rpx;
- margin-right: 10rpx;
- }
- .p_act {
- background: #EA252C;
- color: #fff;
- border: inherit;
- }
- }
- .m_paging_item:hover {
- background: #EA252C;
- color: #fff;
- border: inherit;
- }
- .m_act1 {
- color: #FF0019;
- }
- </style>
|