Lijy преди 2 седмици
родител
ревизия
81d9767b7f
променени са 1 файла, в които са добавени 178 реда и са изтрити 5 реда
  1. 178 5
      fhKeeper/formulahousekeeper/timesheet/src/views/project/financeComponents/incomeDetail.vue

+ 178 - 5
fhKeeper/formulahousekeeper/timesheet/src/views/project/financeComponents/incomeDetail.vue

@@ -6,10 +6,33 @@
         <i class="fa fa-align-justify" @click.prevent="switchMenu" style="cursor: pointer" />
         <div class="m-lr">选择月份</div>
         <el-date-picker size="small" v-model="selectMonth" :editable="false" format="yyyy-MM" value-format="yyyy-MM"
-          @change="retrieveDataAgain" :clearable="false" type="month" placeholder="选择月份" />
+          @change="retrieveDataAgain" :clearable="false" type="month" placeholder="选择月份" style="width: 160px;" />
+
+        <!-- 奖金类型 -->
+        <div class="item-center" style="margin-left: 15px">
+          <div style="margin-right: 10px">选择奖金类型</div>
+          <el-select v-model="bonusType" placeholder="请选择" clearable @change="retrieveDataAgain" size="small" style="width: 140px;">
+            <el-option v-for="(item, index) in bonusTypeList" :key="index" :label="item.label"
+              :value="item.value">
+            </el-option>
+          </el-select>
+        </div>
+
+        <!-- 数据类型 -->
+        <div class="item-center" style="margin-left: 15px">
+          <div style="margin-right: 10px">选择数据类型</div>
+          <el-select v-model="isNegative" placeholder="请选择" clearable @change="retrieveDataAgain" size="small" style="width: 140px;">
+            <el-option v-for="(item, index) in isNegativeList" :key="index" :label="item.label"
+              :value="item.value">
+            </el-option>
+          </el-select>
+        </div>
       </div>
       <div class="item-center">
-        <el-link type="primary" :underline="false" @click="notParticipatingInSharedProjects()">
+        <el-link type="primary" :underline="false" @click="oneClickVerification()">
+          一键核销
+        </el-link>
+        <el-link type="primary" :underline="false" class="ml" @click="notParticipatingInSharedProjects()">
           不参与分摊项目设置
         </el-link>
         <el-link type="primary" :underline="false" class="ml" @click="bonusDataExport">数据导出</el-link>
@@ -108,12 +131,57 @@
             <el-date-picker v-model="selectYear" type="year" value-format="yyyy" :size="'small'">
             </el-date-picker>
           </el-form-item>
+          <el-form-item label="选择奖金类型">
+            <el-select v-model="exportBonusType" placeholder="请选择" clearable size="small">
+              <el-option v-for="(item, index) in bonusTypeList" :key="index" :label="item.label"
+                :value="item.value">
+              </el-option>
+            </el-select>
+          </el-form-item>
+          <el-form-item label="选择数据类型">
+            <el-select v-model="exportIsNegative" placeholder="请选择" clearable size="small">
+              <el-option v-for="(item, index) in isNegativeList" :key="index" :label="item.label"
+                :value="item.value">
+              </el-option>
+            </el-select>
+          </el-form-item>
         </el-form>
       </div>
       <span slot="footer" class="dialog-footer">
         <el-button type="primary" @click="submitExport()" :loading="dataExportLoading">导出</el-button>
       </span>
     </el-dialog>
+
+    <!-- 一键核销 -->
+    <el-dialog title="一键核销" :visible.sync="oneClickVerificationVisable" top="6.2vh" width="1000px">
+      <div>
+        <el-form ref="form" label-width="100px" style="display: flex;">
+          <el-form-item label="选择年份">
+            <el-date-picker v-model="writeOffYear" type="year" value-format="yyyy" :size="'small'" :clearable="false" @change="getWriteOffTableData">
+            </el-date-picker>
+          </el-form-item>
+          <el-form-item label="选择奖金类型" style="margin-left: 20px;">
+            <el-select v-model="writeOffBonusType" placeholder="请选择" clearable size="small" @change="getWriteOffTableData">
+              <el-option v-for="(item, index) in bonusTypeList" :key="index" :label="item.label"
+                :value="item.value">
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-form>
+        <el-table ref="multipleTable" :data="oneClickVerificationList" border height="56vh" tooltip-effect="dark" style="width: 100%" @selection-change="writeOffSelectionChange" v-loading="oneClickVerificationTableLoading">
+          <el-table-column type="selection" width="55"></el-table-column>
+          <el-table-column prop="jobNumber" label="工号"></el-table-column>
+          <el-table-column prop="userName" label="姓名"></el-table-column>
+          <el-table-column prop="bonusType" label="奖金类型"></el-table-column>
+          <el-table-column prop="totalBonusValue" label="奖金金额(元)"></el-table-column>
+          <el-table-column prop="startYM" label="分摊月份"></el-table-column>
+        </el-table>
+      </div>
+      <span slot="footer" class="writeOffAtTheBottom">
+        <el-button type="primary" size="small" @click="writeOffSelected()" :disabled="!oneClickVerificationSelected.length">一键核销</el-button>
+        <el-button size="small" @click="oneClickVerificationVisable = false">关闭</el-button>
+      </span>
+    </el-dialog>
   </div>
 </template>
 
@@ -158,6 +226,33 @@ export default {
       projectAllList: [],
       echartsData: [],
       myChart: null,
+
+      bonusTypeList: [
+        { label: '第一季度奖', value: '第一季度奖' },
+        { label: '第二季度奖', value: '第二季度奖' },
+        { label: '第三季度奖', value: '第三季度奖' },
+        { label: '第四季度奖', value: '第四季度奖' },
+        { label: '上半年奖', value: '上半年奖' },
+        { label: '下半年奖', value: '下半年奖' },
+        { label: '全年', value: '全年' },
+      ],
+      isNegativeList: [
+        { label: '正数', value: 'false' },
+        { label: '负数', value: 'true' },
+      ],
+      exportBonusType: '',
+      exportIsNegative: '',
+      bonusType: '',
+      isNegative: '',
+
+      // 一键核销
+      oneClickVerificationTableLoading: false,
+      oneClickVerificationVisable: false,
+      oneClickVerificationList: [],
+      oneClickVerificationSelected: [],
+      oneClickVerificationBtnLoading: false,
+      writeOffYear: '',
+      writeOffBonusType: ''
     };
   },
   mounted() {
@@ -166,6 +261,52 @@ export default {
     this.loadMonthData()
   },
   methods: {
+    writeOffSelected() {
+      this.$confirm('确定核销当前选中的数据?', '核销', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        const ids = this.oneClickVerificationSelected.map(item => item.id).join(',')
+        this.oneClickVerificationBtnLoading = true
+        this.postData(`/contractBonusSummary/generateNegativeContractBonus`, {
+          ids
+        }).then((res) => {
+          this.$message({
+            type: 'success',
+            message: '核销成功!'
+          });
+          this.getWriteOffTableData()
+        }).finally(() => {
+          this.oneClickVerificationBtnLoading =false
+        })
+      })
+    },
+    writeOffSelectionChange(val) {
+      this.oneClickVerificationSelected = val
+    },
+    oneClickVerification() {
+      this.oneClickVerificationVisable = true
+      this.writeOffYear = this.dayjs().format('YYYY')
+      this.writeOffBonusType = ''
+      this.getWriteOffTableData()
+    },
+    getWriteOffTableData() {
+      this.oneClickVerificationTableLoading = true
+      this.oneClickVerificationSelected = []
+      let formVal = {}
+      if(this.writeOffBonusType) {
+        formVal.bonusType = this.writeOffBonusType
+      }
+      this.postData(`/contractBonusSummary/getBonusSummaryByYear`, {
+        year: this.selectMonth.split('-')[0],
+        ...formVal
+      }).then((res) => {
+        this.oneClickVerificationList = res.data || []
+      }).finally(() => {
+        this.oneClickVerificationTableLoading =false
+      })
+    },
     loadMonthData() {
       this.getSelectProjectBonusAllocation()
       this.retrieveDataAgain()
@@ -233,8 +374,16 @@ export default {
       this.getTableList()
     },
     submitExport() {
+      let formVal = {}
+      if(this.exportBonusType) {
+        formVal.bonusType = this.exportBonusType
+      }
+      if(this.exportIsNegative) {
+        formVal.isNegative = this.exportIsNegative
+      }
       this.http.downloadFile('/contractBonusDetail/exportContractBonus', {
-        year: this.selectYear
+        year: this.selectYear,
+        ...formVal
       }, '奖金项目分摊.xlsx', err => {
         this.$message({
           message: err,
@@ -244,6 +393,8 @@ export default {
     },
     bonusDataExport() {
       this.selectYear = dayjs().format('YYYY')
+      this.exportBonusType = ''
+      this.exportIsNegative = ''
       this.dataExportVisable = true
     },
     batchDeletion() {
@@ -320,7 +471,14 @@ export default {
     },
     getTableList() {
       this.tableListLoading = true
-      this.postData(`/contractBonusSummary/getBonusSummary`, { ym: this.selectMonth }).then((res) => {
+      let formVal = {}
+      if(this.bonusType) {
+        formVal.bonusType = this.bonusType
+      }
+      if(this.isNegative) {
+        formVal.isNegative = this.isNegative
+      }
+      this.postData(`/contractBonusSummary/getBonusSummary`, { ym: this.selectMonth, ...formVal }).then((res) => {
         this.tableList = res.data || []
       }).finally(() => {
         this.tableListLoading = false
@@ -328,7 +486,17 @@ export default {
     },
     getEchartsData() {
       this.echartsLoading = true
-      this.postData(`/contractBonusDetail/getContractBonus`, { year: dayjs(this.selectMonth).format('YYYY') }).then(res => {
+      let formVal = {}
+      if(this.bonusType) {
+        formVal.bonusType = this.bonusType
+      }
+      if(this.isNegative) {
+        formVal.isNegative = this.isNegative
+      }
+      this.postData(`/contractBonusDetail/getContractBonus`, { 
+        year: dayjs(this.selectMonth).format('YYYY'),
+        ...formVal
+      }).then(res => {
         // this.echartsData = res.data || []
         this.instantiateChart(res.data || [])
       }).finally(() => {
@@ -472,4 +640,9 @@ export default {
 .h-full {
   height: 100%;
 }
+.writeOffAtTheBottom {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+}
 </style>