|
@@ -11,7 +11,9 @@
|
|
|
const changeSort = {
|
|
|
name: '变更令排序',
|
|
|
hint: '默认的变更令排序,同时对变更令,变更清单进行排序\n' +
|
|
|
- '变更令排序勿需勾选任何预定义处理指标,但是在指标映射中,要添加"变更令(change)"和"变更清单(chang_audit_list)"下的指标',
|
|
|
+ '变更令排序勿需勾选任何预定义处理指标,但是在指标映射中,需要添加如下指标:' +
|
|
|
+ '1. 如果只有变更令数据,则必须添加,"变更令(change)"下的"变更令号"' +
|
|
|
+ '2. 如果有变更清单需要排序,则必须在1的基础上添加,变更令(change)"下的"变更令uuid"和"变更清单(chang_audit_list)"下的"所属变更令uuid"&"清单编号"',
|
|
|
/**
|
|
|
*
|
|
|
* @param ctx - context常量
|
|
@@ -19,22 +21,24 @@ const changeSort = {
|
|
|
* @param fieldsKey - 计算字段
|
|
|
*/
|
|
|
fun: function(ctx, data, fieldsKey) {
|
|
|
- if (!data.change || !data.change_audit_list) return;
|
|
|
+ if (!data.change) return;
|
|
|
// 变更令排序
|
|
|
data.change.sort(function (a, b) {
|
|
|
return a.code.localeCompare(b.code);
|
|
|
});
|
|
|
- data.change_audit_list.sort(function (a, b) {
|
|
|
- const aCIndex = data.change.findIndex(function (c) {
|
|
|
- return c.cid === a.cid;
|
|
|
- });
|
|
|
- const bCIndex = data.change.findIndex(function (c) {
|
|
|
- return c.cid === b.cid;
|
|
|
+ if (data.change_audit_list) {
|
|
|
+ data.change_audit_list.sort(function (a, b) {
|
|
|
+ const aCIndex = data.change.findIndex(function (c) {
|
|
|
+ return c.cid === a.cid;
|
|
|
+ });
|
|
|
+ const bCIndex = data.change.findIndex(function (c) {
|
|
|
+ return c.cid === b.cid;
|
|
|
+ });
|
|
|
+ return aCIndex === bCIndex
|
|
|
+ ? ctx.helper.compareCode(a.code, b.code)
|
|
|
+ : aCIndex - bCIndex;
|
|
|
});
|
|
|
- return aCIndex === bCIndex
|
|
|
- ? ctx.helper.compareCode(a.code, b.code)
|
|
|
- : aCIndex - bCIndex;
|
|
|
- });
|
|
|
+ }
|
|
|
},
|
|
|
};
|
|
|
const gatherGcl = {
|