123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241 |
- <!--气瓶使用-->
- <template>
- <div class="app-container approval_handle">
- <div class="approval_handle-page">
- <template>
- <el-tabs v-model="activeName" @tab-click="handleTabClick">
- <el-tab-pane label="领用气瓶" name="1"></el-tab-pane>
- <el-tab-pane label="归还气瓶" name="2" v-if="returnGasList[0]"></el-tab-pane>
- </el-tabs>
- </template>
- <el-table border v-loading="loading" :data="tableData">
- <el-table-column label="识别码" align="left" prop="electronicTag"/>
- <el-table-column label="气瓶编号" align="left" prop="airNumber"></el-table-column>
- <el-table-column label="气体名称" align="left" prop="airName"></el-table-column>
- <el-table-column label="气瓶规格" align="left" prop="configName"></el-table-column>
- <el-table-column label="当前气压" align="left" prop="currentPressure">
- <template slot-scope="scope">
- <span>{{scope.row.currentPressure}}Mpa</span>
- </template>
- </el-table-column>
- <el-table-column label="领用时间" align="left" prop="receivingTime" v-if="activeName==2"></el-table-column>
- <el-table-column label="操作" align="left" class-name="small-padding fixed-width" width="120">
- <template slot-scope="scope">
- <div class="button-box">
- <p class="table-min-button"
- v-if="activeName==1"
- @click="handleClick('',scope.row,'receive')"
- >领用</p>
- <p class="table-min-button"
- v-if="activeName==2"
- @click="handleClick('',scope.row,'give')"
- >归还</p>
- </div>
- </template>
- </el-table-column>
- </el-table>
- <pagination :page-sizes="[20, 30, 40, 50]"
- :total="total"
- layout="total, prev, pager, next, sizes, jumper"
- :page.sync="queryParams.pageNum"
- :limit.sync="queryParams.pageSize"
- @pagination="getList"
- />
- </div>
- <!-- 弹窗-->
- <el-dialog :title=dialogTitle :visible.sync="dialogVisible" width="500px" append-to-body>
- <el-form ref="form" :model="form" :rules="rules" label-width="80px">
- <div style="margin-bottom: 20px;color: #333;">{{dialogContent}}</div>
- <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="请输入气表实际压力,精确到小数点后一位" />
- <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="请输入气表实际压力,精确到小数点后一位" />
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button @click="cancel">取消</el-button>
- <el-button type="primary" @click="submitForm">领用</el-button>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import { gasApplyList, } from '@/api/gasManage3_0/gasManage'
- import { getToken } from "@/utils/auth";
- import { mangerVoice } from '@/api/laboratory/subject'
- import { receivingGasListByStu, returnGasByStu,} from '@/api/gasManage3_0/gasManageSYD'
- import { returnRecord, useRecord} from '@/api/studentApi/gasManage/index'
- export default {
- name: "Approval",
- data() {
- return {
- activeName:'1',
- dialogTitle:'领用气瓶提示',
- dialogContent:'您在领用气瓶前需要确认气表压力与系统显示的压力值是否一致,如不一致则需要在下方填写实际气压值。',
- dialogVisible:false,
- //页面状态
- pageType:1,
- loading:false,
- headers: {
- Authorization: "Bearer " + getToken()
- },
- // 查询参数
- queryParams: {
- pageNum: 1,
- pageSize:20,
- },
- total:0,
- tableData:[{}],
- dateRange:[],
- pageData2:{},
- form:{
- beforeUse:'',//领用
- afterUse:'',//归还
- },
- currentPressure:'',
- rules:{
- txt:[
- {required: true, message: '请输入播放文字', trigger: 'blur'},
- { required: true, message: "请输入播放文字", validator: this.spaceJudgment, trigger: "blur" }
- ],
- },
- returnGasList:[],
- };
- },
- methods: {
- handleTabClick(tab, event) {
- console.log(tab, event);
- this.getList()
- },
- handleClick(index,row,doType){
- let _this=this;
- if(doType=='receive'){//领用
- this.dialogTitle='领用气瓶提示';
- this.dialogContent='您在领用气瓶前需要确认气表压力与系统显示的压力值是否一致,如不一致则需要在下方填写实际气压值。';
- this.dialogVisible=true;
- this.form.bottleName=row.airName;
- this.form.isSurplus=1;
- this.form.subjectName=row.subjectName;
- this.form.subjectId=row.subjectId;
- this.form.storageId=row.id;
- this.form.beforeUse='';
- this.currentPressure=row.currentPressure;
- }else if(doType=='give'){//归还
- this.dialogTitle='归还气瓶提示';
- this.dialogContent='请输入当前气压值。';
- this.dialogVisible=true;
- _this.form.storageId=row.id
- _this.form.afterUse='';
- /* this.$confirm('请确认已将气瓶放置在气瓶存放点,您是否确认归还?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- returnRecord(this.form).then( response => {
- let res=response.data;
- });
- }).catch(() => {}); */
- }
- },
- /** 搜索按钮操作 */
- handleQuery() {
- this.queryParams.pageNum = 1;
- this.getList();
- },
- /** 重置按钮操作 */
- resetQuery() {
- this.handleQuery();
- },
- // 取消按钮
- cancel() {
- this.form = {};
- this.dialogVisible = false;
- },
- /*领用提交*/
- submitForm(){
- let _this=this;
- console.log(this.activeName)
- this.$refs["form"].validate(valid => {
- if (valid) {
- if(_this.activeName==1){//领用
- if(!this.form.beforeUse){
- this.form.beforeUse=_this.currentPressure
- }
- useRecord(this.form).then( response => {
- let res=response.data;
- if(response.code==200){
- _this.dialogVisible=false;
- _this.getList()
- _this.msgSuccess(response.msg)
- }
- });
- }else if(_this.activeName==2){//归还
- returnRecord(this.form).then( response => {
- let res=response.data;
- if(response.code==200){
- _this.dialogVisible=false;
- _this.getList()
- _this.msgSuccess(response.msg)
- }
- });
- }
- }
- });
- },
- getList(){
- let _this=this;
- if(_this.activeName==1){//领用
- receivingGasListByStu(_this.queryParams).then( response => {
- let res=response.rows;
- _this.tableData=res;
- _this.total=response.total;
- });
- }else if(_this.activeName==2){//归还
- returnGasByStu(_this.queryParams).then( response => {
- let res=response.rows;
- _this.tableData=res;
- _this.total=response.total;
- });
- }
- this.getReturnGas();
- },
- getReturnGas(){
- returnGasByStu({pageNum: 1, pageSize:20,}).then( response => {
- this.$set(this,'returnGasList',response.rows);
- });
- },
- },
- mounted() {
- this.getList()
- }
- };
- </script>
- <style scoped lang="scss">
- .approval_handle {
- display: flex!important;
- flex-direction: column;
- .approval_handle-page{
- flex:1;
- display: flex!important;
- flex-direction: column;
- box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
- padding:20px 20px 20px!important;
- border-radius:10px;
- .button-box{
- width:200px;
- display: flex;
- }
- }
- }
- </style>
|