Browse Source

部分接口联调

cxmo 9 months ago
parent
commit
25ebb17b60

+ 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)
 	}
 }
 

+ 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)
                 }
             },

+ 39 - 1
src/views/dataEntry_manage/thirdBase/components/addIndicsDia.vue

@@ -67,6 +67,7 @@
 
 <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 {
@@ -143,8 +144,45 @@ export default {
             this.filterNodes(res.Data.AllNodes||[]);
             this.options = res.Data.AllNodes || [];
         },
-        handleAddEdb(){
+        async handleAddEdb(){
             //校验表单
+            try{
+                await this.$refs.targetForm.validate()
+            }catch(e){
+                return 
+            }
+            const {code,edb_name,menu,frequency,unit} = this.formData
+            //添加检测
+            const resAddCheck = await steelInterface.batchAddEdbCheck({
+                IndexCodes:[code]
+            })
+            if(resAddCheck.Ret!==200) return 
+            //已存在提示并关闭该弹窗
+            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 
+            if(resCheck.Data[0]&&resCheck.Data[0].Exist){
+                return this.$message.warning(this.$t('BloombergPage.add_edb_check_hint2'))
+            }
+            //添加至指标库
+            const res = await steelInterface.AddToLib({
+                EdbCode:code,
+                EdbName:edb_name,
+                Unit:unit,
+                Frequency:frequency,
+                ClassifyId:Number(menu),
+            })
+            if(res.Ret!==200) return 
+            this.$message.success(this.$t('MsgPrompt.add_msg2'))
+            this.$emit('close')
         },
         initDia(){
             this.getClassifyOpt()

+ 41 - 36
src/views/dataEntry_manage/thirdBase/components/batchAddIndicsDia.vue

@@ -20,19 +20,23 @@
                         children:'Children',
                         label:'ClassifyName',
                         value:'BaseFromMysteelChemicalClassifyId',
-                        multiple:true
+                        multiple:true,
+                        emitPath:false,
                     }"
                     :placeholder="$t('Edb.InputHolderAll.input_classify')"
                     @change="getEdbList"
                 ></el-cascader>
-                <el-input style="width:240px;" 
+                <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 @selection-change="handleSelectionChange">
+                <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">
@@ -133,13 +137,18 @@ export default {
                     frequency:'日度',
                     unit:'吨',
                     classify:'',
+                    isHighlight:false
                 }, */
             ],
+            tableLoading:false,
             edbClassifyList:[],//指标库目录
             selectEdbList:[]
         };
     },
     methods: {
+        tableRowClassName({row}){
+            return row.isHighlight?'highlight-row':''
+        },
         initDia(){
             this.getClassifyList()
             this.getClassifyOpt()
@@ -177,34 +186,25 @@ export default {
             this.selectEdbList = []
             this.classifyType = 1
             //tableData
-            this.edbList = [{
-                    edbId:'123456',
-                    edbName:'指标名称指标名称',
-                    frequency:'日度',
-                    unit:'吨',
-                    classify:'',
-                },
-                {
-                    edbId:'654321',
-                    edbName:'22222',
-                    frequency:'日度',
-                    unit:'吨',
-                    classify:'',
-                },
-                {
-                    edbId:'77777',
-                    edbName:'11111',
-                    frequency:'日度',
-                    unit:'吨',
-                    classify:'',
-                },
-                {
-                    edbId:'888888',
-                    edbName:'指标名称指标名称',
-                    frequency:'日度',
-                    unit:'吨',
-                    classify:'',
-                },]
+            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
@@ -213,7 +213,7 @@ export default {
         handleAddEdb(){
             //校验所选指标
             if(!this.selectEdbList.length){
-                return this.$message.warning(this.$t('InputHolderAll.input_select_edb'))
+                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'))
@@ -225,14 +225,16 @@ export default {
             
             let messageList = [] //有问题的列表
             this.selectEdbList.forEach((item)=>{
-                let checkResult = checkEdbData(item)
-                if(checkEdbData(item)){
+                let checkResult = this.checkEdbData(item)
+                if(!this.checkEdbData(item)){
+                    item.isHighlight = true
                     messageList.push(item)
                 }
             })
             //message轻提示 同时标出不完整的行
             if(messageList.length){
-                
+                this.$message.warning('指标信息未填写完整,请检查')
+
                 return
             }
             
@@ -241,7 +243,7 @@ export default {
 
         },
         checkEdbData(edbData){
-            return !(!edbData.edbName||!edbData.frequency||!edbData.unit||this.classifyType===1?(!edbData.classify):false)
+            return edbData.edbName&&edbData.frequency&&edbData.unit&&(this.classifyType===1?edbData.classify:true)
         },
         batchAddEdb(){
             //获取添加结果
@@ -258,6 +260,9 @@ export default {
         .el-input{
             width:100%;
         }
+        .el-table .highlight-row{
+            background-color:#fef0f0 !important;
+        }
     }
 }
 </style>