gasUseManage.vue 8.4 KB

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