|
|
@@ -676,6 +676,7 @@ $(document).ready(function() {
|
|
|
for (const attr of attributeSet) {
|
|
|
$('#htdetail_' + attr.field).text(attrInfo && attrInfo[attr.field] ? attrInfo[attr.field] : '');
|
|
|
}
|
|
|
+ $('#hidden_pay_condition').val(attrInfo && attrInfo.pay_condition ? attrInfo.pay_condition : '');
|
|
|
$('#htdetail_df_price').text(ZhCalc.sub(node.yf_price, node.sf_price) || '');
|
|
|
if (needPost) {
|
|
|
postData(window.location.pathname + '/update', {postType: 'get-contract', postData: node.id}, function (result) {
|
|
|
@@ -1882,14 +1883,19 @@ $(document).ready(function() {
|
|
|
$('#htdetail_' + c).html('<input type="text" class="form-control form-control-sm" value="' + node[c] + '">');
|
|
|
}
|
|
|
}
|
|
|
- const attrInfo = node.attribute_json ? JSON.parse(node.attribute_json) : null;
|
|
|
+ const attrInfo = node.attribute_json ? JSON.parse(node.attribute_json) : {};
|
|
|
+ let havePayCondition = false;
|
|
|
for (const attr of attributeSet) {
|
|
|
+ if (attr.field === 'pay_condition') havePayCondition = true;
|
|
|
if (attr.type === 'long_text') {
|
|
|
$('#htdetail_' + attr.field).html('<textarea class="form-control form-control-sm" rows="3">' + (attrInfo && attrInfo[attr.field] ? attrInfo[attr.field] : '') + '</textarea>');
|
|
|
continue;
|
|
|
}
|
|
|
$('#htdetail_' + attr.field).html('<input type="' + attr.type + '" class="form-control form-control-sm" value="' + (attrInfo && attrInfo[attr.field] ? attrInfo[attr.field] : '') + '">');
|
|
|
}
|
|
|
+ if (!havePayCondition) {
|
|
|
+ $('#hidden_pay_condition').val(attrInfo && attrInfo.pay_condition ? attrInfo.pay_condition : '');
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
$('#save_contract_btn').on('click', function () {
|
|
|
@@ -1937,7 +1943,9 @@ $(document).ready(function() {
|
|
|
return;
|
|
|
}
|
|
|
const attrInfo = node.attribute_json ? JSON.parse(node.attribute_json) : {};
|
|
|
+ let havePayCondition = false;
|
|
|
for (const attr of attributeSet) {
|
|
|
+ if (attr.field === 'pay_condition') havePayCondition = true;
|
|
|
if (attr.type === 'long_text') {
|
|
|
attrInfo[attr.field] = $('#htdetail_' + attr.field + ' textarea').val();
|
|
|
// 判断长度超过1000字提示
|
|
|
@@ -1963,11 +1971,15 @@ $(document).ready(function() {
|
|
|
}
|
|
|
attrInfo[attr.field] = $('#htdetail_' + attr.field + ' input').val();
|
|
|
}
|
|
|
+ if (!havePayCondition) {
|
|
|
+ attrInfo.pay_condition = $('#hidden_pay_condition').val();
|
|
|
+ }
|
|
|
data.attribute_json = JSON.stringify(attrInfo);
|
|
|
// if (data.party_b === '') {
|
|
|
// toastr.warning('签订单位(乙方)不能为空');
|
|
|
// return;
|
|
|
// }
|
|
|
+ console.log(data);
|
|
|
// 更新至服务器
|
|
|
postData(window.location.pathname + '/update', {postType: 'update-contract', postData: data}, function (result) {
|
|
|
toastr.success('已编辑成功');
|
|
|
@@ -2005,6 +2017,7 @@ $(document).ready(function() {
|
|
|
}
|
|
|
$('#htdetail_' + attr.field).text(attrInfo && attrInfo[attr.field] ? attrInfo[attr.field] : '');
|
|
|
}
|
|
|
+ $('#hidden_pay_condition').val(attrInfo && attrInfo.pay_condition ? attrInfo.pay_condition : '');
|
|
|
}
|
|
|
});
|
|
|
|
|
|
@@ -2659,6 +2672,15 @@ $(document).ready(function() {
|
|
|
}
|
|
|
signDate.selectDate('');
|
|
|
$('#cons-add textarea[name="remark"]').val('');
|
|
|
+ // 附加属性也清空
|
|
|
+ for (const attr of attributeSet) {
|
|
|
+ if (attr.type === 'long_text') {
|
|
|
+ $('#cons-add textarea[name="' + attr.field + '"]').val('');
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ $('#cons-add input[name="' + attr.field + '"]').val('');
|
|
|
+ }
|
|
|
+ $('#cons-add textarea[name="pay_condition"]').val('');
|
|
|
// type选回第一个
|
|
|
$('#cons-add select[name="type"]').val($('#cons-add select[name="type"] option:first').val());
|
|
|
$('#contract-add-cid').val('');
|
|
|
@@ -2668,6 +2690,22 @@ $(document).ready(function() {
|
|
|
$('#ai-file-panel').hide();
|
|
|
});
|
|
|
|
|
|
+ $('#contractAttrCollapse')
|
|
|
+ .on('show.bs.collapse', function () {
|
|
|
+ $(this)
|
|
|
+ .prev()
|
|
|
+ .find('.attr-collapse-icon')
|
|
|
+ .removeClass('fa-chevron-down')
|
|
|
+ .addClass('fa-chevron-up');
|
|
|
+ })
|
|
|
+ .on('hide.bs.collapse', function () {
|
|
|
+ $(this)
|
|
|
+ .prev()
|
|
|
+ .find('.attr-collapse-icon')
|
|
|
+ .removeClass('fa-chevron-up')
|
|
|
+ .addClass('fa-chevron-down');
|
|
|
+ });
|
|
|
+
|
|
|
$('#add-contract').click(function () {
|
|
|
const node = SpreadJsObj.getSelectObject(contractSheet);
|
|
|
if (!node) {
|
|
|
@@ -2679,6 +2717,20 @@ $(document).ready(function() {
|
|
|
for (const key of edit_contract_input_key) {
|
|
|
data[key] = $('#cons-add input[name="'+ key +'"]').val();
|
|
|
}
|
|
|
+ const attribute_json = {};
|
|
|
+ let havePayCondition = false;
|
|
|
+ for (const attr of attributeSet) {
|
|
|
+ if (attr.field === 'pay_condition') havePayCondition = true;
|
|
|
+ if (attr.type === 'long_text') {
|
|
|
+ attribute_json[attr.field] = $('#cons-add textarea[name="' + attr.field + '"]').val();
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ attribute_json[attr.field] = $('#cons-add input[name="' + attr.field + '"]').val();
|
|
|
+ }
|
|
|
+ if (!havePayCondition) {
|
|
|
+ attribute_json.pay_condition = $('#cons-add textarea[name="pay_condition"]').val();
|
|
|
+ }
|
|
|
+ data.attribute_json = JSON.stringify(attribute_json);
|
|
|
const new_cid = $('#contract-add-cid').val();
|
|
|
data.cid = new_cid;
|
|
|
data.attach = $('#contract-add-attach').prop('checked');
|
|
|
@@ -4166,6 +4218,7 @@ $(document).ready(function() {
|
|
|
$('#cons-add input[name="' + key + '"]').val(data[key] || '');
|
|
|
}
|
|
|
signDate.selectDate(data && data.sign_date ? new Date(moment(data.sign_date).format('YYYY-MM-DD')) : '');
|
|
|
+ $('#cons-add textarea[name="pay_condition"]').val(data.pay_condition || '');
|
|
|
$('#contract-add-cid').val(result.cid);
|
|
|
if (result.file) {
|
|
|
$('#contract-add-fid').val(result.file.id || '');
|
|
|
@@ -4200,13 +4253,21 @@ $(document).ready(function() {
|
|
|
}
|
|
|
}
|
|
|
const attrInfo = node.attribute_json ? JSON.parse(node.attribute_json) : null;
|
|
|
+ let havePayCondition = false;
|
|
|
for (const attr of attributeSet) {
|
|
|
- if (attr.type === 'long_text') {
|
|
|
+ if (attr.field === 'pay_condition') {
|
|
|
+ havePayCondition = true;
|
|
|
+ $('#htdetail_' + attr.field).html('<textarea class="form-control form-control-sm" rows="3">' + (data && data[attr.field] ? data[attr.field] : '') + '</textarea>');
|
|
|
+ continue;
|
|
|
+ } else if (attr.type === 'long_text') {
|
|
|
$('#htdetail_' + attr.field).html('<textarea class="form-control form-control-sm" rows="3">' + (attrInfo && attrInfo[attr.field] ? attrInfo[attr.field] : '') + '</textarea>');
|
|
|
continue;
|
|
|
}
|
|
|
$('#htdetail_' + attr.field).html('<input type="' + attr.type + '" class="form-control form-control-sm" value="' + (attrInfo && attrInfo[attr.field] ? attrInfo[attr.field] : '') + '">');
|
|
|
}
|
|
|
+ if (!havePayCondition) {
|
|
|
+ $('#hidden_pay_condition').val(data && data.pay_condition ? data.pay_condition : '');
|
|
|
+ }
|
|
|
}
|
|
|
if (result.file) {
|
|
|
// 插入到files最前面
|