60
60
<div class =" drawer-footer" >
61
61
<Button @click =" openDrawer = false" type =" primary" >{{ $t('art_close') }}</Button >
62
62
</div >
63
- <Modal :mask-closable =" false" v-model =" isShowConfigKeyModal" :title =" $t('artifacts_property_value_fill_rule')" @on-ok =" setConfigRowValue" @on-cancel =" closeConfigSelectModal" >
64
- <div style =" display : flex " >
65
- <Input type =" text" :placeholder =" $t('artifacts_unselected')" v-model =" customSearch" > </Input >
66
- <Button type =" primary" @click =" remoteConfigSearch" :loading =" remoteLoading" >{{ $t('search') }}</Button >
63
+ <Modal :mask-closable =" false" v-model =" isShowConfigKeyModal" :fullscreen =" fullscreen" width =" 900" >
64
+ <p slot =" header" >
65
+ <span >{{ $t('art_copy_exist') }}</span >
66
+ <Icon v-if =" !fullscreen" @click =" zoomModalMax" class =" header-icon" type =" ios-expand" />
67
+ <Icon v-else @click =" zoomModalMin" class =" header-icon" type =" ios-contract" />
68
+ </p >
69
+ <div slot =" footer" >
70
+ <Button type =" text" @click =" closeConfigSelectModal()" >{{ $t('artifacts_cancel') }} </Button >
71
+ <Button type =" primary" @click =" setConfigRowValue()" >{{ $t('art_ok') }} </Button >
72
+ </div >
73
+ <div style =" display : flex ;gap : 8px ;margin-bottom : 8px ;" >
74
+ <Select style =" width : 200px ;" @on-change =" remoteConfigSearch()" :placeholder =" $t('artifacts_uploaded_by')" v-model =" tempCopyParams.variable_type" >
75
+ <Option v-for =" item in ['GLOBAL', 'PRIVATE', 'ENCRYPTED', 'FILE']" :value =" item" :key =" item" >{{ item }}</Option >
76
+ </Select >
77
+ <Input style =" width : 200px ;" v-model =" tempCopyParams.variable_name" @on-change =" remoteConfigSearch()" :placeholder =" $t('art_variable_name')" clearable />
78
+ <Select style =" width : 200px ;" clearable filterable @on-change =" remoteConfigSearch()" @on-clear =" tempCopyParams.create_user = ''" :placeholder =" $t('artifacts_uploaded_by')" v-model =" tempCopyParams.create_user" >
79
+ <Option v-for =" user in userList" :value =" user.username" :key =" user.id" >{{ user.username }}</Option >
80
+ </Select >
67
81
</div >
68
- <Select ref =" ddrop" :disabled =" !allDiffConfigs || allDiffConfigs.length === 0" filterable clearable v-model =" currentConfigId" style =" margin-top : 10px " >
69
- <Option v-for =" conf in allDiffConfigs.filter(conf => conf.variable_value && conf.code !== currentConfigRow.key)" :value =" conf.id" :key =" conf.key_name" >{{ conf.key_name }}</Option >
70
- </Select >
82
+ <RuleTable :data =" tempCopyTableData" ref =" tempCopyTableRef" :columns =" tempCopyColomns" :page =" page" @reloadTableData =" remoteConfigSearch" :maxHeight =" fileContentHeight" :loading =" remoteLoading" ></RuleTable >
71
83
</Modal >
72
84
<Modal :mask-closable =" false" v-model =" isShowBatchBindModal" :width =" 800" :title =" $t('multi_bind_config')" >
73
85
<Card >
103
115
</template >
104
116
105
117
<script >
106
- import { sysConfig , getSpecialConnector , getAllCITypesWithAttr , getPackageCiTypeId , getSystemDesignVersions , updateEntity , getPackageDetail , updatePackage , getVariableRootCiTypeId , getEntitiesByCiType } from ' @/api/server.js'
118
+ import { getUserList , sysConfig , getSpecialConnector , getAllCITypesWithAttr , getPackageCiTypeId , getSystemDesignVersions , updateEntity , getPackageDetail , updatePackage , getVariableRootCiTypeId , getEntitiesByCiType , getDiffVariable } from ' @/api/server.js'
107
119
import { setCookie , getCookie } from ' ../util/cookie.js'
108
120
import axios from ' axios'
109
121
import { decode } from ' js-base64'
122
+ import RuleTable from ' ./rule-table.vue'
123
+ import { debounce } from ' lodash'
110
124
// 业务运行实例ciTypeId
111
125
const defaultAppRootCiTypeId = ' app_instance'
112
126
const defaultDBRootCiTypeId = ' rdb_instance'
@@ -155,7 +169,6 @@ export default {
155
169
packageId: ' ' ,
156
170
157
171
customInputs: [],
158
- customSearch: ' ' ,
159
172
// -------------------
160
173
// 差异化变量数据
161
174
// -------------------
@@ -186,7 +199,6 @@ export default {
186
199
isShowConfigKeyModal: false ,
187
200
isShowCiConfigModal: false ,
188
201
currentConfigRow: {},
189
- allDiffConfigs: [],
190
202
allCIConfigs: [],
191
203
attrsTableColomnOptions: [
192
204
{
@@ -315,7 +327,60 @@ export default {
315
327
],
316
328
prefixType: ' variable_prefix_default' , // 前缀
317
329
tempTableData: [], // 通过类型、文件、前缀过滤后的展示数据
318
- currentFileIndex: - 1 // 缓存单签文件顺序
330
+ currentFileIndex: - 1 , // 缓存单签文件顺序
331
+ tempCopySelectRow: {
332
+ guid: ' '
333
+ },
334
+ // 选择已有模版-开始
335
+ tempCopyColomns: [
336
+ {
337
+ title: ' ' ,
338
+ align: ' center' ,
339
+ width: 30 ,
340
+ render : (h , params ) => {
341
+ return (
342
+ < Radio
343
+ value= {params .row .guid === this .tempCopySelectRow .guid }
344
+ onInput= {value => {
345
+ this .selectTemp (params .row )
346
+ }}
347
+ >< / Radio>
348
+ )
349
+ }
350
+ },
351
+ {
352
+ title: this .$t (' art_variable_name' ),
353
+ width: 200 ,
354
+ key: ' variable_name'
355
+ },
356
+ {
357
+ title: this .$t (' art_value_rule' ),
358
+ key: ' variable_value' ,
359
+ render : (h , params ) => {
360
+ return < ArtifactsAutoFill style= " margin-top:5px;" allCiTypes= {this .ciTypes } specialDelimiters= {this .specialDelimiters } rootCiTypeId= " " isReadOnly= {true } v- model= {params .row .variable_value } cmdbPackageName= {cmdbPackageName} / >
361
+ }
362
+ },
363
+ {
364
+ title: this .$t (' art_creator' ),
365
+ width: 120 ,
366
+ key: ' create_user'
367
+ }
368
+ ],
369
+ tempCopyTableData: [],
370
+ page: {
371
+ currentPage: 1 ,
372
+ pageSize: 10 ,
373
+ total: 0
374
+ },
375
+ tempCopyParams: {
376
+ variable_name: ' ' ,
377
+ create_user: ' ' ,
378
+ variable_type: ' GLOBAL'
379
+ },
380
+ userList: [],
381
+ // 选择已有模版-结束
382
+ fullscreen: false ,
383
+ fileContentHeight: window .screen .availHeight * 0.4 + 100
319
384
}
320
385
},
321
386
computed: {},
@@ -698,12 +763,6 @@ export default {
698
763
renderConfigButton (params ) {
699
764
let row = params .row
700
765
return [
701
- // <Tooltip placement="top" max-width="200" content={this.$t('variable_select_key_tooltip')}>
702
- // <Button disabled={!!row.conf_variable.fixedDate} size="small" type="primary" style="margin-right:5px;margin-bottom:5px;" onClick={async () => this.showConfigKeyModal(row)}>
703
- // {this.$t('select_key')}
704
- // </Button>
705
- // </Tooltip>,
706
- // disable no dirty data or row is confirmed
707
766
< Button disabled= {!! (row .conf_variable .diffExpr === row .conf_variable .originDiffExpr || row .conf_variable .fixedDate )} size= " small" type= " info" style= " margin-right:5px;margin-bottom:5px;" onClick= {() => this .saveConfigVariableValue (row)}>
708
767
{this .$t (' artifacts_save' )}
709
768
< / Button>
@@ -742,23 +801,81 @@ export default {
742
801
cancelBatchBindOperation () {
743
802
this .isShowBatchBindModal = false
744
803
},
804
+ selectTemp (val ) {
805
+ this .tempCopySelectRow = val
806
+ },
745
807
async showConfigKeyModal (row ) {
808
+ this .tempCopyParams = {
809
+ variable_name: ' ' ,
810
+ create_user: ' ' ,
811
+ variable_type: ' GLOBAL'
812
+ }
813
+ this .getUserList ()
814
+ await this .remoteConfigSearch ()
815
+ this .tempCopySelectRow = {
816
+ guid: ' '
817
+ }
818
+ this .fullscreen = false
746
819
this .isShowConfigKeyModal = true
747
820
this .currentConfigRow = row
748
- // }
749
- },
750
- async remoteConfigSearch () {
751
- const query = this .customSearch
752
- if (typeof query === ' string' && query .trim ().length > 0 ) {
753
- this .remoteLoading = true
754
- const diffConfigs = await getEntitiesByCiType (cmdbPackageName, DIFF_CONFIGURATION , { criteria: {}, additionalFilters: [{ attrName: ' code' , op: ' like' , condition: query .trim () }] })
755
- if (diffConfigs) {
756
- this .allDiffConfigs = diffConfigs .data
757
- this .$nextTick (() => {
758
- this .$refs [' ddrop' ].toggleMenu (null , true )
759
- })
760
- }
761
- this .remoteLoading = false
821
+ },
822
+ remoteConfigSearch: debounce (async function (
823
+ pageable = {
824
+ pageSize: 10 ,
825
+ currentPage: 1
826
+ }
827
+ ) {
828
+ this .remoteLoading = true
829
+ let params = {
830
+ dialect: {
831
+ queryMode: ' new'
832
+ },
833
+ filters: [],
834
+ pageable: {},
835
+ sorting: {
836
+ asc: false ,
837
+ field: ' update_time'
838
+ },
839
+ paging: true
840
+ }
841
+ params .pageable .pageSize = pageable .pageSize
842
+ params .pageable .startIndex = (pageable .currentPage - 1 ) * this .page .pageSize
843
+
844
+ if (this .tempCopyParams .variable_name !== ' ' ) {
845
+ params .filters .push ({
846
+ name: ' variable_name' ,
847
+ operator: ' contains' ,
848
+ value: this .tempCopyParams .variable_name
849
+ })
850
+ }
851
+ if (this .tempCopyParams .create_user ) {
852
+ params .filters .push ({
853
+ name: ' create_user' ,
854
+ operator: ' eq' ,
855
+ value: this .tempCopyParams .create_user
856
+ })
857
+ }
858
+ if (this .tempCopyParams .variable_type ) {
859
+ params .filters .push ({
860
+ name: ' variable_type' ,
861
+ operator: ' eq' ,
862
+ value: this .tempCopyParams .variable_type
863
+ })
864
+ }
865
+
866
+ const diffConfigs = await getDiffVariable (DIFF_CONFIGURATION , params)
867
+ if (diffConfigs) {
868
+ this .tempCopyTableData = diffConfigs .data .contents
869
+ this .page .total = diffConfigs .data .pageInfo .totalRows
870
+ this .page .currentPage = pageable .currentPage
871
+ this .$refs .tempCopyTableRef .setPage (this .page )
872
+ }
873
+ this .remoteLoading = false
874
+ }, 300 ),
875
+ async getUserList () {
876
+ let { status, data } = await getUserList ()
877
+ if (status === ' OK' ) {
878
+ this .userList = data || []
762
879
}
763
880
},
764
881
handleCIConfigChange (code ) {
@@ -805,18 +922,14 @@ export default {
805
922
}
806
923
},
807
924
setConfigRowValue () {
808
- if (this .currentConfigId ) {
809
- const tmp = this .currentDiffConfigTab === this .constPackageOptions .db ? ' db_diff_conf_file' : ' diff_conf_file'
810
- this .packageDetail [tmp].forEach (elFile => {
811
- elFile .configKeyInfos .forEach (elFileVar => {
812
- if (this .currentConfigRow .key .toLowerCase () === elFileVar .key .toLowerCase ()) {
813
- const tmp = this .allDiffConfigs .find (item => item .id === this .currentConfigId )
814
- elFileVar .conf_variable .diffExpr = tmp .variable_value
815
- }
816
- })
925
+ const tmp = this .currentDiffConfigTab === this .constPackageOptions .db ? ' db_diff_conf_file' : ' diff_conf_file'
926
+ this .packageDetail [tmp].forEach (elFile => {
927
+ elFile .configKeyInfos .forEach (elFileVar => {
928
+ if (this .currentConfigRow .key .toLowerCase () === elFileVar .key .toLowerCase ()) {
929
+ elFileVar .conf_variable .diffExpr = this .tempCopySelectRow .variable_value
930
+ }
817
931
})
818
- // this.$set(this.packageDetail.diff_conf_variable[this.currentConfigRow._index], 'diffExpr', this.currentConfigValue)
819
- }
932
+ })
820
933
this .closeConfigSelectModal ()
821
934
},
822
935
setCIConfigRowValue () {
@@ -841,8 +954,7 @@ export default {
841
954
this .currentConfigValue = ' '
842
955
this .isShowConfigKeyModal = false
843
956
this .currentConfigRow = {}
844
- this .customSearch = ' '
845
- this .allDiffConfigs = []
957
+ this .tempCopyTableData = []
846
958
},
847
959
closeCIConfigSelectModal () {
848
960
this .currentConfigValue = ' '
@@ -902,13 +1014,25 @@ export default {
902
1014
},
903
1015
handleResize () {
904
1016
this .maxHeight = window .innerHeight - 290
1017
+ },
1018
+
1019
+ // #endregion
1020
+ zoomModalMax () {
1021
+ this .fileContentHeight = window .screen .availHeight - 410
1022
+ this .fullscreen = true
1023
+ },
1024
+ zoomModalMin () {
1025
+ this .fileContentHeight = window .screen .availHeight * 0.4 + 100
1026
+ this .fullscreen = false
905
1027
}
906
1028
},
907
1029
created () {
908
1030
this .fetchData ()
909
1031
this .getSpecialConnector ()
910
1032
},
911
- components: {}
1033
+ components: {
1034
+ RuleTable
1035
+ }
912
1036
}
913
1037
</script >
914
1038
0 commit comments