gasUseManage.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  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"></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. v-hasPermi="['airbottle:taskManage:query']"
  28. @click="handleClick('',scope.row,'receive')"
  29. >领用</p>
  30. <p class="table-min-button"
  31. v-if="activeName==2"
  32. v-hasPermi="['airbottle:taskManage:query']"
  33. @click="handleClick('',scope.row,'give')"
  34. >归还</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-if="activeName==1" v-model="form.beforeUse" placeholder="请输入气表实际压力,精确到小数点后一位" />
  52. <el-input v-if="activeName==2" v-model="form.afterUse" 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">领用</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, returnRecord, useRecord } from '@/api/gasManage3_0/gasManageSYD'
  66. export default {
  67. name: "Approval",
  68. data() {
  69. return {
  70. activeName:'1',
  71. dialogTitle:'领用气瓶提示',
  72. dialogContent:'您在领用气瓶前需要确认气表压力与系统显示的压力值是否一致,如不一致则需要在下方填写实际气压值。',
  73. dialogVisible:false,
  74. //页面状态
  75. pageType:1,
  76. loading:false,
  77. headers: {
  78. Authorization: "Bearer " + getToken()
  79. },
  80. // 查询参数
  81. queryParams: {
  82. pageNum: 1,
  83. pageSize:20,
  84. },
  85. total:0,
  86. tableData:[{}],
  87. dateRange:[],
  88. pageData2:{},
  89. form:{
  90. beforeUse:'',//领用
  91. afterUse:'',//归还
  92. },
  93. rules:{
  94. txt:[
  95. {required: true, message: '请输入播放文字', trigger: 'blur'},
  96. { required: true, message: "请输入播放文字", validator: this.spaceJudgment, trigger: "blur" }
  97. ],
  98. },
  99. };
  100. },
  101. methods: {
  102. handleTabClick(tab, event) {
  103. console.log(tab, event);
  104. this.getList()
  105. },
  106. handleClick(index,row,doType){
  107. let _this=this;
  108. if(doType=='receive'){//领用
  109. this.dialogTitle='领用气瓶提示';
  110. this.dialogContent='您在领用气瓶前需要确认气表压力与系统显示的压力值是否一致,如不一致则需要在下方填写实际气压值。';
  111. this.dialogVisible=true;
  112. this.form.bottleName=row.airName;
  113. this.form.isSurplus=1;
  114. this.form.subjectName=row.subjectName;
  115. this.form.subjectId=row.subjectId;
  116. this.form.storageId=row.id;
  117. if(!this.form.beforeUse){
  118. this.form.beforeUse=row.currentPressure
  119. }
  120. }else if(doType=='give'){//归还
  121. this.dialogTitle='归还气瓶提示';
  122. this.dialogContent='请输入当前气压值。';
  123. this.dialogVisible=true;
  124. _this.form.storageId=row.id
  125. /* this.$confirm('请确认已将气瓶放置在气瓶存放点,您是否确认归还?', '提示', {
  126. confirmButtonText: '确定',
  127. cancelButtonText: '取消',
  128. type: 'warning'
  129. }).then(() => {
  130. returnRecord(this.form).then( response => {
  131. let res=response.data;
  132. });
  133. }).catch(() => {}); */
  134. }
  135. },
  136. /** 搜索按钮操作 */
  137. handleQuery() {
  138. this.queryParams.pageNum = 1;
  139. this.getList();
  140. },
  141. /** 重置按钮操作 */
  142. resetQuery() {
  143. this.handleQuery();
  144. },
  145. // 取消按钮
  146. cancel() {
  147. this.form = {};
  148. this.dialogVisible = false;
  149. },
  150. /*领用提交*/
  151. submitForm(){
  152. let _this=this;
  153. console.log(this.activeName)
  154. this.$refs["form"].validate(valid => {
  155. if (valid) {
  156. if(_this.activeName==1){//领用
  157. useRecord(this.form).then( response => {
  158. let res=response.data;
  159. if(response.code==200){
  160. _this.dialogVisible=false;
  161. _this.getList()
  162. }
  163. });
  164. }else if(_this.activeName==2){//归还
  165. returnRecord(this.form).then( response => {
  166. let res=response.data;
  167. if(response.code==200){
  168. _this.dialogVisible=false;
  169. _this.getList()
  170. }
  171. });
  172. }
  173. }
  174. });
  175. },
  176. getList(){
  177. let _this=this;
  178. if(_this.activeName==1){//领用
  179. receivingGasListByStu(_this.queryParams).then( response => {
  180. let res=response.rows;
  181. _this.tableData=res;
  182. _this.total=response.total;
  183. });
  184. }else if(_this.activeName==2){//归还
  185. returnGasByStu(_this.queryParams).then( response => {
  186. let res=response.rows;
  187. _this.tableData=res;
  188. _this.total=response.total;
  189. });
  190. }
  191. },
  192. },
  193. mounted() {
  194. this.getList()
  195. }
  196. };
  197. </script>
  198. <style scoped lang="scss">
  199. .approval_handle {
  200. display: flex!important;
  201. flex-direction: column;
  202. .approval_handle-page{
  203. flex:1;
  204. display: flex!important;
  205. flex-direction: column;
  206. box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
  207. padding:20px 20px 20px!important;
  208. border-radius:10px;
  209. .button-box{
  210. width:200px;
  211. display: flex;
  212. }
  213. }
  214. }
  215. </style>