outRecord.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. <!--出库记录-->
  2. <template>
  3. <div class="apply">
  4. <div class="apply_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:informationRecord:storageOutexport']">
  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 class="reset-button-one" style="margin-left: 12px;" @click="backPage">返回</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="applyUserName"/>
  50. <el-table-column label="联系方式" align="left" prop="phone"></el-table-column>
  51. <el-table-column label="标签码" align="left" prop=""></el-table-column>
  52. <el-table-column label="气瓶编号" align="left" prop=""></el-table-column>
  53. <el-table-column label="气体名称" align="left" prop="airName"></el-table-column>
  54. <el-table-column label="气瓶规格" align="left" prop=""></el-table-column>
  55. <el-table-column label="出库时间" align="left" prop=""></el-table-column>
  56. <el-table-column label="操作" align="left" class-name="small-padding fixed-width" width="120">
  57. <template slot-scope="scope">
  58. <div class="button-box">
  59. <p class="table-min-button"
  60. v-hasPermi="['airbottle:storageOutManage:query']"
  61. @click="handleClick('',scope.row,'detail')"
  62. >查看</p>
  63. </div>
  64. </template>
  65. </el-table-column>
  66. </el-table>
  67. <div style="display: flex;height:32px;margin-top:15px;">
  68. <!--<p style="flex:4;"></p>-->
  69. <p style="text-align: left;margin:0;line-height:32px;margin-right:20px;font-size:14px;color:#999;">
  70. <i class="el-icon-warning" style="color:#0183FA;"></i>
  71. 已选择 {{selectedNum}} 项
  72. </p>
  73. <div style="flex:5;">
  74. <pagination :page-sizes="[20, 30, 40, 50]"
  75. v-show="total>0"
  76. :total="total"
  77. style="margin:0;"
  78. :page.sync="queryParams.pageNum"
  79. :limit.sync="queryParams.pageSize"
  80. @pagination="getList"
  81. />
  82. </div>
  83. </div>
  84. </div>
  85. <!--详情页面-->
  86. <detail-page v-if="pageType==2" :pageData2="pageData2"></detail-page>
  87. </div>
  88. </template>
  89. <script>
  90. import { enterRecordList, outRecordList } from '@/api/gasManage3_0/gasManage'
  91. import { getToken } from "@/utils/auth";
  92. import detailPage from "./outRecordDetail.vue"
  93. export default {
  94. name: "Approval",
  95. components: {
  96. detailPage
  97. },
  98. data() {
  99. return {
  100. //页面状态
  101. pageType:1,
  102. loading:false,
  103. headers: {
  104. Authorization: "Bearer " + getToken()
  105. },
  106. // 查询参数
  107. queryParams: {
  108. pageNum: 1,
  109. pageSize:20,
  110. searchValue:'',
  111. startTime:'',
  112. endTime:'',
  113. airStatus:0,
  114. },
  115. total:0,
  116. tableData:[],
  117. dateRange:[],
  118. pageData2:{},
  119. //导出
  120. //表格扩展选择器---需要在@selection-change绑定的方法内监控selection数组长度
  121. selectedNum:0,
  122. // 选中数组
  123. ids: [],
  124. // 非单个禁用
  125. single: true,
  126. // 非多个禁用
  127. multiple: true,
  128. };
  129. },
  130. methods: {
  131. handleClick(index,row,doType){
  132. let _this=this;
  133. if(doType=='detail'){//查看
  134. _this.pageData2.item=row;
  135. _this.pageType=2;
  136. }else if(doType=='back'){//返回
  137. _this.pageType=1;
  138. }else if(doType=='export'){//导出
  139. this.download('airbottle/storageOutManage/export', {
  140. ...this.queryParams
  141. }, `出库记录导出.xlsx`)
  142. }
  143. },
  144. /** 当前时间 */
  145. getCurrentTime () {
  146. const yy = new Date().getFullYear()
  147. const mm = new Date().getMonth() + 1
  148. const dd = new Date().getDate()
  149. const hh = new Date().getHours()
  150. const mf = new Date().getMinutes() < 10 ? '0' + new Date().getMinutes() : new Date().getMinutes()
  151. const ss = new Date().getSeconds() < 10 ? '0' + new Date().getSeconds() : new Date().getSeconds()
  152. return yy + '-' + mm + '-' + dd
  153. },
  154. /** 导出按钮操作 */
  155. exportButton(item) {
  156. let self = this;
  157. let currentDate = this.getCurrentTime()
  158. if(item.command == 1){
  159. self.$confirm(`确认导出全部数据?`, "提示", {
  160. confirmButtonText: "确定",
  161. cancelButtonText: "取消",
  162. type: "warning"
  163. }).then(async () => {
  164. self.download('/airbottle/informationRecord/storageOutexport/', {...self.queryParamsData}, '出库记录导出-'+currentDate+'.xlsx')
  165. }).catch(() => {})
  166. }else if(item.command == 2){
  167. if(self.ids.length>0) {
  168. self.$confirm(`确认导出选中数据?`, "提示", {
  169. confirmButtonText: "确定",
  170. cancelButtonText: "取消",
  171. type: "warning"
  172. }).then(async () => {
  173. let ids = self.ids.join(',');
  174. let obj = {
  175. ids :ids
  176. }
  177. console.log("obj",obj)
  178. self.download(`/airbottle/storageOutManage/export/`,obj, '出库记录导出-'+currentDate+'.xlsx')
  179. }).catch(() => {})
  180. }else {
  181. this.msgError('请选择要导出的数据')
  182. }
  183. }
  184. },
  185. // 多选框选中数据
  186. handleSelectionChange(selection) {
  187. this.selectedNum = selection.length;
  188. this.ids = selection.map(item => item.id);
  189. this.single = selection.length != 1;
  190. this.multiple = !selection.length;
  191. },
  192. /*===记录勾选数据===
  193. 需要再el-table 添加 :row-key="getRowKeys"
  194. 需要在selection 添加 :reserve-selection="true"
  195. */
  196. getRowKeys(row) {
  197. return row.id
  198. },
  199. //返回
  200. backPage(){
  201. this.$parent.handleClick('','','back');
  202. this.$parent.outStatistics()
  203. this.$parent.gasApplyStatistics()
  204. this.$parent.useGasStatistics()
  205. },
  206. /** 搜索按钮操作 */
  207. handleQuery() {
  208. this.queryParams.pageNum = 1;
  209. this.getList();
  210. },
  211. /** 重置按钮操作 */
  212. resetQuery() {
  213. this.queryParams.searchValue = "";
  214. this.dateRange=[];
  215. this.queryParams.startTime=null;
  216. this.queryParams.endTime=null
  217. this.handleQuery();
  218. },
  219. getList(){
  220. let _this=this;
  221. if(this.dateRange&&this.dateRange.length>0) {
  222. this.queryParams.startTime=this.dateRange[0]
  223. this.queryParams.endTime=this.dateRange[1]
  224. } else {
  225. this.queryParams.startTime=null;
  226. this.queryParams.endTime=null
  227. }
  228. outRecordList(_this.queryParams).then( response => {
  229. let res=response.rows;
  230. _this.tableData=res;
  231. _this.total=response.total;
  232. });
  233. },
  234. },
  235. mounted() {
  236. this.getList()
  237. }
  238. };
  239. </script>
  240. <style scoped lang="scss">
  241. /*导出按钮样式*/
  242. .form-dropdown-box{
  243. display: flex;
  244. margin:0;
  245. padding:0 10px;
  246. cursor: pointer;
  247. height:40px;
  248. img:nth-child(1){
  249. width:16px;
  250. height:16px;
  251. margin-top:12px;
  252. }
  253. p{
  254. width:47px;
  255. text-align: center;
  256. font-size:14px;
  257. margin:0;
  258. line-height:40px;
  259. }
  260. img:nth-child(3){
  261. width:10px;
  262. height:6px;
  263. margin-top:17px;
  264. }
  265. }
  266. .apply {
  267. flex:1;
  268. display: flex!important;
  269. flex-direction: column;
  270. .apply_page{
  271. flex:1;
  272. display: flex!important;
  273. flex-direction: column;
  274. box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
  275. padding:20px 20px 20px!important;
  276. border-radius:10px;
  277. .button-box{
  278. width:200px;
  279. display: flex;
  280. }
  281. }
  282. }
  283. </style>