add prettierrc & 一些全局替换

This commit is contained in:
lb 2022-08-04 15:42:36 +08:00
parent d4e7bda03b
commit 8b060b8bf1
18 changed files with 1274 additions and 1483 deletions

11
.prettierrc Normal file
View File

@ -0,0 +1,11 @@
{
"singleQuote": true,
"tabWidth": 2,
"bracketSameLine": true,
"embeddedLanguageFormatting": "auto",
"printWidth": 180,
"quoteProps": "consistent",
"trailingComma": "none",
"semi": false,
"useTabs": true
}

View File

@ -76,7 +76,7 @@ export default {
return data.name.indexOf(value) !== -1 return data.name.indexOf(value) !== -1
}, },
getDeptList (id) { getDeptList (id) {
return this.$http.get('/sys/dept/list').then(({ data: res }) => { return this.$http.get(this.$http.adornUrl('/sys/dept/list')).then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }

View File

@ -90,7 +90,7 @@ export default {
return data.name.indexOf(value) !== -1 return data.name.indexOf(value) !== -1
}, },
getDataList (id) { getDataList (id) {
return this.$http.get('/sys/region/tree').then(({ data: res }) => { return this.$http.get(this.$http.adornUrl('/sys/region/tree')).then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }

View File

@ -94,7 +94,7 @@ export default {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }
clearLoginInfo() clearLoginInfo()
this.$router.push({ name: 'login' }) this.$router.push({ name: "Login" })
}).catch(() => {}) }).catch(() => {})
}).catch(() => {}) }).catch(() => {})
} }

View File

@ -1,9 +1,5 @@
<template> <template>
<div <div v-loading.fullscreen.lock="loading" :element-loading-text="$t('loading')" :class="['aui-wrapper', { 'aui-sidebar--fold': $store.state.sidebarFold }]">
v-loading.fullscreen.lock="loading"
:element-loading-text="$t('loading')"
:class="['aui-wrapper', { 'aui-sidebar--fold': $store.state.sidebarFold }]"
>
<template v-if="!loading"> <template v-if="!loading">
<main-navbar /> <main-navbar />
<main-sidebar /> <main-sidebar />
@ -15,104 +11,98 @@
</template> </template>
<script> <script>
import MainNavbar from "./main-navbar"; import MainNavbar from './main-navbar'
import MainSidebar from "./main-sidebar"; import MainSidebar from './main-sidebar'
import MainContent from "./main-content"; import MainContent from './main-content'
import debounce from "lodash/debounce"; import debounce from 'lodash/debounce'
export default { export default {
provide() { provide() {
return { return {
// //
refresh() { refresh() {
this.$store.state.contentIsNeedRefresh = true; this.$store.state.contentIsNeedRefresh = true
this.$nextTick(() => { this.$nextTick(() => {
this.$store.state.contentIsNeedRefresh = false; this.$store.state.contentIsNeedRefresh = false
}); })
}, }
}; }
}, },
data() { data() {
return { return {
loading: true, loading: true
}; }
}, },
components: { components: {
MainNavbar, MainNavbar,
MainSidebar, MainSidebar,
MainContent, MainContent
}, },
watch: { watch: {
$route: "routeHandle", $route: 'routeHandle'
}, },
created() { created() {
this.windowResizeHandle(); this.windowResizeHandle()
this.routeHandle(this.$route); this.routeHandle(this.$route)
Promise.all([this.getUserInfo(), this.getPermissions()]).then(() => { Promise.all([this.getUserInfo(), this.getPermissions()]).then(() => {
this.loading = false; this.loading = false
}); })
}, },
methods: { methods: {
// //
windowResizeHandle() { windowResizeHandle() {
this.$store.state.sidebarFold = this.$store.state.sidebarFold = document.documentElement['clientWidth'] <= 992 || false
document.documentElement["clientWidth"] <= 992 || false;
window.addEventListener( window.addEventListener(
"resize", 'resize',
debounce(() => { debounce(() => {
this.$store.state.sidebarFold = this.$store.state.sidebarFold = document.documentElement['clientWidth'] <= 992 || false
document.documentElement["clientWidth"] <= 992 || false;
}, 150) }, 150)
); )
}, },
// , // ,
routeHandle(route) { routeHandle(route) {
if (!route.meta.isTab) { if (!route.meta.isTab) {
return false; return false
} }
var tab = this.$store.state.contentTabs.filter( var tab = this.$store.state.contentTabs.filter(item => item.name === route.name)[0]
(item) => item.name === route.name
)[0];
if (!tab) { if (!tab) {
tab = { tab = {
...window.SITE_CONFIG["contentTabDefault"], ...window.SITE_CONFIG['contentTabDefault'],
...route.meta, ...route.meta,
name: route.name, name: route.name,
params: { ...route.params }, params: { ...route.params },
query: { ...route.query }, query: { ...route.query }
};
this.$store.state.contentTabs = this.$store.state.contentTabs.concat(
tab
);
} }
this.$store.state.sidebarMenuActiveName = tab.menuId; this.$store.state.contentTabs = this.$store.state.contentTabs.concat(tab)
this.$store.state.contentTabsActiveName = tab.name; }
this.$store.state.sidebarMenuActiveName = tab.menuId
this.$store.state.contentTabsActiveName = tab.name
}, },
// //
getUserInfo() { getUserInfo() {
return this.$http return this.$http
.get(this.$http.adornUrl("/sys/user/info")) .get(this.$http.adornUrl('/sys/user/info'))
.then(({ data: res }) => { .then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg); return this.$message.error(res.msg)
} }
this.$store.state.user.id = res.data.id; this.$store.state.user.id = res.data.id
this.$store.state.user.name = res.data.username; this.$store.state.user.name = res.data.username
this.$store.state.user.superAdmin = res.data.superAdmin; this.$store.state.user.superAdmin = res.data.superAdmin
}) })
.catch(() => {}); .catch(() => {})
}, },
// //
getPermissions() { getPermissions() {
return this.$http return this.$http
.get(this.$http.adornUrl("/sys/menu/permissions")) .get(this.$http.adornUrl('/sys/menu/permissions'))
.then(({ data: res }) => { .then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg); return this.$message.error(res.msg)
} }
window.SITE_CONFIG["permissions"] = res.data; window.SITE_CONFIG['permissions'] = res.data
}) })
.catch(() => {}); .catch(() => {})
}, }
}, }
}; }
</script> </script>

