index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  1. <!--巡查计划-->
  2. <template>
  3. <div class="app-container inspectionPlan">
  4. <div class="page-container" v-if="pageType == 1">
  5. <div class="page-form-title-box">
  6. <el-form :model="queryParams" class="form-box" ref="queryForm" :inline="true" label-width="80px">
  7. <div class="form-button-max-big-box">
  8. <div class="form-button-big-box">
  9. <p class="text-p" :class="queryParams.checkStatus=='0'?'checkDiv':''" @click="topLeftClickType('0')">全部</p>
  10. <p class="text-p" :class="queryParams.checkStatus=='1'?'checkDiv':''" @click="topLeftClickType('1')">未开始</p>
  11. <p class="text-p" :class="queryParams.checkStatus=='2'?'checkDiv':''" @click="topLeftClickType('2')">进行中</p>
  12. <p class="text-p" :class="queryParams.checkStatus=='3'?'checkDiv':''" @click="topLeftClickType('3')">已结束</p>
  13. </div>
  14. </div>
  15. <!--与我相关-->
  16. <div class="form-button-max-big-box-me">
  17. <div class="form-button-big-box-me">
  18. <div :class="queryParams.myRelated==1?'checkDiv-me':''" @click="topRightClickType">
  19. <p class="text-p-me">与我有关{{correlationNum}}</p>
  20. <p class="el-icon-check icon-p-me" v-if="queryParams.myRelated==1"></p>
  21. </div>
  22. </div>
  23. </div>
  24. <el-form-item label="" prop="searchValue" style="margin-left:10px;" label-width="70px">
  25. <el-input
  26. maxLength="30"
  27. v-model="queryParams.searchValue"
  28. placeholder="计划标题/创建人"
  29. clearable
  30. style="width: 200px"
  31. />
  32. </el-form-item>
  33. <el-form-item label="" prop="dateRange" label-width="70px">
  34. <el-date-picker
  35. :clearable="false"
  36. v-model="dateRange"
  37. size="small"
  38. style="width: 240px"
  39. value-format="yyyy-MM-dd"
  40. type="daterange"
  41. range-separator="-"
  42. start-placeholder="开始日期"
  43. end-placeholder="结束日期"
  44. ></el-date-picker>
  45. </el-form-item>
  46. <p class="page-inquire-common-style-button" @click="handleQuery" style="margin-right:10px;">查询</p>
  47. <p class="page-reset-common-style-button" @click="resetQuery">重置</p>
  48. <p class="page-add-common-style-button"
  49. style="width:130px;float: right;"
  50. @click="addDialogOpen(1)"
  51. >创建巡查计划</p>
  52. </el-form>
  53. </div>
  54. <div class="page-content-box">
  55. <el-table class="table-box" border :data="tableList" ref="multipleTable" @sort-change="sortChange">
  56. <el-table-column label="序号" align="center" type="index" width="60" />
  57. <el-table-column label="计划标题" align="center" prop="title" show-overflow-tooltip/>
  58. <el-table-column label="检查范围" align="center" prop="checkRange" show-overflow-tooltip width="120">
  59. <template slot-scope="scope">
  60. <p>{{scope.row.checkRange==1?'全校':(scope.row.checkRange==2?'学院':(scope.row.checkRange==3?'实验室':''))}}</p>
  61. </template>
  62. </el-table-column>
  63. <el-table-column label="检查类型" align="center" prop="checkRange" show-overflow-tooltip width="120">
  64. <template slot-scope="scope">
  65. <p>{{scope.row.checkCategory==1?'综合检查':(scope.row.checkCategory==2?'专项检查':'-')}}</p>
  66. </template>
  67. </el-table-column>
  68. <el-table-column label="计划周期" align="center" prop="cycleStartTime" show-overflow-tooltip width="260">
  69. <template slot-scope="scope">
  70. <p>{{scope.row.cycleStartTime}} 至 {{scope.row.cycleEndTime}}<span style="color:#EE0606;margin-left:15px;" v-if="scope.row.isOverdue==1">已逾期</span></p>
  71. </template>
  72. </el-table-column>
  73. <el-table-column label="状态" align="center" prop="checkStatus" show-overflow-tooltip width="80">
  74. <template slot-scope="scope">
  75. <p :class="scope.row.checkStatus==1?'checkStatus-color-1':(scope.row.checkStatus==2?'checkStatus-color-2':(scope.row.checkStatus==3?'checkStatus-color-3':''))">{{scope.row.checkStatus==1?'未开始':(scope.row.checkStatus==2?'进行中':(scope.row.checkStatus==3?'已结束':''))}}</p>
  76. </template>
  77. </el-table-column>
  78. <el-table-column label="检查进度" align="center" prop="checkSchedule" show-overflow-tooltip width="210"/>
  79. <el-table-column label="创建人" align="center" prop="createName" show-overflow-tooltip width="130"/>
  80. <el-table-column label="创建时间" sortable="custom" align="center" prop="createTime" show-overflow-tooltip width="157"/>
  81. <el-table-column label="操作" align="center" prop="deptName" width="280">
  82. <template slot-scope="scope">
  83. <div class="table-button-box">
  84. <p class="table-button-null"></p>
  85. <p class="table-button-p" v-hasPermiRouter="['security:checkPlan:query']"
  86. v-show="scope.row.checkStatus!=1" @click="addDialogOpen(3,scope.row)">详情</p>
  87. <p class="table-button-p" v-hasPermiRouter="['security:checkPlan:edit']"
  88. v-show="scope.row.checkStatus==1&&scope.row.isSelfData == 1" @click="addDialogOpen(2,scope.row)">编辑</p>
  89. <p class="table-button-p" v-hasPermiRouter="['security:checkManage_2:list']"
  90. @click="goPage(2,scope.row)">巡查管理</p>
  91. <p class="table-button-p" v-hasPermiRouter="['security:checkPlan:remove']"
  92. v-show="scope.row.checkStatus==1&&scope.row.isSelfData == 1" @click="deleteObj(scope.row)">删除</p>
  93. <p class="table-button-p" v-show="scope.row.isAttachment == 1" @click="lookDocumentListButton(1,scope.row)">查看附件</p>
  94. <p class="table-button-null"></p>
  95. </div>
  96. </template>
  97. </el-table-column>
  98. </el-table>
  99. <pagination :page-sizes="[20, 30, 40, 50]"
  100. v-show="total>0"
  101. :total="total"
  102. :page.sync="queryParams.page"
  103. :limit.sync="queryParams.pageSize"
  104. @pagination="getList"
  105. />
  106. </div>
  107. </div>
  108. <list-page v-if="pageType == 2" :propsListPageData="propsListPageData"></list-page>
  109. <add-dialog v-if="addDialogType" :addDialogData="addDialogData"></add-dialog>
  110. <lookDocumentListDialog v-if="lookDocumentListType" :propsLookDocumentListData="propsLookDocumentListData"></lookDocumentListDialog>
  111. </div>
  112. </template>
  113. <script>
  114. import addDialog from './addDialog.vue'
  115. import listPage from './listPage.vue'
  116. import lookDocumentListDialog from '@/components/lookDocumentDialog/lookDocumentListDialog.vue'
  117. import { checkPlanList,checkPlanDelete,getFindByCheckPlanId } from '@/apiDemo/safetyCheck/index'
  118. export default {
  119. name: 'index',
  120. components: {
  121. addDialog,
  122. listPage,
  123. lookDocumentListDialog
  124. },
  125. data(){
  126. return{
  127. //子组件数据
  128. lookDocumentListType:false,
  129. propsLookDocumentListData:{},
  130. propsListPageData:{},
  131. addDialogType:false,
  132. addDialogData:{},
  133. pageType:1,
  134. queryParams:{
  135. page:1,
  136. pageSize:20,
  137. checkStatus:0,
  138. createTimeSort:0,
  139. searchValue:"",
  140. checkType:1,
  141. myRelated:1,
  142. },
  143. dateRange:[],
  144. tableList:[],
  145. total:0,
  146. correlationNum:'',
  147. }
  148. },
  149. created(){
  150. },
  151. mounted(){
  152. this.getList();
  153. },
  154. methods:{
  155. //获取相关数量
  156. getCorrelationNum(){
  157. checkPlanList({
  158. page:1,
  159. pageSize:20,
  160. createTimeSort:0,
  161. checkType:1,
  162. myRelated:1,
  163. checkStatus:this.queryParams.checkStatus,
  164. searchValue:this.queryParams.searchValue,
  165. cycleStartTime:this.dateRange[0]?this.dateRange[0]+'T00:00:00':'',
  166. cycleEndTime:this.dateRange[1]?this.dateRange[1]+'T23:59:59':'',
  167. }).then(response => {
  168. this.$set(this,'correlationNum',response.data.total>999?' 999+':(response.data.total<1?'':' '+response.data.total));
  169. });
  170. },
  171. //与我相关按钮
  172. topRightClickType(){
  173. this.$set(this.queryParams,'myRelated',this.queryParams.myRelated==1?0:1);
  174. this.handleQuery();
  175. },
  176. //切换页面
  177. goPage(type,data){
  178. if(this.pageType != type){
  179. if(type == 2){
  180. this.$set(this,'propsListPageData',data);
  181. this.$set(this,'pageType',type);
  182. }else if(type == 1){
  183. this.$set(this,'pageType',type);
  184. }else if(type == 3){
  185. this.$set(this,'pageType',1);
  186. this.getList();
  187. }
  188. }
  189. },
  190. //弹窗开启
  191. addDialogOpen(type,data){
  192. if(type==1){
  193. this.$set(this,'addDialogData',{
  194. title:"创建巡查计划",
  195. lookInfoType:false,
  196. addType:true,
  197. })
  198. this.$set(this,'addDialogType',true);
  199. }else if(type==2){
  200. this.$set(this,'addDialogData',{
  201. title:"编辑巡查计划",
  202. id:data.id,
  203. lookInfoType:false,
  204. addType:false,
  205. })
  206. this.$set(this,'addDialogType',true);
  207. }else if(type==3){
  208. this.$set(this,'addDialogData',{
  209. title:"巡查计划详情",
  210. id:data.id,
  211. lookInfoType:true,
  212. addType:false,
  213. })
  214. this.$set(this,'addDialogType',true);
  215. }else if(type==4){
  216. this.$set(this,'addDialogType',false);
  217. }else if(type == 5){
  218. this.$set(this,'addDialogType',false);
  219. this.getList();
  220. }
  221. },
  222. //范围选择
  223. topLeftClickType(type){
  224. if(this.queryParams.checkStatus != type){
  225. this.$set(this.queryParams,'checkStatus',type);
  226. this.handleQuery();
  227. }
  228. },
  229. //时间排序方法
  230. sortChange(val){
  231. if(val.prop == 'createTime'){
  232. this.$set(this.queryParams,'createTimeSort',val.order=='ascending'?'1':(val.order=='descending'?'2':'0'));
  233. this.handleQuery();
  234. }
  235. },
  236. //获取数据列表
  237. getList(){
  238. let obj = JSON.parse(JSON.stringify(this.queryParams))
  239. if(this.dateRange[0]){
  240. obj.cycleStartTime = this.dateRange[0]+'T00:00:00';
  241. obj.cycleEndTime = this.dateRange[1]+'T23:59:59';
  242. }else{
  243. obj.cycleStartTime = "";
  244. obj.cycleEndTime = "";
  245. }
  246. let self = this;
  247. setTimeout(function(){
  248. self.getCorrelationNum();
  249. },500);
  250. checkPlanList(obj).then(response => {
  251. this.total = response.data.total;
  252. this.tableList = response.data.records;
  253. });
  254. },
  255. /** 搜索按钮操作 */
  256. handleQuery() {
  257. this.$set(this.queryParams,'page',1);
  258. this.getList();
  259. },
  260. /** 重置按钮操作 */
  261. resetQuery() {
  262. this.$set(this,'dateRange',[]);
  263. this.$set(this,'queryParams',{
  264. page:1,
  265. pageSize:20,
  266. checkStatus:0,
  267. createTimeSort:0,
  268. searchValue:"",
  269. checkType:1,
  270. myRelated:1,
  271. });
  272. this.handleQuery();
  273. },
  274. //删除
  275. deleteObj(obj){
  276. let self = this;
  277. this.$confirm('是否确认删除?', "警告", {
  278. confirmButtonText: "确定",
  279. cancelButtonText: "取消",
  280. type: "warning"
  281. }).then(function() {
  282. checkPlanDelete({id:obj.id,checkType:obj.checkType}).then(response => {
  283. self.msgSuccess(response.msg)
  284. self.getList();
  285. })
  286. }).then(() => {
  287. }).catch(() => {});
  288. },
  289. //查看多个文档
  290. lookDocumentListButton(type,row){
  291. if(type==1){
  292. getFindByCheckPlanId({checkPlanId:row.id}).then(response => {
  293. let list = [];
  294. for(let i=0;i<response.data.length;i++){
  295. let obj = {
  296. name:response.data[i].fileName,
  297. url:response.data[i].fileUrl,
  298. }
  299. list.push(obj);
  300. }
  301. this.$set(this,'propsLookDocumentListData',{
  302. title:"查看附件",
  303. list:list
  304. });
  305. this.$set(this,'lookDocumentListType',true);
  306. });
  307. }else{
  308. this.$set(this,'lookDocumentListType',false);
  309. }
  310. },
  311. }
  312. }
  313. </script>
  314. <style scoped lang="scss">
  315. .inspectionPlan{
  316. flex: 1;
  317. display: flex !important;
  318. flex-direction: column;
  319. overflow: hidden;
  320. .page-container{
  321. .page-form-title-box{
  322. .form-button-max-big-box{
  323. display: inline-block;
  324. overflow: hidden;
  325. .form-button-big-box{
  326. display: flex;
  327. p:nth-child(1){
  328. border-top-left-radius: 4px;
  329. border-bottom-left-radius: 4px;
  330. border-top:1px solid #E0E0E0;
  331. border-bottom:1px solid #E0E0E0;
  332. }
  333. p:nth-child(2){
  334. border-top:1px solid #E0E0E0;
  335. border-bottom:1px solid #E0E0E0;
  336. }
  337. p:nth-child(3){
  338. border-top:1px solid #E0E0E0;
  339. border-bottom:1px solid #E0E0E0;
  340. }
  341. p:nth-child(4){
  342. border-top-right-radius: 4px;
  343. border-bottom-right-radius: 4px;
  344. border-top:1px solid #E0E0E0;
  345. border-bottom:1px solid #E0E0E0;
  346. border-right:1px solid #E0E0E0;
  347. }
  348. p{
  349. height:40px;
  350. width:80px;
  351. line-height: 40px;
  352. text-align: center;
  353. color:#666666;
  354. font-size:14px;
  355. font-weight:500;
  356. cursor: pointer;
  357. border-left:1px solid #E0E0E0;
  358. }
  359. .checkDiv{
  360. color:#fff!important;
  361. border:1px solid #0183FA!important;
  362. background-color: #0183FA;
  363. }
  364. }
  365. }
  366. .form-button-max-big-box-me{
  367. display: inline-block;
  368. overflow: hidden;
  369. .form-button-big-box-me{
  370. display: flex;
  371. div{
  372. position: relative;
  373. height:40px;
  374. width:130px;
  375. line-height: 40px;
  376. text-align: center;
  377. color:#999;
  378. font-size:14px;
  379. border:1px solid #999;
  380. border-radius:4px;
  381. margin-left:10px;
  382. font-weight:500;
  383. cursor: pointer;
  384. .icon-p-me{
  385. width:15px;
  386. height:15px;
  387. line-height:15px;
  388. text-align: center;
  389. position: absolute;
  390. right:0;
  391. bottom:0;
  392. color:#fff;
  393. background: #0183fa;
  394. border-top-left-radius:4px;
  395. }
  396. }
  397. .checkDiv-me{
  398. color:#0183FA!important;
  399. border:1px solid #0183FA!important;
  400. }
  401. }
  402. }
  403. }
  404. .page-content-box{
  405. .checkStatus-color-1{
  406. color:#0183FA;
  407. }
  408. .checkStatus-color-2{
  409. color:#EE0606;
  410. }
  411. .checkStatus-color-3{
  412. color:#23B303;
  413. }
  414. }
  415. }
  416. }
  417. </style>