gasUseManage.vue 8.0 KB

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