View File

@ -1,8 +1,5 @@
<template> <template>
<el-dialog <el-dialog :title="!dataForm.id ? '新增' : '修改'" :close-on-click-modal="false" :visible.sync="visible">
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px"> <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
<el-form-item label="plc表iD" prop="plcId"> <el-form-item label="plc表iD" prop="plcId">
<el-input v-model="dataForm.plcId" placeholder="plc表iD"></el-input> <el-input v-model="dataForm.plcId" placeholder="plc表iD"></el-input>
@ -49,8 +46,8 @@
</template> </template>
<script> <script>
export default { export default {
data () { data() {
return { return {
visible: false, visible: false,
dataForm: { dataForm: {
@ -69,47 +66,23 @@
version: '' version: ''
}, },
dataRule: { dataRule: {
plcId: [ plcId: [{ required: true, message: 'plc表iD不能为空', trigger: 'blur' }],
{ required: true, message: 'plc表iD不能为空', trigger: 'blur' } equipmentId: [{ required: true, message: '设备表id不能为空', trigger: 'blur' }],
], enabled: [{ required: true, message: '启用状态:0 、停用1、启用不能为空', trigger: 'blur' }],
equipmentId: [ remark: [{ required: true, message: '备注不能为空', trigger: 'blur' }],
{ required: true, message: '设备表id不能为空', trigger: 'blur' } valid: [{ required: true, message: '删除标志,是否有效:1 可用 0不可用不能为空', trigger: 'blur' }],
], creatorId: [{ required: true, message: '创建人不能为空', trigger: 'blur' }],
enabled: [ creatorName: [{ required: true, message: '创建人姓名不能为空', trigger: 'blur' }],
{ required: true, message: '启用状态:0 、停用1、启用不能为空', trigger: 'blur' } createTime: [{ required: true, message: '创建时间不能为空', trigger: 'blur' }],
], updaterId: [{ required: true, message: '更新人不能为空', trigger: 'blur' }],
remark: [ updaterName: [{ required: true, message: '更新人姓名不能为空', trigger: 'blur' }],
{ required: true, message: '备注不能为空', trigger: 'blur' } updateTime: [{ required: true, message: '更新时间不能为空', trigger: 'blur' }],
], version: [{ required: true, message: '版本号不能为空', trigger: 'blur' }]
valid: [
{ required: true, message: '删除标志,是否有效:1 可用 0不可用不能为空', trigger: 'blur' }
],
creatorId: [
{ required: true, message: '创建人不能为空', trigger: 'blur' }
],
creatorName: [
{ required: true, message: '创建人姓名不能为空', trigger: 'blur' }
],
createTime: [
{ required: true, message: '创建时间不能为空', trigger: 'blur' }
],
updaterId: [
{ required: true, message: '更新人不能为空', trigger: 'blur' }
],
updaterName: [
{ required: true, message: '更新人姓名不能为空', trigger: 'blur' }
],
updateTime: [
{ required: true, message: '更新时间不能为空', trigger: 'blur' }
],
version: [
{ required: true, message: '版本号不能为空', trigger: 'blur' }
]
} }
} }
}, },
methods: { methods: {
init (id) { init(id) {
this.dataForm.id = id || 0 this.dataForm.id = id || 0
this.visible = true this.visible = true
this.$nextTick(() => { this.$nextTick(() => {
@ -119,7 +92,7 @@
url: this.$http.adornUrl(`/monitoring/equipmenplcconnect/info/${this.dataForm.id}`), url: this.$http.adornUrl(`/monitoring/equipmenplcconnect/info/${this.dataForm.id}`),
method: 'get', method: 'get',
params: this.$http.adornParams() params: this.$http.adornParams()
}).then(({data}) => { }).then(({ data }) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.dataForm.plcId = data.equipmenplcConnect.plcId this.dataForm.plcId = data.equipmenplcConnect.plcId
this.dataForm.equipmentId = data.equipmenplcConnect.equipmentId this.dataForm.equipmentId = data.equipmenplcConnect.equipmentId
@ -139,28 +112,28 @@
}) })
}, },
// //
dataFormSubmit () { dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => { this.$refs['dataForm'].validate(valid => {
if (valid) { if (valid) {
this.$http({ this.$http({
url: this.$http.adornUrl(`/monitoring/equipmenplcconnect/${!this.dataForm.id ? 'save' : 'update'}`), url: this.$http.adornUrl(`/monitoring/equipmenplcconnect/${!this.dataForm.id ? 'save' : 'update'}`),
method: 'post', method: 'post',
data: this.$http.adornData({ data: this.$http.adornData({
'id': this.dataForm.id || undefined, id: this.dataForm.id || undefined,
'plcId': this.dataForm.plcId, plcId: this.dataForm.plcId,
'equipmentId': this.dataForm.equipmentId, equipmentId: this.dataForm.equipmentId,
'enabled': this.dataForm.enabled, enabled: this.dataForm.enabled,
'remark': this.dataForm.remark, remark: this.dataForm.remark,
'valid': this.dataForm.valid, valid: this.dataForm.valid,
'creatorId': this.dataForm.creatorId, creatorId: this.dataForm.creatorId,
'creatorName': this.dataForm.creatorName, creatorName: this.dataForm.creatorName,
'createTime': this.dataForm.createTime, createTime: this.dataForm.createTime,
'updaterId': this.dataForm.updaterId, updaterId: this.dataForm.updaterId,
'updaterName': this.dataForm.updaterName, updaterName: this.dataForm.updaterName,
'updateTime': this.dataForm.updateTime, updateTime: this.dataForm.updateTime,
'version': this.dataForm.version version: this.dataForm.version
}) })
}).then(({data}) => { }).then(({ data }) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.$message({ this.$message({
message: '操作成功', message: '操作成功',
@ -179,5 +152,5 @@
}) })
} }
} }
} }
</script> </script>

View File

@ -1,8 +1,5 @@
<template> <template>
<el-dialog <el-dialog :title="!dataForm.id ? '新增' : '修改'" :close-on-click-modal="false" :visible.sync="visible">
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px"> <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
<el-form-item label="设备外部代码" prop="externalCode"> <el-form-item label="设备外部代码" prop="externalCode">
<el-input v-model="dataForm.externalCode" placeholder="设备外部代码"></el-input> <el-input v-model="dataForm.externalCode" placeholder="设备外部代码"></el-input>
@ -61,8 +58,8 @@
</template> </template>
<script> <script>
export default { export default {
data () { data() {
return { return {
visible: false, visible: false,
dataForm: { dataForm: {
@ -85,59 +82,27 @@
version: '' version: ''
}, },
dataRule: { dataRule: {
externalCode: [ externalCode: [{ required: true, message: '设备外部代码不能为空', trigger: 'blur' }],
{ required: true, message: '设备外部代码不能为空', trigger: 'blur' } plcId: [{ required: true, message: 'plc id不能为空', trigger: 'blur' }],
], plc: [{ required: true, message: 'plc不能为空', trigger: 'blur' }],
plcId: [ equipmentId: [{ required: true, message: '设备id不能为空', trigger: 'blur' }],
{ required: true, message: 'plc id不能为空', trigger: 'blur' } equipmentName: [{ required: true, message: '设备名称不能为空', trigger: 'blur' }],
], status: [{ required: true, message: '状态0正常 1计划停机 2故障不能为空', trigger: 'blur' }],
plc: [ logTime: [{ required: true, message: '记录时间不能为空', trigger: 'blur' }],
{ required: true, message: 'plc不能为空', trigger: 'blur' } remark: [{ required: true, message: '备注不能为空', trigger: 'blur' }],
], valid: [{ required: true, message: '删除标志,是否有效:1 可用 0不可用不能为空', trigger: 'blur' }],
equipmentId: [ creatorId: [{ required: true, message: '创建人不能为空', trigger: 'blur' }],
{ required: true, message: '设备id不能为空', trigger: 'blur' } creatorName: [{ required: true, message: '创建人姓名不能为空', trigger: 'blur' }],
], createTime: [{ required: true, message: '创建时间不能为空', trigger: 'blur' }],
equipmentName: [ updaterId: [{ required: true, message: '更新人不能为空', trigger: 'blur' }],
{ required: true, message: '设备名称不能为空', trigger: 'blur' } updaterName: [{ required: true, message: '更新人姓名不能为空', trigger: 'blur' }],
], updateTime: [{ required: true, message: '更新时间不能为空', trigger: 'blur' }],
status: [ version: [{ required: true, message: '版本号不能为空', trigger: 'blur' }]
{ required: true, message: '状态0正常 1计划停机 2故障不能为空', trigger: 'blur' }
],
logTime: [
{ required: true, message: '记录时间不能为空', trigger: 'blur' }
],
remark: [
{ required: true, message: '备注不能为空', trigger: 'blur' }
],
valid: [
{ required: true, message: '删除标志,是否有效:1 可用 0不可用不能为空', trigger: 'blur' }
],
creatorId: [
{ required: true, message: '创建人不能为空', trigger: 'blur' }
],
creatorName: [
{ required: true, message: '创建人姓名不能为空', trigger: 'blur' }
],
createTime: [
{ required: true, message: '创建时间不能为空', trigger: 'blur' }
],
updaterId: [
{ required: true, message: '更新人不能为空', trigger: 'blur' }
],
updaterName: [
{ required: true, message: '更新人姓名不能为空', trigger: 'blur' }
],
updateTime: [
{ required: true, message: '更新时间不能为空', trigger: 'blur' }
],
version: [
{ required: true, message: '版本号不能为空', trigger: 'blur' }
]
} }
} }
}, },
methods: { methods: {
init (id) { init(id) {
this.dataForm.id = id || 0 this.dataForm.id = id || 0
this.visible = true this.visible = true
this.$nextTick(() => { this.$nextTick(() => {
@ -147,7 +112,7 @@
url: this.$http.adornUrl(`/monitoring/equipmenstatuslog/info/${this.dataForm.id}`), url: this.$http.adornUrl(`/monitoring/equipmenstatuslog/info/${this.dataForm.id}`),
method: 'get', method: 'get',
params: this.$http.adornParams() params: this.$http.adornParams()
}).then(({data}) => { }).then(({ data }) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.dataForm.externalCode = data.equipmenstatusLog.externalCode this.dataForm.externalCode = data.equipmenstatusLog.externalCode
this.dataForm.plcId = data.equipmenstatusLog.plcId this.dataForm.plcId = data.equipmenstatusLog.plcId
@ -171,32 +136,32 @@
}) })
}, },
// //
dataFormSubmit () { dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => { this.$refs['dataForm'].validate(valid => {
if (valid) { if (valid) {
this.$http({ this.$http({
url: this.$http.adornUrl(`/monitoring/equipmenstatuslog/${!this.dataForm.id ? 'save' : 'update'}`), url: this.$http.adornUrl(`/monitoring/equipmenstatuslog/${!this.dataForm.id ? 'save' : 'update'}`),
method: 'post', method: 'post',
data: this.$http.adornData({ data: this.$http.adornData({
'id': this.dataForm.id || undefined, id: this.dataForm.id || undefined,
'externalCode': this.dataForm.externalCode, externalCode: this.dataForm.externalCode,
'plcId': this.dataForm.plcId, plcId: this.dataForm.plcId,
'plc': this.dataForm.plc, plc: this.dataForm.plc,
'equipmentId': this.dataForm.equipmentId, equipmentId: this.dataForm.equipmentId,
'equipmentName': this.dataForm.equipmentName, equipmentName: this.dataForm.equipmentName,
'status': this.dataForm.status, status: this.dataForm.status,
'logTime': this.dataForm.logTime, logTime: this.dataForm.logTime,
'remark': this.dataForm.remark, remark: this.dataForm.remark,
'valid': this.dataForm.valid, valid: this.dataForm.valid,
'creatorId': this.dataForm.creatorId, creatorId: this.dataForm.creatorId,
'creatorName': this.dataForm.creatorName, creatorName: this.dataForm.creatorName,
'createTime': this.dataForm.createTime, createTime: this.dataForm.createTime,
'updaterId': this.dataForm.updaterId, updaterId: this.dataForm.updaterId,
'updaterName': this.dataForm.updaterName, updaterName: this.dataForm.updaterName,
'updateTime': this.dataForm.updateTime, updateTime: this.dataForm.updateTime,
'version': this.dataForm.version version: this.dataForm.version
}) })
}).then(({data}) => { }).then(({ data }) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.$message({ this.$message({
message: '操作成功', message: '操作成功',
@ -215,5 +180,5 @@
}) })
} }
} }
} }
</script> </script>

View File

@ -10,186 +10,37 @@
<el-button v-if="$hasPermission('monitoring:equipment:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button> <el-button v-if="$hasPermission('monitoring:equipment:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-table <el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" style="width: 100%;">
:data="dataList" <el-table-column type="selection" header-align="center" align="center" width="50"> </el-table-column>
border <el-table-column prop="id" header-align="center" align="center" label="id"> </el-table-column>
v-loading="dataListLoading" <el-table-column prop="code" header-align="center" align="center" label="编码"> </el-table-column>
@selection-change="selectionChangeHandle" <el-table-column prop="name" header-align="center" align="center" label="设备名称"> </el-table-column>
style="width: 100%;"> <el-table-column prop="enName" header-align="center" align="center" label="英文名称"> </el-table-column>
<el-table-column <el-table-column prop="abbr" header-align="center" align="center" label="缩写"> </el-table-column>
type="selection" <el-table-column prop="enterTime" header-align="center" align="center" label="进厂日期"> </el-table-column>
header-align="center" <el-table-column prop="productionTime" header-align="center" align="center" label="生产日期"> </el-table-column>
align="center" <el-table-column prop="equipmentTypeId" header-align="center" align="center" label="设备类型,关联设备类型表"> </el-table-column>
width="50"> <el-table-column prop="groupId" header-align="center" align="center" label="分组id (关联 T_EQUIPMENT_GROUP"> </el-table-column>
<el-table-column prop="dataType" header-align="center" align="center" label="0:无类别1:上片数据设备2:下片数据设备"> </el-table-column>
<el-table-column prop="tvalue" header-align="center" align="center" label="每小时生产数量"> </el-table-column>
<el-table-column prop="processingTime" header-align="center" align="center" label="单件加工时间 s/件"> </el-table-column>
<el-table-column prop="manufacturer" header-align="center" align="center" label="制造商"> </el-table-column>
<el-table-column prop="spec" header-align="center" align="center" label="规格"> </el-table-column>
<el-table-column prop="description" header-align="center" align="center" label="功能描述"> </el-table-column>
<el-table-column prop="enabled" header-align="center" align="center" label="启用状态:0 、停用1、启用"> </el-table-column>
<el-table-column prop="remark" header-align="center" align="center" label="备注"> </el-table-column>
<el-table-column prop="valid" header-align="center" align="center" label="删除标志,是否有效:1 可用 0不可用"> </el-table-column>
<el-table-column prop="creatorId" header-align="center" align="center" label="创建人"> </el-table-column>
<el-table-column prop="creatorName" header-align="center" align="center" label="创建人姓名"> </el-table-column>
<el-table-column prop="createTime" header-align="center" align="center" label="创建时间"> </el-table-column>
<el-table-column prop="updaterId" header-align="center" align="center" label="更新人"> </el-table-column>
<el-table-column prop="updaterName" header-align="center" align="center" label="更新人姓名"> </el-table-column>
<el-table-column prop="updateTime" header-align="center" align="center" label="更新时间"> </el-table-column>
<el-table-column prop="version" header-align="center" align="center" label="版本号"> </el-table-column>
<el-table-column prop="externalCode" header-align="center" align="center" label="外部系统代码"> </el-table-column>
<el-table-column prop="externalCodeStatis" header-align="center" align="center" label="统一用的外部代码,代表用哪个设备的数据代替该设备,目前用于生产数量统计">
</el-table-column> </el-table-column>
<el-table-column <el-table-column fixed="right" header-align="center" align="center" width="150" label="操作">
prop="id"
header-align="center"
align="center"
label="id">
</el-table-column>
<el-table-column
prop="code"
header-align="center"
align="center"
label="编码">
</el-table-column>
<el-table-column
prop="name"
header-align="center"
align="center"
label="设备名称">
</el-table-column>
<el-table-column
prop="enName"
header-align="center"
align="center"
label="英文名称">
</el-table-column>
<el-table-column
prop="abbr"
header-align="center"
align="center"
label="缩写">
</el-table-column>
<el-table-column
prop="enterTime"
header-align="center"
align="center"
label="进厂日期">
</el-table-column>
<el-table-column
prop="productionTime"
header-align="center"
align="center"
label="生产日期">
</el-table-column>
<el-table-column
prop="equipmentTypeId"
header-align="center"
align="center"
label="设备类型,关联设备类型表">
</el-table-column>
<el-table-column
prop="groupId"
header-align="center"
align="center"
label="分组id (关联 T_EQUIPMENT_GROUP">
</el-table-column>
<el-table-column
prop="dataType"
header-align="center"
align="center"
label="0:无类别1:上片数据设备2:下片数据设备">
</el-table-column>
<el-table-column
prop="tvalue"
header-align="center"
align="center"
label="每小时生产数量">
</el-table-column>
<el-table-column
prop="processingTime"
header-align="center"
align="center"
label="单件加工时间 s/件">
</el-table-column>
<el-table-column
prop="manufacturer"
header-align="center"
align="center"
label="制造商">
</el-table-column>
<el-table-column
prop="spec"
header-align="center"
align="center"
label="规格">
</el-table-column>
<el-table-column
prop="description"
header-align="center"
align="center"
label="功能描述">
</el-table-column>
<el-table-column
prop="enabled"
header-align="center"
align="center"
label="启用状态:0 、停用1、启用">
</el-table-column>
<el-table-column
prop="remark"
header-align="center"
align="center"
label="备注">
</el-table-column>
<el-table-column
prop="valid"
header-align="center"
align="center"
label="删除标志,是否有效:1 可用 0不可用">
</el-table-column>
<el-table-column
prop="creatorId"
header-align="center"
align="center"
label="创建人">
</el-table-column>
<el-table-column
prop="creatorName"
header-align="center"
align="center"
label="创建人姓名">
</el-table-column>
<el-table-column
prop="createTime"
header-align="center"
align="center"
label="创建时间">
</el-table-column>
<el-table-column
prop="updaterId"
header-align="center"
align="center"
label="更新人">
</el-table-column>
<el-table-column
prop="updaterName"
header-align="center"
align="center"
label="更新人姓名">
</el-table-column>
<el-table-column
prop="updateTime"
header-align="center"
align="center"
label="更新时间">
</el-table-column>
<el-table-column
prop="version"
header-align="center"
align="center"
label="版本号">
</el-table-column>
<el-table-column
prop="externalCode"
header-align="center"
align="center"
label="外部系统代码">
</el-table-column>
<el-table-column
prop="externalCodeStatis"
header-align="center"
align="center"
label="统一用的外部代码,代表用哪个设备的数据代替该设备,目前用于生产数量统计">
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button> <el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button> <el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
@ -203,7 +54,8 @@
:page-sizes="[10, 20, 50, 100]" :page-sizes="[10, 20, 50, 100]"
:page-size="pageSize" :page-size="pageSize"
:total="totalPage" :total="totalPage"
layout="total, sizes, prev, pager, next, jumper"> layout="total, sizes, prev, pager, next, jumper"
>
</el-pagination> </el-pagination>
<!-- 弹窗, 新增 / 修改 --> <!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update> <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
@ -211,9 +63,9 @@
</template> </template>
<script> <script>
import AddOrUpdate from './equipment-add-or-update' import AddOrUpdate from './equipment-add-or-update'
export default { export default {
data () { data() {
return { return {
dataForm: { dataForm: {
key: '' key: ''
@ -230,23 +82,23 @@
components: { components: {
AddOrUpdate AddOrUpdate
}, },
activated () { activated() {
console.log('activated') console.log('activated')
this.getDataList() this.getDataList()
}, },
methods: { methods: {
// //
getDataList () { getDataList() {
this.dataListLoading = true this.dataListLoading = true
this.$http({ this.$http({
url: this.$http.adornUrl('/monitoring/equipment/page'), url: this.$http.adornUrl('/monitoring/equipment/page'),
method: 'get', method: 'get',
params: this.$http.adornParams({ params: this.$http.adornParams({
'page': this.pageIndex, page: this.pageIndex,
'limit': this.pageSize, limit: this.pageSize,
'key': this.dataForm.key key: this.dataForm.key
}) })
}).then(({data}) => { }).then(({ data }) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.dataList = data.list this.dataList = data.list
this.totalPage = data.total this.totalPage = data.total
@ -258,30 +110,32 @@
}) })
}, },
// //
sizeChangeHandle (val) { sizeChangeHandle(val) {
this.pageSize = val this.pageSize = val
this.pageIndex = 1 this.pageIndex = 1
this.getDataList() this.getDataList()
}, },
// //
currentChangeHandle (val) { currentChangeHandle(val) {
this.pageIndex = val this.pageIndex = val
this.getDataList() this.getDataList()
}, },
// //
selectionChangeHandle (val) { selectionChangeHandle(val) {
this.dataListSelections = val this.dataListSelections = val
}, },
// / // /
addOrUpdateHandle (id) { addOrUpdateHandle(id) {
this.addOrUpdateVisible = true this.addOrUpdateVisible = true
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.addOrUpdate.init(id) this.$refs.addOrUpdate.init(id)
}) })
}, },
// //
deleteHandle (id) { deleteHandle(id) {
var ids = id ? [id] : this.dataListSelections.map(item => { var ids = id
? [id]
: this.dataListSelections.map(item => {
return item.id return item.id
}) })
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', { this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
@ -293,7 +147,7 @@
url: this.$http.adornUrl('/monitoring/equipment/delete'), url: this.$http.adornUrl('/monitoring/equipment/delete'),
method: 'post', method: 'post',
data: this.$http.adornData(ids, false) data: this.$http.adornData(ids, false)
}).then(({data}) => { }).then(({ data }) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.$message({ this.$message({
message: '操作成功', message: '操作成功',
@ -310,5 +164,5 @@
}) })
} }
} }
} }
</script> </script>

View File

@ -72,7 +72,7 @@ export default {
}, },
// //
getInfo () { getInfo () {
this.$http.get(`/sys/schedule/${this.dataForm.id}`).then(({ data: res }) => { this.$http.get(this.$http.adornUrl(`/sys/schedule/${this.dataForm.id}`)).then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }

View File

@ -62,7 +62,7 @@ export default {
}, },
// //
showErrorInfo (id) { showErrorInfo (id) {
this.$http.get(`/sys/scheduleLog/${id}`).then(({ data: res }) => { this.$http.get(this.$http.adornUrl(`/sys/scheduleLog/${id}`)).then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }

View File

@ -99,7 +99,7 @@
<script> <script>
import debounce from 'lodash/debounce' import debounce from 'lodash/debounce'
export default { export default {
data () { data() {
return { return {
visible: false, visible: false,
dataForm: { dataForm: {
@ -126,63 +126,33 @@ export default {
} }
}, },
computed: { computed: {
dataRule () { dataRule() {
return { return {
qiniuDomain: [ qiniuDomain: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }],
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } qiniuAccessKey: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }],
], qiniuSecretKey: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }],
qiniuAccessKey: [ qiniuBucketName: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }],
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } aliyunDomain: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }],
], aliyunEndPoint: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }],
qiniuSecretKey: [ aliyunAccessKeyId: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }],
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } aliyunAccessKeySecret: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }],
], aliyunBucketName: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }],
qiniuBucketName: [ qcloudDomain: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }],
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } qcloudAppId: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }],
], qcloudSecretId: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }],
aliyunDomain: [ qcloudSecretKey: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }],
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } qcloudBucketName: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }],
], qcloudRegion: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }]
aliyunEndPoint: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
aliyunAccessKeyId: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
aliyunAccessKeySecret: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
aliyunBucketName: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
qcloudDomain: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
qcloudAppId: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
qcloudSecretId: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
qcloudSecretKey: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
qcloudBucketName: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
qcloudRegion: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
]
} }
} }
}, },
watch: { watch: {
'dataForm.type' (val) { 'dataForm.type'(val) {
this.$refs['dataForm'].clearValidate() this.$refs['dataForm'].clearValidate()
} }
}, },
methods: { methods: {
init () { init() {
this.visible = true this.visible = true
this.$nextTick(() => { this.$nextTick(() => {
this.$refs['dataForm'].resetFields() this.$refs['dataForm'].resetFields()
@ -190,21 +160,27 @@ export default {
}) })
}, },
// //
getInfo () { getInfo() {
this.$http.get('/sys/oss/info').then(({ data: res }) => { this.$http
.get(this.$http.adornUrl('/sys/oss/info'))
.then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }
this.dataForm = res.data this.dataForm = res.data
}).catch(() => {}) })
.catch(() => {})
}, },
// //
dataFormSubmitHandle: debounce(function () { dataFormSubmitHandle: debounce(
this.$refs['dataForm'].validate((valid) => { function() {
this.$refs['dataForm'].validate(valid => {
if (!valid) { if (!valid) {
return false return false
} }
this.$http.post('/sys/oss', this.dataForm).then(({ data: res }) => { this.$http
.post(this.$http.adornUrl('/sys/oss'), this.dataForm)
.then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }
@ -217,9 +193,13 @@ export default {
this.$emit('refreshDataList') this.$emit('refreshDataList')
} }
}) })
}).catch(() => {})
}) })
}, 1000, { 'leading': true, 'trailing': false }) .catch(() => {})
})
},
1000,
{ leading: true, trailing: false }
)
} }
} }
</script> </script>

