Pārlūkot izejas kodu

平衡项目添加“是否平衡”,修改添加“分摊值”

zhangy 2 gadi atpakaļ
vecāks
revīzija
295f6631e6

+ 40 - 8
src/views/energyBalance/components/balanceData.vue

@@ -313,9 +313,24 @@
                             width="110px"
                             :show-overflow-tooltip="true"
                         >
-                            <template slot-scope="scope">
-                                <span>{{ isNaN(scope.row.apportvalue - scope.row.rav) ? '' : floatComputed(scope.row.apportvalue, scope.row.rav, '-') }}</span>
-                            </template>
+                          <template slot-scope="scope">
+                               <el-form-item
+                                   v-if="scope.row.isSelection"
+                                   :prop="'s' + scope.row.seq + '.ftv'"
+                                   :rules="tableFormRules.numbers"
+                               >
+                               <!-- v-model="tableFormDataObj['s' + scope.row.seq].apportvalue-tableFormDataObj['s' + scope.row.seq].scope.row.rav" -->
+
+                                   <el-input clearable @keydown.native="keyDown" :id="scope.column.id + scope.$index"
+                                       style="width: 100%;"
+                                        v-model="tableFormDataObj['s' + scope.row.seq].ftv"
+                                       refcous="true"
+                                       @change="getApportvalue1('s' + scope.row.seq)"
+                                   ></el-input>
+                               </el-form-item>
+                                <span v-else>{{scope.row.ftv}}</span>
+                              <!-- <span v-else>{{ isNaN(scope.row.apportvalue - scope.row.rav) ? '' : floatComputed(scope.row.apportvalue, scope.row.rav, '-') }}</span> -->
+                           </template>
                         </el-table-column>
                         <!-- <el-table-column
                         sortable
@@ -339,7 +354,7 @@
                                 <el-form-item
                                     v-if="scope.row.isSelection"
                                     :prop="'s' + scope.row.seq + '.apportvalue'"
-                                    :rules="tableFormRules.numbers"
+                                    :rules="tableFormRules.integer"
                                 >
                                     <el-input clearable @keydown.native="keyDown" :id="scope.column.id + scope.$index"
                                         style="width: 100%;"
@@ -492,7 +507,7 @@
 </template>
 
 <script>
-import { zCheckNumber1 } from '~/utils/validator.js'
+import { zCheckNumber1, checkInteger } from '~/utils/validator.js'
 import store from '@/store/index.js';
 import timegranDate from '~/components/zg/timegranDate.vue'
 import {formatDate, XtcommonSummaries} from '@/utils/util.js';
@@ -540,6 +555,9 @@ export default {
             tableFormRules: {
                 numbers: [
                     { validator: zCheckNumber1, trigger: 'change' }
+                ],
+                integer: [
+                    { validator: checkInteger, trigger: 'change' }
                 ]
             },
             pageNum: 1,
@@ -765,7 +783,8 @@ export default {
                     itemid: that.filterForm.data.itemid,
                     itemname: that.filterForm.data.itemname,
                     itemdesc: that.filterForm.data.itemdesc,
-                    measureid: that.filterForm.data.measureid
+                    measureid: that.filterForm.data.measureid,
+                    balflag: 1
                 };
             that.pageNum = pageNum || that.pageNum;
             that.tableLoading = true;
@@ -803,7 +822,7 @@ export default {
                                 updateUser: item.USERID,
                                 updateclock: item.UPTIME,
                                 rav: item.RAV,
-                                ftv: Number(item.APPORTVALUE) - Number(item.RAV),
+                                ftv: item.FTV != null ? item.FTV : Number(item.APPORTVALUE) - Number(item.RAV),
                                 showno: item.SHOWNO
                             })
                         }
