From 0d86c19b122011dc528c624597b0952660d69aba Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期日, 26 六月 2022 09:32:53 +0800
Subject: [PATCH] 1.优化动态路由
---
src/views/sbgl/sbqd.vue | 568 ++++++++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 466 insertions(+), 102 deletions(-)
diff --git a/src/views/sbgl/sbqd.vue b/src/views/sbgl/sbqd.vue
index f35e4a2..ad2373f 100644
--- a/src/views/sbgl/sbqd.vue
+++ b/src/views/sbgl/sbqd.vue
@@ -1,7 +1,7 @@
<template>
<div>
- <div class="body" style="background-color: #ffffff; padding: 20px 10px 0 20px;" :style="{height:mainHeight+'px'}">
- <div>
+ <div class="body" :style="{height:mainHeight+'px'}">
+ <div style="padding: 10px 5px 0 0">
<el-form
ref="form"
:model="form"
@@ -9,15 +9,15 @@
inline
style="display: flex;justify-content: space-between"
>
- <div style="display: flex;justify-content: space-around;">
+ <div class="elForm">
<el-form-item label="璁惧缂栫爜" style=" display: flex;">
- <el-input v-model="form.DeviceCode" placeholder="璇疯緭鍏�" style="width: calc(100%-30px)" />
+ <el-input v-model="form.DeviceCode" placeholder="璇疯緭鍏�" style="width: 200px" />
</el-form-item>
<el-form-item label="璁惧鍚嶇О" style=" display: flex;">
- <el-input v-model="form.DeviceName" placeholder="璇疯緭鍏�" style="width: calc(100%-30px)" />
+ <el-input v-model="form.DeviceName" placeholder="璇疯緭鍏�" style="width: 200px" />
</el-form-item>
<el-form-item label="浣跨敤鐘舵��" style=" display: flex;">
- <el-select v-model="form.Status" filterable style="width: calc(100%-30px)" placeholder="璇烽�夋嫨">
+ <el-select v-model="form.Status" :popper-append-to-body="false" filterable style="width: 200px" placeholder="璇烽�夋嫨">
<el-option
v-for="item in StatusArr"
:key="item.value"
@@ -27,7 +27,7 @@
</el-select>
</el-form-item>
<el-form-item label="鎵�灞炶溅闂�" style=" display: flex;">
- <el-select v-model="form.WorkShop" filterable style="width: calc(100%-30px)" placeholder="璇烽�夋嫨">
+ <el-select v-model="form.WorkShop" :popper-append-to-body="false" filterable style="width: 200px" placeholder="璇烽�夋嫨">
<el-option
v-for="item in WorkShopArr"
:key="item.code"
@@ -37,7 +37,7 @@
</el-select>
</el-form-item>
<el-form-item filterable label="璁惧绫诲瀷" style="display: flex;">
- <el-select v-model="form.DeviceType" style="width: calc(100%-30px)" placeholder="璇烽�夋嫨" @change="deviceTypeChange">
+ <el-select v-model="form.DeviceType" :popper-append-to-body="false" style="width: 200px" placeholder="璇烽�夋嫨" @change="deviceTypeChange">
<el-option
v-for="item in DeviceTypeArr"
:key="item.code"
@@ -47,7 +47,13 @@
</el-select>
</el-form-item>
<el-form-item label="璁惧缁�" style=" display: flex;">
- <el-select v-model="form.DeviceGroup" :disabled="form.DeviceType===''" style="width: calc(100%-30px)" placeholder="璇烽�夋嫨">
+ <el-select
+ v-model="form.DeviceGroup"
+ :popper-append-to-body="false"
+ :disabled="form.DeviceType===''"
+ style="width: 200px"
+ placeholder="璇烽�夋嫨"
+ >
<el-option
v-for="item in DeviceGroupArr"
:key="item.code"
@@ -63,19 +69,22 @@
</div>
</el-form>
</div>
- <div style="margin-bottom: 20px;display: flex">
+ <el-divider />
+ <div style="margin-left: 10px;display: flex">
<el-button type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button>
<el-button type="primary" icon="el-icon-c-scale-to-original" @click="deviceTypeButton">璁惧绫诲瀷</el-button>
<el-button type="primary" icon="el-icon-document-copy" @click="deviceGroupButton">璁惧缁�</el-button>
<el-button type="primary" icon="el-icon-upload2" @click="upload">瀵煎叆</el-button>
</div>
-
- <div style="display: flex;border: 1px solid #eee">
+ <el-divider />
+ <div class="elTableDiv">
<el-table
:data="tableData"
border
+ :height="tableHeight"
+ stripe
highlight-current-row
- :style="{width: 100+'%',height:tableHeight+'px'}"
+ :style="{width: 100+'%',height:(tableHeight-50)+'px'}"
:header-cell-style="this.$headerCellStyle"
:cell-style="this.$cellStyle"
@sort-change="sortChange"
@@ -122,7 +131,7 @@
</el-table-column>
<el-table-column
prop="input_date"
- label="鎶曞叆鏃堕棿"
+ label="鎶曞叆鏃ユ湡"
sortable="custom"
width="120"
>
@@ -168,7 +177,7 @@
<template slot-scope="{row}">
<div class="operationClass">
<el-button type="text" @click="edit('edit',row)">淇敼</el-button>
- <el-button type="text" @click="del(row.id)">鍒犻櫎</el-button>
+ <el-button type="text" @click="del(row)">鍒犻櫎</el-button>
</div>
</template>
</el-table-column>
@@ -188,7 +197,7 @@
</div>
<!--璁惧娓呭崟鏂板缂栬緫-->
<el-dialog
- :title="operation==='add'?'娣诲姞':'淇敼'"
+ :title="operation==='add'?'鏂板':'淇敼'"
:visible.sync="dialogVisible"
width="50%"
top="15vh"
@@ -196,33 +205,63 @@
@close="handleClose"
>
<el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px">
- <el-form-item label="璁惧缂栫爜" prop="OrgCode">
- <el-input v-model="dialogForm.OrgCode" :disabled="operation!=='add'" style="width: 220px" />
+ <el-form-item label="璁惧缂栫爜" prop="devicecode">
+ <el-input v-model="dialogForm.devicecode" :disabled="operation!=='add'" style="width: 220px" />
</el-form-item>
- <el-form-item label="璁惧鍚嶇О" prop="OrgName">
- <el-input v-model="dialogForm.OrgName" style="width: 220px" />
+ <el-form-item label="璁惧鍚嶇О" prop="devicename">
+ <el-input v-model="dialogForm.devicename" style="width: 220px" />
</el-form-item>
- <el-form-item label="璁惧绫诲瀷" prop="OrgName">
- <el-input v-model="dialogForm.OrgName" style="width: 220px" />
+ <el-form-item label="璁惧绫诲瀷" prop="devicetypecode">
+ <el-select v-model="dialogForm.devicetypecode" :popper-append-to-body="false" style="width: 220px" placeholder="璇烽�夋嫨" @change="devicetypecodeChange">
+ <el-option
+ v-for="item in DeviceTypeArr"
+ :key="item.code"
+ :label="item.name"
+ :value="item.code"
+ />
+ </el-select>
</el-form-item>
- <el-form-item label="璁惧缁�" prop="OrgName">
- <el-input v-model="dialogForm.OrgName" style="width: 220px" />
+ <el-form-item label="璁惧缁�" prop="devicegroupcode">
+ <el-select v-model="dialogForm.devicegroupcode" :popper-append-to-body="false" :disabled="dialogForm.devicetypecode===''" style="width: 220px" placeholder="璇烽�夋嫨">
+ <el-option
+ v-for="item in DeviceGroupArr"
+ :key="item.code"
+ :label="item.name"
+ :value="item.code"
+ />
+ </el-select>
</el-form-item>
- <el-form-item label="鎶曞叆鏃ユ湡" prop="OrgName">
+ <el-form-item label="鎶曞叆鏃ユ湡" prop="importdate">
<el-date-picker
- v-model="dialogForm.OrgCode"
+ v-model="dialogForm.importdate"
+ style="width: 220px"
type="date"
placeholder="閫夋嫨鏃ユ湡"
+ popper-class="dateStyle"
/>
</el-form-item>
- <el-form-item label="鎵�灞炶溅闂�" prop="OrgName">
- <el-input v-model="dialogForm.OrgName" style="width: 220px" />
+ <el-form-item label="鎵�灞炶溅闂�" prop="workshopcode">
+ <el-select v-model="dialogForm.workshopcode" :popper-append-to-body="false" style="width: 220px" placeholder="璇烽�夋嫨" @change="workshopcodeChange">
+ <el-option
+ v-for="item in WorkShopArr"
+ :key="item.code"
+ :label="item.name"
+ :value="item.code"
+ />
+ </el-select>
</el-form-item>
- <el-form-item label="鎵�灞炰骇绾�" prop="OrgName">
- <el-input v-model="dialogForm.OrgName" style="width: 220px" />
+ <el-form-item label="鎵�灞炰骇绾�" prop="linecode">
+ <el-select v-model="dialogForm.linecode" :popper-append-to-body="false" :disabled="dialogForm.workshopcode===''" style="width: 220px" placeholder="璇烽�夋嫨">
+ <el-option
+ v-for="item in WorkLineArr"
+ :key="item.linecode"
+ :label="item.linename"
+ :value="item.linecode"
+ />
+ </el-select>
</el-form-item>
- <el-form-item label="浣跨敤鐘舵��" prop="OrgName">
- <el-select v-model="form.Status" placeholder="璇烽�夋嫨">
+ <el-form-item label="浣跨敤鐘舵��" prop="status">
+ <el-select v-model="dialogForm.status" :popper-append-to-body="false" style="width: 220px" placeholder="璇烽�夋嫨">
<el-option
v-for="item in StatusArr"
:key="item.value"
@@ -231,8 +270,8 @@
/>
</el-select>
</el-form-item>
- <el-form-item label="绋煎姩鐜�" prop="OrgName">
- <el-input v-model="dialogForm.OrgName" style="width: 220px" />
+ <el-form-item label="绋煎姩鐜�" prop="ratio">
+ <el-input v-model="dialogForm.ratio" style="width: 195px" /><span style="margin-left: 10px">%</span>
</el-form-item>
</el-form>
@@ -246,12 +285,11 @@
<!--璁惧绫诲瀷-->
<el-dialog
- title="瑙掕壊绫诲瀷"
+ title="璁惧绫诲瀷"
:visible.sync="DeviceTypeDialogVisible"
width="50%"
top="15vh"
class="DeviceTypeDialogVisible"
- @closed="handleCloseDeviceType"
@close="handleCloseDeviceType"
>
<div style="margin-bottom: 20px;display: flex">
@@ -310,12 +348,6 @@
<el-button v-if="row.isVisible===1" type="text" @click="DeviceTypeCancel(row)">鍙栨秷</el-button>
</div>
</template>
- <!-- <template v-for="item in RoleTypeCodeArr" slot-scope="{row}">-->
- <!-- <div :key="item.roletype_code" class="operationClass">-->
- <!-- <el-button v-if="item.isVisible" type="text" @click="formSettingSave(row)">淇濆瓨</el-button>-->
- <!-- <el-button v-if="item.isVisible" type="text" @click="formSettingCancel(row)">鍙栨秷</el-button>-->
- <!-- </div>-->
- <!-- </template>-->
</el-table-column>
</el-table>
<!--鍒嗛〉-->
@@ -338,23 +370,127 @@
</el-dialog>
<!--璁惧缁�-->
+ <el-dialog
+ title="璁惧缁�"
+ :visible.sync="DeviceGroupDialogVisible"
+ width="70%"
+ top="15vh"
+ class="DeviceTypeDialogVisible"
+ @close="handleCloseDeviceGroup"
+ >
+ <div style="margin-bottom: 20px;display: flex">
+ <el-button type="primary" icon="el-icon-circle-plus-outline" @click="addDeviceGroup">鏂板</el-button>
+ </div>
+ <el-table
+ :data="DeviceGroupArray"
+ border
+ highlight-current-row
+ :style="{width: 100+'%',height:tableHeight-300+'px'}"
+ :header-cell-style="this.$headerCellStyle"
+ :cell-style="this.$cellStyle"
+ @sort-change="sortChangeOfDeviceGroup"
+ >
+ <el-table-column
+ width="50"
+ label="搴忓彿"
+ prop="RowNum"
+ />
+ <el-table-column
+ prop="code"
+ label="鍒嗙粍缂栫爜"
+ sortable="custom"
+ >
+ <template slot-scope="{row}">
+ <el-input v-if="row.isVisible===1" v-model="row.code" placeholder="璇疯緭鍏�" />
+ <div v-else> {{ row.code }}</div>
+ </template>
+ </el-table-column>
+ <el-table-column
+ prop="name"
+ label="鍒嗙粍鍚嶇О"
+ sortable="custom"
+ >
+ <template slot-scope="{row}">
+ <el-input v-if="row.isVisible===1" v-model="row.name" placeholder="璇疯緭鍏�" />
+ <div v-else> {{ row.name }}</div>
+ </template>
+ </el-table-column>
+ <el-table-column
+ prop="eqptype_name"
+ label="鎵�灞炶澶囩被鍨�"
+ sortable="custom"
+ >
+ <template slot-scope="{row}">
+ <el-select v-if="row.isVisible===1" v-model="row.eqptype_code" :popper-append-to-body="false" placeholder="璇烽�夋嫨">
+ <el-option
+ v-for="item in DeviceTypeArr"
+ :key="item.code"
+ :label="item.name"
+ :value="item.code"
+ />
+ </el-select>
+ <div v-else> {{ row.eqptype_name }}</div>
+ </template>
+ </el-table-column>
+ <el-table-column
+ prop="remark"
+ label="鍒嗙粍鎻忚堪"
+ show-overflow-tooltip
+ sortable="custom"
+ >
+ <template slot-scope="{row}">
+ <el-input v-if="row.isVisible===1" v-model="row.remark" placeholder="璇疯緭鍏�" />
+ <div v-else> {{ row.remark }}</div>
+ </template>
+ </el-table-column>
+ <el-table-column label="鎿嶄綔">
+ <template slot-scope="{row}">
+ <div class="operationClass">
+ <el-button v-if="row.isVisible===0" type="text" @click="DeviceGroupDel(row)">鍒犻櫎</el-button>
+ <el-button v-if="row.isVisible===1" type="text" @click="DeviceGroupSave(row)">淇濆瓨</el-button>
+ <el-button v-if="row.isVisible===1" type="text" @click="DeviceGroupCancel(row)">鍙栨秷</el-button>
+ </div>
+ </template>
+ </el-table-column>
+ </el-table>
+ <!--鍒嗛〉-->
+ <pagination
+ v-show="DeviceGroupTotal>0"
+ :total="DeviceGroupTotal"
+ :page.sync="formDeviceGroup.page"
+ :limit.sync="formDeviceGroup.rows"
+ align="right"
+ layout="prev, pager, next,sizes"
+ popper-class="select_bottom"
+ @pagination="getDeviceGroupSearchDialog"
+ />
+ <span slot="footer" class="dialog-footer">
+ <div class="footerButton">
+ <el-button @click="DeviceGroupDialogVisibleCancel">杩斿洖</el-button>
+ <!-- <el-button type="primary" @click="settingDialogVisibleConfirm">纭� 瀹�</el-button>-->
+ </div>
+ </span>
+ </el-dialog>
<!--瀵煎叆-->
+
</div>
</template>
<script>
import Pagination from '@/components/Pagination'
-import { AddUpdateOrganization, DeleteOrganization, OrganizationSearch, PrentOrganization } from '@/api/jcsz'
import { getCookie } from '@/utils/auth'
import {
+ AddUpdateDeviceGroup, AddUpdateDeviceManger,
+ AddUpdateDeviceType, DeleteDeviceManger, DeleteDeviceType,
DeviceGroupSearch,
DeviceMangerSearch,
DeviceTypeSearch,
DeviceTypeSelect,
DeviceTypeSelectGroup,
- WorkShopSelect
+ WorkShopSelect, WorkShopSelectLine
} from '@/api/sbgl'
+import { handleDatatime } from '@/utils/global'
const SER_HZ = /^[\u4e00-\u9fa5]+$/
export default {
@@ -374,13 +510,6 @@
}
}
}
- const validateTypeCode = (rule, value, callback) => {
- if (!value) {
- return callback(new Error('璇烽�夋嫨涓婄骇'))
- } else {
- callback()
- }
- }
return {
mainHeight: 0,
tableHeight: 0,
@@ -394,7 +523,7 @@
prop: 'lm_date', // 鎺掑簭瀛楁
order: 'desc', // 鎺掑簭瀛楁
page: 1, // 绗嚑椤�
- rows: 10 // 姣忛〉澶氬皯鏉�
+ rows: 20 // 姣忛〉澶氬皯鏉�
},
DeviceTypeArr: [], // 璁惧绫诲瀷涓嬫媺鏁扮粍
StatusArr: [
@@ -407,40 +536,63 @@
tableData: [],
dialogVisible: false,
dialogForm: {
- OrgType: '',
- OrgCode: '',
- OrgName: '',
- SupUnit: ''// 涓婄骇鍗曚綅
+ id: '',
+ devicecode: '',
+ devicename: '',
+ devicetypecode: '',
+ devicegroupcode: '',
+ importdate: '',
+ workshopcode: '',
+ linecode: '',
+ status: '',
+ ratio: ''
},
+ WorkLineArr: [], // 鎵�灞炰骇绾挎暟缁�
operation: '',
dialogFormRules: {
- OrgType: [
- { required: true, message: '璇疯緭鍏ラ�夋嫨绫诲瀷', trigger: ['blur', 'change'] }
- ],
- OrgCode: [
+ devicecode: [
{ required: true, validator: validateName, trigger: ['blur', 'change'] }
],
- OrgName: [
+ devicename: [
{ required: true, message: '璇疯緭鍏ュ悕绉�', trigger: ['blur', 'change'] }
],
- SupUnit: [
- { required: true, validator: validateTypeCode, trigger: ['blur', 'change'] }
+ devicetypecode: [
+ { required: true, message: '璇烽�夋嫨璁惧绫诲瀷', trigger: ['blur', 'change'] }
+ ],
+ devicegroupcode: [
+ { required: true, message: '璇烽�夋嫨璁惧缁�', trigger: ['blur', 'change'] }
+ ],
+ importdate: [
+ { required: true, message: '璇烽�夋嫨鎶曞叆鏃ユ湡', trigger: ['blur', 'change'] }
+ ],
+ workshopcode: [
+ { required: true, message: '璇烽�夋嫨鎵�灞炶溅闂�', trigger: ['blur', 'change'] }
+ ],
+ linecode: [
+ { required: true, message: '璇烽�夋嫨鎵�灞炰骇绾�', trigger: ['blur', 'change'] }
+ ],
+ status: [
+ { required: true, message: '璇烽�夋嫨浣跨敤鐘舵��', trigger: ['blur', 'change'] }
]
},
DeviceTypeDialogVisible: false,
DeviceTypeArray: [], // 璁惧绫诲瀷瀵硅瘽妗嗗唴鐨勬暟缁�
formDeviceType: {
- // code: '',
- // name: '',
- // group: '',
- // description: '',
- rows: 1,
- row: 10,
+ page: 1,
+ rows: 10,
prop: 'code',
order: 'desc'
},
- DeviceTypeTotal: 0
-
+ DeviceTypeTotal: 0,
+ DeviceGroupDialogVisible: false,
+ DeviceGroupArray: [], // 璁惧缁勫璇濇鍐呯殑鏁扮粍
+ formDeviceGroup: {
+ page: 1,
+ rows: 10,
+ prop: 'code',
+ order: 'desc'
+ },
+ DeviceGroupTotal: 0
}
},
created() {
@@ -463,7 +615,7 @@
this.total = res.count
},
// 鑾峰彇鎵�灞炶溅闂翠笅鎷�
- async getWorkShopSelect() {
+ async getWorkShopSelect() {
const { data: res } = await WorkShopSelect()
this.WorkShopArr = res
},
@@ -473,7 +625,7 @@
this.DeviceTypeArr = res
},
// 璁惧绫诲瀷鏀瑰彉鏃�
- async deviceTypeChange(val) {
+ async deviceTypeChange(val) {
this.form.DeviceType = val
const { data: res } = await DeviceTypeSelectGroup({ eqptypecode: val })
this.DeviceGroupArr = res
@@ -521,37 +673,62 @@
edit(operation, row) {
this.operation = operation
this.dialogVisible = true
-
+ // console.log(row)
this.$nextTick(() => {
- this.dialogForm.OrgCode = row.org_code
- this.dialogForm.OrgName = row.org_name
- this.dialogForm.SupUnit = row.parent_id
+ this.dialogForm.id = row.id
+ this.dialogForm.devicecode = row.code
+ this.dialogForm.devicename = row.name
+ this.dialogForm.devicetypecode = row.eqptype_code
+ this.dialogForm.devicegroupcode = row.eqpgroup_code
+ this.dialogForm.importdate = row.input_date
+ this.dialogForm.workshopcode = row.wksp_code
+ this.dialogForm.linecode = row.Line_code
+ this.dialogForm.status = row.enable
+ this.dialogForm.ratio = row.operation_ration
})
},
// 鍒犻櫎鎸夐挳
- async del(id) {
+ async del(row) {
this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', {
confirmButtonText: '纭畾',
cancelButtonText: '鍙栨秷',
type: 'warning'
}).then(() => {
- // DeleteOrganization({ orgid: id }).then(res => {
- // if (res.code === '200') {
- // this.$message.success('鍒犻櫎鎴愬姛!')
- // this.getDeviceMangerSearch()
- // }
- // })
+ DeleteDeviceManger({ devicecode: row.code }).then(res => {
+ if (res.code === '200') {
+ this.$message.success('鍒犻櫎鎴愬姛!')
+ this.getDeviceMangerSearch()
+ }
+ })
}).catch(() => {
this.$message.info('宸插彇娑堝垹闄�')
})
},
// 瀵硅瘽妗嗗叧闂簨浠�
handleClose() {
- this.dialogForm.OrgType = ''
- this.dialogForm.OrgCode = ''
- this.dialogForm.OrgName = ''
- this.dialogForm.SupUnit = ''
+ this.dialogForm.id = ''
+ this.dialogForm.devicecode = ''
+ this.dialogForm.devicename = ''
+ this.dialogForm.devicetypecode = ''
+ this.dialogForm.devicegroupcode = ''
+ this.dialogForm.importdate = ''
+ this.dialogForm.workshopcode = ''
+ this.dialogForm.linecode = ''
+ this.dialogForm.status = ''
+ this.dialogForm.ratio = ''
this.$refs.dialogForm.clearValidate()
+ },
+ // 瀵硅瘽妗嗘墍灞炶溅闂翠笅鎷夐�夋嫨鏀瑰彉鏃�
+ async workshopcodeChange(val) {
+ const { data: res } = await WorkShopSelectLine({ workshopcode: val })
+ this.WorkLineArr = res
+ this.dialogForm.linecode = ''
+ },
+ // 瀵硅瘽妗嗚澶囩被鍨嬩笅鎷夐�夋嫨鏀瑰彉鏃�
+ async devicetypecodeChange(val) {
+ const { data: res } = await DeviceTypeSelectGroup({ eqptypecode: val })
+ this.DeviceGroupArr = res
+ this.dialogForm.devicegroupcode = ''
},
// 瀵硅瘽妗嗗彇娑�
dialogVisibleCancel() {
@@ -562,12 +739,19 @@
this.$refs.dialogForm.validate(valid => {
if (valid) {
const data = {
- OrganCode: this.dialogForm.OrgCode,
- OrganName: this.dialogForm.OrgName,
- OperType: this.operation === 'add' ? 'Add' : 'Update',
- Operator: getCookie('admin')
+ id: this.dialogForm.id,
+ devicecode: this.dialogForm.devicecode,
+ devicename: this.dialogForm.devicename,
+ devicetypecode: this.dialogForm.devicetypecode,
+ devicegroupcode: this.dialogForm.devicegroupcode,
+ importdate: handleDatatime(this.dialogForm.importdate),
+ workshopcode: this.dialogForm.workshopcode,
+ linecode: this.dialogForm.linecode,
+ status: this.dialogForm.status,
+ ratio: this.dialogForm.ratio,
+ OperType: this.operation === 'add' ? 'Add' : 'Update'
}
- AddUpdateOrganization(data).then(res => {
+ AddUpdateDeviceManger(data).then(res => {
if (res.code === '200') {
this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�')
this.dialogVisible = false
@@ -582,7 +766,7 @@
// 鑾峰彇椤甸潰楂樺害
getHeight() {
this.$nextTick(() => {
- this.mainHeight = window.innerHeight - 200
+ this.mainHeight = window.innerHeight - 250
this.tableHeight = this.mainHeight - 100
})
},
@@ -603,7 +787,12 @@
},
// 澶勭悊瀵硅瘽妗嗗叧闂�
handleCloseDeviceType() {
- // this.DeviceTypeDialogVisible = false
+ this.DeviceTypeArray.forEach((item, index) => {
+ if (item.isVisible === 1) {
+ this.DeviceTypeArray.splice(index, 1)
+ }
+ })
+ this.getDeviceTypeSelect()
},
// 璁惧绫诲瀷琛ㄥ崟鐐瑰嚮鎺掑簭
sortChangeOfDeviceType({ column, prop, order }) {
@@ -620,19 +809,55 @@
},
// 鏂板鎸夐挳
addDeviceType() {
- this.DeviceTypeArray.unshift({ code: '', name: '', group: '', description: '', isVisible: 1 })
+ this.DeviceTypeArray.unshift({ code: '', name: '', group: '', remark: '', isVisible: 1 })
},
// 鍒犻櫎
DeviceTypeDel(row) {
-
+ this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', {
+ confirmButtonText: '纭畾',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning'
+ }).then(() => {
+ DeleteDeviceType({ devicetypecode: row.code }).then(res => {
+ if (res.code === '200') {
+ this.$message.success('鍒犻櫎鎴愬姛!')
+ this.getDeviceTypeSearchDialog()
+ }
+ })
+ }).catch(() => {
+ this.$message.info('宸插彇娑堝垹闄�')
+ })
},
// 淇濆瓨
- DeviceTypeSave(row) {
-
+ async DeviceTypeSave(row) {
+ if (row.code.trim().length < 1) {
+ return this.$message.info('绫诲瀷缂栫爜涓嶈兘涓虹┖锛�')
+ }
+ if (row.name.trim().length < 1) {
+ return this.$message.info('绫诲瀷鍚嶇О涓嶈兘涓虹┖锛�')
+ }
+ if (row.remark.trim().length < 1) {
+ return this.$message.info('绫诲瀷鎻忚堪涓嶈兘涓虹┖锛�')
+ }
+ const data = {
+ 'code': row.code,
+ 'name': row.name,
+ 'group': '',
+ 'description': row.remark
+ }
+ const res = await AddUpdateDeviceType([data])
+ if (res.code === '200') {
+ this.$message.success('娣诲姞鎴愬姛锛�')
+ await this.getDeviceTypeSearchDialog()
+ }
},
// 鍙栨秷
DeviceTypeCancel(row) {
-
+ this.DeviceTypeArray.forEach((item, index) => {
+ if (item.isVisible === 1 && item.code === row.code) {
+ this.DeviceTypeArray.splice(index, 1)
+ }
+ })
},
// 杩斿洖鎸夐挳
DeviceTypeDialogVisibleCancel() {
@@ -642,7 +867,101 @@
/* 璁惧缁勬ā鍧�*/
// 鐐瑰嚮璁惧缁勬寜閽�
deviceGroupButton() {
-
+ this.DeviceGroupDialogVisible = true
+ this.getDeviceGroupSearchDialog()
+ },
+ // 璁惧缁勫璇濇鍏抽棴浜嬩欢
+ handleCloseDeviceGroup() {
+ this.DeviceGroupDialogVisible = false
+ this.DeviceGroupArray.forEach((item, index) => {
+ if (item.isVisible === 1) {
+ this.DeviceGroupArray.splice(index, 1)
+ }
+ })
+ if (this.form.DeviceType !== '') {
+ this.deviceTypeChange(this.form.DeviceType)
+ }
+ },
+ // 鏂板
+ addDeviceGroup() {
+ this.DeviceGroupArray.unshift({ code: '', name: '', eqptype_code: '', eqptype_name: '', remark: '', isVisible: 1 })
+ },
+ // 鎺掑簭
+ sortChangeOfDeviceGroup({ column, prop, order }) {
+ if (order === 'descending') {
+ order = 'desc'
+ } else if (order === 'ascending') {
+ order = 'asc'
+ } else {
+ order = 'desc'
+ }
+ this.formDeviceGroup.order = order
+ this.formDeviceGroup.prop = prop
+ this.getDeviceGroupSearchDialog()
+ },
+ // 鑾峰彇璁惧缁勫垪琛�
+ async getDeviceGroupSearchDialog() {
+ const res = await DeviceGroupSearch(this.formDeviceGroup)
+ this.DeviceGroupArray = res.data
+ this.DeviceGroupTotal = res.count
+ this.DeviceGroupArray.forEach(item => {
+ item.isVisible = 0
+ })
+ },
+ // 杩斿洖鎸夐挳
+ DeviceGroupDialogVisibleCancel() {
+ this.DeviceGroupDialogVisible = false
+ },
+ // 鍒犻櫎鎸夐挳
+ DeviceGroupDel(row) {
+ this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', {
+ confirmButtonText: '纭畾',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning'
+ }).then(() => {
+ DeleteDeviceGroup({ devicegroupcode: row.code }).then(res => {
+ if (res.code === '200') {
+ this.$message.success('鍒犻櫎鎴愬姛!')
+ this.getDeviceGroupSearchDialog()
+ }
+ })
+ }).catch(() => {
+ this.$message.info('宸插彇娑堝垹闄�')
+ })
+ },
+ // 淇濆瓨鎸夐挳
+ async DeviceGroupSave(row) {
+ if (row.code.trim().length < 1) {
+ return this.$message.info('鍒嗙粍缂栫爜涓嶈兘涓虹┖锛�')
+ }
+ if (row.name.trim().length < 1) {
+ return this.$message.info('鍒嗙粍鍚嶇О涓嶈兘涓虹┖锛�')
+ }
+ if (row.eqptype_code.trim().length < 1) {
+ return this.$message.info('鎵�灞炶澶囩被鍨嬩笉鑳戒负绌猴紒')
+ }
+ if (row.remark.trim().length < 1) {
+ return this.$message.info('鍒嗙粍鎻忚堪涓嶈兘涓虹┖锛�')
+ }
+ const data = {
+ 'code': row.code,
+ 'name': row.name,
+ 'group': row.eqptype_code,
+ 'description': row.remark
+ }
+ const res = await AddUpdateDeviceGroup([data])
+ if (res.code === '200') {
+ this.$message.success('娣诲姞鎴愬姛锛�')
+ await this.getDeviceGroupSearchDialog()
+ }
+ },
+ // 鍙栨秷鎸夐挳
+ DeviceGroupCancel(row) {
+ this.DeviceGroupArray.forEach((item, index) => {
+ if (item.isVisible === 1 && item.code === row.code) {
+ this.DeviceGroupArray.splice(index, 1)
+ }
+ })
}
}
}
@@ -655,17 +974,28 @@
height: 30px;
display: flex;
align-items: center;
+ //border: 1px solid $main_color;
+ border: none;
+ padding: 0 20px;
}
-
+::v-deep .el-button--primary:hover {
+ border: none;
+}
::v-deep .el-button--info {
//background-color: $main_color !important;
height: 30px;
display: flex;
align-items: center;
+ padding: 0 20px;
}
::v-deep .el-pagination.is-background .el-pager li:not(.disabled).active {
background-color: $main_color !important;
+}
+
+::v-deep .el-dialog__footer {
+ display: flex;
+ justify-content: flex-end;
}
.footerButton {
@@ -678,6 +1008,7 @@
height: 30px;
display: flex;
align-items: center;
+ padding: 0 20px;
}
::v-deep .el-button--default:hover {
@@ -692,6 +1023,12 @@
::v-deep .el-dialog__body {
padding: 20px 20px !important;
}
+
+ ::v-deep .el-select .el-input .el-select__caret {
+ display: flex;
+ align-items: center;
+ }
+
}
::v-deep .el-radio__input.is-checked .el-radio__inner {
@@ -771,4 +1108,31 @@
::v-deep .el-radio.is-bordered + .el-radio.is-bordered {
margin: 10px 30px 0px 0;
}
+
+.body ::v-deep .el-divider{
+ border: 1px solid #eee;
+ width: 99%;
+ margin: 10px auto;
+}
+.body ::v-deep .el-form-item{
+ margin-bottom: 0;
+}
+::v-deep .el-input__inner:focus {
+ border-color: $main_color;
+}
+
+::v-deep .el-select .el-input__inner:focus{
+ border-color: $main_color;
+}
+
+::v-deep .el-select-dropdown__item.selected{
+ color: $main_color;
+}
+</style>
+<style lang="scss">
+.dateStyle{
+ .el-date-table td.today span{
+ color: #42b983;
+ }
+}
</style>
--
Gitblit v1.9.3