index.vue 15 KB

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