Przeglądaj źródła

Merge branch 'master' of http://132.232.92.186:3000/XinXiBu/oa-system

liuhj 1 tydzień temu
rodzic
commit
a3dcbfdde4
1 zmienionych plików z 153 dodań i 0 usunięć
  1. 153 0
      src/components/Finance/Cost.vue

+ 153 - 0
src/components/Finance/Cost.vue

@@ -2,6 +2,25 @@
     <div class="cost-all" v-loading.fullscreen.lock="costloading">
         <div class="cost-box">
 
+            <el-dialog width="400px" title="成本数据复制" :visible.sync="dialogCopyVisible">
+                <div>
+                    <label class="el-form-item__label">将此成本数据复制至:</label>
+                    <el-select @focus="GroupSelectFocus" remote :loading="selectLoading" :remote-method="remoteMethod"
+                        size="small" v-model="dialogCopySelect" filterable placeholder="请选择">
+                        <el-option v-for="item in options" :key="item.id" :label="item.groupName" :value="item.id">
+                            <span v-if="item.isTrue == 'True'" style="color:#409EFF">{{ item.groupName }}</span>
+                            <span v-else style="color:gray">{{ item.groupName }}</span>
+                        </el-option>
+                    </el-select>
+                </div>
+                <br />
+                <div class="btn-dialog-cost">
+                    <el-button size="small" type="primary" @click='CopyGroupCost'>确定</el-button>
+                    &nbsp;&nbsp;&nbsp;
+                    <el-button @click="dialogCopyVisible = false" size="small">取消</el-button>
+                </div>
+            </el-dialog>
+
             <el-dialog width="85%" title="地接历史费用" :visible.sync="historyCarDialog" @close="dialogClose">
                 <div style="display: flex;">
                     <div style="width: 30%;">
@@ -147,6 +166,8 @@
                         </el-select>
                     </div>
                     <div class="ser-btn-li">
+                        <el-button size="small" type="primary"
+                            @click="dialogCopyVisible = true; dialogCopySelect = '';">成本复制</el-button>
                         <el-button size="small" :type="blackCodeIsTrue ? 'primary' : 'danger'"
                             @click="importBlackCode">导入机票行程数据</el-button>
                         <el-button size="small" :type="hotelIsTrue ? 'primary' : 'danger'"
@@ -3295,6 +3316,8 @@ export default {
             blackCodeListSeLect: [],
             blackCodeSelect: '',
             selectLoading: false,
+            dialogCopyVisible: false,
+            dialogCopySelect: '',
         };
     },
     watch: {
@@ -6620,6 +6643,136 @@ export default {
             if (this.options.length == 0) {
                 this.remoteMethod("")
             }
+        },
+        async CopyGroupCost() {
+
+            if (this.costTypevalue == 'A') {
+                var sgrfilter = this.costTypeHotelNumbers.filter(x => {
+                    return x.type == 'Default'
+                })[0];
+                var pNumber = 0;
+                //遍历 sgrfilter对象
+                for (var key in sgrfilter) {
+                    var parNumber = Number(sgrfilter[key]);
+                    if (isNaN(parNumber)) {
+                        parNumber = 0;
+                    } else {
+                        if (key == 'tbr') {
+                            pNumber += parNumber * 2;
+                        }
+                        if (key == 'sgr') {
+                            pNumber += parNumber;
+                        }
+                        if (key == 'jses') {
+                            pNumber += parNumber;
+                        }
+                        if (key == 'suite') {
+                            pNumber += parNumber;
+                        }
+                    }
+                }
+
+                var isChange = await this.getGroupInfo();
+                if (isChange) {
+                    var number = this.grouptitleinfo.visitPNumber;
+                    this.AGroupCostParameter.visaRS = number;
+                    this.AGroupCostParameter.bxrs = number;
+                    this.AGroupCostParameter.djrs = number;
+                    this.AGroupCostParameter.gwrs = number;
+                    this.AGroupCostParameter.lyjrs = number;
+                }
+
+                ////console.log(pNumber, 'pNumber-------------');
+                if (this.grouptitleinfo.visitPNumber != pNumber) {
+                    this.$message.error('团组人数与房间人数不一致!')
+                    return resolve(false);
+                }
+            }
+
+            var that = this;
+            var Data = { diid: this.diid, userid: this.userId };
+            var isTrue = await this.formVerify();
+            if (isTrue) {
+                Data.checkBoxs = this.CheckBoxListSelect.map(x => {
+                    return {
+                        diid: x.diid,
+                        cbType: x.cbType,
+                        cbValues: x.cbValues.join(',')
+                    };
+                });
+
+                Data.groupCosts = this.tableData;
+                Data.costTypeHotelNumbers = this.costTypeHotelNumbers.map(x => {
+                    return {
+                        id: x.id,
+                        sgr: x.sgr,
+                        tbr: x.tbr,
+                        jses: x.jses,
+                        suite: x.suite,
+                        type: x.type,
+                        diid: that.diid
+                    };
+                });
+
+                this.AGroupCostParameter.currency = this.AGroupCostParameter.currency.toString();
+                this.AGroupCostParameter.diId = this.diid;
+                this.BGroupCostParameter.diId = this.diid;
+
+                var Aparam = Object.assign({}, this.AGroupCostParameter);
+                var Bparam = Object.assign({}, this.BGroupCostParameter);
+                if (that.AGroupCostParameter.costTypeStartTime) {
+                    Aparam.costTypeStartTime = this.addOneDay(that.AGroupCostParameter.costTypeStartTime, 0);
+                }
+                if (that.AGroupCostParameter.costTypeendTime) {
+                    Aparam.costTypeendTime = this.addOneDay(that.AGroupCostParameter.costTypeendTime, 0);
+                }
+                if (that.BGroupCostParameter.costTypeStartTime) {
+                    Bparam.costTypeStartTime = this.addOneDay(that.BGroupCostParameter.costTypeStartTime, 0);
+                }
+                if (that.BGroupCostParameter.costTypeendTime) {
+                    Bparam.costTypeendTime = this.addOneDay(that.BGroupCostParameter.costTypeendTime, 0);
+                }
+                if (this.costTypevalue == "A") {
+                    Data.groupCostParameters = [Aparam];
+                } else {
+                    Data.groupCostParameters = [Aparam, Bparam];
+                }
+
+                var ResultCostArr = this.Dataformat();
+                Data.groupCosts = ResultCostArr;
+                Data.ToGroupId = this.dialogCopySelect;
+                ////////console.log(Data, "save-------Data");
+
+                var that = this;
+                this.$axios.post('/api/Groups/CopyGroupCost', Data, {
+                    headers: {
+                        'Authorization': that.token,
+                    }
+                }).then(resp => {
+
+                    if (resp.data.code == 200) {
+                        this.$message({
+                            message: '复制成功!',
+                            type: 'success'
+                        });
+                    } else {
+                        this.$message.error('复制失败!' + resp.data.msg);
+                    }
+
+                    var result = Number(that.AGroupCostParameter.currency);
+                    if (isNaN(result)) {
+
+                    } else {
+                        that.AGroupCostParameter.currency = result;
+                    }
+                }).finally(() => {
+                    this.dialogCopyVisible = false;
+                })
+
+            } else {
+                this.dialogCopyVisible = false;
+                this.$message.error('请将本团组完善!');
+            }
         }
     },
     updated() {