patrol.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476
  1. <!-- -->
  2. <template>
  3. <div>
  4. <!-- <h2> class="m-container"
  5. <div class="squrt"></div>
  6. 乐团巡查
  7. <filter-search
  8. :keys="['searchType']"
  9. :moreKeys="['organId', 'start', 'end']"
  10. @reload="reloadSearch"
  11. />
  12. </h2> -->
  13. <div class="m-core">
  14. <save-form
  15. :inline="true"
  16. ref="searchForm"
  17. @submit="search"
  18. @reset="onReSet"
  19. :model="searchForm"
  20. :saveKey="`indexErrDataRecord-${searchType}`"
  21. >
  22. <el-form-item prop="search">
  23. <el-input
  24. type="text"
  25. placeholder="请输入乐团名称"
  26. clearable
  27. v-model="searchForm.search"
  28. />
  29. </el-form-item>
  30. <el-form-item prop="organId">
  31. <el-select
  32. class="multiple"
  33. v-model.trim="searchForm.organId"
  34. filterable
  35. clearable
  36. @change="onBranchChange"
  37. placeholder="请选择分部"
  38. >
  39. <el-option
  40. v-for="(item, index) in selects.branchs"
  41. :key="index"
  42. :label="item.name"
  43. :value="item.id"
  44. ></el-option>
  45. </el-select>
  46. </el-form-item>
  47. <el-form-item prop="cooperationOrganId">
  48. <el-select
  49. class="multiple"
  50. :disabled="!searchForm.organId"
  51. v-model.trim="searchForm.cooperationOrganId"
  52. filterable
  53. clearable
  54. placeholder="请选择合作单位"
  55. >
  56. <el-option
  57. v-for="(item, index) in cooperationList"
  58. :key="index"
  59. :label="item.name"
  60. :value="item.id"
  61. ></el-option>
  62. </el-select>
  63. </el-form-item>
  64. <el-form-item prop="userId">
  65. <el-select
  66. class="multiple"
  67. v-model.trim="searchForm.userId"
  68. filterable
  69. clearable
  70. placeholder="请选择乐团主管"
  71. >
  72. <el-option
  73. v-for="(item, index) in selects.roles.educationId"
  74. :key="index"
  75. :label="item.userName"
  76. :value="item.userId"
  77. >
  78. <span style="float: left">{{ item.userName }}</span>
  79. <span style="float: right; color: #8492a6; font-size: 13px">{{
  80. item.userId
  81. }}</span>
  82. </el-option>
  83. </el-select>
  84. </el-form-item>
  85. <el-form-item prop="hasDealTime">
  86. <el-select
  87. v-model.trim="searchForm.hasDealTime"
  88. clearable
  89. filterable
  90. placeholder="是否处理异常"
  91. >
  92. <el-option label="是" value="1"></el-option>
  93. <el-option label="否" value="0"></el-option>
  94. </el-select>
  95. </el-form-item>
  96. <el-form-item prop="createTimer">
  97. <el-date-picker
  98. v-model.trim="searchForm.createTimer"
  99. type="daterange"
  100. value-format="yyyy-MM-dd"
  101. range-separator="至"
  102. start-placeholder="巡查开始日期"
  103. end-placeholder="巡查结束日期"
  104. :picker-options="{ firstDayOfWeek: 1 }"
  105. >
  106. </el-date-picker>
  107. </el-form-item>
  108. <el-form-item>
  109. <el-button type="danger" native-type="submit">搜索</el-button>
  110. <el-button native-type="reset" type="primary">重置</el-button>
  111. </el-form-item>
  112. </save-form>
  113. <div class="tableWrap">
  114. <el-table
  115. style="width: 100%"
  116. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  117. :data="tableList"
  118. >
  119. <el-table-column
  120. align="center"
  121. prop="id"
  122. width="120px"
  123. label="巡查编号"
  124. >
  125. </el-table-column>
  126. <el-table-column align="center" label="所属分部">
  127. <template slot-scope="scope">
  128. {{ scope.row.organName }}(<copy-text>{{
  129. scope.row.organId
  130. }}</copy-text
  131. >)
  132. </template>
  133. </el-table-column>
  134. <el-table-column
  135. align="center"
  136. prop="cooperationName"
  137. label="合作单位"
  138. ></el-table-column>
  139. <el-table-column
  140. align="center"
  141. prop="musicGroupName"
  142. label="巡查乐团"
  143. >
  144. <template slot-scope="scope">
  145. {{ scope.row.musicGroupName }}(<copy-text>{{
  146. scope.row.musicGroupId
  147. }}</copy-text
  148. >)
  149. </template>
  150. </el-table-column>
  151. <el-table-column align="center" label="乐团主管">
  152. <template slot-scope="scope">
  153. {{ scope.row.realName }}(<copy-text>{{
  154. scope.row.userId
  155. }}</copy-text
  156. >)
  157. </template>
  158. </el-table-column>
  159. <el-table-column align="center" label="巡查项目是否异常">
  160. <template slot-scope="scope">
  161. {{ scope.row.conclusionStatus ?'否':'是'}}
  162. </template>
  163. </el-table-column>
  164. <el-table-column align="center" prop="subject" label="巡查时间" width="103px">
  165. <template slot-scope="scope">
  166. {{ dayjs(scope.row.planStart).format("YYYY-MM-DD HH:mm") }}~{{ dayjs(scope.row.planEnd).format("HH:mm") }}
  167. </template>
  168. </el-table-column>
  169. <el-table-column
  170. align="center"
  171. prop="submitedTime"
  172. label="提交时间"
  173. ></el-table-column>
  174. <el-table-column align="center" prop="status" label="提交状态">
  175. <template slot-scope="scope">
  176. {{ scope.row.status | statusFormat }}
  177. </template>
  178. </el-table-column>
  179. <el-table-column align="center" label="处理方式">
  180. <template slot-scope="scope">
  181. <overflow-text
  182. width="100%"
  183. :text="scope.row.memo"
  184. ></overflow-text>
  185. </template>
  186. </el-table-column>
  187. <el-table-column align="center" label="异常产生时间">
  188. <template slot-scope="scope">
  189. <div>
  190. {{ scope.row.generateTime | dayjsFormat }}
  191. </div>
  192. </template>
  193. </el-table-column>
  194. <el-table-column align="center" label="异常处理时间" width="103px">
  195. <template slot-scope="scope">
  196. <div>
  197. {{ scope.row.dealTime }}
  198. </div>
  199. </template>
  200. </el-table-column>
  201. <el-table-column
  202. align="center"
  203. width="250px"
  204. label="操作"
  205. v-if="searchType == 'MUSIC_PATROL_ITEM'"
  206. >
  207. <template slot-scope="scope">
  208. <auth
  209. auths="inspectionItemPlanConclusion/getPlanConclusion/4403"
  210. v-if="scope.row.status != 0"
  211. >
  212. <el-button type="text" @click="onLook(scope.row)"
  213. >查看</el-button
  214. >
  215. </auth>
  216. <auth
  217. auths="inspectionItemPlanConclusion/GPS-INFO/4404"
  218. v-if="scope.row.status != 0"
  219. >
  220. <el-button type="text" @click="onGPS(scope.row)"
  221. >GPS定位</el-button
  222. >
  223. </auth>
  224. <auth
  225. auths="inspectionItemPlanConclusion/exportPlanConclusion/4405"
  226. v-if="scope.row.status != 0"
  227. >
  228. <el-button type="text" @click="onExport(scope.row)"
  229. >下载</el-button
  230. >
  231. </auth>
  232. <!-- <auth
  233. auths="inspectionItemPlan/updateMemo"
  234. v-if="scope.row.conclusionStatus == 1 || scope.row.status == 0"
  235. >
  236. <el-button type="text" @click="handleClick(scope.row)"
  237. >立即处理</el-button
  238. >
  239. </auth> -->
  240. </template>
  241. </el-table-column>
  242. </el-table>
  243. <pagination
  244. :saveKey="`indexErrDataRecord-${searchType}`"
  245. :total.sync="pageInfo.total"
  246. sync
  247. :page.sync="pageInfo.page"
  248. :limit.sync="pageInfo.limit"
  249. :page-sizes="pageInfo.page_size"
  250. @pagination="getList"
  251. />
  252. </div>
  253. </div>
  254. <el-dialog title="乐团巡查表" :visible.sync="tableStatus" width="1200px">
  255. <look-detail v-if="tableStatus" :detail="planDetail" />
  256. </el-dialog>
  257. <el-dialog
  258. title="GPS定位"
  259. :visible.sync="gpsVisible"
  260. width="1000px"
  261. append-to-body
  262. >
  263. <gpsLoction v-if="gpsVisible" :activeRow="activeRow" />
  264. </el-dialog>
  265. <el-dialog
  266. title="处理方式"
  267. :visible.sync="handleStatus"
  268. @close="handleClose('ruleForm')"
  269. width="500px"
  270. >
  271. <el-form :model="handleForm" label-position="top" ref="ruleForm">
  272. <el-form-item
  273. label="处理方式"
  274. prop="memo"
  275. :rules="[
  276. { required: true, message: '请输入处理方式', trigger: 'blur' },
  277. ]"
  278. >
  279. <el-input type="textarea" v-model.trim="handleForm.memo"></el-input>
  280. </el-form-item>
  281. </el-form>
  282. <span slot="footer" class="dialog-footer">
  283. <el-button @click="handleStatus = false">取 消</el-button>
  284. <el-button @click="onHandleSubmit('ruleForm')" type="primary"
  285. >确 定</el-button
  286. >
  287. </span>
  288. </el-dialog>
  289. </div>
  290. </template>
  291. <script>
  292. import pagination from "@/components/Pagination/index";
  293. import LookDetail from "@/views/musicInspection/modals/lookDetail";
  294. import dayjs from "dayjs";
  295. import { inspectionItemPlan, updateMemo } from "@/views/musicInspection/api";
  296. import { queryByOrganId } from "@/api/systemManage";
  297. import { getTeamList } from "@/api/teamServer";
  298. import { getTimes } from "@/utils";
  299. import { Export } from "@/utils/downLoadFile";
  300. import gpsLoction from "@/views/teamDetail/componentCourse/gpsLocation";
  301. import { getErrInspectionData } from "../api";
  302. export default {
  303. props: ["searchType"],
  304. components: { pagination, LookDetail, gpsLoction },
  305. data() {
  306. return {
  307. cooperationList: [],
  308. musicGroupList: [],
  309. activeRow: null,
  310. planDetail: null,
  311. searchForm: {
  312. search: null,
  313. organId: null,
  314. userId: null,
  315. // musicGroupId: null,
  316. conclusionStatus: null,
  317. cooperationOrganId: null,
  318. createTimer: [],
  319. hasDealTime:null
  320. },
  321. tableList: [],
  322. pageInfo: {
  323. // 分页规则
  324. limit: 10, // 限制显示条数
  325. page: 1, // 当前页
  326. total: 0, // 总条数
  327. page_size: [10, 20, 40, 50], // 选择限制显示条数
  328. },
  329. handleStatus: false,
  330. handleForm: {
  331. id: null,
  332. memo: null,
  333. },
  334. tableStatus: false,
  335. gpsVisible: false,
  336. };
  337. },
  338. async mounted() {
  339. const { query } = this.$route;
  340. if (query.organId) {
  341. this.searchForm.organId = query.organId;
  342. }
  343. if (query.conclusionStatus) {
  344. this.searchForm.conclusionStatus = Number(query.conclusionStatus);
  345. }
  346. if (query.start && query.end) {
  347. this.searchForm.createTimer = [query.start, query.end];
  348. }
  349. this.getList();
  350. // 分部
  351. await this.$store.dispatch("setBranchs");
  352. await this.$store.dispatch("setOrganRole");
  353. // 乐团列表 {只查询进行中的乐团}
  354. // await getTeamList({ musicGroupStatus: 'PROGRESS', rows: 9999 }).then(res => {
  355. // if(res.code == 200) {
  356. // this.musicGroupList = res.data.rows
  357. // }
  358. // })
  359. },
  360. methods: {
  361. dayjs,
  362. reloadSearch() {
  363. this.rules.page = 1;
  364. this.getList();
  365. },
  366. async getList() {
  367. // console.log(this.searchType)
  368. try {
  369. let { createTimer, ...rest } = this.searchForm;
  370. let params = {
  371. ...rest,
  372. page: this.pageInfo.page,
  373. rows: this.pageInfo.limit,
  374. searchType: this.searchType,
  375. ...getTimes(createTimer, ["startTime", "endTime"]),
  376. };
  377. const res = await getErrInspectionData(params);
  378. this.tableList = res.data.rows;
  379. this.pageInfo.total = res.data.total;
  380. } catch (err) {}
  381. },
  382. reloadSearch() {
  383. this.rules.page = 1;
  384. this.getList();
  385. },
  386. onLook(row) {
  387. this.planDetail = row;
  388. this.tableStatus = true;
  389. },
  390. onGPS(row) {
  391. this.activeRow = {
  392. schoolLongitudeLatitude: row.schoolGps,
  393. signOutLongitudeLatitude: row.submitedGps,
  394. };
  395. this.gpsVisible = true;
  396. },
  397. async onExport(row) {
  398. await Export(
  399. this,
  400. {
  401. url: "/api-web/inspectionItemPlanConclusion/exportPlanConclusion",
  402. fileName: "巡查结果.xls",
  403. method: "get",
  404. params: {
  405. planId: row.id,
  406. },
  407. },
  408. "您确定导出巡查结果?"
  409. );
  410. },
  411. async onBranchChange(value) {
  412. if (!value) {
  413. this.cooperationList = [];
  414. this.searchForm.cooperationOrganId = null;
  415. return;
  416. }
  417. // 合作单位
  418. await queryByOrganId({ organId: value }).then((res) => {
  419. if (res.code == 200) {
  420. this.cooperationList = res.data;
  421. }
  422. });
  423. },
  424. search() {
  425. this.pageInfo.page = 1;
  426. this.getList();
  427. },
  428. onReSet() {
  429. this.$refs["searchForm"].resetFields();
  430. this.pageInfo.page = 1;
  431. this.getList();
  432. },
  433. handleClick(row) {
  434. this.handleForm.id = row.id;
  435. this.handleForm.memo = row.memo;
  436. this.handleStatus = true;
  437. },
  438. onHandleSubmit(formName) {
  439. this.$refs[formName].validate(async (valid) => {
  440. if (valid) {
  441. console.log(this.handleForm);
  442. try {
  443. await updateMemo(this.handleForm);
  444. this.$message.success("处理成功");
  445. this.getList();
  446. this.handleStatus = false;
  447. } catch (err) {}
  448. }
  449. });
  450. },
  451. handleClose(formName) {
  452. this.$refs[formName].resetFields();
  453. },
  454. },
  455. filters: {
  456. statusFormat(value) {
  457. let template = ["未提交", "正常", "异常"];
  458. return template[value];
  459. },
  460. },
  461. };
  462. </script>
  463. <style lang='scss' scoped>
  464. /deep/.el-dialog__body {
  465. // padding: 10px 20px;
  466. }
  467. /deep/.description-title {
  468. margin: 0 !important;
  469. }
  470. </style>