123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439 |
- <template>
- <div class="app-container" v-loading="loading">
- <el-form ref="form" :model="form" :rules="rules" label-width="180px">
- <h3 class="toolbar">
- <span class="title">项目基本信息</span>
- </h3>
- <el-row :gutter="40">
- <el-col :span="12">
- <el-form-item label="项目名称" prop="projectName">
- <el-input v-model="form.projectName" type="text" placeholder="请输入项目名称" :disabled="disabledVisible"></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="企业名称" prop="entName">
- <el-input v-model="form.entName" type="text" placeholder="请输入企业名称" disabled></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="通讯地址" prop="address">
- <el-input v-model="form.address" placeholder="请输入通讯地址" :disabled="disabledVisible"></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="企业联系人" prop="linkName">
- <el-input v-model="form.linkName" placeholder="请输入企业联系人" :disabled="disabledVisible"></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="联系电话(座机)" prop="linkPhone">
- <el-input v-model="form.linkPhone" type="text" auto-complete="off" placeholder="请输入联系电话(座机)" :disabled="disabledVisible">
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="联系电话(手机)" prop="linkMobile">
- <el-input v-model="form.linkMobile" type="text" auto-complete="off" placeholder="请输入联系电话(手机)" :disabled="disabledVisible">
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="职工总人数(人)" prop="totoalPersons">
- <el-input v-model="form.totoalPersons" type="text" auto-complete="off" placeholder="请输入职工总人数" :disabled="disabledVisible">
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="年度企业销售收入(万元)" prop="sales">
- <el-input v-model="form.sales" type="text" auto-complete="off" placeholder="请输入年度企业销售收入(万元)" :disabled="disabledVisible">
- <template slot="append">万元</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="研发人数" prop="techPersons">
- <el-input v-model="form.techPersons" type="text" auto-complete="off" placeholder="请输入研发人数" :disabled="disabledVisible">
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="年度研发投入(万元)" prop="techInvest">
- <el-input v-model="form.techInvest" type="text" auto-complete="off" placeholder="请输入年度研发投入(万元)" :disabled="disabledVisible">
- <template slot="append">万元</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="占销售收入比例(%)" prop="techRate">
- <el-input v-model="form.techRate" type="text" auto-complete="off" placeholder="请输入占销售收入比例(%)" disabled>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="企业所属行业" prop="industryArray">
- <el-cascader
- v-model="form.industryArray"
- :options="options"
- :disabled="disabledVisible" style="width: 310px;"></el-cascader>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="国家自主创新示范区企业" prop="innovateFlag">
- <el-radio-group v-model="form.innovateFlag" :disabled="disabledVisible">
- <el-radio v-for="(item, index) in yesOrNoOptions" :key="index" :label="item.dictValue">{{item.dictLabel}}</el-radio>
- </el-radio-group>
- </el-form-item>
- </el-col>
- </el-row>
- <h3 class="toolbar">
- <span class="title">项目是否跨年</span>
- </h3>
- <el-row :gutter="40">
- <el-col :span="12">
- <el-form-item label="是否跨年" prop="overYearFlag">
- <el-radio-group v-model="form.overYearFlag" :disabled="disabledVisible">
- <el-radio v-for="(item, index) in yesOrNoOptions" :key="index" :label="item.dictValue">{{item.dictLabel}}</el-radio>
- </el-radio-group>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="项目时间段" prop="projectTime">
- <el-date-picker v-model="form.projectTime" placeholder="选择日期" type="daterange" value-format="yyyy-MM-dd" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :disabled="disabledVisible"></el-date-picker>
- </el-form-item>
- </el-col>
- </el-row>
- <h3 class="toolbar">
- <span class="title">科技型中小企业信息</span>
- </h3>
- <el-row :gutter="40">
- <el-col :span="12">
- <el-form-item label="是否科技型中小企业" prop="smallFlag">
- <el-radio-group v-model="form.smallFlag" :disabled="disabledVisible">
- <el-radio v-for="(item, index) in yesOrNoOptions" :key="index" :label="item.dictValue">{{item.dictLabel}}</el-radio>
- </el-radio-group>
- </el-form-item>
- </el-col>
- </el-row>
- <h3 class="toolbar">
- <span class="title">高新技术企业信息</span>
- </h3>
- <el-row :gutter="40">
- <el-col :span="12">
- <el-form-item label="是否高新技术企业" prop="techFlag">
- <el-radio-group v-model="form.techFlag" :disabled="disabledVisible">
- <el-radio v-for="(item, index) in yesOrNoOptions" :key="index" :label="item.dictValue">{{item.dictLabel}}</el-radio>
- </el-radio-group>
- </el-form-item>
- </el-col>
- <template v-if="form.techFlag == 1">
- <el-col :span="24">
- <el-form-item label="高新技术企业所属技术领域" prop="techScopeArray">
- <el-checkbox-group v-model="form.techScopeArray" :disabled="disabledVisible">
- <el-checkbox v-for="(item, index) in techScopeOptions" :label="item.dictLabel" :key="index">{{item.dictLabel}}</el-checkbox>
- </el-checkbox-group>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item label="证书有效期限" prop="lisenceTime">
- <el-date-picker v-model="form.lisenceTime" placeholder="选择日期" type="daterange" value-format="yyyy-MM" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :disabled="disabledVisible"></el-date-picker>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item label="高新证书" prop="techLicense" ref="techLicenseUpload">
- <FileUpload :file="{url: form.techLicense, name: form.fileName}" @input="handleSuccess" :disabledVisible="disabledVisible">上传证书</FileUpload>
- </el-form-item>
- </el-col>
- </template>
- </el-row>
- <template v-if="userType == 'ENT_TECH' || userType == 'ENT_ADMIN_TECH'">
- <el-row :gutter="40">
- <el-col :span="24">
- <el-form-item style="width:100%;text-align: center;" label-width="0px">
- <el-button @click="synSubmit" size="medium" type="primary">同步企业填报</el-button>
- <el-button :loading="loading" size="medium" type="primary" @click.native.prevent="submitForm" style="width: 100px;">技术保存</el-button>
- <el-button size="medium" type="primary" style="width: 100px;" @click="cancel">取消</el-button>
- <el-button size="medium" type="primary" @click="submitDraft">保存草稿</el-button>
- </el-form-item>
- </el-col>
- </el-row>
- </template>
- </el-form>
- </div>
- </template>
- <script>
- import { editProjectApi,getProjectInfoApi,synTechApi,draftApi } from "@/api/enterprise/project/project"
- import { techScopeOptions,yesOrNoOptions,businessIndustryOptions } from "@/utils/dataFormat"
- import FileUpload from '@/components/FileUpload'
- import { listEntUserApi } from "@/api/ent/ent"
- import { validAmount,validNumber,validPercentage} from '@/utils/validate'
- export default {
- name: "First",
- components: {
- FileUpload
- },
- computed: {
- userType() {
- return this.$store.state.user.userType
- },
- tempVariable() {
- let invest = this.form.techInvest
- let sales = this.form.sales
- return {invest, sales}
- }
- },
- data() {
- return {
- options: businessIndustryOptions,
- disabledVisible: false,
- adminId: undefined,
- techId: undefined,
- finId: undefined,
- serviceDate: [],
- provinceName: '',
- cityName: '',
- districtName: '',
- codeUrl: "",
- techScopeOptions: techScopeOptions,
- yesOrNoOptions: yesOrNoOptions,
- provinceDataList: [],
- cityDataList: [],
- districtDataList: [],
- form: {
- techScopeArray: ['电子信息'],
- lisenceTime: [],
- projectTime: [],
- id: undefined,
- entId: undefined,
- projectOwner: 2,
- techStartDate: '',
- techEndDate: '',
- projectStartDate: '',
- projectEndDate: '',
- industryArray: [],
- industry: ''
- },
- rules: {
- userName: [
- { required: true, trigger: "blur", message: "请输入您的账号" },
- { min: 2, max: 20, message: '用户账号长度必须介于 2 和 20 之间', trigger: 'blur' }
- ],
- password: [
- { required: true, trigger: "blur", message: "请输入您的密码" },
- { min: 5, max: 20, message: '用户密码长度必须介于 5 和 20 之间', trigger: 'blur' }
- ],
- address: [
- { required: true, trigger: "blur", message: "请输入通讯地址" },
- { max: 100, message: '不超过100字符', trigger: 'blur' }
- ],
- linkName: [
- { required: true, trigger: "blur", message: "请输入企业联系人" },
- { max: 100, message: '不超过100字符', trigger: 'blur' }
- ],
- linkPhone: [
- { required: true, trigger: "blur", message: "请输入联系电话(座机)" },
- // { max: 11, message: '请输入正确的电话格式', trigger: 'blur' }
- ],
- linkMobile: [
- { required: true, trigger: "blur", message: "请输入手机号" },
- {
- pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
- message: "请输入正确的手机号码",
- trigger: "blur"
- }
- ],
- totoalPersons: [
- { required: true, trigger: "blur", message: "请输入职工总人数" },
- { validator: validNumber, trigger: 'blur'}
- ],
- sales: [
- { required: true, trigger: "blur", message: "请输入年度企业销售收入(万元)" },
- { validator: validAmount, trigger: 'blur'}
- ],
- techPersons: [
- { required: true, trigger: "blur", message: "请输入研发人数" },
- { validator: validNumber, trigger: 'blur'}
- ],
- techInvest: [
- { required: true, trigger: "blur", message: "请输入年度研发投入(万元)" },
- { validator: validAmount, trigger: 'blur'}
- ],
- techRate: [
- { required: true, trigger: "blur", message: "请输入占销售收入比例(%)" },
- { validator: validPercentage, trigger: 'blur'}
- ],
- industry: [
- { required: true, trigger: "blur", message: "请选择企业所属行业" }
- ],
- innovateFlag: [
- { required: true, trigger: "[blur,change]", message: "请选择国家自主创新示范区企业" }
- ],
- overYearFlag: [
- { required: true, trigger: "change", message: "请选择是否跨年" }
- ],
- smallFlag: [
- { required: true, trigger: "[blur,change]", message: "请选择是否科技型中小企业" }
- ],
- techFlag: [
- { required: true, trigger: "[blur,change]", message: "请选择是否高新技术企业" }
- ],
- techLicense: [
- { required: true, trigger: "change", message: "请上传高新企业证书" }
- ],
- lisenceTime: [
- { required: true, trigger: "change", message: "请选择证书有效期限" }
- ]
- },
- loading: false,
- captchaOnOff: true
- };
- },
- created() {
- this.$nextTick(() => {
- this.$refs.form.clearValidate()
- })
- this.form.id = this.$route.query.id || undefined;
- this.form.entId = this.$route.query.entId || undefined;
- if(this.userType == 'ENT_TECH' || this.userType == 'ENT_ADMIN_TECH') {
- this.disabledVisible = false
- }else {
- this.disabledVisible = true
- }
- if(this.form.id) {
- this.getData().then(res => {
- this.getEntData()
- })
- }
- },
- methods: {
- synSubmit() {
- this.loading = true
- synTechApi(this.adminId).then(res => {
- this.loading = false
- if(res.code == 200) {
- this.$message.success('已同步完成');
- this.getData()
- }
- })
- },
- async getEntData() {
- listEntUserApi().then(res => {
- if(!this.form.entName) {
- this.form.entName = res.data.entName
- }
- if(!this.form.linkName) {
- this.form.linkName = res.data.linkName
- }
- if(!this.form.linkPhone) {
- this.form.linkPhone = res.data.linkPhone
- }
- if(!this.form.linkMobile) {
- this.form.linkMobile = res.data.linkMobile
- }
- if(!this.form.techFlag) {
- this.form.techFlag = res.data.techFlag
- }
- })
- },
- async getData() {
- getProjectInfoApi(this.form.id).then(res => {
- let obj = res.data.techProject || {}
- this.form = obj || {}
- this.adminId = res.data.entProject.id
- this.form.fileName = '高新证书'
- let arr = ['电子信息']
- this.$set(this.form, 'techScopeArray', arr)
- if(obj.techScope) {
- this.form.techScopeArray = obj.techScope.split(',') || ['电子信息']
- }
- if(this.form.industry) {
- let industryArray = this.form.industry.split(',') || [];
- this.$set(this.form, 'industryArray', industryArray);
- }
- if(obj.projectStartDate) {
- this.form.projectTime = []
- this.form.projectTime[0] = obj.projectStartDate
- this.form.projectTime[1] = obj.projectEndDate
- }
- if(obj.techStartDate) {
- this.form.lisenceTime = []
- this.form.lisenceTime[0] = obj.techStartDate
- this.form.lisenceTime[1] = obj.techEndDate
- }
- if(obj.techFlag == 1) {
- this.techVisible = true
- }
- })
- },
- handleSuccess(file) {
- this.$refs.techLicenseUpload.clearValidate()
- this.form.techLicense = file.url;
- this.form.fileName = file.name;
- },
- cancel() {
- this.$store.dispatch("tagsView/delView", this.$route); // 关闭当前tab
- this.$router.go(-1);
- },
- submitForm() {
- this.$refs.form.validate(valid => {
- if(valid) {
- this.loading = true
- this.form.techScope = this.form.techScopeArray.join(',')
- this.form.industry = this.form.industryArray.join(',')
- editProjectApi(this.form).then(res => {
- this.loading = false
- this.$store.dispatch("tagsView/delView", this.$route);
- this.$router.go(-1);
- })
- }
- })
- },
- submitDraft() {
- this.loading = true
- if(this.form.techScopeArray.length > 0) {
- this.form.techScope = this.form.techScopeArray.join(',')
- }
- if(this.form.industryArray.length > 0) {
- this.form.industry = this.form.industryArray.join(',')
- }
- draftApi(this.form).then(res => {
- this.loading = false
- this.$store.dispatch("tagsView/delView", this.$route);
- this.$router.go(-1);
- })
- }
- },
- watch: {
- 'entProjectList': {
- immediate: true,
- handler (val) {
- this.form.entProjectList = this.entProjectList || {}
- }
- },
- 'form.projectTime'(val) {
- if(this.projectTime) {
- this.form.projectStartDate = this.form.projectTime[0]
- this.form.projectEndDate = this.form.projectTime[1]
- }else {
- this.form.projectStartDate = ''
- this.form.projectEndDate = ''
- }
- },
- 'form.lisenceTime'(val) {
- if(this.form.lisenceTime) {
- this.form.techStartDate = this.form.lisenceTime[0]
- this.form.techEndDate = this.form.lisenceTime[1]
- }else {
- this.form.techStartDate = ''
- this.form.techEndDate = ''
- }
- },
- 'tempVariable'(val) {
- if(val.invest && val.sales) {
- this.form.techRate = ((val.invest / val.sales)*100).toFixed(2)
- }
- }
- }
- };
- </script>
|