@@ -878,6 +897,18 @@ export default {
             let that = this;
             let correctvalue = that.floatComputed(that.tableFormDataObj[ids].apportvalue, that.tableFormDataObj[ids].actualvalue, '-');
             that.tableFormDataObj[ids].correctvalue = correctvalue;
+        },
+        // 计算分摊值
+        getFtv (ids) {
+            let that = this;
+            let ftv = that.floatComputed(that.tableFormDataObj[ids].apportvalue, that.tableFormDataObj[ids].rav, '-');
+            that.tableFormDataObj[ids].ftv = ftv;
+        },
+        // 计算最终值(取整数)
+        getApportvalue1 (ids) {
+            let that = this;
+            let apportvalue = that.floatComputed(that.tableFormDataObj[ids].rav, that.tableFormDataObj[ids].ftv, '+').toFixed(0);
+            that.tableFormDataObj[ids].apportvalue = apportvalue;
         },
         // 批量重新计算
         but_re_compute () {
@@ -929,7 +960,8 @@ export default {
                                 timegranid: that.tableFormDataObj[obj].timegranid,
                                 correctvalue: that.tableFormDataObj[obj].correctvalue,
                                 apportvalue: that.tableFormDataObj[obj].apportvalue,
-                                actualvalue: that.tableFormDataObj[obj].actualvalue
+                                actualvalue: that.tableFormDataObj[obj].actualvalue,
+                                ftv: that.tableFormDataObj[obj].ftv
                             })
                         }
                         that.loading = true;

+ 49 - 15
src/views/energyBalance/components/balanceData2.vue

@@ -221,14 +221,10 @@
             </div>
              <el-tabs v-model="activeName" @tab-click="handleClick">
                 <el-tab-pane label="安泰" name="安泰-">
-
                 </el-tab-pane>
-
                 <el-tab-pane label="新泰" name="新泰-">
-
                 </el-tab-pane>
                 <el-tab-pane label="附表" name="附表" >
-
                 </el-tab-pane>
             </el-tabs>
             <div class="box-bottom">
@@ -325,9 +321,24 @@
                             width="110px"
                             :show-overflow-tooltip="true"
                         >
-                            <template slot-scope="scope">
-                                <span>{{ isNaN(scope.row.apportvalue - scope.row.rav) ? '' : floatComputed(scope.row.apportvalue, scope.row.rav, '-') }}</span>
-                            </template>
+                       <template slot-scope="scope">
+                            <el-form-item
+                                v-if="scope.row.isSelection"
+                                :prop="'s' + scope.row.seq + '.ftv'"
+                                :rules="tableFormRules.numbers"
+                            >
+                            <!-- v-model="tableFormDataObj['s' + scope.row.seq].apportvalue-tableFormDataObj['s' + scope.row.seq].scope.row.rav" -->
+
+                                <el-input clearable @keydown.native="keyDown" :id="scope.column.id + scope.$index"
+                                    style="width: 100%;"
+                                     v-model="tableFormDataObj['s' + scope.row.seq].ftv"
+                                    refcous="true"
+                                    @change="getApportvalue1('s' + scope.row.seq)"
+
+                                ></el-input>
+                            </el-form-item>
+                            <span v-else>{{ scope.row.ftv}}</span>
+                        </template>
                         </el-table-column>
                         <!-- <el-table-column
                         sortable
@@ -351,7 +362,7 @@
                                 <el-form-item
                                     v-if="scope.row.isSelection"
                                     :prop="'s' + scope.row.seq + '.apportvalue'"
-                                    :rules="tableFormRules.numbers"
+                                    :rules="tableFormRules.integer"
                                 >
                                     <el-input clearable @keydown.native="keyDown" :id="scope.column.id + scope.$index"
                                         style="width: 100%;"
@@ -410,7 +421,7 @@
                             :show-overflow-tooltip="true"
                         >
                             <template slot-scope="scope">
-                                <el-form-item
+                            <!--    <el-form-item
                                     v-if="scope.row.isSelection"
                                     :prop="'s' + scope.row.seq + '.correctvalue'"
                                     :rules="tableFormRules.numbers"
@@ -421,8 +432,8 @@
                                         refcous="true"
                                         @change="getApportvalue('s' + scope.row.seq)"
                                     ></el-input>
