123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- var reqList = [];
- var util = {};
- util.treeTableXcode = function(data, xcode) {
- xcode = xcode || "";
- for(var i = 0; i < data.length; i++) {
- var item = data[i];
- item.xcode = xcode + i;
- if(item.children && item.children.length > 0) {
- util.treeTableXcode(item.children, item.xcode + "-");
- }
- }
- };
- Vue.use(Vuedals.default);
- new Vue({
- el: "#main",
- data: {
- tableData: [],
- valueArea: "350203",
- optionsArea: [{code:"350203",name:"思明区"}],
- dateValue: [],
- pickerOptions: {
- disabledDate: function(d) {
- return d > new Date();
- }
- },
- isloading:false, //加载中
- },
- components: {
- vuedals: Vuedals.Component
- },
- mounted: function() {
- var vm = this
- //初始化时间
- var end = new Date();
- var start = new Date();
- start.setDate(1)
- vm.dateValue = [start.format("yyyy-MM-dd"), end.format("yyyy-MM-dd")]
- vm.initData()
- // vm.getDistrict()
- //初始化数据
- $("#main").removeClass("c-hide");
- //监听后退按钮的操作
- EventBus.$on("back-click", function(arg) {
- history.go(-1);
- });
- //监听页面刷新
- EventBus.$on("refresh-click", function(arg) {
- alert("刷新")
- vm.initData()
- });
- window.onresize = function() {
-
- }
- },
- methods: {
- initData: function() {
- var vm=this
- var startDate,endDate
- if(vm.dateValue[0]>vm.dateValue[1]){
- vm.$message.warning("开始时间应小于结束时间")
- return false
- }
- vm.isloading=true
- startDate=vm.dateValue[0]
- endDate=vm.dateValue[1]
- var params={
- userAgent:localStorage.getItem('wlyyAgentForDoc'),
- area:vm.valueArea,startDate:startDate,endDate:endDate,
- }
- statisticAPI.doorQualificationAnalyze(params).then(function(res) {
- vm.isloading=false
- if(res.status == 200) {
- vm.tableData=res.data
- util.treeTableXcode(vm.tableData);
- } else {
- vm.$message.error(res.msg)
- }
- })
- },
- changeDateValue: function() {
- alert(JSON.stringify(this.dateValue))
- },
- getDistrict: function() {
- var vm=this
- var params={
- type:3,code:"350200"
- }
- homeAPI.getDistrict(params).then(function(res) {
- if(res.status == 200) {
- vm.optionsArea=res.list
- vm.valueArea=vm.optionsArea[0].code
- vm.initData()
- } else {
- vm.$message.error(res.msg)
- }
- })
- },
- exportData: function() {
- var vm=this
- var startDate,endDate
- if(typeof(vm.dateValue[0])!="string"){
- startDate=vm.dateValue[0].format("yyyy-MM-dd")
- endDate=vm.dateValue[1].format("yyyy-MM-dd")
- }else{
- startDate=vm.dateValue[0]
- endDate=vm.dateValue[1]
- }
- var params={
- userAgent:localStorage.getItem('wlyyAgentForDoc'),
- area:vm.valueArea,startDate:startDate,endDate:endDate,
- }
- // var str="http://192.168.131.24:8082/doctor/statisticAnalyze/doorQualificationAnalyzeExport?area=350203&startDate=2018-03-25&endDate=2019-03-25"
- var str = statisticAPI.doorQualificationAnalyzeExport+"?area="+vm.valueArea+"&startDate="+startDate+"&endDate="+endDate;
- window.open(str, "接收包数据导出")//导出数据
- },
- treeClick: function(item, index) {
- if(item.open) {
- this.collapse(item, index);
- } else {
- this.expand(item, index);
- }
- },
- expand: function(item, index) {
- if(!item.children) {
- return index;
- }
- //展开
- for(var i = 0; item.children && i < item.children.length; i++) {
- var child = item.children[i];
- this.tableData.splice(++index, 0, child);
- if(child.children && child.children.length > 0 && child.open) {
- index = this.expand(child, index);
- }
- }
- item.open = true;
- return index;
- },
- collapse: function(item, index) {
- if(!item.children) {
- return index;
- }
- //收缩
- item.open = false;
- var len = this.tableData[index].children.length;
- this.tableData.splice(index + 1, len);
- }
- }
- });
|