Commit 16e6540f authored by 谢子梦's avatar 谢子梦

文档:3.2.1

parent 1c332484
......@@ -48,7 +48,7 @@
<el-form-item label="代发企业" prop="taxUnitName">
<el-input v-model="signForm.taxUnitName" disabled placeholder="请选择代发企业" />
</el-form-item>
<el-form-item label="签约主体" prop="inviterName">
<el-form-item label="签约主体" prop="inviterId">
<el-select v-model="signForm.inviterId" clearable placeholder="请选择发薪主体">
<el-option v-for="item in payerCompanyArr" :key="item.id" :label="item.companyName" :value="item.id">
</el-option>
......@@ -61,7 +61,7 @@
</div>
</el-dialog>
<!-- 点击签约后查看合同 -->
<el-dialog title="签约合同" :visible.sync="signContractPanelVisible" append-to-body width="45%" center>
<el-dialog title="签约合同" :visible.sync="signContractPanelVisible" width="45%" center append-to-body>
<el-steps :active="active" finish-status="success" simple style="margin-top: 20px">
<el-step title="1、签订合同"></el-step>
<el-step title="2、确认签约"></el-step>
......@@ -85,6 +85,30 @@
</div>
</div>
</el-dialog>
<el-dialog title="上传代发合同" :visible.sync="uploadOnBehalfOfContract" center width="35%" append-to-body>
<div class="onBehalfOfContractMain">
<!-- <FileUpload ref="fileUpload" :fileType="['doc', 'docx', 'pdf']" :limit="1" v-model="contractUrl" /> -->
<div class="uploadFile">
<el-upload class="upload-demo" :headers="headers" :action="actionUrl" drag multiple :limit="1"
:on-preview="handlePreview" :on-remove="handleRemove" :before-remove="beforeRemove"
:on-exceed="handleExceed" :on-success="handleAvatarSuccess" :before-upload="beforeAvatarUpload">
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
<div class="el-upload__tip" slot="tip">只能上传wrod/pdf文件,且不超过10MB</div>
</el-upload>
</div>
<div class="onBehalfOfContractSubmit">
<el-button type="primary" :disabled="!contractUrl" class="onBehalfOfContractSubmitButton"
@click="onBehalfOfContractSubmitFN">确
认</el-button>
</div>
<div class="electronicContractSigning">
<el-button type="text" class="electronicContractSigningButton"
@click="electronicContractSigningFN">使用电子签约</el-button>
</div>
</div>
</el-dialog>
</div>
</template>
......@@ -93,6 +117,7 @@ import { listToSignUnit } from '@/api/business/unitInfo'
import { addLaborSign, applySignPreGenFile, confirmSignContract } from '@/api/business/laborSign'
import { listAllCompanyInfo } from '@/api/business/companyInfo'
import { signContractFile } from '@/api/business/onlineTaskInfo'
import { getToken } from "@/utils/auth";
export default {
name: "taxSignComponent",
......@@ -131,12 +156,25 @@ export default {
},
signFormRules: {
inviterId: [
{ required: true, message: "签约主体不能为空", trigger: "blur" }
{ required: true, message: "签约主体不能为空", trigger: ['blur', 'change'] }
],
},
/**查看签约合同参数 */
signContractPanelVisible: false,
toSignData: {}
toSignData: {},
// 签约代发合同弹窗参数
uploadOnBehalfOfContract: false,
actionUrl: process.env.VUE_APP_BASE_API + "/common/upload", // 上传的图片服务器地址
headers: {
Authorization: "Bearer " + getToken(),
},
allowedFileTypes: [
'application/pdf',
'application/msword',
'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
],
// 允许的文件扩展名
allowedExtensions: ['pdf', 'doc', 'docx']
};
},
created() {
......@@ -144,8 +182,97 @@ export default {
this.getPayerCompanyList();
},
methods: {
// 点击线上电子签章方法
electronicContractSigningFN() {
this.$modal.loading();
this.signForm.contractUrl = "pre";
applySignPreGenFile(this.signForm).then(resp => {
if (200 === resp.code) {
this.$modal.msgSuccess("操作成功!");
this.uploadOnBehalfOfContract = false
this.signContractPanelVisible = true;
this.contractUrl = resp.data;
this.signForm.contractUrl = resp.data;
} else {
this.$modal.msgError(resp.message);
}
}).catch(() => {
this.signContractPanelVisible = false;
this.signPanel = false
}).finally(() => {
this.$modal.closeLoading();
})
},
// 线下签约-点击确认方法
onBehalfOfContractSubmitFN() {
this.signForm.contractUrl = this.contractUrl
console.log('新方法传入的数据', this.signForm);
addLaborSign(this.signForm).then(resp => {
if (200 === resp.code) {
this.$modal.msgSuccess("操作成功!");
this.uploadOnBehalfOfContract = false;
// this.signPanel = false
this.$emit('submitSignContract')
}
}).catch(() => {
this.uploadOnBehalfOfContract = false;
// this.signPanel = false
})
},
beforeAvatarUpload(file) {
const fileType = file.type;
const fileExtension = file.name.split('.').pop().toLowerCase();
const fileSize = file.size / 1024 / 1024; // MB
// 验证文件类型
if (!this.allowedFileTypes.includes(fileType) && !this.allowedExtensions.includes(fileExtension)) {
this.showMessage('请上传PDF或Word文档(.pdf/.doc/.docx)', 'error');
return false;
}
// 验证文件大小
if (fileSize > 10) {
this.showMessage('文件大小不能超过10MB', 'error');
return false;
}
// // 限制只能上传一个文件
// if (this.fileList.length > 0) {
// this.$refs.uploadRef.clearFiles();
// }
return true;
return isJPG && isLt2M;
},
handleAvatarSuccess(res, file) {
// this.contractUrl = URL.createObjectURL(file.raw);
if (res.code == 200) {
this.contractUrl = res.url
this.$modal.msgSuccess('上传成功!');
}
// console.log('文件上传成功返回', res);
},
handleRemove(file, fileList) {
// console.log(file, fileList);
},
handlePreview(file) {
console.log(file);
},
handleExceed(files, fileList) {
// console.log('当前文件数量', fileList);
this.$message.warning(`当前限制选择 1 个文件`);
},
beforeRemove(file, fileList) {
return this.$confirm(`确定移除 ${file.name}?`).then(() => {
console.log('执行了删除逻辑');
this.contractUrl = '';
});
},
getPayerCompanyList() {
listAllCompanyInfo({bindType: 1}).then(resp => {
listAllCompanyInfo({ bindType: 1 }).then(resp => {
if (200 == resp.code) {
this.payerCompanyArr = resp.data
}
......@@ -199,44 +326,51 @@ export default {
this.signContractPanelVisible = false;
},
submitSignForm() {
this.$modal.loading();
this.signForm.contractUrl = "pre";
applySignPreGenFile(this.signForm).then(resp => {
if (200 === resp.code) {
this.$modal.msgSuccess("操作成功!");
this.signContractPanelVisible = true;
this.contractUrl = resp.data;
this.signForm.contractUrl = resp.data;
}else {
this.$modal.msgError(resp.message);
this.$refs.signForm.validate((valid) => {
if (valid) {
this.signPanel = false
this.uploadOnBehalfOfContract = true
// 老方法
// this.$modal.loading();
// this.signForm.contractUrl = "pre";
// applySignPreGenFile(this.signForm).then(resp => {
// if (200 === resp.code) {
// this.$modal.msgSuccess("操作成功!");
// this.signContractPanelVisible = true;
// this.contractUrl = resp.data;
// this.signForm.contractUrl = resp.data;
// } else {
// this.$modal.msgError(resp.message);
// }
// }).catch(() => {
// this.signContractPanelVisible = false;
// this.signPanel = false
// }).finally(() => {
// this.$modal.closeLoading();
// })
}
}).catch(() => {
this.signContractPanelVisible = false;
this.signPanel = false
}).finally(() => {
this.$modal.closeLoading();
})
},
confirmSealContractFile() {
// TODO 确认框
// this.$modal.confirm('是否确认签订合同?').then(() => {
// 添加 loading 提示
this.$modal.loading("正在签订合同,请稍候...");
confirmSignContract(this.signForm).then(response => {
if (response.code === 200) {
this.$modal.msgSuccess("签订合同成功");
this.contractUrl = response.data;
this.signForm.contractUrl = response.data;
this.active = 2;
} else {
this.$modal.msgError("签订合同失败:" + (response.msg || "未知错误"));
}
}).catch(error => {
console.error("签订合同接口调用失败", error);
this.$modal.msgError("签订合同失败,请稍后再试");
}).finally(() => {
this.$modal.closeLoading()
});
// 添加 loading 提示
this.$modal.loading("正在签订合同,请稍候...");
confirmSignContract(this.signForm).then(response => {
if (response.code === 200) {
this.$modal.msgSuccess("签订合同成功");
this.contractUrl = response.data;
this.signForm.contractUrl = response.data;
this.active = 2;
} else {
this.$modal.msgError("签订合同失败:" + (response.msg || "未知错误"));
}
}).catch(error => {
console.error("签订合同接口调用失败", error);
this.$modal.msgError("签订合同失败,请稍后再试");
}).finally(() => {
this.$modal.closeLoading()
});
// }).catch(() => {
// // 用户取消操作
// this.$modal.msgError("已取消签订合同");
......@@ -245,3 +379,36 @@ export default {
},
};
</script>
<style lang="scss" scoped>
.onBehalfOfContractMain ::v-deep {
.uploadFile {
margin-left: 15%;
}
.onBehalfOfContractSubmit {
text-align: center;
// margin: 0 6px;
.el-button {
width: 220px;
font-size: 14px;
margin: 18px 0px 0px;
}
.onBehalfOfContractSubmit {
width: 60px;
font-size: 14px;
}
}
.electronicContractSigning {
text-align: right;
margin-top: 12px;
.electronicContractSigningButton {
font-size: 14px;
}
}
}
</style>
\ No newline at end of file
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 to comment