Ver Fonte

Merge branch 'eta2.0.1'

cxmo há 8 meses atrás
pai
commit
9e4a853bf1

+ 56 - 0
src/api/modules/thirdBaseApi.js

@@ -400,6 +400,62 @@ const steelInterface = {
 	 */
 	edbRefresh: params => {
 		return http.get('/datamanage/mysteel_chemical/refresh',params)
+	},
+	/**
+	 * 批量搜索指标
+	 * @param {Object} params 
+	 * @param {String} params.BaseFromMysteelChemicalClassifyIds 目录列表 用,隔开
+	 * @param {String} params.Keyword
+	 * @returns 
+	 */
+	searchEdbBatch:params=>{
+		return http.get('/datamanage/mysteel_chemical/batch_search',params)
+	},
+	/**
+	 * 重名检测
+	 * @param {Array} params 
+	 * @param {String} params[].EdbCode
+	 * @param {String} params[].EdbName
+	 * @param {String} params[].Frequency
+	 * @returns 
+	 */
+	batchCheckEdbName:params=>{
+		return http.post('/datamanage/mysteel_chemical/name_check',params)
+	},
+	/**
+	 * 添加检测
+	 * @param {Object} params 
+	 * @param {Object[]} params.IndexCodes  指标IDs
+	 * @returns 
+	 */
+	batchAddEdbCheck:params=>{
+		return http.post('/datamanage/mysteel_chemical/edb_info/add_check',params)
+	},
+	/**
+	 * 批量添加到指标库
+	 * @param {Array} params
+	 * @param {String} params[].EdbCode
+	 * @param {String} params[].EdbName
+	 * @param {String} params[].Unit
+	 * @param {Number} params[].ClassifyId 指标库的id
+	 * @param {String} params[].Frequency
+	 * @returns 
+	 */
+	batchAddToLib:params=>{
+		return http.post('/datamanage/mysteel_chemical/batch_add',params)
+	},
+	/**
+	 * 单个添加到指标库
+	 * @param {Object} params 
+	 * @param {String} params.EdbCode
+	 * @param {String} params.EdbName
+	 * @param {String} params.Unit
+	 * @param {String} params.Frequency
+	 * @param {Number} params.ClassifyId
+	 * @returns 
+	 */
+	AddToLib:params=>{
+		return http.post('/datamanage/mysteel_chemical/edb_info/add',params)
 	}
 }
 

+ 10 - 1
src/components/lzTable.vue

@@ -22,6 +22,11 @@
 									: frequencyMap.get(data[item])
 								: data[item] 
 							}}
+							<span v-if="item==='Opt'&&$route.path==='/steelChemical'&&data['IndexCode'] ">
+								<el-button type="text" @click.stop="$emit('addToLib',data)"
+									v-if="!data.EdbInfoId&&permissionBtn.isShowBtn('dataSourcePermission','mysteelData_addEdb')"
+								>{{$t('ManualEdbListPage.add_tobase_btn')}}</el-button>
+							</span>
 						</template>
 					</template>
 					<!-- 百川盈孚数据源 频度和单位需要可编辑 -->
@@ -87,6 +92,9 @@ export default {
 				arr=['IndexName','IndexCode','FrequencyName','UnitName','UpdateTime']
 			}else if(this.source === 'glhg'){
 				arr=['IndexName','IndexCode','FrequencyName','UnitName','UpdateTime','IsStop']
+				if(this.$route.path==='/steelChemical'){
+					arr.push('Opt')
+				}
 			}else if(sourceTypeOne.includes(this.source)){
 				arr=['IndexName','IndexCode','Frequency','Unit','ModifyTime']
 			}
