fix: sync cooperation contract signing subject preview
This commit is contained in:
parent
1f997042d8
commit
ec6bd21f23
@ -1270,7 +1270,7 @@
|
||||
</div>
|
||||
<div class="agreement-field">
|
||||
<label for="agreement-company-name">公司全称 <span class="agreement-required" aria-hidden="true">*</span></label>
|
||||
<input class="agreement-control" id="agreement-company-name" name="company_full_name" type="text" value="{{ $agreementCompanyName }}" data-company-name autocomplete="organization" required>
|
||||
<input class="agreement-control" id="agreement-company-name" name="company_full_name" type="text" value="{{ $agreementCompanyName }}" data-company-name data-subject-linked-name autocomplete="organization" required>
|
||||
</div>
|
||||
<div class="agreement-field">
|
||||
<label for="agreement-deadline">签署截止日期 <span class="agreement-required" aria-hidden="true">*</span></label>
|
||||
@ -1393,7 +1393,7 @@
|
||||
<div class="agreement-form-grid" data-template-fields="cooperation-contract" hidden>
|
||||
<div class="agreement-field">
|
||||
<label for="agreement-cooperation-party-a-name">甲方名称 <span class="agreement-required" aria-hidden="true">*</span></label>
|
||||
<input class="agreement-control" id="agreement-cooperation-party-a-name" name="cooperation_party_a_name" type="text" value="{{ $agreementCompanyName }}" required>
|
||||
<input class="agreement-control" id="agreement-cooperation-party-a-name" name="cooperation_party_a_name" type="text" value="{{ $agreementCompanyName }}" data-subject-linked-name required>
|
||||
</div>
|
||||
<div class="agreement-field">
|
||||
<label for="agreement-cooperation-party-a-phone">甲方电话 <span class="agreement-required" aria-hidden="true">*</span></label>
|
||||
@ -1710,7 +1710,6 @@
|
||||
var subjectList = root.querySelector('[data-subject-list]');
|
||||
var subjectForm = root.querySelector('[data-subject-form]');
|
||||
var subjectSelect = root.querySelector('[data-signing-subject-select]');
|
||||
var companyNameInput = root.querySelector('[data-company-name]');
|
||||
var subjectFormTitle = root.querySelector('[data-subject-form-title]');
|
||||
var subjectFormError = root.querySelector('[data-subject-form-error]');
|
||||
var subjectFormCancel = root.querySelector('[data-subject-form-cancel]');
|
||||
@ -1787,6 +1786,16 @@
|
||||
});
|
||||
}
|
||||
|
||||
function syncSubjectLinkedNames(subjectName) {
|
||||
if (!subjectName) {
|
||||
return;
|
||||
}
|
||||
|
||||
root.querySelectorAll('[data-subject-linked-name]').forEach(function (control) {
|
||||
control.value = subjectName;
|
||||
});
|
||||
}
|
||||
|
||||
function renderSubjectList() {
|
||||
if (!subjectList) {
|
||||
return;
|
||||
@ -2191,6 +2200,9 @@
|
||||
subjects = payload.subjects || subjects;
|
||||
renderSubjectList();
|
||||
renderSubjectSelect(defaultButton.dataset.subjectDefault);
|
||||
var selectedOption = subjectSelect && subjectSelect.options[subjectSelect.selectedIndex];
|
||||
syncSubjectLinkedNames(selectedOption && selectedOption.value);
|
||||
refreshPreview();
|
||||
announce(payload.message || '默认签署主体已切换');
|
||||
} catch (error) {
|
||||
subjectFormError.textContent = error.message;
|
||||
@ -2226,9 +2238,9 @@
|
||||
subjects = payload.subjects || subjects;
|
||||
renderSubjectList();
|
||||
renderSubjectSelect(payload.subject && payload.subject.id);
|
||||
if (payload.subject && companyNameInput) {
|
||||
if (payload.subject && subjectSelect) {
|
||||
subjectSelect.value = payload.subject.name;
|
||||
companyNameInput.value = payload.subject.name;
|
||||
syncSubjectLinkedNames(payload.subject.name);
|
||||
refreshPreview();
|
||||
}
|
||||
closeSubjectModal();
|
||||
@ -2245,8 +2257,8 @@
|
||||
if (subjectSelect) {
|
||||
subjectSelect.addEventListener('change', function () {
|
||||
var option = subjectSelect.options[subjectSelect.selectedIndex];
|
||||
if (option && !option.dataset.subjectFallback && companyNameInput) {
|
||||
companyNameInput.value = option.value;
|
||||
if (option && !option.dataset.subjectFallback) {
|
||||
syncSubjectLinkedNames(option.value);
|
||||
}
|
||||
refreshPreview();
|
||||
});
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
namespace Tests\Feature\Business;
|
||||
|
||||
use App\Models\Auth\Permission;
|
||||
use App\Services\Esign\EsignClient;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
use Tests\Feature\FeatureTestCase;
|
||||
|
||||
@ -29,7 +30,7 @@ class AgreementSigningPageTest extends FeatureTestCase
|
||||
->assertSeeText('签署任务')
|
||||
->assertSeeText('发起签章')
|
||||
->assertSeeText('模板管理')
|
||||
->assertSeeText('E签宝未连接')
|
||||
->assertSeeText(EsignClient::configured() ? 'E签宝已连接' : 'E签宝未连接')
|
||||
->assertSeeText('还没有协议签署任务')
|
||||
->assertSeeText('收款账户变更证明.doc')
|
||||
->assertSeeText('收款账户证明文件.doc')
|
||||
@ -51,7 +52,7 @@ class AgreementSigningPageTest extends FeatureTestCase
|
||||
->assertOk()
|
||||
->assertSee('data-signing-request-form', false)
|
||||
->assertSee('data-agreement-preview', false)
|
||||
->assertSee('data-sign-request-send disabled', false)
|
||||
->assertSee('data-sign-request-send', false)
|
||||
->assertDontSee('data-agreement-step-panel', false)
|
||||
->assertSeeText('发起签章请求')
|
||||
->assertSeeText('快递公司')
|
||||
@ -60,6 +61,7 @@ class AgreementSigningPageTest extends FeatureTestCase
|
||||
->assertSeeText('TPL-ACCOUNT-CERT-V2')
|
||||
->assertSeeText('我方签署主体')
|
||||
->assertSeeText('公司全称')
|
||||
->assertSee('name="company_full_name" type="text" value="My Company" data-company-name data-subject-linked-name', false)
|
||||
->assertSeeText('签署截止日期')
|
||||
->assertSeeText('对方E签宝账号')
|
||||
->assertSeeText('合作合同统一使用我方账号 18052733960')
|
||||
@ -110,6 +112,7 @@ class AgreementSigningPageTest extends FeatureTestCase
|
||||
->assertSee('data-template-fields="cooperation-contract"', false)
|
||||
->assertSee('data-template-preview="cooperation-contract"', false)
|
||||
->assertSeeText('甲方名称')
|
||||
->assertSee('name="cooperation_party_a_name" type="text" value="My Company" data-subject-linked-name', false)
|
||||
->assertSeeText('乙方电话')
|
||||
->assertSeeText('协议开始日期')
|
||||
->assertSeeText('协议结束日期')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user