-                                </el-form-item>
-                                <span v-else>{{scope.row.correctvalue}}</span>
+                                </el-form-item> -->
+                                <span >{{scope.row.correctvalue}}</span>
                             </template>
                         </el-table-column>
                         <!-- <el-table-column
@@ -504,7 +515,7 @@
 </template>
 
 <script>
-import { zCheckNumber1 } from '~/utils/validator.js'
+import { zCheckNumber1, checkInteger} from '~/utils/validator.js'
 import store from '@/store/index.js';
 import timegranDate from '~/components/zg/timegranDate.vue'
 import {formatDate, XtcommonSummaries} from '@/utils/util.js';
@@ -516,6 +527,8 @@ export default {
     data () {
         let start = new Date(new Date().getFullYear(), new Date().getMonth() - 1, '01');
         return {
+            // 默认选中第一个
+            activeName: '安泰-',
             rowIndex: '',
             columnId: '',
             focusTarget: null,
@@ -552,6 +565,9 @@ export default {
             tableFormRules: {
                 numbers: [
                     { validator: zCheckNumber1, trigger: 'change' }
+                ],
+                integer: [
+                    { validator: checkInteger, trigger: 'change' }
                 ]
             },
             pageNum: 1,
@@ -614,6 +630,8 @@ export default {
         }
     },
     created () {
+        this.filterForm.data.itemdesc = this.activeName;
+        this.pageSize = 100;
         this.activeMenu = window.localStorage.getItem('activeMenu');
     },
     mounted () {
@@ -783,7 +801,8 @@ export default {
                     itemid: that.filterForm.data.itemid,
                     itemname: that.filterForm.data.itemname,
                     itemdesc: that.filterForm.data.itemdesc,
-                    measureid: that.filterForm.data.measureid
+                    measureid: that.filterForm.data.measureid,
+                    balflag: 1
                 };
             that.pageNum = pageNum || that.pageNum;
             that.tableLoading = true;
@@ -821,10 +840,11 @@ export default {
                                 updateUser: item.USERID,
                                 updateclock: item.UPTIME,
                                 rav: item.RAV,
-                                ftv: Number(item.APPORTVALUE) - Number(item.RAV),
+                                ftv: item.FTV != null ? item.FTV : Number(item.APPORTVALUE) - Number(item.RAV),
                                 showno: item.SHOWNO
                             })
                         }
+
                         that.tableData = arr;
                         that.total = res.data.total;
                     } else {
@@ -896,6 +916,19 @@ export default {
             let that = this;
             let correctvalue = that.floatComputed(that.tableFormDataObj[ids].apportvalue, that.tableFormDataObj[ids].actualvalue, '-');
             that.tableFormDataObj[ids].correctvalue = correctvalue;
+            this.getFtv(ids);
+        },
+        // 计算分摊值
+        getFtv (ids) {
+            let that = this;
+            let ftv = that.floatComputed(that.tableFormDataObj[ids].apportvalue, that.tableFormDataObj[ids].rav, '-');
+            that.tableFormDataObj[ids].ftv = ftv;
+        },
+        // 计算最终值(取整数)
+        getApportvalue1 (ids) {
+            let that = this;
+            let apportvalue = that.floatComputed(that.tableFormDataObj[ids].rav, that.tableFormDataObj[ids].ftv, '+').toFixed(0);
+            that.tableFormDataObj[ids].apportvalue = apportvalue;
         },
         // 批量重新计算
         but_re_compute () {
@@ -947,7 +980,8 @@ export default {
                                 timegranid: that.tableFormDataObj[obj].timegranid,
                                 correctvalue: that.tableFormDataObj[obj].correctvalue,
                                 apportvalue: that.tableFormDataObj[obj].apportvalue,
-                                actualvalue: that.tableFormDataObj[obj].actualvalue
+                                actualvalue: that.tableFormDataObj[obj].actualvalue,
+                                ftv: that.tableFormDataObj[obj].ftv
                             })
                         }
                         that.loading = true;

+ 62 - 3
src/views/energyBalance/components/balanceSheetItem.vue

@@ -205,7 +205,7 @@
                         size="mini"
                         highlight-current-row
                         @current-change="handleCurrentChange"
-                        @selection-change="handleSelectionChange"                        
+                        @selection-change="handleSelectionChange"
 						:row-class-name="tableRowClassName"
                     >
                         <el-table-column
@@ -447,7 +447,41 @@
                             label="修改时间"
                             width="135px"
                             :show-overflow-tooltip="true"
-                        ></el-table-column>
+                        ></el-table-column>
+                        <el-table-column
+                            sortable
+                            prop="balflag"
+                            label="是否平衡"
+                            width="135px"
+                            :show-overflow-tooltip="true"
+                        >
+                        <template slot-scope="scope">
+                            <el-form-item
+                                v-if="scope.row.isSelection"
+                                :prop="scope.row.itemid + '.balflag'"
+
+                            >
+                                <el-select
+                                    filterable clearable
+                                    style="width: 100%;"
+                                    v-model="tableFormDataObj[scope.row.itemid].balflag"
+                                >
+                                  <el-option
+                                       label="是"
+                                       value="1"
+                                   ></el-option>
+                                   <el-option
+                                       label="否"
+                                       value="0"
+                                   ></el-option>
+                                </el-select>
+                                <template slot="error" slot-scope="scope">
+                                    <p class="error" :title="scope.error">{{ scope.error }}</p>
+                                </template>
+                            </el-form-item>
+                            <span v-else>{{ scope.row.balflag === '0' ? '否' : '是' }}</span>
+                        </template>
+                        </el-table-column>
                         <el-table-column
                             class-name="gn-TableDownloadExcel-none"
                             label="操作"
@@ -624,6 +658,27 @@
                                 ></el-input>
                             </el-form-item>
                         </el-col>
+                    </el-row>
+                    <el-row>
+                        <el-col :span="12">
+                            <el-form-item label="是否平衡" prop="balflag">
+                                <el-select
+                                filterable clearable
+                                    style="width: 100%;"
+                                    v-model="dialog.editorBox.form.data.balflag"
+                                    :disabled="dialog.editorBox.type !== 'add'"
+                                >
+                                   <el-option
+                                       label="是"
+                                       value="1"
+                                   ></el-option>
+                                   <el-option
+                                       label="否"
+                                       value="0"
+                                   ></el-option>
+                                </el-select>
+                            </el-form-item>
+                        </el-col>
                     </el-row>
                     <!-- <el-row>
                       <el-col :span="12">
@@ -965,7 +1020,8 @@ export default {
                                 userid: item.userid,
                                 defaulman: item.defaulman,
                                 modificationtime: item.modificationtime,
-                                useflag: item.useflag,
+                                useflag: item.useflag,
+                                balflag: item.balflag,
                                 showno: item.showno,
                                 digits: item.digits
                             })
@@ -1062,6 +1118,7 @@ export default {
                 propertyid: that.dialog.editorBox.form.data.propertyid,
                 unitid: that.dialog.editorBox.form.data.unitid,
                 fid: that.dialog.editorBox.form.data.fid,
+                balflag: that.dialog.editorBox.form.data.balflag,
                 digits: that.dialog.editorBox.form.data.digits
             };
             that.$refs['dialog_form'].validate((valid) => {
@@ -1088,6 +1145,7 @@ export default {
                             tablename: 'T_RM_BALANCE_VALUE',
                             itemdesc: SubmitData.itemdesc,
                             fid: SubmitData.fid,
+                            balflag: SubmitData.balflag,
                             digits: SubmitData.digits
                         };
                         that.loading = true;
@@ -1177,6 +1235,7 @@ export default {
                                 unitid: that.tableFormDataObj[key].unitid,
                                 fid: that.tableFormDataObj[key].fid,
                                 showno: that.tableFormDataObj[key].showno,
+                                balflag: that.tableFormDataObj[key].balflag,
                                 digits: that.tableFormDataObj[key].digits
                             });
                         }