index.vue 16 KB

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