patrolRoute.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. <template>
  2. <div class="main">
  3. <template v-if="isLook === 'index'">
  4. <div class="search">
  5. <el-input
  6. placeholder="请输入巡更点名称"
  7. class="search-input"
  8. clearable
  9. v-model="mixins_query.route_name"
  10. ></el-input>
  11. <el-select
  12. v-model="mixins_query.communityId"
  13. placeholder="请选择所属社区"
  14. clearable
  15. >
  16. <el-option
  17. v-for="(item, index) in communityArr"
  18. :key="index"
  19. :label="item.communityName"
  20. :value="item.id"
  21. ></el-option>
  22. </el-select>
  23. <el-button
  24. type="primary"
  25. class="search-btn"
  26. @click="mixins_search"
  27. icon="el-icon-search"
  28. >查询</el-button>
  29. <div class="search-icon">
  30. <el-tooltip
  31. class="item"
  32. effect="light"
  33. placement="bottom"
  34. content="排班"
  35. >
  36. <i
  37. class="zoniot_font zoniot-icon-piliangshenhe"
  38. @click="weekEdit()"
  39. ></i>
  40. </el-tooltip>
  41. <el-tooltip
  42. class="item"
  43. effect="light"
  44. placement="bottom"
  45. content="新增"
  46. >
  47. <i
  48. class="zoniot_font zoniot-icon-tianjia2"
  49. @click="add()"
  50. ></i>
  51. </el-tooltip>
  52. </div>
  53. </div>
  54. <zz-table
  55. :cols="cols"
  56. :settings="{ showIndex: true, stripe: true }"
  57. :loading="mixins_onQuery"
  58. :data="mixins_list"
  59. :pageset="mixins_pageset"
  60. @page-change="pageChange"
  61. >
  62. <template
  63. slot-scope="scope"
  64. slot="startDate"
  65. >
  66. {{ checkDateType(scope.row.startDate) }}{{ '至' + checkDateType(scope.row.endDate) }}</template>
  67. <template
  68. slot-scope="scope"
  69. slot="periodValue"
  70. >{{
  71. scope.row.periodType == 1 ? `每周${periodValueType(scope.row.periodValue)}` : `每隔${scope.row.periodValue}天`
  72. }}</template>
  73. <template
  74. slot-scope="scope"
  75. slot="opt"
  76. >
  77. <div class="opt">
  78. <!-- <el-tooltip
  79. effect="light"
  80. placement="bottom"
  81. content="排班"
  82. >
  83. <i
  84. class="zoniot_font zoniot-icon-shenhe"
  85. @click="schedulingEdit(scope.row)"
  86. ></i>
  87. </el-tooltip> -->
  88. <el-tooltip
  89. effect="light"
  90. placement="bottom"
  91. content="详情"
  92. >
  93. <i
  94. class="zoniot_font zoniot-icon-xiangqing"
  95. @click="details(scope.row)"
  96. ></i>
  97. </el-tooltip>
  98. <el-tooltip
  99. effect="light"
  100. placement="bottom"
  101. content="删除"
  102. >
  103. <i
  104. class="zoniot_font zoniot-icon-shanchu redText"
  105. @click="deleteOne(scope.row.id)"
  106. ></i>
  107. </el-tooltip>
  108. </div>
  109. </template>
  110. </zz-table>
  111. </template>
  112. <scheduling
  113. v-if="isLook === 'schedu'"
  114. @initPage="initPage"
  115. ></scheduling>
  116. <add-patrol
  117. v-if="isLook === 'patrol'"
  118. @initPage="initPage"
  119. :patrolDetail="patrolDetail"
  120. :disable='disable'
  121. ></add-patrol>
  122. <week-edit-page
  123. v-if="isLook === 'weekEd'"
  124. @initPage="initPage"
  125. ></week-edit-page>
  126. </div>
  127. </template>
  128. <script>
  129. import list from '@utils/list.js';
  130. import scheduling from './popups/scheduling.vue';
  131. import addPatrol from './popups/addPatrol.vue';
  132. import weekEditPage from './popups/weekEdit.vue';
  133. export default {
  134. mixins: [list],
  135. name: 'patrolManagement',
  136. components: {
  137. scheduling,
  138. addPatrol,
  139. weekEditPage
  140. },
  141. data () {
  142. let _this = this;
  143. return {
  144. isLook: 'index', // index , schedu,patrol 主页 日历 添加
  145. communityArr: [],
  146. cols: [
  147. {
  148. label: '所属社区',
  149. prop: 'communityName'
  150. },
  151. {
  152. label: '巡更路线',
  153. prop: 'routeName'
  154. },
  155. {
  156. label: '巡更日期',
  157. prop: 'startDate',
  158. slot: 'startDate'
  159. },
  160. {
  161. label: '巡更时间',
  162. prop: 'timePeriod'
  163. },
  164. {
  165. label: '巡更周期',
  166. prop: 'periodValue',
  167. slot: 'periodValue'
  168. },
  169. {
  170. label: '操作',
  171. prop: 'id',
  172. slot: 'opt'
  173. }
  174. ],
  175. findUser: [],
  176. thisObj: {},
  177. mixins_post: 'post',
  178. patrolDetail: {},
  179. disable: ''
  180. };
  181. },
  182. created () {
  183. this.getorgTree();
  184. this.mixins_dataUrl = '/czc-community/patrolRoute/page';
  185. this.mixins_query = {};
  186. this.mixins_search();
  187. this.getUserList();
  188. },
  189. mounted () { },
  190. methods: {
  191. deleteOne (id) {
  192. this.$msgBox(`删除`, '删除后将无法恢复,请问是否继续?')
  193. .then(() => {
  194. this.$http.get('/czc-community/patrolRoute/delete', { id: id }).then(({ status, data, msg }) => {
  195. if (0 === status) {
  196. this.$message({
  197. type: 'success',
  198. message: '删除成功!'
  199. });
  200. this.mixins_search();
  201. }
  202. });
  203. })
  204. .catch(() => { });
  205. },
  206. getorgTree () {
  207. this.$http
  208. .get('/czc-community/assets/community/list')
  209. .then((data) => {
  210. this.communityArr = data.data;
  211. this.$store.commit('setAreaSelect', data.data);
  212. })
  213. .catch(function () { });
  214. },
  215. getUserList () {
  216. this.$http.get('/czc-user-center/user/findUserList').then(({ data, status, msg }) => {
  217. this.findUser = data;
  218. });
  219. },
  220. add () {
  221. this.disable = '2';
  222. this.patrolDetail = {};
  223. this.isLook = 'patrol';
  224. },
  225. details (row) {
  226. this.disable = '1';
  227. this.patrolDetail = row;
  228. this.isLook = 'patrol';
  229. },
  230. schedulingEdit (row) {
  231. this.thisObj = row;
  232. this.isLook = 'schedu';
  233. },
  234. weekEdit () {
  235. this.isLook = 'weekEd';
  236. },
  237. initPage () {
  238. this.isLook = 'index';
  239. this.thisObj = {};
  240. this.mixins_search();
  241. },
  242. periodValueType (value) {
  243. if (!!value) {
  244. return value.split(',').sort().toString();
  245. }
  246. return '--';
  247. },
  248. checkDateType (time) {
  249. return !!time ? this.$moment(new Date(time)).format('YYYY-MM-DD') : '--';
  250. }
  251. }
  252. };
  253. </script>
  254. <style scoped lang='scss'>
  255. .main {
  256. height: 100%;
  257. }
  258. </style>