index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. <!--巡查计划-->
  2. <template>
  3. <div class="app-container inspectionPlan">
  4. <div class="inspectionPlan-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.buttonType==1?'checkDiv':''" @click="topLeftClickType(1)">
  10. <p class="text-p">全部</p>
  11. <p class="el-icon-check icon-p" v-if="queryParams.buttonType==1"></p>
  12. </div>
  13. <div :class="queryParams.buttonType==2?'checkDiv':''" @click="topLeftClickType(2)">
  14. <p class="text-p">待检查</p>
  15. <p class="el-icon-check icon-p" v-if="queryParams.buttonType==2"></p>
  16. </div>
  17. <div :class="queryParams.buttonType==3?'checkDiv':''" @click="topLeftClickType(3)">
  18. <p class="text-p">检查中</p>
  19. <p class="el-icon-check icon-p" v-if="queryParams.buttonType==3"></p>
  20. </div>
  21. <div :class="queryParams.buttonType==4?'checkDiv':''" @click="topLeftClickType(4)">
  22. <p class="text-p">已检查</p>
  23. <p class="el-icon-check icon-p" v-if="queryParams.buttonType==4"></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. <el-form-item style="float: right;">
  54. <el-col :span="1.5">
  55. <p class="inquire-button-one"
  56. style="width:130px;"
  57. @click="addDialogOpen(1)"
  58. ><i class="el-icon-plus"></i> 创建巡查计划</p>
  59. </el-col>
  60. </el-form-item>
  61. </el-form>
  62. </div>
  63. <div class="content-box">
  64. <el-table border :data="tableList" ref="multipleTable" @sort-change="sortChange">
  65. <el-table-column label="序号" align="center" type="index" width="60" />
  66. <el-table-column label="计划标题" align="center" prop="deptName" show-overflow-tooltip/>
  67. <el-table-column label="检查范围" align="center" prop="deptName" show-overflow-tooltip width="120"/>
  68. <el-table-column label="检查周期" align="center" prop="deptName" show-overflow-tooltip width="280"/>
  69. <el-table-column label="检查状态" align="center" prop="deptName" show-overflow-tooltip width="130"/>
  70. <el-table-column label="检查进度" align="center" prop="deptName" show-overflow-tooltip width="220"/>
  71. <el-table-column label="创建人" align="center" prop="deptName" show-overflow-tooltip width="130"/>
  72. <el-table-column label="创建时间" sortable align="center" prop="deptName" show-overflow-tooltip width="157"/>
  73. <el-table-column label="操作" align="center" prop="deptName" width="200">
  74. <template slot-scope="scope">
  75. <div class="table-button-box">
  76. <p class="table-button-p" @click="addDialogOpen(2,scope.row)">编辑</p>
  77. <p class="table-button-p">删除</p>
  78. <p class="table-button-p" @click="addDialogOpen(3,scope.row)">详情</p>
  79. <p class="table-button-p" @click="goPage(2,scope.row)">巡查管理</p>
  80. <p class="table-button-p" @click="lookDocumentListButton(1,scope.row)">查看附件</p>
  81. </div>
  82. </template>
  83. </el-table-column>
  84. </el-table>
  85. <pagination :page-sizes="[20, 30, 40, 50]"
  86. v-show="total>0"
  87. :total="total"
  88. :page.sync="queryParams.pageNum"
  89. :limit.sync="queryParams.pageSize"
  90. @pagination="getList"
  91. />
  92. </div>
  93. </div>
  94. <list-page v-if="pageType == 2"></list-page>
  95. <add-dialog v-if="addDialogType" :addDialogData="addDialogData"></add-dialog>
  96. <lookDocumentListDialog v-if="lookDocumentListType" :propsLookDocumentListData="propsLookDocumentListData"></lookDocumentListDialog>
  97. </div>
  98. </template>
  99. <script>
  100. import addDialog from './addDialog.vue'
  101. import listPage from './listPage.vue'
  102. import lookDocumentListDialog from '@/components/lookDocumentDialog/lookDocumentListDialog.vue'
  103. export default {
  104. name: 'index',
  105. components: {
  106. addDialog,
  107. listPage,
  108. lookDocumentListDialog
  109. },
  110. data(){
  111. return{
  112. //子组件数据
  113. lookDocumentListType:false,
  114. propsLookDocumentListData:{},
  115. addDialogType:false,
  116. addDialogData:{},
  117. pageType:1,
  118. queryParams:{
  119. pageNum:1,
  120. pageSize:20,
  121. buttonType:1,
  122. timeType:0,
  123. searchValue:"",
  124. data1:""
  125. },
  126. dateRange:[],
  127. tableList:[{}],
  128. total:0,
  129. }
  130. },
  131. created(){
  132. },
  133. mounted(){
  134. },
  135. methods:{
  136. //切换页面
  137. goPage(type){
  138. if(this.pageType != type){
  139. this.$set(this,'pageType',type);
  140. }
  141. },
  142. //弹窗开启
  143. addDialogOpen(type,data){
  144. if(type==1){
  145. this.$set(this,'addDialogData',{
  146. title:"创建巡查计划",
  147. lookInfoType:false,
  148. addType:false,
  149. })
  150. this.$set(this,'addDialogType',true);
  151. }else if(type==2){
  152. this.$set(this,'addDialogData',{
  153. title:"编辑巡查计划",
  154. lookInfoType:false,
  155. addType:true,
  156. })
  157. this.$set(this,'addDialogType',true);
  158. }else if(type==3){
  159. this.$set(this,'addDialogData',{
  160. title:"巡查计划详情",
  161. lookInfoType:true,
  162. addType:true,
  163. })
  164. this.$set(this,'addDialogType',true);
  165. }else if(type==4){
  166. this.$set(this,'addDialogType',false);
  167. }
  168. },
  169. //范围选择
  170. topLeftClickType(type){
  171. if(this.queryParams.buttonType != type){
  172. this.$set(this.queryParams,'buttonType',type);
  173. this.getList();
  174. }
  175. },
  176. //时间排序方法
  177. sortChange(val){
  178. //ascending 上 descending 下 null 无
  179. console.log('val',val.order)
  180. this.$set(this.queryParams,'timeType',val.order=='ascending'?1:(val.order=='descending'?2:''));
  181. },
  182. //获取数据列表
  183. getList(){
  184. // this.queryParamsData = JSON.parse(JSON.stringify(this.queryParams));
  185. // this.queryParamsData.type = 'RFID_RECOGNIZER';
  186. // listHardware(this.queryParamsData).then(response => {
  187. // this.total = response.total;
  188. // this.tableList = response.rows;
  189. // });
  190. },
  191. /** 搜索按钮操作 */
  192. handleQuery() {
  193. this.$set(this.queryParams,'pageNum',1);
  194. this.getList();
  195. },
  196. /** 重置按钮操作 */
  197. resetQuery() {
  198. this.$set(this,'dateRange',[]);
  199. this.$set(this,'queryParams',{
  200. pageNum:1,
  201. pageSize:20,
  202. buttonType:1,
  203. timeType:0,
  204. searchValue:"",
  205. data1:""
  206. });
  207. this.handleQuery();
  208. },
  209. /*==========上传相关==========*/
  210. handleAvatarSuccess(res) {
  211. if(this.dialogUpList.length>9){
  212. this.msgError('已到达上传数量上限')
  213. return
  214. }
  215. let suffixName= this.upDataName.split('.')[this.upDataName.split('.').length - 2]
  216. //判断文件名中是否有逗号和分号
  217. if(suffixName.indexOf(',')==-1 && suffixName.indexOf(';')==-1){
  218. }else{
  219. this.$message.info('文件名里包含逗号或分号,请修改后重新上传!')
  220. return
  221. }
  222. let obj ={
  223. name:this.upDataName,
  224. url:res.data.url,
  225. };
  226. this.dialogUpList.push(obj);
  227. this.$forceUpdate()
  228. },
  229. beforeAvatarUpload(file) {
  230. console.log('file',file)
  231. let type = false;
  232. if (file.type == 'application/pdf' || file.type == 'application/msword' || file.type == 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'|| file.type == 'application/vnd.ms-excel' || file.type == 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') {
  233. this.upDataName = file.name;
  234. type = true;
  235. }else{
  236. this.$message.error('只能上传png/jpeg/gif/doc/docx格式');
  237. type = false;
  238. }
  239. return type;
  240. },
  241. //查看多个文档
  242. lookDocumentListButton(type,row){
  243. if(type==1){
  244. this.$set(this,'propsLookDocumentListData',{
  245. title:"查看附件",
  246. list:row.list
  247. });
  248. this.$set(this,'lookDocumentListType',true);
  249. }else{
  250. this.$set(this,'lookDocumentListType',false);
  251. }
  252. },
  253. }
  254. }
  255. </script>
  256. <style scoped lang="scss">
  257. .inspectionPlan{
  258. flex: 1;
  259. display: flex !important;
  260. flex-direction: column;
  261. overflow: hidden;
  262. .inspectionPlan-page{
  263. .title-box{
  264. padding-top:20px;
  265. border-bottom:1px solid #dedede;
  266. .form-button-max-big-box{
  267. display: inline-block;
  268. .form-button-big-box{
  269. display: flex;
  270. div{
  271. position: relative;
  272. height:40px;
  273. width:80px;
  274. line-height: 40px;
  275. text-align: center;
  276. color:#999;
  277. font-size:14px;
  278. border:1px solid #999;
  279. border-radius:4px;
  280. margin-left:10px;
  281. font-weight:500;
  282. cursor: pointer;
  283. .icon-p{
  284. width:15px;
  285. height:15px;
  286. line-height:15px;
  287. text-align: center;
  288. position: absolute;
  289. right:0;
  290. bottom:0;
  291. color:#fff;
  292. background: #0183fa;
  293. border-top-left-radius:4px;
  294. }
  295. }
  296. .checkDiv{
  297. color:#0183FA;
  298. border:1px solid #0183FA;
  299. }
  300. }
  301. }
  302. }
  303. .content-box{
  304. flex: 1;
  305. display: flex;
  306. flex-direction: column;
  307. padding:20px;
  308. overflow: hidden;
  309. }
  310. }
  311. }
  312. </style>