index.vue 14 KB

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