普通项目管理页面;选择企业组件;
This commit is contained in:
@@ -0,0 +1,329 @@
|
||||
<template>
|
||||
<j-modal
|
||||
:title="title"
|
||||
:width="width"
|
||||
:visible="visible"
|
||||
:confirmLoading="confirmLoading"
|
||||
switchFullscreen
|
||||
@ok="handleOk"
|
||||
@cancel="handleCancel"
|
||||
cancelText="关闭">
|
||||
<a-form :form="form">
|
||||
<a-row>
|
||||
<a-col>
|
||||
<a-form-item label="来款项目" :labelCol="remarksLabelCol" :wrapperCol="remarksWrapperCol">
|
||||
<a-input placeholder="请输入项目名称"
|
||||
v-decorator="['chargeProject',validatorRules.chargeProject]"
|
||||
:maxLength='50'
|
||||
@change="e => {e.target.value = (e.target.value + '').trim()}"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :xl="12" :sm="24">
|
||||
<a-form-item label="运行年份" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<j-date show-type="year" date-format="YYYY" placeholder="请选择运行年份"
|
||||
v-decorator="['year',validatorRules.year]"></j-date>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xl="12" :sm="24">
|
||||
<a-form-item label="负责人" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<a-select placeholder="请选择负责人"
|
||||
v-decorator="['principalId',validatorRules.principalId]"
|
||||
:maxLength='50'
|
||||
@change="e => {e.target.value = (e.target.value + '').trim()}">
|
||||
<a-select-option v-for="item in userList" :key="item.id" :value="item.id">{{ item.username }}</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :xl="12" :sm="24">
|
||||
<a-form-item label="来款企业" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<company-select placeholder="请选择来款企业"
|
||||
v-decorator="['chargeCompanyName',validatorRules.chargeCompanyName]"
|
||||
@change="companyChange"
|
||||
:maxLength='50'>
|
||||
</company-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xl="12" :sm="24">
|
||||
<a-form-item label="来款用途" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<j-dict-select-tag v-decorator="['chargeUse',validatorRules.chargeUse]" placeholder="请选择来款用途"
|
||||
dictCode="sex"/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :xl="12" :sm="24">
|
||||
<a-form-item label="联系人" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<a-row>
|
||||
<a-col :span="20">
|
||||
<a-select placeholder="请选择联系人"
|
||||
v-decorator="['contactsId',validatorRules.contactsId]"
|
||||
:maxLength='50'
|
||||
@change="e => {e.target.value = (e.target.value + '').trim()}">
|
||||
<a-select-option v-for="item in userList" :key="item.id" :value="item.id">{{ item.contactsName }}</a-select-option>
|
||||
</a-select>
|
||||
</a-col>
|
||||
<a-col :span="4" class="form-btn">
|
||||
<a-button icon="plus" @click="addContacts"></a-button>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xl="12" :sm="24">
|
||||
<a-form-item label="邮寄联系人" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<a-row>
|
||||
<a-col :span="20">
|
||||
<a-select placeholder="请选择邮寄联系人"
|
||||
v-decorator="['mailContactsId',validatorRules.mailContactsId]"
|
||||
:maxLength='50'
|
||||
@change="e => {e.target.value = (e.target.value + '').trim()}">
|
||||
<a-select-option v-for="item in userList" :key="item.id" :value="item.id">{{ item.mailContactsName }}</a-select-option>
|
||||
</a-select>
|
||||
</a-col>
|
||||
<a-col :span="4" class="form-btn">
|
||||
<a-button icon="plus" @click="addContacts"></a-button>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :xl="12" :sm="24">
|
||||
<a-form-item label="应收金额" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<a-row>
|
||||
<a-col :span="20">
|
||||
<a-input placeholder="请输入应收金额"
|
||||
v-decorator="['receivableAmount',validatorRules.receivableAmount]"
|
||||
:maxLength='50'
|
||||
@change="e => {e.target.value = (e.target.value + '').trim()}"></a-input>
|
||||
</a-col>
|
||||
<a-col :span="1">元</a-col>
|
||||
</a-row>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xl="12" :sm="24">
|
||||
<a-form-item label="需要发票" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<a-select placeholder="请选择发票类型"
|
||||
v-decorator="['invoice',validatorRules.invoice]"
|
||||
:maxLength='50'
|
||||
@change="e => {e.target.value = (e.target.value + '').trim()}">
|
||||
<a-select-option v-for="item in userList" :key="item.id" :value="item.id">{{
|
||||
item.invoice
|
||||
}}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :xl="12" :sm="24">
|
||||
<a-form-item label="来款方式" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<a-radio-group v-decorator="['chargeWay',validatorRules.chargeWay]" @change="handlechargeWayChange">
|
||||
<a-radio :value="1">无</a-radio>
|
||||
<a-radio :value="2">合同</a-radio>
|
||||
<a-radio :value="3">收费通知</a-radio>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xl="12" :sm="24">
|
||||
<a-form-item label="合同号" :labelCol="labelCol" :wrapperCol="wrapperCol" v-show="chargeWayType === 2">
|
||||
<a-input placeholder="请输入合同号"
|
||||
v-decorator="['contractNum',validatorRules.contractNum]"
|
||||
:maxLength='50'
|
||||
@change="e => {e.target.value = (e.target.value + '').trim()}"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row v-show="chargeWayType === 3">
|
||||
<a-col :xl="12" :sm="24">
|
||||
<a-form-item label="收费通知号" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<a-input placeholder="请输入收费通知号"
|
||||
v-decorator="['chargeNoticeNo',validatorRules.chargeNoticeNo]"
|
||||
:maxLength='50'
|
||||
@change="e => {e.target.value = (e.target.value + '').trim()}"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xl="12" :sm="24">
|
||||
<a-form-item label="收费通知" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<j-upload :number="1" file-type="word,pdf" v-decorator="['chargeNoticeId', validatorRules.chargeNoticeId]"
|
||||
:trigger-change="true"></j-upload>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col>
|
||||
<a-form-item label="备注" :labelCol="remarksLabelCol" :wrapperCol="remarksWrapperCol">
|
||||
<a-textarea
|
||||
placeholder="请输入备注"
|
||||
:auto-size="{ minRows: 3, maxRows: 6 }"
|
||||
v-decorator="['remarks']"
|
||||
:maxLength='300'
|
||||
@change="e => {e.target.value = (e.target.value + '').trim()}"/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
<contact-management-module ref="contactForm" is-company-disabled :selected-company="selectedCompany"></contact-management-module>
|
||||
</j-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import pick from 'lodash.pick'
|
||||
import { httpAction } from '@api/manage'
|
||||
import JDate from '@comp/jero/JDate'
|
||||
import JUpload from '@comp/jero/JUpload'
|
||||
import CompanySelect from '@comp/company/CompanySelect'
|
||||
import ContactManagementModule from '@views/businessManagement/modules/ContactManagementModule'
|
||||
|
||||
export default {
|
||||
name: 'GeneralProjectModule',
|
||||
components: { JDate, JUpload, CompanySelect, ContactManagementModule },
|
||||
data() {
|
||||
return {
|
||||
title: '操作',
|
||||
width: 800,
|
||||
visible: false,
|
||||
confirmLoading: false,
|
||||
form: this.$form.createForm(this),
|
||||
model: {},
|
||||
labelCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 6 }
|
||||
},
|
||||
wrapperCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 18 }
|
||||
},
|
||||
remarksLabelCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 3 }
|
||||
},
|
||||
remarksWrapperCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 21 }
|
||||
},
|
||||
validatorRules: {
|
||||
chargeProject: {
|
||||
rules: [{ required: true, message: '请输入项目名称' }]
|
||||
},
|
||||
year: {
|
||||
rules: [{ required: true, message: '请选择运行年份' }]
|
||||
},
|
||||
principalId: {
|
||||
rules: [{ required: true, message: '请选择负责人' }]
|
||||
},
|
||||
chargeCompanyName: {
|
||||
rules: [{ required: true, message: '请选择来款企业' }]
|
||||
},
|
||||
chargeUse: {
|
||||
rules: [{ required: true, message: '请选择来款用途' }]
|
||||
},
|
||||
contactsId: {
|
||||
rules: [{ required: true, message: '请选择联系人' }]
|
||||
},
|
||||
mailContactsId: {
|
||||
rules: [{ required: true, message: '请选择邮寄联系人' }]
|
||||
},
|
||||
receivableAmount: {
|
||||
rules: [{ required: true, message: '请输入应收金额' }]
|
||||
},
|
||||
invoice: {
|
||||
rules: [{ required: true, message: '请选择发票类型' }]
|
||||
},
|
||||
chargeWay: {
|
||||
rules: [{ required: true, message: '请选择来款方式' }]
|
||||
},
|
||||
contractNum: {
|
||||
rules: [{ required: true, message: '请输入合同号' }]
|
||||
},
|
||||
chargeNoticeNo: {
|
||||
rules: [{ required: true, message: '请输入收费通知号' }]
|
||||
}
|
||||
},
|
||||
userList: [], // 用户列表
|
||||
chargeWayType: null,
|
||||
selectedCompany: null
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
add() {
|
||||
this.edit({})
|
||||
},
|
||||
edit(record) {
|
||||
this.form.resetFields()
|
||||
this.model = Object.assign({}, record)
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue(pick(this.model, 'companyName', 'companyAddress', 'companyPhone', 'postalCode', 'bankAccountName', 'openingBank', 'bankAccount', 'dutyCode', 'remarks'))
|
||||
})
|
||||
},
|
||||
close() {
|
||||
this.$emit('close')
|
||||
this.visible = false
|
||||
},
|
||||
handleOk() {
|
||||
const that = this
|
||||
// 触发表单验证
|
||||
this.form.validateFields((err, values) => {
|
||||
if (!err) {
|
||||
let httpurl = ''
|
||||
let method = ''
|
||||
if (!this.model.id) {
|
||||
httpurl += this.url.add
|
||||
method = 'post'
|
||||
} else {
|
||||
httpurl += this.url.edit
|
||||
method = 'put'
|
||||
}
|
||||
const formData = Object.assign(this.model, values)
|
||||
console.log('表单提交数据', formData)
|
||||
httpAction(httpurl, formData, method).then((res) => {
|
||||
if (res.success) {
|
||||
that.$message.success(res.message)
|
||||
that.$emit('ok')
|
||||
that.close()
|
||||
} else {
|
||||
that.$message.warning(res.message)
|
||||
}
|
||||
}).finally(() => {
|
||||
that.confirmLoading = false
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
handleCancel() {
|
||||
this.close()
|
||||
},
|
||||
/**
|
||||
* 来款方式变化
|
||||
* @param e
|
||||
*/
|
||||
handlechargeWayChange(e) {
|
||||
this.chargeWayType = e.target.value
|
||||
},
|
||||
companyChange(value) {
|
||||
console.log('---companyChange---', value)
|
||||
this.selectedCompany = value
|
||||
},
|
||||
addContacts() {
|
||||
if (this.selectedCompany) {
|
||||
this.$refs.contactForm.add()
|
||||
this.$refs.contactForm.title = "新增";
|
||||
this.$refs.contactForm.disableSubmit = false;
|
||||
return
|
||||
}
|
||||
this.$message.warn('请先选择来款企业再为该企业新建联系人')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.form-btn {
|
||||
padding-top: 1px;
|
||||
padding-left: 8px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user