View File

@ -14,7 +14,8 @@
:highlight-current="true" :highlight-current="true"
:expand-on-click-node="false" :expand-on-click-node="false"
accordion accordion
@current-change="deptListTreeCurrentChangeHandle"> @current-change="deptListTreeCurrentChangeHandle"
>
</el-tree> </el-tree>
</el-popover> </el-popover>
<el-input v-model="dataForm.parentName" v-popover:deptListPopover :readonly="true" :placeholder="$t('dept.parentName')"> <el-input v-model="dataForm.parentName" v-popover:deptListPopover :readonly="true" :placeholder="$t('dept.parentName')">
@ -22,7 +23,8 @@
v-if="$store.state.user.superAdmin === 1 && dataForm.pid !== '0'" v-if="$store.state.user.superAdmin === 1 && dataForm.pid !== '0'"
slot="suffix" slot="suffix"
@click.stop="deptListTreeSetDefaultHandle()" @click.stop="deptListTreeSetDefaultHandle()"
class="el-icon-circle-close el-input__icon"> class="el-icon-circle-close el-input__icon"
>
</i> </i>
</el-input> </el-input>
</el-form-item> </el-form-item>
@ -40,7 +42,7 @@
<script> <script>
import debounce from 'lodash/debounce' import debounce from 'lodash/debounce'
export default { export default {
data () { data() {
return { return {
visible: false, visible: false,
deptList: [], deptList: [],
@ -55,19 +57,15 @@ export default {
} }
}, },
computed: { computed: {
dataRule () { dataRule() {
return { return {
name: [ name: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }],
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } parentName: [{ required: true, message: this.$t('validate.required'), trigger: 'change' }]
],
parentName: [
{ required: true, message: this.$t('validate.required'), trigger: 'change' }
]
} }
} }
}, },
methods: { methods: {
init () { init() {
this.visible = true this.visible = true
this.$nextTick(() => { this.$nextTick(() => {
this.$refs['dataForm'].resetFields() this.$refs['dataForm'].resetFields()
@ -81,17 +79,22 @@ export default {
}) })
}, },
// //
getDeptList () { getDeptList() {
return this.$http.get('/sys/dept/list').then(({ data: res }) => { return this.$http
.get(this.$http.adornUrl('/sys/dept/list'))
.then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }
this.deptList = res.data this.deptList = res.data
}).catch(() => {}) })
.catch(() => {})
}, },
// //
getInfo () { getInfo() {
this.$http.get(`/sys/dept/${this.dataForm.id}`).then(({ data: res }) => { this.$http
.get(this.$http.adornUrl(`/sys/dept/${this.dataForm.id}`))
.then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }
@ -103,26 +106,29 @@ export default {
return this.deptListTreeSetDefaultHandle() return this.deptListTreeSetDefaultHandle()
} }
this.$refs.deptListTree.setCurrentKey(this.dataForm.pid) this.$refs.deptListTree.setCurrentKey(this.dataForm.pid)
}).catch(() => {}) })
.catch(() => {})
}, },
// , // ,
deptListTreeSetDefaultHandle () { deptListTreeSetDefaultHandle() {
this.dataForm.pid = '0' this.dataForm.pid = '0'
this.dataForm.parentName = this.$t('dept.parentNameDefault') this.dataForm.parentName = this.$t('dept.parentNameDefault')
}, },
// , // ,
deptListTreeCurrentChangeHandle (data) { deptListTreeCurrentChangeHandle(data) {
this.dataForm.pid = data.id this.dataForm.pid = data.id
this.dataForm.parentName = data.name this.dataForm.parentName = data.name
this.deptListVisible = false this.deptListVisible = false
}, },
// //
dataFormSubmitHandle: debounce(function () { dataFormSubmitHandle: debounce(
this.$refs['dataForm'].validate((valid) => { function() {
this.$refs['dataForm'].validate(valid => {
if (!valid) { if (!valid) {
return false return false
} }
this.$http[!this.dataForm.id ? 'post' : 'put']('/sys/dept', this.dataForm).then(({ data: res }) => { this.$http[!this.dataForm.id ? 'post' : 'put']('/sys/dept', this.dataForm)
.then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }
@ -135,9 +141,13 @@ export default {
this.$emit('refreshDataList') this.$emit('refreshDataList')
} }
}) })
}).catch(() => {})
}) })
}, 1000, { 'leading': true, 'trailing': false }) .catch(() => {})
})
},
1000,
{ leading: true, trailing: false }
)
} }
} }
</script> </script>

