<template>
  <div class="app-container">
    这个页面取消，暂停开发
 
  </div>
</template>

<script>
import echarts from 'echarts'

require('echarts/theme/macarons')
// 引入
import { GetDataByName, GetDataByNames, PostDataByName, PostDataByNames, getRecuData, checkButtons, ExecDataByConfig, failproccess, GetAccount, GetReportform } from '@/api/common'
import waves from '@/directive/waves'
import { parseTime, sortChange, json2excel } from '@/utils/index.js'
import Pagination from '@/components/Pagination'
import { MessageBox } from 'element-ui'
import TreeSelect from '@/components/TreeSelect'
import Cookies from 'js-cookie'
import { getToken } from '@/utils/auth'
export default {
  inject: ['reload'],
  name: 'AssetDesignee',
  components: { Pagination, TreeSelect },
  directives: { waves },
  data() {
    return {
      isBasicsAdd: [], isBasicsCard: [], isBasicsUpdate: [], isBasicsDel: [], isBasicsDel2: [], isBasic: [], isBasicSH: [], isBasicExamine: [],
      rules: {
        // assetCode: [{ required: true, message: '必填', trigger: 'blur' }],
        eqName: [{ required: true, message: '必填', trigger: 'blur' }],
        eqCode: [{ required: true, message: '必填', trigger: 'blur' }],
        financeCode: [{ required: true, message: '必填', trigger: 'blur' }],
        departmentId: [{ required: true, message: '必填', trigger: 'blur' }],
        employeeId: [{ required: true, message: '必填', trigger: 'blur' }],
        depreciation: [{ type: 'number', required: true, validator: (rule, value, callback) => {
          if (!value) {
            callback(new Error('不能为空'))
          }
          setTimeout(() => {
            const re = /^[0-9]*[1-9][0-9]*$/ // /^[0-9]*[1-9][0-9]*$/
            const rsCheck = re.test(value)
            if (!rsCheck) {
              callback(new Error('请输入正整数'))
            } else {
              callback()
            }
          }, 0)
        }, trigger: 'blur' }]
      },
      placeholder:"请选择设备类别",
      findAllBrand: [], findAllProvider: [],
      findAllAssetType: [], findAllPasture: [], findAllDepart: [], findAllEmploye: [],
      getDictByName: [], upkeepgrades: [], createDepartList: [],
      statues: [{ id: '0', name: '审核中' }, { id: '1', name: '已通过' }, { id: '2', name: '未通过' }],
      depreciationAlertList: [{ id: '0', name: '正常' }, { id: '1', name: '到期预警' }, { id: '2', name: '超期使用' }],
      requestParams: [
        { name: 'findAllBrand', offset: 0, pagecount: 0, params: [] },
        { name: 'findAllProvider', offset: 0, pagecount: 0, params: [] },
        { name: 'findAlllAssetProvider', offset: 0, pagecount: 0, params: [] },
        { name: 'findAllAssetType', offset: 0, pagecount: 0, params: [] },
        { name: 'findAllPasture', offset: 0, pagecount: 0, returntype: 'Map', parammaps: { 'id': Cookies.get('pastureid') }},
        { name: 'findAllEmploye', offset: 0, pagecount: 0, parammaps: { 'pastureId': Cookies.get('pastureid') }},
        { name: 'getDictByName', offset: 0, pagecount: 0, params: ['资产状态'] },
        { name: 'getdictbyname', offset: 0, pagecount: 0, params: ['保养级别'] }
      ],
      getDepartParam: { name: 'findAllDepart1', offset: 0, pagecount: 0, parammaps: { 'pastureId': Cookies.get('pastureid'), 'eId': Cookies.get('employeid') }},
      disabled: false,  
      nodeKey: 'id',
      defaultCheckedKeys: [],
      parentClass: [],
      defaultProps: { children: 'children', label: 'typeName' },
      getRecuListParm: { name: 'getAssetTypeList', idname: 'id', params: [-1] },
      tableKey: 0,
      list: [],
      total: 0,
      listLoading: true,
      getdataListParm: {
        name: 'getAssetList', page: 1, offset: 1, pagecount: 10, returntype: 'Map',
        parammaps: {proId:'',brandId:'', assetCode:'',eqCode: '', eqName: '', departmentId: '', pastureId: Cookies.get('pastureid'), pastureName: Cookies.get('pasturename'), status: '', inputDatetime1: '', startTime: '', stopTime: '', inputDatetime2: '', startTime2: '', stopTime2: '', inputDatetime3: '', startTime3: '', stopTime3: '', warning: '', eqClassId: '' }
      },
     
      textMap: { update: '编辑', create: '新增', card: '查看设备信息', examine: '审核', change: '批量变更' },
      dialogFormVisible: false,
      dialogStatus: '',
      pickerOptions1: {
        disabledDate(time) {
          return time.getTime() > Date.now()// 当天之前的时间可选
        }
      },

      dialogImageUrl: '', dialogVisible: false,
      fileList: [], showUpload: false,
      headers: { optname: 'insertcustompic', id: 1, token: getToken() },
      uploadImageUrl: process.env.VUE_APP_BASE_API + 'authdata/uploaderimage',
      width: '',

      createTemp: { inputDatetime: parseTime(new Date(), '{y}-{m}-{d}'), employeId: this.$store.state.user.employeid, inputUser: this.$store.state.user.employeid, deptId: this.$store.state.user.departmentid, departmentName: Cookies.get('departmentname'), pastureId: this.$store.state.user.pastureid, assetCode: '', eqClassName: '', eqClassId: '', eqCode: '', eqName: '', specification: '', providerName: '', brandName: '', financeCode: '', status: '正常', purpose: '', purchaseDate: parseTime(new Date(), '{y}-{m}-{d}'), entranceDate: parseTime(new Date(), '{y}-{m}-{d}'), yearUpkeepCost: '', yearMaintainDost: '', yuanzhi: '', baseHours: '', upkeepgrade: '', salvage: '', subtractvalue: '', yearMaintainCost: '', brandId: '', providerId: '', inputUserName: '', employeName: this.$store.state.user.employename, depreciation: '' },
      requestParam: { name: 'insertAsset', offset: 0, pagecount: 0, parammaps: {}},
      seeTemp: {},
 
      dialogFormVisible_See: false,
      activeName: 'first',

      maintainTypes: [{ id: '0', name: '周保养' }, { id: '1', name: '月保养' }, { id: '2', name: '间隔保养' }],
      changeStates: [{ id: '17', name: '正常' }, { id: '18', name: '闲置' }, { id: '19', name: '报废' }, { id: '20', name: '封存' }],

      getdataEQNumber: { name: 'cerateEQNumber', page: 1, offset: 1, pagecount: 10, returntype: 'Map', parammaps: {}},

      dialoFormVisible_Examine: false,
      examineTemp: { SHstatue: 1 },
      statueReason: false,
      activeList: [],
      active: 3,
      isFlowChart: false,
      isDisplayRecord: false,
      buttons: [],
      // 查看-点检记录
      getAssetBigSpotCheckListParm: { name: 'getAssetBigSpotCheck1', page: 1, offset: 1, pagecount: 10, returntype: 'Map', parammaps: { inputDatetimeSpotCheck1: '', startTime: '', stopTime: '' }},
      listLoadingSpotCheck1: false,
      listSpotCheck1: [],
      totalSpotCheck1: 0,
      // 查看-保养记录
      getBigupkeepbyeqParm: { name: 'getBigupkeepbyeq', page: 1, offset: 1, pagecount: 10, returntype: 'Map', parammaps: { inputDatetimeUpkeepbyeq: '', startTime: '', stopTime: '', upkeepType: '', upkeepCode: '' }},
      listLoadingUpkeepbyeq: false,
      listUpkeepbyeq: [],
      totalUpkeepbyeq: 0,
      // 查看-维修记录
      getAssetMaintainParm: { name: 'getAssetMaintain1', page: 1, offset: 1, pagecount: 10, returntype: 'Map', parammaps: { inputDatetimeAssetMaintain: '', startTime: '', stopTime: '', repairCode: '' }},
      listLoadingAssetMaintain: false,
      listAssetMaintain: [],
      totalAssetMaintain: 0,
      // 查看-启停记录
      getAssetSTTParm: { name: 'getAssetSTT1', page: 1, offset: 1, pagecount: 10, returntype: 'Map', parammaps: { startTime: '', stopTime: '' }},
      listLoadingAssetSTT: false,
      listAssetSTT: [],
      totalAssetSTT: 0,
      // 查看-变更记录
      getAssetChangeParm: { name: 'getAssetChange1', page: 1, offset: 1, pagecount: 10, returntype: 'Map', parammaps: { startTime: '', stopTime: '', changeStatue: '', inputDatetimeAssetChange: '' }},
      listLoadingAssetChange: false,
      listAssetChange: [],
      totalAssetChange: 0,
      // 查看-备件领用记录
      getAssetPartApplyParm: { name: 'getAssetPartApply', page: 1, offset: 1, pagecount: 10, returntype: 'Map', parammaps: { startTime: '', stopTime: '', inputDatetimeAssetPartApply: '' }},
      listLoadingAssetPartApply: false,
      listAssetPartApply: [],
      totalAssetPartApply: 0,
      downLoadParm: {},
      downLoadList: [],
      requestBrand: {
        name: 'getBrandByPartCode',
        page: 0,
        offset: 0,
        pagecount: 10,
        returntype: 'Map',
        parammaps: {}
      },
      BrandList: [],
      requestEmploye: {
        name: 'findAllEmployeV2',
        page: 0,
        offset: 0,
        pagecount: 10,
        returntype: 'Map',
        parammaps: {
          pastureId: Cookies.get('pastureid')
        }
      },
      employeList: [],
      totaltitle: 0,
      getBarChart1Parm: {
        name: 'getReportEqCostYear',
        parammaps: {}
      },
      barChart1: null,
      chart_data1: {},
      getBarChart2Parm: {
        name: 'getReportEqCostMonth',
        parammaps: {
          receiveTime: new Date().getFullYear()
        }
      },
      barChart2: null,
      chart_data2: {},
      dialogFormVisible_ChartSee: false,
      getChartSeeParm: {
        name: 'getEqPartuseDetailList',
        page: 0,
        offset: 0,
        pagecount: 10,
        returntype: 'Map',
        parammaps: {
          receiveTime: '',
          eqId: '',
          useTypeV: '',
          inputDatetime2: '',
          stopTime: '',
          startTime: ''
        }
      },
      listLoadingChartSee: false,
      totalChartSee: 0,
      listChartSee: [],
      pageNum: 0,
      pageSize: 0,
      pageNumSH: 0,
      pageSizeSH: 0,
      useTypes: [{ id: 0, name: '维修' }, { id: 1, name: '保养' }],
      downLoadParm2: {},
      downLoadList2: [],
      isPercentage: false,
      percentage: 1,
      isokDisable: false,
      edit: 0,
      selectionList: [],
      dialogFormVisible_change: false,
      batchChange: {
        temp: { departmentId: '', employeeId: '' },
        getdataListParmDept: { name: 'getAssetAndEmpList', offset: 0, pagecount: 0, parammaps: {}},
        deptList: [],
        getdataListParmPerson: { name: 'getAllEmp', offset: 0, pagecount: 0, parammaps: {}},
        personList: []
      },
      rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
      cellStyle: { padding: 0 + 'px' }
    }
  },
  computed: {
    // 设置请求头
    // headers() {
    //   return {
    //     // 设置token
    //     // eslint-disable-next-line no-undef
    //     token: getToken()
    //   }
    // },
    uploadData() {
      return {
        name: 'importStockUse',
        importParams: '牧场,设备类别,资产编号,设备名称,设备内部编号,设备规格,品牌,供应商,用途,状态,购置日期,入场日期,折旧年限,财务编号,原值,残值,月核减值,保养级别,保养费用,维修费用,维修费用,基数(小时),部门,责任人,录入人,录入时间,使用时长(年),使用率(%),SignColumn',
        sheetname: 'SheetJS'
      }
    },
   
    // 设置上传地址
    uploadExcelUrl() {
      // process.env.VUE_APP_BASE_API是服务器的路径，也是axios的基本路径
      return process.env.VUE_APP_BASE_API + 'authdata/equipment'
    }
  },
  created() {
     
 
  },
  methods: {
     // 导入
     beforeImportExcel(file) {
      const isLt2M = file.size / 1024 / 1024 < 10
      if (!isLt2M) {
        this.$message.error('上传文件大小不能超过 10MB!')
      }
      return isLt2M
    },
    handleImportExcelSuccess(res, file) {
      if (res.msg === 'ok') {
        this.$message({
          title: '成功',
          message: '导入成功:' + res.data.success + '条!',
          type: 'success',
          duration: 2000
        })
        if (res.data.err_count > 0) {
          this.$notify({
            title: '失败',
            message: '导入失败:' + res.data.err_count + '条!',
            type: 'danger',
            duration: 2000
          })

          
        }
      } else {
        this.$notify({
          title: '失败',
          message: '上传失败',
          type: 'danger',
          duration: 2000
        })
      }
    },
    formatJsonTemp(filterVal, jsonData) {
      return jsonData.map(v =>
        filterVal.map(j => {
          if (j === 'timestamp') {
            return parseTime(v[j])
          } else {
            return v[j]
          }
        })
      )
    },
    tableSort2(column) {
      sortChange(column, this.list)
    },
    tableSort(column) {
      if (this.activeName == 'third') {
        sortChange(column, this.listUpkeepbyeq)
      } else if (this.activeName == 'fouth') {
        sortChange(column, this.listAssetMaintain)
      } else if (this.activeName == 'seventh') {
        sortChange(column, this.listAssetPartApply)
      }
    },
    get_auto_buttons() {
      // 新增
      const BasicsAdd = 'asset:basics:add'
      const isBasicsAdd = checkButtons(this.$store.state.user.buttons, BasicsAdd)
      this.isBasicsAdd = isBasicsAdd
      // 卡片
      const BasicsCard = 'asset:basics:kapian'
      const isBasicsCard = checkButtons(this.$store.state.user.buttons, BasicsCard)
      this.isBasicsCard = isBasicsCard
      // 编辑
      const BasicsUpdate = 'asset:basics:update'
      const isBasicsUpdate = checkButtons(this.$store.state.user.buttons, BasicsUpdate)
      this.isBasicsUpdate = isBasicsUpdate
      // 删除
      const BasicsDel = 'asset:basics:del'
      const isBasicsDel = checkButtons(this.$store.state.user.buttons, BasicsDel)
      this.isBasicsDel = isBasicsDel
      // 设备基础信息-删除
      const BasicsDel2 = 'asset:basics:del2'
      const isBasicsDel2 = checkButtons(this.$store.state.user.buttons, BasicsDel2)
      this.isBasicsDel2 = isBasicsDel2
      // 设备基础信息
      const Basic = 'asset:basic:basic'
      const isBasic = checkButtons(this.$store.state.user.buttons, Basic)
      this.isBasic = isBasic
      // 设备审核
      const BasicSH = 'asset:basic:shjm'
      const isBasicSH = checkButtons(this.$store.state.user.buttons, BasicSH)
      this.isBasicSH = isBasicSH
      // 审核
      const BasicExamine = 'asset:basic:shenhe'
      const isBasicExamine = checkButtons(this.$store.state.user.buttons, BasicExamine)
      this.isBasicExamine = isBasicExamine
    },
    // 2-2:下拉框
    get_select_list() {
      GetDataByNames(this.requestParams).then(response => {
        if (response.data.list !== null) {
          this.findAllBrand = response.data.findAllBrand.list
          this.findAllProvider = response.data.findAllProvider.list
          this.findAllAssetType = response.data.findAllAssetType.list
          this.findAllPasture = response.data.findAllPasture.list
          this.findAllEmploye = response.data.findAllEmploye.list
          this.getDictByName = response.data.getDictByName.list
          this.upkeepgrades = response.data.getdictbyname.list
          this.getDepartDownList()
        }
      })
    },
    getDepartDownList() {
      GetDataByName(this.getDepartParam).then(response => {
        this.findAllDepart = response.data.list
      })
    },
    changePastureName(item) {
      this.getDepartParam.parammaps.pastureId = this.findAllPasture.find(obj => obj.name == item).id
      this.getdataListParm.parammaps.departmentId = ''
      this.getDepartDownList()
    },
    getCreateDepartDownList() {
      GetDataByName(this.getDepartParam).then(response => {
        this.createDepartList = response.data.list
        if (this.edit == 1) {
          if (this.createDepartList.find(obj => obj.id == Cookies.get('departmentid'))) {
            this.createTemp.departmentId = parseInt(Cookies.get('departmentid'))
            this.createTemp.departmentName = this.createDepartList.find(obj => obj.id == Cookies.get('departmentid')).name
            this.createTemp.deptId = parseInt(Cookies.get('departmentid'))
          } else {
            this.createTemp.departmentId = response.data.list[0].id
            this.createTemp.departmentId = response.data.list[0].id
            this.createTemp.deptId = response.data.list[0].name
          }
        }
      })
    },
    changePasture(item) {
      this.getDepartParam.parammaps.pastureId = item
      this.edit = 1
      this.getCreateDepartDownList()
    },
    changeDepart(item) {
      this.createTemp.departmentName = this.createDepartList.find(obj => obj.id == item).name
    },
    get_table_data() {
      this.listLoading = true
      if (this.getdataListParm.parammaps.inputDatetime1 == null) {
        this.getdataListParm.parammaps.inputDatetime1 = ''
        this.getdataListParm.parammaps.startTime = ''
        this.getdataListParm.parammaps.stopTime = ''
      } else {
        this.getdataListParm.parammaps.startTime = this.getdataListParm.parammaps.inputDatetime1[0]
        this.getdataListParm.parammaps.stopTime = this.getdataListParm.parammaps.inputDatetime1[1]
      }
      if (this.getdataListParm.parammaps.inputDatetime2 == null || this.getdataListParm.parammaps.inputDatetime2 == '') {
        this.getdataListParm.parammaps.inputDatetime2 = ''
        this.getdataListParm.parammaps.startTime2 = ''
        this.getdataListParm.parammaps.stopTime2 = ''
      } else {
        this.getdataListParm.parammaps.startTime2 = this.getdataListParm.parammaps.inputDatetime2[0]
        this.getdataListParm.parammaps.stopTime2 = this.getdataListParm.parammaps.inputDatetime2[1]
      }
      if (this.getdataListParm.parammaps.inputDatetime3 == null || this.getdataListParm.parammaps.inputDatetime3 == '') {
        this.getdataListParm.parammaps.inputDatetime3 = ''
        this.getdataListParm.parammaps.startTime3 = ''
        this.getdataListParm.parammaps.stopTime3 = ''
      } else {
        this.getdataListParm.parammaps.startTime3 = this.getdataListParm.parammaps.inputDatetime3[0]
        this.getdataListParm.parammaps.stopTime3 = this.getdataListParm.parammaps.inputDatetime3[1]
      }
      GetDataByName(this.getdataListParm).then(response => {
        console.log('table数据', response.data.list)
        if (response.data.list !== null) {
          this.list = response.data.list
           
          this.pageNum = response.data.pageNum
          this.pageSize = response.data.pageSize
        } else {
          this.list = []
        }
        this.total = response.data.total
        setTimeout(() => {
          this.listLoading = false
        }, 100)
        this.get_select_list()
      })
    },
     
    SHStatus: function(cellValue) {
      if (cellValue.SHStatus == 0) {
        return '审核中'
      } else if (cellValue.SHStatus == 1) {
        return '已通过'
      } else if (cellValue.SHStatus == 2) {
        return '未通过'
      } else if (cellValue.SHStatus == 3) {
        return '历史数据'
      }
    },
    form_search() {
      this.listLoading = true
      this.getdataListParm.parammaps.pastureId = ''
      if (this.getdataListParm.parammaps.warning !== '') {
        this.getdataListParm.parammaps.d1 = 1
      } else {
        this.getdataListParm.parammaps.d1 = ''
      }
      if (this.getdataListParm.parammaps.inputDatetime1 == null) {
        this.getdataListParm.parammaps.inputDatetime1 = ''
        this.getdataListParm.parammaps.startTime = ''
        this.getdataListParm.parammaps.stopTime = ''
      } else {
        this.getdataListParm.parammaps.startTime = this.getdataListParm.parammaps.inputDatetime1[0]
        this.getdataListParm.parammaps.stopTime = this.getdataListParm.parammaps.inputDatetime1[1]
      }
      console.log(this.getdataListParm.parammaps.inputDatetime2)
      if (this.getdataListParm.parammaps.inputDatetime2 == null) {
        this.getdataListParm.parammaps.inputDatetime2 = ''
        this.getdataListParm.parammaps.startTime2 = ''
        this.getdataListParm.parammaps.stopTime2 = ''
      } else {
        this.getdataListParm.parammaps.startTime2 = this.getdataListParm.parammaps.inputDatetime2[0]
        this.getdataListParm.parammaps.stopTime2 = this.getdataListParm.parammaps.inputDatetime2[1]
      }
      if (this.getdataListParm.parammaps.inputDatetime3 == null) {
        this.getdataListParm.parammaps.inputDatetime3 = ''
        this.getdataListParm.parammaps.startTime3 = ''
        this.getdataListParm.parammaps.stopTime3 = ''
      } else {
        this.getdataListParm.parammaps.startTime3 = this.getdataListParm.parammaps.inputDatetime3[0]
        this.getdataListParm.parammaps.stopTime3 = this.getdataListParm.parammaps.inputDatetime3[1]
      }
      this.getdataListParm.offset = 1
      this.get_table_data()
    },
 
    handlePicChange(file, fileList) {
      if (fileList.length > 0) {
        this.$nextTick(() => {
          this.showUpload = true
        })
      } else {
        this.$nextTick(() => {
          this.showUpload = false
        })
      }
      console.log(this.createTemp)
    },
    handlePicSuccess(response, file, fileList) {
      if (fileList.length > 0) {
        this.$nextTick(() => {
          this.showUpload = true
        })
      } else {
        this.$nextTick(() => {
          this.showUpload = false
        })
      }
      if (this.createTemp.picpath === undefined || this.createTemp.picpath === '' || this.createTemp.picpath == -1) {
        this.$set(this.createTemp, 'picpath', response.execresult.LastInsertId)
      }
    },
    handlePicRemove(file, fileList) {
      if (this.dialogStatus === 'create') {
        if (fileList.length < 1) {
          this.showUpload = false
        }
        for (const key in this.createTemp) {
          if (this.createTemp[key] === file.response.execresult.LastInsertId) {
            this.$delete(this.createTemp, key)
          }
        }
      } else {
        if (fileList.length < 1) {
          this.$nextTick(() => {
            this.showUpload = false
          })
        }
        const url = file.url
        console.log(url, 'url')
        for (const key in this.createTemp) {
          console.log(this.createTemp[key], 'createTemp[key]')
          if (this.createTemp[key] === url) {
            console.log(key)
            if (key === 'picpath') {
              this.$delete(this.createTemp, 'picpath')
              this.$delete(this.createTemp, 'picId')
            }
          }
        }
      }
      console.log(this.createTemp, '文件列表移除文件时的钩子row')
    },
    handlePicPreview(file) {
      this.dialogImageUrl = file.url
      this.dialogVisible = true
    },
    onLoad(e) {
      const img = e.target
      let width = 0
      if (img.fileSize > 0 || (img.width > 1 && img.height > 1)) {
        width = img.width + 40
      }
      this.width = width + 'px'
    },
    add_dialog_saveAdd() {
      console.log('点击了保存')
      this.isokDisable = true
      setTimeout(() => {
        this.isokDisable = false
      }, 1000)
      this.$refs['createTemp'].validate(valid => {
        if (valid) {
          for (var i = 0; i < this.listAdd.length; i++) {
            if (this.listAdd[i].score == null) {
              this.$message({ type: 'warning', message: '请检查检查结果是否为空', duration: 2000 })
              return false
            }
            if (this.listAdd[i].pic1 == undefined) {
              this.listAdd[i].pic1 = -1
            }
            if (this.listAdd[i].pic2 == undefined) {
              this.listAdd[i].pic2 = -1
            }
            if (this.listAdd[i].pic3 == undefined) {
              this.listAdd[i].pic3 = -1
            }
          }
          this.postDataPramas.common = { 'returnmap': '0' }
          this.postDataPramas.data = []
          this.postDataPramas.data[0] = { 'name': 'insertBigjudge', 'type': 'e', 'parammaps': {
            pastureId: this.createTemp.pastureId,
            batime: this.createTemp.batime,
            empId: this.createTemp.empId
          }}
          this.postDataPramas.data[1] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.listAdd }}
          this.postDataPramas.data[1].children = []
          this.postDataPramas.data[1].children[0] = { 'name': 'insertjudge', 'type': 'e', 'parammaps': {
            bigId: '@insertBigjudge.LastInsertId',
            statue: '@insertSpotList.statue',
            score: '@insertSpotList.score',
            note: '@insertSpotList.note',
            pic1: '@insertSpotList.pic1',
            pic2: '@insertSpotList.pic2',
            pic3: '@insertSpotList.pic3'
          }}
          ExecDataByConfig(this.postDataPramas).then(response => {
            console.log('新增保存发送参数', this.postDataPramas)
            if (response.msg === 'fail') {
              this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
            } else {
              this.getdataListParm.parammaps.inputDatetime = ''
              this.get_table_data()
              this.dialogFormVisibleAdd = false
              this.createTemp.providerName = ''
              this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
            }
          })
        }
      })
    },
    beforeRemove(file, fileList) {
      console.log(file.response, '删除文件之前的钩子，参数为上传的文件和文件列表')
      return this.$confirm('删除当前图片, 是否继续?', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' })
    },
    resetCreateTemp() {
      this.defaultCheckedKeys = []
      this.createTemp.defaultCheckedKeys = []
      this.createTemp.brandId = ''
      this.createTemp.providerId = ''
      this.createTemp.inputDatetime = parseTime(new Date(), '{y}-{m}-{d}')
      this.createTemp.eqClassName = ''
      this.createTemp.eqClassId = ''
      this.createTemp.employeName = Cookies.get('employename')
      this.createTemp.employeId = Cookies.get('employeid')
      this.createTemp.inputUser = Cookies.get('employeid')
      this.createTemp.deptId = parseInt(Cookies.get('departmentid'))
      this.createTemp.departmentName = Cookies.get('departmentname')
      this.createTemp.pastureId = parseInt(Cookies.get('pastureid'))
      this.createTemp.eqCode = ''
      this.createTemp.eqName = ''
      this.createTemp.specification = ''
      this.createTemp.providerName = ''
      this.createTemp.financeCode = ''
      this.createTemp.status = '正常'
      this.createTemp.providerName = ''
      this.createTemp.brandName = ''
      this.createTemp.purpose = ''
      this.createTemp.purchaseDate = parseTime(new Date(), '{y}-{m}-{d}')
      this.createTemp.entranceDate = parseTime(new Date(), '{y}-{m}-{d}')
      this.createTemp.assetCode = ''
      this.createTemp.yearUpkeepCost = ''
      this.createTemp.yearMaintainDost = ''
      this.createTemp.yuanzhi = ''
 
      this.createTemp.baseHours = ''
      this.createTemp.upkeepgrade = 113
      this.createTemp.salvage = ''
      this.createTemp.subtractvalue = ''
      this.createTemp.yearMaintainCost = ''
      this.createTemp.inputUserName = ''
      this.createTemp.picpath = ''
      this.fileList = []
      this.showUpload = false
      this.createTemp.fileList = []
      this.createTemp.depreciation = ''
    },
    form_add() {
      this.resetCreateTemp()
      this.edit = 1
      this.getDepartParam.parammaps.pastureId = this.createTemp.pastureId
      this.getCreateDepartDownList()
      this.dialogStatus = 'create'
      this.dialogFormVisible = true
      this.$nextTick(() => {
        this.$refs['createTemp'].clearValidate()
      })
    },
    changeBrand(item) {
      this.createTemp.brandName = this.findAllBrand.find(obj => obj.id === item).name
    },
    changeUpkeepgrade(item) {
      console.log(item)
    },
    upkeepgradeChange(e) {
      if (!e) {
        this.$refs['upkeepgrade'].blur()
      }
    },
    popoverHide(checkedIds, checkedData) {
      console.log(checkedIds, checkedData)
      if (checkedIds !== null) {
        this.getdataEQNumber.parammaps.eqCode = checkedData.typeCode
        // if (checkedData.children === undefined) {
        //   this.createTemp.eqClassId = checkedData.eqClassId
        //   this.createTemp.eqName = checkedData.NewName
        //   this.getdataListParm.parammaps.eqClassId = checkedData.eqClassId
        //   this.getEQNumber()
        // } else {
        //   this.defaultCheckedKeys = []
        //   this.createTemp.eqClassId = ''
        //   this.getdataListParm.parammaps.eqClassId = ''
        //   this.$message({ type: 'warning', message: '请选择具体设备类型' })
        // }
        this.createTemp.eqClassId = checkedData.eqClassId
          this.createTemp.eqName = checkedData.NewName
          this.getdataListParm.parammaps.eqClassId = checkedData.eqClassId
          this.getEQNumber()
      } else {
        this.defaultCheckedKeys = []
        this.createTemp.eqClassId = ''
        this.getdataListParm.parammaps.eqClassId = ''
      }
    },
    add_dialog_save() {
      this.isokDisable = true
      setTimeout(() => {
        this.isokDisable = false
      }, 1000)
      this.$refs['createTemp'].validate(valid => {
        if (valid) {
          console.log(this.createTemp)
          this.requestParam.name = 'insertAsset'
          if (this.createTemp.status == '正常') { this.createTemp.status = 17 }
          if (this.createTemp.providerId == '') { this.createTemp.providerId = 0 }
          if (this.createTemp.brandId == '') { this.createTemp.brandId = 0 }
          if (this.createTemp.yuanzhi == '') { this.createTemp.yuanzhi = 0 }
          if (this.createTemp.salvage == '') { this.createTemp.salvage = 0 }
          if (this.createTemp.subtractvalue == '') { this.createTemp.subtractvalue = 0 }
          if (this.createTemp.yearUpkeepCost == '') { this.createTemp.yearUpkeepCost = 0 }
          if (this.createTemp.yearMaintainCost == '') { this.createTemp.yearMaintainCost = 0 }
          if (this.createTemp.baseHours == '') { this.createTemp.baseHours = 0 }
          // 原值yuanzhi残值salvage月核减值subtractvalue保养费用yearUpkeepCost维修费用yearMaintainCost
          var rulesValue = /^\d+(\.\d{1,3})?$/
          this.requestParam.parammaps = this.createTemp
          this.requestParam.parammaps.picpath = this.createTemp.picpath
          if (this.createTemp.yuanzhi !== '' || this.createTemp.salvage !== '' || this.createTemp.subtractvalue !== '' || this.createTemp.yearUpkeepCost !== '' || this.createTemp.yearMaintainCost !== '') {
            this.requestParam.parammaps.yuanzhi = parseFloat(this.createTemp.yuanzhi)
            if (!rulesValue.test(parseFloat(this.createTemp.yuanzhi))) {
              this.$message({ type: 'error', message: '原值请输入自然数，最多保留三位小数点', duration: 2000 })
              return false
            }
            if (!rulesValue.test(parseFloat(this.createTemp.salvage))) {
              this.$message({ type: 'error', message: '残值请输入自然数，最多保留三位小数点', duration: 2000 })
              return false
            }
            if (!rulesValue.test(parseFloat(this.createTemp.subtractvalue))) {
              this.$message({ type: 'error', message: '月核减值请输入自然数，最多保留三位小数点', duration: 2000 })
              return false
            }
            if (!rulesValue.test(parseFloat(this.createTemp.yearUpkeepCost))) {
              this.$message({ type: 'error', message: '保养费用输入自然数，最多保留三位小数点', duration: 2000 })
              return false
            }
            if (!rulesValue.test(parseFloat(this.createTemp.yearMaintainCost))) {
              this.$message({ type: 'error', message: '维修费用请输入自然数，最多保留三位小数点', duration: 2000 })
              return false
            }
          }
          PostDataByName(this.requestParam).then(response => {
            console.log('新增保存发送参数', this.requestParam)
            if (response.msg !== 'fail') {
              if (this.getdataListParm.parammaps.inputDatetime1 === null) {
                this.getdataListParm.parammaps.inputDatetime1 = ''
              }
              this.dialogFormVisible = false
              this.get_table_data()
              this.$notify({ title: '成功', message: '新增成功', type: 'success', duration: 2000 })
              // this.reload()
            } else {
              failproccess(response, this.$notify)
            }
          })
        }
      })
    },
    // 继续新增
    add_dialog_save_again() {
      this.isokDisable = true
      setTimeout(() => {
        this.isokDisable = false
      }, 1000)
      this.$refs['createTemp'].validate(valid => {
        if (valid) {
          this.requestParam.name = 'insertAsset'
          if (this.createTemp.status == '正常') { this.createTemp.status = 17 }
          if (this.createTemp.providerId == '') { this.createTemp.providerId = 0 }
          if (this.createTemp.brandId == '') { this.createTemp.brandId = 0 }
          if (this.createTemp.yuanzhi == '') { this.createTemp.yuanzhi = 0 }
          if (this.createTemp.salvage == '') { this.createTemp.salvage = 0 }
          if (this.createTemp.subtractvalue == '') { this.createTemp.subtractvalue = 0 }
          if (this.createTemp.yearUpkeepCost == '') { this.createTemp.yearUpkeepCost = 0 }
          if (this.createTemp.yearMaintainCost == '') { this.createTemp.yearMaintainCost = 0 }
          if (this.createTemp.baseHours == '') { this.createTemp.baseHours = 0 }
          // 原值yuanzhi残值salvage月核减值subtractvalue保养费用yearUpkeepCost维修费用yearMaintainCost
          var rulesValue = /^\d+(\.\d{1,3})?$/
          this.requestParam.parammaps = this.createTemp
          this.requestParam.parammaps.picpath = this.createTemp.picpath
          if (this.createTemp.yuanzhi !== '' || this.createTemp.salvage !== '' || this.createTemp.subtractvalue !== '' || this.createTemp.yearUpkeepCost !== '' || this.createTemp.yearMaintainCost !== '') {
            this.requestParam.parammaps.yuanzhi = parseFloat(this.createTemp.yuanzhi)
            // if (!rulesValue.test(parseFloat(this.createTemp.yuanzhi)) || !rulesValue.test(parseFloat(this.createTemp.salvage)) || !rulesValue.test(parseFloat(this.createTemp.subtractvalue)) || !rulesValue.test(parseFloat(this.createTemp.yearUpkeepCost)) || !rulesValue.test(parseFloat(this.createTemp.yearMaintainCost))) {
            if (!rulesValue.test(parseFloat(this.createTemp.yuanzhi))) {
              this.$message({ type: 'error', message: '原值请输入自然数，最多保留三位小数点', duration: 2000 })
              return false
            }
            if (!rulesValue.test(parseFloat(this.createTemp.salvage))) {
              this.$message({ type: 'error', message: '残值请输入自然数，最多保留三位小数点', duration: 2000 })
              return false
            }
            if (!rulesValue.test(parseFloat(this.createTemp.subtractvalue))) {
              this.$message({ type: 'error', message: '月核减值请输入自然数，最多保留三位小数点', duration: 2000 })
              return false
            }
            if (!rulesValue.test(parseFloat(this.createTemp.yearUpkeepCost))) {
              this.$message({ type: 'error', message: '保养费用输入自然数，最多保留三位小数点', duration: 2000 })
              return false
            }
            if (!rulesValue.test(parseFloat(this.createTemp.yearMaintainCost))) {
              this.$message({ type: 'error', message: '维修费用请输入自然数，最多保留三位小数点', duration: 2000 })
              return false
            }
          }
          PostDataByName(this.requestParam).then(response => {
            console.log('新增保存发送参数', this.requestParam)
            if (response.msg !== 'fail') {
              if (this.getdataListParm.parammaps.inputDatetime === null) {
                this.getdataListParm.parammaps.inputDatetime = ''
              }
              this.resetCreateTemp()
              this.$notify({ title: '成功', message: '新增成功', type: 'success', duration: 2000 })
            } else {
              failproccess(response, this.$notify)
            }
          })
        }
      })
    },
    form_edit(row) {
      if (this.dialogFormVisible) {
        return
      }
      this.edit = 0
      this.getDepartParam.parammaps.pastureId = row.pastureId
      this.getCreateDepartDownList()
      this.createTemp = Object.assign({}, row) // copy obj
      if (row.inputUser !== undefined) {
        this.createTemp.inputUser = parseInt(row.inputUser)
      }

      if (this.createTemp.eqClassId !== undefined) {
        this.defaultCheckedKeys = [this.createTemp.eqClassId]
      } else {
        this.createTemp.eqClassId = ''
        this.defaultCheckedKeys = []
      }
      this.dialogStatus = 'update'
      this.dialogFormVisible = true
      this.$nextTick(() => {
        this.$refs['createTemp'].clearValidate()
      })
      const urlArray = []
      const fileList = []
      if (row.picpath == undefined) {
        urlArray.push()
      } else if (row.picpath == '') {
        urlArray.push()
      } else {
        urlArray.push(row.picpath)
      }
      for (let i = 0; i < urlArray.length; i++) {
        const urlObj = {}
        this.$set(urlObj, 'url', urlArray[i])
        fileList.push(urlObj)
      }
      this.$set(this.createTemp, 'fileList', fileList)
      console.log(this.createTemp)
      if (this.createTemp.fileList.length >= 1) {
        this.showUpload = true
      } else {
        this.showUpload = false
      }
    },
    edit_dialog_save() {
      this.$refs['createTemp'].validate(valid => {
        if (valid) {
          console.log('-----------', this.createTemp)
          console.log(this.createTemp.providerId)
          if (this.createTemp.eqClassId == '' || this.createTemp.eqClassId == undefined || this.createTemp.eqClassId == null) {
            this.$message({ type: 'warning', message: '请选择设备类别' })
          } else {
            this.requestParam.name = 'updateAsset'
            this.requestParam.parammaps = this.createTemp
            if (this.createTemp.status === '正常') { this.createTemp.status = 17 }
            if (this.createTemp.status === '闲置') { this.createTemp.status = 18 }
            if (this.createTemp.status === '报废') { this.createTemp.status = 19 }
            if (this.createTemp.status === '封存') { this.createTemp.status = 20 }
            if (this.createTemp.providerId === '' || this.createTemp.providerId === undefined) { this.createTemp.providerId = 0 }
            if (this.createTemp.brandId === '' || this.createTemp.brandId == undefined) { this.createTemp.brandId = 0 }
            if (this.createTemp.yuanzhi === '') { this.createTemp.yuanzhi = 0 }
            if (this.createTemp.salvage === '') { this.createTemp.salvage = 0 }
            if (this.createTemp.subtractvalue === '') { this.createTemp.subtractvalue = 0 }
            if (this.createTemp.yearUpkeepCost === '') { this.createTemp.yearUpkeepCost = 0 }
            if (this.createTemp.yearMaintainCost === '') { this.createTemp.yearMaintainCost = 0 }
            if (this.createTemp.baseHours === '') { this.createTemp.baseHours = 0 }
            if (this.createTemp.upkeepgrade === 'A' || this.createTemp.upkeepgrade === 'B' || this.createTemp.upkeepgrade === 'C') {
              this.createTemp.upkeepgrade = this.createTemp.upkeepgradeId
              this.createTemp.upkeepgradeId = ''
            }
            this.createTemp.deptId = this.createTemp.deptId
            this.createTemp.departmentName = this.createTemp.departmentName
            this.createTemp.employeeId = this.createTemp.employeId
            // var rulesValue = /^\d+(\.\d{1,3})?$/
            this.requestParam.parammaps = this.createTemp
            if (this.tabName === 'first') {
              this.requestParam.parammaps.SHStatus = this.createTemp.SHStatus
            } else if (this.tabName === 'second') {
              this.requestParam.parammaps.SHStatus = 0
            }
            const picpath = parseInt(this.createTemp.picpath)
            if (isNaN(picpath) == false) {
              this.requestParam.parammaps.picpath = this.createTemp.picpath
            } else {
              this.requestParam.parammaps.picpath = this.createTemp.picId
            }
            PostDataByName(this.requestParam).then(response => {
              console.log(response)
              if (response.msg !== 'fail') {
                if (this.getdataListParm.parammaps.inputDatetime1 === null) {
                  this.getdataListParm.parammaps.inputDatetime1 = ''
                }
                this.get_table_data()
                this.get_table_dataSH()
                this.dialogFormVisible = false
                this.$notify({ title: '成功', message: '保存成功-', type: 'success', duration: 2000 })
                // this.reload()
              } else {
                failproccess(response, this.$notify)
              }
            })
          }
        }
      })
    },
    brandSearch(queryString, cb) {
      console.log('品牌模糊查询输入值', queryString)
      this.requestBrand.parammaps['brandName'] = queryString
      GetDataByName(this.requestBrand).then(response => {
        console.log('品牌模糊查询搜索data', response.data.list)
        this.BrandList = response.data.list
        cb(this.BrandList)
      })
    },
    handleSelectBrand(item) {
      console.log('品牌模糊查询选中值', item)
      this.$set(this.createTemp, 'brandName', item.brandName)
      this.$set(this.createTemp, 'brandId', item.brandId)
      this.$forceUpdate()
    },
    employeSearch(queryString, cb) {
      console.log('责任人模糊查询输入值', queryString)
      this.requestEmploye.parammaps['empname'] = queryString
      GetDataByName(this.requestEmploye).then(response => {
        console.log('责任人模糊查询搜索data', response.data.list)
        this.employeList = response.data.list
        cb(this.employeList)
      })
    },
    handleSelectEmploye(item) {
      console.log('责任人模糊查询选中值', item)
      this.$set(this.createTemp, 'employeId', item.id)
      this.$set(this.createTemp, 'employeName', item.name)
      this.$forceUpdate()
    },
    form_see(row) {
      console.log(row)
      this.seeTemp = Object.assign({}, row) // copy obj
      this.activeName = 'first'
      this.dialogStatus = 'card'
      this.dialogFormVisible_See = true
      // 流程图
      var reason = '未通过原因:' + this.seeTemp.workflowNote
      if (this.seeTemp.SHStatus === 0) {
        this.activeList = [{ title: '提交信息', date: this.seeTemp.inputDatetime, name: this.seeTemp.inputUserName }, { title: '设备中心审核' }]
        this.active = 1
      } else if (this.seeTemp.SHStatus === 1) {
        this.activeList = [{ title: '提交信息', date: this.seeTemp.inputDatetime, name: this.seeTemp.inputUserName }, { title: '设备中心审核', date: this.seeTemp.chargeDate, name: this.seeTemp.chargePerson }]
        this.active = 2
      } else if (this.seeTemp.SHStatus === 2) {
        this.activeList = [{ title: '提交信息', date: this.seeTemp.inputDatetime, name: this.seeTemp.inputUserName }, { title: '设备中心审核', date: this.seeTemp.chargeDate, name: this.seeTemp.chargePerson, status: 'error', reason: reason }]
        this.active = 2
      }
      // 查看-点检记录
    },
    form_seeTabClick(val) {
      console.log(val)
      if (val.name == 'second') {
        this.getAssetBigSpotCheckList()
      } else if (val.name == 'third') {
        this.getBigupkeepbyeqList()
      } else if (val.name == 'fouth') {
        this.getAssetMaintainList()
      } else if (val.name == 'fifth') {
        this.getAssetSTTList()
      } else if (val.name == 'sixth') {
        this.getAssetChangeList()
      } else if (val.name == 'seventh') {
        this.getAssetPartApplyList()
      } else if (val.name == 'eighth') {
        this.getBarChart1Parm.parammaps.eqId = this.seeTemp.id
        this.getBarChart2Parm.parammaps.eqId = this.seeTemp.id
        this.getChartSeeParm.parammaps.eqId = this.seeTemp.id

        this.getBarChart1()
        this.getBarChart2()
      }
    },
    // 点检记录
    getAssetBigSpotCheckList() {
      this.listLoadingSpotCheck1 = true
      if (this.$refs['inputDatetimeCheck1'] !== undefined && this.$refs['inputDatetimeCheck1'].value !== null) {
        this.getAssetBigSpotCheckListParm.parammaps.startTime = this.$refs['inputDatetimeCheck1'].value[0]
        this.getAssetBigSpotCheckListParm.parammaps.stopTime = this.$refs['inputDatetimeCheck1'].value[1]
      } else {
        this.getAssetBigSpotCheckListParm.parammaps.startTime = ''
        this.getAssetBigSpotCheckListParm.parammaps.stopTime = ''
      }
      this.getAssetBigSpotCheckListParm.parammaps.assetId = this.seeTemp.assetId
      this.getAssetBigSpotCheckListParm.parammaps.pastureId = this.seeTemp.pastureId
      GetDataByName(this.getAssetBigSpotCheckListParm).then(response => {
        console.log('点检记录-table数据', response.data.list)
        if (response.data.list !== null) {
          this.listSpotCheck1 = response.data.list
          this.pageNumSpotCheck1 = response.data.pageNum
          this.pageSizeSpotCheck1 = response.data.pageSize
        } else {
          this.listSpotCheck1 = []
        }
        this.totalSpotCheck1 = response.data.total
        setTimeout(() => {
          this.listLoadingSpotCheck1 = false
        }, 100)
      })
    },
    form_searchSportCheck() {
      if (this.getAssetBigSpotCheckListParm.parammaps.inputDatetimeCheck1 == null) {
        this.getAssetBigSpotCheckListParm.parammaps.inputDatetimeCheck1 = ''
      }
      this.getAssetBigSpotCheckListParm.offset = 1
      this.getAssetBigSpotCheckList()
    },
    // 保养记录
    getBigupkeepbyeqList() {
      this.listLoadingSpotCheck1 = true
      if (this.$refs['inputDatetimeUpkeepbyeq'] !== undefined && this.$refs['inputDatetimeUpkeepbyeq'].value !== null) {
        this.getBigupkeepbyeqParm.parammaps.startTime = this.$refs['inputDatetimeUpkeepbyeq'].value[0]
        this.getBigupkeepbyeqParm.parammaps.stopTime = this.$refs['inputDatetimeUpkeepbyeq'].value[1]
      } else {
        this.getBigupkeepbyeqParm.parammaps.startTime = ''
        this.getBigupkeepbyeqParm.parammaps.stopTime = ''
      }
      this.getBigupkeepbyeqParm.parammaps.assetId = this.seeTemp.assetId
      this.getBigupkeepbyeqParm.parammaps.pastureId = this.seeTemp.pastureId
      GetDataByName(this.getBigupkeepbyeqParm).then(response => {
        console.log('保养记录-table数据', response.data.list)
        if (response.data.list !== null) {
          this.listUpkeepbyeq = response.data.list
          this.pageNumUpkeepbyeq = response.data.pageNum
          this.pageSizeUpkeepbyeq = response.data.pageSize
        } else {
          this.listUpkeepbyeq = []
        }
        this.totalUpkeepbyeq = response.data.total
        setTimeout(() => {
          this.listLoadingSpotCheck1 = false
        }, 100)
      })
    },
    form_searchUpkeepbyeq() {
      if (this.getBigupkeepbyeqParm.parammaps.inputDatetimeUpkeepbyeq === null) {
        this.getBigupkeepbyeqParm.parammaps.inputDatetimeUpkeepbyeq = ''
      }
      this.getBigupkeepbyeqParm.offset = 1
      this.getBigupkeepbyeqList()
    },
    // 维修记录
    getAssetMaintainList() {
      this.listLoadingAssetMaintain = true
      if (this.$refs['inputDatetimeAssetMaintain'] !== undefined && this.$refs['inputDatetimeAssetMaintain'].value !== null) {
        this.getAssetMaintainParm.parammaps.startTime = this.$refs['inputDatetimeAssetMaintain'].value[0]
        this.getAssetMaintainParm.parammaps.stopTime = this.$refs['inputDatetimeAssetMaintain'].value[1]
      } else {
        this.getAssetMaintainParm.parammaps.startTime = ''
        this.getAssetMaintainParm.parammaps.stopTime = ''
      }
      this.getAssetMaintainParm.parammaps.assetId = this.seeTemp.assetId
      this.getAssetMaintainParm.parammaps.pastureId = this.seeTemp.pastureId
      GetDataByName(this.getAssetMaintainParm).then(response => {
        console.log('维修记录-tabile数据', response.data.list)
        if (response.data.list !== null) {
          this.listAssetMaintain = response.data.list
          this.pageNumAssetMaintain = response.data.pageNum
          this.pageSizeAssetMaintain = response.data.pageSize
        } else {
          this.listAssetMaintain = []
        }

        this.totalAssetMaintain = response.data.total

        setTimeout(() => {
          this.listLoadingAssetMaintain = false
        }, 100)
      })
    },
    form_searchAssetMaintain() {
      if (this.getBigupkeepbyeqParm.parammaps.inputDatetimeAssetMaintan === null) {
        this.getBigupkeepbyeqParm.parammaps.inputDatetimeAssetMaintan = ''
      }
      this.getBigupkeepbyeqParm.offset = 1
      this.getAssetMaintainList()
    },
    // 启停记录
    getAssetSTTList() {
      this.listLoadingAssetSTT = true
      this.getAssetSTTParm.parammaps.assetId = this.seeTemp.assetId
      this.getAssetSTTParm.parammaps.pastureId = this.seeTemp.pastureId
      GetDataByName(this.getAssetSTTParm).then(response => {
        console.log('启停记录-tabile数据', response.data.list)
        if (response.data.list !== null) {
          this.listAssetSTT = response.data.list
          this.pageNumAssetSTT = response.data.pageNum
          this.pageSizeAssetSTT = response.data.pageSize
        } else {
          this.listAssetSTT = []
        }
        this.totalAssetSTT = response.data.total
        setTimeout(() => {
          this.listLoadingAssetSTT = false
        }, 100)
      })
    },
    form_searchAssetSTT() {
      if (this.getAssetSTTParm.parammaps.startTime == null) {
        this.getAssetSTTParm.parammaps.startTime = ''
      }
      if (this.getAssetSTTParm.parammaps.stopTime == null) {
        this.getAssetSTTParm.parammaps.stopTime = ''
      }
      this.getAssetSTTParm.offset = 1
      this.getAssetSTTList()
    },
    // 变更记录
    getAssetChangeList() {
      this.listLoadingAssetChange = true
      console.log(this.$refs['inputDatetimeAssetChange'])
      if (this.$refs['inputDatetimeAssetChange'] !== undefined && this.$refs['inputDatetimeAssetChange'].value !== null) {
        this.getAssetChangeParm.parammaps.startTime = this.$refs['inputDatetimeAssetChange'].value[0]
        this.getAssetChangeParm.parammaps.stopTime = this.$refs['inputDatetimeAssetChange'].value[1]
      } else {
        this.getAssetChangeParm.parammaps.startTime = ''
        this.getAssetChangeParm.parammaps.stopTime = ''
      }
      this.getAssetChangeParm.parammaps.assetId = this.seeTemp.assetId
      this.getAssetChangeParm.parammaps.pastureId = this.seeTemp.pastureId
      GetDataByName(this.getAssetChangeParm).then(response => {
        console.log('变更记录-tabile数据', response.data.list)
        if (response.data.list !== null) {
          this.listAssetChange = response.data.list
          this.pageNumAssetChange = response.data.pageNum
          this.pageSizeAssetChange = response.data.pageSize
        } else {
          this.listAssetChange = []
        }
        this.totalAssetChange = response.data.total
        setTimeout(() => {
          this.listLoadingAssetChange = false
        }, 100)
      })
    },
    form_searchAssetChange() {
      if (this.getAssetChangeParm.parammaps.inputDatetimeAssetChange === null) {
        this.getAssetChangeParm.parammaps.inputDatetimeAssetChange = ''
      }
      this.getAssetChangeParm.offset = 1
      this.getAssetChangeList()
    },
    changeStatue: function(cellValue) {
      if (cellValue.changeStatue == 17) {
        return '正常'
      } else if (cellValue.changeStatue == 18) {
        return '闲置'
      } else if (cellValue.changeStatue == 19) {
        return '报废'
      } else if (cellValue.changeStatue == 20) {
        return '封存'
      }
    },
    // 备件领用记录
    getAssetPartApplyList() {
      this.listLoadingAssetChange = true
      console.log(this.$refs['inputDatetimeAssetPartApply'].value)
      if (this.$refs['inputDatetimeAssetPartApply'] !== undefined && this.$refs['inputDatetimeAssetPartApply'].value !== null && this.$refs['inputDatetimeAssetPartApply'].value !== '') {
        this.getAssetPartApplyParm.parammaps.startTime = this.$refs['inputDatetimeAssetPartApply'].value[0]
        this.getAssetPartApplyParm.parammaps.stopTime = this.$refs['inputDatetimeAssetPartApply'].value[1]
      } else {
        this.getAssetPartApplyParm.parammaps.startTime = ''
        this.getAssetPartApplyParm.parammaps.stopTime = ''
      }
      this.getAssetPartApplyParm.parammaps.assetId = this.seeTemp.assetId
      this.getAssetPartApplyParm.parammaps.pastureId = this.seeTemp.pastureId
      GetDataByName(this.getAssetPartApplyParm).then(response => {
        console.log('备件领用记录-tabile数据', response.data.list)
        if (response.data.list !== null) {
          this.listAssetPartApply = response.data.list
          this.pageNumAssetPartApply = response.data.pageNum
          this.pageSizeAssetPartApply = response.data.pageSize
        } else {
          this.listAssetPartApply = []
        }
        this.totalAssetPartApply = response.data.total
        setTimeout(() => {
          this.listLoadingAssetPartApply = false
        }, 100)
      })
    },
    form_searchAssetPartApply() {
      this.listLoadingAssetChange = true
      if (this.getAssetPartApplyParm.parammaps.inputDatetimeAssetChange == null) {
        this.getAssetPartApplyParm.parammaps.inputDatetimeAssetChange = ''
      }
      this.getAssetPartApplyParm.offset = 1
      this.getAssetPartApplyList()
    },
    getBarChart1() {
      GetReportform(this.getBarChart1Parm).then(response => {
        console.log('图1', response)
        this.chart_data1 = response.data.chart_data
        var repireCost = response.data.chart_data.repireCost
        var upkeepCost = response.data.chart_data.upkeepCost
        var totaltitle1 = 0
        if (repireCost !== null || repireCost !== undefined) {
          repireCost.forEach(function(item, index) {
            console.log(parseFloat(item))
            totaltitle1 = totaltitle1 + parseFloat(item)
          })
        }
        var totaltitle2 = 0
        if (upkeepCost !== null || upkeepCost !== undefined) {
          upkeepCost.forEach(function(item, index) {
            console.log(parseFloat(item))
            totaltitle2 = totaltitle2 + parseFloat(item)
          })
        }
        this.totaltitle = totaltitle1 + totaltitle2
        this.roadBarChart1(this.chart_data1, this.totaltitle.toFixed(2))
      })
    },
    roadBarChart1(chart_data1, totaltitle) {
      console.log(chart_data1, totaltitle)
      if (this.barChart1 != null) {
        this.barChart1.dispose()
      }
      this.barChart1 = echarts.init(document.getElementById('barChart1'))
      var option = {
        title: { text: '年度费用统计（总费用:' + totaltitle + '元）', textStyle: { color: '#769cfc' }},
        tooltip: {
          trigger: 'axis',
          axisPointer: { // 坐标轴指示器，坐标轴触发有效
            type: 'shadow' // 默认为直线，可选为:'line' | 'shadow'
          },
          formatter: function(data) {
            console.log(data.length)
            var value = 0
            let val = ''
            if (data.length == 1) {
              val += data[0].seriesName + ':' + data[0].data + '元<br/>'
            } else {
              value = (parseFloat(data[0].value) + parseFloat(data[1].value)).toFixed(2)
              // eslint-disable-next-line no-unused-vars
              val = data[0].name + '年设备总费用:' + value + '元' + '<br/>'
              val += '维修费用:' + data[0].data + '元<br/>'
              val += '保养费用:' + data[1].data + '元<br/>'
            }
            return val
          }
        },
        legend: {
          data: ['维修费用', '保养费用'],
          x: 'right'
        },
        color: ['#769cfc', '#42b983'],
        grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true },
        xAxis: [
          { type: 'category', data: this.chart_data1.year }
        ],
        yAxis: [
          { type: 'value', name: '费用(元)' }
        ],
        series: [
          { name: '维修费用', type: 'bar', barWidth: 60, stack: '广告', data: this.chart_data1.repireCost },
          { name: '保养费用', type: 'bar', barWidth: 60, stack: '广告', data: this.chart_data1.upkeepCost }
        ]
      }
      this.barChart1.setOption(option)
      var that = this
      window.onresize = function() {
        that.barChart1.resize()
      }
      this.barChart1.on('click', function(param, i) {
        console.log(param)
        that.getBarChart2Parm.parammaps.receiveTime = param.name
        that.getBarChart2()
        that.getBarChart1()
      })
    },
    getBarChart2() {
      GetReportform(this.getBarChart2Parm).then(response => {
        console.log('图2', response)
        this.chart_data2 = response.data.chart_data
        this.roadBarChart2(this.chart_data2)
      })
    },
    roadBarChart2(chart_data1) {
      if (this.barChart2 != null) {
        this.barChart2.dispose()
      }
      this.barChart2 = echarts.init(document.getElementById('barChart2'))
      var option = {
        title: { text: this.getBarChart2Parm.parammaps.receiveTime + '年月度费用统计', textStyle: { color: '#769cfc' }},
        tooltip: {
          trigger: 'axis',
          axisPointer: { // 坐标轴指示器，坐标轴触发有效
            type: 'shadow' // 默认为直线，可选为:'line' | 'shadow'
          },
          formatter: function(data) {
            console.log(data)
            var value = 0
            var val = ''
            if (data.length == 1) {
              val += data[0].seriesName + ':' + data[0].data + '元<br/>'
            } else {
              value = (parseFloat(data[0].value) + parseFloat(data[1].value)).toFixed(2)
              val = data[0].name + '月设备总费用:' + value + '元' + '<br/>'
              val += '维修费用:' + data[0].data + '元<br/>'
              val += '保养费用:' + data[1].data + '元<br/>'
            }
            return val
          }
        },
        legend: {
          data: ['维修费用', '保养费用'],
          x: 'right'
        },
        color: ['#769cfc', '#42b983'],
        grid: {
          left: '3%',
          right: '4%',
          bottom: '3%',
          containLabel: true
        },
        xAxis: [
          { type: 'category', data: this.chart_data2.months }
        ],
        yAxis: [
          { type: 'value', name: '费用(元)' }
        ],
        series: [
          { name: '维修费用', type: 'bar', stack: '广告', data: this.chart_data2.repireCost },
          { name: '保养费用', type: 'bar', stack: '广告', data: this.chart_data2.upkeepCost }
        ]
      }
      this.barChart2.setOption(option)
      var that = this
      window.onresize = function() {
        that.barChart2.resize()
      }
      this.barChart2.on('click', function(param, i) {
        console.log(param)
        that.dialogFormVisible_ChartSee = true
        that.dialogStatus = 'card'
        that.getChartSeeParm.parammaps.receiveTime = param.name
        that.getChartSeeList()
        that.getBarChart1()
        that.getBarChart2()
      })
    },
    getChartSeeList() {
      this.listLoadingChartSee = true
      if (this.$refs['inputDatetime2'] !== undefined && this.$refs['inputDatetime2'].value !== null) {
        this.getChartSeeParm.parammaps.startTime = this.$refs['inputDatetime2'].value[0]
        this.getChartSeeParm.parammaps.stopTime = this.$refs['inputDatetime2'].value[1]
      } else {
        this.getChartSeeParm.parammaps.startTime = ''
        this.getChartSeeParm.parammaps.stopTime = ''
      }
      GetDataByName(this.getChartSeeParm).then(response => {
        console.log('table数据', response.data.list)
        if (response.data.list !== null) {
          this.listChartSee = response.data.list
          this.pageNumChartSee = response.data.pageNum
          this.pageSizeChartSee = response.data.pageSize
          if (response.data.total) {
            this.totalChartSee = response.data.total
          }
        } else {
          this.listChartSee = []
        }
        setTimeout(() => {
          this.listLoadingChartSee = false
        }, 100)
      })
    },
    form_searchChartSee() {
      this.listLoadingChartSee = true
      if (this.getChartSeeParm.parammaps.inputDatetime2 === null) {
        this.getChartSeeParm.parammaps.inputDatetime2 = ''
      }
      this.getChartSeeParm.offset = 1
      this.getChartSeeList()
    },
 
    form_delete(row) {
      MessageBox.confirm('确认删除此信息?', {
        confirmButtonText: '确认',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.requestParam.name = 'deleteAsset'
        this.requestParam.parammaps = {}
        this.requestParam.parammaps['id'] = row.id
        PostDataByName(this.requestParam).then(() => {
          if (this.getdataListParm.parammaps.inputDatetime1 === null) {
            this.getdataListParm.parammaps.inputDatetime1 = ''
          }
          this.get_table_data()
        
          this.dialogFormVisible = false
          this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
        })
      }).catch(() => {
        this.$message({ type: 'info', message: '已取消删除' })
      })
    },
    getDownClassList() {
      getRecuData(this.getRecuListParm).then(response => {
        this.parentClass = response.data
      })
    },

    getEQNumber() {
      this.getdataEQNumber.parammaps.pastureId = Cookies.get('pastureid')
      GetDataByName(this.getdataEQNumber).then(response => {

        
        this.createTemp.assetCode = response.data.list[0].createNumber
        console.log(response.data.list[0].createNumber)
        console.log(this.createTemp.assetCode)
        this.$forceUpdate()
        
      })
    },

   
 
    changeSHStatue(val) {
      if (val == 2) {
        this.statueReason = true
      } else {
        this.statueReason = false
      }
    },
   
 
   
   
    changeBatchDept(item) {
      console.log(item)
      this.batchChange.getdataListParmPerson.parammaps.deptId = item
      this.batchChange.temp.employeeId = ''
      this.batchChange.getdataListParmPerson.parammaps.pastureId = this.batchChange.deptList.find(obj => obj.deptid == item).pastureId
      this.getBatchChangePersonDownList()
    },
    getBatchChangePersonDownList() {
      GetDataByName(this.batchChange.getdataListParmPerson).then(response => {
        if (response.data.list !== null) {
          this.batchChange.personList = response.data.list
        } else {
          this.batchChange.personList = []
        }
      })
    },
    changeBatchPerson(item) {
      console.log(item)
      this.batchChange.temp.employeeId = item
      this.batchChange.temp.employeName = this.batchChange.personList.find(obj => obj.id == item).empname
      this.$forceUpdate()
    },
    changeData() {
      this.isokDisable = true
      setTimeout(() => {
        this.isokDisable = false
      }, 1000)
      this.$refs['batchChangeTemp'].validate(valid => {
        if (valid) {
          this.requestParam = {}
          var array = []
          for (let i = 0; i < this.selectionList.length; i++) {
            var obj = {}
            var parammaps = {}
            obj.name = 'updateEquipmentALL'
            obj.offset = 0
            obj.pagecount = 0
            parammaps.departmentId = this.batchChange.temp.departmentId
            parammaps.employeeId = this.batchChange.temp.employeeId
            parammaps.employeName = this.batchChange.temp.employeName
            parammaps.id = this.selectionList[i].id
            obj.parammaps = parammaps
            array.push(obj)
          }
          this.requestParam.array = array
          PostDataByNames(this.requestParam).then(response => {
            if (response.msg !== 'fail') {
              this.dialogFormVisible_change = false
              this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
              this.get_table_data()
            } else {
              failproccess(response, this.$notify)
            }
          })
        }
      })
    }
  }
}
</script>
<style lang="scss" scoped>
  .el-autocomplete-suggestion li{
    padding:0 3px!important;
  }
  .el-table .warning-row {
      background: oldlace;
  }
  .el-table .success-row {
      background: #f0f9eb;
  }
</style>
<style lang="scss">
  .upkeepgrade .el-form-item__label{
    line-height: 20px;
  }
  .inputDatetime .el-range-separator{
   padding: 0;
   margin: 0 10px;
  }
  .el-radio__label{
    padding-left: 2px !important;
  }
</style>
<style>
  .el-table .goBeyond { background: #F47C7C ; }
  .el-table .warning { background: #989DF0; }
  .el-table .scrap { background: #D7D7D7; }
</style>
