daily.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. <template>
  2. <section>
  3. <!--工具条-->
  4. <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
  5. <el-form :inline="true">
  6. <el-form-item>
  7. <el-date-picker v-model="date" :editable="false" format="yyyy-MM" value-format="yyyy-MM" @change='changeMonth()' :clearable="false" type="month" placeholder="选择月份"></el-date-picker>
  8. </el-form-item>
  9. <el-form-item style="float:right;">
  10. <el-link type="primary" :underline="false" @click="handleAdd">导出日报</el-link>
  11. </el-form-item>
  12. <el-form-item style="float:right;">
  13. <el-link type="primary" :underline="false" @click="handleAdd">项目管理</el-link>
  14. </el-form-item>
  15. </el-form>
  16. </el-col>
  17. <!--列表-->
  18. <div>
  19. <el-card class="box-card daily" shadow="never" :style="'height:'+tableHeight +'px'">
  20. <div slot="header" class="clearfix">
  21. <span>日期:</span>
  22. <span v-for="(item,index) in allDate" :id="'day'+index" :class="index==choseDay?'chooseDate date_item':'date_item'" @click="choseDate(index)">{{item}}</span>
  23. </div>
  24. <div class="allDaily">
  25. <div class="one_daily">
  26. <el-link><i class="fa fa-circle"></i> 吴涛涛</el-link>
  27. <div class="one_daily_body">
  28. <el-timeline>
  29. <el-timeline-item>
  30. <el-card shadow="never">
  31. <p>项目:<b>工时管家开发项目</b></p>
  32. <p>时长:1.5h</p>
  33. <p>事项:1.重新设计工作日报模块<br>
  34. 2.绘制原型图<br>
  35. 3.敲代码<br>
  36. </p>
  37. </el-card>
  38. </el-timeline-item>
  39. </el-timeline>
  40. </div>
  41. </div>
  42. <div class="one_daily">
  43. <el-link><i class="fa fa-circle"></i> 吴涛涛</el-link>
  44. <div class="one_daily_body">
  45. <el-timeline>
  46. <el-timeline-item>
  47. <el-card shadow="never">
  48. <p>项目:<b>工时管家开发项目</b></p>
  49. <p>时长:1.5h</p>
  50. <p>事项:1.重新设计工作日报模块<br>
  51. 2.绘制原型图<br>
  52. 3.敲代码<br>
  53. </p>
  54. </el-card>
  55. </el-timeline-item>
  56. </el-timeline>
  57. </div>
  58. </div>
  59. <div class="one_daily">
  60. <el-link><i class="fa fa-circle"></i> 吴涛涛</el-link>
  61. <div class="one_daily_body">
  62. <el-timeline>
  63. <el-timeline-item>
  64. <el-card shadow="never">
  65. <p>项目:<b>工时管家开发项目</b></p>
  66. <p>时长:1.5h</p>
  67. <p>事项:1.重新设计工作日报模块<br>
  68. 2.绘制原型图<br>
  69. 3.敲代码<br>
  70. </p>
  71. </el-card>
  72. </el-timeline-item>
  73. <el-timeline-item>
  74. <el-card shadow="never">
  75. <p>项目:<b>工时管家开发项目</b></p>
  76. <p>时长:1.5h</p>
  77. <p>事项:1.重新设计工作日报模块<br>
  78. 2.绘制原型图<br>
  79. 3.敲代码<br>
  80. </p>
  81. </el-card>
  82. </el-timeline-item>
  83. </el-timeline>
  84. </div>
  85. </div>
  86. </div>
  87. </el-card>
  88. </div>
  89. </section>
  90. </template>
  91. <script>
  92. import util from '../../common/js/util'
  93. export default {
  94. data() {
  95. return {
  96. user: JSON.parse(sessionStorage.getItem('user')),
  97. allDate: [],
  98. date: util.formatDate.format(new Date(new Date()), 'yyyy-MM'),
  99. choseDay: 0,
  100. tableHeight: 0,
  101. listLoading: false,
  102. total: 0,
  103. page: 1,
  104. size: 20,
  105. list: [],
  106. addFormVisible: false,
  107. addLoading: false,
  108. }
  109. },
  110. methods: {
  111. changeMonth() {
  112. this.getAllDate();
  113. this.getList();
  114. },
  115. choseDate(i) {
  116. this.choseDay = i;
  117. },
  118. getAllDate() {
  119. var dayArry = [];
  120. var day = this.getCountDays();
  121. for (var k = 1; k <= day; k++) {
  122. var str = new Date(this.date.replace(/-/g,'/')).getMonth() + 1 + "月" + k + "日";
  123. if(new Date(this.date.replace(/-/g,'/')).getFullYear() == new Date(new Date()).getFullYear() &&
  124. new Date(this.date.replace(/-/g,'/')).getMonth() == new Date(new Date()).getMonth()) {
  125. if(new Date().getDate() == k) {
  126. this.choseDay = k-1;
  127. }
  128. } else {
  129. this.choseDay = 0;
  130. }
  131. dayArry.push(str);
  132. }
  133. this.allDate = dayArry;
  134. },
  135. getCountDays() {
  136. var newstr = this.date.replace(/-/g,'/');
  137. var curDate = new Date(newstr);
  138. var curMonth = curDate.getMonth();
  139. curDate.setMonth(curMonth + 1);
  140. curDate.setDate(0);
  141. return curDate.getDate();
  142. },
  143. //分页
  144. handleCurrentChange(val) {
  145. this.page = val;
  146. this.getList();
  147. },
  148. handleSizeChange(val) {
  149. this.size = val;
  150. this.getList();
  151. },
  152. //获取项目列表
  153. getList() {
  154. this.listLoading = true;
  155. this.http.post(this.port.project.projectList, {
  156. keyName: '',
  157. pageNum: this.page,
  158. pageSize: this.size,
  159. }, res => {
  160. this.listLoading = false;
  161. if (res.code == "ok") {
  162. var list = res.data.list;
  163. for(var i in list){
  164. var customCompaniesStr = "";
  165. for(var j in list[i].customCompanies){
  166. if(j == list[i].customCompanies.length -1){
  167. customCompaniesStr += list[i].customCompanies[j].companyName;
  168. } else {
  169. customCompaniesStr += list[i].customCompanies[j].companyName + "、";
  170. }
  171. }
  172. list[i].customCompaniesStr = customCompaniesStr;
  173. }
  174. this.list = list;
  175. this.total = res.data.total;
  176. } else {
  177. this.$message({
  178. message: res.msg,
  179. type: 'error'
  180. });
  181. }
  182. }, error => {
  183. this.listLoading = false;
  184. this.$message({
  185. message: error,
  186. type: 'error'
  187. });
  188. })
  189. },
  190. //显示新增界面
  191. handleAdd() {
  192. this.getUnusual();
  193. this.addFormVisible = true;
  194. },
  195. // 获取异常列表
  196. getUnusual() {
  197. this.listLoading = true;
  198. this.http.post(this.port.project.projectList, {
  199. keyName: '',
  200. pageNum: this.page,
  201. pageSize: this.size,
  202. }, res => {
  203. this.listLoading = false;
  204. if (res.code == "ok") {
  205. var list = res.data.list;
  206. for(var i in list){
  207. var customCompaniesStr = "";
  208. for(var j in list[i].customCompanies){
  209. if(j == list[i].customCompanies.length -1){
  210. customCompaniesStr += list[i].customCompanies[j].companyName;
  211. } else {
  212. customCompaniesStr += list[i].customCompanies[j].companyName + "、";
  213. }
  214. }
  215. list[i].customCompaniesStr = customCompaniesStr;
  216. }
  217. this.list = list;
  218. this.total = res.data.total;
  219. } else {
  220. this.$message({
  221. message: res.msg,
  222. type: 'error'
  223. });
  224. }
  225. }, error => {
  226. this.listLoading = false;
  227. this.$message({
  228. message: error,
  229. type: 'error'
  230. });
  231. })
  232. },
  233. },
  234. created() {
  235. let height = window.innerHeight;
  236. this.tableHeight = height - 170;
  237. const that = this;
  238. window.onresize = function temp() {
  239. that.tableHeight = window.innerHeight - 170;
  240. };
  241. },
  242. mounted() {
  243. this.getAllDate();
  244. this.getList();
  245. }
  246. }
  247. </script>
  248. <style lang="scss" scoped>
  249. .clearfix {
  250. overflow-x: auto;
  251. white-space: nowrap;
  252. padding: 15px 0;
  253. .date_item {
  254. padding:0 15px;
  255. cursor: pointer;
  256. }
  257. .chooseDate {
  258. color: #20a0ff;
  259. }
  260. }
  261. .one_daily {
  262. i {
  263. color: #9ED0FF;
  264. margin-right: 5px;
  265. }
  266. .one_daily_body {
  267. padding: 15px 0px;
  268. p {
  269. margin: 0;
  270. line-height: 30px;
  271. }
  272. }
  273. ul {
  274. padding: 0;
  275. }
  276. }
  277. </style>
  278. <style lang="scss">
  279. .daily {
  280. .el-card__body {
  281. height: 82%;
  282. overflow-y: auto;
  283. }
  284. }
  285. </style>