View File

@ -24,7 +24,7 @@
<script> <script>
import debounce from 'lodash/debounce' import debounce from 'lodash/debounce'
export default { export default {
data () { data() {
return { return {
visible: false, visible: false,
dataForm: { dataForm: {
@ -38,22 +38,16 @@ export default {
} }
}, },
computed: { computed: {
dataRule () { dataRule() {
return { return {
dictLabel: [ dictLabel: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }],
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } dictValue: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }],
], sort: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }]
dictValue: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
sort: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
]
} }
} }
}, },
methods: { methods: {
init () { init() {
this.visible = true this.visible = true
this.$nextTick(() => { this.$nextTick(() => {
this.$refs['dataForm'].resetFields() this.$refs['dataForm'].resetFields()
@ -63,8 +57,10 @@ export default {
}) })
}, },
// //
getInfo () { getInfo() {
this.$http.get(`/sys/dict/data/${this.dataForm.id}`).then(({ data: res }) => { this.$http
.get(this.$http.adornUrl(`/sys/dict/data/${this.dataForm.id}`))
.then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }
@ -72,15 +68,18 @@ export default {
...this.dataForm, ...this.dataForm,
...res.data ...res.data
} }
}).catch(() => {}) })
.catch(() => {})
}, },
// //
dataFormSubmitHandle: debounce(function () { dataFormSubmitHandle: debounce(
this.$refs['dataForm'].validate((valid) => { function() {
this.$refs['dataForm'].validate(valid => {
if (!valid) { if (!valid) {
return false return false
} }
this.$http[!this.dataForm.id ? 'post' : 'put']('/sys/dict/data', this.dataForm).then(({ data: res }) => { this.$http[!this.dataForm.id ? 'post' : 'put']('/sys/dict/data', this.dataForm)
.then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }
@ -93,9 +92,13 @@ export default {
this.$emit('refreshDataList') this.$emit('refreshDataList')
} }
}) })
}).catch(() => {})
}) })
}, 1000, { 'leading': true, 'trailing': false }) .catch(() => {})
})
},
1000,
{ leading: true, trailing: false }
)
} }
} }
</script> </script>

