liuhj 7 달 전
부모
커밋
700af3b3bc
1개의 변경된 파일117개의 추가작업 그리고 6개의 파일을 삭제
  1. 117 6
      src/components/OP/OpDecreasePayments.vue

+ 117 - 6
src/components/OP/OpDecreasePayments.vue

@@ -1,5 +1,14 @@
 <template>
     <div class="car_add" v-loading.fullscreen.lock="fullscreenLoading">
+        <el-dialog class="opdp-dialog" width="500px" title="物资选择" :visible.sync="suppliesVisible">
+            <el-checkbox-group v-model="checkedCities" @change="handleCheckedDatesChange">
+                <el-checkbox v-for="item in priceNamelist" :label="item.value" :key="item.id">{{item.value}}</el-checkbox>
+            </el-checkbox-group>
+            <div class="supplies-button">
+                <el-button size="mini" @click="suppliesVisible = false">取 消</el-button>
+                <el-button size="mini" type="primary" @click="suppliesclick">确 定</el-button>
+            </div>
+        </el-dialog>
         <div>
             <div class="communal-title">
                 <div>{{ title }}</div>
@@ -48,10 +57,18 @@
                             </el-input>
                         </el-form-item>
                     </div> -->
-                    <div style="width: 394px;">
+                    <div style="width: 394px;position: relative;">
+                        <el-button @click="suppliesVisible=true" style="position: absolute;right: -72px;top: 1px;" type="primary">选择</el-button>
                         <el-form-item label="费用名称:" prop="priceName" label-width="160px">
-                            <el-input placeholder="费用名称" v-model="DecreasePaymentsData.priceName">
-                            </el-input>
+                            <!-- <el-input placeholder="费用名称" v-model="DecreasePaymentsData.priceName"></el-input> -->
+                            <el-autocomplete
+                            style="width: 100%;"
+                            class="inline-input"
+                            v-model="DecreasePaymentsData.priceName"
+                            :fetch-suggestions="querySearch"
+                            placeholder="请输入内容"
+                            @select="priceNameSelect"
+                            ></el-autocomplete>
                         </el-form-item>
                     </div>
                     <div style="width: 394px;">
@@ -78,7 +95,6 @@
                         <el-form-item label="供应商全称:" prop="supplierName" label-width="160px">
                             <!-- <el-input placeholder="供应商全称" v-model="DecreasePaymentsData.supplierName">
                             </el-input> -->
-
                             <el-autocomplete
                             style="width: 100%;"
                             v-model="DecreasePaymentsData.supplierName"
@@ -86,7 +102,6 @@
                             placeholder="供应商全称"
                             @select="handleSelect"
                             ></el-autocomplete>
-                            
                         </el-form-item>
                     </div>
                     <div v-if="eventspd" style="width: 394px;">
@@ -332,6 +347,9 @@ export default {
             fullscreenLoading:false,
             queryArr : [],
             Switchwifi:false,
+            priceNamelist:[],
+            suppliesVisible:false,
+            checkedCities:[]
         }   
     },
     watch:{
@@ -736,6 +754,86 @@ export default {
                     that.queryArr = res.data.data;
                 }
             })
+        },
+        querySearch(queryString, cb) {
+            var priceNamelist = this.priceNamelist;
+            var results = queryString ? priceNamelist.filter(this.createFilter(queryString)) : priceNamelist;
+            // 调用 callback 返回建议列表的数据
+            cb(results);
+        },
+        createFilter(queryString) {
+            return (restaurant) => {
+                return restaurant.value.replace("  ", "").toLowerCase().match(queryString.toLowerCase());
+            };
+        },
+        handleCheckedDatesChange(val){
+            console.log(val);
+        },
+        suppliesclick(){
+            var suppliesarr=[];
+            if (this.checkedCities.length==0) {
+                this.$message({
+                    message: '未选择物资!',
+                    type: 'warning'
+                });
+                return 
+            }
+            for(let i=0;i<this.priceNamelist.length;i++){
+                for (let j = 0; j < this.checkedCities.length; j++) {
+                    if(this.checkedCities[j]==this.priceNamelist[i].value){
+                        suppliesarr.push(this.priceNamelist[i])
+                    }
+                }
+            }
+            this.DecreasePaymentsData.price=0;
+            this.DecreasePaymentsData.priceName='';
+            this.DecreasePaymentsData.remark='';
+            this.DecreasePaymentsData.currency='';
+            this.DecreasePaymentsData.quantity=0;
+            for(let g=0;g<suppliesarr.length;g++){
+                this.DecreasePaymentsData.price+=suppliesarr[g].price;
+                this.DecreasePaymentsData.priceName+=suppliesarr[g].value+'、'
+                this.DecreasePaymentsData.remark+=suppliesarr[g].value+'   '+suppliesarr[g].price+' CNY 、'
+            }
+            this.DecreasePaymentsData.currency=836;
+            this.DecreasePaymentsData.quantity=1;
+            this.Sumup();
+            this.suppliesVisible=false;
+        },
+        priceNameSelect(val){
+            console.log(val);
+            this.DecreasePaymentsData.price=val.price;
+            this.DecreasePaymentsData.currency=836;
+            this.DecreasePaymentsData.quantity=1;
+            this.DecreasePaymentsData.remark=val.value+'   '+val.price+' CNY'
+            this.Sumup();
+        },
+        QuerySetData() {
+            var url = "/api/System/QuerySetData"
+            var that = this
+            this.$axios({
+                method: 'post',
+                url: url,
+                headers: {
+                    Authorization: 'Bearer ' + that.token
+                },
+                data: {
+                    dataType: 91
+                }
+            }).then(function (res) {
+                if (res.data.code == 200) {
+                    var priceNamelist=res.data.data;
+                    that.priceNamelist= priceNamelist.map((terminal) => {
+                        return {
+                            value: terminal.name,
+                            id:terminal.id,
+                            price:Number(terminal.remark)
+                        };
+                    });
+                    console.log(that.priceNamelist);
+                    
+                }
+            })
         }
 
     },
@@ -747,6 +845,7 @@ export default {
         this.token = JSON.parse(localStorage.getItem('userinif')).token;
         this.userId = JSON.parse(localStorage.getItem('userinif')).userInfo.userId
         this.AirTicketResSelect();
+        this.QuerySetData();
         this.id = this.$route.query.id
         if (this.id != null && this.id != undefined && this.id != 0) {
             this.QueryDecreasePaymentsById();
@@ -808,7 +907,19 @@ export default {
     border-radius: 10px;
     min-height: 810px;
 }
-
+.opdp-dialog .el-checkbox-group{
+    display: flex;
+    flex-wrap: wrap;
+}
+.opdp-dialog .el-checkbox{
+    margin-right: 10px;
+    margin-bottom: 10px;
+    width: 30%;
+}
+.supplies-button{
+    margin-top: 15px;
+    text-align: right;
+}
 @media screen and (max-width: 1700px) {
     .appraise-box>div {
         width: 48%;