gzjftable.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <template>
  2. <div class="global">
  3. <div class="contentContainerGg">
  4. <div class="container">
  5. <el-form :inline="true">
  6. <el-form-item label="时间:">
  7. <el-date-picker @change="timechange" id="getWeek" v-model="datetime" type="month" format="yyyy-MM" placeholder="选择月">
  8. </el-date-picker>
  9. </el-form-item>
  10. <el-form-item>
  11. <el-button icon="el-icon-search" type="success" plain @click="getList()">
  12. 查询</el-button>
  13. </el-form-item>
  14. </el-form>
  15. <el-table border :data="tableList" highlight-current-row style="width:100%" :header-cell-style="{background:'#f8f8f8'}">
  16. <el-table-column property="sTime" label="时间" align="center" >
  17. <template slot-scope="scope">
  18. {{ scope.row.sTime.slice(0,7) }}
  19. </template>
  20. </el-table-column>
  21. <el-table-column property="depotName" label="公司" align="center" min-width="150">
  22. <template slot-scope="scope">
  23. {{ depotDic[scope.row.depotId] }}
  24. </template>
  25. </el-table-column>
  26. <el-table-column prop="monthlyWorkQuantity" label="月工作总数(项)" align="center" />
  27. <el-table-column prop="finishOnTime" label="按时完成(项)" align="center" />
  28. <el-table-column prop="lateCompletion" label="逾期完成(项)" align="center" />
  29. <el-table-column prop="soverdue" label="逾期未完成(项)" align="center" />
  30. <el-table-column prop="sscore" label="得分(分)" align="center" >
  31. <template slot-scope="scope">
  32. {{scope.row.sscore}} 分
  33. </template>
  34. </el-table-column>
  35. <el-table-column property="operation" label="操作" align="center" width='250'>
  36. <template slot-scope="scope">
  37. <div v-show="depotChild.includes(scope.row.depotId)">
  38. <el-button size="mini" type="detailbtn" @click="detailbtn(scope.$index, scope.row)">查看库内工作情况排名</el-button>
  39. </div>
  40. </template>
  41. </el-table-column>
  42. </el-table>
  43. <div class="pagination-container">
  44. <el-pagination class="right" background :current-page.sync="listQuery.page" :page-size="listQuery.limit" :page-sizes="[10,20,30,40]" :total="total" @size-change="sizeChange" @current-change="pageChange" layout="total, sizes, prev, pager, next, jumper"></el-pagination>
  45. </div>
  46. </div>
  47. </div>
  48. </div>
  49. </template>
  50. <script>
  51. import { getcf } from "@/api/organizationalStructureManagement/index.js"
  52. import { getmorejfqk ,getAllDepotChild} from "@/api/branchoff/index.js"
  53. export default {
  54. data() {
  55. return {
  56. datetime: "",
  57. // 列表数据
  58. tableList: [],
  59. // 分页
  60. total: 0,
  61. listLoading: true,
  62. listQuery: {
  63. page: 1,
  64. limit: 10
  65. },
  66. roleList: [],
  67. depotDic: [],
  68. depotId:'',
  69. depotChild:[]
  70. }
  71. },
  72. created() {
  73. this.getList()
  74. this.depotDic = JSON.parse(localStorage.getItem("deportDic"))
  75. this.depotId = JSON.parse(localStorage.getItem("userInfo")).depotId
  76. // console.log(this.depotId,'this.depotid')
  77. },
  78. mounted() {
  79. this.getNewDate()
  80. this.getDepotChild()
  81. },
  82. methods: {
  83. //获取特定格式的日期时间 "yyyy-MM-dd HH:MMM:SS"
  84. getNewDate() {
  85. var date = new Date();
  86. // console.log(date);
  87. var transverse = "-";
  88. var Verticalpoint = ":";
  89. var year = date.getFullYear() //获取年份
  90. var month = date.getMonth() + 1;//获取月份
  91. var strDate = date.getDate();//获取具体的日期
  92. var strHour = date.getHours();//获取...钟点
  93. var strMinute = date.getMinutes();//获取分钟数
  94. var strSeconde = date.getSeconds();//获取秒钟数
  95. //判断获取月份 、 具体的日期 、...钟点、分钟数、秒钟数 是否在1~9
  96. //如果是则在前面加“0”
  97. if (month >= 1 && month <= 9) {
  98. month = "0" + month;
  99. }
  100. // console.log(month);
  101. if (strDate >= 1 && strDate <= 9) {
  102. strDate = "0" + strDate;
  103. }
  104. if (strHour >= 1 && strHour <=9) {
  105. strHour = "0" + strHour
  106. }
  107. // console.log(strHour);
  108. if (strMinute >= 1 && strMinute <= 9) {
  109. strMinute = "0" + strMinute;
  110. }
  111. if (strSeconde >= 1 && strSeconde <= 9) {
  112. strSeconde = "0" + strSeconde;
  113. }
  114. if(month == '01' ){ //当在每一年的1月份是,返回的是上一年的12月份
  115. console.log(month,'000000')
  116. year = year -1
  117. month = 12
  118. console.log(year +'-'+month)
  119. }else{
  120. if (month >= 1 && month <= 9) {
  121. month = "0" +( month-1);
  122. }else{
  123. month = month-1;
  124. }
  125. }
  126. //时间日期字符串拼接
  127. var NewDate =year + transverse + month /* + transverse + strDate + " " +
  128. strHour + Verticalpoint + strMinute + Verticalpoint + strSeconde */;
  129. //返回拼接字符串
  130. this.datetime = NewDate
  131. // return NewDate;
  132. },
  133. timechange() {
  134. this.$nextTick(() => {
  135. let week = document.querySelector("#getWeek").value
  136. this.checkYear = week
  137. })
  138. },
  139. // 获取当前库及下所属库
  140. getDepotChild(){
  141. getAllDepotChild(this.depotId).then(res =>{
  142. // console.log(res,'resmmmmmmmmm')
  143. this.depotChild = res.data
  144. // console.log(this.depotChild,'this.depotChild')
  145. }).catch(err =>{
  146. console.log(err)
  147. })
  148. },
  149. getList() {
  150. var condition = {
  151. // depotId: this.$store.state.depotId,
  152. depotId: this.$route.query.depotId,
  153. sTime: this.checkYear,
  154. groupBy:1,
  155. type:''
  156. }
  157. condition = JSON.stringify(condition)
  158. let data = {
  159. condition: condition,
  160. pageIndex: this.listQuery.page,
  161. pageSize: this.listQuery.limit
  162. }
  163. getmorejfqk(data)
  164. .then(res => {
  165. if (res.code == 200) {
  166. this.tableList = res.data.records
  167. this.listQuery.limit = res.data.size
  168. this.total = res.data.total
  169. } else {
  170. this.$message({
  171. type: "error",
  172. message: res.msg
  173. })
  174. }
  175. })
  176. .catch(err => {
  177. console.log(err)
  178. })
  179. },
  180. sizeChange(v) {
  181. this.listQuery.limit = v
  182. this.getList()
  183. },
  184. pageChange(v) {
  185. this.listQuery.page = v
  186. this.getList()
  187. },
  188. detailbtn( index, row ) {
  189. this.$router.push({
  190. name: "kngzjftable",
  191. query: {
  192. depotId: row.depotId,
  193. midprovinceName: this.$route.query.midprovinceName
  194. }
  195. })
  196. }
  197. }
  198. }
  199. </script>
  200. <style lang="scss" scoped>
  201. .top {
  202. height: 40px;
  203. line-height: 40px;
  204. border-bottom: 1px solid #ccc;
  205. }
  206. .container {
  207. padding: 10px;
  208. }
  209. .pagination-container {
  210. margin-top: 10px;
  211. margin-right: 20px;
  212. text-align: right;
  213. }
  214. </style>