View File

@ -63,7 +63,7 @@ export default {
}, },
// //
getInfo () { getInfo () {
this.$http.get(`/sys/dict/type/${this.dataForm.id}`).then(({ data: res }) => { this.$http.get(this.$http.adornUrl(`/sys/dict/type/${this.dataForm.id}`)).then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }

View File

@ -20,7 +20,8 @@
:highlight-current="true" :highlight-current="true"
:expand-on-click-node="false" :expand-on-click-node="false"
accordion accordion
@current-change="menuListTreeCurrentChangeHandle"> @current-change="menuListTreeCurrentChangeHandle"
>
</el-tree> </el-tree>
</el-popover> </el-popover>
<el-input v-model="dataForm.parentName" v-popover:menuListPopover :readonly="true" :placeholder="$t('menu.parentName')"> <el-input v-model="dataForm.parentName" v-popover:menuListPopover :readonly="true" :placeholder="$t('menu.parentName')">
@ -40,11 +41,7 @@
<el-popover v-model="iconListVisible" ref="iconListPopover" placement="bottom-start" trigger="click" popper-class="mod-sys__menu-icon-popover"> <el-popover v-model="iconListVisible" ref="iconListPopover" placement="bottom-start" trigger="click" popper-class="mod-sys__menu-icon-popover">
<div class="mod-sys__menu-icon-inner"> <div class="mod-sys__menu-icon-inner">
<div class="mod-sys__menu-icon-list"> <div class="mod-sys__menu-icon-list">
<el-button <el-button v-for="(item, index) in iconList" :key="index" @click="iconListCurrentChangeHandle(item)" :class="{ 'is-active': dataForm.icon === item }">
v-for="(item, index) in iconList"
:key="index"
@click="iconListCurrentChangeHandle(item)"
:class="{ 'is-active': dataForm.icon === item }">
<svg class="icon-svg" aria-hidden="true"><use :xlink:href="`#${item}`"></use></svg> <svg class="icon-svg" aria-hidden="true"><use :xlink:href="`#${item}`"></use></svg>
</el-button> </el-button>
</div> </div>
@ -64,7 +61,7 @@
import debounce from 'lodash/debounce' import debounce from 'lodash/debounce'
import { getIconList } from '@/utils' import { getIconList } from '@/utils'
export default { export default {
data () { data() {
return { return {
visible: false, visible: false,
menuList: [], menuList: [],
@ -85,24 +82,20 @@ export default {
} }
}, },
computed: { computed: {
dataRule () { dataRule() {
return { return {
name: [ name: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }],
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } parentName: [{ required: true, message: this.$t('validate.required'), trigger: 'change' }]
],
parentName: [
{ required: true, message: this.$t('validate.required'), trigger: 'change' }
]
} }
} }
}, },
watch: { watch: {
'dataForm.type' (val) { 'dataForm.type'(val) {
this.$refs['dataForm'].clearValidate() this.$refs['dataForm'].clearValidate()
} }
}, },
methods: { methods: {
init () { init() {
this.visible = true this.visible = true
this.$nextTick(() => { this.$nextTick(() => {
this.$refs['dataForm'].resetFields() this.$refs['dataForm'].resetFields()
@ -116,17 +109,22 @@ export default {
}) })
}, },
// //
getMenuList () { getMenuList() {
return this.$http.get('/sys/menu/list?type=0').then(({ data: res }) => { return this.$http
.get(this.$http.adornUrl('/sys/menu/list?type=0'))
.then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }
this.menuList = res.data this.menuList = res.data
}).catch(() => {}) })
.catch(() => {})
}, },
// //
getInfo () { getInfo() {
this.$http.get(`/sys/menu/${this.dataForm.id}`).then(({ data: res }) => { this.$http
.get(this.$http.adornUrl(`/sys/menu/${this.dataForm.id}`))
.then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }
@ -138,31 +136,34 @@ export default {
return this.deptListTreeSetDefaultHandle() return this.deptListTreeSetDefaultHandle()
} }
this.$refs.menuListTree.setCurrentKey(this.dataForm.pid) this.$refs.menuListTree.setCurrentKey(this.dataForm.pid)
}).catch(() => {}) })
.catch(() => {})
}, },
// , // ,
deptListTreeSetDefaultHandle () { deptListTreeSetDefaultHandle() {
this.dataForm.pid = '0' this.dataForm.pid = '0'
this.dataForm.parentName = this.$t('menu.parentNameDefault') this.dataForm.parentName = this.$t('menu.parentNameDefault')
}, },
// , // ,
menuListTreeCurrentChangeHandle (data) { menuListTreeCurrentChangeHandle(data) {
this.dataForm.pid = data.id this.dataForm.pid = data.id
this.dataForm.parentName = data.name this.dataForm.parentName = data.name
this.menuListVisible = false this.menuListVisible = false
}, },
// , // ,
iconListCurrentChangeHandle (icon) { iconListCurrentChangeHandle(icon) {
this.dataForm.icon = icon this.dataForm.icon = icon
this.iconListVisible = false this.iconListVisible = false
}, },
// //
dataFormSubmitHandle: debounce(function () { dataFormSubmitHandle: debounce(
this.$refs['dataForm'].validate((valid) => { function() {
this.$refs['dataForm'].validate(valid => {
if (!valid) { if (!valid) {
return false return false
} }
this.$http[!this.dataForm.id ? 'post' : 'put']('/sys/menu', this.dataForm).then(({ data: res }) => { this.$http[!this.dataForm.id ? 'post' : 'put']('/sys/menu', this.dataForm)
.then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }
@ -175,9 +176,13 @@ export default {
this.$emit('refreshDataList') this.$emit('refreshDataList')
} }
}) })
}).catch(() => {})
}) })
}, 1000, { 'leading': true, 'trailing': false }) .catch(() => {})
})
},
1000,
{ leading: true, trailing: false }
)
} }
} }
</script> </script>

