|
@@ -9,17 +9,19 @@
|
|
|
<div>
|
|
|
<el-form ref="form" :model="product" :rules="productRules" label-width="200px">
|
|
|
<el-form-item label="标的产品:" prop="productName">
|
|
|
- <el-input v-model="product.productName" v-if="isEdit == 'productName'"></el-input>
|
|
|
- <span @dblclick="changEdit('productName')" v-else>{{ product.productName }}</span>
|
|
|
+ <el-input v-model="product.productName" @change="editChange" @blur="editChange" v-if="isEdit == 'productName' " placeholder="请输入"></el-input>
|
|
|
+ <span @dblclick="changEdit('productName')" placeholder="请输入" v-else>{{ product.productName }}</span>
|
|
|
<!-- <span>{{ product.productName }}</span> -->
|
|
|
</el-form-item>
|
|
|
<el-form-item label="调查标的说明:" prop="productDescription">
|
|
|
- <el-input v-model="product.productDescription" v-if="isEdit == 'productDescription'"></el-input>
|
|
|
- <span @dblclick="changEdit('productDescription')" v-else>{{ product.productDescription }}</span>
|
|
|
+ <el-input type="textarea" v-model="product.productDescription" @change="editChange" @blur="editChange" v-if="isEdit == 'productDescription'" placeholder="请输入"></el-input>
|
|
|
+ <span @dblclick="changEdit('productDescription')" placeholder="请输入" v-else>{{ product.productDescription }}</span>
|
|
|
<!-- <span>{{ product.productDescription }}</span> -->
|
|
|
</el-form-item>
|
|
|
<el-form-item label="调查区域:" prop="surveyArea">
|
|
|
- <span>{{ product.surveyArea }}</span>
|
|
|
+ <el-input type="textarea" v-model="product.surveyArea" @change="editChange" @blur="editChange" v-if="isEdit == 'surveyArea'" placeholder="请输入"></el-input>
|
|
|
+ <span @dblclick="changEdit('surveyArea')" placeholder="请输入" v-else>{{ product.surveyArea}}</span>
|
|
|
+ <!-- <span>{{ product.surveyArea }}</span> -->
|
|
|
</el-form-item>
|
|
|
<el-form-item label="产品图:">
|
|
|
<el-upload ref="upload" action="#" :auto-upload="false" multiple :on-change="handleChangeUpload" list-type="picture" :show-file-list="false">
|
|
@@ -47,19 +49,22 @@
|
|
|
</el-upload>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="检索策略:" prop="searchPolicy">
|
|
|
- <el-input v-model="product.searchPolicy" v-if="isEdit == 'searchPolicy'" placeholder="请输入"></el-input>
|
|
|
+ <el-input v-model="product.searchPolicy" @change="editChange" @blur="editChange" v-if="isEdit == 'searchPolicy'" placeholder="请输入"></el-input>
|
|
|
<span @dblclick="changEdit('searchPolicy')" placeholder="请输入" v-else>{{ product.searchPolicy}}</span>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="检索截止日期:">
|
|
|
+ <el-form-item label="检索截止日期:" prop="deadLine">
|
|
|
<el-date-picker
|
|
|
style="width:100%"
|
|
|
v-model="product.deadLine"
|
|
|
type="date"
|
|
|
- placeholder="选择日期">
|
|
|
+ placeholder="选择日期"
|
|
|
+ @change="isDates">
|
|
|
</el-date-picker>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="关注企业/发明人/技术方向:" v-if="product.focusInformation">
|
|
|
- <span>{{ product.focusInformation }}</span>
|
|
|
+ <el-form-item label="关注企业/发明人/技术方向:">
|
|
|
+ <el-input type="textarea" v-model="product.focusInformation" @change="editChange" @blur="editChange" v-if="isEdit == 'focusInformation'" placeholder="请输入"></el-input>
|
|
|
+ <span @dblclick="changEdit('focusInformation')" placeholder="请输入" v-else>{{ product.focusInformation}}</span>
|
|
|
+ <!-- <span>{{ product.focusInformation }}</span> -->
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</div>
|
|
@@ -74,10 +79,31 @@
|
|
|
|
|
|
<script>
|
|
|
|
|
|
+
|
|
|
export default{
|
|
|
props:['reportId'],
|
|
|
- data() {
|
|
|
- return {
|
|
|
+ data() {
|
|
|
+ const isTime = (rule, value, callback) => {
|
|
|
+ console.log(this.isDate);
|
|
|
+ if (this.isDate) {
|
|
|
+ let a = Date.parse(new Date)
|
|
|
+ let b = Date.parse(value)
|
|
|
+ if (value) {
|
|
|
+ if (b+8.64e7<a) {//8.64e7一天的时间//只适用YYYY-mm-dd格式
|
|
|
+ callback(new Error('禁止选择以前时间,请重新选择'))
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ callback()
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ return {
|
|
|
+ isDate:true,
|
|
|
isEdit:'',//是否编辑
|
|
|
file:[],
|
|
|
dialogImageUrl:[],
|
|
@@ -87,7 +113,10 @@ export default{
|
|
|
productRules:{
|
|
|
name: [{ required: true, message: '请输入标的专利/产品', trigger: 'blur' },],
|
|
|
explain: [{ required: true, message: '请输入调查标的说明', trigger: 'blur' },],
|
|
|
- area: [{ required: true, message: '请输入调查区域', trigger: 'blur' },],
|
|
|
+ area: [{ required: true, message: '请输入调查区域', trigger: 'blur' },],
|
|
|
+ deadLine: [
|
|
|
+ { required: false, validator:isTime, trigger: 'change' }
|
|
|
+ ],
|
|
|
},
|
|
|
Already:[],
|
|
|
}
|
|
@@ -96,10 +125,15 @@ export default{
|
|
|
this.$set(this.product,'productName',this.$s.getSession('row').signPatentNo)
|
|
|
this.getProduct()
|
|
|
},
|
|
|
- methods: {
|
|
|
+ methods: {
|
|
|
+ isDates() {
|
|
|
+ this.isDate=true
|
|
|
+ },
|
|
|
changEdit(val){
|
|
|
- console.log(val)
|
|
|
this.isEdit = val
|
|
|
+ },
|
|
|
+ editChange() {
|
|
|
+ this.isEdit = ''
|
|
|
},
|
|
|
handleChangeUpload(file, fileList) {
|
|
|
if(this.product.reportFiles){
|
|
@@ -175,39 +209,48 @@ export default{
|
|
|
reportId:this.reportId
|
|
|
}
|
|
|
this.$api.getProduct(a).then(response=>{
|
|
|
- if(response.code == 200){
|
|
|
+ if (response.code == 200) {
|
|
|
+ if (this.data.deadLine) {
|
|
|
+ this.isDate=false
|
|
|
+ }
|
|
|
this.product = response.data
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- saveProduct(){
|
|
|
- this.product.reportId = this.reportId
|
|
|
- let formData = new FormData()
|
|
|
- if(this.file.length>0){
|
|
|
- this.file.forEach(item=>{
|
|
|
- formData.append('files', item)
|
|
|
- })
|
|
|
- }
|
|
|
- formData.append('jsons', JSON.stringify(this.product))
|
|
|
- if(this.product.id){
|
|
|
- this.$api.updateProduct(formData).then(response=>{
|
|
|
- if(response.code == 200){
|
|
|
- this.dialogImageUrl = []
|
|
|
- this.file = []
|
|
|
- this.$message.success('产品信息修改成功')
|
|
|
- this.getProduct()
|
|
|
- }
|
|
|
- })
|
|
|
- }else{
|
|
|
- this.$api.addProduct(formData).then(response=>{
|
|
|
- if(response.code == 200){
|
|
|
- this.dialogImageUrl = []
|
|
|
- this.file = []
|
|
|
- this.$message.success('产品信息保存成功')
|
|
|
- this.getProduct()
|
|
|
- }
|
|
|
- })
|
|
|
+ saveProduct() {
|
|
|
+ this.$refs.form.validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ this.editChange()
|
|
|
+ this.product.reportId = this.reportId
|
|
|
+ let formData = new FormData()
|
|
|
+ if(this.file.length>0){
|
|
|
+ this.file.forEach(item=>{
|
|
|
+ formData.append('files', item)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ formData.append('jsons', JSON.stringify(this.product))
|
|
|
+ if(this.product.id){
|
|
|
+ this.$api.updateProduct(formData).then(response=>{
|
|
|
+ if(response.code == 200){
|
|
|
+ this.dialogImageUrl = []
|
|
|
+ this.file = []
|
|
|
+ this.$message.success('产品信息修改成功')
|
|
|
+ this.getProduct()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ this.$api.addProduct(formData).then(response=>{
|
|
|
+ if(response.code == 200){
|
|
|
+ this.dialogImageUrl = []
|
|
|
+ this.file = []
|
|
|
+ this.$message.success('产品信息保存成功')
|
|
|
+ this.getProduct()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
+ })
|
|
|
+
|
|
|
|
|
|
},
|
|
|
},
|