123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816 |
- <template>
- <div class="app-container">
- <div v-if="isPercentage" class="percentage" style="width: 210px;height: 90px;background: #fff;position: fixed;bottom: 0;left: 0;z-index: 9999999999999;">
- <h4 style="padding-left: 10px;line-height: 0;">导出进度:</h4>
- <el-progress style="padding-left: 10px;" :text-inside="true" :stroke-width="26" :percentage="percentage" />
- </div>
- <div class="filter-container">
- <el-select ref="pastureName" v-model="getdataListParm.parammaps.pastureName" placeholder="牧场" class="filter-item" @change="changePastureName">
- <el-option v-for="item in findAllPasture" :key="item.id" :label="item.name" :value="item.name" />
- </el-select>
- <el-input v-model="getdataListParm.parammaps.assetCode" placeholder="设备内部编号" clearable class="filter-item" style="width: 130px" />
- <el-input v-model="getdataListParm.parammaps.eqName" placeholder="设备名称" style="width: 130px;" class="filter-item" />
- <el-select v-model="getdataListParm.parammaps.departmentId" clearable placeholder="部门" class="filter-item" style="width: 100px">
- <el-option v-for="item in findAllDepart" :key="item.id" :label="item.name" :value="item.id" />
- </el-select>
- <el-select v-model="getdataListParm.parammaps.status" clearable placeholder="状态" class="filter-item" style="width: 100px">
- <el-option v-for="item in getDictByName" :key="item.id" :label="item.label" :value="item.id" />
- </el-select>
- <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="form_search">搜索</el-button>
- <div>
- <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="form_add">变更</el-button>
- <el-button class="filter-item" type="success" icon="el-icon-download" style="" @click="handleDownload">导出</el-button>
- </div>
- </div>
- <el-table
- :key="tableKey"
- v-loading="listLoading"
- element-loading-text="给我一点时间"
- :data="list"
- border
- fit
- highlight-current-row
- style="width: 100%;"
- :row-style="rowStyle"
- :cell-style="cellStyle"
- class="elTable"
- >
- <!-- table表格 -->
- <el-table-column label="序号" align="center" type="index" width="50px">
- <template slot-scope="scope">
- <span>{{ scope.$index + (pageNum-1) * pageSize + 1 }}</span>
- </template>
- </el-table-column>
- <el-table-column label="牧场" min-width="110px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.pastureName }}</span>
- </template>
- </el-table-column>
- <!-- <el-table-column label="资产编号" min-width="130px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.assetCode }}</span>
- </template>
- </el-table-column> -->
- <el-table-column label="设备名称" min-width="110px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.eqName }}</span>
- </template>
- </el-table-column>
- <el-table-column label="设备内部编号" min-width="110px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.eqCode }}</span>
- </template>
- </el-table-column>
- <el-table-column label="规格" min-width="110px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.specification }}</span>
- </template>
- </el-table-column>
- <el-table-column label="品牌" min-width="90px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.brandName }}</span>
- </template>
- </el-table-column>
- <el-table-column label="设备图片" min-width="110px" align="center">
- <template slot-scope="scope">
- <el-popover placement="right" title="" trigger="hover">
- <img v-if="scope.row.picpath !== ''" :src="scope.row.picpath">
- <img v-if="scope.row.picpath !== ''" slot="reference" :src="scope.row.picpath" :alt="scope.row.srcpath" style="height: 100px;width:100px;">
- </el-popover>
- </template>
- </el-table-column>
- <el-table-column label="部门" width="90px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.deptName }}</span>
- </template>
- </el-table-column>
- <el-table-column label="状态" min-width="80px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.status }}</span>
- </template>
- </el-table-column>
- <el-table-column label="变更日期" sortable prop="changeTime" min-width="110px" align="center" />
- <el-table-column label="操作" align="center" width="200" class-name="small-padding fixed-width" fixed="right">
- <template slot-scope="{row}">
- <el-button type="warning" size="mini" @click="form_edit(row)">状态变更</el-button>
- <el-button type="primary" size="mini" @click="form_see(row)">变更记录</el-button>
- </template>
- </el-table-column>
- </el-table>
- <pagination v-show="total>0" :total="total" :page.sync="getdataListParm.offset" :limit.sync="getdataListParm.pagecount" @pagination="getList" />
- <!-- 弹出层新增or修改 -->
- <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" :close-on-click-modal="false">
- <el-form ref="temp" :rules="rules" :model="temp" label-position="right" label-width="140px">
- <el-row>
- <el-col :span="8">
- <el-form-item label="设备名称:" prop="assetName">
- <el-autocomplete
- ref="assetName"
- v-model="temp.assetName"
- value-key="assetName"
- class="inline-input"
- :fetch-suggestions="formNameSearch"
- placeholder="请输入内容"
- :disabled="dialogStatus==='update'"
- style="width:100%;"
- @select="handleformNameSelect"
- >
- <template slot-scope="{ item }">
- <div class="name" style="display: inline;">{{ item.eqName }}</div>
- <span class="addr">{{ item.eqCode }}</span>
- </template>
- </el-autocomplete>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="牧场设备编号:" prop="eqCode">
- <el-autocomplete
- ref="eqCode"
- v-model="temp.eqCode"
- value-key="eqCode"
- class="inline-input"
- :fetch-suggestions="formNumberSearch"
- placeholder="请输入内容"
- :disabled="dialogStatus==='update'"
- style="width:100%;"
- @select="handleformNumberSelect"
- >
- <template slot-scope="{ item }">
- <div class="name" style="display: inline;">{{ item.eqName }}</div>
- <span class="addr">{{ item.eqCode }}</span>
- </template>
- </el-autocomplete>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="变更状态:">
- <!-- <el-input v-model="temp.changeStatue" style="width:250px;" /> -->
- <el-select v-model="temp.status" clearable placeholder="状态" class="filter-item" style="width:100%;">
- <el-option v-for="item in getDictByName" :key="item.id" :label="item.label" :value="item.id" />
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="8">
- <el-form-item label="牧场:">
- <!-- <span>{{ temp.pastureName }}</span> -->
- <el-input v-model="temp.pastureName" disabled style="width:100%;" />
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="部门:">
- <el-input v-model="temp.deptName" disabled style="width:100%;" />
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="变更时间:" prop="inputDatetime">
- <el-date-picker
- v-model="temp.inputDatetime"
- type="date"
- placeholder="变更时间"
- style="width:100%;"
- :picker-options="pickerOptions0"
- />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="8">
- <el-form-item label="变更人:" prop="empId">
- <el-select v-model="temp.empId" placeholder="操作人" class="filter-item" style="width:100%;">
- <el-option
- v-for="item in findAllEmploye"
- :key="item.id"
- :label="item.name"
- :value="item.id"
- />
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="dialogStatus==='create'?add_dialog_save():edit_dialog_save()">确认</el-button>
- <el-button @click="dialogFormVisible = false;getList()">关闭</el-button>
- </div>
- </el-dialog>
- <!-- 变更记录 -->
- <el-dialog :title="cardTitle" :visible.sync="dialogFormVisibleCard" :close-on-click-modal="false" width="90%">
- <div class="app-contentcard">
- <el-form ref="rowSeeData" :rules="rules" :model="rowSeeData" label-position="right" label-width="120px" style="width: 100%;margin:0 auto;">
- <div class="filter-container">
- <el-select
- v-model="getdataListParmSee.parammaps.changeStatue"
- clearable
- placeholder="状态"
- class="filter-item"
- style="width: 100px"
- >
- <el-option
- v-for="item in getDictByName"
- :key="item.id"
- :label="item.label"
- :value="item.id"
- />
- </el-select>
- <el-date-picker ref="inputDatetime2" v-model="getdataListParmSee.parammaps.inputDatetime" class="inputDatetime" type="datetimerange" style="width: 250px;top:-3px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" />
- <el-button
- v-waves
- class="filter-item"
- type="primary"
- icon="el-icon-search"
- @click="form_searchDelivery"
- >搜索</el-button>
- </div>
- </el-form>
- <el-table
- :key="tableKey"
- v-loading="listLoadingSee"
- element-loading-text="给我一点时间"
- :data="listSee"
- border
- fit
- highlight-current-row
- style="width: 100%;"
- :row-style="rowStyle"
- :cell-style="cellStyle"
- class="elTable"
- >
- <el-table-column label="序号" align="center" type="index" width="50px">
- <template slot-scope="scope">
- <span>{{ scope.$index + (pageNum-1) * pageSize + 1 }}</span>
- </template>
- </el-table-column>
- <el-table-column label="变更日期" sortable prop="changeTime" min-width="110px" align="center" />
- <el-table-column label="变更状态" min-width="110px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.status }}</span>
- </template>
- </el-table-column>
- <el-table-column label="变更人" min-width="110px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.empname }}</span>
- </template>
- </el-table-column>
- </el-table>
- <pagination
- v-show="totalSee>0"
- :total="totalSee"
- :page.sync="getdataListParmSee.offset"
- :limit.sync="getdataListParmSee.pagecount"
- @pagination="getListSee"
- />
- <div slot="footer" class="dialog-footer" style="right:30px;position:absolute;bottom:10px">
- <el-button @click="dialogFormVisibleCard = false">关闭</el-button>
- </div>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- // 引入
- import { GetDataByName, GetDataByNames, ExecDataByConfig, GetAccount } from '@/api/common'
- import waves from '@/directive/waves' // waves directive
- import { parseTime } from '@/utils/index.js'
- // eslint-disable-next-line no-unused-vars
- import { validateEMail } from '@/utils/validate.js'
- import Pagination from '@/components/Pagination' // secondary package based on el-pagination
- // import { MessageBox } from 'element-ui'
- import Cookies from 'js-cookie'
- import { json2excel } from '@/utils/index.js'
- export default {
- name: 'Install',
- components: { Pagination },
- directives: { waves },
- data() {
- return {
- tableKey: 0,
- list: null,
- total: 0,
- listLoading: true,
- requestParam: {
- name: 'insertAsset',
- offset: 0,
- pagecount: 0,
- parammaps: {}
- },
- // 1-2:table&搜索传参
- getdataListParm: {
- name: 'geteqChangeList',
- page: 1,
- offset: 1,
- pagecount: 10,
- returntype: 'Map',
- parammaps: {
- assetCode: '',
- eqName: '',
- pastureName: Cookies.get('pasturename'),
- status: '',
- deptName: '',
- departmentId: ''
- }
- },
- downLoadParm: {},
- downLoadList: [],
- // 2-3:下拉框请求后数据加入[]
- findAllProvider: [],
- findAllAssetType: [],
- findAllPasture: [],
- findAllDepart: [],
- findAllEmploye: [],
- getDictByName: [],
- // 2-1.请求下拉框接口
- requestParams: [
- { name: 'findAllProvider', 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: ['资产状态'] }
- ],
- getDepartParam: {
- name: 'findAllDepart', offset: 0, pagecount: 0, parammaps: { 'pastureId': Cookies.get('pastureid') }
- },
- postDataPramas: {
- 'common': { 'returnmap': '0' },
- 'data': [
- { 'name': 'updateChangeStatue', 'type': 'e',
- 'parammaps': {
- 'status': '',
- 'assetId': '',
- 'pastureId': Cookies.get('pastureid')
- }},
- { 'name': 'updateAssetChange', 'type': 'e',
- 'parammaps': {
- 'changeStatue': '',
- 'assetId': '',
- 'assetName': '',
- 'assetNumber': '',
- 'pastureId': Cookies.get('pastureid'),
- 'empId': ''
- }}
- ] },
- temp: {
- pastureName: '',
- deptName: '',
- deptId: '',
- eqName: '',
- assetId: '',
- eqCode: '',
- status: '',
- statusId: '',
- inputDatetime: new Date(),
- typeName: '',
- assTypeId: '',
- syStatus: '',
- employeId: this.$store.state.user.employeid,
- departmentId: this.$store.state.user.departmentid,
- employeName: this.$store.state.user.employename,
- pastureId: this.$store.state.user.pastureid
- },
- dialogFormVisible: false,
- dialogStatus: '',
- textMap: {
- update: '修改状态',
- create: '新增'
- },
- dialogPvVisible: false,
- requestFilterParams: {
- name: 'findAssetMain', offset: 0, pagecount: 20,
- returntype: 'Map',
- parammaps: {}
- },
- // 新加的列表用的==========================================
- cardTitle: '变更记录',
- dialogFormVisibleCard: false,
- dialogStatusCard: '',
- listLoadingSee: true,
- rowSeeData: {},
- listSee: [],
- totalSee: 0,
- getdataListParmSee: {
- name: 'getAssetchangeList',
- page: 1,
- offset: 1,
- pagecount: 10,
- returntype: 'Map',
- parammaps: {
- eqId: '',
- changeStatue: '',
- inputDatetime: '',
- startTime: '',
- stopTime: '',
- pastureId: Cookies.get('pastureid')
- }
- },
- checkStatus: '',
- // 新加的列表用的==========================================
- // 时间设置
- pickerOptions0: {
- disabledDate(time) {
- return time.getTime() > Date.now() - 8.64e6
- }
- },
- // 校验规则
- rules: {
- assetName: [{ required: true, message: '必填', trigger: 'remove-tag' }],
- eqCode: [{ required: true, message: '必填', trigger: 'expand-change' }],
- equipmentName: [{ required: true, message: '必填', trigger: 'blur' }]
- },
- rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
- cellStyle: { padding: 0 + 'px' },
- isPercentage: false,
- percentage: 1
- }
- },
- created() {
- this.get_select_list()
- this.getList()
- },
- methods: {
- // 模糊查询-名称
- formNumberSearch(queryString, cb) {
- this.requestFilterParams.parammaps['eqCode'] = queryString
- this.requestFilterParams.parammaps['assetName'] = ''
- this.requestFilterParams.parammaps['pastureId'] = this.$store.state.user.pastureid
- GetDataByName(this.requestFilterParams).then(response => {
- cb(response.data.list)
- })
- },
- formNameSearch(queryString, cb) {
- this.requestFilterParams.parammaps['eqCode'] = ''
- this.requestFilterParams.parammaps['assetName'] = queryString
- this.requestFilterParams.parammaps['pastureId'] = this.$store.state.user.pastureid
- GetDataByName(this.requestFilterParams).then(response => {
- cb(response.data.list)
- })
- },
- handleformNumberSelect(item) {
- this.temp.assetNumber = item.assetNumber
- this.temp.assetName = item.assetName
- this.temp.eqCode = item.eqCode
- this.temp.eqName = item.eqName
- this.temp.eqId = item.eqId
- this.temp.id = item.assetId
- this.temp.assetId = item.assetId
- this.temp.pastureId = item.pastureId
- this.temp.pastureName = item.pastureName
- this.temp.deptName = item.deptName
- this.temp.deptId = item.deptName
- this.temp.changeStatue = item.changeStatue
- this.temp.status = item.status
- // this.temp.statusId = item.statusId
- this.checkStatus = item.status
- this.temp.employeId = item.employeId
- this.temp.employeName = item.employeName
- this.temp.inputDatetime = new Date()
- // this.temp.inputDatetime = this.temp.inputDatetime
- if (item.sttId === undefined || item.sttId === null) {
- this.temp.sttId = 0
- } else {
- this.temp.sttId = item.sttId
- }
- },
- handleformNameSelect(item) {
- console.log(item)
- this.temp.assetNumber = item.assetNumber
- this.temp.assetName = item.assetName
- this.temp.eqCode = item.eqCode
- this.temp.eqName = item.eqName
- this.temp.eqId = item.eqId
- this.temp.id = item.assetId
- this.temp.assetId = item.assetId
- this.temp.pastureId = item.pastureId
- this.temp.pastureName = item.pastureName
- this.temp.deptName = item.deptName
- this.temp.deptId = item.deptName
- this.temp.changeStatue = item.changeStatue
- this.temp.status = item.status
- // this.temp.statusId = item.statusId
- this.checkStatus = item.status
- this.temp.employeId = item.employeId
- this.temp.employeName = item.employeName
- // this.temp.inputDatetime = parse(new Date(), '{y}-{m}-{d} {h}:{i}')
- // this.temp.inputDatetime = this.temp.inputDatetime
- console.log(item.inputDatetime)
- if (item.sttId === undefined || item.sttId === null) {
- this.temp.sttId = 0
- } else {
- this.temp.sttId = item.sttId
- }
- },
- // 1-1: table&搜索
- getList() {
- this.listLoading = true
- GetDataByName(this.getdataListParm).then(response => {
- console.log('表格:', response.data.list)
- this.list = response.data.list
- if (response.data.list !== null) {
- for (let i = 0; i < response.data.list.length; i++) {
- if (response.data.list[i].srcpath !== null && response.data.list[i].picpath !== null && response.data.list[i].srcpath !== undefined && response.data.list[i].picpath !== undefined) {
- this.list[i].srcpath = process.env.VUE_APP_BASE_API + response.data.list[i].srcpath
- this.list[i].picpath = process.env.VUE_APP_BASE_API + response.data.list[i].picpath
- } else {
- this.list[i].srcpath = ''
- this.list[i].picpath = ''
- }
- console.log(this.list[i].srcpath)
- }
- }
- this.pageNum = response.data.pageNum
- this.pageSize = response.data.pageSize
- if (response.data.total) {
- this.total = response.data.total
- }
- // this.$refs['pastureName'].val = Cookies.get('employename')
- // console.log('-----------',this.$refs['pastureName'])
- // Just to simulate the time of the request
- setTimeout(() => {
- this.listLoading = false
- }, 100)
- })
- },
- // 2-2:下拉框
- get_select_list() {
- GetDataByNames(this.requestParams).then(response => {
- 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.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()
- },
- form_search() {
- this.listLoading = true
- this.getdataListParm.offset = 1
- this.getList()
- },
- handleModifyStatus(row, statusId) {
- this.$message({
- message: '操作成功',
- type: 'success'
- })
- // row.status = status
- row.statusId = statusId
- },
- form_reset() {
- this.temp = {
- pastureName: '',
- deptName: '',
- deptId: '',
- employeName: '',
- eqName: '',
- assetId: '',
- eqCode: '',
- status: '',
- statusId: '',
- inputDatetime: new Date(),
- typeName: '',
- assTypeId: '',
- syStatus: '',
- employeId: this.$store.state.user.employeid,
- departmentId: this.$store.state.user.departmentid,
- employeName: this.$store.state.user.employeid,
- pastureId: this.$store.state.user.pastureid
- }
- this.checkStatus = ''
- // this.temp.inputDatetime = parseTime(new Date(), '{y}-{m}-{d} {h}:{i}')
- // this.temp.typeName = ''
- // this.temp.assTypeId = ''
- // this.temp.eqName = ''
- // this.temp.eqCode = ''
- // this.temp.deptName = ''
- // this.temp.deptId = ''
- // this.temp.status = ''
- // this.temp.statusId = ''
- // this.temp.pastureName = ''
- // this.temp.employeId = this.$store.state.user.employeId
- // this.temp.departmentId = this.$store.state.user.departmentid
- },
- add_dialog_save() {
- if (this.temp.assetId == '' || this.temp.eqCode == '' || this.temp.eqName == '') {
- this.$notify({
- title: '',
- message: '请输入设备名称或设备内部编号',
- type: 'warning',
- duration: 2000
- })
- } else {
- if (this.checkStatus == this.temp.status) {
- this.$notify({
- title: '',
- message: '请选择变更状态',
- type: 'warning',
- duration: 2000
- })
- } else {
- this.postDataPramas.data[0].parammaps.status = this.temp.status
- this.postDataPramas.data[0].parammaps.assetId = this.temp.assetId
- this.postDataPramas.data[1].parammaps.changeStatue = this.temp.status
- this.postDataPramas.data[1].parammaps.assetId = this.temp.assetId
- this.postDataPramas.data[1].parammaps.assetName = this.temp.eqName
- this.postDataPramas.data[1].parammaps.assetNumber = this.temp.eqCode
- this.postDataPramas.data[1].parammaps.empId = this.temp.empId
- ExecDataByConfig(this.postDataPramas).then(response => {
- if (response.msg === 'fail') {
- this.$notify({
- title: '变更失败',
- message: response.data,
- type: 'warning',
- duration: 2000
- })
- } else {
- this.getList()
- this.dialogFormVisible = false
- this.$notify({
- title: '',
- message: '变更成功',
- type: 'success',
- duration: 2000
- })
- }
- })
- }
- }
- },
- edit_dialog_save() {
- if (this.checkStatus == this.temp.status) {
- this.$notify({
- title: '',
- message: '请选择变更状态',
- type: 'warning',
- duration: 2000
- })
- } else {
- this.postDataPramas.data[0].parammaps.status = this.temp.status
- this.postDataPramas.data[0].parammaps.assetId = this.temp.assetId
- this.postDataPramas.data[1].parammaps.changeStatue = this.temp.status
- this.postDataPramas.data[1].parammaps.assetId = this.temp.assetId
- this.postDataPramas.data[1].parammaps.assetName = this.temp.eqName
- this.postDataPramas.data[1].parammaps.assetNumber = this.temp.eqCode
- this.postDataPramas.data[1].parammaps.empId = this.temp.empId
- this.postDataPramas.data[1].parammaps.changeId = this.temp.employeId
- ExecDataByConfig(this.postDataPramas).then(response => {
- if (response.msg === 'fail') {
- this.$notify({
- title: '变更失败',
- message: response.data,
- type: 'warning',
- duration: 2000
- })
- } else {
- this.getList()
- this.dialogFormVisible = false
- this.$notify({
- title: '',
- message: '变更成功',
- type: 'success',
- duration: 2000
- })
- }
- })
- }
- },
- form_edit(row) {
- console.log('row', row)
- this.temp = Object.assign({}, row) // copy obj
- this.temp.inputDatetime = new Date()
- this.temp.empId = this.$store.state.user.employeid
- this.checkStatus = row.status
- this.dialogStatus = 'update'
- this.dialogFormVisible = true
- this.$nextTick(() => {
- this.$refs['temp'].clearValidate()
- })
- },
- form_add() {
- this.form_reset()
- this.dialogStatus = 'create'
- this.dialogFormVisible = true
- this.temp.empId = this.$store.state.user.employeid
- this.$nextTick(() => {
- this.$refs['temp'].clearValidate()
- })
- },
- form_see(row) {
- console.log(row)
- this.rowSeeData = Object.assign({}, row)
- this.cardTitle = '变更记录 设备名称:' + row.eqName + '设备编号:' + row.eqCode
- this.dialogFormVisibleCard = true
- this.getdataListParmSee.parammaps.eqId = row.id
- this.getListSee()
- },
- form_searchDelivery() {
- // this.getdataListParmSee.parammaps.eqId = row.id
- if (this.getdataListParmSee.parammaps.inputDatetime === null) {
- this.getdataListParmSee.parammaps.inputDatetime = ''
- }
- console.log('getdataListParmSee', this.getdataListParmSee)
- this.getdataListParmSee.offset = 1
- this.getListSee()
- },
- getListSee() {
- console.log('enabledTime', this.$refs['inputDatetime2'])
- if (this.$refs['inputDatetime2'] !== undefined && this.$refs['inputDatetime2'].value !== null) {
- this.getdataListParmSee.parammaps.startTime = this.$refs['inputDatetime2'].value[0]
- this.getdataListParmSee.parammaps.stopTime = this.$refs['inputDatetime2'].value[1]
- } else {
- this.getdataListParmSee.parammaps.startTime = ''
- this.getdataListParmSee.parammaps.stopTime = ''
- }
- GetDataByName(this.getdataListParmSee).then(response => {
- this.listSee = response.data.list
- console.log('记录列表数据', response.data.list)
- this.pageNum = response.data.pageNum
- this.pageSize = response.data.pageSize
- if (response.data.total) {
- this.totalSee = response.data.total
- }
- // Just to simulate the time of the request
- setTimeout(() => {
- this.listLoadingSee = false
- }, 300)
- })
- },
- handleDownload() {
- this.$alert('设备变更正在导出中,请勿刷新或离开本页面,若导出时间过长,建议缩小导出数据范围重新导出', {})
- this.isPercentage = true
- this.percentage = 1
- var timer = setInterval(() => {
- this.percentage += 5
- if (this.percentage > 95) {
- this.percentage = 99
- clearInterval(timer)
- }
- this.percentage = this.percentage
- }, 1000)
- this.downLoadParm.name = 'geteqChangeList'
- this.downLoadParm.parammaps = this.getdataListParm.parammaps
- GetAccount(this.downLoadParm).then(response => {
- this.downLoadList = response.data.list
- if (response.data.list !== '') {
- this.percentage = 99
- setTimeout(() => {
- this.isPercentage = false
- }, 2000)
- }
- console.log(this.downLoadList)
- const elecExcelDatas = [
- {
- tHeader: ['牧场', '设备名称', '设备内部编号', '规格', '品牌', '部门', '状态', '变更日期'],
- filterVal: ['pastureName', 'eqName', 'eqCode', 'specification', 'brandName', 'deptName', 'status', 'changeTime'],
- tableDatas: this.downLoadList,
- sheetName: '设备变更'
- }
- ]
- json2excel(elecExcelDatas, '设备变更', true, 'xlsx')
- })
- }
- }
- }
- </script>
|