1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
/**
* 领导机构新增
* $Id: government_new.inc,v 1.12020/01/03 11:18:46 Exp $
* @author lixq
* @access public
* @package manager.templates
*/
global $csv_error_msg;
?>
<div id="change">
<p class="edit_title">领导机构新增</p>
<div class="edit_content">
<form id="form" method="post" action="government_new_result.php" enctype="multipart/form-data">
<p>CSV文件</p>
<input type="file" name="csv_file" class="input_200" @change="getFile($event)" accept=".csv"/><br />
<el-button type="primary" class="edit_btn" @click="submitForm()">新增</el-button>
<el-button type="primary" class="edit_btn" @Click="window.location='./government_list.php'" />返回</el-button>
</form>
</div>
</div>
<script type="text/javascript">
$(document).ready(function () {
var vm = new Vue({
el: 'form',
data: {
file: ''
},
methods: {
getFile(event) {
this.file = event.target.files[0];
//$('#csv_file').attr("value",this.file);
console.log(this.file);
},
submitForm() {
if(!this.file){
this.$message({
type: 'error',
message: '请选择CSV文件!'
});
return;
}
$('#form').submit();
}
}
})
if(<?=$csv_error_msg?1:0 ?>){
vm.$message({
type: 'error',
message: '<?=$csv_error_msg?>'
});
}
})
</script>