| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387 |
- <!-- 选择气瓶 -->
- <template>
- <view id="gasCylinderSelectCylinder">
- <view class="top-input-max-box">
- <view class="input-box">
- <uni-icons type="search" class="icon-box" color="#7C7C7C" size="25"></uni-icons>
- <input class="uni-input input-min" confirm-type="search" @confirm="getList()"
- v-model="inputData" maxlength="20" placeholder="搜索关键字" />
- <view class="button-p" @click="resetButton()">重置</view>
- </view>
- <view class="picker-box">
- <picker @change="bindPickerChangeA" :value="indexA" :range="arrayA">
- <view class="picker-min-box">
- <view>{{indexA==null?'气体':arrayA[indexA]}}</view>
- <uni-icons type="down" class="icon-box" size="15"></uni-icons>
- </view>
- </picker>
- <picker @change="bindPickerChangeB" :value="indexB" :range="arrayB">
- <view class="picker-min-box">
- <view>{{indexB==null?'气体类别':arrayB[indexB]}}</view>
- <uni-icons type="down" class="icon-box" size="15"></uni-icons>
- </view>
- </picker>
- </view>
- </view>
- <scroll-view scroll-y @scrolltolower="scrollGet" class="content-box">
- <view class="null-p" v-if="!dataList[0]">暂无数据</view>
- <view class="for-max-big-box" @click="checkButton(item)"
- v-for="(item,index) in dataList" :key="index">
- <view class="for-title-box" v-if="item.specialGases">
- <view>气瓶编码:</view>
- <view>{{item.bottleCode}}</view>
- </view>
- <view class="for-text-box">
- <view>气体:</view>
- <view>{{item.gasName}}</view>
- </view>
- <view class="for-text-box">
- <view>气瓶规格:</view>
- <view>{{item.specification}}</view>
- </view>
- <view class="for-text-box">
- <view>气体类别:</view>
- <view>{{item.gasCategory}}</view>
- </view>
- <view class="for-text-box" v-if="item.specialGases">
- <view>压力:</view>
- <view>{{item.pressure}}</view>
- </view>
- <view class="for-text-box">
- <view>纯度:</view>
- <view>{{item.purity}}</view>
- </view>
- </view>
- </scroll-view>
- <uni-icons class="sao-code-box" type="scan" color="#fff" size="25" @click="saoCode()"></uni-icons>
- </view>
- </template>
- <script>
- import {
- airBottleNewQpAppletBottleScan,
- airbottleNewQpAppletBottlePage,airBottleNewQpDictList,
- } from '@/pages_supplierCylinderManagement/api/index.js'
- export default {
- data() {
- return {
- fromPage:'',
- inputData:'',
- arrayA:[],
- indexA:null,
- arrayB:[],
- indexB:null,
- dataList:[],
- // 查询参数
- getDataType: false,
- queryParams: {
- page: 1,
- pageSize: 10,
- },
- total:0,
- }
- },
- onLoad(options) {
- this.fromPage = options.from;
- },
- onShow() {
- this.airBottleNewQpDictList1();
- this.airBottleNewQpDictList2();
- this.getList();
- },
- methods: {
- bindPickerChangeA(e) {
- this.indexA = e.detail.value
- this.$set(this.queryParams,'page',1);
- this.getList();
- },
- bindPickerChangeB(e) {
- this.indexB = e.detail.value
- this.$set(this.queryParams,'page',1);
- this.getList();
- },
- //滚动加载事件
- scrollGet() {
- let self = this;
- if (self.total / self.queryParams.pageSize <= self.queryParams.page) {
- this.$set(this, 'getDataType', true);
- } else {
- this.queryParams.page += 1;
- this.$nextTick(() => {
- this.getList();
- })
- }
- },
- //搜索
- async getList() {
- let self = this;
- let obj = {
- page:this.queryParams.page,
- pageSize:this.queryParams.pageSize,
- searchValue:this.inputData,
- gasName:this.indexA==null?'':this.arrayA[this.indexA],
- gasCategory:this.indexB==null?'':this.arrayB[this.indexB],
- };
- if(this.fromPage == 1){
- obj.state = 0;
- }else{
- obj.state = 1;
- }
- const {
- data
- } = await airbottleNewQpAppletBottlePage(obj);
- if (data.code == 200) {
- if(self.queryParams.page == 1){
- this.dataList = data.data.records;
- this.total = data.data.total;
- if (data.data.total / self.queryParams.pageSize <= self.queryParams.page) {
- this.$set(this, 'getDataType', true);
- }
- }else{
- this.dataList = [...this.dataList, ...data.data.records]
- this.total = data.data.total;
- if (data.data.total / self.queryParams.pageSize <= self.queryParams.page) {
- this.$set(this, 'getDataType', true);
- }
- }
- }
- },
- async airBottleNewQpDictList1() {
- const {
- data
- } = await airBottleNewQpDictList({"typeCode":'gas'});
- if (data.code == 200) {
- let list = [];
- for(let i=0;i<data.data.length;i++){
- list.push(data.data[i].name);
- }
- this.$set(this,'arrayA',list);
- }
- },
- async airBottleNewQpDictList2() {
- const {
- data
- } = await airBottleNewQpDictList({"typeCode":'gas_category'});
- if (data.code == 200) {
- let list = [];
- for(let i=0;i<data.data.length;i++){
- list.push(data.data[i].name);
- }
- this.$set(this,'arrayB',list);
- }
- },
- //重置
- resetButton(){
- this.$set(this,'inputData','');
- this.$set(this,'indexA',null);
- this.$set(this,'indexB',null);
- this.$set(this,'dataList',[]);
- this.$set(this,'getDataType',false);
- this.$set(this,'queryParams',{
- page: 1,
- pageSize: 10,
- });
- this.$set(this,'total',0);
- this.getList();
- },
- checkButton(item){
- let obj = {
- pageType:1,
- id:item.id,
- bottleCode:item.bottleCode,
- gasName:item.gasName,
- specification:item.specification,
- gasCategory:item.gasCategory,
- pressure:item.pressure,
- purity:item.purity,
- specialGases:item.specialGases,
- }
- uni.$emit('refreshBPageData', obj);
- uni.navigateBack({ delta: 1 });
- },
- /* 扫一扫*/
- saoCode() {
- let self = this;
- uni.scanCode({
- onlyFromCamera: true,
- success: function(res) {
- if(res.result.indexOf('type') != -1){
- let list = res.result.split("?")[1].split("&");
- let codeData = {};
- list.forEach((item) => {
- codeData[item.split("=")[0]] = item.split("=")[1];
- })
- if (codeData.type == 'gasCylinder' && codeData.code) {
- self.airBottleNewQpAppletBottleScan(codeData.code);
- }else{
- uni.showToast({
- title: '请扫描正确的二维码',
- icon: "error",
- mask: true,
- duration: 2000
- });
- }
- }else{
- uni.showToast({
- title: '请扫描正确的二维码',
- icon: "error",
- mask: true,
- duration: 2000
- });
- }
- }
- });
- },
- async airBottleNewQpAppletBottleScan(code) {
- const {
- data
- } = await airBottleNewQpAppletBottleScan({code:code});
- if (data.code == 200) {
- if(this.fromPage == 1 && data.data.state != 0){
- uni.showToast({
- title: '非待入库状态,无法入库',
- icon:"none",
- mask:true,
- duration: 3000
- });
- return
- }
- if(this.fromPage == 2 && data.data.state != 1){
- uni.showToast({
- title: '非使用中状态,无法出库',
- icon:"none",
- mask:true,
- duration: 3000
- });
- return
- }
- let obj = {
- pageType:1,
- id:data.data.id,
- bottleCode:data.data.bottleCode,
- gasName:data.data.gasName,
- specification:data.data.specification,
- gasCategory:data.data.gasCategory,
- pressure:data.data.pressure,
- purity:data.data.purity,
- specialGases:data.data.specialGases,
- }
- uni.$emit('refreshBPageData', obj);
- uni.navigateBack({ delta: 1 });
- }
- },
- }
- }
- </script>
- <style lang="stylus" scoped>
- #gasCylinderSelectCylinder {
- height: 100%;
- width: 100%;
- display flex ;
- flex-direction column;
- overflow: hidden;
- position: relative;
- .top-input-max-box{
- background-color: #fff;
- .input-box{
- display: flex;
- border-radius:40rpx;
- background-color: #eeeeee;
- margin:20rpx 20rpx 0 20rpx;
- color:#7C7C7C;
- .icon-box{
- margin:15rpx;
- }
- .input-min{
- height:80rpx;
- line-height:80rpx;
- flex:1;
- }
- .button-p{
- line-height:80rpx;
- width:120rpx;
- text-align: center;
- color:#333;
- font-size:28rpx;
- background-color: #D4D4D4;
- border-top-right-radius:40rpx;
- border-bottom-right-radius:40rpx;
- }
- }
- .picker-box{
- display: flex;
- .picker-min-box{
- height:80rpx;
- line-height:80rpx;
- display: flex;
- padding:0 30rpx;
- .icon-box{
- margin-left:10rpx;
- }
- }
- }
- }
- .content-box{
- flex:1;
- display flex ;
- flex-direction column;
- overflow: scroll;
- padding-bottom:40rpx;
- .null-p{
- text-align: center;
- line-height:300rpx;
- color:#999;
- }
- .for-max-big-box{
- padding:20rpx 30rpx;
- background-color: #fff;
- border-radius:10rpx;
- margin:25rpx 25rpx 0;
- .for-title-box{
- display: flex;
- margin-bottom:20rpx;
- view{
- padding-bottom:20rpx;
- line-height: 60rpx
- border-bottom:1rpx solid #dedede;
- font-weight:700;
- }
- view:nth-child(1){
- color:#666666;
- }
- view:nth-child(2){
- flex:1;
- text-align: right;
- }
- }
- .for-text-box{
- display: flex;
- view{
- line-height: 60rpx
- font-weight:700;
- }
- view:nth-child(1){
- color:#666666;
- }
- view:nth-child(2){
- flex:1;
- text-align: right;
- }
- }
- }
- }
- .sao-code-box{
- width:100rpx;
- height:100rpx;
- line-height:100rpx;
- text-align: center;
- background-color: #266FFF;
- border-radius:50%;
- position: absolute;
- bottom:60rpx;
- left:50%;
- margin-left:-50rpx;
- }
- }
- </style>
|