index.vue 15 KB

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