Commit 56466edf authored by wangxl's avatar wangxl

22222

parent c18a69b4
...@@ -5,6 +5,9 @@ ...@@ -5,6 +5,9 @@
<a-modal v-model="visibleFileView" :title="'[' + fileName + '] 文件查看'" width="1000px" :dialog-style="{ top: '10%' }" :footer="null" destroyOnClose> <a-modal v-model="visibleFileView" :title="'[' + fileName + '] 文件查看'" width="1000px" :dialog-style="{ top: '10%' }" :footer="null" destroyOnClose>
<preview-file v-model="fileUrl" :fileName="fileName"></preview-file> <preview-file v-model="fileUrl" :fileName="fileName"></preview-file>
</a-modal> </a-modal>
<a class="ant-dropdown-link" style="margin-left:6px" :href="fileUrl" :download="fileName">
<a-icon type="download" />
</a>
</div> </div>
</template> </template>
...@@ -17,7 +20,7 @@ export default { ...@@ -17,7 +20,7 @@ export default {
components: { components: {
previewFile previewFile
}, },
data() { data () {
return { return {
visibleFileView: false, visibleFileView: false,
enums: enums, enums: enums,
...@@ -26,13 +29,13 @@ export default { ...@@ -26,13 +29,13 @@ export default {
props: { props: {
fileUrl: { fileUrl: {
type: String, type: String,
default() { default () {
return null; return null;
}, },
}, },
fileName: { fileName: {
type: String, type: String,
default() { default () {
return null; return null;
}, },
}, },
......
<template>
<div v-if="file.downloadUrl" class="file-box">
<div>
<document-view :fileUrl="file.downloadUrl" :fileName="file.fileName" :imageArray="[file.downloadUrl]"></document-view>
</div>
<a-icon type="delete" class="hover-pointer d-icon" @click="deletefile(file)" />
</div>
<div v-else>
<a-form-model-item :prop="name +'.'+ index + '.downloadUrl'" :rules="{required: true, message: '请上传附件',trigger: 'blur',}">
<input type="file" :ref="name +'fileElem' + index" class="visually-hidden" @change="handleFiles(file, index)" />
<a-button @click="fileSelect(index)"><a-icon type="upload" />选择文件</a-button>
</a-form-model-item>
</div>
</template>
<script>
import documentView from '@/views/components/common/documentView'
export default {
name: "FileLoad",
components: {
documentView
},
data () {
return {
};
},
props: {
value: {
type: Object,
default: () => {
return null
}
},
file: {
type: Object,
default: () => {
return null
}
},
name: {
type: String,
default: () => {
return 'fileList'
}
},
index: {
type: Number,
default () {
return 0
},
},
},
created () {
},
methods: {
deletefile (item) {
this.$api.base.deletefile({ id: item.downloadId }).then(({ data = {} }) => {
if (data) {
item.fileName = ''
item.downloadUrl = ''
item.downloadId = ''
}
}).catch(() => {
this.$message.error('删除失败')
})
},
handleFiles (item, index) {
let fileElem = this.$refs[this.name + 'fileElem' + index]
let files = fileElem.files
if (files.length <= 0) {
this.$message.error('未选中文件,请尝试重新选择')
return
}
if (!this.fileCheck(files[0]))
return
this.$api.base.asyncUpload(this.uploadHandle(files[0], files[0].name)).then(({ data = {} }) => {
if (data) {
item.fileName = files[0].name
item.downloadUrl = data.downloadUrl
item.downloadId = data.id
console.log(item, data)
} else
this.$message.error('上传失败')
}).catch(() => {
this.$message.error('上传失败')
})
},
fileCheck (file) {
//判断是否小于1M
let isLtSize = file.size < 1024 * 1024 * 15;
if (!isLtSize) {
this.$message.error('文件大小不能超过15M!');
return false
}
// var fileNames = file.name.split('.')
// var fileType = fileNames[fileNames.length - 1].toLocaleLowerCase()
// var extList = ['doc', 'docx', 'pdf']
// if (!extList.find((item) => item == fileType)) {
// this.$message.error('文件格式错误!')
// return false
// }
return true
},
uploadHandle (file, fileName) {
let formData = new FormData()
formData.append('file', file)
formData.append('fileName', fileName)
return formData
},
fileSelect (index) {
let fileElem = this.$refs[this.name + 'fileElem' + index]
if (fileElem) {
fileElem.click()
}
},
},
watch: {
value: {
handler (value) {
},
}
}
};
</script>
<style scoped lang="less">
.upload-layout {
display: inline-block;
margin: 0 10px;
height: 30px;
line-height: 30px;
.file-box {
display: flex;
justify-content: space-between;
align-items: center;
margin: 0 8px;
> div:nth-child(1) {
max-width: 90%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
.visually-hidden {
display: none !important;
}
}
</style>
<template>
<div>
<a-row>
<a-col :span="24">
<div class="tb-title">
<span>单位科研项目及资金管理制度</span>
</div>
</a-col>
</a-row>
<a-row type="flex" class="item_inner">
<a-col :span="4" class="bg-gray">
<div class="special-middle">
<div class="required">单位政策名称</div>
</div>
</a-col>
<a-col :span="2" class="bg-gray">
<div class="special-middle">
<div class="required">出台日期</div>
</div>
</a-col>
<a-col :span="2" class="bg-gray">
<div class="special-middle">
<div class="required">文号</div>
</div>
</a-col>
<a-col :span="2" class="bg-gray">
<div class="special-middle">
<div class="required">有效期</div>
</div>
</a-col>
<a-col :span="4" class="bg-gray">
<div class="special-middle">
<div class="required">主要内容</div>
</div>
</a-col>
<a-col :span="6" class="bg-gray">
<div class="special-middle">
<div>附件</div>
</div>
</a-col>
<a-col :span="2" class="bg-gray">
<div class="special-middle">
<div>操作</div>
</div>
</a-col>
</a-row>
<a-row v-for="(item, index) in managementRuleList" :key="'managementRuleList'+index" type="flex" class="item_inner">
<a-col :span="4">
<a-form-model-item :prop="'managementRuleList.' + index + '.policyName'" :rules="{ required: true, message: '*', trigger: 'blur',}">
<a-input v-model="item.policyName" :maxLength="100" placeholder="单位政策名称" style="width:85%" />
</a-form-model-item>
</a-col>
<a-col :span="2">
<a-form-model-item :prop="'managementRuleList.' + index + '.releaseDate'" :rules="{ required: true, message: '*', trigger: 'change',}">
<a-date-picker format="YYYY-MM-DD" valueFormat="YYYY-MM-DD HH:mm:ss" placeholder="出台日期" v-model="item.releaseDate" style="width:85%" />
</a-form-model-item>
</a-col>
<a-col :span="2">
<a-form-model-item :prop="'managementRuleList.' + index + '.documentNumber'" :rules="{ required: true, message: '*', trigger: 'blur',}">
<a-input v-model="item.documentNumber" :maxLength="100" placeholder="文号" style="width:85%" />
</a-form-model-item>
</a-col>
<a-col :span="2">
<a-form-model-item :prop="'managementRuleList.' + index + '.validityPeriod'" :rules="{ required: true, message: '*', trigger: 'change',}">
<a-date-picker format="YYYY-MM-DD" valueFormat="YYYY-MM-DD HH:mm:ss" placeholder="有效期" v-model="item.validityPeriod" style="width:85%" />
</a-form-model-item>
</a-col>
<a-col :span="4">
<a-form-model-item :prop="'managementRuleList.' + index + '.mainContent'" :rules="{ required: true, message: '*', trigger: 'blur',}">
<a-input-number v-model="item.mainContent" placeholder="主要内容" :min="0" :step="0.01" style="width:85%" />
</a-form-model-item>
</a-col>
<a-col :span="6">
<div class="special-middle">
<file-load :file.sync="managementRuleList[index]" :index="index" :name="'managementRuleList'" />
</div>
</a-col>
<a-col :span="2">
<div class="special-middle">
<a-popconfirm title="确定要删除吗?" ok-text="确定" cancel-text="取消" @confirm="deleteListItem(item,1)">
<a-button type="link" size="small">删除</a-button>
</a-popconfirm>
</div>
</a-col>
</a-row>
<a-row type="flex">
<a-col :span="24" style="text-align: center">
<div class="special-middle">
<a-button type="dashed" style="width: 20%" @click="addListItem(1)">
<a-icon type="plus" /> 添加 <span style="color:red;margin-left:10px"></span>
</a-button>
</div>
</a-col>
</a-row>
</div>
</template>
<script>
const ManagementRule = { policyName: null, releaseDate: null, documentNumber: null, validityPeriod: null, mainContent: null, fileId: null, downloadId: null, fileName: null, downloadUrl: null }
import { isEmptyParams } from "@/views/utils/common"
import fileLoad from '@/views/components/common/fileLoad'
export default {
name: "managementRuleEdit",
components: {
fileLoad
},
props: {
managementRuleList: {
type: Array,
default: () => {
return [{ ...ManagementRule }]
}
},
},
data () {
return {
};
},
created () {
},
computed: {
},
methods: {
},
};
</script>
<style scoped lang="less">
.file-description {
display: block;
width: 100%;
line-height: 22px;
padding: 3px 3px 3px 3px;
color: red;
white-space: normal;
word-wrap: break-word;
// text-indent: 1em;
}
.inner_from {
.ant-row-flex:last-child .ant-col {
border-bottom: 0;
}
.ant-row-flex .ant-col:first-child {
border-left: 0;
}
.ant-row-flex {
border-right: 0;
}
}
.special-middle {
.font_s {
margin: 0 6px;
}
}
</style>
...@@ -597,6 +597,12 @@ ...@@ -597,6 +597,12 @@
<!-- 经费预算 --> <!-- 经费预算 -->
<budget-edit :budget.sync="formData.budget" /> <budget-edit :budget.sync="formData.budget" />
<!-- 项目课题设置 -->
<project-sub-edit :projectSubList.sync="formData.projectSubList" />
<!-- 单位科研项目及资金管理制度表 -->
<management-rule-edit :managementRuleList.sync="formData.managementRuleList" />
<!-- 附件 --> <!-- 附件 -->
<file-edit :fileList.sync="formData.fileList" /> <file-edit :fileList.sync="formData.fileList" />
</a-form-model> </a-form-model>
...@@ -611,10 +617,14 @@ import baseSelect from '@/views/components/common/baseSelect' ...@@ -611,10 +617,14 @@ import baseSelect from '@/views/components/common/baseSelect'
import ProjGroupMember from '@/views/report/project/components/projGroupMember' import ProjGroupMember from '@/views/report/project/components/projGroupMember'
import cooperativeUnits from '@/views/report/project/components/cooperativeUnits' import cooperativeUnits from '@/views/report/project/components/cooperativeUnits'
import budgetEdit from '@/views/report/project/components/budgetEdit' import budgetEdit from '@/views/report/project/components/budgetEdit'
import projectSubEdit from '@/views/report/project/components/projectSubEdit'
import managementRuleEdit from '@/views/report/project/components/managementRuleEdit'
import fileEdit from '@/views/report/project/components/fileEdit' import fileEdit from '@/views/report/project/components/fileEdit'
import { isEmptyParams } from "@/views/utils/common" import { isEmptyParams } from "@/views/utils/common"
import moment from 'moment' import moment from 'moment'
const ManagementRule = { policyName: null, releaseDate: null, documentNumber: null, validityPeriod: null, mainContent: null, fileId: null, downloadId: null, fileName: null, downloadUrl: null }
const ProjectSub = { projName: null, undertakingUnit: null, address: null, director: null, totalBudget: null, govBudget: null, selfBudget: null, cooperativeUnits: null, fileId: null, downloadId: null, fileName: null, downloadUrl: null }
const Cooperative = { id: null, unitName: null, unitCountry: null, unitAddress: null, organizationCode: null, projectWork: null } const Cooperative = { id: null, unitName: null, unitCountry: null, unitAddress: null, organizationCode: null, projectWork: null }
const Members = { showIndex: 1, name: null, certId: null, sex: null, birthday: null, age: null, degree: null, title: null, duty: null, spec: null, workUnit: null, projWork: null } const Members = { showIndex: 1, name: null, certId: null, sex: null, birthday: null, age: null, degree: null, title: null, duty: null, spec: null, workUnit: null, projWork: null }
const Equipments = { name: null, specificationType: null, quantity: null, totalBudget: null, useFrom: null } const Equipments = { name: null, specificationType: null, quantity: null, totalBudget: null, useFrom: null }
...@@ -623,7 +633,7 @@ const File = { fileName: '', downloadUrl: '', fileExplain: '', downloadId: '' } ...@@ -623,7 +633,7 @@ const File = { fileName: '', downloadUrl: '', fileExplain: '', downloadId: '' }
export default { export default {
name: 'projectEdit', name: 'projectEdit',
components: { components: {
paraMultiSelect, paraSelect, baseSelect, ProjGroupMember, cooperativeUnits,budgetEdit,fileEdit paraMultiSelect, paraSelect, baseSelect, ProjGroupMember, cooperativeUnits, budgetEdit, projectSubEdit, managementRuleEdit, fileEdit
}, },
props: { props: {
value: { value: {
...@@ -695,8 +705,12 @@ export default { ...@@ -695,8 +705,12 @@ export default {
mobile: '', mobile: '',
// 邮箱 // 邮箱
email: '', email: '',
// 成员 // 合作单位
cooperativeUnits: [], cooperativeUnits: [],
// 项目课题设置
projectSubList: [],
// 单位科研项目及资金管理制度表
managementRuleList: [],
// 成员 // 成员
members: [], members: [],
// 投资总额 // 投资总额
...@@ -834,6 +848,10 @@ export default { ...@@ -834,6 +848,10 @@ export default {
} }
}, },
loadList () { loadList () {
if (!!!this.formData.managementRuleList || this.formData.managementRuleList.length == 0)
this.formData.managementRuleList = [{ ...ManagementRule }]
if (!!!this.formData.projectSubList || this.formData.projectSubList.length == 0)
this.formData.projectSubList = [{ ...ProjectSub }]
if (!!!this.formData.cooperativeUnits || this.formData.cooperativeUnits.length == 0) if (!!!this.formData.cooperativeUnits || this.formData.cooperativeUnits.length == 0)
this.formData.cooperativeUnits = [{ ...Cooperative }] this.formData.cooperativeUnits = [{ ...Cooperative }]
if (!!!this.formData.members || this.formData.members.length == 0) if (!!!this.formData.members || this.formData.members.length == 0)
......
<template>
<div>
<a-row>
<a-col :span="24">
<div class="tb-title">
<span>项目课颖设置</span>
</div>
</a-col>
</a-row>
<a-row type="flex" class="item_inner">
<a-col :span="2" class="bg-gray">
<div class="special-middle">
<div class="required">课题名称</div>
</div>
</a-col>
<a-col :span="2" class="bg-gray">
<div class="special-middle">
<div class="required">课题承担单位</div>
</div>
</a-col>
<a-col :span="2" class="bg-gray">
<div class="special-middle">
<div class="required">所在地</div>
</div>
</a-col>
<a-col :span="2" class="bg-gray">
<div class="special-middle">
<div class="required">课颖负责人</div>
</div>
</a-col>
<a-col :span="2" class="bg-gray">
<div class="special-middle">
<div class="required">课题预算总经费</div>
</div>
</a-col>
<a-col :span="2" class="bg-gray">
<div class="special-middle">
<div class="required">其中:省科技经费</div>
</div>
</a-col>
<a-col :span="2" class="bg-gray">
<div class="special-middle">
<div>自筹经费</div>
</div>
</a-col>
<a-col :span="2" class="bg-gray">
<div class="special-middle">
<div>合作单位</div>
</div>
</a-col>
<a-col :span="6" class="bg-gray">
<div class="special-middle">
<div>附件</div>
</div>
</a-col>
<a-col :span="2" class="bg-gray">
<div class="special-middle">
<div>操作</div>
</div>
</a-col>
</a-row>
<a-row v-for="(item, index) in projectSubList" :key="'projectSubList'+index" type="flex" class="item_inner">
<a-col :span="2">
<a-form-model-item :prop="'projectSubList.' + index + '.projName'" :rules="{ required: true, message: '*', trigger: 'blur',}">
<a-input v-model="item.projName" :maxLength="100" placeholder="课题名称" style="width:85%" />
</a-form-model-item>
</a-col>
<a-col :span="2">
<a-form-model-item :prop="'projectSubList.' + index + '.undertakingUnit'" :rules="{ required: true, message: '*', trigger: 'blur',}">
<a-input v-model="item.undertakingUnit" :maxLength="100" placeholder="课题承担单位" style="width:85%" />
</a-form-model-item>
</a-col>
<a-col :span="2">
<a-form-model-item :prop="'projectSubList.' + index + '.address'" :rules="{ required: true, message: '*', trigger: 'blur',}">
<a-input v-model="item.address" :maxLength="100" placeholder="所在地" style="width:85%" />
</a-form-model-item>
</a-col>
<a-col :span="2">
<a-form-model-item :prop="'projectSubList.' + index + '.director'" :rules="{ required: true, message: '*', trigger: 'blur',}">
<a-input v-model="item.director" :maxLength="50" placeholder="课颖负责人" style="width:85%" />
</a-form-model-item>
</a-col>
<a-col :span="2">
<a-form-model-item :prop="'projectSubList.' + index + '.totalBudget'" :rules="{ required: true, message: '*', trigger: 'blur',}">
<a-input-number v-model="item.totalBudget" placeholder="课题预算总经费" :min="0" :step="0.01" style="width:85%" />
</a-form-model-item>
</a-col>
<a-col :span="2">
<a-form-model-item :prop="'projectSubList.' + index + '.govBudget'" :rules="{ required: true, message: '*', trigger: 'blur',}">
<a-input-number v-model="item.govBudget" placeholder="其中:省科技经费" :min="0" :step="0.01" style="width:85%" />
</a-form-model-item>
</a-col>
<a-col :span="2">
<a-form-model-item :prop="'projectSubList.' + index + '.selfBudget'" :rules="{ required: true, message: '*', trigger: 'blur',}">
<a-input-number v-model="item.selfBudget" placeholder="自筹经费" :min="0" :step="0.01" style="width:85%" />
</a-form-model-item>
</a-col>
<a-col :span="2">
<a-form-model-item :prop="'projectSubList.' + index + '.cooperativeUnits'" :rules="{ required: true, message: '*', trigger: 'blur',}">
<a-input v-model="item.cooperativeUnits" :maxLength="100" placeholder="合作单位" style="width:85%" />
</a-form-model-item>
</a-col>
<a-col :span="6">
<div class="special-middle">
<file-load :file.sync="projectSubList[index]" :index="index" :name="'projectSubList'" />
</div>
</a-col>
<a-col :span="2">
<div class="special-middle">
<a-popconfirm title="确定要删除吗?" ok-text="确定" cancel-text="取消" @confirm="deleteListItem(item,1)">
<a-button type="link" size="small">删除</a-button>
</a-popconfirm>
</div>
</a-col>
</a-row>
<a-row type="flex">
<a-col :span="24" style="text-align: center">
<div class="special-middle">
<a-button type="dashed" style="width: 20%" @click="addListItem(1)">
<a-icon type="plus" /> 添加 <span style="color:red;margin-left:10px"></span>
</a-button>
</div>
</a-col>
</a-row>
</div>
</template>
<script>
const ProjectSub = { projName: null, undertakingUnit: null, address: null, director: null, totalBudget: null, govBudget: null, selfBudget: null, cooperativeUnits: null, fileId: null, downloadId: null, fileName: null, downloadUrl: null }
import { isEmptyParams } from "@/views/utils/common"
import fileLoad from '@/views/components/common/fileLoad'
export default {
name: "projectSubEdit",
components: {
fileLoad
},
props: {
projectSubList: {
type: Array,
default: () => {
return [{ ...ProjectSub }]
}
},
},
data () {
return {
};
},
created () {
},
computed: {
},
methods: {
},
};
</script>
<style scoped lang="less">
.file-description {
display: block;
width: 100%;
line-height: 22px;
padding: 3px 3px 3px 3px;
color: red;
white-space: normal;
word-wrap: break-word;
// text-indent: 1em;
}
.inner_from {
.ant-row-flex:last-child .ant-col {
border-bottom: 0;
}
.ant-row-flex .ant-col:first-child {
border-left: 0;
}
.ant-row-flex {
border-right: 0;
}
}
.special-middle {
.font_s {
margin: 0 6px;
}
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment