factory_mp/pages/srm/patent_form.vue

237 lines
8.5 KiB
Vue

<!-- 专利申请 -->
<template>
<view class="container">
<scroll-view scroll-y style="padding-bottom: 180rpx;background-color: #fff;">
<uni-forms v-model="form" label-width="150upx" ref="customForm" :rules="customRules">
<ticketd :ticket_="form.ticket_"></ticketd>
<uni-forms-item label="专利名称" required name="name">
<uni-easyinput v-model="form.name" placeholder="请输入专利名称" v-if="mode!='show'"/>
<span v-else>{{form.name}}</span>
</uni-forms-item>
<uni-forms-item label="申请部门" required name="organization">
<uni-easyinput v-model="form.organization" placeholder="请输入申请部门" v-if="mode!='show'"/>
<span v-else>{{form.organization}}</span>
</uni-forms-item>
<uni-forms-item label="发明人" required>
<uni-easyinput v-model="form.author" placeholder="请输入发明人" v-if="mode!='show'"/>
<span v-else>{{form.author}}</span>
</uni-forms-item>
<uni-forms-item label="专利类型" required>
<uni-data-checkbox v-model="form.type" :localdata="hobby" :disabled="mode=='show'"></uni-data-checkbox>
</uni-forms-item>
<uni-forms-item label="是否公开" required>
<uni-data-checkbox v-model="form.is_public" :localdata="hobby2" :disabled="mode=='show'"></uni-data-checkbox>
</uni-forms-item>
<uni-forms-item label="申请地域" required>
<uni-data-checkbox v-model="form.area" :localdata="hobby3" :disabled="mode=='show'"></uni-data-checkbox>
</uni-forms-item>
<uni-forms-item label="" v-if="form.area=='Foreign'|| form.area=='PCT'">
<uni-easyinput v-model="form.other_area" placeholder="请输入申请的国家" v-if="mode!='show'"/>
<span v-else>{{form.other_area}}</span>
</uni-forms-item>
<uni-forms-item label="技术状态"></uni-forms-item>
<template v-for="(item,index) in hobby4">
<uni-data-checkbox multiple v-model="item[0].status" :localdata="item" @change="checkChange" :disabled="mode=='show'" style="padding-left:150upx;"></uni-data-checkbox>
<template v-if="item[0].status.length>0" style="display: flex;justify-content: flex-end;width:80%">
<xtUpload v-if="mode!='show'" v-model="item[0].file" xtype="path" style="padding-left:145upx;width:80%"></xtUpload>
<filePreview v-else :filePath="item[0].file" style="padding-left:145upx;width: 100%;height: 30upx;"></filePreview>
</template>
</template>
<uni-forms-item label="技术文件"></uni-forms-item>
<template v-for="item in hobby5">
<view style="display: flex;margin-bottom: 20upx;">
<uni-data-checkbox multiple v-model="item[0].name" :localdata="item" @change="checkChange" :disabled="mode=='show'" style="padding-left:150upx;flex: none"></uni-data-checkbox>
<uni-number-box v-model="item[0].pages" :disabled="mode=='show'||item[0].name.length<1"></uni-number-box>
</view>
</template>
</uni-forms>
</scroll-view>
<view class="footer_fixed">
<ticketd_b :workflow_key="'wf_patent'" :title="form.name + '-专利审批'" :t_id="form.id" :ticket_="form.ticket_"
@success="submitSuccess" :submit_b_func="submit_b_func" ref="ticketd_b_start"></ticketd_b>
</view>
</view>
</template>
<script>
import ticketd_b from "../wf/ticketd_b.vue"
import ticketd from "../wf/ticketd.vue"
import config from '/utils/config';
import {actStateEnum} from "@/utils/enum.js"
import xtUpload from "@/components/xtUpload.vue"
import filePreview from "@/components/filePreview.vue"
export default {
components: { ticketd_b, ticketd,xtUpload,filePreview },
data(){
return{
mode:"add",
t_id: null,
form:{
name:"",
author:"",
type:"",
is_public:false,
area:"",
other_area:"",
belong_dept:"",
tech_status:[],
tech_file:[],
},
type:0,
hobby: [
{text: '发明专利',value: 'invention'},
{text: '实用新型专利',value: 'utility'},
{text: '外观设计专利',value: 'design'},
],
hobby2:[
{text: '是',value: true},
{text: '否',value: false},
],
hobby3: [
{text: '国内申请',value: 'Domestic'},
{text: '国外申请',value: 'Foreign'},
{text: 'PCT申请',value: 'PCT'},
],
hobby4: [
[{text: '是否进行过科技成果鉴定',value: '是',status:[],file:'',files:[]}],
[{text: '是否发表过文章',value: '是',status:[],file:'',files:[]}],
[{text: '是否参与过展会展出',value: '是',status:[],file:'',files:[]}],
[{text: '是否参与应用于生产/销售',value: '是',status:[],file:'',files:[]}],
[{text: '是否参与过技术交流',value: '是',status:[],file:'',files:[]}],
],
hobby5: [// 发明专利、实用新型专利申请提供:
[{text: '技术背景材料',value: '技术背景材料',pages:0,checked:false, name:[]}],
[{text: '技术交底材料',value: '技术交底材料',pages:0,checked:false,name:[]}],
[{text: '查新检索报告',value: '查新检索报告',pages:0,checked:false,name:[]}],
[{text: '图或者照片',value: '图或者照片',pages:0,checked:false,name:[]}],//外观设计专利申请提供:
],
header:"",
customRules: {
filename: {
rules: [{
required: true,
errorMessage: '姓名不能为空'
}]
},
age: {
rules: [{
required: true,
errorMessage: '年龄不能为空'
}]
},
},
}
},
async onLoad(options) {
let that = this;
that.form.id='';
that.mode = options.mode?options.mode:'show';
that.t_id = options.t_id?options.t_id:null;
that.header = {
Authorization: "Bearer " + uni.getStorageSync('access')
}
if(that.mode != "add"){
if(that.t_id) {
that.form = await that.$api.patentItem(that.t_id);
that.form.tech_status.forEach(item=>{
let index = 0;
if(item.name=='是否进行过科技成果鉴定'){index=0}
else if(item.name=='是否发表过文章'){index=1}
else if(item.name=='是否参与过展会展出'){index=2}
else if(item.name=='是否参与应用于生产/销售'){index=3}
else if(item.name=='是否参与过技术交流'){index=4}
that.hobby4[index][0].file = item.file;
if(item.status=='是'){
that.hobby4[index][0].status.push(item.status)
let obj = {name:item.file,path:item.file};
that.hobby4[index][0].files.push(obj)
}
})
that.form.tech_file.forEach(item2=>{
let index2 = 0;
if(item2.name=='技术背景材料'){index2=0}
else if(item2.name=='技术交底材料'){index2=1}
else if(item2.name=='查新检索报告'){index2=2}
else if(item2.name=='图或者照片'){index2=3}
that.hobby5[index2][0].pages = item2.pages;
that.hobby5[index2][0].checked = item2.checked;
if(item2.checked){
that.hobby5[index2][0].name=[];
that.hobby5[index2][0].name.push(item2.name);
}
})
if(that.form.ticket_.state_.type == 1 && that.form.create_by == uni.getStorageSync("userInfo").id ) {
that.mode = "edit";
}else{
that.mode = "show";
}
}
}
},
mounted() {
this.form.belong_dept = uni.getStorageSync("userInfo").belong_dept;
},
methods:{
checkChange(e){
console.log('e',e)
},
sealChange(){
console.log('seal1',this.seal1)
},
async submit_b_func(id){
let that = this;
console.log('that.form',that.form)
let tech_file = [],tech_status=[];
that.hobby4.forEach(item4=>{
let obj4 = {};
obj4.name = item4[0].text;
obj4.file = item4[0].file?item4[0].file:"";
obj4.status = item4[0].status.length>0?"是":"";
tech_status.push(obj4)
})
that.hobby5.forEach(item5=>{
let obj5 = {};
obj5.name = item5[0].text;
obj5.pages = item5[0].name.length>0?item5[0].pages:"";
obj5.checked = item5[0].name.length>0?true:false;
tech_file.push(obj5)
})
let obj = {};
obj = that.form;
obj.tech_file = tech_file;
obj.tech_status = tech_status;
that.$refs.customForm.validate().then(res => {
}).catch(err => {
console.log('err', err);
})
if (that.mode != 'show') {
if(obj.id) {
await that.$api.patentUpdate(obj.id,obj)
}else{
let res = await that.$api.patentCreate(obj)
that.form.id = res.id;
}
}
},
submitSuccess(){
uni.navigateTo({
url: "/pages/index/index"
})
},
}
}
</script>
<style scoped>
.uni-data-checklist .checklist-group .checklist-box{
margin: 10px 0!important;
}
.flex_file_picker>.uni-file-picker__files{
flex-direction: row;
}
.flex_file_picker{
width: 100%;
flex: none;
}
</style>