| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- window.renderCell = function(result, {col, row})
- {
- if(col.name == 'system' && row.data.releases)
- {
- result[0] = {className: 'overflow-hidden', html: result[0]};
- result[result.length] = {html:'<span class="label gray-pale rounded-xl clip">' + integratedLabel + '</span>', className:'flex items-end', style:{flexDirection:"column"}};
- }
- if(col.name == 'name')
- {
- if(row.data.marker == 1)
- {
- result[result.length] = {html: "<icon class='icon icon-flag text-danger' title='" + markerTitle + "'></icon>"};
- return result;
- }
- }
- if(col.name == 'build')
- {
- if(!row.data.buildInfos) row.data.buildInfos = row.data.builds;
- let result = [];
- for(key in row.data.buildInfos)
- {
- let buildName = canViewProjectbuild ? "<a href='" + $.createLink('projectbuild', 'view', 'buildID=' + row.data.buildInfos[key].id) + "' title='" + row.data.buildInfos[key].name + "'>" + row.data.buildInfos[key].name + '</a>' : row.data.buildInfos[key].name;
- result.push({html: buildName})
- }
- return result;
- }
- return result;
- }
- window.checkedChange = function(changes)
- {
- if(!this._checkedRows) this._checkedRows = {};
- Object.keys(changes).forEach((rowID) =>
- {
- const row = this.getRowInfo(rowID);
- if(row !== undefined) this._checkedRows[rowID] = row.data;
- });
- }
- window.insertListToDoc = function()
- {
- const dtable = zui.DTable.query($('#projectreleases'));
- const myTable = dtable.$;
- const checkedList = Object.keys(myTable.state.checkedRows);
- if(!checkedList.length) return;
- let {cols} = dtable.options;
- const data = checkedList.map(rowID => myTable._checkedRows[rowID]);
- const docID = getDocApp()?.docID;
- const blockType = 'projectRelease';
- const url = $.createLink('doc', 'buildZentaoList', `docID=${docID}&type=${blockType}&blockID=${blockID}`);
- const formData = new FormData();
- formData.append('cols', JSON.stringify(cols));
- formData.append('data', JSON.stringify(data));
- formData.append('idList', checkedList.join(','));
- formData.append('url', insertListLink);
- $.post(url, formData, function(resp)
- {
- resp = JSON.parse(resp);
- if(resp.result == 'success')
- {
- const oldBlockID = resp.oldBlockID;
- const newBlockID = resp.newBlockID;
- zui.Modal.hide();
- window.insertZentaoList && window.insertZentaoList(blockType, newBlockID, null, oldBlockID);
- }
- });
- }
- window.firstRendered = false;
- window.toggleCheckRows = function(idList)
- {
- if(!idList?.length || firstRendered) return;
- firstRendered = true;
- const dtable = zui.DTable.query($('#projectreleases'));
- dtable.$.toggleCheckRows(idList.split(','), true);
- }
|