123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431 |
- <template>
- <div class="app-container">
- <el-form
- :inline="true"
- ref="form"
- :model="form"
- :rules="rules"
- label-width="auto"
- style="margin-top: 20px"
- >
- <el-divider content-position="left">基本信息</el-divider>
- <!-- <el-form-item label="融资产品编号" prop="zfpNumber">
- <el-input v-model="form.zfpNumber" placeholder="请输入融资产品编号" />
- </el-form-item> -->
- <el-row>
- <el-col :span="8">
- <el-form-item
- label="合同模板名称:"
- prop="zfcName"
- >
- <el-input
- v-model="form.zfcName"
- placeholder="请输入合同模板名称"
- maxlength="20"
- /> </el-form-item
- ></el-col>
- <el-col :span="8"
- ><el-form-item
- label="合同类型:"
- prop="zfcType"
- >
- <el-select
- v-model="form.zfcType"
- placeholder="请选择合同类型"
- clearable
- size="small"
- >
- <el-option
- v-for="dict in typeOptions"
- :key="dict.dictValue"
- :label="dict.dictLabel"
- :value="dict.dictValue"
- />
- </el-select> </el-form-item
- ></el-col>
- <el-col :span="8">
- <el-form-item
- label="资金方:"
- prop="zfcManagementId"
- >
- <el-select
- style="width: 95%"
- v-model="form.zfcManagementId"
- filterable
- placeholder="请选择资金方"
- clearable
- size="small"
- >
- <el-option
- v-for="(item, index) in companyList"
- :key="index"
- :label="item.scyName"
- :value="item.scyId"
- />
- </el-select> </el-form-item
- ></el-col>
- </el-row>
- <el-row>
- <el-form-item style="margin-left: 100px" >
- <el-table :data="nodeList" @selection-change="handleSelectionChange" style="width: 500px" >
- <el-table-column
- type="selection"
- width="50"
- align="center"/>
- <el-table-column label="签署节点" align="center" prop="zfcNode" :show-overflow-tooltip="true" >
- </el-table-column>
- <el-table-column label="盖章关键字" align="center" prop="zfcSignKeyword" :show-overflow-tooltip="true">
- <template slot-scope="scope">
- <el-input
- v-model="scope.row.zfcSignKeyword"
- size="small"
- maxlength="200"
- ></el-input>
- </template>
- </el-table-column>
- </el-table>
- </el-form-item
- >
- <!-- <el-col :span="8">
- <el-form-item
- label="签署主体:"
- prop="zfcSubject"
- >
- <el-select
- v-model="form.zfcSubject"
- placeholder="请选择签署主体"
- clearable
- size="small"
- >
- <el-option
- v-for="dict in subjectOptions"
- :key="dict.dictValue"
- :label="dict.dictLabel"
- :value="dict.dictValue"
- />
- </el-select> </el-form-item
- ></el-col>
- <el-col :span="8">
- <el-form-item
- label="签署节点:"
- prop="zfcNode"
- >
- <el-select
- v-model="form.zfcNode"
- placeholder="请选择签署节点"
- clearable
- size="small"
- >
- <el-option
- v-for="dict in nodeOptions"
- :key="dict.dictValue"
- :label="dict.dictLabel"
- :value="dict.dictValue"
- />
- </el-select> </el-form-item
- ></el-col> -->
- </el-row>
- <el-row>
- <el-col :span="16">
- <el-form-item
- label="合同描述:"
- prop="zfcDesc"
-
- >
- <el-input
- type="textarea"
- maxlength="100"
- style="width:250%"
- show-word-limit
- v-model="form.zfcDesc"
- placeholder="请输入合同描述"
- /> </el-form-item
- ></el-col>
- </el-row>
- <!-- 合同模板文件 -->
- <el-divider content-position="left">合同模板文件</el-divider>
- <el-form-item label="合同模板文件" style="margin-left: 100px">
- <el-upload
- ref="upload"
- class="upload-demo"
- action=""
- :http-request="httpRequest"
- :before-remove="beforeRemove"
- accept=".docx"
- multiple
- :limit="1"
- :on-exceed="handleExceed"
- :before-upload="beforeUpload"
- :file-list="fileList"
- :auto-upload="true"
- style="width:800px"
- >
- <el-button slot="trigger" size="small" type="primary"
- >点击选择</el-button
- >
- <!-- <el-button
- style="margin-left: 10px"
- size="small"
- type="success"
- @click="submitUpload"
- >上传到服务器</el-button
- >-->
- </el-upload>
- </el-form-item>
- </el-form>
- <!-- 保存 -->
- <div class="footer" style="margin-top: 260px; float: right">
- <el-button type="info" @click="cancel">取消</el-button>
- <el-button type="success" @click="submitForm">提交</el-button>
- </div>
- </div>
- </template>
- <script>
- import { addContract } from "@/api/service/contract/contract";
- import { listCompany } from "@/api/common/company";
- import { uploadFileNew } from "@/api/common/file";
- import { getToken } from "@/utils/auth";
- export default {
- name: "addContract",
- components: {},
- data() {
- return {
- nodeList:[],
- disabled: true,
- //选中数据
- chooseList: [],
- // 选中数组
- ids: [],
- //附件地址
- fileList:[],
- // 弹出层标题
- title: "",
- invoiceTitle: "",
- // 总条数
- total: 0,
- totalCustomer: 0,
- totalContract: 0,
- totalProject: 0,
- // 是否显示弹出层
- open: false,
- // 资方列表
- companyList: [],
- //合同列表
- contractList: [],
- content: [],
- //发票列表
- typeOptions: [],
- subjectOptions: [],
- nodeOptions: [],
- // 表单参数
- form: {},
- queryParams: {
- pageNum: 1,
- pageSize: 10,
- pifName: null,
- pifId: null,
- pifContractId: null,
- },
- queryParamsInvoice: {
- pageNum: 1,
- pageSize: 10,
- dateTime: [],
- pvfProjectId: null,
- pvfContractId: null,
- pidCode: null,
- pvfTYPE: null,
- pvfInvoiceTitle: null,
- },
- options: [],
- value: [],
- loading: false,
- // 表单校验
- rules: {
- zfcName: [
- {
- required: true,
- message: "合同模板名称",
- trigger: ["blur", "change"],
- },
- ],
- zfcManagementId: [
- {
- required: true,
- message: "资金方不能为空",
- trigger: ["blur", "change"],
- },
- ],
- zfcType: [
- {
- required: true,
- message: "合同类型",
- trigger: ["blur", "change"],
- },
- ],
- zfcSubject: [
- {
- required: true,
- message: "签署主体",
- trigger: ["blur", "change"],
- },
- ],
- },
- };
- },
- created() {
- this.reset();
- this.getCompanyList();
- this.getDicts("zc_zfc_type").then((response) => {
- this.typeOptions = response.data;
- });
- this.getDicts("zc_zfc_node").then((response) => {
- this.nodeOptions = response.data;
- for(let i=0;i<this.nodeOptions.length;i++){
- this.nodeList.push({zfcNode:this.nodeOptions[i].dictLabel,zfcCode:this.nodeOptions[i].dictValue})
- }
- console.log(this.nodeList);
- });
- this.getDicts("zc_zfc_subject").then((response) => {
- this.subjectOptions = response.data;
- });
- },
- activated() {
- this.reset();
- },
- methods: {
- // 上传
-
- /** 查询资方 */
- getCompanyList() {
- const type = "03";
- listCompany(type).then((response) => {
- this.companyList = response.data;
- });
- },
- change(val) {
- if (val <= 14) {
- this.$set(this.form, "zfpShortestPeriod", "14");
- }
- return;
- },
- // 多选框选中数据
- handleSelectionChange(val) {
- this.chooseList = val;
- },
- /** 上传图片 */
- submitUpload() {
- this.$refs.upload.submit();
- },
- //文件移除提示
- beforeRemove(file, fileList) {
- // return this.$confirm(`确定移除 ${file.name}?`);
- for(let i = 0;i< this.fileList.length;i++){
- if(file.uid == this.fileList[i].uid){
- this.fileList.splice(i, 1);
- break;
- }
- }
- },
- handleExceed(files, fileList) {
- this.$message.warning(`当前限制选择 1 个文件`);
- },
- beforeUpload(files){
- var testmsg=files.name.substring(files.name.lastIndexOf('.')+1);
- const extension2 = testmsg === 'docx'
- if(!extension2){
- this.$message.warning(`请选择word文档`);
- }
- return extension2;
- },
- //手动上传文件触发
- httpRequest(param) {
- let fileObj = param.file; // 相当于input里取得的files
- let fd = new FormData(); // FormData 对象
- fd.append("file", fileObj); // 文件对象
- fd.append("fileType", "04"); // 类型:文件
- const loading = this.$loading({
- lock: true,
- text: "Loading",
- spinner: "el-icon-loading",
- background: "rgba(0, 0, 0, 0.7)",
- });
- uploadFileNew(fd).then((response) => {
- if (response) {
- this.fileList.push({name:response.fileName,uid : response.fileId,url:response.url+'/'+getToken()})
- this.msgSuccess("上传成功");
- loading.close();
- }
- }).catch((response) =>{
- if(!response){
- this.$message.warning(`上传失败`);
- }
- loading.close();
- });
- },
-
- // 多选框选中数据
- handleCurrentChange(val) {
- // this.currentRow = val;
- // this.open = false;
- },
- reset() {
- this.form = {
-
- };
- this.resetForm("form");
- },
- /* ---------------------------------------------------------------------- */
- // 取消按钮
- cancel() {
- this.reset();
- this.$store.dispatch("tagsView/delView", this.$route);
- this.$router.go(-1);
- this.open = false;
- },
- /** 保存按钮 */
- submitForm() {
- this.$refs["form"].validate((valid) => {
- this.form.nodeList = this.chooseList;
- if(!this.fileList.length){
- this.$message({
- message: '请上传合同模板!',
- type: 'warning'
- });
- return;
- };
- this.form.zfcFile = this.fileList;
- console.log(this.form);
- if (valid) {
- const loading = this.$loading({
- lock: true,
- text: "Loading",
- spinner: "el-icon-loading",
- background: "rgba(0, 0, 0, 0.7)",
- });
- addContract(this.form)
- .then((response) => {
- loading.close();
- this.msgSuccess("新增成功");
- this.$store.dispatch("tagsView/delView", this.$route);
- this.$router.go(-1);
- })
- .catch((response) => {
- loading.close();
- });
- }
- });
- },
- // submitData() {
- // this.open = false;
- // },
- /* // 将数字金额转换为大写金额 */
- },
- };
- </script>
- <style>
- .single-select-table thead .el-table-column--selection .cell {
- display: none;
- }
- </style>
|