Commit fa91f2a0 by liangjianmin

feat(orderTrack): 优化采购合作框架协议电子签署功能

- 更新协议版本链接为动态地址,支持下载协议模板
- 增加上传按钮和有效期选择的禁用状态,提升用户体验
- 新增协议状态提示弹窗,显示审核状态信息
- 实现获取协议审核状态的逻辑,动态更新表单数据
- 增加状态颜色显示,便于用户识别协议状态
parent f6126ee0
Showing with 107 additions and 11 deletions
......@@ -164,13 +164,13 @@
<el-form :model="agreementForm" :rules="agreementRules" ref="agreementForm" label-width="121px">
<div class="form-section">
<el-form-item label="协议版本:">
<el-link type="primary" :underline="false" href="#">采购合作框架协议</el-link>
<el-link type="primary" :underline="false" :href="agreementTemplateUrl" target="_blank">采购合作框架协议</el-link>
</el-form-item>
<el-form-item label="上传签章协议:" prop="file_url">
<div class="upload-area">
<el-upload :data="fileData" :action="uploadUrl" :on-success="handleUploadSuccess" :before-upload="beforeUpload" accept=".pdf" :show-file-list="false">
<el-button icon="el-icon-upload2" type="primary">上传</el-button>
<span class="upload-tip">仅支持PDF格式</span>
<el-upload :data="fileData" :action="uploadUrl" :on-success="handleUploadSuccess" :before-upload="beforeUpload" accept=".pdf" :show-file-list="false" :disabled="agreementStatus.status === 0">
<el-button icon="el-icon-upload2" type="primary" :disabled="agreementStatus.status === 0">上传</el-button>
<span class="upload-tip">仅支持PDF格式{{ agreementStatus.status === 0 ? '(待审核状态不可修改)' : '' }}</span>
</el-upload>
<div v-if="agreementForm.file_url" class="uploaded-file">
<i class="el-icon-document"></i>
......@@ -181,13 +181,13 @@
</el-form-item>
<el-form-item label="有效期:" prop="validity_type">
<div class="validity-area" :style="{ marginTop: agreementForm.validity_type === 1 ? '7px' : '0px' }">
<el-radio v-model="agreementForm.validity_type" :label="1">长期有效</el-radio>
<el-radio v-model="agreementForm.validity_type" :label="2">自定义</el-radio>
<el-date-picker v-if="agreementForm.validity_type === 2" v-model="validityRange" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd" style="width: 300px; margin-left: 20px;" :picker-options="pickerOptions" format="yyyy-MM-dd" clearable :unlink-panels="true"></el-date-picker>
<el-radio v-model="agreementForm.validity_type" :label="1" :disabled="agreementStatus.status === 0">长期有效</el-radio>
<el-radio v-model="agreementForm.validity_type" :label="2" :disabled="agreementStatus.status === 0">自定义</el-radio>
<el-date-picker v-if="agreementForm.validity_type === 2" v-model="validityRange" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd" style="width: 300px; margin-left: 20px;" :picker-options="pickerOptions" format="yyyy-MM-dd" clearable :unlink-panels="true" :disabled="agreementStatus.status === 0"></el-date-picker>
</div>
</el-form-item>
<el-form-item label="状态:">
<span></span>
<span :style="{ color: getStatusColor() }">{{ agreementStatus.status_name || '暂无状态' }}</span>
</el-form-item>
</div>
</el-form>
......@@ -195,7 +195,20 @@
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="cancelAgreement">取消</el-button>
<el-button type="primary" @click="submitAgreement">提交审核</el-button>
<el-button type="primary" @click="submitAgreement" :disabled="agreementStatus.status === 0">{{ agreementStatus.status === 0 ? '待审核中' : '提交审核' }}</el-button>
</div>
</el-dialog>
<!--协议状态提示弹窗-->
<el-dialog title="提示" :visible.sync="dialogVisibleStatus" width="550px" :close-on-click-modal="false">
<div class="status-content">
<p>
贵司已与猎芯签订【<el-link type="primary" :underline="false" :href="agreementForm.file_url" target="_blank">{{ agreementForm.file_name }}</el-link>】,且已通过审核,可使用电子签签订采购合同。
</p>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogVisibleStatus = false">取消</el-button>
<el-button type="primary" @click="dialogVisibleStatus = false">确定</el-button>
</div>
</el-dialog>
</section>
......@@ -221,6 +234,7 @@
page: 1,
dialogVisible: false,
dialogVisibleSign: false,
dialogVisibleStatus: false, // 协议状态提示弹窗
logs: [],
create_time_val: '',
inquiry_item_id: '',//询价id
......@@ -240,6 +254,7 @@
},
// 签署协议表单数据
agreementForm: {
id: '',//id,更新的时候要传
type: 'cooperation_agreement',//附件类型
file_url: '',//文件地址
file_name: '',//文件名称
......@@ -284,6 +299,14 @@
// 文件上传相关
uploadUrl: 'http://file.liexindev.net/uploadFile?sys_type=2',
fileData: {},
// 协议模板下载链接
agreementTemplateUrl: NODE_ENVS + '/api/attachment/downloadAttachmentTemplate?type=cooperation_agreement',
// 协议状态信息
agreementStatus: {
status_name: '',
has_cooperation_agreement: 0,
status: 0 // 审核状态
},
// 表单验证规则
agreementRules: {
file_url: [
......@@ -401,8 +424,69 @@
* 签署合作协议
*/
signPartnerAgreement() {
this.dialogVisibleSign = true;
this.title = '签署采购合作框架协议';
// 先获取协议状态,再决定打开哪个弹窗和设置标题
this.getAgreementStatus();
},
/**
* 获取协议审核状态
*/
getAgreementStatus() {
this.$http('GET', '/api/attachment/getAttachmentAuditDetail', { type: 'cooperation_agreement' }).then(res => {
if (res.code === 0 && res.data) {
this.agreementStatus.status_name = res.data.status_name;
this.agreementStatus.has_cooperation_agreement = res.data.has_cooperation_agreement;
this.agreementStatus.status = res.data.status;
var status = res.data.status;
// 根据协议状态设置标题和显示对应弹窗
if (res.data.has_cooperation_agreement === 1) {
// 已有协议
this.agreementForm.id = res.data.id || '';
this.agreementForm.file_url = res.data.file_url || '';
this.agreementForm.file_name = res.data.file_name || '';
this.agreementForm.validity_type = res.data.validity_type || 1;
this.agreementForm.validity_start = res.data.validity_start || '';
this.agreementForm.validity_end = res.data.validity_end || '';
// 如果是自定义有效期,设置日期范围
if (res.data.validity_type === 2 && res.data.validity_start && res.data.validity_end) {
this.validityRange = [res.data.validity_start, res.data.validity_end];
}
if (status === 1) {
// 审核通过,显示状态提示弹窗
this.title = '提示';
this.dialogVisibleSign = false;
this.dialogVisibleStatus = true;
} else {
// 待审核或审核失败,显示申请弹窗
this.title = '申请电子签';
this.dialogVisibleSign = true;
this.dialogVisibleStatus = false;
}
} else {
// 没有协议,显示申请弹窗
this.title = '签署采购合作框架协议';
this.dialogVisibleSign = true;
this.dialogVisibleStatus = false;
}
} else {
this.agreementStatus.status_name = '暂无状态';
this.agreementStatus.has_cooperation_agreement = 0;
// 没有协议数据,打开申请弹窗
this.title = '签署采购合作框架协议';
this.dialogVisibleSign = true;
this.dialogVisibleStatus = false;
}
}).catch(err => {
console.error('获取协议状态失败:', err);
this.agreementStatus.status_name = '获取状态失败';
this.agreementStatus.has_cooperation_agreement = 0;
// 接口失败,默认打开申请弹窗
this.title = '签署采购合作框架协议';
this.dialogVisibleSign = true;
this.dialogVisibleStatus = false;
});
},
//生成发货单
addSend() {
......@@ -519,6 +603,18 @@
}
},
/**
* 获取状态颜色
*/
getStatusColor() {
if (this.agreementStatus.status === -1) {
return '#F56C6C'; // 审核失败 - 红色
} else if (this.agreementStatus.status === 1) {
return '#67C23A'; // 审核通过 - 绿色
} else {
return '#E6A23C'; // 待审核 - 橙色
}
},
/**
* 取消协议
*/
cancelAgreement() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment