fzq #31

Closed
fanzhiqin wants to merge 215 commits from fzq into test
18 changed files with 1274 additions and 1483 deletions
Showing only changes of commit 8b060b8bf1 - Show all commits

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,118 +1,108 @@
<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" <template v-if="!loading">
:element-loading-text="$t('loading')" <main-navbar />
:class="['aui-wrapper', { 'aui-sidebar--fold': $store.state.sidebarFold }]" <main-sidebar />
> <div class="aui-content__wrapper">
<template v-if="!loading"> <main-content v-if="!$store.state.contentIsNeedRefresh" />
<main-navbar /> </div>
<main-sidebar /> </template>
<div class="aui-content__wrapper"> </div>
<main-content v-if="!$store.state.contentIsNeedRefresh" />
</div>
</template>
</div>
</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 = document.documentElement['clientWidth'] <= 992 || false
this.$store.state.sidebarFold = }, 150)
document.documentElement["clientWidth"] <= 992 || false; )
}, 150) },
); // ,
}, routeHandle(route) {
// , if (!route.meta.isTab) {
routeHandle(route) { return false
if (!route.meta.isTab) { }
return false; var tab = this.$store.state.contentTabs.filter(item => item.name === route.name)[0]
} if (!tab) {
var tab = this.$store.state.contentTabs.filter( tab = {
(item) => item.name === route.name ...window.SITE_CONFIG['contentTabDefault'],
)[0]; ...route.meta,
if (!tab) { name: route.name,
tab = { params: { ...route.params },
...window.SITE_CONFIG["contentTabDefault"], query: { ...route.query }
...route.meta, }
name: route.name, this.$store.state.contentTabs = this.$store.state.contentTabs.concat(tab)
params: { ...route.params }, }
query: { ...route.query }, this.$store.state.sidebarMenuActiveName = tab.menuId
}; this.$store.state.contentTabsActiveName = tab.name
this.$store.state.contentTabs = this.$store.state.contentTabs.concat( },
tab //
); getUserInfo() {
} return this.$http
this.$store.state.sidebarMenuActiveName = tab.menuId; .get(this.$http.adornUrl('/sys/user/info'))
this.$store.state.contentTabsActiveName = tab.name; .then(({ data: res }) => {
}, if (res.code !== 0) {
// return this.$message.error(res.msg)
getUserInfo() { }
return this.$http this.$store.state.user.id = res.data.id
.get(this.$http.adornUrl("/sys/user/info")) this.$store.state.user.name = res.data.username
.then(({ data: res }) => { this.$store.state.user.superAdmin = res.data.superAdmin
if (res.code !== 0) { })
return this.$message.error(res.msg); .catch(() => {})
} },
this.$store.state.user.id = res.data.id; //
this.$store.state.user.name = res.data.username; getPermissions() {
this.$store.state.user.superAdmin = res.data.superAdmin; return this.$http
}) .get(this.$http.adornUrl('/sys/menu/permissions'))
.catch(() => {}); .then(({ data: res }) => {
}, if (res.code !== 0) {
// return this.$message.error(res.msg)
getPermissions() { }
return this.$http window.SITE_CONFIG['permissions'] = res.data
.get(this.$http.adornUrl("/sys/menu/permissions")) })
.then(({ data: res }) => { .catch(() => {})
if (res.code !== 0) { }
return this.$message.error(res.msg); }
} }
window.SITE_CONFIG["permissions"] = res.data;
})
.catch(() => {});
},
},
};
</script> </script>

View File

@ -1,183 +1,156 @@
<template> <template>
<el-dialog <el-dialog :title="!dataForm.id ? '新增' : '修改'" :close-on-click-modal="false" :visible.sync="visible">
:title="!dataForm.id ? '新增' : '修改'" <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
:close-on-click-modal="false" <el-form-item label="plc表iD" prop="plcId">
:visible.sync="visible"> <el-input v-model="dataForm.plcId" placeholder="plc表iD"></el-input>
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px"> </el-form-item>
<el-form-item label="plc表iD" prop="plcId"> <el-form-item label="设备表id" prop="equipmentId">
<el-input v-model="dataForm.plcId" placeholder="plc表iD"></el-input> <el-input v-model="dataForm.equipmentId" placeholder="设备表id"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="设备表id" prop="equipmentId"> <el-form-item label="启用状态:0 、停用1、启用" prop="enabled">
<el-input v-model="dataForm.equipmentId" placeholder="设备表id"></el-input> <el-input v-model="dataForm.enabled" placeholder="启用状态:0 、停用1、启用"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="启用状态:0 、停用1、启用" prop="enabled"> <el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.enabled" placeholder="启用状态:0 、停用1、启用"></el-input> <el-input v-model="dataForm.remark" placeholder="备注"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="备注" prop="remark"> <el-form-item label="删除标志,是否有效:1 可用 0不可用" prop="valid">
<el-input v-model="dataForm.remark" placeholder="备注"></el-input> <el-input v-model="dataForm.valid" placeholder="删除标志,是否有效:1 可用 0不可用"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="删除标志,是否有效:1 可用 0不可用" prop="valid"> <el-form-item label="创建人" prop="creatorId">
<el-input v-model="dataForm.valid" placeholder="删除标志,是否有效:1 可用 0不可用"></el-input> <el-input v-model="dataForm.creatorId" placeholder="创建人"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="创建人" prop="creatorId"> <el-form-item label="创建人姓名" prop="creatorName">
<el-input v-model="dataForm.creatorId" placeholder="创建人"></el-input> <el-input v-model="dataForm.creatorName" placeholder="创建人姓名"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="创建人姓名" prop="creatorName"> <el-form-item label="创建时间" prop="createTime">
<el-input v-model="dataForm.creatorName" placeholder="创建人姓名"></el-input> <el-input v-model="dataForm.createTime" placeholder="创建时间"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="创建时间" prop="createTime"> <el-form-item label="更新人" prop="updaterId">
<el-input v-model="dataForm.createTime" placeholder="创建时间"></el-input> <el-input v-model="dataForm.updaterId" placeholder="更新人"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="更新人" prop="updaterId"> <el-form-item label="更新人姓名" prop="updaterName">
<el-input v-model="dataForm.updaterId" placeholder="更新人"></el-input> <el-input v-model="dataForm.updaterName" placeholder="更新人姓名"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="更新人姓名" prop="updaterName"> <el-form-item label="更新时间" prop="updateTime">
<el-input v-model="dataForm.updaterName" placeholder="更新人姓名"></el-input> <el-input v-model="dataForm.updateTime" placeholder="更新时间"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="更新时间" prop="updateTime"> <el-form-item label="版本号" prop="version">
<el-input v-model="dataForm.updateTime" placeholder="更新时间"></el-input> <el-input v-model="dataForm.version" placeholder="版本号"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="版本号" prop="version"> </el-form>
<el-input v-model="dataForm.version" placeholder="版本号"></el-input> <span slot="footer" class="dialog-footer">
</el-form-item> <el-button @click="visible = false">取消</el-button>
</el-form> <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
<span slot="footer" class="dialog-footer"> </span>
<el-button @click="visible = false">取消</el-button> </el-dialog>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template> </template>
<script> <script>
export default { export default {
data () { data() {
return { return {
visible: false, visible: false,
dataForm: { dataForm: {
id: 0, id: 0,
plcId: '', plcId: '',
equipmentId: '', equipmentId: '',
enabled: '', enabled: '',
remark: '', remark: '',
valid: '', valid: '',
creatorId: '', creatorId: '',
creatorName: '', creatorName: '',
createTime: '', createTime: '',
updaterId: '', updaterId: '',
updaterName: '', updaterName: '',
updateTime: '', updateTime: '',
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: [ methods: {
{ required: true, message: '创建人不能为空', trigger: 'blur' } init(id) {
], this.dataForm.id = id || 0
creatorName: [ this.visible = true
{ required: true, message: '创建人姓名不能为空', trigger: 'blur' } this.$nextTick(() => {
], this.$refs['dataForm'].resetFields()
createTime: [ if (this.dataForm.id) {
{ required: true, message: '创建时间不能为空', trigger: 'blur' } this.$http({
], url: this.$http.adornUrl(`/monitoring/equipmenplcconnect/info/${this.dataForm.id}`),
updaterId: [ method: 'get',
{ required: true, message: '更新人不能为空', trigger: 'blur' } params: this.$http.adornParams()
], }).then(({ data }) => {
updaterName: [ if (data && data.code === 0) {
{ required: true, message: '更新人姓名不能为空', trigger: 'blur' } this.dataForm.plcId = data.equipmenplcConnect.plcId
], this.dataForm.equipmentId = data.equipmenplcConnect.equipmentId
updateTime: [ this.dataForm.enabled = data.equipmenplcConnect.enabled
{ required: true, message: '更新时间不能为空', trigger: 'blur' } this.dataForm.remark = data.equipmenplcConnect.remark
], this.dataForm.valid = data.equipmenplcConnect.valid
version: [ this.dataForm.creatorId = data.equipmenplcConnect.creatorId
{ required: true, message: '版本号不能为空', trigger: 'blur' } this.dataForm.creatorName = data.equipmenplcConnect.creatorName
] this.dataForm.createTime = data.equipmenplcConnect.createTime
} this.dataForm.updaterId = data.equipmenplcConnect.updaterId
} this.dataForm.updaterName = data.equipmenplcConnect.updaterName
}, this.dataForm.updateTime = data.equipmenplcConnect.updateTime
methods: { this.dataForm.version = data.equipmenplcConnect.version
init (id) { }
this.dataForm.id = id || 0 })
this.visible = true }
this.$nextTick(() => { })
this.$refs['dataForm'].resetFields() },
if (this.dataForm.id) { //
this.$http({ dataFormSubmit() {
url: this.$http.adornUrl(`/monitoring/equipmenplcconnect/info/${this.dataForm.id}`), this.$refs['dataForm'].validate(valid => {
method: 'get', if (valid) {
params: this.$http.adornParams() this.$http({
}).then(({data}) => { url: this.$http.adornUrl(`/monitoring/equipmenplcconnect/${!this.dataForm.id ? 'save' : 'update'}`),
if (data && data.code === 0) { method: 'post',
this.dataForm.plcId = data.equipmenplcConnect.plcId data: this.$http.adornData({
this.dataForm.equipmentId = data.equipmenplcConnect.equipmentId id: this.dataForm.id || undefined,
this.dataForm.enabled = data.equipmenplcConnect.enabled plcId: this.dataForm.plcId,
this.dataForm.remark = data.equipmenplcConnect.remark equipmentId: this.dataForm.equipmentId,
this.dataForm.valid = data.equipmenplcConnect.valid enabled: this.dataForm.enabled,
this.dataForm.creatorId = data.equipmenplcConnect.creatorId remark: this.dataForm.remark,
this.dataForm.creatorName = data.equipmenplcConnect.creatorName valid: this.dataForm.valid,
this.dataForm.createTime = data.equipmenplcConnect.createTime creatorId: this.dataForm.creatorId,
this.dataForm.updaterId = data.equipmenplcConnect.updaterId creatorName: this.dataForm.creatorName,
this.dataForm.updaterName = data.equipmenplcConnect.updaterName createTime: this.dataForm.createTime,
this.dataForm.updateTime = data.equipmenplcConnect.updateTime updaterId: this.dataForm.updaterId,
this.dataForm.version = data.equipmenplcConnect.version updaterName: this.dataForm.updaterName,
} updateTime: this.dataForm.updateTime,
}) version: this.dataForm.version
} })
}) }).then(({ data }) => {
}, if (data && data.code === 0) {
// this.$message({
dataFormSubmit () { message: '操作成功',
this.$refs['dataForm'].validate((valid) => { type: 'success',
if (valid) { duration: 1500,
this.$http({ onClose: () => {
url: this.$http.adornUrl(`/monitoring/equipmenplcconnect/${!this.dataForm.id ? 'save' : 'update'}`), this.visible = false
method: 'post', this.$emit('refreshDataList')
data: this.$http.adornData({ }
'id': this.dataForm.id || undefined, })
'plcId': this.dataForm.plcId, } else {
'equipmentId': this.dataForm.equipmentId, this.$message.error(data.msg)
'enabled': this.dataForm.enabled, }
'remark': this.dataForm.remark, })
'valid': this.dataForm.valid, }
'creatorId': this.dataForm.creatorId, })
'creatorName': this.dataForm.creatorName, }
'createTime': this.dataForm.createTime, }
'updaterId': this.dataForm.updaterId, }
'updaterName': this.dataForm.updaterName,
'updateTime': this.dataForm.updateTime,
'version': this.dataForm.version
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script> </script>

View File

@ -1,219 +1,184 @@
<template> <template>
<el-dialog <el-dialog :title="!dataForm.id ? '新增' : '修改'" :close-on-click-modal="false" :visible.sync="visible">
:title="!dataForm.id ? '新增' : '修改'" <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
:close-on-click-modal="false" <el-form-item label="设备外部代码" prop="externalCode">
:visible.sync="visible"> <el-input v-model="dataForm.externalCode" placeholder="设备外部代码"></el-input>
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px"> </el-form-item>
<el-form-item label="设备外部代码" prop="externalCode"> <el-form-item label="plc id" prop="plcId">
<el-input v-model="dataForm.externalCode" placeholder="设备外部代码"></el-input> <el-input v-model="dataForm.plcId" placeholder="plc id"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="plc id" prop="plcId"> <el-form-item label="plc" prop="plc">
<el-input v-model="dataForm.plcId" placeholder="plc id"></el-input> <el-input v-model="dataForm.plc" placeholder="plc"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="plc" prop="plc"> <el-form-item label="设备id" prop="equipmentId">
<el-input v-model="dataForm.plc" placeholder="plc"></el-input> <el-input v-model="dataForm.equipmentId" placeholder="设备id"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="设备id" prop="equipmentId"> <el-form-item label="设备名称" prop="equipmentName">
<el-input v-model="dataForm.equipmentId" placeholder="设备id"></el-input> <el-input v-model="dataForm.equipmentName" placeholder="设备名称"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="设备名称" prop="equipmentName"> <el-form-item label="状态0正常 1计划停机 2故障" prop="status">
<el-input v-model="dataForm.equipmentName" placeholder="设备名称"></el-input> <el-input v-model="dataForm.status" placeholder="状态0正常 1计划停机 2故障"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="状态0正常 1计划停机 2故障" prop="status"> <el-form-item label="记录时间" prop="logTime">
<el-input v-model="dataForm.status" placeholder="状态0正常 1计划停机 2故障"></el-input> <el-input v-model="dataForm.logTime" placeholder="记录时间"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="记录时间" prop="logTime"> <el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.logTime" placeholder="记录时间"></el-input> <el-input v-model="dataForm.remark" placeholder="备注"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="备注" prop="remark"> <el-form-item label="删除标志,是否有效:1 可用 0不可用" prop="valid">
<el-input v-model="dataForm.remark" placeholder="备注"></el-input> <el-input v-model="dataForm.valid" placeholder="删除标志,是否有效:1 可用 0不可用"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="删除标志,是否有效:1 可用 0不可用" prop="valid"> <el-form-item label="创建人" prop="creatorId">
<el-input v-model="dataForm.valid" placeholder="删除标志,是否有效:1 可用 0不可用"></el-input> <el-input v-model="dataForm.creatorId" placeholder="创建人"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="创建人" prop="creatorId"> <el-form-item label="创建人姓名" prop="creatorName">
<el-input v-model="dataForm.creatorId" placeholder="创建人"></el-input> <el-input v-model="dataForm.creatorName" placeholder="创建人姓名"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="创建人姓名" prop="creatorName"> <el-form-item label="创建时间" prop="createTime">
<el-input v-model="dataForm.creatorName" placeholder="创建人姓名"></el-input> <el-input v-model="dataForm.createTime" placeholder="创建时间"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="创建时间" prop="createTime"> <el-form-item label="更新人" prop="updaterId">
<el-input v-model="dataForm.createTime" placeholder="创建时间"></el-input> <el-input v-model="dataForm.updaterId" placeholder="更新人"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="更新人" prop="updaterId"> <el-form-item label="更新人姓名" prop="updaterName">
<el-input v-model="dataForm.updaterId" placeholder="更新人"></el-input> <el-input v-model="dataForm.updaterName" placeholder="更新人姓名"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="更新人姓名" prop="updaterName"> <el-form-item label="更新时间" prop="updateTime">
<el-input v-model="dataForm.updaterName" placeholder="更新人姓名"></el-input> <el-input v-model="dataForm.updateTime" placeholder="更新时间"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="更新时间" prop="updateTime"> <el-form-item label="版本号" prop="version">
<el-input v-model="dataForm.updateTime" placeholder="更新时间"></el-input> <el-input v-model="dataForm.version" placeholder="版本号"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="版本号" prop="version"> </el-form>
<el-input v-model="dataForm.version" placeholder="版本号"></el-input> <span slot="footer" class="dialog-footer">
</el-form-item> <el-button @click="visible = false">取消</el-button>
</el-form> <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
<span slot="footer" class="dialog-footer"> </span>
<el-button @click="visible = false">取消</el-button> </el-dialog>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template> </template>
<script> <script>
export default { export default {
data () { data() {
return { return {
visible: false, visible: false,
dataForm: { dataForm: {
id: 0, id: 0,
externalCode: '', externalCode: '',
plcId: '', plcId: '',
plc: '', plc: '',
equipmentId: '', equipmentId: '',
equipmentName: '', equipmentName: '',
status: '', status: '',
logTime: '', logTime: '',
remark: '', remark: '',
valid: '', valid: '',
creatorId: '', creatorId: '',
creatorName: '', creatorName: '',
createTime: '', createTime: '',
updaterId: '', updaterId: '',
updaterName: '', updaterName: '',
updateTime: '', updateTime: '',
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' } methods: {
], init(id) {
remark: [ this.dataForm.id = id || 0
{ required: true, message: '备注不能为空', trigger: 'blur' } this.visible = true
], this.$nextTick(() => {
valid: [ this.$refs['dataForm'].resetFields()
{ required: true, message: '删除标志,是否有效:1 可用 0不可用不能为空', trigger: 'blur' } if (this.dataForm.id) {
], this.$http({
creatorId: [ url: this.$http.adornUrl(`/monitoring/equipmenstatuslog/info/${this.dataForm.id}`),
{ required: true, message: '创建人不能为空', trigger: 'blur' } method: 'get',
], params: this.$http.adornParams()
creatorName: [ }).then(({ data }) => {
{ required: true, message: '创建人姓名不能为空', trigger: 'blur' } if (data && data.code === 0) {
], this.dataForm.externalCode = data.equipmenstatusLog.externalCode
createTime: [ this.dataForm.plcId = data.equipmenstatusLog.plcId
{ required: true, message: '创建时间不能为空', trigger: 'blur' } this.dataForm.plc = data.equipmenstatusLog.plc
], this.dataForm.equipmentId = data.equipmenstatusLog.equipmentId
updaterId: [ this.dataForm.equipmentName = data.equipmenstatusLog.equipmentName
{ required: true, message: '更新人不能为空', trigger: 'blur' } this.dataForm.status = data.equipmenstatusLog.status
], this.dataForm.logTime = data.equipmenstatusLog.logTime
updaterName: [ this.dataForm.remark = data.equipmenstatusLog.remark
{ required: true, message: '更新人姓名不能为空', trigger: 'blur' } this.dataForm.valid = data.equipmenstatusLog.valid
], this.dataForm.creatorId = data.equipmenstatusLog.creatorId
updateTime: [ this.dataForm.creatorName = data.equipmenstatusLog.creatorName
{ required: true, message: '更新时间不能为空', trigger: 'blur' } this.dataForm.createTime = data.equipmenstatusLog.createTime
], this.dataForm.updaterId = data.equipmenstatusLog.updaterId
version: [ this.dataForm.updaterName = data.equipmenstatusLog.updaterName
{ required: true, message: '版本号不能为空', trigger: 'blur' } this.dataForm.updateTime = data.equipmenstatusLog.updateTime
] this.dataForm.version = data.equipmenstatusLog.version
} }
} })
}, }
methods: { })
init (id) { },
this.dataForm.id = id || 0 //
this.visible = true dataFormSubmit() {
this.$nextTick(() => { this.$refs['dataForm'].validate(valid => {
this.$refs['dataForm'].resetFields() if (valid) {
if (this.dataForm.id) { this.$http({
this.$http({ url: this.$http.adornUrl(`/monitoring/equipmenstatuslog/${!this.dataForm.id ? 'save' : 'update'}`),
url: this.$http.adornUrl(`/monitoring/equipmenstatuslog/info/${this.dataForm.id}`), method: 'post',
method: 'get', data: this.$http.adornData({
params: this.$http.adornParams() id: this.dataForm.id || undefined,
}).then(({data}) => { externalCode: this.dataForm.externalCode,
if (data && data.code === 0) { plcId: this.dataForm.plcId,
this.dataForm.externalCode = data.equipmenstatusLog.externalCode plc: this.dataForm.plc,
this.dataForm.plcId = data.equipmenstatusLog.plcId equipmentId: this.dataForm.equipmentId,
this.dataForm.plc = data.equipmenstatusLog.plc equipmentName: this.dataForm.equipmentName,
this.dataForm.equipmentId = data.equipmenstatusLog.equipmentId status: this.dataForm.status,
this.dataForm.equipmentName = data.equipmenstatusLog.equipmentName logTime: this.dataForm.logTime,
this.dataForm.status = data.equipmenstatusLog.status remark: this.dataForm.remark,
this.dataForm.logTime = data.equipmenstatusLog.logTime valid: this.dataForm.valid,
this.dataForm.remark = data.equipmenstatusLog.remark creatorId: this.dataForm.creatorId,
this.dataForm.valid = data.equipmenstatusLog.valid creatorName: this.dataForm.creatorName,
this.dataForm.creatorId = data.equipmenstatusLog.creatorId createTime: this.dataForm.createTime,
this.dataForm.creatorName = data.equipmenstatusLog.creatorName updaterId: this.dataForm.updaterId,
this.dataForm.createTime = data.equipmenstatusLog.createTime updaterName: this.dataForm.updaterName,
this.dataForm.updaterId = data.equipmenstatusLog.updaterId updateTime: this.dataForm.updateTime,
this.dataForm.updaterName = data.equipmenstatusLog.updaterName version: this.dataForm.version
this.dataForm.updateTime = data.equipmenstatusLog.updateTime })
this.dataForm.version = data.equipmenstatusLog.version }).then(({ data }) => {
} if (data && data.code === 0) {
}) this.$message({
} message: '操作成功',
}) type: 'success',
}, duration: 1500,
// onClose: () => {
dataFormSubmit () { this.visible = false
this.$refs['dataForm'].validate((valid) => { this.$emit('refreshDataList')
if (valid) { }
this.$http({ })
url: this.$http.adornUrl(`/monitoring/equipmenstatuslog/${!this.dataForm.id ? 'save' : 'update'}`), } else {
method: 'post', this.$message.error(data.msg)
data: this.$http.adornData({ }
'id': this.dataForm.id || undefined, })
'externalCode': this.dataForm.externalCode, }
'plcId': this.dataForm.plcId, })
'plc': this.dataForm.plc, }
'equipmentId': this.dataForm.equipmentId, }
'equipmentName': this.dataForm.equipmentName, }
'status': this.dataForm.status,
'logTime': this.dataForm.logTime,
'remark': this.dataForm.remark,
'valid': this.dataForm.valid,
'creatorId': this.dataForm.creatorId,
'creatorName': this.dataForm.creatorName,
'createTime': this.dataForm.createTime,
'updaterId': this.dataForm.updaterId,
'updaterName': this.dataForm.updaterName,
'updateTime': this.dataForm.updateTime,
'version': this.dataForm.version
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script> </script>

View File

@ -1,314 +1,168 @@
<template> <template>
<div class="mod-config"> <div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()"> <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item> <el-form-item>
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input> <el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button @click="getDataList()">查询</el-button> <el-button @click="getDataList()">查询</el-button>
<el-button v-if="$hasPermission('monitoring:equipment:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button> <el-button v-if="$hasPermission('monitoring:equipment:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
<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> <el-table-column prop="dataType" header-align="center" align="center" label="0:无类别1:上片数据设备2:下片数据设备"> </el-table-column>
<el-table-column <el-table-column prop="tvalue" header-align="center" align="center" label="每小时生产数量"> </el-table-column>
prop="id" <el-table-column prop="processingTime" header-align="center" align="center" label="单件加工时间 s/件"> </el-table-column>
header-align="center" <el-table-column prop="manufacturer" header-align="center" align="center" label="制造商"> </el-table-column>
align="center" <el-table-column prop="spec" header-align="center" align="center" label="规格"> </el-table-column>
label="id"> <el-table-column prop="description" header-align="center" align="center" label="功能描述"> </el-table-column>
</el-table-column> <el-table-column prop="enabled" header-align="center" align="center" label="启用状态:0 、停用1、启用"> </el-table-column>
<el-table-column <el-table-column prop="remark" header-align="center" align="center" label="备注"> </el-table-column>
prop="code" <el-table-column prop="valid" header-align="center" align="center" label="删除标志,是否有效:1 可用 0不可用"> </el-table-column>
header-align="center" <el-table-column prop="creatorId" header-align="center" align="center" label="创建人"> </el-table-column>
align="center" <el-table-column prop="creatorName" header-align="center" align="center" label="创建人姓名"> </el-table-column>
label="编码"> <el-table-column prop="createTime" header-align="center" align="center" label="创建时间"> </el-table-column>
</el-table-column> <el-table-column prop="updaterId" header-align="center" align="center" label="更新人"> </el-table-column>
<el-table-column <el-table-column prop="updaterName" header-align="center" align="center" label="更新人姓名"> </el-table-column>
prop="name" <el-table-column prop="updateTime" header-align="center" align="center" label="更新时间"> </el-table-column>
header-align="center" <el-table-column prop="version" header-align="center" align="center" label="版本号"> </el-table-column>
align="center" <el-table-column prop="externalCode" header-align="center" align="center" label="外部系统代码"> </el-table-column>
label="设备名称"> <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="enName" <template slot-scope="scope">
header-align="center" <el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
align="center" <el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
label="英文名称"> </template>
</el-table-column> </el-table-column>
<el-table-column </el-table>
prop="abbr" <el-pagination
header-align="center" @size-change="sizeChangeHandle"
align="center" @current-change="currentChangeHandle"
label="缩写"> :current-page="pageIndex"
</el-table-column> :page-sizes="[10, 20, 50, 100]"
<el-table-column :page-size="pageSize"
prop="enterTime" :total="totalPage"
header-align="center" layout="total, sizes, prev, pager, next, jumper"
align="center" >
label="进厂日期"> </el-pagination>
</el-table-column> <!-- 弹窗, 新增 / 修改 -->
<el-table-column <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
prop="productionTime" </div>
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">
<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>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</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: ''
}, },
dataList: [], dataList: [],
pageIndex: 1, pageIndex: 1,
pageSize: 10, pageSize: 10,
totalPage: 0, totalPage: 0,
dataListLoading: false, dataListLoading: false,
dataListSelections: [], dataListSelections: [],
addOrUpdateVisible: false addOrUpdateVisible: false
} }
}, },
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
} else { } else {
this.dataList = [] this.dataList = []
this.totalPage = 0 this.totalPage = 0
} }
this.dataListLoading = false this.dataListLoading = false
}) })
}, },
// //
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
return item.id ? [id]
}) : this.dataListSelections.map(item => {
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', { return item.id
confirmButtonText: '确定', })
cancelButtonText: '取消', this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
type: 'warning' confirmButtonText: '确定',
}).then(() => { cancelButtonText: '取消',
this.$http({ type: 'warning'
url: this.$http.adornUrl('/monitoring/equipment/delete'), }).then(() => {
method: 'post', this.$http({
data: this.$http.adornData(ids, false) url: this.$http.adornUrl('/monitoring/equipment/delete'),
}).then(({data}) => { method: 'post',
if (data && data.code === 0) { data: this.$http.adornData(ids, false)
this.$message({ }).then(({ data }) => {
message: '操作成功', if (data && data.code === 0) {
type: 'success', this.$message({
duration: 1500, message: '操作成功',
onClose: () => { type: 'success',
this.getDataList() duration: 1500,
} onClose: () => {
}) this.getDataList()
} else { }
this.$message.error(data.msg) })
} } else {
}) this.$message.error(data.msg)
}) }
} })
} })
} }
}
}
</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

@ -1,225 +1,205 @@
<template> <template>
<el-dialog :visible.sync="visible" :title="$t('oss.config')" :close-on-click-modal="false" :close-on-press-escape="false"> <el-dialog :visible.sync="visible" :title="$t('oss.config')" :close-on-click-modal="false" :close-on-press-escape="false">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()" label-width="120px"> <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()" label-width="120px">
<el-form-item :label="$t('oss.type')" size="mini"> <el-form-item :label="$t('oss.type')" size="mini">
<el-radio-group v-model="dataForm.type"> <el-radio-group v-model="dataForm.type">
<el-radio :label="1">{{ $t('oss.type1') }}</el-radio> <el-radio :label="1">{{ $t('oss.type1') }}</el-radio>
<el-radio :label="2">{{ $t('oss.type2') }}</el-radio> <el-radio :label="2">{{ $t('oss.type2') }}</el-radio>
<el-radio :label="3">{{ $t('oss.type3') }}</el-radio> <el-radio :label="3">{{ $t('oss.type3') }}</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<template v-if="dataForm.type === 1"> <template v-if="dataForm.type === 1">
<el-form-item size="mini"> <el-form-item size="mini">
<a href="https://s.qiniu.com/7Rfaym" target="_blank">免费申请(七牛)10GB储存空间</a> <a href="https://s.qiniu.com/7Rfaym" target="_blank">免费申请(七牛)10GB储存空间</a>
</el-form-item> </el-form-item>
<el-form-item prop="qiniuDomain" :label="$t('oss.qiniuDomain')"> <el-form-item prop="qiniuDomain" :label="$t('oss.qiniuDomain')">
<el-input v-model="dataForm.qiniuDomain" :placeholder="$t('oss.qiniuDomainTips')"></el-input> <el-input v-model="dataForm.qiniuDomain" :placeholder="$t('oss.qiniuDomainTips')"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="qiniuPrefix" :label="$t('oss.qiniuPrefix')"> <el-form-item prop="qiniuPrefix" :label="$t('oss.qiniuPrefix')">
<el-input v-model="dataForm.qiniuPrefix" :placeholder="$t('oss.qiniuPrefixTips')"></el-input> <el-input v-model="dataForm.qiniuPrefix" :placeholder="$t('oss.qiniuPrefixTips')"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="qiniuAccessKey" :label="$t('oss.qiniuAccessKey')"> <el-form-item prop="qiniuAccessKey" :label="$t('oss.qiniuAccessKey')">
<el-input v-model="dataForm.qiniuAccessKey" :placeholder="$t('oss.qiniuAccessKeyTips')"></el-input> <el-input v-model="dataForm.qiniuAccessKey" :placeholder="$t('oss.qiniuAccessKeyTips')"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="qiniuSecretKey" :label="$t('oss.qiniuSecretKey')"> <el-form-item prop="qiniuSecretKey" :label="$t('oss.qiniuSecretKey')">
<el-input v-model="dataForm.qiniuSecretKey" :placeholder="$t('oss.qiniuSecretKeyTips')"></el-input> <el-input v-model="dataForm.qiniuSecretKey" :placeholder="$t('oss.qiniuSecretKeyTips')"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="qiniuBucketName" :label="$t('oss.qiniuBucketName')"> <el-form-item prop="qiniuBucketName" :label="$t('oss.qiniuBucketName')">
<el-input v-model="dataForm.qiniuBucketName" :placeholder="$t('oss.qiniuBucketNameTips')"></el-input> <el-input v-model="dataForm.qiniuBucketName" :placeholder="$t('oss.qiniuBucketNameTips')"></el-input>
</el-form-item> </el-form-item>
</template> </template>
<template v-else-if="dataForm.type === 2"> <template v-else-if="dataForm.type === 2">
<el-form-item size="mini"> <el-form-item size="mini">
<a href="https://www.aliyun.com/minisite/goods?userCode=y93lfwbg" target="_blank">免费领取阿里云优惠券</a> <a href="https://www.aliyun.com/minisite/goods?userCode=y93lfwbg" target="_blank">免费领取阿里云优惠券</a>
</el-form-item> </el-form-item>
<el-form-item prop="aliyunDomain" :label="$t('oss.aliyunDomain')"> <el-form-item prop="aliyunDomain" :label="$t('oss.aliyunDomain')">
<el-input v-model="dataForm.aliyunDomain" :placeholder="$t('oss.aliyunDomainTips')"></el-input> <el-input v-model="dataForm.aliyunDomain" :placeholder="$t('oss.aliyunDomainTips')"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="aliyunPrefix" :label="$t('oss.aliyunPrefix')"> <el-form-item prop="aliyunPrefix" :label="$t('oss.aliyunPrefix')">
<el-input v-model="dataForm.aliyunPrefix" :placeholder="$t('oss.aliyunPrefixTips')"></el-input> <el-input v-model="dataForm.aliyunPrefix" :placeholder="$t('oss.aliyunPrefixTips')"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="aliyunEndPoint" :label="$t('oss.aliyunEndPoint')"> <el-form-item prop="aliyunEndPoint" :label="$t('oss.aliyunEndPoint')">
<el-input v-model="dataForm.aliyunEndPoint" :placeholder="$t('oss.aliyunEndPointTips')"></el-input> <el-input v-model="dataForm.aliyunEndPoint" :placeholder="$t('oss.aliyunEndPointTips')"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="aliyunAccessKeyId" :label="$t('oss.aliyunAccessKeyId')"> <el-form-item prop="aliyunAccessKeyId" :label="$t('oss.aliyunAccessKeyId')">
<el-input v-model="dataForm.aliyunAccessKeyId" :placeholder="$t('oss.aliyunAccessKeyIdTips')"></el-input> <el-input v-model="dataForm.aliyunAccessKeyId" :placeholder="$t('oss.aliyunAccessKeyIdTips')"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="aliyunAccessKeySecret" :label="$t('oss.aliyunAccessKeySecret')"> <el-form-item prop="aliyunAccessKeySecret" :label="$t('oss.aliyunAccessKeySecret')">
<el-input v-model="dataForm.aliyunAccessKeySecret" :placeholder="$t('oss.aliyunAccessKeySecretTips')"></el-input> <el-input v-model="dataForm.aliyunAccessKeySecret" :placeholder="$t('oss.aliyunAccessKeySecretTips')"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="aliyunBucketName" :label="$t('oss.aliyunBucketName')"> <el-form-item prop="aliyunBucketName" :label="$t('oss.aliyunBucketName')">
<el-input v-model="dataForm.aliyunBucketName" :placeholder="$t('oss.aliyunBucketNameTips')"></el-input> <el-input v-model="dataForm.aliyunBucketName" :placeholder="$t('oss.aliyunBucketNameTips')"></el-input>
</el-form-item> </el-form-item>
</template> </template>
<template v-else-if="dataForm.type === 3"> <template v-else-if="dataForm.type === 3">
<el-form-item size="mini"> <el-form-item size="mini">
<a href="https://curl.qcloud.com/zt3xdYbZ" target="_blank">免费领取腾讯云优惠券</a> <a href="https://curl.qcloud.com/zt3xdYbZ" target="_blank">免费领取腾讯云优惠券</a>
</el-form-item> </el-form-item>
<el-form-item prop="qcloudDomain" :label="$t('oss.qcloudDomain')"> <el-form-item prop="qcloudDomain" :label="$t('oss.qcloudDomain')">
<el-input v-model="dataForm.qcloudDomain" :placeholder="$t('oss.qcloudDomainTips')"></el-input> <el-input v-model="dataForm.qcloudDomain" :placeholder="$t('oss.qcloudDomainTips')"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="qcloudPrefix" :label="$t('oss.qcloudPrefix')"> <el-form-item prop="qcloudPrefix" :label="$t('oss.qcloudPrefix')">
<el-input v-model="dataForm.qcloudPrefix" :placeholder="$t('oss.qcloudPrefixTips')"></el-input> <el-input v-model="dataForm.qcloudPrefix" :placeholder="$t('oss.qcloudPrefixTips')"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="qcloudAppId" :label="$t('oss.qcloudAppId')"> <el-form-item prop="qcloudAppId" :label="$t('oss.qcloudAppId')">
<el-input v-model="dataForm.qcloudAppId" :placeholder="$t('oss.qcloudAppIdTips')"></el-input> <el-input v-model="dataForm.qcloudAppId" :placeholder="$t('oss.qcloudAppIdTips')"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="qcloudSecretId" :label="$t('oss.qcloudSecretId')"> <el-form-item prop="qcloudSecretId" :label="$t('oss.qcloudSecretId')">
<el-input v-model="dataForm.qcloudSecretId" :placeholder="$t('oss.qcloudSecretIdTips')"></el-input> <el-input v-model="dataForm.qcloudSecretId" :placeholder="$t('oss.qcloudSecretIdTips')"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="qcloudSecretKey" :label="$t('oss.qcloudSecretKey')"> <el-form-item prop="qcloudSecretKey" :label="$t('oss.qcloudSecretKey')">
<el-input v-model="dataForm.qcloudSecretKey" :placeholder="$t('oss.qcloudSecretKeyTips')"></el-input> <el-input v-model="dataForm.qcloudSecretKey" :placeholder="$t('oss.qcloudSecretKeyTips')"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="qcloudBucketName" :label="$t('oss.qcloudBucketName')"> <el-form-item prop="qcloudBucketName" :label="$t('oss.qcloudBucketName')">
<el-input v-model="dataForm.qcloudBucketName" :placeholder="$t('oss.qcloudBucketNameTips')"></el-input> <el-input v-model="dataForm.qcloudBucketName" :placeholder="$t('oss.qcloudBucketNameTips')"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="qcloudRegion" :label="$t('oss.qcloudRegion')"> <el-form-item prop="qcloudRegion" :label="$t('oss.qcloudRegion')">
<el-select v-model="dataForm.qcloudRegion" clearable :placeholder="$t('oss.qcloudRegionTips')" class="w-percent-100"> <el-select v-model="dataForm.qcloudRegion" clearable :placeholder="$t('oss.qcloudRegionTips')" class="w-percent-100">
<el-option value="ap-beijing-1" :label="$t('oss.qcloudRegionBeijing1')"></el-option> <el-option value="ap-beijing-1" :label="$t('oss.qcloudRegionBeijing1')"></el-option>
<el-option value="ap-beijing" :label="$t('oss.qcloudRegionBeijing')"></el-option> <el-option value="ap-beijing" :label="$t('oss.qcloudRegionBeijing')"></el-option>
<el-option value="ap-shanghai" :label="$t('oss.qcloudRegionShanghai')"></el-option> <el-option value="ap-shanghai" :label="$t('oss.qcloudRegionShanghai')"></el-option>
<el-option value="ap-guangzhou" :label="$t('oss.qcloudRegionGuangzhou')"></el-option> <el-option value="ap-guangzhou" :label="$t('oss.qcloudRegionGuangzhou')"></el-option>
<el-option value="ap-chengdu" :label="$t('oss.qcloudRegionChengdu')"></el-option> <el-option value="ap-chengdu" :label="$t('oss.qcloudRegionChengdu')"></el-option>
<el-option value="ap-chongqing" :label="$t('oss.qcloudRegionChongqing')"></el-option> <el-option value="ap-chongqing" :label="$t('oss.qcloudRegionChongqing')"></el-option>
<el-option value="ap-singapore" :label="$t('oss.qcloudRegionSingapore')"></el-option> <el-option value="ap-singapore" :label="$t('oss.qcloudRegionSingapore')"></el-option>
<el-option value="ap-hongkong" :label="$t('oss.qcloudRegionHongkong')"></el-option> <el-option value="ap-hongkong" :label="$t('oss.qcloudRegionHongkong')"></el-option>
<el-option value="na-toronto" :label="$t('oss.qcloudRegionToronto')"></el-option> <el-option value="na-toronto" :label="$t('oss.qcloudRegionToronto')"></el-option>
<el-option value="eu-frankfurt" :label="$t('oss.qcloudRegionFrankfurt')"></el-option> <el-option value="eu-frankfurt" :label="$t('oss.qcloudRegionFrankfurt')"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</template> </template>
</el-form> </el-form>
<template slot="footer"> <template slot="footer">
<el-button @click="visible = false">{{ $t('cancel') }}</el-button> <el-button @click="visible = false">{{ $t('cancel') }}</el-button>
<el-button type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button> <el-button type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button>
</template> </template>
</el-dialog> </el-dialog>
</template> </template>
<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: {
type: 0, type: 0,
qiniuDomain: '', qiniuDomain: '',
qiniuPrefix: '', qiniuPrefix: '',
qiniuAccessKey: '', qiniuAccessKey: '',
qiniuSecretKey: '', qiniuSecretKey: '',
qiniuBucketName: '', qiniuBucketName: '',
aliyunDomain: '', aliyunDomain: '',
aliyunPrefix: '', aliyunPrefix: '',
aliyunEndPoint: '', aliyunEndPoint: '',
aliyunAccessKeyId: '', aliyunAccessKeyId: '',
aliyunAccessKeySecret: '', aliyunAccessKeySecret: '',
aliyunBucketName: '', aliyunBucketName: '',
qcloudDomain: '', qcloudDomain: '',
qcloudPrefix: '', qcloudPrefix: '',
qcloudAppId: 0, qcloudAppId: 0,
qcloudSecretId: '', qcloudSecretId: '',
qcloudSecretKey: '', qcloudSecretKey: '',
qcloudBucketName: '', qcloudBucketName: '',
qcloudRegion: '' qcloudRegion: ''
} }
} }
}, },
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: [ watch: {
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } 'dataForm.type'(val) {
], this.$refs['dataForm'].clearValidate()
aliyunAccessKeySecret: [ }
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } },
], methods: {
aliyunBucketName: [ init() {
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } this.visible = true
], this.$nextTick(() => {
qcloudDomain: [ this.$refs['dataForm'].resetFields()
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } this.getInfo()
], })
qcloudAppId: [ },
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } //
], getInfo() {
qcloudSecretId: [ this.$http
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } .get(this.$http.adornUrl('/sys/oss/info'))
], .then(({ data: res }) => {
qcloudSecretKey: [ if (res.code !== 0) {
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } return this.$message.error(res.msg)
], }
qcloudBucketName: [ this.dataForm = res.data
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } })
], .catch(() => {})
qcloudRegion: [ },
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } //
] dataFormSubmitHandle: debounce(
} function() {
} this.$refs['dataForm'].validate(valid => {
}, if (!valid) {
watch: { return false
'dataForm.type' (val) { }
this.$refs['dataForm'].clearValidate() this.$http
} .post(this.$http.adornUrl('/sys/oss'), this.dataForm)
}, .then(({ data: res }) => {
methods: { if (res.code !== 0) {
init () { return this.$message.error(res.msg)
this.visible = true }
this.$nextTick(() => { this.$message({
this.$refs['dataForm'].resetFields() message: this.$t('prompt.success'),
this.getInfo() type: 'success',
}) duration: 500,
}, onClose: () => {
// this.visible = false
getInfo () { this.$emit('refreshDataList')
this.$http.get('/sys/oss/info').then(({ data: res }) => { }
if (res.code !== 0) { })
return this.$message.error(res.msg) })
} .catch(() => {})
this.dataForm = res.data })
}).catch(() => {}) },
}, 1000,
// { leading: true, trailing: false }
dataFormSubmitHandle: debounce(function () { )
this.$refs['dataForm'].validate((valid) => { }
if (!valid) {
return false
}
this.$http.post('/sys/oss', this.dataForm).then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.$message({
message: this.$t('prompt.success'),
type: 'success',
duration: 500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
}).catch(() => {})
})
}, 1000, { 'leading': true, 'trailing': false })
}
} }
</script> </script>

View File

@ -1,154 +1,164 @@
<template> <template>
<el-dialog :visible.sync="visible" :title="!dataForm.id ? $t('add') : $t('update')" :close-on-click-modal="false" :close-on-press-escape="false"> <el-dialog :visible.sync="visible" :title="!dataForm.id ? $t('add') : $t('update')" :close-on-click-modal="false" :close-on-press-escape="false">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()" label-width="120px"> <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()" label-width="120px">
<el-form-item prop="name" :label="$t('dept.name')"> <el-form-item prop="name" :label="$t('dept.name')">
<el-input v-model="dataForm.name" :placeholder="$t('dept.name')"></el-input> <el-input v-model="dataForm.name" :placeholder="$t('dept.name')"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="parentName" :label="$t('dept.parentName')" class="dept-list"> <el-form-item prop="parentName" :label="$t('dept.parentName')" class="dept-list">
<el-popover v-model="deptListVisible" ref="deptListPopover" placement="bottom-start" trigger="click"> <el-popover v-model="deptListVisible" ref="deptListPopover" placement="bottom-start" trigger="click">
<el-tree <el-tree
:data="deptList" :data="deptList"
:props="{ label: 'name', children: 'children' }" :props="{ label: 'name', children: 'children' }"
node-key="id" node-key="id"
ref="deptListTree" ref="deptListTree"
: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-popover> </el-tree>
<el-input v-model="dataForm.parentName" v-popover:deptListPopover :readonly="true" :placeholder="$t('dept.parentName')"> </el-popover>
<i <el-input v-model="dataForm.parentName" v-popover:deptListPopover :readonly="true" :placeholder="$t('dept.parentName')">
v-if="$store.state.user.superAdmin === 1 && dataForm.pid !== '0'" <i
slot="suffix" v-if="$store.state.user.superAdmin === 1 && dataForm.pid !== '0'"
@click.stop="deptListTreeSetDefaultHandle()" slot="suffix"
class="el-icon-circle-close el-input__icon"> @click.stop="deptListTreeSetDefaultHandle()"
</i> class="el-icon-circle-close el-input__icon"
</el-input> >
</el-form-item> </i>
<el-form-item prop="sort" :label="$t('dept.sort')"> </el-input>
<el-input-number v-model="dataForm.sort" controls-position="right" :min="0" :label="$t('dept.sort')"></el-input-number> </el-form-item>
</el-form-item> <el-form-item prop="sort" :label="$t('dept.sort')">
</el-form> <el-input-number v-model="dataForm.sort" controls-position="right" :min="0" :label="$t('dept.sort')"></el-input-number>
<template slot="footer"> </el-form-item>
<el-button @click="visible = false">{{ $t('cancel') }}</el-button> </el-form>
<el-button type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button> <template slot="footer">
</template> <el-button @click="visible = false">{{ $t('cancel') }}</el-button>
</el-dialog> <el-button type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button>
</template>
</el-dialog>
</template> </template>
<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: [],
deptListVisible: false, deptListVisible: false,
dataForm: { dataForm: {
id: '', id: '',
name: '', name: '',
pid: '', pid: '',
parentName: '', parentName: '',
sort: 0 sort: 0
} }
} }
}, },
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: {
} init() {
} this.visible = true
}, this.$nextTick(() => {
methods: { this.$refs['dataForm'].resetFields()
init () { this.getDeptList().then(() => {
this.visible = true if (this.dataForm.id) {
this.$nextTick(() => { this.getInfo()
this.$refs['dataForm'].resetFields() } else if (this.$store.state.user.superAdmin === 1) {
this.getDeptList().then(() => { this.deptListTreeSetDefaultHandle()
if (this.dataForm.id) { }
this.getInfo() })
} else if (this.$store.state.user.superAdmin === 1) { })
this.deptListTreeSetDefaultHandle() },
} //
}) getDeptList() {
}) return this.$http
}, .get(this.$http.adornUrl('/sys/dept/list'))
// .then(({ data: res }) => {
getDeptList () { if (res.code !== 0) {
return this.$http.get('/sys/dept/list').then(({ data: res }) => { return this.$message.error(res.msg)
if (res.code !== 0) { }
return this.$message.error(res.msg) this.deptList = res.data
} })
this.deptList = res.data .catch(() => {})
}).catch(() => {}) },
}, //
// getInfo() {
getInfo () { this.$http
this.$http.get(`/sys/dept/${this.dataForm.id}`).then(({ data: res }) => { .get(this.$http.adornUrl(`/sys/dept/${this.dataForm.id}`))
if (res.code !== 0) { .then(({ data: res }) => {
return this.$message.error(res.msg) if (res.code !== 0) {
} return this.$message.error(res.msg)
this.dataForm = { }
...this.dataForm, this.dataForm = {
...res.data ...this.dataForm,
} ...res.data
if (this.dataForm.pid === '0') { }
return this.deptListTreeSetDefaultHandle() if (this.dataForm.pid === '0') {
} return this.deptListTreeSetDefaultHandle()
this.$refs.deptListTree.setCurrentKey(this.dataForm.pid) }
}).catch(() => {}) this.$refs.deptListTree.setCurrentKey(this.dataForm.pid)
}, })
// , .catch(() => {})
deptListTreeSetDefaultHandle () { },
this.dataForm.pid = '0' // ,
this.dataForm.parentName = this.$t('dept.parentNameDefault') deptListTreeSetDefaultHandle() {
}, this.dataForm.pid = '0'
// , this.dataForm.parentName = this.$t('dept.parentNameDefault')
deptListTreeCurrentChangeHandle (data) { },
this.dataForm.pid = data.id // ,
this.dataForm.parentName = data.name deptListTreeCurrentChangeHandle(data) {
this.deptListVisible = false this.dataForm.pid = data.id
}, this.dataForm.parentName = data.name
// this.deptListVisible = false
dataFormSubmitHandle: debounce(function () { },
this.$refs['dataForm'].validate((valid) => { //
if (!valid) { dataFormSubmitHandle: debounce(
return false function() {
} this.$refs['dataForm'].validate(valid => {
this.$http[!this.dataForm.id ? 'post' : 'put']('/sys/dept', this.dataForm).then(({ data: res }) => { if (!valid) {
if (res.code !== 0) { return false
return this.$message.error(res.msg) }
} this.$http[!this.dataForm.id ? 'post' : 'put']('/sys/dept', this.dataForm)
this.$message({ .then(({ data: res }) => {
message: this.$t('prompt.success'), if (res.code !== 0) {
type: 'success', return this.$message.error(res.msg)
duration: 500, }
onClose: () => { this.$message({
this.visible = false message: this.$t('prompt.success'),
this.$emit('refreshDataList') type: 'success',
} duration: 500,
}) onClose: () => {
}).catch(() => {}) this.visible = false
}) this.$emit('refreshDataList')
}, 1000, { 'leading': true, 'trailing': false }) }
} })
})
.catch(() => {})
})
},
1000,
{ leading: true, trailing: false }
)
}
} }
</script> </script>
<style lang="scss"> <style lang="scss">
.mod-sys__dept { .mod-sys__dept {
.dept-list { .dept-list {
.el-input__inner, .el-input__inner,
.el-input__suffix { .el-input__suffix {
cursor: pointer; cursor: pointer;
} }
} }
} }
</style> </style>

View File

@ -1,101 +1,104 @@
<template> <template>
<el-dialog :visible.sync="visible" :title="!dataForm.id ? $t('add') : $t('update')" :close-on-click-modal="false" :close-on-press-escape="false"> <el-dialog :visible.sync="visible" :title="!dataForm.id ? $t('add') : $t('update')" :close-on-click-modal="false" :close-on-press-escape="false">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()" label-width="120px"> <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()" label-width="120px">
<el-form-item prop="dictValue" :label="$t('dict.dictValue')"> <el-form-item prop="dictValue" :label="$t('dict.dictValue')">
<el-input v-model="dataForm.dictValue" :placeholder="$t('dict.dictValue')"></el-input> <el-input v-model="dataForm.dictValue" :placeholder="$t('dict.dictValue')"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="dictLabel" :label="$t('dict.dictLabel')"> <el-form-item prop="dictLabel" :label="$t('dict.dictLabel')">
<el-input v-model="dataForm.dictLabel" :placeholder="$t('dict.dictLabel')"></el-input> <el-input v-model="dataForm.dictLabel" :placeholder="$t('dict.dictLabel')"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="sort" :label="$t('dict.sort')"> <el-form-item prop="sort" :label="$t('dict.sort')">
<el-input-number v-model="dataForm.sort" controls-position="right" :min="0" :label="$t('dict.sort')"></el-input-number> <el-input-number v-model="dataForm.sort" controls-position="right" :min="0" :label="$t('dict.sort')"></el-input-number>
</el-form-item> </el-form-item>
<el-form-item prop="remark" :label="$t('dict.remark')"> <el-form-item prop="remark" :label="$t('dict.remark')">
<el-input v-model="dataForm.remark" :placeholder="$t('dict.remark')"></el-input> <el-input v-model="dataForm.remark" :placeholder="$t('dict.remark')"></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<template slot="footer"> <template slot="footer">
<el-button @click="visible = false">{{ $t('cancel') }}</el-button> <el-button @click="visible = false">{{ $t('cancel') }}</el-button>
<el-button type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button> <el-button type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button>
</template> </template>
</el-dialog> </el-dialog>
</template> </template>
<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: {
id: '', id: '',
dictTypeId: '', dictTypeId: '',
dictLabel: '', dictLabel: '',
dictValue: '', dictValue: '',
sort: 0, sort: 0,
remark: '' remark: ''
} }
} }
}, },
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: [ methods: {
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } init() {
] this.visible = true
} this.$nextTick(() => {
} this.$refs['dataForm'].resetFields()
}, if (this.dataForm.id) {
methods: { this.getInfo()
init () { }
this.visible = true })
this.$nextTick(() => { },
this.$refs['dataForm'].resetFields() //
if (this.dataForm.id) { getInfo() {
this.getInfo() this.$http
} .get(this.$http.adornUrl(`/sys/dict/data/${this.dataForm.id}`))
}) .then(({ data: res }) => {
}, if (res.code !== 0) {
// return this.$message.error(res.msg)
getInfo () { }
this.$http.get(`/sys/dict/data/${this.dataForm.id}`).then(({ data: res }) => { this.dataForm = {
if (res.code !== 0) { ...this.dataForm,
return this.$message.error(res.msg) ...res.data
} }
this.dataForm = { })
...this.dataForm, .catch(() => {})
...res.data },
} //
}).catch(() => {}) dataFormSubmitHandle: debounce(
}, function() {
// this.$refs['dataForm'].validate(valid => {
dataFormSubmitHandle: debounce(function () { if (!valid) {
this.$refs['dataForm'].validate((valid) => { return false
if (!valid) { }
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) }
} this.$message({
this.$message({ message: this.$t('prompt.success'),
message: this.$t('prompt.success'), type: 'success',
type: 'success', duration: 500,
duration: 500, onClose: () => {
onClose: () => { this.visible = false
this.visible = false this.$emit('refreshDataList')
this.$emit('refreshDataList') }
} })
}) })
}).catch(() => {}) .catch(() => {})
}) })
}, 1000, { 'leading': true, 'trailing': false }) },
} 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

@ -1,221 +1,226 @@
<template> <template>
<el-dialog :visible.sync="visible" :title="!dataForm.id ? $t('add') : $t('update')" :close-on-click-modal="false" :close-on-press-escape="false"> <el-dialog :visible.sync="visible" :title="!dataForm.id ? $t('add') : $t('update')" :close-on-click-modal="false" :close-on-press-escape="false">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()" label-width="120px"> <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()" label-width="120px">
<el-form-item prop="type" :label="$t('menu.type')" size="mini"> <el-form-item prop="type" :label="$t('menu.type')" size="mini">
<el-radio-group v-model="dataForm.type" :disabled="!!dataForm.id"> <el-radio-group v-model="dataForm.type" :disabled="!!dataForm.id">
<el-radio :label="0">{{ $t('menu.type0') }}</el-radio> <el-radio :label="0">{{ $t('menu.type0') }}</el-radio>
<el-radio :label="1">{{ $t('menu.type1') }}</el-radio> <el-radio :label="1">{{ $t('menu.type1') }}</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item prop="name" :label="$t('menu.name')"> <el-form-item prop="name" :label="$t('menu.name')">
<el-input v-model="dataForm.name" :placeholder="$t('menu.name')"></el-input> <el-input v-model="dataForm.name" :placeholder="$t('menu.name')"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="parentName" :label="$t('menu.parentName')" class="menu-list"> <el-form-item prop="parentName" :label="$t('menu.parentName')" class="menu-list">
<el-popover v-model="menuListVisible" ref="menuListPopover" placement="bottom-start" trigger="click"> <el-popover v-model="menuListVisible" ref="menuListPopover" placement="bottom-start" trigger="click">
<el-tree <el-tree
:data="menuList" :data="menuList"
:props="{ label: 'name', children: 'children' }" :props="{ label: 'name', children: 'children' }"
node-key="id" node-key="id"
ref="menuListTree" ref="menuListTree"
: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-popover> </el-tree>
<el-input v-model="dataForm.parentName" v-popover:menuListPopover :readonly="true" :placeholder="$t('menu.parentName')"> </el-popover>
<i v-if="dataForm.pid !== '0'" slot="suffix" @click.stop="deptListTreeSetDefaultHandle()" class="el-icon-circle-close el-input__icon"></i> <el-input v-model="dataForm.parentName" v-popover:menuListPopover :readonly="true" :placeholder="$t('menu.parentName')">
</el-input> <i v-if="dataForm.pid !== '0'" slot="suffix" @click.stop="deptListTreeSetDefaultHandle()" class="el-icon-circle-close el-input__icon"></i>
</el-form-item> </el-input>
<el-form-item v-if="dataForm.type === 0" prop="url" :label="$t('menu.url')"> </el-form-item>
<el-input v-model="dataForm.url" :placeholder="$t('menu.url')"></el-input> <el-form-item v-if="dataForm.type === 0" prop="url" :label="$t('menu.url')">
</el-form-item> <el-input v-model="dataForm.url" :placeholder="$t('menu.url')"></el-input>
<el-form-item prop="sort" :label="$t('menu.sort')"> </el-form-item>
<el-input-number v-model="dataForm.sort" controls-position="right" :min="0" :label="$t('menu.sort')"></el-input-number> <el-form-item prop="sort" :label="$t('menu.sort')">
</el-form-item> <el-input-number v-model="dataForm.sort" controls-position="right" :min="0" :label="$t('menu.sort')"></el-input-number>
<el-form-item prop="permissions" :label="$t('menu.permissions')"> </el-form-item>
<el-input v-model="dataForm.permissions" :placeholder="$t('menu.permissionsTips')"></el-input> <el-form-item prop="permissions" :label="$t('menu.permissions')">
</el-form-item> <el-input v-model="dataForm.permissions" :placeholder="$t('menu.permissionsTips')"></el-input>
<el-form-item v-if="dataForm.type === 0" prop="icon" :label="$t('menu.icon')" class="icon-list"> </el-form-item>
<el-popover v-model="iconListVisible" ref="iconListPopover" placement="bottom-start" trigger="click" popper-class="mod-sys__menu-icon-popover"> <el-form-item v-if="dataForm.type === 0" prop="icon" :label="$t('menu.icon')" class="icon-list">
<div class="mod-sys__menu-icon-inner"> <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-list"> <div class="mod-sys__menu-icon-inner">
<el-button <div class="mod-sys__menu-icon-list">
v-for="(item, index) in iconList" <el-button v-for="(item, index) in iconList" :key="index" @click="iconListCurrentChangeHandle(item)" :class="{ 'is-active': dataForm.icon === item }">
:key="index" <svg class="icon-svg" aria-hidden="true"><use :xlink:href="`#${item}`"></use></svg>
@click="iconListCurrentChangeHandle(item)" </el-button>
:class="{ 'is-active': dataForm.icon === item }"> </div>
<svg class="icon-svg" aria-hidden="true"><use :xlink:href="`#${item}`"></use></svg> </div>
</el-button> </el-popover>
</div> <el-input v-model="dataForm.icon" v-popover:iconListPopover :readonly="true" :placeholder="$t('menu.icon')"></el-input>
</div> </el-form-item>
</el-popover> </el-form>
<el-input v-model="dataForm.icon" v-popover:iconListPopover :readonly="true" :placeholder="$t('menu.icon')"></el-input> <template slot="footer">
</el-form-item> <el-button @click="visible = false">{{ $t('cancel') }}</el-button>
</el-form> <el-button type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button>
<template slot="footer"> </template>
<el-button @click="visible = false">{{ $t('cancel') }}</el-button> </el-dialog>
<el-button type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button>
</template>
</el-dialog>
</template> </template>
<script> <script>
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: [],
menuListVisible: false, menuListVisible: false,
iconList: [], iconList: [],
iconListVisible: false, iconListVisible: false,
dataForm: { dataForm: {
id: '', id: '',
type: 0, type: 0,
name: '', name: '',
pid: '0', pid: '0',
parentName: '', parentName: '',
url: '', url: '',
permissions: '', permissions: '',
sort: 0, sort: 0,
icon: '' icon: ''
} }
} }
}, },
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: {
} 'dataForm.type'(val) {
} this.$refs['dataForm'].clearValidate()
}, }
watch: { },
'dataForm.type' (val) { methods: {
this.$refs['dataForm'].clearValidate() init() {
} this.visible = true
}, this.$nextTick(() => {
methods: { this.$refs['dataForm'].resetFields()
init () { this.iconList = getIconList()
this.visible = true this.dataForm.parentName = this.$t('menu.parentNameDefault')
this.$nextTick(() => { this.getMenuList().then(() => {
this.$refs['dataForm'].resetFields() if (this.dataForm.id) {
this.iconList = getIconList() this.getInfo()
this.dataForm.parentName = this.$t('menu.parentNameDefault') }
this.getMenuList().then(() => { })
if (this.dataForm.id) { })
this.getInfo() },
} //
}) getMenuList() {
}) return this.$http
}, .get(this.$http.adornUrl('/sys/menu/list?type=0'))
// .then(({ data: res }) => {
getMenuList () { if (res.code !== 0) {
return this.$http.get('/sys/menu/list?type=0').then(({ data: res }) => { return this.$message.error(res.msg)
if (res.code !== 0) { }
return this.$message.error(res.msg) this.menuList = res.data
} })
this.menuList = res.data .catch(() => {})
}).catch(() => {}) },
}, //
// getInfo() {
getInfo () { this.$http
this.$http.get(`/sys/menu/${this.dataForm.id}`).then(({ data: res }) => { .get(this.$http.adornUrl(`/sys/menu/${this.dataForm.id}`))
if (res.code !== 0) { .then(({ data: res }) => {
return this.$message.error(res.msg) if (res.code !== 0) {
} return this.$message.error(res.msg)
this.dataForm = { }
...this.dataForm, this.dataForm = {
...res.data ...this.dataForm,
} ...res.data
if (this.dataForm.pid === '0') { }
return this.deptListTreeSetDefaultHandle() if (this.dataForm.pid === '0') {
} return this.deptListTreeSetDefaultHandle()
this.$refs.menuListTree.setCurrentKey(this.dataForm.pid) }
}).catch(() => {}) this.$refs.menuListTree.setCurrentKey(this.dataForm.pid)
}, })
// , .catch(() => {})
deptListTreeSetDefaultHandle () { },
this.dataForm.pid = '0' // ,
this.dataForm.parentName = this.$t('menu.parentNameDefault') deptListTreeSetDefaultHandle() {
}, this.dataForm.pid = '0'
// , this.dataForm.parentName = this.$t('menu.parentNameDefault')
menuListTreeCurrentChangeHandle (data) { },
this.dataForm.pid = data.id // ,
this.dataForm.parentName = data.name menuListTreeCurrentChangeHandle(data) {
this.menuListVisible = false this.dataForm.pid = data.id
}, this.dataForm.parentName = data.name
// , this.menuListVisible = false
iconListCurrentChangeHandle (icon) { },
this.dataForm.icon = icon // ,
this.iconListVisible = false iconListCurrentChangeHandle(icon) {
}, this.dataForm.icon = icon
// this.iconListVisible = false
dataFormSubmitHandle: debounce(function () { },
this.$refs['dataForm'].validate((valid) => { //
if (!valid) { dataFormSubmitHandle: debounce(
return false function() {
} this.$refs['dataForm'].validate(valid => {
this.$http[!this.dataForm.id ? 'post' : 'put']('/sys/menu', this.dataForm).then(({ data: res }) => { if (!valid) {
if (res.code !== 0) { return false
return this.$message.error(res.msg) }
} this.$http[!this.dataForm.id ? 'post' : 'put']('/sys/menu', this.dataForm)
this.$message({ .then(({ data: res }) => {
message: this.$t('prompt.success'), if (res.code !== 0) {
type: 'success', return this.$message.error(res.msg)
duration: 500, }
onClose: () => { this.$message({
this.visible = false message: this.$t('prompt.success'),
this.$emit('refreshDataList') type: 'success',
} duration: 500,
}) onClose: () => {
}).catch(() => {}) this.visible = false
}) this.$emit('refreshDataList')
}, 1000, { 'leading': true, 'trailing': false }) }
} })
})
.catch(() => {})
})
},
1000,
{ leading: true, trailing: false }
)
}
} }
</script> </script>
<style lang="scss"> <style lang="scss">
.mod-sys__menu { .mod-sys__menu {
.menu-list, .menu-list,
.icon-list { .icon-list {
.el-input__inner, .el-input__inner,
.el-input__suffix { .el-input__suffix {
cursor: pointer; cursor: pointer;
} }
} }
&-icon-popover { &-icon-popover {
width: 458px; width: 458px;
overflow: hidden; overflow: hidden;
} }
&-icon-inner { &-icon-inner {
width: 478px; width: 478px;
max-height: 258px; max-height: 258px;
overflow-x: hidden; overflow-x: hidden;
overflow-y: auto; overflow-y: auto;
} }
&-icon-list { &-icon-list {
width: 458px; width: 458px;
padding: 0; padding: 0;
margin: -8px 0 0 -8px; margin: -8px 0 0 -8px;
> .el-button { > .el-button {
padding: 8px; padding: 8px;
margin: 8px 0 0 8px; margin: 8px 0 0 8px;
> span { > span {
display: inline-block; display: inline-block;
vertical-align: middle; vertical-align: middle;
width: 18px; width: 18px;
height: 18px; height: 18px;
font-size: 18px; font-size: 18px;
} }
} }
} }
} }
</style> </style>

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)
} }