View File

@ -56,7 +56,7 @@ export default {
}, },
// //
getInfo () { getInfo () {
this.$http.get(`/sys/params/${this.dataForm.id}`).then(({ data: res }) => { this.$http.get(this.$http.adornUrl(`/sys/params/${this.dataForm.id}`)).then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }

View File

@ -86,7 +86,7 @@ export default {
}, },
// //
getMenuList () { getMenuList () {
return this.$http.get('/sys/menu/select').then(({ data: res }) => { return this.$http.get(this.$http.adornUrl('/sys/menu/select')).then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }
@ -95,7 +95,7 @@ export default {
}, },
// //
getDeptList () { getDeptList () {
return this.$http.get('/sys/dept/list').then(({ data: res }) => { return this.$http.get(this.$http.adornUrl('/sys/dept/list')).then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }
@ -104,7 +104,7 @@ export default {
}, },
// //
getInfo () { getInfo () {
this.$http.get(`/sys/role/${this.dataForm.id}`).then(({ data: res }) => { this.$http.get(this.$http.adornUrl(`/sys/role/${this.dataForm.id}`)).then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }

View File

@ -141,7 +141,7 @@ export default {
}, },
// //
getRoleList () { getRoleList () {
return this.$http.get('/sys/role/list').then(({ data: res }) => { return this.$http.get(this.$http.adornUrl('/sys/role/list')).then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }
@ -150,7 +150,7 @@ export default {
}, },
// //
getInfo () { getInfo () {
this.$http.get(`/sys/user/${this.dataForm.id}`).then(({ data: res }) => { this.$http.get(this.$http.adornUrl(`/sys/user/${this.dataForm.id}`)).then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }