taskBoard.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <template>
  2. <view class="taskBoard">
  3. <u-navbar
  4. :bgStatusImage="backPic0"
  5. :bgImage="backPic"
  6. :title="gasTitle"
  7. :safeAreaInsetTop="true"
  8. leftIcon="arrow-left"
  9. leftIconColor="#303133"
  10. @leftClick="goBack"
  11. >
  12. </u-navbar>
  13. <u-list :height="666" v-if="isShow">
  14. <u-list-item v-for="(item, index) in indexList" :key="index">
  15. <u-cell icon="share" @click="getBorad(item)">
  16. <view slot="title" class="u-slot-title">
  17. <text class="u-cell-text">
  18. <text>{{ item.name }}</text>
  19. <text style="margin-left: 10px">{{
  20. item.checkPerson ? `(${item.checkPerson})` : ""
  21. }}</text>
  22. </text>
  23. </view>
  24. <view slot="value" class="u-slot-title">
  25. <u-tag
  26. :text="item.classType_dictText"
  27. plain
  28. size="mini"
  29. :type="
  30. item.classType_dictText == '早班'
  31. ? 'success'
  32. : item.classType_dictText == '中班'
  33. ? 'warning'
  34. : 'error'
  35. "
  36. >
  37. </u-tag>
  38. </view>
  39. </u-cell>
  40. </u-list-item>
  41. </u-list>
  42. <!-- 填报日期弹窗 -->
  43. <u-modal
  44. v-if="isShow"
  45. showCancelButton
  46. showConfirmButton
  47. confirmText="确定"
  48. cancelText="取消"
  49. :show="showTime"
  50. :title="titleTime"
  51. @confirm="confirmTime"
  52. @cancel="cancelTime"
  53. >
  54. <view class="dialog-item" @click="getChangeTime">
  55. <text class="dialog-label">任务日期:</text>
  56. <u--input
  57. readonly
  58. v-model="searchTime"
  59. placeholder="请选择任务日期"
  60. inputAlign="center"
  61. suffixIcon="arrow-right"
  62. ></u--input>
  63. <u-calendar
  64. :show="showCalendar"
  65. :minDate="minDate"
  66. :maxDate="maxDate"
  67. :monthNum="calendarMonthNum"
  68. v-model="searchTime"
  69. mode="single"
  70. closeOnClickOverlay
  71. @confirm="changeTime"
  72. @close="closeTime"
  73. ></u-calendar>
  74. </view>
  75. </u-modal>
  76. <component
  77. v-else
  78. :is="loadComponent"
  79. :taskId="taskId"
  80. @getBackBoard="getBackBoard"
  81. ></component>
  82. </view>
  83. </template>
  84. <script>
  85. import api from "@/api/api";
  86. import taskBoardAddress from "./taskBoardAddress.vue";
  87. import moment from "moment";
  88. export default {
  89. name: "taskBoard",
  90. components: {
  91. taskBoardAddress,
  92. },
  93. props: {},
  94. data() {
  95. return {
  96. showTime: false, //是否显示填报日期弹窗
  97. titleTime: "",
  98. searchTime: "", //检测时间
  99. showCalendar: false, //控制日期选型下拉开启
  100. // timeRan: Number(new Date()),
  101. minDate: moment()
  102. .subtract(30 * 10, "days")
  103. .format("YYYY-MM-DD"),
  104. // minDate: moment().subtract(160, 'days').format('YYYY-MM-DD'),
  105. maxDate: moment()
  106. .add(30 * 10, "days")
  107. .format("YYYY-MM-DD"),
  108. isShow: true,
  109. loadComponent: "",
  110. taskId: "",
  111. indexList: [],
  112. gasTitle: "巡检任务", //标题
  113. backPic0: "url(/static/topnavbar0.png)",
  114. backPic: "url(../../static/topnavbar.png)",
  115. };
  116. },
  117. computed: {
  118. calendarMonthNum() {
  119. const minDate = moment(this.minDate, "YYYY-MM-DD");
  120. const maxDate = moment(this.maxDate, "YYYY-MM-DD");
  121. return (
  122. (maxDate.year() - minDate.year()) * 12 +
  123. maxDate.month() -
  124. minDate.month() +
  125. 1
  126. );
  127. },
  128. teamCode: function () {
  129. return uni.getStorageSync("login_user_info")["districtTeam"];
  130. },
  131. },
  132. mounted() {
  133. this.getTimeList();
  134. },
  135. methods: {
  136. //左上角返回键:直接返回首页
  137. goBack() {
  138. this.$emit("goHome");
  139. },
  140. //点击弹出日期下拉选项
  141. getChangeTime() {
  142. this.showCalendar = true;
  143. },
  144. changeTime(e) {
  145. let that = this;
  146. that.searchTime = e[0];
  147. uni.setStorageSync("searchTime", that.searchTime);
  148. that.showCalendar = false;
  149. },
  150. closeTime() {
  151. this.searchTime = "";
  152. this.showCalendar = false;
  153. },
  154. //点击返回上一级
  155. getBackBoard() {
  156. let that = this;
  157. that.isShow = true;
  158. that.loadComponent = "";
  159. },
  160. //点击跳转到识别看板
  161. getBorad(item) {
  162. let that = this;
  163. that.taskId = item.id;
  164. that.showTime = true;
  165. },
  166. //选择检测时间-确定
  167. confirmTime() {
  168. let that = this;
  169. if (that.searchTime) {
  170. that.isShow = false;
  171. that.showTime = false;
  172. that.loadComponent = "taskBoardAddress";
  173. }
  174. },
  175. //选择检测时间-取消
  176. cancelTime() {
  177. let that = this;
  178. that.isShow = true;
  179. that.showTime = false;
  180. },
  181. //获取任务管理列表数据
  182. getTimeList() {
  183. let that = this;
  184. new Promise((resolve, reject) => {
  185. api
  186. .teamList({ pageNo: 1, pageSize: 100, teamCode: that.teamCode })
  187. .then((response) => {
  188. if (response.data.code == 200) {
  189. that.indexList = response.data.result.records;
  190. } else {
  191. reject(response);
  192. }
  193. })
  194. .catch((error) => {
  195. console.log("catch===>response", response);
  196. reject(error);
  197. });
  198. });
  199. },
  200. },
  201. };
  202. </script>
  203. <style lang="scss" scoped>
  204. .taskBoard {
  205. position: relative;
  206. width: 100%;
  207. height: 100%;
  208. background-color: #fff;
  209. }
  210. .dialog-item {
  211. display: flex;
  212. align-items: center;
  213. justify-content: center;
  214. .dialog-label {
  215. width: 86px;
  216. text-align: center;
  217. }
  218. }
  219. ::v-deep .u-input {
  220. display: flex;
  221. flex-direction: row;
  222. align-items: center;
  223. justify-content: space-between;
  224. padding: 3px 9px !important;
  225. width: 180px;
  226. }
  227. ::v-deep .u-popup {
  228. flex: 0;
  229. }
  230. ::v-deep .u-slot-title {
  231. display: flex;
  232. }
  233. </style>