| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- 'use strict';
- /**
- *
- *
- * @author Mai
- * @date
- * @version
- */
- const changeSort = {
- name: '变更令排序',
- hint: '默认的变更令排序,同时对变更令,变更清单进行排序',
- /**
- *
- * @param ctx - context常量
- * @param data - 全部数据源{Array}
- * @param fieldsKey - 计算字段
- */
- fun: function (ctx, data, fieldsKey) {
- if (!data.change || data.change_audit_list) 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;
- });
- return aCIndex === bCIndex
- ? ctx.helper.compareCode(a.code, b.code)
- : aCIndex - bCindex;
- })
- },
- };
- module.exports = {
- changeSort,
- };
|