@@ -1222,6 +1222,7 @@ https://github.com/Tencent/APIJSON/issues
12221222 history: {name: '请求0'},
12231223 remotes: [],
12241224 locals: [],
1225+ chainTags: [{name: 'Home', selected: true}, {name: 'Category', selected: false}, {name: 'Search', selected: true}, {name: 'Moment'}, {name: 'Chat'}, {name: 'Tommy'}, {name: 'Lemon'}],
12251226 chainPaths: [],
12261227 casePaths: [],
12271228 chainGroups: [],
@@ -4869,6 +4870,94 @@ https://github.com/Tencent/APIJSON/issues
48694870 isChainItemShow: function () {
48704871 return this.chainShowType != 2 || (this.chainGroups.length <= 0 && this.chainPaths.length > 0)
48714872 },
4873+ removeChainTag: function (ind, tag, index, item) {
4874+ var chain = (item || {}).Chain || {}
4875+ var tagList = chain.tagList || [];
4876+ tagList.splice(ind, 1)
4877+ this.setChainTag(index, chain, tagList)
4878+ },
4879+ addChainTag: function (index, group) {
4880+ this.isCaseGroupEditable = true
4881+ this.currentChainGroupIndex = index
4882+ var chain = (group || {}).Chain || {}
4883+ var tagList = chain.tagList || []
4884+ var chainTags = this.chainTags || []
4885+ for (var j = 0; j < chainTags.length; j ++) {
4886+ var tag = chainTags[i] || {}
4887+ tag.selected = false
4888+ }
4889+ 4890+ for (var i = 0; i < tagList.length; i ++) {
4891+ var name = tagList[i]
4892+ if (StringUtil.isEmpty(name)) {
4893+ continue
4894+ }
4895+ 4896+ var find = false
4897+ for (var j = 0; j < chainTags.length; j ++) {
4898+ var tag = chainTags[i] || {}
4899+ if (tag.name == name) {
4900+ tag.selected = true
4901+ find = true
4902+ }
4903+ }
4904+ 4905+ if (! find) {
4906+ chainTags.push({name: name, selected: true})
4907+ }
4908+ }
4909+ 4910+ this.chainTags = chainTags
4911+ },
4912+ setChainTag(index, item, tagList, isAdd) {
4913+ var chain = item || {} // (item || {}).Chain || {}
4914+ this.request(true, REQUEST_TYPE_POST, REQUEST_TYPE_JSON, this.server + '/put', {
4915+ Chain: {
4916+ 'id': chain.id,
4917+ 'groupId': chain.groupId,
4918+ 'groupId{}': [chain.groupId],
4919+ 'groupName': chain.groupName,
4920+ 'tagList': tagList
4921+ },
4922+ tag: 'Chain-group'
4923+ }, {}, function (url, res, err) {
4924+ App.onResponse(url, res, err)
4925+ var isOk = JSONResponse.isSuccess(res.data)
4926+ 4927+ var msg = isOk ? '' : ('\nmsg: ' + StringUtil.get((res.data || {}).msg))
4928+ if (err != null) {
4929+ msg += '\nerr: ' + err.msg
4930+ }
4931+ alert((isAdd ? '新增' : '移除') + (isOk ? '成功' : '失败') + (isAdd ? '! \n' :'!\ngroupId: ' + chain.groupId) + '\ngroupName: ' + chain.groupName + '\n' + msg)
4932+ 4933+ App.isCaseGroupEditable = ! isOk
4934+ if (isOk) {
4935+ App.selectChainGroup(App.currentChainGroupIndex, null)
4936+ }
4937+ })
4938+ },
4939+ selectChainTag: function (index, tag) {
4940+ tag.selected = ! tag.selected
4941+ var groupIndex = this.currentChainGroupIndex
4942+ if (this.isCaseGroupEditable != true || groupIndex < 0) {
4943+ this.selectChainGroup(groupIndex)
4944+ return
4945+ }
4946+ 4947+ var group = this.chainGroups[groupIndex] || {}
4948+ var chain = group.Chain || {}
4949+ var tagList = chain.tagList || []
4950+ if (tag.selected) {
4951+ tagList.push(tag.name)
4952+ } else {
4953+ var ind = tagList.indexOf(tag.name)
4954+ if (ind >= 0) {
4955+ tagList.splice(ind, 1)
4956+ }
4957+ }
4958+ 4959+ this.setChainTag(groupIndex, chain, tagList, true)
4960+ },
48724961 selectChainGroup: function (index, group) {
48734962 this.currentChainGroupIndex = index
48744963 this.currentDocIndex = -1
@@ -4885,7 +4974,7 @@ https://github.com/Tencent/APIJSON/issues
48854974 this.chainPaths = [group] // .push(group)
48864975 }
48874976
4888- this.casePaths = this.chainPaths
4977+ this.casePaths = this.chainPaths
48894978
48904979 var groupId = group == null ? 0 : group.groupId
48914980 if (groupId != null && groupId > 0) { // group != null && groupId == 0) {
@@ -4904,6 +4993,14 @@ https://github.com/Tencent/APIJSON/issues
49044993 var page = this.chainGroupPage = this.chainGroupPages[key] || 0
49054994 var count = this.chainGroupCount = this.chainGroupCounts[key] || 0
49064995 var search = this.chainGroupSearch = this.chainGroupSearches[key] || ''
4996+ var chainTags = this.chainTags || []
4997+ var tags = []
4998+ for (var i = 0; i < chainTags.length; i ++) {
4999+ var tag = chainTags[i] || {}
5000+ if (tag.selected) {
5001+ tags.push(tag.name)
5002+ }
5003+ }
49075004
49085005 search = StringUtil.isEmpty(search, true) ? null : '%' + StringUtil.trim(search).replaceAll('_', '\\_').replaceAll('%', '\\%') + '%'
49095006 var req = {
@@ -4915,8 +5012,9 @@ https://github.com/Tencent/APIJSON/issues
49155012 'userId': userId,
49165013 'toGroupId': groupId,
49175014 'groupName$': search,
4918- // '@raw': '@column',
4919- '@column': "groupId;any_value(groupName):groupName;count(*):count",
5015+ 'tagList&<>': tags == null || tags.length <= 0 ? null : tags,
5016+ '@raw': '@column',
5017+ '@column': "groupId;any_value(groupName):groupName;any_value(tagList):tagList;count(*):count",
49205018 '@group': 'groupId',
49215019 '@order': 'groupId-',
49225020// 'documentId>': 0
0 commit comments