gasUseManage.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <!--气瓶使用-->
  2. <template>
  3. <div class="app-container approval_handle">
  4. <div class="approval_handle-page">
  5. <template>
  6. <el-tabs v-model="activeName" @tab-click="handleTabClick">
  7. <el-tab-pane label="领用气瓶" name="1"></el-tab-pane>
  8. <el-tab-pane label="归还气瓶" name="2" v-if="returnGasList[0]"></el-tab-pane>
  9. </el-tabs>
  10. </template>
  11. <el-table border v-loading="loading" :data="tableData">
  12. <el-table-column label="识别码" align="left" prop="electronicTag"/>
  13. <el-table-column label="气瓶编号" align="left" prop="airNumber"></el-table-column>
  14. <el-table-column label="气体名称" align="left" prop="airName"></el-table-column>
  15. <el-table-column label="气瓶规格" align="left" prop="configName"></el-table-column>
  16. <el-table-column label="当前气压" align="left" prop="currentPressure">
  17. <template slot-scope="scope">
  18. <span>{{scope.row.currentPressure}}Mpa</span>
  19. </template>
  20. </el-table-column>
  21. <el-table-column label="领用时间" align="left" prop="receivingTime" v-if="activeName==2"></el-table-column>
  22. <el-table-column label="操作" align="left" class-name="small-padding fixed-width" width="120">
  23. <template slot-scope="scope">
  24. <div class="button-box">
  25. <p class="table-min-button"
  26. v-if="activeName==1"
  27. @click="handleClick('',scope.row,'receive')"
  28. >领用</p>
  29. <p class="table-min-button"
  30. v-if="activeName==2"
  31. @click="handleClick('',scope.row,'give')"
  32. >归还</p>
  33. </div>
  34. </template>
  35. </el-table-column>
  36. </el-table>
  37. <pagination :page-sizes="[20, 30, 40, 50]"
  38. :total="total"
  39. layout="total, prev, pager, next, sizes, jumper"
  40. :page.sync="queryParams.pageNum"
  41. :limit.sync="queryParams.pageSize"
  42. @pagination="getList"
  43. />
  44. </div>
  45. <!-- 弹窗-->
  46. <el-dialog :title=dialogTitle :visible.sync="dialogVisible" width="500px" append-to-body>
  47. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  48. <div style="margin-bottom: 20px;color: #333;">{{dialogContent}}</div>
  49. <el-input v-show="activeName==1" v-model="form.beforeUse" oninput="value=value.replace(/[^1-9]{0,1}(\d*(?:\.\d{0,1})?).*$/g, '$1')" placeholder="请输入气表实际压力,精确到小数点后一位" />
  50. <el-input v-show="activeName==2" v-model="form.afterUse" oninput="value=value.replace(/[^1-9]{0,1}(\d*(?:\.\d{0,1})?).*$/g, '$1')" placeholder="请输入气表实际压力,精确到小数点后一位" />
  51. </el-form>
  52. <div slot="footer" class="dialog-footer">
  53. <el-button @click="cancel">取消</el-button>
  54. <el-button type="primary" @click="submitForm">领用</el-button>
  55. </div>
  56. </el-dialog>
  57. </div>
  58. </template>
  59. <script>
  60. import { gasApplyList, } from '@/api/gasManage3_0/gasManage'
  61. import { getToken } from "@/utils/auth";
  62. import { mangerVoice } from '@/api/laboratory/subject'
  63. import { receivingGasListByStu, returnGasByStu,} from '@/api/gasManage3_0/gasManageSYD'
  64. import { returnRecord, useRecord} from '@/api/studentApi/gasManage/index'
  65. export default {
  66. name: "Approval",
  67. data() {
  68. return {
  69. activeName:'1',
  70. dialogTitle:'领用气瓶提示',
  71. dialogContent:'您在领用气瓶前需要确认气表压力与系统显示的压力值是否一致,如不一致则需要在下方填写实际气压值。',
  72. dialogVisible:false,
  73. //页面状态
  74. pageType:1,
  75. loading:false,
  76. headers: {
  77. Authorization: "Bearer " + getToken()
  78. },
  79. // 查询参数
  80. queryParams: {
  81. pageNum: 1,
  82. pageSize:20,
  83. },
  84. total:0,
  85. tableData:[{}],
  86. dateRange:[],
  87. pageData2:{},
  88. form:{
  89. beforeUse:'',//领用
  90. afterUse:'',//归还
  91. },
  92. currentPressure:'',
  93. rules:{
  94. txt:[
  95. {required: true, message: '请输入播放文字', trigger: 'blur'},
  96. { required: true, message: "请输入播放文字", validator: this.spaceJudgment, trigger: "blur" }
  97. ],
  98. },
  99. returnGasList:[],
  100. };
  101. },
  102. methods: {
  103. handleTabClick(tab, event) {
  104. console.log(tab, event);
  105. this.getList()
  106. },
  107. handleClick(index,row,doType){
  108. let _this=this;
  109. if(doType=='receive'){//领用
  110. this.dialogTitle='领用气瓶提示';
  111. this.dialogContent='您在领用气瓶前需要确认气表压力与系统显示的压力值是否一致,如不一致则需要在下方填写实际气压值。';
  112. this.dialogVisible=true;
  113. this.form.bottleName=row.airName;
  114. this.form.isSurplus=1;
  115. this.form.subjectName=row.subjectName;
  116. this.form.subjectId=row.subjectId;
  117. this.form.storageId=row.id;
  118. this.form.beforeUse='';
  119. this.currentPressure=row.currentPressure;
  120. }else if(doType=='give'){//归还
  121. this.dialogTitle='归还气瓶提示';
  122. this.dialogContent='请输入当前气压值。';
  123. this.dialogVisible=true;
  124. _this.form.storageId=row.id
  125. _this.form.afterUse='';
  126. /* this.$confirm('请确认已将气瓶放置在气瓶存放点,您是否确认归还?', '提示', {
  127. confirmButtonText: '确定',
  128. cancelButtonText: '取消',
  129. type: 'warning'
  130. }).then(() => {
  131. returnRecord(this.form).then( response => {
  132. let res=response.data;
  133. });
  134. }).catch(() => {}); */
  135. }
  136. },
  137. /** 搜索按钮操作 */
  138. handleQuery() {
  139. this.queryParams.pageNum = 1;
  140. this.getList();
  141. },
  142. /** 重置按钮操作 */
  143. resetQuery() {
  144. this.handleQuery();
  145. },
  146. // 取消按钮
  147. cancel() {
  148. this.form = {};
  149. this.dialogVisible = false;
  150. },
  151. /*领用提交*/
  152. submitForm(){
  153. let _this=this;
  154. console.log(this.activeName)
  155. this.$refs["form"].validate(valid => {
  156. if (valid) {
  157. if(_this.activeName==1){//领用
  158. if(!this.form.beforeUse){
  159. this.form.beforeUse=_this.currentPressure
  160. }
  161. useRecord(this.form).then( response => {
  162. let res=response.data;
  163. if(response.code==200){
  164. _this.dialogVisible=false;
  165. _this.getList()
  166. _this.msgSuccess(response.msg)
  167. }
  168. });
  169. }else if(_this.activeName==2){//归还
  170. returnRecord(this.form).then( response => {
  171. let res=response.data;
  172. if(response.code==200){
  173. _this.dialogVisible=false;
  174. _this.getList()
  175. _this.msgSuccess(response.msg)
  176. }
  177. });
  178. }
  179. }
  180. });
  181. },
  182. getList(){
  183. let _this=this;
  184. if(_this.activeName==1){//领用
  185. receivingGasListByStu(_this.queryParams).then( response => {
  186. let res=response.rows;
  187. _this.tableData=res;
  188. _this.total=response.total;
  189. });
  190. }else if(_this.activeName==2){//归还
  191. returnGasByStu(_this.queryParams).then( response => {
  192. let res=response.rows;
  193. _this.tableData=res;
  194. _this.total=response.total;
  195. });
  196. }
  197. this.getReturnGas();
  198. },
  199. getReturnGas(){
  200. returnGasByStu({pageNum: 1, pageSize:20,}).then( response => {
  201. this.$set(this,'returnGasList',response.rows);
  202. });
  203. },
  204. },
  205. mounted() {
  206. this.getList()
  207. }
  208. };
  209. </script>
  210. <style scoped lang="scss">
  211. .approval_handle {
  212. display: flex!important;
  213. flex-direction: column;
  214. .approval_handle-page{
  215. flex:1;
  216. display: flex!important;
  217. flex-direction: column;
  218. box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
  219. padding:20px 20px 20px!important;
  220. border-radius:10px;
  221. .button-box{
  222. width:200px;
  223. display: flex;
  224. }
  225. }
  226. }
  227. </style>