Browse Source

成果接口

master
lucky 4 years ago
parent
commit
11ecff6885
  1. 105
      src/components/Development/Detail.vue
  2. 628
      src/components/Development/DevelopmentAdd.vue
  3. 739
      src/components/Development/DevelopmentEdit.vue
  4. 105
      src/components/Development/mixins/addMixin.js

105
src/components/Development/Detail.vue

@ -16,69 +16,79 @@
</div>
<div class="d-flex flex-nowrap mb-3">
<div class="flex-1">
<span class="font-bold-14">所属领域1</span>
<span class="font-bold-14">所属领域</span>
{{ record.info.domainone }}
</div>
<div class="flex-1">
<span class="font-bold-14">所属领域2</span>
{{ record.info.domaintwo }}
<span
v-if="record.info.domaintwo"
>/ {{ record.info.domaintwo }}</span>
</div>
<div class="flex-1">
<span class="font-bold-14">知识产权</span>
{{ record.info.finance }}
</div>
<div class="flex-1">
<span class="font-bold-14">转让收入</span>
{{ record.info.income }}万元
</div>
</div>
<div class="d-flex flex-nowrap mb-3">
<div class="flex-1">
<span class="font-bold-14">转让收入</span>
{{ record.info.money }}万元
<span class="font-bold-14">成果阶段</span>
{{ record.info.stage }}
</div>
<div class="flex-1">
<span class="font-bold-14">分类类型</span>
<span :key="a" v-for="(type,a) in record.info.names">
{{ type }}
<span v-if="a < record.info.names.length-1">/</span>
</span>
<span class="font-bold-14">成果标准</span>
{{ record.info.standard }}
</div>
<div class="flex-1">
<span class="font-bold-14">成果水平</span>
{{ record.info.keywordthree }}
{{ record.info.level }}
</div>
</div>
<div class="d-flex flex-nowrap mb-3">
<div class="flex-1">
<span class="font-bold-14">关键词1</span>
{{ record.info.keywordone }}
<span class="font-bold-14">分类类型</span>
<span :key="a" v-for="(type,a) in record.info.names">
{{ type }}
<span v-if="a < record.info.names.length-1">/</span>
</span>
</div>
<div class="flex-1">
<span class="font-bold-14">关键词2</span>
{{ record.info.keywordtwo }}
<span class="font-bold-14">关键词</span>
{{ record.info.keywordone }}
<span
v-if="record.info.keywordone"
>/ {{ record.info.keywordone }}</span>
<span v-if="record.info.keywordthree">/ {{ record.info.keywordthree }}</span>
</div>
<div class="flex-1">
<span class="font-bold-14">关键词3</span>
{{ record.info.keywordthree }}
<span class="font-bold-14">专利数</span>
{{ record.info.nums }}
</div>
</div>
<div class="d-flex flex-nowrap mb-3">
<div class="flex-1">
<span class="font-bold-14">转让形式</span>
{{ record.info.keywordthree }}
</div>
<div class="flex-1">
<span class="font-bold-14">专利数</span>
{{ record.info.keywordthree }}
<span class="font-bold-14">专利名称</span>
{{ record.info.registerName }}
</div>
<div class="flex-1">
<span class="font-bold-14">专利情况</span>
{{ record.info.patent }}
</div>
<div class="flex-1">
<span class="font-bold-14">专利号</span>
{{ record.info.registerNum }}
</div>
</div>
<div class="d-flex flex-nowrap mb-3">
<div class="flex-1">
<span class="font-bold-14">专利类型</span>
{{ record.info.style }}
</div>
<div class="flex-1">
<span class="font-bold-14">成果表现形式</span>
{{ record.info.performance }}
@ -87,32 +97,27 @@
<span class="font-bold-14">成果范围</span>
{{ record.info.ranges }}
</div>
<div class="flex-1">
<span class="font-bold-14">专利名称</span>
{{ record.info.registerName }}
</div>
</div>
<div class="d-flex flex-nowrap mb-3">
<div class="flex-1">
<span class="font-bold-14">未应用原因1</span>
{{ record.info.reansonone }}
<span class="font-bold-14">转让形式</span>
{{ record.info.layout }}
</div>
<div class="flex-1">
<span class="font-bold-14">未应用原因2</span>
{{ record.info.reansontwo }}
<span class="font-bold-14">未应用原因1</span>
{{ record.info.reansonone }}
<span
v-if="record.info.reansontwo"
>/ {{ record.info.reansontwo }}</span>
</div>
<div class="flex-1">
<span class="font-bold-14">专利号</span>
{{ record.info.registerNum }}
<span class="font-bold-14">实验室名字</span>
{{ record.info.researchName }}
</div>
</div>
<div class="d-flex flex-nowrap mb-3">
<div class="flex-1">
<span class="font-bold-14">实验室名字</span>
{{ record.info.research }}
</div>
<div class="flex-1">
<span class="font-bold-14">研究形式</span>
{{ record.info.shape }}
@ -121,26 +126,10 @@
<span class="font-bold-14">应用状态</span>
{{ record.info.situation }}
</div>
</div>
<div class="d-flex flex-nowrap mb-3">
<div class="flex-1">
<span class="font-bold-14">成果阶段</span>
{{ record.info.stage }}
<span class="font-bold-14">发明人</span>
{{ record.info.inventor }}
</div>
<div class="flex-1">
<span class="font-bold-14">成果标准</span>
{{ record.info.standard }}
</div>
<div class="flex-1">
<span class="font-bold-14">专利类型</span>
{{ record.info.style }}
</div>
</div>
<div class="flex-1 mb-3">
<span class="font-bold-14">发明人</span>
{{ record.info.inventor }}
</div>
<div class="d-flex flex-column mb-3">

