This commit is contained in:
Bob 2020-06-22 15:35:22 +08:00
commit 9601238053
5 changed files with 266 additions and 14 deletions

View File

@ -156,6 +156,7 @@ export default {
},
data () {
return {
username: this.$store.state.token,
arrit: [{
dominantspecieschinese: '',
dominantspecieslatin: ''
@ -303,7 +304,10 @@ export default {
var _this = this
axios({
method: 'get',
url: this.GLOBAL.baseURL + '/management/findings/add/'
url: this.GLOBAL.baseURL + '/management/findings/add/',
data: {
username: this.username
}
}).then(function (response) {
console.log(response)
_this.investigatorsList = response.data.investigators
@ -342,8 +346,9 @@ export default {
}).then(function (response) {
if (response.data.status === '1') {
_this.$alert('添加成功')
} else {
console.log('2222222222222222222' + response.data.message)
} else if (response.data.status === '0') {
// console.log(response.data.message)
_this.$alert(response.data.message)
}
}).catch(function (error) {
alert(error)

View File

@ -246,6 +246,7 @@
<!-- <i class="el-icon-plus"></i>-->
<!-- </el-upload>-->
<el-upload
ref="upload1"
class="upload-mul-img"
:show-file-list="true"
:http-request="uploadSample"
@ -500,8 +501,9 @@ export default {
_this.life_list = response.data.life_choices
if (response.data.status === '1') {
_this.$alert('添加成功')
} else {
console.log('2222222222222222222' + response.data.message)
} else if (response.data.status === '0') {
// console.log(response.data.message)
_this.$alert(response.data.message)
}
}).catch(function (error) {
alert(error)
@ -539,6 +541,52 @@ export default {
console.log(this.chinesename)
},
newit () {
var _this = this
// this.$refs.upload1.submit()
this.count.push({
chinesename: _this.form.chinesename
})
this.stat = 1
console.log('11111')
var textnode = document.getElementsByClassName('wu')[0]
textnode.style.display = 'none'
//
const requestData = this.form
const formData = new FormData()
for (const key in requestData) {
formData.append(key, requestData[key])
}
// arritformdata
// formData.arrit = _this.arrit
// console.log(formData)
for (var i = 0; i < _this.arrit.length; i++) {
for (var key in _this.arrit[i]) {
formData.append(`arrit[${i}][${key}]`, _this.arrit[i][key])
}
}
// formdata
formData.forEach((value, key) => {
console.log('key %s: value %s', key, value)
})
axios({
method: 'post',
url: _this.url,
data: formData,
responseType: 'json'
}).then(function (response) {
_this.name_list = response.data.name_choices
_this.wuhou_list = response.data.wuhou_choices
_this.life_list = response.data.life_choices
if (response.data.status === '1') {
_this.$alert('添加成功')
} else if (response.data.status === '0') {
// console.log(response.data.message)
_this.$alert(response.data.message)
}
}).catch(function (error) {
alert(error)
})
this.form.chinesename = ''
this.form.latinname = ''
this.form.hight = ''
@ -548,10 +596,32 @@ export default {
this.form.enforcement = ''
this.form.typical = ''
this.form.imagetype = ''
this.form.frequency = ''
this.form.abundance = ''
this.form.totalfreshweight = ''
this.form.freshweightofsample = ''
this.form.totaldryweight = ''
this.form.dryweightofsample = ''
this.upload = []
this.files = []
this.$refs.upload1.clearFiles()
var _this = this
for (var k = 0; k < this.arrit.length; k++) {
this.arrit[k].hight = ''
this.arrit[k].biomass = ''
this.arrit[k].canopy1 = ''
this.arrit[k].canopy2 = ''
this.arrit.splice(1)
console.log(this.arrit)
}
for (var j = 0; j < this.chooseImgTypes.length; j++) {
this.chooseImgTypes[j].label = ''
this.chooseImgTypes[j].fileList = ''
this.chooseImgTypes[j].value = ''
this.chooseImgTypes[j].uid = ''
// this.chooseImgTypes[j] = {}
console.log(this.chooseImgTypes)
}
// var _this = this
axios({
method: 'get',
url: this.GLOBAL.baseURL + '/samplebush/add/'
@ -559,10 +629,20 @@ export default {
_this.name_list = response.data.name_choices
_this.wuhou_list = response.data.wuhou_choices
_this.life_list = response.data.life_choices
_this.type_list = response.data.image_choices
// _this.type_list = response.data.image_choices
}).catch(function (error) {
alert(error)
})
const testTypes = [
{ label: '根', value: 'root' },
{ label: '茎', value: 'stem' },
{ label: '叶', value: 'leaf' },
{ label: '花', value: 'flower' },
{ label: '果', value: 'fruit' },
{ label: '实', value: 'solid' },
{ label: '其他', value: 'rest' }
]
this.type_list = testTypes
},
uploadOk (val) {
var _this = this

View File

@ -249,6 +249,7 @@
</div>
<el-form-item label="图片文件" prop="file" class="posi">
<el-upload
ref="upload"
class="upload-mul-img"
:show-file-list="true"
:http-request="uploadSample"
@ -467,8 +468,9 @@ export default {
_this.life_list = response.data.life_choices
if (response.data.status === '1') {
_this.$alert('添加成功')
} else {
console.log('2222222222222222222' + response.data.message)
} else if (response.data.status === '0') {
// console.log(response.data.message)
_this.$alert(response.data.message)
}
}).catch(function (error) {
alert(error)
@ -504,6 +506,52 @@ export default {
console.log(this.chinesename)
},
newit () {
var _this = this
// this.$refs.upload.submit()
this.count.push({
chinesename: _this.form.chinesename
})
this.stat = 1
console.log('11111')
var textnode = document.getElementsByClassName('wu')[0]
textnode.style.display = 'none'
//
const requestData = this.form
const formData = new FormData()
for (const key in requestData) {
formData.append(key, requestData[key])
}
// arritformdata
// formData.arrit = _this.arrit
// console.log(formData)
for (var i = 0; i < _this.arrit.length; i++) {
for (var key in _this.arrit[i]) {
formData.append(`arrit[${i}][${key}]`, _this.arrit[i][key])
}
}
// formdata
formData.forEach((value, key) => {
console.log('key %s: value %s', key, value)
})
axios({
method: 'post',
url: _this.url,
data: formData,
responseType: 'json'
}).then(function (response) {
_this.name_list = response.data.name_choices
_this.wuhou_list = response.data.wuhou_choices
_this.life_list = response.data.life_choices
if (response.data.status === '1') {
_this.$alert('添加成功')
} else if (response.data.status === '0') {
// console.log(response.data.message)
_this.$alert(response.data.message)
}
}).catch(function (error) {
alert(error)
})
this.form.chinesename = ''
this.form.latinname = ''
this.form.hight = ''
@ -511,10 +559,26 @@ export default {
this.form.enforcement = ''
this.form.typical = ''
this.form.imagetype = ''
this.form.abundance = ''
this.form.speciesontotalfreshweight = ''
this.form.speciesontotaldryweight = ''
this.upload = []
this.files = []
this.$refs.upload.clearFiles()
var _this = this
for (var k = 0; k < this.arrit.length; k++) {
this.arrit[k].hight = ''
this.arrit.splice(1)
console.log(this.arrit)
}
for (var j = 0; j < this.chooseImgTypes.length; j++) {
this.chooseImgTypes[j].label = ''
this.chooseImgTypes[j].fileList = ''
this.chooseImgTypes[j].value = ''
this.chooseImgTypes[j].uid = ''
// this.chooseImgTypes[j] = {}
console.log(this.chooseImgTypes)
}
// var _this = this
axios({
method: 'get',
url: this.GLOBAL.baseURL + '/sampleherbal/add/'
@ -522,12 +586,23 @@ export default {
_this.name_list = response.data.name_choices
_this.wuhou_list = response.data.wuhou_choices
_this.life_list = response.data.life_choices
_this.type_list = response.data.image_choices
// _this.type_list = response.data.image_choices
console.log('response')
console.log(response.data.image_choices)
// console.log(response.data.image_choices)
// console.log(_this.type_list)
}).catch(function (error) {
alert(error)
})
const testTypes = [
{ label: '根', value: 'root' },
{ label: '茎', value: 'stem' },
{ label: '叶', value: 'leaf' },
{ label: '花', value: 'flower' },
{ label: '果', value: 'fruit' },
{ label: '实', value: 'solid' },
{ label: '其他', value: 'rest' }
]
this.type_list = testTypes
},
uploadOk (val) {
var _this = this

View File

@ -222,6 +222,7 @@
<!-- <i class="el-icon-plus"></i>-->
<!-- </el-upload>-->
<el-upload
ref="upload1"
class="upload-mul-img"
:show-file-list="true"
:http-request="uploadSample"
@ -593,6 +594,59 @@ export default {
}
},
newit () {
var _this = this
this.count.push({
chinesename: _this.form.chinesename
})
this.stat = 1
var textnode = document.getElementsByClassName('wu')[0]
textnode.style.display = 'none'
//
// this.form
// const requestDataArr = this.arrit
const arritstring = _this.arrit.toString()
console.log(arritstring)
const requestData = this.form
// const arrit = _this.arrit
const formData = new FormData()
console.log(typeof formData)
for (const key in requestData) {
formData.append(key, requestData[key])
}
// arritformdata
// formData.arrit = _this.arrit
// console.log(formData)
for (var i = 0; i < _this.arrit.length; i++) {
for (var key in _this.arrit[i]) {
formData.append(`arrit[${i}][${key}]`, _this.arrit[i][key])
}
}
// formdata
formData.forEach((value, key) => {
console.log('key %s: value %s', key, value)
})
// arrit
console.log(_this.arrit)
// console.log(_this.radio4)
axios({
method: 'post',
url: _this.url,
data: formData,
responseType: 'json'
}).then(function (response) {
_this.name_list = response.data.name_choices
_this.wuhou_list = response.data.wuhou_choices
_this.life_list = response.data.life_choices
if (response.data.status === '1') {
_this.$alert('添加成功')
} else {
console.log('2222222222222222222' + response.data.message)
}
}).catch(function (error) {
alert(error)
})
console.log('访问后台')
this.form.chinesename = ''
this.form.latinname = ''
this.form.hight = ''
@ -600,14 +654,31 @@ export default {
this.form.canopy = ''
this.form.phenophase = ''
this.form.biotype = ''
this.form.abundance = ''
this.form.enforcement = ''
this.form.typical = ''
this.form.imagetype = ''
this.upload = []
this.files = []
this.$refs.upload1.clearFiles()
for (var k = 0; k < this.arrit.length; k++) {
this.arrit[k].hight = ''
this.arrit[k].dbh = ''
this.arrit[k].canopy1 = ''
this.arrit[k].canopy2 = ''
this.arrit.splice(1)
console.log(this.arrit)
}
for (var j = 0; j < this.chooseImgTypes.length; j++) {
this.chooseImgTypes[j].label = ''
this.chooseImgTypes[j].fileList = ''
this.chooseImgTypes[j].value = ''
this.chooseImgTypes[j].uid = ''
// this.chooseImgTypes[j] = {}
console.log(this.chooseImgTypes)
}
// this.methods.handleChange()
var _this = this
// var _this = this
axios({
method: 'get',
url: this.GLOBAL.baseURL + '/sampletrees/add/'
@ -615,13 +686,23 @@ export default {
_this.name_list = response.data.name_choices
_this.wuhou_list = response.data.wuhou_choices
_this.life_list = response.data.life_choices
_this.type_list = response.data.image_choices
// _this.type_list = response.data.image_choices
}).catch(function (error) {
alert(error)
})
// this.handleRemove(_this.file, this.fileList)
console.log('uuuuuu')
console.log(this.upload)
const testTypes = [
{ label: '根', value: 'root' },
{ label: '茎', value: 'stem' },
{ label: '叶', value: 'leaf' },
{ label: '花', value: 'flower' },
{ label: '果', value: 'fruit' },
{ label: '实', value: 'solid' },
{ label: '其他', value: 'rest' }
]
this.type_list = testTypes
},
//
disp (i) {

View File

@ -64,6 +64,14 @@ export default {
callback()
}, 1000)
}
var checkName = (rule, value, callback) => {
if (!value) {
return callback(new Error('名字不能为空'))
}
setTimeout(() => {
callback()
}, 1000)
}
var validateEmail = (rule, value, callback) => {
const mailReg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/
if (!value) {
@ -156,6 +164,9 @@ export default {
username: [
{ validator: checkUsername, trigger: 'blur' }
],
name: [
{ validator: checkName, trigger: 'blur' }
],
email: [
{ validator: validateEmail, trigger: 'blur' }
],