taskBoard.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  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. v-model="searchTime"
  68. mode="single"
  69. closeOnClickOverlay
  70. @confirm="changeTime"
  71. @close="closeTime"
  72. ></u-calendar>
  73. </view>
  74. </u-modal>
  75. <component
  76. v-else
  77. :is="loadComponent"
  78. :taskId="taskId"
  79. @getBackBoard="getBackBoard"
  80. ></component>
  81. </view>
  82. </template>
  83. <script>
  84. import api from "@/api/api";
  85. import taskBoardAddress from "./taskBoardAddress.vue";
  86. import moment from "moment";
  87. export default {
  88. name: "taskBoard",
  89. components: {
  90. taskBoardAddress,
  91. },
  92. props: {},
  93. data() {
  94. return {
  95. showTime: false, //是否显示填报日期弹窗
  96. titleTime: "",
  97. searchTime: "", //检测时间
  98. showCalendar: false, //控制日期选型下拉开启
  99. // timeRan: Number(new Date()),
  100. minDate: moment()
  101. .subtract(30 * 10, "days")
  102. .format("YYYY-MM-DD"),
  103. // minDate: moment().subtract(160, 'days').format('YYYY-MM-DD'),
  104. maxDate: moment()
  105. .add(30 * 10, "days")
  106. .format("YYYY-MM-DD"),
  107. isShow: true,
  108. loadComponent: "",
  109. taskId: "",
  110. indexList: [],
  111. gasTitle: "巡检任务", //标题
  112. backPic0: "url(/static/topnavbar0.png)",
  113. backPic: "url(../../static/topnavbar.png)",
  114. };
  115. },
  116. computed: {
  117. teamCode: function () {
  118. return uni.getStorageSync("login_user_info")["districtTeam"];
  119. },
  120. },
  121. mounted() {
  122. this.getTimeList();
  123. },
  124. methods: {
  125. //左上角返回键:直接返回首页
  126. goBack() {
  127. this.$emit("goHome");
  128. },
  129. //点击弹出日期下拉选项
  130. getChangeTime() {
  131. this.showCalendar = true;
  132. },
  133. changeTime(e) {
  134. let that = this;
  135. that.searchTime = e[0];
  136. uni.setStorageSync("searchTime", that.searchTime);
  137. that.showCalendar = false;
  138. },
  139. closeTime() {
  140. this.searchTime = "";
  141. this.showCalendar = false;
  142. },
  143. //点击返回上一级
  144. getBackBoard() {
  145. let that = this;
  146. that.isShow = true;
  147. that.loadComponent = "";
  148. },
  149. //点击跳转到识别看板
  150. getBorad(item) {
  151. let that = this;
  152. that.taskId = item.id;
  153. that.showTime = true;
  154. },
  155. //选择检测时间-确定
  156. confirmTime() {
  157. let that = this;
  158. if (that.searchTime) {
  159. that.isShow = false;
  160. that.showTime = false;
  161. that.loadComponent = "taskBoardAddress";
  162. }
  163. },
  164. //选择检测时间-取消
  165. cancelTime() {
  166. let that = this;
  167. that.isShow = true;
  168. that.showTime = false;
  169. },
  170. //获取任务管理列表数据
  171. getTimeList() {
  172. let that = this;
  173. new Promise((resolve, reject) => {
  174. api
  175. .teamList({ pageNo: 1, pageSize: 100, teamCode: that.teamCode })
  176. .then((response) => {
  177. if (response.data.code == 200) {
  178. that.indexList = response.data.result.records;
  179. } else {
  180. reject(response);
  181. }
  182. })
  183. .catch((error) => {
  184. console.log("catch===>response", response);
  185. reject(error);
  186. });
  187. });
  188. },
  189. },
  190. };
  191. </script>
  192. <style lang="scss" scoped>
  193. .taskBoard {
  194. position: relative;
  195. width: 100%;
  196. height: 100%;
  197. background-color: #fff;
  198. }
  199. .dialog-item {
  200. display: flex;
  201. align-items: center;
  202. justify-content: center;
  203. .dialog-label {
  204. width: 70px;
  205. text-align: center;
  206. }
  207. }
  208. ::v-deep .u-input {
  209. display: flex;
  210. flex-direction: row;
  211. align-items: center;
  212. justify-content: space-between;
  213. padding: 3px 9px !important;
  214. width: 180px;
  215. }
  216. ::v-deep .u-popup {
  217. flex: 0;
  218. }
  219. ::v-deep .u-slot-title {
  220. display: flex;
  221. }
  222. </style>