factory_mp/pages/srm/paperse_form.vue

219 lines
8.0 KiB
Vue

<!-- 论文申密 -->
<template>
<view class="container">
<scroll-view scroll-y style="padding-bottom: 180rpx;background-color: #fff;">
<uni-forms v-model="form" label-width="180upx" ref="customForm" :rules="customRules">
<ticketd :ticket_="form.ticket_"></ticketd>
<uni-forms-item label="拟发表论文名称" required name="name">
<uni-easyinput v-model="form.paper_name" placeholder="请输入拟发表论文名称" v-if="mode!='show'"/>
<text v-else>{{form.paper_name}}</text>
</uni-forms-item>
<uni-forms-item label="申请部门" required name="organization">
<uni-easyinput v-model="form.organization" placeholder="请输入申请部门" v-if="mode!='show'"/>
<text v-else>{{form.organization}}</text>
</uni-forms-item>
<uni-forms-item label="拟投期刊名称" required name="publication_name">
<uni-easyinput v-model="form.publication_name" placeholder="请输入拟投期刊名称" v-if="mode!='show'"/>
<text v-else>{{form.publication_name}}</text>
</uni-forms-item>
<uni-forms-item label="作者" required>
<uni-easyinput v-model="form.author" placeholder="作者" v-if="mode!='show'"/>
<text v-else>{{form.author}}</text>
</uni-forms-item>
<uni-forms-item label="拟发表文章类型">
<uni-data-checkbox v-model="form.paper_type" :localdata="hobby" :disabled="mode=='show'"></uni-data-checkbox>
</uni-forms-item>
<uni-forms-item label="是否为中文核心">
<uni-data-checkbox v-model="form.is_chinese_core" :localdata="hobby2" :disabled="mode=='show'"></uni-data-checkbox>
</uni-forms-item>
<uni-forms-item label="是否被SCI/EI收录">
<uni-data-checkbox v-model="form.is_sci" :localdata="hobby3" :disabled="mode=='show'"></uni-data-checkbox>
</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" :disabled="mode=='show'" style="padding-left:180upx;"></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:175upx;width:80%"></xtUpload>
<filePreview v-else :filePath="item[0].file" style="padding-left:175upx;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" :disabled="mode=='show'" style="padding-left:180upx;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_paperse'" :title="'论文申密'" :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:{
paper_name:"",
author:"",
organization:"",
publication_name:"",
paper_type:"",
is_chinese_core:false,
is_sci:false,
tech_status:[],
tech_file:[],
},
type:0,
hobby: [
{text: '研究论文',value: '研究论文'},
{text: '综述',value: '综述'},
],
hobby2:[
{text: '是',value: true},
{text: '否',value: false},
],
hobby3: [
{text: '是',value: true},
{text: '否',value: false},
],
hobby4: [
[{text: '是否进行过科技成果鉴定',value: '是',checked:false,status:[],file:'',files:[]}],
[{text: '是否发表过文章',value: '是',checked:false,status:[],file:'',files:[]}],
[{text: '是否参与过展会展出',value: '是',checked:false,status:[],file:'',files:[]}],
[{text: '是否参与应用于生产/销售',value: '是',checked:false,status:[],file:'',files:[]}],
[{text: '是否参与过技术交流',value: '是',checked:false,status:[],file:'',files:[]}],
],
hobby5: [// 发明专利、实用新型专利申请提供:
[{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.paperseItem(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}
that.hobby5[index2][0].pages = item2.pages;
that.hobby5[index2][0].checked = item2.checked;
that.hobby5[index2][0].name=[];
if(item2.checked){
that.hobby5[index2][0].name.push(item2.name);
}
})
if(that.form.ticket_&&that.form.ticket_.state_&&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:{
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);
})
let res = await that.$api.paperseCreate(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>