@@ -118,7 +126,8 @@ export default {
 					['FrequencyName', this.$t('Edb.Detail.e_fre')],
 					['UnitName', this.$t('Edb.Detail.e_unit')],
 					['UpdateTime', this.$t('Edb.Detail.e_update_time')],
-					['IsStop',this.$t('Edb.Detail.e_status')]
+					['IsStop',this.$t('Edb.Detail.e_status')],
+					['Opt',this.$t('Table.column_operations')],
 				])
 			}else if(sourceTypeOne.includes(this.source)){
 				temMap=new Map([

+ 0 - 1
src/components/selectUnit.vue

@@ -53,7 +53,6 @@ export default {
         value:{
             handler(){
                 if(this.value){
-                    console.log('value',this.value)
                     this.unit = this.getUnitTrans(this.value)
                 }
             },

+ 6 - 1
src/lang/modules/DataSources/En.js

@@ -91,6 +91,7 @@ export default {
   /* 钢联化工数据库 */
   SteelChemicalPage: {
     add_edb_btn: 'Add indicator',
+    batch_add_edb_btn:'Batch Add to Indicator Library',
     add_classify_btn: 'Add Category',
     refresh_one_btn:'One-click Update',
     del_edb_msg:'After deletion, this indicator cannot be referenced. Are you sure you want to delete it?',
@@ -112,8 +113,12 @@ export default {
     ph_edbid:'Indicator ID can not be empty',
     ph_classify:'Affiliated Category can not be empty',
     add_loading_msg:'The loading time is approximately five minutes; closing the popup will not affect the loading process',
-    add_max_msg: 'The number of additions has reached the upper limit (upper limit 100)!',
+    add_max_msg: 'The number of additions has reached the upper limit (upper limit 150)!',
     ph_classify_name: 'Please select a category name',
+    batch_add_max_msg:'The number of indicators added in batch does not exceed 30',
+    batch_add_hint1:'Some indicators are incomplete. Please check',
+    batch_add_hint2:'Some indicator names already exist. Please enter a new one',
+    batch_add_placeholder:'Place select Indicator category',
   },
 
   /* un数据页面 */

+ 8 - 1
src/lang/modules/DataSources/Zh.js

@@ -92,6 +92,7 @@ export default {
   /* 钢联化工数据库 */
   SteelChemicalPage: {
     add_edb_btn: '新增指标',
+    batch_add_edb_btn:'批量加入指标库',
     add_classify_btn: '添加分类',
     refresh_one_btn:'一键更新',
     del_edb_msg:'删除后该指标不能被引用,确认删除吗?',
@@ -111,8 +112,14 @@ export default {
     ph_edbid:'指标ID不能为空',
     ph_classify:'所属分类不能为空',
     add_loading_msg:'加载时间大概五分钟,关闭弹窗不影响加载',
-    add_max_msg: '添加数量已达上限(上限100)!',
+    add_max_msg: '添加数量已达上限(上限150)!',
     ph_classify_name: '请选择分类名称',
+    batch_add_max_msg:'批量添加指标数量不超过30个',
+    batch_classify_msg:'请选择指标',
+    batch_add_hint1:'部分指标信息未填写完整,请检查',
+    batch_add_hint2:'部分指标名称已存在,请重新填写',
+    batch_add_placeholder:'请选择指标库目录',
+
   },
 
   /* un数据页面 */

+ 2 - 0
src/utils/buttonConfig.js

@@ -238,6 +238,8 @@ export const dataSourcePermission = {
     mysteelData_classifyOpt_add:'mysteelData:classifyOpt:add',//添加目录和子项
     mysteelData_classifyOpt_edit:'mysteelData:classifyOpt:edit',//编辑
     mysteelData_classifyOpt_delete:'mysteelData:classifyOpt:delete',//删除
+    mysteelData_addEdb:'mysteelData:addEdb',//单个指标加入指标库
+    mysteelData_batchAddEdb:'mysteelData:batchAddEdb',//批量加入指标库
     /*--------SMM原始数据库---- */
     smmData_export:'smmData:export',
     smmData_classifyOpt_add:'smmData:classifyOpt:add',//添加目录和子项

+ 211 - 0
src/views/dataEntry_manage/thirdBase/components/addIndicsDia.vue

@@ -0,0 +1,211 @@
+<template>
+    <!-- 单个指标添加进指标库 -->
+    <el-dialog
+        :visible.sync="isOpenDialog"
+        :close-on-click-modal="false"
+        :modal-append-to-body="false"
+        top="5vh"
+        :title="$t('ManualEdbListPage.add_tobase_btn')"
+        @close="$emit('close')"
+        custom-class="add-indics-dia"
+        center
+        width="798px"
+        v-dialogDrag
+    >
+        <div class="dialog-container">
+            <el-form
+                ref="targetForm"
+                label-position="right"
+                label-width="120px"
+                hide-required-asterisk
+                :model="formData"
+                :rules="formRules"
+            >
+                <el-form-item :label="$t('Table.edb_name')" prop="edb_name">
+                    <el-input
+                    v-model="formData.edb_name"
+                    style="width: 80%"
+                    :placeholder="$t('Table.edb_name')"></el-input>
+                </el-form-item>
+                <el-form-item :label="$t('Edb.Detail.select_catalogue')" prop="menu">
+                    <el-cascader
+                    v-model="formData.menu"
+                    :options="options"
+                    :props="levelProps"
+                    style="width: 80%"
+                    clearable
+                    :placeholder="$t('CustomAnalysisPage.select_appropriate_category')"/>
+                </el-form-item>
+                <el-form-item :label="$t('Table.frequency')" prop="frequency">
+                    <el-select 
+                    v-model="formData.frequency" 
+                    :placeholder="$t('CustomAnalysisPage.select_frequency')" 
+                    style="width:80%"
+                    clearable>
+                        <el-option
+                            v-for="item in frequencyArr"
+                            :key="item.value"
+                            :label="item.label"
+                            :value="item.value">
+                        </el-option>
+                    </el-select>
+                </el-form-item>
+                <el-form-item :label="$t('Table.unit')">
+                    <selectUnit 
+                            v-model="formData.unit" 
+                            style="width: 80%"
+                        />
+                </el-form-item>
+            </el-form>
+        </div>
+        <div class="footer-container" slot="footer">
+            <el-button type="primary" @click="handleAddEdb" :loading="btnloading">{{ $t('Dialog.confirm_save_btn') }}</el-button>
+            <el-button type="primary" plain @click="$emit('close')">{{ $t('Dialog.cancel_btn') }}</el-button>
+        </div>
+    </el-dialog>
+</template>
+
+<script>
+import { dataBaseInterface } from '@/api/api.js';
+import { steelInterface } from "@/api/modules/thirdBaseApi";
+import selectUnit from '@/components/selectUnit.vue';
+import { frequencySelectList } from '@/utils/defaultOptions';
+export default {
+    components: { selectUnit },
+    props:{
+        isOpenDialog:{
+            type:Boolean,
+            default:false
+        },
+        edbData:{
+            type:Object,
+            defalut:{}
+        }
+    },
+    computed:{
+        formRules(){
+            return {
+                edb_name:[
+                    { required: true, message: /* '指标名称不能为空' */this.$t('Edb.Valids.name_msg'), trigger: 'blur' },
+                ],
+                menu:[
+                    { required: true, message: /* '所属目录不能为空' */this.$t('Edb.Valids.menu_msg'), trigger: 'blur' },
+                ],
+                frequency:[
+                    { required: true, message: /* '频率不能为空' */this.$t('Edb.Valids.fre_msg'), trigger: 'blur' },
+                ],
+                unit:[
+                    { required: true, message: /* '单位不能为空' */this.$t('Edb.Valids.unit_msg'), trigger: 'blur' },
+                ],
+            }
+        }
+    },
+    watch:{
+        isOpenDialog(newval){
+            if(newval){
+                this.initDia()
+            }
+        }
+    },
+    data() {
+        return {
+            formData:{
+                code:'',
+                edb_name:'',
+                menu:'',
+                frequency:'',
+                unit:'',
+            },
+            options:[],
+            levelProps: {
+                label: 'ClassifyName',
+                value: 'ClassifyId',
+                children: 'Children',
+                emitPath: false,
+                checkStrictly: true
+            },
+            frequencyArr:frequencySelectList(),
+            btnloading:false,
+        };
+    },
+    methods: {
+        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.options = res.Data.AllNodes || [];
+        },
+        async handleAddEdb(){
+            //校验表单
+            try{
+                await this.$refs.targetForm.validate()
+            }catch(e){
+                return 
+            }
+            const {code,edb_name,menu,frequency,unit} = this.formData
+            this.btnloading = true
+            //添加检测
+            const resAddCheck = await steelInterface.batchAddEdbCheck({
+                IndexCodes:[code]
+            })
+            if(resAddCheck.Ret!==200) return (this.btnloading=false)
+            //已存在提示并关闭该弹窗
+            if(resAddCheck.Data[0]&&resAddCheck.Data[0].EdbExist){
+                this.$emit('close')
+                return this.$message.warning(this.$t('YsDataPage.haved_all_msg'))
+            }
+            //重名校验
+            const resCheck = await steelInterface.batchCheckEdbName([{
+                EdbCode:code,
+                EdbName:edb_name,
+                Frequency:frequency,
+            }])
+            if(resCheck.Ret!==200) return (this.btnloading=false)
+            if(resCheck.Data[0]&&resCheck.Data[0].Exist){
+                return this.$message.warning(this.$t('BloombergPage.add_edb_check_hint2'))&&(this.btnloading=false)
+            }
+            //添加至指标库
+            const res = await steelInterface.AddToLib({
+                EdbCode:code,
+                EdbName:edb_name,
+                Unit:unit,
+                Frequency:frequency,
+                ClassifyId:Number(menu),
+            })
+            if(res.Ret!==200) return (this.btnloading=false)
+            this.$message.success(this.$t('MsgPrompt.add_msg2'))
+            this.$emit('addCallback')
+        },
+        initDia(){
+            this.btnloading=false
+            this.getClassifyOpt()
+            const {IndexName,UnitName,FrequencyName,IndexCode} = this.edbData
+            this.formData = {
+                code:IndexCode,
+                edb_name:IndexName,
+                menu:'',
+                frequency:FrequencyName,
+                unit:UnitName
+            }
+        }
+    },
+};
+</script>
+
+<style lang="scss">
+.add-indics-dia{
+    .el-cascader .el-input {
+        width: 100%;
+    }
+}
+</style>

+ 2 - 2
src/views/dataEntry_manage/thirdBase/components/batchAddEdbDia.vue

@@ -185,8 +185,8 @@ import { steelInterface } from "@/api/modules/thirdBaseApi";
       addEdbItem(){
         this.$refs.edbFormDataListRef.validate(valid=>{
           if(valid){
-            if(this.edbForm.edbDataList.length>=100){
-              this.$message.warning(/* '添加数量已达上限(上限100)!' */this.$t('SteelChemicalPage.add_max_msg'))
+            if(this.edbForm.edbDataList.length>=150){
+              this.$message.warning(/* '添加数量已达上限(上限150)!' */this.$t('SteelChemicalPage.add_max_msg'))
               return 
             }
             let lastItem = this.edbForm.edbDataList[this.edbForm.edbDataList.length-1]

+ 422 - 0
src/views/dataEntry_manage/thirdBase/components/batchAddIndicsDia.vue

@@ -0,0 +1,422 @@
+<template>
+    <!-- 批量添加至指标库 -->
+    <el-dialog
+        :visible.sync="isOpenDialog"
+        :close-on-click-modal="false"
+        :modal-append-to-body="false"
+        top="5vh"
+        :title="$t('SteelChemicalPage.batch_add_edb_btn')"
+        @close="$emit('close')"
+        custom-class="batch-add-edb-dia"
+        center
+        width="70%"
+        v-dialogDrag
+    >
+        <div class="dialog-container">
+            <div class="select-box">
+                <el-cascader v-model="searchClassify"
+                    :options="classifyList"
+                    :props="{
+                        children:'Children',
+                        label:'ClassifyName',
+                        value:'BaseFromMysteelChemicalClassifyId',
+                        multiple:true,
+                        emitPath:false,
+                    }"
+                    :placeholder="$t('Edb.InputHolderAll.input_classify')"
+                    @change="getEdbList"
+                ></el-cascader>
+                <el-input style="width:240px;" v-model="searchName"
+                    :placeholder="$t('Edb.InputHolderAll.input_name_orid')"
+                    prefix-icon="el-icon-search"
+                    @input="getEdbList"
+                />
+            </div>
+            <div class="select-table">
+                <el-table :data="edbList" border 
+                :row-class-name="tableRowClassName"
+                @selection-change="handleSelectionChange" 
+                v-loading="tableLoading">
+                    <el-table-column  type="selection" width="55" align="center"></el-table-column>
+                    <el-table-column :label="$t('Edb.Detail.e_id')" align="center" width="120" prop="edbId"></el-table-column>
+                    <el-table-column :label="$t('Table.edb_name')" align="center">
+                        <template slot-scope="{row}">
+                            <el-input v-model="row.edbName" :placeholder="$t('Table.edb_name')"></el-input>
+                        </template>
+                    </el-table-column>
+                    <el-table-column :label="$t('Edb.Detail.e_fre')" align="center" width="140">
+                        <template slot-scope="{row}">
+                            <el-select 
+                                v-model="row.frequency" 
+                                :placeholder="$t('CustomAnalysisPage.select_frequency')" 
+                                clearable>
+                                <el-option
+                                    v-for="item in frequencyArr"
+                                    :key="item.value"
+                                    :label="item.label"
+                                    :value="item.value">
+                                </el-option>
+                            </el-select>
+                        </template>
+                    </el-table-column>
+                    <el-table-column :label="$t('Edb.Detail.e_unit')" align="center" width="140">
+                        <template slot-scope="{row}">
+                            <selectUnit v-model="row.unit" />
+                        </template>
+                    </el-table-column>
+                    <!-- 操作 -->
+                    <el-table-column align="center">
+                        <template slot="header" slot-scope="{row}">
+                            <!-- <span>{{$t('EtaBasePage.catalogue_directory')}}</span> -->
+                            <el-radio-group v-model="classifyType" @change="handleClassifyTypeChange">
+                                <el-radio :label="1" style="margin-right:5px"><!-- 分目录 -->{{$t('EtaBasePage.subdirectory_radio')}}</el-radio>
+                                <el-radio :label="2"><!-- 同目录 -->{{$t('EtaBasePage.directory_radio')}}</el-radio>
+                            </el-radio-group>
+                            <el-cascader v-if="classifyType===2" v-model="selectClassify"
+                                :options="edbClassifyList"
+                                :props="{
+                                    label: 'ClassifyName',
+                                    value: 'ClassifyId',
+                                    children: 'Children',
+                                    checkStrictly: true,
+                                    emitPath:false
+                                }"
+                                :placeholder="$t('SteelChemicalPage.batch_add_placeholder')"
+                            >
+                            </el-cascader>
+                        </template>
+                        <template slot-scope="{row,$index}">
+                            <el-cascader 
+                                v-model="row.classify"
+                                :options="edbClassifyList"
+                                :props="{
+                                    label: 'ClassifyName',
+                                    value: 'ClassifyId',
+                                    children: 'Children',
+                                    checkStrictly: true,
+                                    emitPath:false
+                                }"
+                                :placeholder="$t('SteelChemicalPage.batch_add_placeholder')"
+                                style="width:100%;"
+                                :disabled="classifyType===2"
+                            ></el-cascader>
+                        </template>
+                    </el-table-column>
+                    <div class="no-data" slot="empty">
+                        <tableNoData :text="$t('Table.prompt_slogan')"/>
+                    </div>
+                </el-table>
+            </div>
+        </div>
+        <div class="footer-container" slot="footer">
+            <el-button type="primary" plain @click="$emit('close')">{{ $t('Dialog.cancel_btn') }}</el-button>
+            <el-button type="primary" @click="handleAddEdb" :loading="btnloading">{{ $t('ManualEdbListPage.add_tobase_btn') }}</el-button>
+        </div>
+        <!-- 操作提示弹窗 -->
+        <el-dialog 
+            :title="$t('BloombergPage.operation_prompt')"
+            :visible.sync="isHintDiaShow"
+            :close-on-click-modal="false"
+            :modal-append-to-body="false"
+            @close="handleCloseDia"
+            width="578px"
+            v-dialogDrag
+            center>
+            <div class="hint-dialog-wrap">
+                <p style="margin-bottom: 20px;">{{ hintText }}</p>
+                <ul>
+                    <li v-for="(item,index) in hintList" :key="index" class="hint-item" @click="gotoEdbDetail(item)">
+                        {{ index+1 }}、{{ item.IndexName }}({{ item.IndexCode }})
+                    </li>
+                </ul>
+            </div>
+            <div style="text-align: center;margin-bottom: 30px;">
+                    <el-button type="primary" @click="handleCloseDia">{{$t('Dialog.known')}}</el-button>
+                </div>
+        </el-dialog>
+    </el-dialog>
+</template>
+
+<script>
+import { steelInterface } from "@/api/modules/thirdBaseApi";
+import { dataBaseInterface } from '@/api/api.js';
+import selectUnit from '@/components/selectUnit.vue';
+import { frequencySelectList } from '@/utils/defaultOptions';
+export default {
+    components:{ selectUnit },
+    props:{
+        isOpenDialog:{
+            type:Boolean,
+            default:false
+        }
+    },
+    watch:{
+        isOpenDialog(newval){
+            if(newval){
+                this.initDia()
+            }
+        }
+    },
+    data() {
+        return {
+            classifyList:[],//钢联化工数据库的目录
+            searchName:'',
+            searchClassify:'',
+            classifyType:1,//1分目录 2同目录
+            selectClassify:'',
+            frequencyArr:frequencySelectList(),
+            edbList:[
+                /* {
+                    edbId:'123456',
+                    edbName:'指标名称指标名称',
+                    frequency:'日度',
+                    unit:'吨',
+                    classify:'',
+                    isHighlight:false
+                }, */
+            ],
+            tableLoading:false,
+            edbClassifyList:[],//指标库目录
+            selectEdbList:[],//勾选的指标
+
+            isHintDiaShow:false,
+            hintList:[],
+            hintText:'',
+            btnloading:false,
+        };
+    },
+    methods: {
+        tableRowClassName({row}){
+            return row.isHighlight?'highlight-row':''
+        },
+        initDia(){
+            this.getClassifyList()
+            this.getClassifyOpt()
+            this.searchClassify = ''
+            this.searchName = ''
+            this.edbList = []
+            this.selectEdbList = []
+            this.selectClassify=''
+            this.btnloading=false
+        },
+        //获取钢联化工数据库目录
+        getClassifyList(){
+            steelInterface.classifyList().then((res) => {
+                if(res.Ret!==200) return 
+                this.classifyList = res.Data||[]
+            })
+        },
+        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.edbClassifyList = res.Data.AllNodes || [];
+        },
+        //获取对应目录下的钢联化工指标
+        getEdbList(){
+            //每一次筛选项改变清空选择框
+            this.selectEdbList = []
+            this.classifyType = 1
+            //tableData
+            this.tableLoading = true
+            steelInterface.searchEdbBatch({
+                BaseFromMysteelChemicalClassifyIds:Array.isArray(this.searchClassify)?this.searchClassify.join(','):'',
+                Keyword:this.searchName||''
+            }).then(res=>{
+                this.tableLoading = false
+                if(res.Ret!==200) return 
+                this.edbList = res.Data?res.Data.map(item=>{
+                    return {
+                        edbId:item.IndexCode||'',
+                        edbName:item.IndexName||'',
+                        frequency:item.FrequencyName||'',
+                        unit:item.UnitName||'',
+                        classify:'',
+                        isHighlight:false
+                    }
+                }):[]
+            })
+           
+        },
+        handleSelectionChange(val){
+            this.selectEdbList = val
+        },
+        handleAddEdb(){
+            //校验所选指标
+            if(!this.selectEdbList.length){
+                return this.$message.warning(this.$t('Edb.InputHolderAll.input_select_edb'))
+            }
+            if(this.selectEdbList.length>30){
+                return this.$message.warning(this.$t('SteelChemicalPage.batch_add_max_msg'))
+            }
+            //校验所选指标信息是否完整
+            if(this.classifyType===2&&!this.selectClassify){
+                return this.$message.warning(this.$t('CustomAnalysisPage.select_appropriate_category'))
+            }
+            //重置tableData的高亮
+            this.edbList.forEach(i=>i.isHighlight=false)
+            let messageList = [] //有问题的列表
+            this.selectEdbList.forEach((item)=>{
+                item.isHighlight=false
+                if(!this.checkEdbData(item)){
+                    item.isHighlight = true
+                    messageList.push(item)
+                }
+            })
+            //message轻提示 同时标出不完整的行
+            if(messageList.length){
+                return this.$message.warning(/* '部分指标信息未填写完整,请检查' */this.$t('SteelChemicalPage.batch_add_hint1'))
+            }
+
+            this.btnloading = true
+            //添加检测
+            steelInterface.batchAddEdbCheck({
+                IndexCodes:this.selectEdbList.map(i=>i.edbId)
+            }).then(res=>{
+                if(res.Ret!==200) return (this.btnloading=false)
+                const edbList = res.Data||[]
+                const afterAddList = edbList.filter(i=>i.EdbExist===1) //已添加进指标库的指标
+                const beforeAddList = edbList.filter(i=>i.EdbExist===0) //需要添加进指标库的指标
+                //已选择的指标均添加进指标库 弹窗提示
+                if(!beforeAddList.length){
+                    return this.showHintDialog('all',afterAddList)
+                }
+                //剩余指标进行重名校验
+                this.batchNameCheck(afterAddList,beforeAddList)
+            })
+            
+        },
+        //重名检测
+        batchNameCheck(afterAddList,beforeAddList){
+            const indexCodeList = beforeAddList.map(i=>i.IndexCode)
+            let checkList = []
+            indexCodeList.forEach(i=>{
+                const item = this.selectEdbList.find(s=>s.edbId===i)
+                item&&checkList.push(item)
+            })
+            steelInterface.batchCheckEdbName(checkList.map(i=>{
+                return {
+                    EdbCode:i.edbId,
+                    EdbName:i.edbName,
+                    Frequency:i.frequency
+                }
+            })).then(res=>{
+                if(res.Ret!==200) return (this.btnloading=false)
+                const checkedList = res.Data.filter(i=>i.Exist)
+                if(checkedList.length){
+                    checkedList.forEach(i=>{
+                        const item = this.selectEdbList.find(s=>s.edbId===i.EdbCode)
+                        item&&(item.isHighlight = true)
+                    })
+                    return this.$message.warning(/* '部分指标名称已存在,请重新填写' */this.$t('SteelChemicalPage.batch_add_hint2'))&&(this.btnloading=false)
+                }else{
+                    //通过重名校验后添加进指标库
+                    this.batchAddEdb(afterAddList,checkList)
+                }
+            })
+            
+        },
+        checkEdbData(edbData){
+            return edbData.edbName&&edbData.frequency&&edbData.unit&&(this.classifyType===1?edbData.classify:true)
+        },
+        //显示操作提示弹窗
+        showHintDialog(type,list){
+            this.btnloading = false
+            this.isHintDiaShow = true
+            this.hintList = list
+            this.hintText = type==='all'
+            ?this.$t('YsDataPage.haved_all_msg') //本次添加的指标均已在指标库中,请勿重复添加!
+            :this.$t('YsDataPage.haved_some_msg') //指标库中已存在以下指标,会自动过滤!
+        },
+        //添加进指标库
+        batchAddEdb(afterAddList=[],checkList){
+            //checkList
+            steelInterface.batchAddToLib(checkList.map(i=>{
+                return {
+                    EdbCode:i.edbId,
+                    EdbName:i.edbName,
+                    Unit:i.unit,
+                    Frequency:i.frequency,
+                    ClassifyId:this.classifyType===1?Number(i.classify):Number(this.selectClassify),
+                }
+            })).then(res=>{
+                if(res.Ret!==200) return (this.btnloading=false)
+                //若afterAddList有值 弹窗提示部分指标已加入
+                if(afterAddList.length){
+                    this.showHintDialog('',afterAddList)
+                }else{
+                    this.$message.success(this.$t('MsgPrompt.add_msg2'))
+                    this.$emit('close')
+                }
+            })
+            
+            
+        },
+        //跳转至指标库
+        gotoEdbDetail(data){
+            const {EdbClassifyId,EdbInfoId,EdbUniqueCode} = data||{}
+            const href = this.$router.resolve({
+                path:'/database',
+                query:{
+                    code:EdbUniqueCode,
+                    id:EdbInfoId,
+                    classifyId:EdbClassifyId,
+                }
+            }).href
+            window.open(href,"_blank")
+        },
+        handleCloseDia(){
+            //两个弹窗都关掉
+            this.isHintDiaShow=false
+            this.$emit('close')
+        }
+    },
+};
+</script>
+
+<style lang="scss">
+.batch-add-edb-dia{
+    .dialog-container{
+        .el-input{
+            width:100%;
+        }
+        .el-table .highlight-row{
+            background-color:#fef0f0 !important;
+        }
+    }
+}
+</style>
+<style scoped lang="scss">
+.batch-add-edb-dia{
+    .dialog-container{
+        .select-box{
+            margin-bottom:20px;
+        }
+        .select-table{
+            max-height:600px;
+            overflow-y:auto;
+        }
+    }
+    .hint-dialog-wrap{
+            padding-bottom:30px;
+            .hint-item{
+                cursor: pointer;
+                margin-bottom: 10px;
+                &:hover{
+                    color:#409EFF;
+                    text-decoration: underline;
+                }
+            }
+        }
+}
+</style>

+ 44 - 9
src/views/dataEntry_manage/thirdBase/steelChemicalbase.vue

@@ -18,11 +18,15 @@
       <div class="left-top">
         <div>
           <el-button v-permission="permissionBtn.dataSourcePermission.mysteelData_add"
-          type="primary" size="medium" @click="addTargetBatch"
-            ><!-- 新增指标 -->{{$t('SteelChemicalPage.add_edb_btn')}}</el-button
+          type="primary" size="medium" @click="addTargetBatch" style="margin-bottom: 10px;"
+            ><!-- 新增指标(加入钢联化工数据库) -->{{$t('SteelChemicalPage.add_edb_btn')}}</el-button
           >
-          <el-button
-          v-permission="permissionBtn.dataSourcePermission.mysteelData_export"
+          <el-button style="margin-left: 0;margin-bottom: 10px;" v-permission="permissionBtn.dataSourcePermission.mysteelData_batchAddEdb"
+          type="primary" size="medium" @click="isBatchAddIndicsDiaShow = true"
+            ><!-- 批量加入指标库 -->{{$t('SteelChemicalPage.batch_add_edb_btn')}}</el-button
+          >
+          <el-button style="margin-left: 0;"
+            v-permission="permissionBtn.dataSourcePermission.mysteelData_export"
             type="primary"
             plain
             size="medium"
@@ -170,6 +174,7 @@
               tableType="header"
               ref="table"
               source="glhg"
+              @addToLib="handleAddToLib"
             />
           </div>
           <div class="data-cont" v-if="dateArr.length">
@@ -252,7 +257,20 @@
     <batch-add-edb-dia :isOpenDialog.sync="batchAddDiaShow" 
     :classifyList="classifyList" 
     @successCallback="addSuccessCallback"/>
+    <!-- 批量添加至指标库弹窗 -->
+    <batchAddIndicsDia 
+        :isOpenDialog="isBatchAddIndicsDiaShow"
+        @close="isBatchAddIndicsDiaShow=false"
+    />
+    <!-- 单个添加至指标库弹窗 -->
+    <addIndicsDia 
+        :isOpenDialog="isAddIndicsDiaShow"
+        :edbData="currentIndicData"
+        @close="isAddIndicsDiaShow=false;"
+        @addCallback="isAddIndicsDiaShow=false;getFrequency();"
+    />
   </div>
+
 </template>
 
 <script>
@@ -261,11 +279,13 @@ import { steelInterface } from "@/api/modules/thirdBaseApi";
 import mDialog from "@/components/mDialog.vue";
 import targetDialog from "./components/targetDialog.vue";
 import batchAddEdbDia from "./components/batchAddEdbDia.vue";
+import batchAddIndicsDia from "./components/batchAddIndicsDia"
+import addIndicsDia from "./components/addIndicsDia"
 import leftMixin from "./mixins/leftMixin.js";
 export default {
   name: "",
   mixins: [leftMixin],
-  components: { lzTable, mDialog, targetDialog,batchAddEdbDia },
+  components: { lzTable, mDialog, targetDialog,batchAddEdbDia,batchAddIndicsDia,addIndicsDia },
   data() {
     return {
       isLeftWrapShow:true,
@@ -309,7 +329,11 @@ export default {
       addTargetDialog: false, //添加指标弹窗
       edbForm: {},
       //批量添加指标弹窗
-      batchAddDiaShow:false
+      batchAddDiaShow:false,
+
+      isBatchAddIndicsDiaShow:false, //批量添加至指标库弹窗
+      isAddIndicsDiaShow:false,//单个添加至指标库弹窗
+      currentIndicData:{},//当前选中指标
     };
   },
   methods: {
@@ -704,6 +728,17 @@ export default {
         });
     },
 
+    handleAddToLib(data){
+        //添加前校验 ID是否已存在指标库中
+        //打开弹窗
+        this.currentIndicData = data
+        this.isAddIndicsDiaShow = true
+    },
+    addToLibCallback(){
+        //添加成功回调 
+        this.isAddIndicsDiaShow = false
+    },
+
     /* 添加后回调 */
     addSuccessCallback({ code, id,selectClassifyNodes,indexCode }) {
       indexCode && (this.index_code = indexCode)
@@ -760,8 +795,8 @@ export default {
     width: 5px !important;
   } */
   .left-cont {
-    min-width: 330px;
-    width: 330px;
+    min-width: 390px;
+    width: 390px;
     flex-shrink: 0;
     margin-right: 20px;
     padding: 30px 0;
@@ -772,7 +807,7 @@ export default {
     }
     .scroll-wrap {
       padding: 0 20px;
-      height: calc(100vh - 280px);
+      height: calc(100vh - 320px);
       overflow-y: auto;
       margin-right: 20px;
     }