|
@@ -8,13 +8,14 @@
|
|
|
center
|
|
|
top="5vh"
|
|
|
v-dialogDrag
|
|
|
- title="批量计算-选择指标和计算公式"
|
|
|
+ :title="showSave?'批量计算-结果保存':'批量计算-选择指标和计算公式'"
|
|
|
>
|
|
|
- <div class="batch-computed-wrap">
|
|
|
+ <div class="batch-computed-wrap" v-if="!showSave">
|
|
|
+ <el-form inline>
|
|
|
<div class="type-wrap">
|
|
|
- <div>
|
|
|
+ <div style="margin-right:50px">
|
|
|
<span>计算公式</span>
|
|
|
- <el-select v-model="computedType" placeholder="请选择">
|
|
|
+ <el-select v-model="computedType" @change="handleComputedTypeChange" placeholder="请选择">
|
|
|
<el-option
|
|
|
v-for="opt in computedBatchTypes"
|
|
|
:key="opt.type"
|
|
@@ -23,27 +24,207 @@
|
|
|
/>
|
|
|
</el-select>
|
|
|
</div>
|
|
|
- <div>
|
|
|
+ <div style="flex:1">
|
|
|
+ <!-- 累计值转月/季值 -->
|
|
|
+ <el-form-item v-if="computedType=='toMonthSeason'">
|
|
|
+ <el-radio-group v-model="subComputedType">
|
|
|
+ <el-radio :label="5">转月值</el-radio>
|
|
|
+ <el-radio :label="61">转季值</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <!-- N期移动均值、N期环比值、N期环差值 -->
|
|
|
+ <el-form-item required v-if="[8,12,13].includes(computedType)" label="N等于" style="width:280px">
|
|
|
+ <el-input v-model="formData.nNum" placeholder="请输入N数值" type="number" style="width:200px"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <!-- 超级季节性 -->
|
|
|
+ <template v-if="computedType==35">
|
|
|
+ <el-form-item required label="N等于" style="width:280px">
|
|
|
+ <el-input v-model="formData.nNum" placeholder="请输入N数值" type="number" style="width:200px"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="日历" style="width:180px">
|
|
|
+ <el-select v-model="formData.calendarType" style="width:120px">
|
|
|
+ <el-option label="公历" value="公历"></el-option>
|
|
|
+ <el-option label="农历" value="农历"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <!-- 降频 -->
|
|
|
+ <template v-if="computedType==51">
|
|
|
+ <el-form-item required label="频度" style="width:180px">
|
|
|
+ <el-select v-model="formData.frequency" style="width:120px">
|
|
|
+ <el-option v-for="opt in frequencyArr" :key="opt" :label="opt" :value="opt"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="数据取值" style="width:200px">
|
|
|
+ <el-select v-model="formData.valueType" style="width:120px">
|
|
|
+ <el-option key="期末值" label="期末值" value="期末值"/>
|
|
|
+ <el-option key="平均值" label="平均值" value="平均值"/>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <!-- 累计值 -->
|
|
|
+ <template v-if="computedType=='accumulate'">
|
|
|
+ <el-form-item>
|
|
|
+ <el-radio v-model="subComputedType" :label="62">累计值</el-radio>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item required label="频度" style="width:180px" v-if="subComputedType==62">
|
|
|
+ <el-select style="width:120px">
|
|
|
+ <el-option v-for="opt in frequencyArr" :key="opt" :label="opt" :value="opt"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="最新值处理" style="width:210px" v-if="subComputedType==62">
|
|
|
+ <el-select v-model="formData.newValue" style="width:120px">
|
|
|
+ <el-option label="默认" :value="0"/>
|
|
|
+ <el-option label="均值填充" :value="1"/>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-radio v-model="subComputedType" :label="63">年初至今累计值</el-radio>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <!-- 指数修匀 -->
|
|
|
+ <template v-if="computedType=='alpha'">
|
|
|
+ <el-form-item required label="alpha值" style="width:220px">
|
|
|
+ <el-input v-model.trim="formData.alphaValue" style="width:140px" placeholder="请输入alpha值"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <!-- 与常数计算 -->
|
|
|
+ <template v-if="computedType=='withNum'">
|
|
|
+ <el-form-item required label="公式">
|
|
|
+ <el-input v-model="formData.formula" placeholder="请输入公式" clearable style="width: 200px"/>
|
|
|
+ <span>公式示例:A+100,或A*2</span>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <!-- 与单指标计算 -->
|
|
|
+ <template v-if="computedType=='withEDB'">
|
|
|
+ <el-form-item required label="指标B">
|
|
|
+ <el-select
|
|
|
+ v-model="select_target"
|
|
|
+ v-loadMore="searchLoad"
|
|
|
+ :filterable="!select_target"
|
|
|
+ clearable
|
|
|
+ placeholder="请输入指标名称"
|
|
|
+ style="width: 250px"
|
|
|
+ remote
|
|
|
+ :remote-method="getTarget"
|
|
|
+ @click.native="inputFocusHandle"
|
|
|
+ @change="chooseTarget"
|
|
|
+ @blur="search_have_more = false"
|
|
|
+ >
|
|
|
+ <i slot="prefix" class="el-input__icon el-icon-search"></i>
|
|
|
+ <el-option
|
|
|
+ v-for="item in searchOptions"
|
|
|
+ :key="item.EdbInfoId"
|
|
|
+ :label="$parent.currentLang==='en'?(item.EdbNameEn||item.EdbName):item.EdbName"
|
|
|
+ :value="item.EdbInfoId"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item required label="公式">
|
|
|
+ <el-input v-model="formData.formula" placeholder="请输入公式" clearable style="width: 200px"/>
|
|
|
+ <span>公式示例:A+B,或A/B,A/(A+B)</span>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="生成指标时间序列">
|
|
|
+ <el-cascader
|
|
|
+ v-model="timeSeriesVal"
|
|
|
+ style="width:180px"
|
|
|
+ :options="timeSeriesOpt"
|
|
|
+ :props="{emitPath:false}"
|
|
|
+ :show-all-levels="false"
|
|
|
+ placeholder="请选择"
|
|
|
+ ></el-cascader>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="空值处理">
|
|
|
+ <el-select
|
|
|
+ v-model="formData.nullValueWay"
|
|
|
+ placeholder="请选择"
|
|
|
+ style="width:180px"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in nullWayOptions"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="MAX、MIN空值处理" v-if="showMaxNullDeal">
|
|
|
+ <el-select
|
|
|
+ v-model="formData.maxNullWay"
|
|
|
+ placeholder="请选择"
|
|
|
+ >
|
|
|
+ <el-option label="等于0" :value="1" />
|
|
|
+ <el-option label="跳过空值" :value="2" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <!-- 与单指标计算 -->
|
|
|
+ <template v-if="computedType=='multipleEDB'">
|
|
|
+ <el-form-item style="margin-right:30px">
|
|
|
+ <el-radio-group v-model="subComputedType">
|
|
|
+ <el-radio :label="80">求和</el-radio>
|
|
|
+ <el-radio :label="81">求平均</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="生成指标时间序列">
|
|
|
+ <el-cascader
|
|
|
+ v-model="timeSeriesVal"
|
|
|
+ style="width:180px"
|
|
|
+ :options="timeSeriesOpt"
|
|
|
+ :props="{emitPath:false}"
|
|
|
+ :show-all-levels="false"
|
|
|
+ placeholder="请选择"
|
|
|
+ ></el-cascader>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="空值处理">
|
|
|
+ <el-select
|
|
|
+ v-model="formData.nullValueWay"
|
|
|
+ placeholder="请选择"
|
|
|
+ style="width:180px"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in nullWayOptions"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+
|
|
|
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="table-wrap">
|
|
|
- <div class="left-box">
|
|
|
- <p style="margin-bottom:20px">待选指标(选择指标数量不超过50)</p>
|
|
|
- <div>
|
|
|
+ </el-form>
|
|
|
+ <div class="filter-wrap" style="margin-top:20px">
|
|
|
+ <p style="margin-bottom:10px">待选指标(选择指标数量不超过50)</p>
|
|
|
+ <div>
|
|
|
<el-cascader
|
|
|
v-model="filter.classify"
|
|
|
:options="classifyOpt"
|
|
|
:props="classifyProps"
|
|
|
clearable
|
|
|
+ collapse-tags
|
|
|
placeholder="指标分类"
|
|
|
- style="width: 200px"
|
|
|
+ style="width: 240px"
|
|
|
/>
|
|
|
<el-select
|
|
|
v-model="filter.frequency"
|
|
|
placeholder="请选择频率"
|
|
|
- style="width: 200px"
|
|
|
+ style="width: 140px"
|
|
|
clearable
|
|
|
+ multiple
|
|
|
+ collapse-tags
|
|
|
>
|
|
|
<el-option
|
|
|
v-for="item in frequencyArr"
|
|
@@ -54,13 +235,16 @@
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
<el-cascader
|
|
|
- v-model="filter.classify"
|
|
|
- :options="classifyOpt"
|
|
|
- :props="classifyProps"
|
|
|
- clearable
|
|
|
- placeholder="创建人"
|
|
|
- style="width: 200px"
|
|
|
- />
|
|
|
+ v-model="filter.user"
|
|
|
+ placeholder="创建人"
|
|
|
+ :options="sysUserOpts"
|
|
|
+ :props="sysUserProps"
|
|
|
+ collapse-tags
|
|
|
+ :show-all-levels="false"
|
|
|
+ clearable
|
|
|
+ filterable
|
|
|
+ style="width:240px"
|
|
|
+ />
|
|
|
<el-input
|
|
|
placeholder="指标ID/指标名称"
|
|
|
v-model="filter.keyword"
|
|
@@ -76,7 +260,10 @@
|
|
|
style="margin-left:10px"
|
|
|
@change="listCheckAllChange"
|
|
|
/>
|
|
|
- </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="table-wrap">
|
|
|
+ <div class="left-box">
|
|
|
<el-table
|
|
|
:data="list"
|
|
|
border
|
|
@@ -88,23 +275,25 @@
|
|
|
height="500px"
|
|
|
>
|
|
|
<el-table-column type="selection" min-width="50" align="center" />
|
|
|
- <el-table-column label="指标全称" align="center" prop="EdbName"/>
|
|
|
+ <el-table-column label="指标全称" show-overflow-tooltip align="center" prop="EdbName"/>
|
|
|
<el-table-column label="最新日期" align="center" prop="LatestDate" sortable="custom" width="120px" />
|
|
|
<el-table-column label="最新值" align="center" prop="LatestValue" width="80px"/>
|
|
|
<el-table-column label="创建人" align="center" prop="SysUserRealName" width="80px"/>
|
|
|
<el-table-column label="频度" align="center" prop="Frequency" width="50px"/>
|
|
|
- <el-table-column label="单位" align="center" prop="Unit" width="50px"/>
|
|
|
+ <el-table-column label="单位" show-overflow-tooltip align="center" prop="Unit" width="50px"/>
|
|
|
</el-table>
|
|
|
<m-page
|
|
|
+ style="margin-top:10px"
|
|
|
class="table-page"
|
|
|
v-show="total"
|
|
|
:total="total"
|
|
|
:pageSize="pageSize"
|
|
|
:page_no="page"
|
|
|
+ :pagercount="5"
|
|
|
@handleCurrentChange="pageNumberChange"
|
|
|
/>
|
|
|
</div>
|
|
|
- <div>
|
|
|
+ <div style="padding-top:200px;margin:0 30px">
|
|
|
<el-button type="primary">加入已选指标</el-button>
|
|
|
</div>
|
|
|
<div class="right-box">
|
|
@@ -113,29 +302,72 @@
|
|
|
border
|
|
|
height="500px"
|
|
|
>
|
|
|
- <el-table-column label="指标全称" align="center" prop="EdbName"/>
|
|
|
+ <el-table-column label="指标全称" show-overflow-tooltip align="center" prop="EdbName"/>
|
|
|
+ <el-table-column width="50px" align="center">
|
|
|
+ <template slot="header" slot-scope="scope">
|
|
|
+ <img style="width:15px;height:15px;cursor: pointer;" src="~@/assets/img/ai_m/delete.png" alt="">
|
|
|
+ </template>
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <img style="width:15px;height:15px;cursor: pointer;" src="~@/assets/img/ai_m/delete.png" alt="">
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
</el-table>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <div style="text-align:center;margin:60px 0 40px 0">
|
|
|
+ <el-button type="primary" plain @click="handleClose">取消</el-button>
|
|
|
+ <el-button type="primary" @click="showSave=true">下一步</el-button>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
+ <!-- 结果保存 -->
|
|
|
+ <batchComputedSave @close="handleClose" v-else/>
|
|
|
</el-dialog>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import mPage from '@/components/mPage.vue'
|
|
|
import {computedBatchTypesV2} from './util'
|
|
|
-import { dataBaseInterface } from '@/api/api.js';
|
|
|
+import { dataBaseInterface,departInterence } from '@/api/api.js';
|
|
|
+import batchComputedSave from './batchComputedSave.vue';
|
|
|
export default {
|
|
|
- components:{mPage},
|
|
|
+ components:{mPage,batchComputedSave},
|
|
|
props:{
|
|
|
isShow:{
|
|
|
type: Boolean
|
|
|
},
|
|
|
},
|
|
|
+ computed:{
|
|
|
+ /* max空值处理显示 当输入的公式包含MAX、MIN且空值处理为0时,输入公式失焦后出现右侧选项; */
|
|
|
+ showMaxNullDeal() {
|
|
|
+ let haveMaxOrMin = this.formData.formula.toUpperCase().includes('MAX') || this.formData.formula.toUpperCase().includes('MIN')
|
|
|
+
|
|
|
+ return haveMaxOrMin && this.formData.nullValueWay===4
|
|
|
+ },
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
+ showSave:false,//显示结果保存模块
|
|
|
computedBatchTypes:computedBatchTypesV2,//计算类型筛选项
|
|
|
computedType:computedBatchTypesV2[0].type,//当前选中的计算类型
|
|
|
+ subComputedType:'',//二级计算类型
|
|
|
+ formData:{
|
|
|
+ nNum:1,
|
|
|
+ calendarType:'公历',
|
|
|
+ frequency:'',
|
|
|
+ valueType:'期末值',
|
|
|
+ newValue:0,
|
|
|
+ alphaValue:'',
|
|
|
+ formula:'',
|
|
|
+ timeSeriesVal:'A',
|
|
|
+ nullValueWay:0,
|
|
|
+ maxNullWay:1,
|
|
|
+ },
|
|
|
+
|
|
|
+ select_target:'',
|
|
|
+ searchOptions:[],//指标列表
|
|
|
+ search_have_more:false,
|
|
|
+ search_page: 1,
|
|
|
+ current_search: '',
|
|
|
|
|
|
filter:{
|
|
|
classify:'',
|
|
@@ -150,18 +382,57 @@ export default {
|
|
|
label: 'ClassifyName',
|
|
|
value: 'ClassifyId',
|
|
|
children: 'Children',
|
|
|
- checkStrictly: true
|
|
|
+ multiple: true
|
|
|
},
|
|
|
+ sysUserOpts:[],
|
|
|
+ sysUserProps:{
|
|
|
+ value: "AdminId",
|
|
|
+ label: "RealName",
|
|
|
+ children: "ChildrenList",
|
|
|
+ multiple: true,
|
|
|
+ emitPath:false
|
|
|
+ },
|
|
|
+
|
|
|
+ timeSeriesOpt:[
|
|
|
+ {
|
|
|
+ label:'指定指标时间序列',
|
|
|
+ value:'0',
|
|
|
+ children:[
|
|
|
+ {
|
|
|
+ label:`指标A`,
|
|
|
+ value:'A'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label:`指标B`,
|
|
|
+ value:'B'
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label:'所有指标时间序列并集',
|
|
|
+ value:'all',
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ nullWayOptions: [
|
|
|
+ { label: '查找前后35天最近值',value: 0 },
|
|
|
+ { label: '不计算',value: 1 },
|
|
|
+ { label: '前值填充',value: 2 },
|
|
|
+ { label: '后值填充',value: 3 },
|
|
|
+ { label: '等于0',value: 4 },
|
|
|
+ ],
|
|
|
|
|
|
isCheckAll:false,//是否全选
|
|
|
isCheckIndeterminate:false,// 标志列表当前是全选状态还是不是全选状态和 isCheckAll不一样
|
|
|
+ checkAllStatus:false,
|
|
|
+ selectionReactCancel:false,// 是否不触发 selection的逻辑
|
|
|
|
|
|
page:1,
|
|
|
pageSize:20,
|
|
|
total:0,
|
|
|
list:[],
|
|
|
|
|
|
- selectList:[],//当前勾选的数据
|
|
|
+ tableDataCheckedList:[],
|
|
|
+ tableDataIds:[],
|
|
|
|
|
|
isAddList:[],//添加到右侧的数据
|
|
|
|
|
@@ -169,44 +440,144 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
+ this.getClassifyOpt()
|
|
|
this.getEDBList()
|
|
|
+ this.getSysUserList()
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
+ // 切换计算类型
|
|
|
+ handleComputedTypeChange(){
|
|
|
+ this.subComputedType=''
|
|
|
+ this.formData={
|
|
|
+ nNum:1,
|
|
|
+ calendarType:'公历',
|
|
|
+ frequency:'',
|
|
|
+ valueType:'期末值',
|
|
|
+ newValue:0,
|
|
|
+ alphaValue:'',
|
|
|
+ formula:'',
|
|
|
+ timeSeriesVal:'A',
|
|
|
+ nullValueWay:0,
|
|
|
+ maxNullWay:1,
|
|
|
+ }
|
|
|
+ if(this.computedType=='toMonthSeason'){
|
|
|
+ this.subComputedType=5
|
|
|
+ }else if(this.computedType=='accumulate'){
|
|
|
+ this.subComputedType=62
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ /* 指标列表 */
|
|
|
+ getTarget(query) {
|
|
|
+ this.search_page = 1;
|
|
|
+ this.current_search = query;
|
|
|
+ this.searchApi(this.current_search);
|
|
|
+ },
|
|
|
+
|
|
|
+ /* 聚焦获取当前检索 */
|
|
|
+ inputFocusHandle(e) {
|
|
|
+ this.search_page = 1;
|
|
|
+ this.current_search = e.target.value;
|
|
|
+ this.searchApi(this.current_search);
|
|
|
+ },
|
|
|
+
|
|
|
+ searchApi(query,page=1) {
|
|
|
+ dataBaseInterface.targetSearchByPage({
|
|
|
+ KeyWord:query,
|
|
|
+ CurrentIndex: page,
|
|
|
+ FilterSource: 1,
|
|
|
+ Frequency: ''
|
|
|
+ }).then(res => {
|
|
|
+ if(res.Ret !== 200) return
|
|
|
+ const { List,Paging } = res.Data;
|
|
|
+ this.search_have_more = page < Paging.Pages;
|
|
|
+ let arr = page === 1 ? List : this.searchOptions.concat(List);
|
|
|
+
|
|
|
+ this.searchOptions = arr;
|
|
|
+
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ searchLoad() {
|
|
|
+ if(!this.search_have_more) return;
|
|
|
+ this.searchApi(this.current_search,++this.search_page)
|
|
|
+ },
|
|
|
+
|
|
|
handleClose(){
|
|
|
+ this.showSave=false
|
|
|
this.$emit('close')
|
|
|
},
|
|
|
|
|
|
+ filterNodes(arr) {
|
|
|
+ arr.length &&
|
|
|
+ arr.forEach((item) => {
|
|
|
+ item.Children.length && this.filterNodes(item.Children);
|
|
|
+ if (!item.Children.length) {
|
|
|
+ delete item.Children;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 获取指标分类
|
|
|
+ async getClassifyOpt(){
|
|
|
+ const res=await dataBaseInterface.menuListV3()
|
|
|
+ if (res.Ret !== 200) return
|
|
|
+ this.filterNodes(res.Data.AllNodes||[]);
|
|
|
+ this.classifyOpt = res.Data.AllNodes || [];
|
|
|
+ },
|
|
|
+
|
|
|
+ // 获取所有系统用户
|
|
|
+ async getSysUserList() {
|
|
|
+ const res = await departInterence.getQuestionAdminList();
|
|
|
+ if (res.Ret === 200) {
|
|
|
+ this.sysUserOpts = res.Data.List||[];
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
// 获取指标列表
|
|
|
- async getEDBList(){
|
|
|
+ async getEDBList(type){
|
|
|
const res=await dataBaseInterface.targetSearchByPage({
|
|
|
CurrentIndex:this.page,
|
|
|
PageSize: this.pageSize,
|
|
|
})
|
|
|
if(res.Ret===200){
|
|
|
this.list=res.Data.List||[]
|
|
|
- this.total=res.Data.Paging.Totals
|
|
|
+ this.total=res.Data.Paging.Totals||0
|
|
|
|
|
|
- // 判断是否要选中列表数据
|
|
|
- if(this.isCheckAll){
|
|
|
+ if(this.list.length>0){
|
|
|
+ this.tableDataIds = this.list.map(it => it.EdbInfoId)
|
|
|
+ }else{
|
|
|
+ this.tableDataIds = []
|
|
|
+ }
|
|
|
|
|
|
+ if(type == 'adjustSelection'){
|
|
|
+ this.adjustSelection()
|
|
|
+ }else{
|
|
|
+
|
|
|
+ this.isCheckAll=false
|
|
|
+ this.checkAllStatus=false
|
|
|
+ this.isCheckIndeterminate=false
|
|
|
+
|
|
|
+ this.listCheckAllChange(this.isCheckAll)
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
|
|
|
pageNumberChange(e){
|
|
|
this.page=e
|
|
|
- this.getEDBList()
|
|
|
+ this.getEDBList('adjustSelection')
|
|
|
},
|
|
|
|
|
|
handleFilter(){
|
|
|
this.page=1
|
|
|
this.list=[]
|
|
|
- this.getEDBList()
|
|
|
+ this.getEDBList('adjustSelection')
|
|
|
},
|
|
|
|
|
|
// 切换列表全选按钮状态
|
|
|
listCheckAllChange(check){
|
|
|
+ this.tableDataCheckedList=[]
|
|
|
+ this.checkAllStatus=check
|
|
|
if(check){
|
|
|
// 全选
|
|
|
this.$refs.edbDataRef && this.$refs.edbDataRef.clearSelection()
|
|
@@ -217,25 +588,109 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
|
|
|
+ selectionChange(val){
|
|
|
+ if(this.selectionReactCancel) return
|
|
|
+
|
|
|
+ // selectAllHandle的触发在selectionChange后面,将selectionChange的逻辑延迟一下
|
|
|
+ setTimeout(()=>{
|
|
|
+ // 去重
|
|
|
+ let duplicateArr = Array.from(new Set(this.tableDataCheckedList))
|
|
|
+
|
|
|
+ if((duplicateArr.length == this.total && (!this.checkAllStatus))
|
|
|
+ || (duplicateArr.length == 0 && this.checkAllStatus)){
|
|
|
+ this.isCheckAll = true
|
|
|
+ this.isCheckIndeterminate=false
|
|
|
+ }else if((duplicateArr.length == 0 && (!this.checkAllStatus))
|
|
|
+ || (duplicateArr.length == this.total && this.checkAllStatus)){
|
|
|
+ this.isCheckAll = false
|
|
|
+ this.isCheckIndeterminate=false
|
|
|
+ }else{
|
|
|
+ this.isCheckAll = false
|
|
|
+ this.isCheckIndeterminate=true
|
|
|
+ }
|
|
|
+ },1)
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
//用户手动勾选数据行的 Checkbox 时触发的事件
|
|
|
selectHandle(selection, row){
|
|
|
- console.log(selection, row);
|
|
|
+ if(this.selectionReactCancel) return
|
|
|
|
|
|
let check=false
|
|
|
- if(selection.some(it => it.IndexCode == row.IndexCode)){
|
|
|
+ if(selection.some(it => it.EdbInfoId == row.EdbInfoId)){
|
|
|
// 勾选
|
|
|
-
|
|
|
+ // 勾选
|
|
|
+ if(this.checkAllStatus){
|
|
|
+ check=false
|
|
|
+ }else{
|
|
|
+ check=true
|
|
|
+ }
|
|
|
}else{
|
|
|
// 取消勾选
|
|
|
- if(this.isCheckAll){
|
|
|
- this.isCheckIndeterminate=true
|
|
|
+ if(this.checkAllStatus){
|
|
|
+ check=true
|
|
|
+ }else{
|
|
|
+ check=false
|
|
|
}
|
|
|
}
|
|
|
+ if(check){
|
|
|
+ this.tableDataCheckedList.push(row.EdbInfoId)
|
|
|
+ }else{
|
|
|
+ this.tableDataCheckedList=this.tableDataCheckedList.filter(it => it!=row.EdbInfoId)
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
// 用户手动勾选全选 Checkbox 时触发的事件
|
|
|
selectAllHandle(selection){
|
|
|
- console.log(selection);
|
|
|
+ if(this.selectionReactCancel) return
|
|
|
+ let check = false; // 从tableDataCheckedList 添加还是删除
|
|
|
+ if(selection && selection.length>0){
|
|
|
+ // 全选
|
|
|
+ if(this.checkAllStatus){
|
|
|
+ check=false
|
|
|
+ }else{
|
|
|
+ check=true
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ // 全不选
|
|
|
+ if(this.checkAllStatus){
|
|
|
+ check=true
|
|
|
+ }else{
|
|
|
+ check=false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(check){
|
|
|
+ this.tableDataCheckedList = [...this.tableDataCheckedList,...this.tableDataIds]
|
|
|
+ }else{
|
|
|
+ this.tableDataCheckedList = this.tableDataCheckedList.filter(it => !this.tableDataIds.includes(it))
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ adjustSelection(){
|
|
|
+ this.selectionReactCancel=true
|
|
|
+ if(!this.checkAllStatus){
|
|
|
+ this.tableDataCheckedList.map(it =>{
|
|
|
+ let row = this.list.find(da => da.EdbInfoId==it)
|
|
|
+ if(row){
|
|
|
+ setTimeout(()=>{
|
|
|
+ this.$refs.edbDataRef.toggleRowSelection(row,true)
|
|
|
+ },10)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ this.$refs.edbDataRef.toggleAllSelection()
|
|
|
+ this.tableDataCheckedList.map(it =>{
|
|
|
+ let row = this.list.find(da => da.EdbInfoId==it)
|
|
|
+ if(row){
|
|
|
+ setTimeout(()=>{
|
|
|
+ this.$refs.edbDataRef.toggleRowSelection(row,false)
|
|
|
+ },50)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ setTimeout(()=>{
|
|
|
+ this.selectionReactCancel=false
|
|
|
+ },50)
|
|
|
},
|
|
|
|
|
|
|
|
@@ -251,14 +706,18 @@ export default {
|
|
|
overflow: hidden;
|
|
|
}
|
|
|
.batch-computed-wrap{
|
|
|
+ .type-wrap{
|
|
|
+ display: flex;
|
|
|
+ }
|
|
|
.table-wrap{
|
|
|
- margin-top: 50px;
|
|
|
+ margin-top: 20px;
|
|
|
display: flex;
|
|
|
justify-content: space-between;
|
|
|
.left-box{
|
|
|
width: 50%;
|
|
|
}
|
|
|
.right-box{
|
|
|
+ flex: 1;
|
|
|
flex-shrink: 0;
|
|
|
}
|
|
|
}
|