useGasManage.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. <!--资格管理-->
  2. <template>
  3. <div class="app-container approval_handle">
  4. <div class="approval_handle-page" v-if="pageType == 1">
  5. <el-form :model="queryParams" ref="queryForm" style="margin-top:20px;" :inline="true">
  6. <el-form-item label="关键字" prop="name">
  7. <el-input
  8. v-model="queryParams.searchValue"
  9. placeholder="姓名/联系方式/实验地点"
  10. clearable
  11. maxLength="30"
  12. size="small"
  13. />
  14. </el-form-item>
  15. <el-form-item label="使用期限" prop="dateRange">
  16. <el-date-picker
  17. :clearable="false"
  18. v-model="dateRange"
  19. size="small"
  20. style="width: 240px"
  21. value-format="yyyy-MM-dd"
  22. type="daterange"
  23. range-separator="-"
  24. start-placeholder="开始日期"
  25. end-placeholder="结束日期"
  26. ></el-date-picker>
  27. </el-form-item>
  28. <el-form-item>
  29. <p class="inquire-button-one" @click="handleQuery">查询</p>
  30. <p class="reset-button-one" @click="resetQuery">重置</p>
  31. </el-form-item>
  32. <el-form-item label="" prop="title" style="float: right">
  33. <el-dropdown @command="exportButton" style="float: left" v-hasPermi="['airbottle:taskManage:export']">
  34. <div class="form-dropdown-box">
  35. <img src="@/assets/ZDimages/personnelManagement/icon_jzgxx_sc.png">
  36. <p>导出</p>
  37. <img src="@/assets/ZDimages/personnelManagement/icon_jzggl_xljt.png">
  38. </div>
  39. <el-dropdown-menu slot="dropdown">
  40. <el-dropdown-item style="border-bottom:1px solid #E0E0E0;margin:0 10px;color:#333;" :command="{command:1}">导出全部数据</el-dropdown-item>
  41. <el-dropdown-item style="margin:0 10px;color:#666;" :command="{command:2}">导出选中数据</el-dropdown-item>
  42. </el-dropdown-menu>
  43. </el-dropdown>
  44. <p v-hasPermi="['airbottle:useAgsAuditManage:list']" class="inquire-button-one" style="width: 120px;margin-left: 10px;" @click="handleClick('','','audit')">审核资格</p>
  45. </el-form-item>
  46. </el-form>
  47. <el-table border v-loading="loading" :data="tableData" @selection-change="handleSelectionChange" ref="multipleTable" :row-key="getRowKeys">
  48. <el-table-column type="selection" width="50" align="center"/>
  49. <el-table-column label="姓名" align="left" prop="applyUser"/>
  50. <el-table-column label="联系方式" align="left" prop="phone"></el-table-column>
  51. <el-table-column label="实验地点" align="left" prop="location"></el-table-column>
  52. <el-table-column label="使用气体" align="left" prop="useGasName"></el-table-column>
  53. <el-table-column label="使用期限" align="left" prop="creatTime">
  54. <template slot-scope="scope">
  55. <span>{{scope.row.startTime}}-{{scope.row.endTime}}</span>
  56. </template>
  57. </el-table-column>
  58. <el-table-column label="操作" align="left" class-name="small-padding fixed-width" width="120">
  59. <template slot-scope="scope">
  60. <div class="button-box" v-hasPermi="['airbottle:useAgsApplyManage:query']" >
  61. <p class="table-min-button"
  62. @click="handleClick('',scope.row,'detail')"
  63. >查看</p>
  64. </div>
  65. </template>
  66. </el-table-column>
  67. </el-table>
  68. <div style="display: flex;height:32px;margin-top:15px;">
  69. <!--<p style="flex:4;"></p>-->
  70. <p style="text-align: left;margin:0;line-height:32px;margin-right:20px;font-size:14px;color:#999;">
  71. <i class="el-icon-warning" style="color:#0183FA;"></i>
  72. 已选择 {{selectedNum}} 项
  73. </p>
  74. <div style="flex:5;">
  75. <pagination :page-sizes="[20, 30, 40, 50]"
  76. v-show="total>0"
  77. :total="total"
  78. style="margin:0;"
  79. :page.sync="queryParams.pageNum"
  80. :limit.sync="queryParams.pageSize"
  81. @pagination="getList"
  82. />
  83. </div>
  84. </div>
  85. </div>
  86. <!--审核页面-->
  87. <check-page v-if="pageType==2"></check-page>
  88. <!--详情页面-->
  89. <detail-page v-if="pageType==3" :pageData2="pageData2"></detail-page>
  90. </div>
  91. </template>
  92. <script>
  93. import { useGasManageList } from '@/api/gasManage3_0/gasManage'
  94. import { getToken } from "@/utils/auth";
  95. import detailPage from "./useGasManageDetail.vue"
  96. import checkPage from "./useGasManageCheckList.vue"
  97. export default {
  98. name: "Approval",
  99. components: {
  100. detailPage,
  101. checkPage
  102. },
  103. data() {
  104. return {
  105. //页面状态
  106. pageType:1,
  107. loading:false,
  108. headers: {
  109. Authorization: "Bearer " + getToken()
  110. },
  111. // 查询参数
  112. queryParams: {
  113. pageNum: 1,
  114. pageSize:20,
  115. searchValue:'',
  116. },
  117. total:0,
  118. tableData:[{}],
  119. dateRange:[],
  120. pageData2:{},
  121. //导出
  122. //表格扩展选择器---需要在@selection-change绑定的方法内监控selection数组长度
  123. selectedNum:0,
  124. // 选中数组
  125. ids: [],
  126. // 非单个禁用
  127. single: true,
  128. // 非多个禁用
  129. multiple: true,
  130. };
  131. },
  132. methods: {
  133. handleClick(index,row,doType){
  134. let _this=this;
  135. if(doType=='detail'){//查看
  136. _this.pageData2.id=row.id;
  137. _this.pageType=3;
  138. }else if(doType=='audit'){//审核
  139. _this.pageType=2;
  140. }else if(doType=='back'){//返回
  141. _this.pageType=1;
  142. }else if(doType=='export'){//导出
  143. this.download('airbottle/useAgsApplyManage/export', {
  144. ...this.queryParams
  145. }, `用气信息数据导出.xlsx`)
  146. }
  147. },
  148. /** 当前时间 */
  149. getCurrentTime () {
  150. const yy = new Date().getFullYear()
  151. const mm = new Date().getMonth() + 1
  152. const dd = new Date().getDate()
  153. const hh = new Date().getHours()
  154. const mf = new Date().getMinutes() < 10 ? '0' + new Date().getMinutes() : new Date().getMinutes()
  155. const ss = new Date().getSeconds() < 10 ? '0' + new Date().getSeconds() : new Date().getSeconds()
  156. return yy + '-' + mm + '-' + dd
  157. },
  158. /** 导出按钮操作 */
  159. exportButton(item) {
  160. let self = this;
  161. let currentDate = this.getCurrentTime()
  162. if(item.command == 1){
  163. self.$confirm(`确认导出全部数据?`, "提示", {
  164. confirmButtonText: "确定",
  165. cancelButtonText: "取消",
  166. type: "warning"
  167. }).then(async () => {
  168. self.download('/airbottle/useAgsApplyManage/export/', {...self.queryParamsData}, '用气信息数据导出-'+currentDate+'.xlsx')
  169. }).catch(() => {})
  170. }else if(item.command == 2){
  171. if(self.ids.length>0) {
  172. self.$confirm(`确认导出选中数据?`, "提示", {
  173. confirmButtonText: "确定",
  174. cancelButtonText: "取消",
  175. type: "warning"
  176. }).then(async () => {
  177. let ids = self.ids.join(',');
  178. let obj = {
  179. ids :ids
  180. }
  181. console.log("obj",obj)
  182. self.download(`/airbottle/useAgsApplyManage/export/`,obj, '用气信息数据导出-'+currentDate+'.xlsx')
  183. }).catch(() => {})
  184. }else {
  185. this.msgError('请选择要导出的数据')
  186. }
  187. }
  188. },
  189. // 多选框选中数据
  190. handleSelectionChange(selection) {
  191. this.selectedNum = selection.length;
  192. this.ids = selection.map(item => item.id);
  193. this.single = selection.length != 1;
  194. this.multiple = !selection.length;
  195. },
  196. /*===记录勾选数据===
  197. 需要再el-table 添加 :row-key="getRowKeys"
  198. 需要在selection 添加 :reserve-selection="true"
  199. */
  200. getRowKeys(row) {
  201. return row.id
  202. },
  203. //返回
  204. backPage(){
  205. this.$parent.handleClick('','','back');
  206. this.$parent.outStatistics()
  207. this.$parent.gasApplyStatistics()
  208. this.$parent.useGasStatistics()
  209. },
  210. /** 搜索按钮操作 */
  211. handleQuery() {
  212. this.queryParams.pageNum = 1;
  213. this.getList();
  214. },
  215. /** 重置按钮操作 */
  216. resetQuery() {
  217. this.queryParams.searchValue = "";
  218. this.dateRange=[];
  219. this.queryParams.startTime=null;
  220. this.queryParams.endTime=null
  221. this.handleQuery();
  222. },
  223. getList(){
  224. let _this=this;
  225. if(this.dateRange&&this.dateRange.length>0) {
  226. this.queryParams.startTime=this.dateRange[0]
  227. this.queryParams.endTime=this.dateRange[1]
  228. } else {
  229. this.queryParams.startTime=null;
  230. this.queryParams.endTime=null
  231. }
  232. useGasManageList(_this.queryParams).then( response => {
  233. let res=response.rows;
  234. _this.tableData=res;
  235. _this.total=response.total
  236. });
  237. },
  238. },
  239. mounted() {
  240. this.getList();
  241. }
  242. };
  243. </script>
  244. <style scoped lang="scss">
  245. /*导出按钮样式*/
  246. .form-dropdown-box{
  247. display: flex;
  248. margin:0;
  249. padding:0 10px;
  250. cursor: pointer;
  251. height:40px;
  252. img:nth-child(1){
  253. width:16px;
  254. height:16px;
  255. margin-top:12px;
  256. }
  257. p{
  258. width:47px;
  259. text-align: center;
  260. font-size:14px;
  261. margin:0;
  262. line-height:40px;
  263. }
  264. img:nth-child(3){
  265. width:10px;
  266. height:6px;
  267. margin-top:17px;
  268. }
  269. }
  270. .approval_handle {
  271. display: flex!important;
  272. flex-direction: column;
  273. .approval_handle-page{
  274. flex:1;
  275. display: flex!important;
  276. flex-direction: column;
  277. box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
  278. padding:20px 20px 20px!important;
  279. border-radius:10px;
  280. .button-box{
  281. width:200px;
  282. display: flex;
  283. }
  284. }
  285. }
  286. </style>