628
src/components/Development/DevelopmentAdd.vue

@ -6,53 +6,484 @@
:maskClosable="false"
destroyOnClose
footer
title="添加研发团队"
title="添加成果"
v-model="visible"
width="700px"
>
<a-form :form="form" @submit="handleSubmit">
<!-- 名录 -->
<!-- 成果名称 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="名录"
label="成果名称"
>
<a-input
placeholder="名录"
placeholder="请输入成果名称"
v-decorator="[
'directory',
'name',
{
rules: [
{ required: true, message: '名录不能为空' },
{ whitespace: true, message: '名录不能为空' },
{ max: 140, massage: '名录最多140个字符' },
{ required: true, message: '成果名称不能为空' },
{ whitespace: true, message: '成果名称不能为空' },
{ max: 140, massage: '成果名称最多140个字符' },
],
},
]"
/>
</a-form-item>
<!-- 介绍图片 -->
<!-- 成果水平 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="介绍图片"
label="成果水平"
>
<a-select
placeholder="请选择成果水平"
style="width:100%"
v-decorator="[
'level'
]"
>
<a-select-option :key="type.id" :value="type.id" v-for="type in levels">{{ type.value }}</a-select-option>
</a-select>
</a-form-item>
<!-- 成果范围 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="成果范围"
>
<a-select
placeholder="请选择成果范围"
style="width:100%"
v-decorator="[
'ranges'
]"
>
<a-select-option
:key="type.id"
:value="type.id"
v-for="type in assignments"
>{{ type.value }}</a-select-option>
</a-select>
</a-form-item>
<!-- 成果阶段 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="成果阶段"
>
<a-select
placeholder="请选择成果阶段"
style="width:100%"
v-decorator="[
'stage'
]"
>
<a-select-option :key="type.id" :value="type.id" v-for="type in stages">{{ type.value }}</a-select-option>
</a-select>
</a-form-item>
<!-- 成果表现形式 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="成果表现形式"
>
<a-select
placeholder="请选择成果表现形式"
style="width:100%"
v-decorator="[
'performance'
]"
>
<a-select-option
:key="type.id"
:value="type.id"
v-for="type in performances"
>{{ type.value }}</a-select-option>
</a-select>
</a-form-item>
<!-- 成果标准 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="成果标准"
>
<a-select
placeholder="请选择成果标准"
style="width:100%"
v-decorator="[
'standard'
]"
>
<a-select-option
:key="type.id"
:value="type.id"
v-for="type in standards"
>{{ type.value }}</a-select-option>
</a-select>
</a-form-item>
<!-- 申请人 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="申请人"
>
<a-input
placeholder="请输入申请人"
v-decorator="[
'applicant'
]"
/>
</a-form-item>
<!-- 已转让企业数 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="已转让企业数"
>
<a-input
placeholder="请输入已转让企业数"
v-decorator="[
'assignment'
]"
/>
</a-form-item>
<!-- 学科分类 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="学科分类"
>
<a-input
placeholder="请输入学科分类"
v-decorator="[
'classification'
]"
/>
</a-form-item>
<!-- 所属领域 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="所属领域"
>
<a-checkbox-group @change="onChange($event,'domains','domain')">
<a-checkbox
:disabled="item.disabled"
:key="item.id"
:value="item.id"
class="my-2"
v-for="item in domains"
>{{ item.value }}</a-checkbox>
</a-checkbox-group>
</a-form-item>
<!-- 知识产权 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="知识产权"
>
<a-select
placeholder="请选择知识产权"
style="width:100%"
v-decorator="[
'finance'
]"
>
<a-select-option
:key="type.id"
:value="type.id"
v-for="type in finances"
>{{ type.value }}</a-select-option>
</a-select>
</a-form-item>
<!-- 编号 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="编号"
>
<a-input
placeholder="请输入编号"
v-decorator="[
'identifier'
]"
/>
</a-form-item>
<!-- 转让收入 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="转让收入(万元)"
>
<a-input
placeholder="请输入转让收入(万元)"
v-decorator="[
'income'
]"
/>
</a-form-item>
<!-- 发明人 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="发明人"
>
<a-input
placeholder="请输入发明人"
v-decorator="[
'inventor'
]"
/>
</a-form-item>
<!-- 关键词 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="关键词"
>
<div class="d-flex flex-nowrap">
<a-input
class="mr-2"
placeholder="关键词1"
v-decorator="[
'keywordone'
]"
/>
<a-input
class="mr-2"
placeholder="关键词2"
v-decorator="[
'keywordtwo'
]"
/>
<a-input
placeholder="关键词3"
v-decorator="[
'keywordthree'
]"
/>
</div>
</a-form-item>
<!-- 转让形式 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="转让形式"
>
<a-select
placeholder="请选择转让形式"
style="width:100%"
v-decorator="[
'layout'
]"
>
<a-select-option
:key="type.id"
:value="type.id"
v-for="type in layouts"
>{{ type.value }}</a-select-option>
</a-select>
</a-form-item>
<!-- 类型 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="类型"
>
<a-checkbox-group
v-decorator="[
'modelIds',
{
rules: [
{ required: true, message: '类型不能为空' },
],
},
]"
>
<a-checkbox :key="item.id" :value="item.id" v-for="item in typeLists">{{ item.name }}</a-checkbox>
</a-checkbox-group>
</a-form-item>
<!-- 专利数 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="专利数"
>
<a-input
placeholder="请输入专利数"
v-decorator="[
'nums'
]"
/>
</a-form-item>
<!-- 专利情况 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="专利情况"
>
<a-select
placeholder="请选择专利情况"
style="width:100%"
v-decorator="[
'patent'
]"
>
<a-select-option
:key="type.id"
:value="type.id"
v-for="type in patents"
>{{ type.value }}</a-select-option>
</a-select>
</a-form-item>
<!-- 图片 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="图片"
>
<a-upload
:action="upload"
:before-upload="beforeUpload"
:show-upload-list="false"
@change="handleChange"
action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
class="avatar-uploader"
list-type="picture-card"
name="avatar"
list-type="picture"
name="files"
v-decorator="[
'pic',
{
rules: [
{ required: true, message: '图片不能为空' },
],
},
]"
>
<img :src="imageUrl" alt="avatar" v-if="imageUrl" />
<div v-else>
<a-icon :type="loading ? 'loading' : 'plus'" />
<div class="ant-upload-text">Upload</div>
</div>
<a-button v-show="fileList.length - 0 === 0">
<a-icon type="upload" />选择图片
</a-button>
</a-upload>
</a-form-item>
<!-- 未应用原因 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="未应用原因"
>
<a-checkbox-group @change="onChange($event,'reasons','reason')">
<a-checkbox
:disabled="item.disabled"
:key="item.id"
:value="item.id"
class="my-2"
v-for="item in reasons"
>{{ item.value }}</a-checkbox>
</a-checkbox-group>
</a-form-item>
<!-- 专利名称 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="专利名称"
>
<a-input
placeholder="请输入专利名称"
v-decorator="[
'registerName'
]"
/>
</a-form-item>
<!-- 专利号 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="专利号"
>
<a-input
placeholder="请输入专利号"
v-decorator="[
'registerNum'
]"
/>
</a-form-item>
<!-- 所属单位 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="所属单位"
>
<a-select
placeholder="请选择所属单位"
style="width:100%"
v-decorator="[
'research'
]"
>
<a-select-option
:key="index"
:value="type.id"
v-for="(type, index) in types"
>{{ type.name }}</a-select-option>
</a-select>
</a-form-item>
<!-- 研究形式 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="研究形式"
>
<a-select
placeholder="请选择研究形式"
style="width:100%"
v-decorator="[
'shape'
]"
>
<a-select-option :key="type.id" :value="type.id" v-for="type in shapes">{{ type.value }}</a-select-option>
</a-select>
</a-form-item>
<!-- 应用状态 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="应用状态"
>
<a-select
placeholder="请选择应用状态"
style="width:100%"
v-decorator="[
'situation'
]"
>
<a-select-option
:key="type.id"
:value="type.id"
v-for="type in situations"
>{{ type.value }}</a-select-option>
</a-select>
</a-form-item>
<!-- 专利类型 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="专利类型"
>
<a-input
placeholder="请输入专利类型"
v-decorator="[
'style'
]"
/>
</a-form-item>
<!-- 简介 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="简介"
required
>
<quill-editor :max-size="maxSize" :placeholder="placeholder" @changeInput="changeInput" />
</a-form-item>
<a-form-item class="d-flex flex-row-reverse">
<a-button @click="$emit('closeModal')" class="mr-3">取消</a-button>
@ -64,55 +495,105 @@
</template>
<script>
import { upload, selResAdd } from 'config/api';
import { mapActions } from 'vuex';
import QuillEditor from 'components/QuillEditor/QuillEditor.vue';
import addMixin from './mixins/addMixin.js';
const formItemLayout = {
labelCol: { span: 6 },
wrapperCol: { span: 16 },
};
const tailItemLayout = { wrapperCol: { span: 16, offset: 6 } };
function getBase64(img, callback) {
const reader = new FileReader();
reader.addEventListener('load', () => callback(reader.result));
reader.readAsDataURL(img);
}
export default {
name: 'DevelopmentAdd',
props: { visible: { type: Boolean, default: false } },
props: { visible: { type: Boolean, default: false }, typeLists: { type: Array, default: () => [] } },
components: { QuillEditor },
mixins: [addMixin],
data() {
return {
formItemLayout,
tailItemLayout,
form: this.$form.createForm(this, { name: 'development-add' }),
loading: false,
imageUrl: '',
upload: upload,
fileList: [],
//
beforeUpload: file => {
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png';
if (!isJpgOrPng) {
this.$message.error('仅支持 JPG/PNG 格式的图片!');
}
return isJpgOrPng;
},
types: [],
maxSize: 2048,
content: '',
placeholder: '请输入...',
domain: [], //
reason: [], //
};
},
async created() {
const params = {
param: {
pageNum: 1,
pageSize: 10,
model: 2,
},
};
this.types = await this.getSelModelSearch(params);
},
methods: {
...mapActions(['getSelModelSearch']),
//
onChange(checkedValues, arr, type) {
this[type] = checkedValues;
this[arr][checkedValues[0]].disabled = false;
if (checkedValues.length < 2) {
for (let i = 0; i < this[arr].length; i++) {
const item = this[arr][i];
item.disabled = false;
}
}
if (checkedValues.length > 1) {
for (let i = 0; i < this[arr].length; i++) {
const item = this[arr][i];
item.disabled = true;
for (let j = 0; j < checkedValues.length; j++) {
const element = checkedValues[j];
if (item.id === element) {
item.disabled = false;
}
}
}
}
},
//
handleChange(info) {
if (info.file.status === 'uploading') {
this.loading = true;
return;
}
if (info.file.status === 'done') {
// Get this url from response in real world.
getBase64(info.file.originFileObj, imageUrl => {
this.imageUrl = imageUrl;
this.loading = false;
});
this.fileList.push(info.file.response.data[0].id);
} else if (info.file.status === 'removed') {
this.fileList = info.fileList;
}
},
beforeUpload(file) {
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png';
if (!isJpgOrPng) {
this.$message.error('You can only upload JPG file!');
}
const isLt2M = file.size / 1024 / 1024 < 2;
if (!isLt2M) {
this.$message.error('Image must smaller than 2MB!');
//
changeInput(value) {
this.content = value;
},
//
verificationContent() {
if (this.content === '') {
this.$message.error('请输入简介');
return false;
}
return isJpgOrPng && isLt2M;
return true;
},
//
@ -121,20 +602,32 @@ export default {
this.form.validateFieldsAndScroll(async (err, values) => {
if (!err) {
try {
console.log('values: ', values);
// const params = this.generateParams(values);
// const res = await createTask(params);
// const { data, msg, code } = res.data;
// //
// this.clearCreateTask();
// this.$emit('closeDialog');
// if (code === 200) {
// this.handleCreateSuccess(params.executorId);
// } else {
// throw msg;
// }
if (!this.verificationContent()) return;
const { fileList, domain, reason, content } = this;
const params = { param: values };
params.param.pic = fileList[0];
params.param.content = content;
if (domain && domain.length > 0) {
params.param.domainone = domain[0];
params.param.domaintwo = domain[1] ? domain[1] : '';
}
if (reason && reason.length > 0) {
params.param.reansonone = reason[0];
params.param.reansontwo = reason[1] ? reason[1] : '';
}
const res = await selResAdd(params);
const { data, msg, code } = res.data;
//
if (code === 200) {
this.$message.success('添加成功');
this.$emit('handleTableChange');
} else {
throw msg;
}
this.$emit('closeModal');
} catch (error) {
this.$message.error(error || '添加研发团队失败');
this.$emit('closeModal');
this.$message.error(error || '添加成果失败');
}
}
});
@ -143,19 +636,4 @@ export default {
};
</script>
<style scoped lang="stylus">
.avatar-uploader > .ant-upload {
width: 128px;
height: 128px;
}
.ant-upload-select-picture-card i {
font-size: 32px;
color: #999;
}
.ant-upload-select-picture-card .ant-upload-text {
margin-top: 8px;
color: #666;
}
</style>
<style scoped lang="stylus"></style>

739
src/components/Development/DevelopmentEdit.vue

@ -6,53 +6,494 @@
:maskClosable="false"
destroyOnClose
footer
title="修改研发团队"
title="修改成果"
v-model="editVisible"
width="700px"
>
<a-form :form="form" @submit="handleSubmit">
<!-- 名录 -->
<a-form :form="form" @submit="handleSubmit" v-if="editVisible && editItem && editItem.info">
<!-- 成果名称 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="名录"
label="成果名称"
>
<a-input
placeholder="名录"
placeholder="请输入成果名称"
v-decorator="[
'directory',
'name',
{
initialValue: editItem.info.name,
rules: [
{ required: true, message: '名录不能为空' },
{ whitespace: true, message: '名录不能为空' },
{ max: 140, massage: '名录最多140个字符' },
{ required: true, message: '成果名称不能为空' },
{ whitespace: true, message: '成果名称不能为空' },
{ max: 140, massage: '成果名称最多140个字符' },
],
},
]"
/>
</a-form-item>
<!-- 介绍图片 -->
<!-- 成果水平 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="介绍图片"
label="成果水平"
>
<a-select
placeholder="请选择成果水平"
style="width:100%"
v-decorator="[
'level',{initialValue: editItem.info.level}
]"
>
<a-select-option :key="type.id" :value="type.id" v-for="type in levels">{{ type.value }}</a-select-option>
</a-select>
</a-form-item>
<!-- 成果范围 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="成果范围"
>
<a-select
placeholder="请选择成果范围"
style="width:100%"
v-decorator="[
'ranges',{initialValue: editItem.info.ranges}
]"
>
<a-select-option
:key="type.id"
:value="type.id"
v-for="type in assignments"
>{{ type.value }}</a-select-option>
</a-select>
</a-form-item>
<!-- 成果阶段 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="成果阶段"
>
<a-select
placeholder="请选择成果阶段"
style="width:100%"
v-decorator="[
'stage',{initialValue: editItem.info.stage}
]"
>
<a-select-option :key="type.id" :value="type.id" v-for="type in stages">{{ type.value }}</a-select-option>
</a-select>
</a-form-item>
<!-- 成果表现形式 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="成果表现形式"
>
<a-select
placeholder="请选择成果表现形式"
style="width:100%"
v-decorator="[
'performance',{initialValue: editItem.info.performance}
]"
>
<a-select-option
:key="type.id"
:value="type.id"
v-for="type in performances"
>{{ type.value }}</a-select-option>
</a-select>
</a-form-item>
<!-- 成果标准 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="成果标准"
>
<a-select
placeholder="请选择成果标准"
style="width:100%"
v-decorator="[
'standard',{initialValue: editItem.info.standard}
]"
>
<a-select-option
:key="type.id"
:value="type.id"
v-for="type in standards"
>{{ type.value }}</a-select-option>
</a-select>
</a-form-item>
<!-- 申请人 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="申请人"
>
<a-input
placeholder="请输入申请人"
v-decorator="[
'applicant',{initialValue: editItem.info.applicant}
]"
/>
</a-form-item>
<!-- 已转让企业数 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="已转让企业数"
>
<a-input
placeholder="请输入已转让企业数"
v-decorator="[
'assignment',{initialValue: editItem.info.assignment}
]"
/>
</a-form-item>
<!-- 学科分类 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="学科分类"
>
<a-input
placeholder="请输入学科分类"
v-decorator="[
'classification',{initialValue: editItem.info.classification}
]"
/>
</a-form-item>
<!-- 所属领域 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="所属领域"
>
<a-checkbox-group
@change="onChange($event,'domains','domain')"
v-decorator="[
'domain',{initialValue: oldDomain}
]"
>
<a-checkbox
:disabled="item.disabled"
:key="item.id"
:value="item.id"
class="my-2"
v-for="item in domains"
>{{ item.value }}</a-checkbox>
</a-checkbox-group>
</a-form-item>
<!-- 知识产权 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="知识产权"
>
<a-select
placeholder="请选择知识产权"
style="width:100%"
v-decorator="[
'finance',{initialValue: editItem.info.finance}
]"
>
<a-select-option
:key="type.id"
:value="type.id"
v-for="type in finances"
>{{ type.value }}</a-select-option>
</a-select>
</a-form-item>
<!-- 编号 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="编号"
>
<a-input
placeholder="请输入编号"
v-decorator="[
'identifier',{initialValue: editItem.info.identifier}
]"
/>
</a-form-item>
<!-- 转让收入 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="转让收入(万元)"
>
<a-input
placeholder="请输入转让收入(万元)"
v-decorator="[
'income',{initialValue: editItem.info.income}
]"
/>
</a-form-item>
<!-- 发明人 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="发明人"
>
<a-input
placeholder="请输入发明人"
v-decorator="[
'inventor',{initialValue: editItem.info.inventor}
]"
/>
</a-form-item>
<!-- 关键词 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="关键词"
>
<div class="d-flex flex-nowrap">
<a-input
class="mr-2"
placeholder="关键词1"
v-decorator="[
'keywordone',{initialValue: editItem.info.keywordone}
]"
/>
<a-input
class="mr-2"
placeholder="关键词2"
v-decorator="[
'keywordtwo',{initialValue: editItem.info.keywordtwo}
]"
/>
<a-input
placeholder="关键词3"
v-decorator="[
'keywordthree',{initialValue: editItem.info.keywordthree}
]"
/>
</div>
</a-form-item>
<!-- 转让形式 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="转让形式"
>
<a-select
placeholder="请选择转让形式"
style="width:100%"
v-decorator="[
'layout',{initialValue: editItem.info.layout}
]"
>
<a-select-option
:key="type.id"
:value="type.id"
v-for="type in layouts"
>{{ type.value }}</a-select-option>
</a-select>
</a-form-item>
<!-- 类型 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="类型"
>
<a-checkbox-group
v-decorator="[
'modelIds',
{
initialValue: oldTypes ? oldTypes : [],
rules: [
{ required: true, message: '类型不能为空' },
],
},
]"
>
<a-checkbox :key="item.id" :value="item.id" v-for="item in typeLists">{{ item.name }}</a-checkbox>
</a-checkbox-group>
</a-form-item>
<!-- 专利数 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="专利数"
>
<a-input
placeholder="请输入专利数"
v-decorator="[
'nums',{initialValue: editItem.info.nums}
]"
/>
</a-form-item>
<!-- 专利情况 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="专利情况"
>
<a-select
placeholder="请选择专利情况"
style="width:100%"
v-decorator="[
'patent',{initialValue: editItem.info.patent}
]"
>
<a-select-option
:key="type.id"
:value="type.id"
v-for="type in patents"
>{{ type.value }}</a-select-option>
</a-select>
</a-form-item>
<!-- 图片 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="图片"
required
>
<a-upload
:action="upload"
:before-upload="beforeUpload"
:show-upload-list="false"
@change="handleChange"
action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
class="avatar-uploader"
list-type="picture-card"
name="avatar"
list-type="picture"
name="files"
>
<img :src="imageUrl" alt="avatar" v-if="imageUrl" />
<div v-else>
<a-icon :type="loading ? 'loading' : 'plus'" />
<div class="ant-upload-text">Upload</div>
</div>
<a-button v-show="fileList.length - 0 === 0">
<a-icon type="upload" />选择图片
</a-button>
</a-upload>
</a-form-item>
<!-- 未应用原因 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="未应用原因"
>
<a-checkbox-group
@change="onChange($event,'reasons','reason')"
v-decorator="[
'reason',{initialValue: oldReason}
]"
>
<a-checkbox
:disabled="item.disabled"
:key="item.id"
:value="item.id"
class="my-2"
v-for="item in reasons"
>{{ item.value }}</a-checkbox>
</a-checkbox-group>
</a-form-item>
<!-- 专利名称 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="专利名称"
>
<a-input
placeholder="请输入专利名称"
v-decorator="[
'registerName',{initialValue: editItem.info.registerName}
]"
/>
</a-form-item>
<!-- 专利号 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="专利号"
>
<a-input
placeholder="请输入专利号"
v-decorator="[
'registerNum',{initialValue: editItem.info.registerNum}
]"
/>
</a-form-item>
<!-- 所属单位 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="所属单位"
>
<a-select
placeholder="请选择所属单位"
style="width:100%"
v-decorator="[
'research',{initialValue: editItem.info.research}
]"
>
<a-select-option
:key="index"
:value="type.id"
v-for="(type, index) in types"
>{{ type.name }}</a-select-option>
</a-select>
</a-form-item>
<!-- 研究形式 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="研究形式"
>
<a-select
placeholder="请选择研究形式"
style="width:100%"
v-decorator="[
'shape',{initialValue: editItem.info.shape}
]"
>
<a-select-option :key="type.id" :value="type.id" v-for="type in shapes">{{ type.value }}</a-select-option>
</a-select>
</a-form-item>
<!-- 应用状态 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="应用状态"
>
<a-select
placeholder="请选择应用状态"
style="width:100%"
v-decorator="[
'situation',{initialValue: editItem.info.situation}
]"
>
<a-select-option
:key="type.id"
:value="type.id"
v-for="type in situations"
>{{ type.value }}</a-select-option>
</a-select>
</a-form-item>
<!-- 专利类型 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="专利类型"
>
<a-input
placeholder="请输入专利类型"
v-decorator="[
'style',{initialValue: editItem.info.style}
]"
/>
</a-form-item>
<!-- 简介 -->
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="简介"
required
>
<quill-editor
:max-size="maxSize"
:placeholder="placeholder"
:value="editItem.info.content"
@changeInput="changeInput"
/>
</a-form-item>
<a-form-item class="d-flex flex-row-reverse">
<a-button @click="$emit('closeModal')" class="mr-3">取消</a-button>
@ -64,55 +505,164 @@
</template>
<script>
import { upload, selResUpdate } from 'config/api';
import { mapActions } from 'vuex';
import QuillEditor from 'components/QuillEditor/QuillEditor.vue';
import addMixin from './mixins/addMixin.js';
const formItemLayout = {
labelCol: { span: 6 },
wrapperCol: { span: 16 },
};
const tailItemLayout = { wrapperCol: { span: 16, offset: 6 } };
function getBase64(img, callback) {
const reader = new FileReader();
reader.addEventListener('load', () => callback(reader.result));
reader.readAsDataURL(img);
}
export default {
name: 'DevelopmentEdit',
props: { editVisible: { type: Boolean, default: false } },
props: {
editVisible: { type: Boolean, default: false },
editItem: { type: Object, default: () => {} },
typeLists: { type: Array, default: () => [] },
},
components: { QuillEditor },
mixins: [addMixin],
data() {
return {
formItemLayout,
tailItemLayout,
form: this.$form.createForm(this, { name: 'development-add' }),
loading: false,
imageUrl: '',
form: this.$form.createForm(this, { name: 'development-edit' }),
upload: upload,
fileList: [],
//
beforeUpload: file => {
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png';
if (!isJpgOrPng) {
this.$message.error('仅支持 JPG/PNG 格式的图片!');
}
return isJpgOrPng;
},
types: [],
maxSize: 2048,
content: '',
placeholder: '请输入...',
domain: [], //
reason: [], //
};
},
computed: {
oldTypes() {
const { typeLists, editItem } = this;
let arr = [];
for (let i = 0; i < typeLists.length; i++) {
const item = typeLists[i];
const a = editItem.info.names.findIndex(a => a === item.name);
const index = arr.findIndex(c => c === a);
if (a !== -1 && index === -1) {
arr.push(item.id);
}
}
return arr;
},
oldDomain() {
let { domains, editItem } = this;
let arr = [];
for (let i = 0; i < domains.length; i++) {
const item = domains[i];
if (editItem.info.domainone && item.value === editItem.info.domainone) {
arr.push(item.id);
}
if (editItem.info.domaintwo && item.value === editItem.info.domaintwo) {
arr.push(item.id);
}
if (editItem.info.domainone && editItem.info.domaintwo) {
item.disabled = true;
const a = domains.find(a => a.value === editItem.info.domainone);
a.disabled = false;
const b = domains.find(b => b.value === editItem.info.domaintwo);
b.disabled = false;
}
}
this.domain = arr;
return arr;
},
oldReason() {
let { reasons, editItem } = this;
let arr = [];
for (let i = 0; i < reasons.length; i++) {
const item = reasons[i];
if (editItem.info.reansonone && item.value === editItem.info.reansonone) {
arr.push(item.id);
}
if (editItem.info.reansontwo && item.value === editItem.info.reansontwo) {
arr.push(item.id);
}
if (editItem.info.reansonone && editItem.info.reansontwo) {
item.disabled = true;
const a = reasons.find(a => a.value === editItem.info.reansonone);
a.disabled = false;
const b = reasons.find(b => b.value === editItem.info.reansontwo);
b.disabled = false;
}
}
this.reason = arr;
return arr;
},
},
async created() {
const params = {
param: {
pageNum: 1,
pageSize: 10,
model: 2,
},
};
this.types = await this.getSelModelSearch(params);
},
methods: {
...mapActions(['getSelModelSearch']),
//
onChange(checkedValues, arr, type) {
this[type] = checkedValues;
this[arr][checkedValues[0]].disabled = false;
if (checkedValues.length < 2) {
for (let i = 0; i < this[arr].length; i++) {
const item = this[arr][i];
item.disabled = false;
}
}
if (checkedValues.length > 1) {
for (let i = 0; i < this[arr].length; i++) {
const item = this[arr][i];
item.disabled = true;
for (let j = 0; j < checkedValues.length; j++) {
const element = checkedValues[j];
if (item.id === element) {
item.disabled = false;
}
}
}
}
},
//
handleChange(info) {
if (info.file.status === 'uploading') {
this.loading = true;
return;
}
if (info.file.status === 'done') {
// Get this url from response in real world.
getBase64(info.file.originFileObj, imageUrl => {
this.imageUrl = imageUrl;
this.loading = false;
});
this.fileList.push(info.file.response.data[0].id);
} else if (info.file.status === 'removed') {
this.fileList = info.fileList;
}
},
beforeUpload(file) {
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png';
if (!isJpgOrPng) {
this.$message.error('You can only upload JPG file!');
}
const isLt2M = file.size / 1024 / 1024 < 2;
if (!isLt2M) {
this.$message.error('Image must smaller than 2MB!');
}
return isJpgOrPng && isLt2M;
//
changeInput(value) {
this.content = value;
},
//
@ -121,24 +671,89 @@ export default {
this.form.validateFieldsAndScroll(async (err, values) => {
if (!err) {
try {
console.log('values: ', values);
// const params = this.generateParams(values);
// const res = await createTask(params);
// const { data, msg, code } = res.data;
// //
// this.clearCreateTask();
// this.$emit('closeDialog');
// if (code === 200) {
// this.handleCreateSuccess(params.executorId);
// } else {
// throw msg;
// }
const params = this.generateSaveParams(values);
const { fileList, domain, reason, content, editItem } = this;
const { performance, standard, stage, level, ranges, shape, finance, patent, situation, layout } = values;
const condition = { performance, standard, stage, level, ranges, shape, finance, patent, situation, layout };
const editValue = this.verificationParam(condition);
const params = { param: values };
params.param = editValue;
params.param.id = editItem.id;
params.param.pic = fileList[0] ? fileList[0] : editItem.info.picId;
params.param.content = content ? content : editItem.info.content;
console.log('params: ', params);
if (domain && domain.length > 0) {
params.param.domainone = domain[0];
params.param.domaintwo = domain[1] ? domain[1] : '';
}
if (reason && reason.length > 0) {
params.param.reansonone = reason[0];
params.param.reansontwo = reason[1] ? reason[1] : '';
}
const res = await selResAdd(params);
const { data, msg, code } = res.data;
if (code === 200) {
this.$message.success('修改成功');
this.$emit('closeDialog');
} else {
throw msg;
this.$emit('closeDialog');
}
} catch (error) {
this.$message.error(error || '添加研发团队失败');
this.$message.error(error || '修改成果失败');
this.$emit('closeDialog');
}
}
});
},
//
generateSaveParams(condition) {
const { performance, standard, stage, level, ranges, shape, finance, patent, situation, layout } = condition;
const value = {};
if (this.isNumber(performance)) {
value.performance = '';
}
if (this.isNumber(standard)) {
value.standard = '';
}
if (this.isNumber(stage)) {
value.stage = '';
}
if (this.isNumber(level)) {
value.level = '';
}
if (this.isNumber(ranges)) {
value.ranges = '';
}
if (this.isNumber(shape)) {
value.shape = '';
}
if (this.isNumber(finance)) {
value.finance = '';
}
if (this.isNumber(patent)) {
value.patent = '';
}
if (this.isNumber(situation)) {
value.situation = '';
}
if (this.isNumber(layout)) {
value.layout = '';
}
return value;
},
//
isNumber(val) {
var regPos = /^\d+(\.\d+)?$/; //
var regNeg = /^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$/; //
if (regPos.test(val) || regNeg.test(val)) {
return true;
} else {
return false;
}
},
},
};
</script>

105
src/components/Development/mixins/addMixin.js

@ -0,0 +1,105 @@
const mixin = {
data() {
return {
// 成果体现形式
performances: [
{ id: 0, value: '新技术' },
{ id: 1, value: '新工艺' },
{ id: 2, value: '新产品' },
{ id: 3, value: '新材料' },
{ id: 4, value: '新装备' },
{ id: 5, value: '农业、生产新品种' },
{ id: 6, value: '矿产新品种' },
{ id: 7, value: '其他应用技术' },
],
// 成果标准
standards: [
{ id: 0, value: '国际标准' },
{ id: 1, value: '国家标准' },
{ id: 2, value: '行业标准' },
{ id: 3, value: '地方标准' },
{ id: 4, value: '企业标准' },
],
// 成果所属阶段
stages: [
{ id: 0, value: '初期阶段' },
{ id: 1, value: '中期阶段' },
{ id: 2, value: '成熟应用阶段' },
],
// 成果水平
levels: [
{ id: 0, value: '国际领先' },
{ id: 1, value: '国际先进' },
{ id: 2, value: '国内领先' },
{ id: 3, value: '国内先进' },
{ id: 4, value: '区内领先' },
{ id: 5, value: '区内先进' },
{ id: 6, value: '其他' },
],
// 转让范围
assignments: [
{ id: 0, value: '允许出口' },
{ id: 1, value: '限国内转让' },
],
// 研究形式
shapes: [
{ id: 0, value: '独立研究' },
{ id: 1, value: '与企业合作' },
{ id: 2, value: '与院校、院所合作' },
{ id: 3, value: '与国外合作' },
{ id: 4, value: '其他' },
],
// 所属领域 -- 多选(最多选2)
domains: [
{ id: 0, value: '电子信息', disabled: false },
{ id: 1, value: '先进制造', disabled: false },
{ id: 2, value: '航空航天', disabled: false },
{ id: 3, value: '现代交通', disabled: false },
{ id: 4, value: '生物医药', disabled: false },
{ id: 5, value: '新材料', disabled: false },
{ id: 6, value: '新能源', disabled: false },
{ id: 7, value: '环境保护', disabled: false },
{ id: 8, value: '地球、空间与海洋', disabled: false },
{ id: 9, value: '现代农业', disabled: false },
],
// 知识产权形式
finances: [
{ id: 0, value: '发明 专利' },
{ id: 1, value: '实用新型 专利' },
{ id: 2, value: '软件著作权' },
],
// 专利状况
patents: [
{ id: 0, value: '未申请专利' },
{ id: 1, value: '正在申请专利' },
{ id: 2, value: '已授权专利' },
],
// 成果应用状态
situations: [
{ id: 0, value: '稳定应用' },
{ id: 1, value: '应用后停用' },
{ id: 2, value: '未应用' },
],
// 成果转让形式
layouts: [
{ id: 0, value: '产权转让' },
{ id: 1, value: '资金入股' },
{ id: 2, value: '技术入股' },
{ id: 3, value: '合作开发' },
{ id: 4, value: '技术服务' },
{ id: 5, value: '其他' },
],
// 成果未应用或停用原因 -- 多选(最多选2)
reasons: [
{ id: 0, value: '资金问题', disabled: false },
{ id: 1, value: '技术问题', disabled: false },
{ id: 2, value: '市场问题', disabled: false },
{ id: 3, value: '管理问题', disabled: false },
{ id: 4, value: '政策因素', disabled: false },
{ id: 5, value: '其他', disabled: false },
],
};
},
};
export default mixin;
Loading…
Cancel
Save