合同表单PC端修改

product
mhsnet 2 years ago
parent a9e7360e7e
commit 4b99a4f592

@ -2,20 +2,20 @@
<transition name="el-zoom-in-center"> <transition name="el-zoom-in-center">
<div class="JNPF-preview-main"> <div class="JNPF-preview-main">
<div class="JNPF-common-page-header"> <div class="JNPF-common-page-header">
<el-page-header @back="goBack" :content="!dataForm.id ? '新建' : isDetail ? '详情':'编辑'" /> <el-page-header @back="goBack" :content="!dataForm.id ? '新建' : isDetail ? '详情' : '编辑'" />
<div class="options"> <div class="options">
<el-button type="primary" @click="dataFormSubmit()" v-if="!isDetail"> </el-button> <el-button type="primary" @click="dataFormSubmit()" v-if="!isDetail"> </el-button>
<el-button @click="goBack"> </el-button> <el-button @click="goBack"> </el-button>
</div> </div>
</div> </div>
<el-row :gutter="15" class=" main" :style="{margin: '0 auto',width: '100%'}"> <el-row :gutter="15" class=" main" :style="{ margin: '0 auto', width: '100%' }">
<el-form ref="elForm" :model="dataForm" :rules="rules" size="small" label-width="100px" <el-form ref="elForm" :model="dataForm" :rules="rules" size="small" label-width="100px"
label-position="right"> label-position="right">
<template v-if="!loading"> <template v-if="!loading">
<el-col :span="8"> <el-col :span="8">
<el-form-item label="合同类型 " prop="contractType"> <el-form-item label="合同类型 " prop="contractType">
<el-select v-model="dataForm.contractType" placeholder="请选择" clearable <el-select v-model="dataForm.contractType" placeholder="请选择" clearable
:style='{"width":"100%"}'> :style='{ "width": "100%" }'>
<el-option v-for="(item, index) in contractTypeOptions" :key="index" <el-option v-for="(item, index) in contractTypeOptions" :key="index"
:label="item.fullName" :value="item.id" :disabled="item.disabled"></el-option> :label="item.fullName" :value="item.id" :disabled="item.disabled"></el-option>
@ -25,7 +25,7 @@
<el-col :span="8"> <el-col :span="8">
<el-form-item label="合同编码" prop="contractCode"> <el-form-item label="合同编码" prop="contractCode">
<el-input v-model="dataForm.contractCode" placeholder="请输入" clearable <el-input v-model="dataForm.contractCode" placeholder="请输入" clearable
:style='{"width":"100%"}'> :style='{ "width": "100%" }'>
</el-input> </el-input>
</el-form-item> </el-form-item>
@ -33,7 +33,7 @@
<el-col :span="8"> <el-col :span="8">
<el-form-item label="合同名称" prop="contractName"> <el-form-item label="合同名称" prop="contractName">
<el-input v-model="dataForm.contractName" placeholder="请输入" clearable <el-input v-model="dataForm.contractName" placeholder="请输入" clearable
:style='{"width":"100%"}'> :style='{ "width": "100%" }'>
</el-input> </el-input>
</el-form-item> </el-form-item>
@ -41,7 +41,7 @@
<el-col :span="8"> <el-col :span="8">
<el-form-item label="合同状态" prop="status"> <el-form-item label="合同状态" prop="status">
<el-input v-model="dataForm.status" placeholder="请输入" clearable <el-input v-model="dataForm.status" placeholder="请输入" clearable
:style='{"width":"100%"}'> :style='{ "width": "100%" }'>
</el-input> </el-input>
</el-form-item> </el-form-item>
@ -49,7 +49,7 @@
<el-col :span="8"> <el-col :span="8">
<el-form-item label="开标日期" prop="bidOpeningDate"> <el-form-item label="开标日期" prop="bidOpeningDate">
<el-date-picker v-model="dataForm.bidOpeningDate" placeholder="请选择" clearable <el-date-picker v-model="dataForm.bidOpeningDate" placeholder="请选择" clearable
:style='{"width":"100%"}' type="date" format="yyyy-MM-dd" value-format="timestamp"> :style='{ "width": "100%" }' type="date" format="yyyy-MM-dd" value-format="timestamp">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
@ -57,7 +57,7 @@
<el-col :span="8"> <el-col :span="8">
<el-form-item label="开始日期" prop="startDate"> <el-form-item label="开始日期" prop="startDate">
<el-date-picker v-model="dataForm.startDate" placeholder="请选择" clearable <el-date-picker v-model="dataForm.startDate" placeholder="请选择" clearable
:style='{"width":"100%"}' type="date" format="yyyy-MM-dd" value-format="timestamp"> :style='{ "width": "100%" }' type="date" format="yyyy-MM-dd" value-format="timestamp">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
@ -65,7 +65,7 @@
<el-col :span="8"> <el-col :span="8">
<el-form-item label="审核日期" prop="auditDate"> <el-form-item label="审核日期" prop="auditDate">
<el-date-picker v-model="dataForm.auditDate" placeholder="请选择" clearable <el-date-picker v-model="dataForm.auditDate" placeholder="请选择" clearable
:style='{"width":"100%"}' type="date" format="yyyy-MM-dd" value-format="timestamp"> :style='{ "width": "100%" }' type="date" format="yyyy-MM-dd" value-format="timestamp">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
@ -73,7 +73,7 @@
<el-col :span="8"> <el-col :span="8">
<el-form-item label="供货完成日期" prop="completionDate"> <el-form-item label="供货完成日期" prop="completionDate">
<el-date-picker v-model="dataForm.completionDate" placeholder="请选择" clearable <el-date-picker v-model="dataForm.completionDate" placeholder="请选择" clearable
:style='{"width":"100%"}' type="date" format="yyyy-MM-dd" value-format="timestamp"> :style='{ "width": "100%" }' type="date" format="yyyy-MM-dd" value-format="timestamp">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
@ -81,7 +81,7 @@
<el-col :span="8"> <el-col :span="8">
<el-form-item label="关闭日期" prop="closingDate"> <el-form-item label="关闭日期" prop="closingDate">
<el-date-picker v-model="dataForm.closingDate" placeholder="请选择" clearable <el-date-picker v-model="dataForm.closingDate" placeholder="请选择" clearable
:style='{"width":"100%"}' type="date" format="yyyy-MM-dd" value-format="timestamp"> :style='{ "width": "100%" }' type="date" format="yyyy-MM-dd" value-format="timestamp">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
@ -92,13 +92,14 @@
:style='{"width":"100%"}'> :style='{"width":"100%"}'>
</el-input> --> </el-input> -->
<el-input-number v-model="dataForm.collectionCycle" :min="0" label="请输入" :style='{"width":"100%"}'></el-input-number> <el-input-number v-model="dataForm.collectionCycle" :min="0" label="请输入"
:style='{ "width": "100%" }'></el-input-number>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="签订日期" prop="signingDate"> <el-form-item label="签订日期" prop="signingDate">
<el-date-picker v-model="dataForm.signingDate" placeholder="请选择" clearable <el-date-picker v-model="dataForm.signingDate" placeholder="请选择" clearable
:style='{"width":"100%"}' type="date" format="yyyy-MM-dd" value-format="timestamp"> :style='{ "width": "100%" }' type="date" format="yyyy-MM-dd" value-format="timestamp">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
@ -106,29 +107,58 @@
<el-col :span="8"> <el-col :span="8">
<el-form-item label="截止日期" prop="endDate"> <el-form-item label="截止日期" prop="endDate">
<el-date-picker v-model="dataForm.endDate" placeholder="请选择" clearable <el-date-picker v-model="dataForm.endDate" placeholder="请选择" clearable
:style='{"width":"100%"}' type="date" format="yyyy-MM-dd" value-format="timestamp"> :style='{ "width": "100%" }' type="date" format="yyyy-MM-dd" value-format="timestamp">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="供应商/客户编" prop="code"> <el-form-item label="供应商/客户" prop="code">
<el-input v-model="dataForm.code" placeholder="请输入" clearable :style='{"width":"100%"}'> <template v-if="dataForm.contractType === '0'">
<popupSelect v-model="dataForm.code" propsValue="id" relationField='supplier_name'
vModel='code' :columnOptions="codeColumnOptions" interfaceId="382494924156735557"
:pageSize="20" placeholder="请选择供应商" type="popup">
</popupSelect>
</template>
<template v-else-if="dataForm.contractType === '1'">
<popupSelect v-model="dataForm.code" propsValue="id" relationField='supplier_nm'
vModel='dataForm.code' :columnOptions="nameColumnOptions"
interfaceId="395936123471343749" :pageSize="20" placeholder="请选择客户" type="popup">
</popupSelect>
</template>
<template v-else>
</template>
</el-form-item>
<!-- <u-form-item label="供应商/客户id" prop="code">
<jnpf-popup-select v-model="dataForm.code" propsValue="id" relationField='fullName'
vModel='dataForm.code' :columnOptions="codeColumnOptions" interfaceId="382494924156735557"
:pageSize="20" placeholder="请选择" type="popup">
</jnpf-popup-select>
</u-form-item> -->
<!-- <el-form-item label="供应商/客户编" prop="code">
<el-input v-model="dataForm.code" placeholder="请输入" clearable :style='{ "width": "100%" }'>
</el-input> </el-input>
</el-form-item> </el-form-item> -->
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="供应商/客户名" prop="name"> <!-- <u-form-item label="供应商/客户id" prop="code">
<el-input v-model="dataForm.name" placeholder="请输入" clearable :style='{"width":"100%"}'> <jnpf-popup-select v-model="dataForm.code" propsValue="id" relationField='fullName'
vModel='dataForm.code' :columnOptions="nameColumnOptions" interfaceId="395936123471343749"
:pageSize="20" placeholder="请选择" type="popup">
</jnpf-popup-select>
</u-form-item> -->
<!-- <el-form-item label="供应商/客户名" prop="name">
<el-input v-model="dataForm.name" placeholder="请输入" clearable :style='{ "width": "100%" }'>
</el-input> </el-input>
</el-form-item> </el-form-item> -->
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="对方合同号" prop="contractNo"> <el-form-item label="对方合同号" prop="contractNo">
<el-input v-model="dataForm.contractNo" placeholder="请输入" clearable <el-input v-model="dataForm.contractNo" placeholder="请输入" clearable
:style='{"width":"100%"}'> :style='{ "width": "100%" }'>
</el-input> </el-input>
</el-form-item> </el-form-item>
@ -136,27 +166,29 @@
<el-col :span="8"> <el-col :span="8">
<el-form-item label="币种 " prop="currency"> <el-form-item label="币种 " prop="currency">
<el-select v-model="dataForm.currency" placeholder="请选择" clearable <el-select v-model="dataForm.currency" placeholder="请选择" clearable
:style='{"width":"100%"}'> :style='{ "width": "100%" }'>
<el-option v-for="(item, index) in currencyOptions" :key="index" <el-option v-for="(item, index) in currencyOptions" :key="index" :label="item.fullName"
:label="item.fullName" :value="item.id" :disabled="item.disabled"></el-option> :value="item.id" :disabled="item.disabled"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="数量" prop="num"> <el-form-item label="数量" prop="num">
<el-input-number v-model="dataForm.num" :min="0" label="请输入" :style='{"width":"100%"}'></el-input-number> <el-input-number v-model="dataForm.num" :min="0" label="请输入"
:style='{ "width": "100%" }'></el-input-number>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="金额" prop="amount"> <el-form-item label="金额" prop="amount">
<el-input v-model="dataForm.amount" placeholder="请输入" clearable :style='{"width":"100%"}'></el-input> <el-input v-model="dataForm.amount" placeholder="请输入" clearable
:style='{ "width": "100%" }'></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="库存组织" prop="organization"> <el-form-item label="库存组织" prop="organization">
<el-input v-model="dataForm.organization" placeholder="请输入" clearable <el-input v-model="dataForm.organization" placeholder="请输入" clearable
:style='{"width":"100%"}'> :style='{ "width": "100%" }'>
</el-input> </el-input>
</el-form-item> </el-form-item>
@ -164,7 +196,7 @@
<el-col :span="16"> <el-col :span="16">
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" placeholder="请输入" clearable <el-input v-model="dataForm.remark" placeholder="请输入" clearable
:style='{"width":"100%"}'> :style='{ "width": "100%" }'>
</el-input> </el-input>
</el-form-item> </el-form-item>
@ -215,13 +247,13 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
--> -->
<!-- <el-col :span="24">--> <!-- <el-col :span="24">-->
<!-- <el-form-item label="集团审批" prop="approval">--> <!-- <el-form-item label="集团审批" prop="approval">-->
<!-- <el-switch v-model="dataForm.approval" :active-value="1" :inactive-value="0">--> <!-- <el-switch v-model="dataForm.approval" :active-value="1" :inactive-value="0">-->
<!-- </el-switch>--> <!-- </el-switch>-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
<!-- </el-col>--> <!-- </el-col>-->
<el-col :span="24"> <el-col :span="24">
<el-tabs v-model="activemdfrsi" tab-position="top" class="mb-20"> <el-tabs v-model="activemdfrsi" tab-position="top" class="mb-20">
<el-tab-pane label="物料明细"> <el-tab-pane label="物料明细">
@ -235,67 +267,75 @@
<el-table-column prop="materialCode" label="物料编码" align="center"> <el-table-column prop="materialCode" label="物料编码" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.materialCode" placeholder="请输入" <el-input v-model="scope.row.materialCode" placeholder="请输入"
clearable :style='{"width":"100%"}'> clearable :style='{ "width": "100%" }'>
</el-input> </el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="materialName" label="物料名称" align="center"> <el-table-column prop="materialName" label="物料名称" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.materialName" placeholder="请输入" <el-input v-model="scope.row.materialName" placeholder="请输入"
clearable :style='{"width":"100%"}'> clearable :style='{ "width": "100%" }'>
</el-input> </el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="specification" label="规格型号" align="center"> <el-table-column prop="specification" label="规格型号" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.specification" placeholder="请输入" <el-input v-model="scope.row.specification" placeholder="请输入"
clearable :style='{"width":"100%"}'> clearable :style='{ "width": "100%" }'>
</el-input> </el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="unit" label="单位 " align="center"> <el-table-column prop="unit" label="单位 " align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.unit" placeholder="请输入" clearable <el-input v-model="scope.row.unit" placeholder="请输入" clearable
:style='{"width":"100%"}'> :style='{ "width": "100%" }'>
</el-input> </el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="num" label="数量" align="center"> <el-table-column prop="num" label="数量" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input-number v-model="scope.row.num" :min="0" label="请输入" :style='{"width":"100%"}'></el-input-number> <el-input-number v-model="scope.row.num" :min="0" label="请输入"
:style='{ "width": "100%" }'></el-input-number>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="price" label="单价" align="center"> <el-table-column prop="price" label="单价" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.price" placeholder="请输入" clearable :style='{"width":"100%"}'></el-input> <el-input v-model="scope.row.price" placeholder="请输入" clearable
:style='{ "width": "100%" }'></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="amount" label="金额" align="center"> <el-table-column prop="amount" label="金额" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.amount" placeholder="请输入" clearable :style='{"width":"100%"}'></el-input> <el-input v-model="scope.row.amount" placeholder="请输入" clearable
:style='{ "width": "100%" }'></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="rate" label="税率 " align="center"> <el-table-column prop="rate" label="税率 " align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-select v-model="scope.row.rate" :min="0" label="请输入" :style='{"width":"100%"}'> <el-select v-model="scope.row.rate" :min="0" label="请输入"
<el-option v-for="(item, index) in rateOptions" :key="index" :label="item.fullName" :value="item.id" :disabled="item.disabled" ></el-option> :style='{ "width": "100%" }'>
</el-select> <el-option v-for="(item, index) in rateOptions" :key="index"
:label="item.fullName" :value="item.id"
:disabled="item.disabled"></el-option>
</el-select>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="notPrice" label="不含税单价" align="center"> <el-table-column prop="notPrice" label="不含税单价" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.notPrice" placeholder="请输入" clearable :style='{"width":"100%"}'></el-input> <el-input v-model="scope.row.notPrice" placeholder="请输入" clearable
:style='{ "width": "100%" }'></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="notAmount" label="不含税金额" align="center"> <el-table-column prop="notAmount" label="不含税金额" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.notAmount" placeholder="请输入" clearable :style='{"width":"100%"}'></el-input> <el-input v-model="scope.row.notAmount" placeholder="请输入" clearable
:style='{ "width": "100%" }'></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="remark" label="备注" align="center"> <el-table-column prop="remark" label="备注" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.remark" placeholder="请输入" clearable <el-input v-model="scope.row.remark" placeholder="请输入" clearable
:style='{"width":"100%"}'> :style='{ "width": "100%" }'>
</el-input> </el-input>
</template> </template>
</el-table-column> </el-table-column>
@ -349,268 +389,296 @@
</transition> </transition>
</template> </template>
<script> <script>
import request from '@/utils/request' import request from '@/utils/request'
import { import {
getDataInterfaceRes getDataInterfaceRes
} from '@/api/systemData/dataInterface' } from '@/api/systemData/dataInterface'
import { import {
getDictionaryDataSelector getDictionaryDataSelector
} from '@/api/systemData/dictionary' } from '@/api/systemData/dictionary'
export default { export default {
components: {}, components: {},
props: [], props: [],
data() { data() {
return { return {
visible: false, codeColumnOptions: [
loading: false, {
isDetail: false, "label": "供应商Code",
dataForm: { "value": "supplier_code"
contractType: "",
contractCode: '',
contractName: '',
status: '',
bidOpeningDate: '',
startDate: '',
auditDate: '',
completionDate: '',
closingDate: '',
collectionCycle: '',
signingDate: '',
endDate: '',
code: '',
name: '',
contractNo: '',
currency: '',
num: '',
amount: '',
organization: '',
remark: '',
classification: '',
declarationDate: '',
deptCode: '',
creatorusername: '',
deptName: '',
approval: 0,
contract_item0List: [],
contract_item1List: [],
}, },
activemdfrsi: '0', {
rules: { "label": "供应商",
contractType: [{ "value": "supplier_name"
required: true,
message: '请选择',
trigger: 'change'
}, ],
contractCode: [{
required: true,
message: '请输入',
trigger: 'blur'
}, ],
contractName: [{
required: true,
message: '请输入',
trigger: 'blur'
}, ],
bidOpeningDate: [{
required: true,
message: '请选择',
trigger: 'change'
}, ],
}, },
currencyOptions: [{ ],
"fullName": "人民币", nameColumnOptions: [
"id": "0" {
}, { "label": "ID",
"fullName": "美元", "value": "id"
"id": "1" },
}, { {
"fullName": "英镑", "label": "客户编码",
"id": "2" "value": "supplier_cd"
}], },
{
contractTypeOptions: [{ "label": "客户名称",
"fullName": "采购合同", "value": "supplier_nm"
"id": "0" },
}, { ],
"fullName": "销售合同", visible: false,
"id": "1" loading: false,
}, isDetail: false,
{ dataForm: {
"fullName": "租赁合同", contractType: "",
"id": "2" contractCode: '',
}, { contractName: '',
"fullName": "仓储合同", status: '',
"id": "3" bidOpeningDate: '',
}, { startDate: '',
"fullName": "运输合同", auditDate: '',
"id": "4" completionDate: '',
}, closingDate: '',
{ collectionCycle: '',
"fullName": "施工合同", signingDate: '',
"id": "5" endDate: '',
} code: '',
], name: '',
rateOptions:[ contractNo: '',
{"fullName":"13","id":"0"}, currency: '',
{"fullName":"9","id":"1"}, num: '',
{"fullName":"6","id":"2"}, amount: '',
{"fullName":"5","id":"3"}, organization: '',
{"fullName":"3","id":"4"}, remark: '',
{"fullName":"0","id":"5"}], classification: '',
} declarationDate: '',
}, deptCode: '',
computed: {}, creatorusername: '',
watch: {}, deptName: '',
created() {}, approval: 0,
mounted() {}, contract_item0List: [],
methods: { contract_item1List: [],
contract_item0Exist() {
let isOk = true;
for (let i = 0; i < this.dataForm.contract_item0List.length; i++) {
const e = this.dataForm.contract_item0List[i];
}
return isOk;
},
contract_item1Exist() {
let isOk = true;
for (let i = 0; i < this.dataForm.contract_item1List.length; i++) {
const e = this.dataForm.contract_item1List[i];
}
return isOk;
},
goBack() {
this.$emit('refresh')
}, },
clearData(data) { activemdfrsi: '0',
for (let key in data) { rules: {
if (data[key] instanceof Array) { contractType: [{
data[key] = []; required: true,
} else if (data[key] instanceof Object) { message: '请选择',
this.clearData(data[key]); trigger: 'change'
} else { },],
data[key] = ""; contractCode: [{
} required: true,
} message: '请输入',
trigger: 'blur'
},],
contractName: [{
required: true,
message: '请输入',
trigger: 'blur'
},],
bidOpeningDate: [{
required: true,
message: '请选择',
trigger: 'change'
},],
}, },
init(id, isDetail) { currencyOptions: [{
this.dataForm.id = id || 0; "fullName": "人民币",
this.visible = true; "id": "0"
this.isDetail = isDetail || false; }, {
this.$nextTick(() => { "fullName": "美元",
this.$refs['elForm'].resetFields(); "id": "1"
if (this.dataForm.id) { }, {
this.loading = true "fullName": "英镑",
request({ "id": "2"
url: '/api/example/ContractFile/' + this.dataForm.id, }],
method: 'get'
}).then(res => { contractTypeOptions: [{
this.dataInfo(res.data) "fullName": "采购合同",
this.loading = false "id": "0"
}); }, {
} else { "fullName": "销售合同",
this.clearData(this.dataForm) "id": "1"
}
});
this.$store.commit('generator/UPDATE_RELATION_DATA', {})
}, },
// {
dataFormSubmit() { "fullName": "租赁合同",
this.$refs['elForm'].validate((valid) => { "id": "2"
if (valid) { }, {
if (!this.contract_item0Exist()) return "fullName": "仓储合同",
if (!this.contract_item1Exist()) return "id": "3"
this.request() }, {
} "fullName": "运输合同",
}) "id": "4"
}, },
request() { {
var _data = this.dataList() "fullName": "施工合同",
if (!this.dataForm.id) { "id": "5"
request({ }
url: '/api/example/ContractFile', ],
method: 'post', rateOptions: [
data: _data { "fullName": "13", "id": "0" },
}).then((res) => { { "fullName": "9", "id": "1" },
this.$message({ { "fullName": "6", "id": "2" },
message: res.msg, { "fullName": "5", "id": "3" },
type: 'success', { "fullName": "3", "id": "4" },
duration: 1000, { "fullName": "0", "id": "5" }],
onClose: () => { }
this.visible = false },
this.$emit('refresh', true) computed: {},
} watch: {
}) 'dataForm.contractType': function (newQuestion, oldQuestion) {
}) this.dataForm.code = '';
}
},
created() { },
mounted() { },
methods: {
contract_item0Exist() {
let isOk = true;
for (let i = 0; i < this.dataForm.contract_item0List.length; i++) {
const e = this.dataForm.contract_item0List[i];
}
return isOk;
},
contract_item1Exist() {
let isOk = true;
for (let i = 0; i < this.dataForm.contract_item1List.length; i++) {
const e = this.dataForm.contract_item1List[i];
}
return isOk;
},
goBack() {
this.$emit('refresh')
},
clearData(data) {
for (let key in data) {
if (data[key] instanceof Array) {
data[key] = [];
} else if (data[key] instanceof Object) {
this.clearData(data[key]);
} else { } else {
data[key] = "";
}
}
},
init(id, isDetail) {
this.dataForm.id = id || 0;
this.visible = true;
this.isDetail = isDetail || false;
this.$nextTick(() => {
this.$refs['elForm'].resetFields();
if (this.dataForm.id) {
this.loading = true
request({ request({
url: '/api/example/ContractFile/' + this.dataForm.id, url: '/api/example/ContractFile/' + this.dataForm.id,
method: 'PUT', method: 'get'
data: _data }).then(res => {
}).then((res) => { this.dataInfo(res.data)
this.$message({ this.loading = false
message: res.msg, });
type: 'success', } else {
duration: 1000, this.clearData(this.dataForm)
onClose: () => {
this.visible = false
this.$emit('refresh', true)
}
})
})
}
},
addcontract_item0List() {
let item = {
materialCode: undefined,
materialName: undefined,
specification: undefined,
unit: undefined,
num: undefined,
price: undefined,
amount: undefined,
rate: undefined,
notPrice: undefined,
notAmount: undefined,
remark: undefined,
}
this.dataForm.contract_item0List.push(item)
},
delcontract_item0List(index) {
this.dataForm.contract_item0List.splice(index, 1);
},
addcontract_item1List() {
let item = {
enclosure: undefined,
}
this.dataForm.contract_item1List.push(item)
},
delcontract_item1List(index) {
this.dataForm.contract_item1List.splice(index, 1);
},
dataList() {
var _data = JSON.parse(JSON.stringify(this.dataForm));
_data.approval = parseInt(_data.approval)
for (let i = 0; i < _data.contract_item0List.length; i++) {
var _list = _data.contract_item0List[i];
}
for (let i = 0; i < _data.contract_item1List.length; i++) {
var _list = _data.contract_item1List[i];
_list.enclosure = JSON.stringify(_list.enclosure)
}
return _data;
},
dataInfo(dataAll) {
let _dataAll = dataAll
_dataAll.approval = parseInt(_dataAll.approval)
for (let i = 0; i < _dataAll.contract_item0List.length; i++) {
var _list = _dataAll.contract_item0List[i];
} }
for (let i = 0; i < _dataAll.contract_item1List.length; i++) { });
var _list = _dataAll.contract_item1List[i]; this.$store.commit('generator/UPDATE_RELATION_DATA', {})
_list.enclosure = JSON.parse(_list.enclosure) },
//
dataFormSubmit() {
this.$refs['elForm'].validate((valid) => {
if (valid) {
if (!this.contract_item0Exist()) return
if (!this.contract_item1Exist()) return
this.request()
} }
this.dataForm = _dataAll })
}, },
request() {
var _data = this.dataList()
if (!this.dataForm.id) {
request({
url: '/api/example/ContractFile',
method: 'post',
data: _data
}).then((res) => {
this.$message({
message: res.msg,
type: 'success',
duration: 1000,
onClose: () => {
this.visible = false
this.$emit('refresh', true)
}
})
})
} else {
request({
url: '/api/example/ContractFile/' + this.dataForm.id,
method: 'PUT',
data: _data
}).then((res) => {
this.$message({
message: res.msg,
type: 'success',
duration: 1000,
onClose: () => {
this.visible = false
this.$emit('refresh', true)
}
})
})
}
},
addcontract_item0List() {
let item = {
materialCode: undefined,
materialName: undefined,
specification: undefined,
unit: undefined,
num: undefined,
price: undefined,
amount: undefined,
rate: undefined,
notPrice: undefined,
notAmount: undefined,
remark: undefined,
}
this.dataForm.contract_item0List.push(item)
},
delcontract_item0List(index) {
this.dataForm.contract_item0List.splice(index, 1);
},
addcontract_item1List() {
let item = {
enclosure: undefined,
}
this.dataForm.contract_item1List.push(item)
},
delcontract_item1List(index) {
this.dataForm.contract_item1List.splice(index, 1);
},
dataList() {
var _data = JSON.parse(JSON.stringify(this.dataForm));
_data.approval = parseInt(_data.approval)
for (let i = 0; i < _data.contract_item0List.length; i++) {
var _list = _data.contract_item0List[i];
}
for (let i = 0; i < _data.contract_item1List.length; i++) {
var _list = _data.contract_item1List[i];
_list.enclosure = JSON.stringify(_list.enclosure)
}
return _data;
},
dataInfo(dataAll) {
let _dataAll = dataAll
_dataAll.approval = parseInt(_dataAll.approval)
for (let i = 0; i < _dataAll.contract_item0List.length; i++) {
var _list = _dataAll.contract_item0List[i];
}
for (let i = 0; i < _dataAll.contract_item1List.length; i++) {
var _list = _dataAll.contract_item1List[i];
_list.enclosure = JSON.parse(_list.enclosure)
}
this.dataForm = _dataAll
}, },
} },
}
</script> </script>

Loading…
Cancel
Save