123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973 |
- <template>
- <div class="app-container">
- <div class="filter-container">
- <!-- 搜索条件 -->
- <el-select v-model="getdataListParm.parammaps.pastureName" placeholder="牧场" class="filter-item" style="width: 110px" @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.eqCode" 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.deptId" 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.syStatus" clearable placeholder="状态" class="filter-item" style="width:100px;">
- <el-option v-for="item in getDictByName" :key="item.id" :label="item.label" :value="item.value" />
- </el-select>
- <el-date-picker v-model="getdataListParm.parammaps.enabledTime" type="date" placeholder="开启日期" style="width:140px;top:-3px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" />
- <el-date-picker v-model="getdataListParm.parammaps.blockTime" type="date" placeholder="关闭日期" style="width:140px;top:-3px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" />
- <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>
- </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"
- >
- <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="90px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.pastureName }}</span>
- </template>
- </el-table-column>
- <el-table-column label="设备名称" min-width="100px" 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="90px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.specification }}</span>
- </template>
- </el-table-column>
- <el-table-column label="品牌" min-width="110px" 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="启停状态" min-width="70px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.changeStatue }}</span>
- </template>
- </el-table-column>
- <el-table-column label="部门" min-width="80px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.deptName }}</span>
- </template>
- </el-table-column>
- <el-table-column label="最近开启时间" sortable prop="enabledTime" min-width="120px" align="center" />
- <el-table-column label="最近关闭时间" sortable prop="blockTime" min-width="120px" align="center" />
- <el-table-column label="操作" align="center" width="300" class-name="small-padding fixed-width" fixed="right">
- <template slot-scope="{row}">
- <el-button type="success" size="mini" :disabled="row.changeStatue=='启用'? true : false" @click="handleSST(row)">开启</el-button>
- <el-button type="danger" size="mini" :disabled="row.changeStatue=='停用'? true : false" @click="handleSST(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" disabled style="width:100%;" />
- </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="employeId">
- <el-select v-model="temp.employeId" 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-row v-if="false">
- <el-col :span="8">
- <el-form-item label="操作时间:" prop="inputDatetime">
- <el-date-picker
- v-model="temp.inputDatetime"
- type="datetime"
- placeholder="操作时间"
- style="width:100%;"
- :picker-options="pickerOptions0"
- />
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button v-if="temp.changeStatue =='停用'" type="primary" @click="createStartData()">开启</el-button>
- <el-button v-if="temp.changeStatue =='启用'" type="primary" @click="createStopData()">停用</el-button>
- <el-button @click="dialogFormVisible = false;getList()">关闭</el-button>
- </div>
- </el-dialog>
- <el-dialog :title="textMap[dialogStatusSST]" :visible.sync="dialogFormVisibleSST" :close-on-click-modal="false" style="width:500px;margin:0 auto;margin-bottom:50px">
- <div class="app-SST">
- <el-form ref="tempSST" :rules="rules" :model="tempSST" label-position="right" label-width="100px">
- <h3 style="margin-bottom:50px;">是否{{ tempSST.changeStatue =="停用"?"开启":"关闭" }}?</h3>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="tempSST.changeStatue =='停用'?add_dialog_saveSST1():add_dialog_saveSST2()">确认</el-button>
- <el-button @click="dialogFormVisibleSST = false">关闭</el-button>
- </div>
- </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-date-picker v-model="getdataListParmSee.parammaps.startTime" type="date" placeholder="开启日期" style="width:140px;top:-3px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" />
- <el-date-picker v-model="getdataListParmSee.parammaps.stopTime" type="date" placeholder="关闭日期" style="width:140px;top:-3px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" />
- <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"
- @sort-change="tableSort"
- >
- <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="enabledTime" min-width="110px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.enabledTime }}</span>
- </template>
- </el-table-column>
- <el-table-column label="关闭时间" sortable prop="blockTime" min-width="110px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.blockTime }}</span>
- </template>
- </el-table-column>
- <el-table-column label="运行时间(分钟)" sortable prop="runTime" min-width="110px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.runTime }}</span>
- </template>
- </el-table-column>
- <el-table-column label="开启人" min-width="110px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.enabledName }}</span>
- </template>
- </el-table-column>
- <el-table-column label="关闭人" min-width="110px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.blockName }}</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>
- <div slot="footer" class="dialog-footer" style="right:30px;position:absolute;bottom:10px">
- <el-button @click="dialogFormVisibleCard = false">关闭</el-button>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- // 引入
- // eslint-disable-next-line no-unused-vars
- import { GetDataByName, GetDataByNames, ExecDataByConfig, PostDataByName } from '@/api/common'
- import waves from '@/directive/waves' // waves directive
- import { parseTime, sortChange } 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
- // eslint-disable-next-line no-unused-vars
- import { parse } from 'querystring'
- import Cookies from 'js-cookie'
- export default {
- name: 'SST',
- 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: 'getAssetSTTList',
- name: 'geteqSTTList',
- page: 1,
- offset: 1,
- pagecount: 10,
- returntype: 'Map',
- parammaps: {
- eqCode: '',
- eqName: '',
- pastureName: Cookies.get('pasturename'),
- deptName: '',
- syStatus: '',
- deptId: this.$route.query.deptId,
- blockTime: '',
- enabledTime: ''
- }
- },
- requestParamSST: {
- name: 'updateEQStartStop',
- parammaps: {
- inputDatetime: new Date(),
- employeId: Cookies.get('employeid'),
- pastureId: Cookies.get('pastureid'),
- sttId: ''
- }
- },
- temp: {
- pastureName: '',
- deptName: '',
- deptId: '',
- employeName: '',
- eqName: '',
- assetId: '',
- eqCode: '',
- inputDatetime: new Date(),
- typeName: '',
- assTypeId: '',
- syStatus: '',
- employeId: this.$store.state.user.employeid,
- departmentId: this.$store.state.user.departmentid,
- pastureId: this.$store.state.user.pastureid
- },
- tempSST: {
- },
- // 2-3:下拉框请求后数据加入[]
- findAllProvider: [],
- findAllAssetType: [],
- findAllPasture: [],
- findAllDepart: [],
- findAllEmploye: [],
- getDictByName: [], createDepartList: [], edit: 0,
- // 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: 'findAllDepart', offset: 0, pagecount: 0, parammaps: { 'pastureId': 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: {},
- assetA: { eqName: '', eqCode: '' },
- requestFilterParams: {
- name: 'findAssetMain',
- page: 1,
- offset: 1,
- pagecount: 20,
- returntype: 'Map',
- parammaps: {}
- },
- dialogFormVisible: false,
- dialogFormVisibleCheck: false,
- dialogStatus: '',
- dialogFormVisibleSST: false,
- dialogStatusSST: '',
- dialogStatusCheck: '',
- textMap: {
- create: '新增',
- sst: '设备启停'
- },
- dialogPvVisible: false,
- // 新加的列表用的==========================================
- cardTitle: '启停记录',
- dialogFormVisibleCard: false,
- dialogStatusCard: '',
- listLoadingSee: true,
- rowSeeData: {},
- listSee: [],
- totalSee: 0,
- getdataListParmSee: {
- name: 'getAssetSTT1',
- page: 1,
- offset: 1,
- pagecount: 10,
- returntype: 'Map',
- parammaps: {
- assetId: '',
- startTime: '',
- stopTime: '',
- pastureId: Cookies.get('pastureid')
- }
- },
- // 新加的列表用的==========================================
- // 时间设置
- 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' }]
- },
- rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
- cellStyle: { padding: 0 + 'px' }
- }
- },
- created() {
- this.$store.dispatch('user/getInfo')
- this.getDownList()
- this.getList()
- },
- methods: {
- tableSort(column) {
- sortChange(column, this.listSee)
- },
- // 模糊查询-名称
- 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.eqCode = item.eqCode
- this.temp.eqName = item.eqName
- this.temp.eqId = item.eqId
- this.temp.id = 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.inputDatetime = parseTime(new Date(), '{y}-{m}-{d}')
- // 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.id = item.assetId
- this.temp.eqId = item.eqId
- 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.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
- if (this.getdataListParm.parammaps.enabledTime === null) {
- this.getdataListParm.parammaps.enabledTime = ''
- }
- if (this.getdataListParm.parammaps.blockTime === null) {
- this.getdataListParm.parammaps.blockTime = ''
- }
- 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
- }
- // Just to simulate the time of the request
- setTimeout(() => {
- this.listLoading = false
- }, 100)
- })
- this.temp = {
- pastureName: '',
- deptName: '',
- deptId: '',
- employeName: '',
- eqName: '',
- assetId: '',
- eqCode: '',
- inputDatetime: new Date(),
- typeName: '',
- assTypeId: '',
- syStatus: '',
- employeId: this.$store.state.user.employeid,
- departmentId: this.$store.state.user.departmentid,
- pastureId: this.$store.state.user.pastureid
- }
- },
- // 2-2:下拉框
- getDownList() {
- 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.deptId = ''
- 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
- } else {
- this.createTemp.departmentId = response.data.list[0].id
- this.createTemp.departmentName = response.data.list[0].name
- }
- console.log(this.createTemp.departmentName, 'this.createTemp.departmentName')
- }
- })
- },
- 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
- },
- form_search() {
- this.listLoading = true
- this.getdataListParm.offset = 1
- this.getList()
- },
- handleModifyStatus(row, status) {
- this.$message({
- message: '操作成功',
- type: 'success'
- })
- row.status = status
- },
- form_reset() {
- this.temp = {
- pastureName: '',
- deptName: '',
- deptId: '',
- employeName: '',
- eqName: '',
- assetId: '',
- eqCode: '',
- inputDatetime: new Date(),
- typeName: '',
- assTypeId: '',
- syStatus: '',
- employeId: parseInt(Cookies.get('employeid')),
- departmentId: parseInt(Cookies.get('departmentid')),
- pastureId: parseInt(Cookies.get('pastureid'))
- }
- },
- form_edit(row) {
- this.temp = Object.assign({}, row) // copy obj
- this.dialogStatus = 'update'
- this.dialogFormVisible = true
- this.$nextTick(() => {
- this.$refs['temp'].clearValidate()
- })
- },
- form_add() {
- this.form_reset()
- this.edit = 1
- this.getDepartParam.parammaps.pastureId = this.temp.pastureId
- this.getCreateDepartDownList()
- this.dialogStatus = 'create'
- this.dialogFormVisible = true
- this.$nextTick(() => {
- this.$refs['temp'].clearValidate()
- })
- },
- // 设备启停按钮
- handleSST(row) {
- // console.log(1)
- this.dialogStatusSST = 'sst'
- this.dialogFormVisibleSST = true
- this.tempSST = Object.assign({}, row)
- console.log(this.tempSST)
- },
- // 启用
- add_dialog_saveSST1() {
- console.log(this.tempSST)
- var sendData = {
- name: 'updateEQStartStop',
- parammaps: {
- SSPstatue: '启用',
- id: this.tempSST.id,
- sttId: this.tempSST.sttId1,
- employeId: Cookies.get('employeid'),
- pastureId: this.tempSST.pastureId
- }
- }
- PostDataByName(sendData).then(response => {
- console.log(response)
- if (response.msg === 'fail') {
- this.$notify({
- title: '失败',
- message: '保存失败-' + response.data,
- type: 'warning',
- duration: 2000
- })
- } else {
- this.getList()
- this.dialogFormVisibleSST = false
- this.$notify({
- title: '成功',
- message: '修改成功',
- type: 'success',
- duration: 2000
- })
- }
- })
- },
- add_dialog_saveSST2() {
- console.log(this.tempSST)
- var sendData = {
- name: 'updateEQStartStop',
- parammaps: {
- SSPstatue: '停用',
- id: this.tempSST.id,
- sttId: this.tempSST.sttId1,
- employeId: Cookies.get('employeid'),
- pastureId: this.tempSST.pastureId
- }
- }
- PostDataByName(sendData).then(response => {
- console.log(response)
- if (response.msg === 'fail') {
- this.$notify({
- title: '失败',
- message: '保存失败-' + response.data,
- type: 'warning',
- duration: 2000
- })
- } else {
- this.getList()
- this.dialogFormVisibleSST = false
- this.$notify({
- title: '成功',
- message: '修改成功',
- type: 'success',
- duration: 2000
- })
- }
- })
- },
- add_dialog_saveSST() {
- this.requestParamSST.parammaps.id = this.tempSST.id
- this.requestParamSST.parammaps.pastureId = this.tempSST.pastureId
- this.requestParamSST.parammaps.sttId = this.tempSST.sttId
- this.requestParamSST.parammaps.changeStatue = this.tempSST.changeStatue
- PostDataByName(this.requestParamSST).then(response => {
- console.log(response)
- if (response.msg === 'fail') {
- this.$notify({
- title: '失败',
- message: '保存失败-' + response.data,
- type: 'warning',
- duration: 2000
- })
- } else {
- this.getList()
- this.dialogFormVisibleSST = false
- this.$notify({
- title: '成功',
- message: '修改成功',
- type: 'success',
- duration: 2000
- })
- }
- })
- },
- // 启用
- // createStartData() {
- // this.$refs['temp'].validate(valid => {
- // if (valid) {
- // if (this.temp.changeStatue === '停用') {
- // this.postDataPramas.common = { 'returnmap': '0' }
- // this.postDataPramas.data = []
- // this.postDataPramas.data[0] = { 'name': 'updateByIdEnabled', 'type': 'e', 'parammaps': { }}
- // this.postDataPramas.data[0].parammaps = this.temp
- // this.postDataPramas.data[1] = { 'name': 'insertSTT', 'type': 'e', 'parammaps': { }}
- // this.postDataPramas.data[1].parammaps.inputDatetime = this.temp.inputDatetime
- // this.postDataPramas.data[1].parammaps.employeId = this.temp.employeId
- // this.postDataPramas.data[1].parammaps.id = this.temp.id
- // this.postDataPramas.data[1].parammaps.pastureId = this.temp.pastureId
- // this.postDataPramas.data[2] = { 'name': 'updateByIdAsset', 'type': 'e', 'parammaps': { }}
- // this.postDataPramas.data[2].parammaps.sttId = '@insertSTT.LastInsertId'
- // this.postDataPramas.data[2].parammaps.id = this.temp.id
- // this.postDataPramas.data[2].parammaps.pastureId = this.temp.pastureId
- // 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
- // })
- // }
- // })
- // } else {
- // this.$notify({
- // title: '',
- // message: '设备启用中,必须先停止才能再次启用',
- // type: 'warning',
- // duration: 2000
- // })
- // }
- // }
- // })
- // },
- createStartData() {
- this.$refs['temp'].validate(valid => {
- if (valid) {
- console.log(this.temp)
- var sendData = {
- name: 'updateEQStartStop',
- parammaps: {
- SSPstatue: '启用',
- sttId: this.temp.sttId,
- id: this.temp.eqId,
- employeId: Cookies.get('employeid'),
- pastureId: this.temp.pastureId
- }
- }
- PostDataByName(sendData).then(response => {
- console.log(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
- })
- }
- })
- }
- })
- },
- // 停用
- // createStopData() {
- // this.$refs['temp'].validate(valid => {
- // if (valid) {
- // if (this.temp.changeStatue === '启用') {
- // this.postDataPramas.common = { 'returnmap': '0' }
- // this.postDataPramas.data = []
- // this.postDataPramas.data[0] = { 'name': 'updateByIdBlock', 'type': 'e', 'parammaps': { }}
- // this.postDataPramas.data[0].parammaps = this.temp
- // this.postDataPramas.data[1] = { 'name': 'updateSTT', 'type': 'e', 'parammaps': { }}
- // this.postDataPramas.data[1].parammaps.inputDatetime = this.temp.inputDatetime
- // this.postDataPramas.data[1].parammaps.employeId = this.temp.employeId
- // this.postDataPramas.data[1].parammaps.id = this.temp.sttId
- // this.postDataPramas.data[1].parammaps.pastureId = this.temp.pastureId
- // 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
- // })
- // }
- // })
- // } else {
- // this.$notify({
- // title: '',
- // message: '设备停止中,必须先启用才能停止使用',
- // type: 'warning',
- // duration: 2000
- // })
- // }
- // }
- // })
- // },
- createStopData() {
- this.$refs['temp'].validate(valid => {
- if (valid) {
- console.log(this.temp)
- var sendData = {
- name: 'updateEQStartStop',
- parammaps: {
- SSPstatue: '停用',
- sttId: this.temp.sttId,
- id: this.temp.eqId,
- employeId: Cookies.get('employeid'),
- pastureId: this.temp.pastureId
- }
- }
- PostDataByName(sendData).then(response => {
- console.log(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_see(row) {
- this.rowSeeData = Object.assign({}, row)
- this.cardTitle = '启停记录 设备名称:' + row.eqName + '设备编号:' + row.eqCode
- this.dialogFormVisibleCard = true
- this.getdataListParmSee.parammaps.assetId = row.id
- this.getListSee()
- },
- form_searchDelivery() {
- if (this.getdataListParmSee.parammaps.inputDatetime === null) {
- this.getdataListParmSee.parammaps.inputDatetime = ''
- }
- this.getdataListParmSee.offset = 1
- this.getListSee()
- },
- getListSee() {
- if (this.getdataListParmSee.parammaps.startTime !== undefined && this.getdataListParmSee.parammaps.startTime !== null) {
- } else {
- this.getdataListParmSee.parammaps.startTime = ''
- }
- if (this.getdataListParmSee.parammaps.stopTime !== undefined && this.getdataListParmSee.parammaps.stopTime !== null) {
- } else {
- 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)
- })
- }
- }
- }
- </script>
|