index.vue 15 KB

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