taskBoard.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. <template>
  2. <view class="taskBoard">
  3. <u-navbar
  4. v-if="isShow"
  5. :title="gasTitle"
  6. :safeAreaInsetTop="true"
  7. leftIcon="arrow-left"
  8. leftIconColor="#303133"
  9. :fixed="true"
  10. height="50px"
  11. bgColor="#afc3fc"
  12. @leftClick="goBack"
  13. >
  14. </u-navbar>
  15. <u-list v-if="isShow">
  16. <u-list-item v-for="(item, index) in indexList" :key="index">
  17. <u-cell icon="share" @click="getBorad(item)">
  18. <view slot="title" class="u-slot-title">
  19. <text class="u-cell-text">
  20. <text>{{ item.name }}</text>
  21. <text style="margin-left: 10px">{{
  22. item.checkPerson ? `(${item.checkPerson})` : ""
  23. }}</text>
  24. </text>
  25. </view>
  26. <view slot="value" class="u-slot-title">
  27. <u-tag
  28. :text="item.classType_dictText"
  29. plain
  30. size="mini"
  31. :type="
  32. item.classType_dictText == '早班'
  33. ? 'success'
  34. : item.classType_dictText == '中班'
  35. ? 'warning'
  36. : 'error'
  37. "
  38. >
  39. </u-tag>
  40. </view>
  41. </u-cell>
  42. </u-list-item>
  43. </u-list>
  44. <!-- 填报日期弹窗 -->
  45. <u-modal
  46. v-if="isShow"
  47. showCancelButton
  48. showConfirmButton
  49. confirmText="确定"
  50. cancelText="取消"
  51. :show="showTime"
  52. :title="titleTime"
  53. @confirm="confirmTime"
  54. @cancel="cancelTime"
  55. >
  56. <view class="dialog-item" @click="getChangeTime">
  57. <text class="dialog-label">任务日期:</text>
  58. <u--input
  59. readonly
  60. v-model="searchTime"
  61. placeholder="请选择任务日期"
  62. inputAlign="center"
  63. suffixIcon="arrow-right"
  64. ></u--input>
  65. <u-calendar
  66. :show="showCalendar"
  67. :minDate="minDate"
  68. :maxDate="maxDate"
  69. :monthNum="calendarMonthNum"
  70. v-model="searchTime"
  71. mode="single"
  72. closeOnClickOverlay
  73. @confirm="changeTime"
  74. @close="closeTime"
  75. ></u-calendar>
  76. </view>
  77. </u-modal>
  78. <component
  79. v-else
  80. :is="loadComponent"
  81. :taskId="taskId"
  82. @getBackBoard="getBackBoard"
  83. ></component>
  84. </view>
  85. </template>
  86. <script>
  87. import api from "@/api/api";
  88. import taskBoardAddress from "./taskBoardAddress.vue";
  89. import moment from "moment";
  90. export default {
  91. name: "taskBoard",
  92. components: {
  93. taskBoardAddress,
  94. },
  95. props: {},
  96. data() {
  97. return {
  98. showTime: false, //是否显示填报日期弹窗
  99. titleTime: "",
  100. searchTime: "", //检测时间
  101. showCalendar: false, //控制日期选型下拉开启
  102. // timeRan: Number(new Date()),
  103. minDate: moment()
  104. .subtract(30 * 10, "days")
  105. .format("YYYY-MM-DD"),
  106. // minDate: moment().subtract(160, 'days').format('YYYY-MM-DD'),
  107. maxDate: moment()
  108. .add(30 * 10, "days")
  109. .format("YYYY-MM-DD"),
  110. isShow: true,
  111. loadComponent: "",
  112. taskId: "",
  113. indexList: [],
  114. gasTitle: "巡检任务", //标题
  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: 90%;
  207. height: 100%;
  208. margin-top: 20px;
  209. background: #f9f9fb;
  210. border: 1rpx solid #fff;
  211. border-radius: 16rpx;
  212. margin-left: 20px;
  213. margin-right: 14px;
  214. }
  215. .dialog-item {
  216. display: flex;
  217. align-items: center;
  218. justify-content: center;
  219. .dialog-label {
  220. width: 86px;
  221. text-align: center;
  222. }
  223. }
  224. ::v-deep .u-input {
  225. display: flex;
  226. flex-direction: row;
  227. align-items: center;
  228. justify-content: space-between;
  229. padding: 3px 9px !important;
  230. width: 180px;
  231. }
  232. ::v-deep .u-popup {
  233. flex: 0;
  234. }
  235. ::v-deep .u-slot-title {
  236. display: flex;
  237. }
  238. </style>