|
@@ -10,6 +10,7 @@ $(document).ready(function() {
|
|
|
{title: '项目名称/合同名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 360, formatter: '@', readOnly: 'readOnly.code', wordWrap: true},
|
|
{title: '项目名称/合同名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 360, formatter: '@', readOnly: 'readOnly.code', wordWrap: true},
|
|
|
{title: '创建人', colSpan: '1', rowSpan: '2', field: 'username', hAlign: 1, width: 80, formatter: '@', readOnly: true},
|
|
{title: '创建人', colSpan: '1', rowSpan: '2', field: 'username', hAlign: 1, width: 80, formatter: '@', readOnly: true},
|
|
|
{title: '合同金额', colSpan: '1', rowSpan: '2', field: 'total_price', hAlign: 2, width: 120, formatter: '@', readOnly: true},
|
|
{title: '合同金额', colSpan: '1', rowSpan: '2', field: 'total_price', hAlign: 2, width: 120, formatter: '@', readOnly: true},
|
|
|
|
|
+ {title: '合同状态', colSpan: '1', rowSpan: '2', field: 'status', hAlign: 1, width: 100, formatter: '@', readOnly: true, getValue:'getValue.status', foreColor:'foreColor.status'},
|
|
|
],
|
|
],
|
|
|
emptyRows: 0,
|
|
emptyRows: 0,
|
|
|
headRows: 2,
|
|
headRows: 2,
|
|
@@ -54,21 +55,36 @@ $(document).ready(function() {
|
|
|
readOnly: {
|
|
readOnly: {
|
|
|
code: function (data) {
|
|
code: function (data) {
|
|
|
return !permission_edit || data.c_code;
|
|
return !permission_edit || data.c_code;
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ },
|
|
|
|
|
+ calc: function (data) {
|
|
|
|
|
+ return !permission_edit || data?.children?.length > 0;
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
}
|
|
}
|
|
|
const getStackedBarTip = function (data) {
|
|
const getStackedBarTip = function (data) {
|
|
|
return data.stackedBarTips ? data.stackedBarTips.join('\n') : '';
|
|
return data.stackedBarTips ? data.stackedBarTips.join('\n') : '';
|
|
|
};
|
|
};
|
|
|
- if (contract_type === contractConst.type.expenses) {
|
|
|
|
|
- contractSpreadSetting.cols.push({title: '累计应付', colSpan: '1', rowSpan: '2', field: 'yf_price', hAlign: 2, width: 120, formatter: '@', readOnly: true});
|
|
|
|
|
- contractSpreadSetting.cols.push({title: '支付进度', colSpan: '1', rowSpan: '2', formatter: '@', readOnly: true, field: 'stackedBar', hAlign: 0, width: 200, cellType: 'stackedBar', stackedBarCover: true, bc_type: 'grid', getTip: getStackedBarTip, hintNum: true});
|
|
|
|
|
- } else if (contract_type === contractConst.type.income) {
|
|
|
|
|
- contractSpreadSetting.cols.push({title: '累计应回', colSpan: '1', rowSpan: '2', field: 'yf_price', hAlign: 2, width: 120, formatter: '@', readOnly: true});
|
|
|
|
|
- contractSpreadSetting.cols.push({title: '回款进度', colSpan: '1', rowSpan: '2', formatter: '@', readOnly: true, field: 'stackedBar', hAlign: 0, width: 200, cellType: 'stackedBar', stackedBarCover: true, bc_type: 'grid', getTip: getStackedBarTip, hintNum: true});
|
|
|
|
|
|
|
+ const getStackedBarTipSf = function (data) {
|
|
|
|
|
+ return data.stackedBarSfTips ? data.stackedBarSfTips.join('\n') : '';
|
|
|
|
|
+ };
|
|
|
|
|
+ const colMap = {
|
|
|
|
|
+ yf_price: {title: '累计应付', colSpan: '1', rowSpan: '2', field: 'yf_price', hAlign: 2, width: 120, formatter: '@', readOnly: true},
|
|
|
|
|
+ stackedBar: {title: '应付进度', colSpan: '1', rowSpan: '2', formatter: '@', readOnly: true, field: 'stackedBar', hAlign: 0, width: 200, cellType: 'stackedBar', stackedBarCover: true, bc_type: 'grid', getTip: getStackedBarTip, hintNum: true},
|
|
|
|
|
+ sf_price: {title: '累计实付', colSpan: '1', rowSpan: '2', field: 'sf_price', hAlign: 2, width: 120, formatter: '@', readOnly: true},
|
|
|
|
|
+ stackedBarSf: {title: '实付进度', colSpan: '1', rowSpan: '2', formatter: '@', readOnly: true, field: 'stackedBarSf', hAlign: 0, width: 200, cellType: 'stackedBar', stackedBarCover: true, bc_type: 'grid', getTip: getStackedBarTipSf, hintNum: true},
|
|
|
|
|
+ remark: {title: '备注1', colSpan: '1', rowSpan: '2', field: 'remark', hAlign: 0, width: 120, formatter: '@', cellType: 'ellipsisAutoTip', scrollHeightClass: '.sjs-height-1'},
|
|
|
|
|
+ remark2: {title: '备注2', colSpan: '1', rowSpan: '2', field: 'remark2', hAlign: 0, width: 120, formatter: '@', cellType: 'ellipsisAutoTip', scrollHeightClass: '.sjs-height-1'},
|
|
|
|
|
+ calc: {title: '计算1', colSpan: '1', rowSpan: '2', field: 'calc', hAlign: 2, width: 120, type: 'Number', readOnly: 'readOnly.calc'},
|
|
|
|
|
+ calc2: {title: '计算2', colSpan: '1', rowSpan: '2', field: 'calc2', hAlign: 2, width: 120, type: 'Number', readOnly: 'readOnly.calc'},
|
|
|
}
|
|
}
|
|
|
- contractSpreadSetting.cols.push({title: '合同状态', colSpan: '1', rowSpan: '2', field: 'status', hAlign: 1, width: 100, formatter: '@', readOnly: true, getValue:'getValue.status', foreColor:'foreColor.status'});
|
|
|
|
|
- contractSpreadSetting.cols.push({title: '备注', colSpan: '1', rowSpan: '2', field: 'remark', hAlign: 0, width: 120, formatter: '@', readOnly: 'readOnly.code', cellType: 'ellipsisAutoTip', scrollHeightClass: '.sjs-height-1'});
|
|
|
|
|
|
|
+ // 根据 colSet 组装最终显示的列配置
|
|
|
|
|
+ colSet.forEach(col => {
|
|
|
|
|
+ const colInfo = colMap?.[col.field];
|
|
|
|
|
+ if (colInfo && col.show) {
|
|
|
|
|
+ contractSpreadSetting.cols.push({...colInfo, title: col?.alias || col.name});
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
|
|
|
const contractSpread = SpreadJsObj.createNewSpread($('#contract-spread')[0]);
|
|
const contractSpread = SpreadJsObj.createNewSpread($('#contract-spread')[0]);
|
|
|
const contractSheet = contractSpread.getActiveSheet();
|
|
const contractSheet = contractSpread.getActiveSheet();
|
|
@@ -83,7 +99,7 @@ $(document).ready(function() {
|
|
|
level: 'level',
|
|
level: 'level',
|
|
|
rootId: -1,
|
|
rootId: -1,
|
|
|
keys: ['id', 'tid', 'spid', 'contract_type'],
|
|
keys: ['id', 'tid', 'spid', 'contract_type'],
|
|
|
- calcFields: ['pay_price', 'total_price', 'sf_price', 'debit_price', 'yf_price'],
|
|
|
|
|
|
|
+ calcFields: ['pay_price', 'total_price', 'sf_price', 'debit_price', 'yf_price', 'calc', 'calc2'],
|
|
|
autoExpand: 3,
|
|
autoExpand: 3,
|
|
|
markExpandKey: 'contract-bills-expand' + window.location.pathname.split('/')[2] + contractConst.typeMap[contract_type],
|
|
markExpandKey: 'contract-bills-expand' + window.location.pathname.split('/')[2] + contractConst.typeMap[contract_type],
|
|
|
markExpandSubKey: window.location.pathname.split('/')[2] + contractConst.typeMap[contract_type],
|
|
markExpandSubKey: window.location.pathname.split('/')[2] + contractConst.typeMap[contract_type],
|
|
@@ -100,6 +116,13 @@ $(document).ready(function() {
|
|
|
node.stackedBar.push({ color: calcFieldColor[cf], percent: ZhCalc.div(node[cf], base), field: cf, hintNum: cf === 'yf_price' });
|
|
node.stackedBar.push({ color: calcFieldColor[cf], percent: ZhCalc.div(node[cf], base), field: cf, hintNum: cf === 'yf_price' });
|
|
|
node.stackedBarTips.push(`${calcFieldCaption[cf]}: ${node[cf] || 0}`);
|
|
node.stackedBarTips.push(`${calcFieldCaption[cf]}: ${node[cf] || 0}`);
|
|
|
}
|
|
}
|
|
|
|
|
+ // 计算实付进度(单独的 stackedBarSf)
|
|
|
|
|
+ node.stackedBarSf = [];
|
|
|
|
|
+ node.stackedBarSfTips = [];
|
|
|
|
|
+ node.stackedBarSf.push({ color: '#bbb', percent: ZhCalc.div(node.total_price, base), field: 'total_price', hintNum: false });
|
|
|
|
|
+ node.stackedBarSf.push({ color: '#007bff', percent: ZhCalc.div(node.sf_price, base), field: 'sf_price', hintNum: true });
|
|
|
|
|
+ node.stackedBarSfTips.push(`合同金额: ${node.total_price || 0}`);
|
|
|
|
|
+ node.stackedBarSfTips.push(`累计${contract_type === contractConst.type.expenses ? '实付' : '实回'}: ${node.sf_price || 0}`);
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
const contractTree = createNewPathTree('revise', treeSetting);
|
|
const contractTree = createNewPathTree('revise', treeSetting);
|
|
@@ -392,6 +415,7 @@ $(document).ready(function() {
|
|
|
},
|
|
},
|
|
|
setContract: function (sheet) {
|
|
setContract: function (sheet) {
|
|
|
const node = SpreadJsObj.getSelectObject(sheet);
|
|
const node = SpreadJsObj.getSelectObject(sheet);
|
|
|
|
|
+
|
|
|
if (node && node.c_code) {
|
|
if (node && node.c_code) {
|
|
|
$('#htdetail-table').show();
|
|
$('#htdetail-table').show();
|
|
|
$('#htpay-table').show();
|
|
$('#htpay-table').show();
|
|
@@ -573,6 +597,7 @@ $(document).ready(function() {
|
|
|
const col = info.sheet.zh_setting.cols[info.col];
|
|
const col = info.sheet.zh_setting.cols[info.col];
|
|
|
const sortData = info.sheet.zh_dataType === 'tree' ? info.sheet.zh_tree.nodes : info.sheet.zh_data;
|
|
const sortData = info.sheet.zh_dataType === 'tree' ? info.sheet.zh_tree.nodes : info.sheet.zh_data;
|
|
|
const node = sortData[info.row];
|
|
const node = sortData[info.row];
|
|
|
|
|
+
|
|
|
const data = {
|
|
const data = {
|
|
|
id: node.id,
|
|
id: node.id,
|
|
|
};
|
|
};
|
|
@@ -589,9 +614,9 @@ $(document).ready(function() {
|
|
|
} else {
|
|
} else {
|
|
|
data[col.field] = null;
|
|
data[col.field] = null;
|
|
|
}
|
|
}
|
|
|
- console.log(data);
|
|
|
|
|
// 更新至服务器
|
|
// 更新至服务器
|
|
|
- postData(window.location.pathname + '/update', {postType: 'update', postData: data}, function (result) {
|
|
|
|
|
|
|
+
|
|
|
|
|
+ postData(window.location.pathname + '/update', {postType: node?.c_code ? 'update-contract' : 'update', postData: data}, function (result) {
|
|
|
const refreshNode = contractTree.loadPostData(result);
|
|
const refreshNode = contractTree.loadPostData(result);
|
|
|
contractTreeSpreadObj.refreshTree(info.sheet, refreshNode);
|
|
contractTreeSpreadObj.refreshTree(info.sheet, refreshNode);
|
|
|
});
|
|
});
|
|
@@ -1229,12 +1254,10 @@ $(document).ready(function() {
|
|
|
toastr.warning('签订单位(乙方)不能为空');
|
|
toastr.warning('签订单位(乙方)不能为空');
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- console.log(data);
|
|
|
|
|
// 更新至服务器
|
|
// 更新至服务器
|
|
|
postData(window.location.pathname + '/update', {postType: 'update-contract', postData: data}, function (result) {
|
|
postData(window.location.pathname + '/update', {postType: 'update-contract', postData: data}, function (result) {
|
|
|
toastr.success('已编辑成功');
|
|
toastr.success('已编辑成功');
|
|
|
const refreshNode = contractTree.loadPostData(result);
|
|
const refreshNode = contractTree.loadPostData(result);
|
|
|
- console.log(refreshNode);
|
|
|
|
|
contractTreeSpreadObj.refreshTree(contractSheet, refreshNode);
|
|
contractTreeSpreadObj.refreshTree(contractSheet, refreshNode);
|
|
|
const newNode = SpreadJsObj.getSelectObject(contractSheet);
|
|
const newNode = SpreadJsObj.getSelectObject(contractSheet);
|
|
|
contractTreeSpreadObj.changeContractTab(newNode, true);
|
|
contractTreeSpreadObj.changeContractTab(newNode, true);
|