Compare commits
81 Commits
test
...
37df2abcc5
| Author | SHA1 | Date | |
|---|---|---|---|
| 37df2abcc5 | |||
| fef9bca0ae | |||
| 197b4734d5 | |||
| dedcedec06 | |||
| 93b401071a | |||
| a15e78dcaf | |||
| 3c4af47e2d | |||
| 686002a48e | |||
| 4cae583333 | |||
| 8aaaf2c7ad | |||
| 56ab0220e2 | |||
| 8943eb56b3 | |||
| 6063b664a6 | |||
| 3e42b99996 | |||
| f17fab4749 | |||
| 566c900a24 | |||
| 8ad162aab6 | |||
| 3d851e4362 | |||
| 23e508916e | |||
| 535004719c | |||
| 51022a6e6d | |||
| b4e00bbca0 | |||
| a9265d6708 | |||
| 302d1832df | |||
| 00343fa5b9 | |||
| d1dd52fe90 | |||
| 04f19e82e3 | |||
| 19730bb635 | |||
| ba44951b71 | |||
| b3aba50b09 | |||
| 3f2e8e8b9e | |||
| db5b5091e1 | |||
| 0ef30e1985 | |||
| cd9beb120a | |||
| a1056abe80 | |||
| 0ddba21e1c | |||
| 535cb490b1 | |||
| c1e152405d | |||
| c435901f3b | |||
| 174e5efae5 | |||
| bc08dffda2 | |||
| e91520e99d | |||
| 83fb096f6d | |||
| 90e34584ec | |||
| 9653474e2f | |||
| df3b11b6dd | |||
| ffd095b6b8 | |||
| 559cffc5f0 | |||
| cfec6ff3f5 | |||
| 5d8f537d05 | |||
| 669c8f90c6 | |||
| 2557026002 | |||
| 0733660c2f | |||
| 32dd90969a | |||
| a150905840 | |||
| 2911cf2a90 | |||
| e3849933d9 | |||
| c15671c496 | |||
| 1e118a6d5d | |||
| f415f30f9e | |||
| 56bbc2497a | |||
| 06193447c8 | |||
| 1b760cb844 | |||
| afc4577335 | |||
| 333da8433e | |||
| 65c4ce9d45 | |||
| 93912aa193 | |||
| 374da7b1e9 | |||
| 43f33be189 | |||
| ee27a93181 | |||
| 8f802c5580 | |||
| cf28335d9e | |||
| 4bd6ad1f47 | |||
| b79efe0a19 | |||
| ffad1a2643 | |||
| affea8af59 | |||
| 8b060b8bf1 | |||
| d4e7bda03b | |||
| 3df2939fb4 | |||
| d3752c4f40 | |||
| 0566808861 |
11
.prettierrc
Normal file
11
.prettierrc
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"singleQuote": true,
|
||||
"tabWidth": 2,
|
||||
"bracketSameLine": true,
|
||||
"embeddedLanguageFormatting": "auto",
|
||||
"printWidth": 180,
|
||||
"quoteProps": "consistent",
|
||||
"trailingComma": "none",
|
||||
"semi": false,
|
||||
"useTabs": true
|
||||
}
|
||||
166
AddOrUpdateConfig.md
Normal file
166
AddOrUpdateConfig.md
Normal file
@@ -0,0 +1,166 @@
|
||||
# Add Or Update Dialog Configs
|
||||
|
||||
> 通过传入合理的配置项来使用 addOrUpdate Dialog
|
||||
|
||||
## 示例
|
||||
|
||||
```js
|
||||
const addOrUpdateConfigs = {
|
||||
type: 'dialog', // dialog | drawer | page
|
||||
infoUrl: '/monitoring/product',
|
||||
fields: [
|
||||
'name',
|
||||
{
|
||||
name: 'code',
|
||||
api: '/monitoring/product/getCode'
|
||||
},
|
||||
{
|
||||
name: 'processTime',
|
||||
label: '加工时间',
|
||||
placeholder: '请输入加工时间',
|
||||
type: 'number', // type: number(input+number) | default(input) | textarea | select(options在父组件里获取) | datetime
|
||||
required: true,
|
||||
rules: [
|
||||
// 除了required之外的验证规则
|
||||
{
|
||||
type: 'number',
|
||||
trigger: 'blur',
|
||||
transform: val => Number(val),
|
||||
message: '必须输入数字'
|
||||
}
|
||||
]
|
||||
},
|
||||
'remark',
|
||||
'specifications',
|
||||
{
|
||||
name: 'typeDictValue',
|
||||
rules: [{ required: true, trigger: 'blur' }],
|
||||
label: '产品类型', // 对于非常见属性,最好自己指定label
|
||||
type: 'select',
|
||||
options: [
|
||||
// 动态获取
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'unitDictValue',
|
||||
label: '单位',
|
||||
type: 'select',
|
||||
placeholder: '请选择单位',
|
||||
options: [
|
||||
// 动态获取
|
||||
]
|
||||
}
|
||||
],
|
||||
operations: [
|
||||
// { name: 'reset', url: true },
|
||||
{ name: 'cancel', url: true, showAlways: true },
|
||||
{ name: 'save', url: '/monitoring/product', permission: '', showOnEdit: false },
|
||||
{ name: 'update', url: '/monitoring/product', permission: '', showOnEdit: true }
|
||||
],
|
||||
subtable: {
|
||||
// for i18n
|
||||
title: '动态属性',
|
||||
url: '/monitoring/productArrt',
|
||||
tableConfigs: [
|
||||
{ type: 'index', name: '序号' },
|
||||
{ prop: 'createTime', name: '添加时间', filter: val => (val ? moment(val).format('YYYY-MM-DD hh:mm:ss') : '-') },
|
||||
{ prop: 'name', name: '属性名', formField: true, rules: [{ required: true, message: '必填', trigger: 'blur' }] },
|
||||
{ prop: 'code', name: '属性值', formField: true },
|
||||
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
},
|
||||
extraComponents: [
|
||||
{
|
||||
name: 'CompName',
|
||||
label: 'markdown编辑器',
|
||||
component: () => import('xx.vue')
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## 配置项
|
||||
|
||||
<br>
|
||||
|
||||
### type
|
||||
|
||||
类型: string
|
||||
值:dialog | drawer | page
|
||||
含义:对话框、抽屉、新页面
|
||||
|
||||
### infoUrl
|
||||
|
||||
类型:string
|
||||
含义:详情的接口,如 `/monitoring/product`
|
||||
|
||||
### fields
|
||||
|
||||
含义:设置新增、编辑时的字段
|
||||
类型:`Array<string | object>`
|
||||
|
||||
- 当类型为 string 时,默认渲染 `<input>`
|
||||
- 当类型为 object 时,有如下选项:
|
||||
- name: 字段名
|
||||
- label: 字段的 label
|
||||
- api: 如果设置了该属性,则该字段会自动从服务器获取值,一般为 code 字段需要
|
||||
- placeholder
|
||||
- type: 渲染何种类型的组件,默认值: 'input'
|
||||
- options: 当上一条 type 值为 'select' 时,需要自行动态获取并加载 options 列表
|
||||
- required: 是否是必须填写的字段(或可用过 rules 做更加具体的设定,设定方式参考 async-validator )
|
||||
- rules: 验证规则数组,如果只有"必填"的需求,可直接用上一条
|
||||
|
||||
### operations
|
||||
|
||||
含义:设置对话框等组件里,需要哪些按钮
|
||||
类型:`Array<object>`
|
||||
属性:
|
||||
|
||||
- name,按钮的类型,决定按钮的文字和颜色
|
||||
- url,按钮操作的接口地址,不需要的可以给 null 或 true
|
||||
- permission,该操作需要的权限,如 "sys:xxx:add" 形式
|
||||
- showOnEdit: boolean,是否编辑页面展示,不设置则始终展示
|
||||
示例:
|
||||
|
||||
```js
|
||||
operations: [
|
||||
{ name: 'reset', url: true },
|
||||
{ name: 'cancel', url: true, showAlways: true },
|
||||
{ name: 'save', url: '/monitoring/product', permission: '', showOnEdit: false },
|
||||
{ name: 'update', url: '/monitoring/product', permission: '', showOnEdit: true }
|
||||
],
|
||||
```
|
||||
|
||||
### subtable
|
||||
|
||||
含义:有些对话框里需要额外的表格来展示更深层次的数据,如“产品属性”
|
||||
类型:object
|
||||
选项:
|
||||
- title, 内嵌表格的标题
|
||||
- url, 内嵌表格的数据地址
|
||||
- tableConfigs,内嵌表格的配置选项
|
||||
- 类型:`Array<object>`
|
||||
- 配置:
|
||||
- type: 同 element-ui 的 table 属性的 type
|
||||
- fixed: 同 element-ui 的 table 属性的 fixed
|
||||
- width: 同 element-ui 的 table 属性的 width
|
||||
- name: 表头显示的内容
|
||||
- filter: 一般用于转换时间
|
||||
- prop: 字段
|
||||
- formField: boolean, 是否用于表单的填写
|
||||
- rules: 表单验证规则,详见:async-validator
|
||||
- subcomponent: 同 base-table 的 subcomponent
|
||||
- options: 表格操作列需要哪些操作
|
||||
- 值:`edit` | `delete` | `detail`,需要其他可自行添加(修改 base-table 组件)
|
||||
|
||||
### extraComponents
|
||||
含义: 需要在对话框里使用的自定义组件列表
|
||||
类型: Array<object>
|
||||
对象选项:
|
||||
- name: 该组件对应的 dataForm 字段(需要参照后端文档来指定)
|
||||
- hasModel: boolean, 上传组件一般设置为 false,设置是否和 dataForm 关联
|
||||
- label
|
||||
- fieldType: 设置该组件的数据将以什么数据类型形式来保存
|
||||
- component: 组件
|
||||
- props 传给组件的配置
|
||||
|
||||
55
package-lock.json
generated
55
package-lock.json
generated
@@ -2603,6 +2603,12 @@
|
||||
"resolved": "https://registry.npm.taobao.org/@types/json-schema/download/@types/json-schema-7.0.5.tgz",
|
||||
"integrity": "sha1-3M5EMOZLRDuolF8CkPtWStW6xt0="
|
||||
},
|
||||
"@types/lodash": {
|
||||
"version": "4.14.182",
|
||||
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.182.tgz",
|
||||
"integrity": "sha512-/THyiqyQAP9AfARo4pF+aCGcyiQ94tX/Is2I7HofNRqoYLgN1PBoOWu2/zTA5zMxzP5EFutMtWtGAFRKUe961Q==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/minimatch": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npm.taobao.org/@types/minimatch/download/@types/minimatch-3.0.3.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Fminimatch%2Fdownload%2F%40types%2Fminimatch-3.0.3.tgz",
|
||||
@@ -5277,6 +5283,19 @@
|
||||
"safe-buffer": "^5.0.1"
|
||||
}
|
||||
},
|
||||
"ckeditor4-integrations-common": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ckeditor4-integrations-common/-/ckeditor4-integrations-common-1.0.0.tgz",
|
||||
"integrity": "sha512-OAoQT/gYrHkg0qgzf6MS/rndYhq3SScLVQ3rtXQeuCE8ju7nFHg3qZ7WGA2XpFxcZzsMP6hhugXqdel5vbcC3g=="
|
||||
},
|
||||
"ckeditor4-vue": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ckeditor4-vue/-/ckeditor4-vue-2.1.1.tgz",
|
||||
"integrity": "sha512-BBmpT1BYxOmaA+qy9+hvhG0tDYCGqFve1eDSol0ZNwWCm1hZvmPAke809AhkHFUjb834dbNRlTwH3c2qedjtkQ==",
|
||||
"requires": {
|
||||
"ckeditor4-integrations-common": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"class-utils": {
|
||||
"version": "0.3.6",
|
||||
"resolved": "https://registry.npm.taobao.org/class-utils/download/class-utils-0.3.6.tgz",
|
||||
@@ -7101,6 +7120,22 @@
|
||||
"safer-buffer": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"echarts": {
|
||||
"version": "5.3.3",
|
||||
"resolved": "https://registry.npmjs.org/echarts/-/echarts-5.3.3.tgz",
|
||||
"integrity": "sha512-BRw2serInRwO5SIwRviZ6Xgm5Lb7irgz+sLiFMmy/HOaf4SQ+7oYqxKzRHAKp4xHQ05AuHw1xvoQWJjDQq/FGw==",
|
||||
"requires": {
|
||||
"tslib": "2.3.0",
|
||||
"zrender": "5.3.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"tslib": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.0.tgz",
|
||||
"integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"ee-first": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npm.taobao.org/ee-first/download/ee-first-1.1.1.tgz",
|
||||
@@ -10942,6 +10977,11 @@
|
||||
"minimist": "^1.2.5"
|
||||
}
|
||||
},
|
||||
"moment": {
|
||||
"version": "2.29.4",
|
||||
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz",
|
||||
"integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w=="
|
||||
},
|
||||
"move-concurrently": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npm.taobao.org/move-concurrently/download/move-concurrently-1.0.1.tgz",
|
||||
@@ -17245,6 +17285,21 @@
|
||||
"integrity": "sha1-48mzFWnhBoEd8kL3FXJaH0xJQyA="
|
||||
}
|
||||
}
|
||||
},
|
||||
"zrender": {
|
||||
"version": "5.3.2",
|
||||
"resolved": "https://registry.npmjs.org/zrender/-/zrender-5.3.2.tgz",
|
||||
"integrity": "sha512-8IiYdfwHj2rx0UeIGZGGU4WEVSDEdeVCaIg/fomejg1Xu6OifAL1GVzIPHg2D+MyUkbNgPWji90t0a8IDk+39w==",
|
||||
"requires": {
|
||||
"tslib": "2.3.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"tslib": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.0.tgz",
|
||||
"integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg=="
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,14 +13,17 @@
|
||||
"axios": "^0.19.2",
|
||||
"babel-eslint": "^8.0.1",
|
||||
"babel-plugin-component": "^1.1.1",
|
||||
"ckeditor4-vue": "^2.1.1",
|
||||
"core-js": "^3.6.5",
|
||||
"echarts": "^5.3.3",
|
||||
"element-theme": "^2.0.1",
|
||||
"element-ui": "^2.15.7",
|
||||
"js-cookie": "^2.2.1",
|
||||
"lodash": "^4.17.19",
|
||||
"sass": "^1.26.5",
|
||||
"moment": "^2.29.4",
|
||||
"qs": "^6.9.4",
|
||||
"quill": "^1.3.7",
|
||||
"sass": "^1.26.5",
|
||||
"sass-loader": "^9.0.2",
|
||||
"screenfull": "^4.2.1",
|
||||
"svg-sprite-loader": "^5.0.0",
|
||||
@@ -31,6 +34,7 @@
|
||||
"vuex": "^3.5.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/lodash": "^4.14.182",
|
||||
"@vue/cli-plugin-babel": "^4.4.6",
|
||||
"@vue/cli-service": "^4.4.6",
|
||||
"element-theme-chalk": "^2.15.7",
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
window.SITE_CONFIG['version'] = 'v5.0.0';
|
||||
window.SITE_CONFIG['nodeEnv'] = '<%= process.env.VUE_APP_NODE_ENV %>';
|
||||
window.SITE_CONFIG['apiURL'] = ''; // api请求地址
|
||||
window.SITE_CONFIG['projURL'] = '/yd-monitor'; // api请求地址
|
||||
window.SITE_CONFIG['storeState'] = {}; // vuex本地储存初始化状态(用于不刷新页面的情况下,也能重置初始化项目中所有状态)
|
||||
window.SITE_CONFIG['contentTabDefault'] = { // 内容标签页默认属性对象
|
||||
'name': '', // 名称, 由 this.$route.name 自动赋值(默认,名称 === 路由名称 === 路由路径)
|
||||
@@ -30,7 +31,7 @@
|
||||
<!-- 开发环境 -->
|
||||
<% if (process.env.VUE_APP_NODE_ENV === 'dev') { %>
|
||||
<script>
|
||||
window.SITE_CONFIG['apiURL'] = 'http://localhost:8080/renren-admin';
|
||||
window.SITE_CONFIG['apiURL'] = 'http://192.168.1.65:8080';
|
||||
</script>
|
||||
<% } %>
|
||||
<!-- 集成测试环境 -->
|
||||
|
||||
46
src/App.vue
46
src/App.vue
@@ -1,34 +1,34 @@
|
||||
<template>
|
||||
<transition name="el-fade-in-linear">
|
||||
<router-view />
|
||||
</transition>
|
||||
<transition name="el-fade-in-linear">
|
||||
<router-view />
|
||||
</transition>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
.el-table th.gutter{
|
||||
display: table-cell!important;
|
||||
}
|
||||
.el-table th.gutter {
|
||||
display: table-cell !important;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
import Cookies from 'js-cookie'
|
||||
import { messages } from '@/i18n'
|
||||
export default {
|
||||
watch: {
|
||||
'$i18n.locale': 'i18nHandle'
|
||||
},
|
||||
created () {
|
||||
this.i18nHandle(this.$i18n.locale)
|
||||
},
|
||||
methods: {
|
||||
i18nHandle (val, oldVal) {
|
||||
Cookies.set('language', val)
|
||||
document.querySelector('html').setAttribute('lang', val)
|
||||
document.title = messages[val].brand.lg
|
||||
// 非登录页面,切换语言刷新页面
|
||||
if (this.$route.name !== 'login' && oldVal) {
|
||||
window.location.reload()
|
||||
}
|
||||
}
|
||||
}
|
||||
watch: {
|
||||
'$i18n.locale': 'i18nHandle'
|
||||
},
|
||||
created() {
|
||||
this.i18nHandle(this.$i18n.locale)
|
||||
},
|
||||
methods: {
|
||||
i18nHandle(val, oldVal) {
|
||||
Cookies.set('language', val)
|
||||
document.querySelector('html').setAttribute('lang', val)
|
||||
document.title = messages[val].brand.lg
|
||||
// 非登录页面,切换语言刷新页面
|
||||
if (this.$route.name !== 'login' && oldVal) {
|
||||
window.location.reload()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
548
src/components/base-detail-page/index.vue
Normal file
548
src/components/base-detail-page/index.vue
Normal file
@@ -0,0 +1,548 @@
|
||||
<template>
|
||||
<div class="super-flexible-dialog" :title="isDetail ? title.detail : !dataForm.id ? title.add : title.edit" @close="handleClose">
|
||||
<div style="max-height: 60vh; overflow-y: scroll; overflow-x: hidden;">
|
||||
<el-form ref="dataForm" :model="dataForm" :rules="dataFormRules">
|
||||
<!-- 如果需要更精细一点的布局,可以根据配置项实现地再复杂一点,但此处暂时全部采用一行两列布局 -->
|
||||
<el-row v-for="n in rows" :key="n" :gutter="20">
|
||||
<el-col v-for="c in COLUMN_PER_ROW" :key="`${n}+'col'+${c}`" :span="getSpan(n, c)">
|
||||
<!-- <el-col v-for="c in COLUMN_PER_ROW" :key="`${n}+'col'+${c}`" :span="24 / COLUMN_PER_ROW"> -->
|
||||
<!-- :class="{ 'hidden-input': configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].hidden }" -->
|
||||
<el-form-item
|
||||
v-if="configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)]"
|
||||
:prop="configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].name"
|
||||
:key="`${n}-col-${c}-item`"
|
||||
:label="getLabel(n, c)"
|
||||
>
|
||||
<!-- 暂时先不实现部分输入方式 -->
|
||||
<el-input
|
||||
v-if="getType(n, c) === 'input'"
|
||||
:placeholder="getPlaceholder(n, c)"
|
||||
v-model="dataForm[configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].name]"
|
||||
clearable
|
||||
/>
|
||||
<el-radio v-if="getType(n, c) === 'radio'" v-model="dataForm[configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].name]"></el-radio>
|
||||
<el-checkbox v-if="getType(n, c) === 'check'" v-model="dataForm[configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].name]"></el-checkbox>
|
||||
<el-select
|
||||
v-if="getType(n, c) === 'select'"
|
||||
:placeholder="getPlaceholder(n, c)"
|
||||
v-model="dataForm[configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].name]"
|
||||
clearable
|
||||
@change="emitSelectChange(configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].name, $event)"
|
||||
>
|
||||
<el-option v-for="opt in configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].options" :key="opt.label" :label="opt.label" :value="opt.value" />
|
||||
</el-select>
|
||||
<el-switch v-if="getType(n, c) === 'switch'" v-model="dataForm[configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].name]"></el-switch>
|
||||
<el-cascader
|
||||
v-if="getType(n, c) === 'cascader'"
|
||||
v-model="dataForm[configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].name]"
|
||||
:options="configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].options"
|
||||
:props="configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].props"
|
||||
></el-cascader>
|
||||
<el-time-select v-if="getType(n, c) === 'time'" v-model="dataForm[configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].name]"></el-time-select>
|
||||
<el-date-picker
|
||||
v-if="getType(n, c) === 'date'"
|
||||
v-bind="configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].props"
|
||||
:placeholder="getPlaceholder(n, c)"
|
||||
v-model="dataForm[configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].name]"
|
||||
></el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<!-- extra components , like Markdown or RichEdit -->
|
||||
<template v-if="configs.extraComponents && configs.extraComponents.length > 0">
|
||||
<el-form-item v-for="(ec, index) in configs.extraComponents" :key="ec.name + index" :label="ec.label" class="extra-components">
|
||||
<component style="margin-top: 40px;" v-if="ec.hasModel" :is="ec.component" v-bind="ec.props" v-model="dataForm[ec.name]" @ready="handleEditorReady" />
|
||||
<!-- <component v-if="ec.hasModel" :is="ec.component" v-bind="ec.props" v-model="dataForm[ec.name]" /> -->
|
||||
<component
|
||||
v-else
|
||||
:is="ec.component"
|
||||
v-bind="ec.props"
|
||||
@uploader-update-filelist="handleUploadListUpdate($event, ec.props.extraParams.typeCode)"
|
||||
:uploader-inject-file-list="/*用于设备分流的*/ fileList[ec.props.extraParams.typeCode]"
|
||||
/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-form>
|
||||
|
||||
<template v-if="dataForm.id && configs.subtable">
|
||||
<attr-form :pId="dataForm.id" v-bind="configs.subtable" />
|
||||
</template>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<template v-for="(operate, index) in configs.operations">
|
||||
<!-- {{ operate.name | btnNameFilter }} -->
|
||||
<el-button
|
||||
v-if="
|
||||
operate.showAlways ||
|
||||
(((dataForm.id && operate.showOnEdit) || (!dataForm.id && !operate.showOnEdit)) && (operate.permission ? $hasPermission(operate.permission) : true))
|
||||
"
|
||||
:key="`operate-${index}`"
|
||||
:type="btnType[operate.name]"
|
||||
@click="handleClick(operate)"
|
||||
>{{ btnName[operate.name] }}</el-button
|
||||
>
|
||||
</template>
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AttrForm from '../AttrForm'
|
||||
import { pick } from 'lodash/object'
|
||||
|
||||
// 标题 for i18n
|
||||
const title = {
|
||||
detail: '详情',
|
||||
add: '新增',
|
||||
edit: '编辑'
|
||||
}
|
||||
|
||||
// 或者也可以改造成自定义颜色:
|
||||
const btnType = {
|
||||
save: 'success',
|
||||
update: 'primary',
|
||||
reset: 'text'
|
||||
// cancel: 'text'
|
||||
// add more...
|
||||
}
|
||||
|
||||
const btnName = {
|
||||
// for i18n
|
||||
save: '保存',
|
||||
update: '更新',
|
||||
reset: '重置',
|
||||
cancel: '取消'
|
||||
// add more...
|
||||
}
|
||||
|
||||
// 每行的列数
|
||||
const COLUMN_PER_ROW = 2
|
||||
|
||||
export default {
|
||||
name: 'AddOrUpdateDialog',
|
||||
components: { AttrForm },
|
||||
props: {
|
||||
configs: {
|
||||
/**
|
||||
* TODO: 定义及使用方式,应改用README.md文件记录
|
||||
* type: 'dialog' | 'drawer' | 'page'
|
||||
* fields: Array<string|object>
|
||||
* - fields.object: { name, type: 'number'|'textarea'|'select'|'date'|.., required: boolean, validator: boolean(是否需要验证), [options]: any[], api: string(自动获取数据的接口,一般为getcode接口)}
|
||||
* operations: Array[object], 操作名和对应的接口地址,还有permission(如,sys:dict:update)
|
||||
*/
|
||||
type: Object,
|
||||
default: () => ({}) // 此处省去类型检查,使用者自行注意就好
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
nameFilter: function(name) {
|
||||
if (!name) return null
|
||||
// for i18n
|
||||
const defaultNames = {
|
||||
name: '名称',
|
||||
code: '编码',
|
||||
remark: '备注',
|
||||
description: '描述',
|
||||
specifications: '规格'
|
||||
// add more...
|
||||
}
|
||||
|
||||
return defaultNames[name]
|
||||
}
|
||||
},
|
||||
// provide() {
|
||||
// return {
|
||||
// _df: this.dataForm
|
||||
// }
|
||||
// },
|
||||
data() {
|
||||
return {
|
||||
COLUMN_PER_ROW,
|
||||
title,
|
||||
/** 按钮相关属性 */
|
||||
btnName,
|
||||
btnType,
|
||||
defaultNames: {
|
||||
name: '名称',
|
||||
code: '编码',
|
||||
remark: '备注',
|
||||
description: '描述',
|
||||
specifications: '规格'
|
||||
// add more...
|
||||
},
|
||||
defaultPlaceholders: {}, // 自动根据 defaultNames 计算得来
|
||||
/** 表单相关属性 */
|
||||
visible: false,
|
||||
isEdit: false,
|
||||
isDetail: false,
|
||||
dataForm: {},
|
||||
dataFormRules: {},
|
||||
tempForm: [], // 临时保存自动生成的code,或其他数据
|
||||
shouldWait: null,
|
||||
fileForm: {}, // 文件上传分流用、合并用的表单,根据 typeCode 进行分流,在请求时合并
|
||||
fileList: {} // 文件加载时分流,依据 typeCode
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
rows() {
|
||||
// 本组件只实现了'一行两列'的表单布局
|
||||
return Math.ceil(this.configs.fields.length / COLUMN_PER_ROW)
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
/** 计算 defaultPlaceholders */
|
||||
const prefix = '请输入'
|
||||
Object.entries(this.defaultNames).map(([key, value]) => {
|
||||
this.defaultPlaceholders[key] = prefix + value
|
||||
})
|
||||
|
||||
/** 转换 configs.fields 的结构,把纯字符串转为对象 */
|
||||
this.$nextTick(() => {
|
||||
this.configs.fields = this.configs.fields.map(item => {
|
||||
if (typeof item === 'string') {
|
||||
return { name: item }
|
||||
}
|
||||
return item
|
||||
})
|
||||
|
||||
/** 动态设置dataForm字段 */
|
||||
this.configs.fields.forEach(item => {
|
||||
this.$set(this.dataForm, [item.name], '')
|
||||
|
||||
/** select 的默认值设置 */
|
||||
if (item.type === 'select') {
|
||||
const opts = item.options || []
|
||||
const dft = opts.find(item => item.default || false)
|
||||
if (dft) {
|
||||
this.$set(this.dataForm, [item.name], dft.value)
|
||||
}
|
||||
}
|
||||
|
||||
if (item.api) {
|
||||
/** 自动请求并填充 */
|
||||
// or this.shouldWaitPool = []
|
||||
this.shouldWait = this.$http({
|
||||
url: this.$http.adornUrl(item.api),
|
||||
method: 'POST' // 也可以改成动态决定
|
||||
}).then(({ data: res }) => {
|
||||
if (res && res.code === 0) {
|
||||
// this.dataForm[item.name] = res.data // <=== 此处需要对接口
|
||||
this.tempForm.push({ name: item.name, data: res.data })
|
||||
}
|
||||
})
|
||||
} // end if (item.api)
|
||||
|
||||
if (item.required) {
|
||||
const requiredRule = {
|
||||
required: true,
|
||||
message: '请输入必填项',
|
||||
trigger: 'change'
|
||||
}
|
||||
/** 检查是否已经存在该字段的规则 */
|
||||
const exists = this.dataFormRules[item.name] || null
|
||||
/** 设置验证规则 */
|
||||
if (exists) {
|
||||
const unset = true
|
||||
for (const rule of exists) {
|
||||
if (rule.required) unset = false
|
||||
}
|
||||
if (unset) {
|
||||
exists.push(requiredRule)
|
||||
}
|
||||
} else {
|
||||
/** 不存在已有规则 */
|
||||
this.$set(this.dataFormRules, [item.name], [requiredRule])
|
||||
}
|
||||
} // end if (item.required)
|
||||
|
||||
if (item.rules) {
|
||||
const exists = this.dataFormRules[item.name] || null
|
||||
if (exists) {
|
||||
// 浅拷贝过去
|
||||
exists.push(...item.rules)
|
||||
} else {
|
||||
this.$set(this.dataFormRules, [item.name], [...item.rules])
|
||||
}
|
||||
} // end if (item.rules)
|
||||
})
|
||||
|
||||
/** 计算默认值 */
|
||||
function calDefault(type) {
|
||||
switch (type) {
|
||||
case 'array':
|
||||
return []
|
||||
// more case...
|
||||
default:
|
||||
return ''
|
||||
}
|
||||
}
|
||||
/** 检查是否需要额外的组件 */
|
||||
this.configs.extraComponents &&
|
||||
this.configs.extraComponents.forEach(item => {
|
||||
if (Object.hasOwn(this.dataForm, [item.name])) {
|
||||
console.log('有了!')
|
||||
return
|
||||
} else {
|
||||
console.log('新建!')
|
||||
this.$set(this.dataForm, [item.name], calDefault(item.fieldType))
|
||||
}
|
||||
|
||||
console.log('component: ', item.component)
|
||||
})
|
||||
|
||||
/** 单独设置 id */
|
||||
this.$set(this.dataForm, 'id', null)
|
||||
console.log('mounted: this.dataForm', JSON.stringify(this.dataForm))
|
||||
})
|
||||
},
|
||||
|
||||
methods: {
|
||||
getSpan(n, c) {
|
||||
const opt = this.configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)]
|
||||
return opt && opt.span ? opt.span : 24 / COLUMN_PER_ROW
|
||||
},
|
||||
|
||||
getLabel(n, c) {
|
||||
const opt = this.configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)]
|
||||
if (opt) {
|
||||
// if opt is valid
|
||||
return opt.label ? opt.label : this.defaultNames[opt.name]
|
||||
}
|
||||
},
|
||||
|
||||
getPlaceholder(n, c) {
|
||||
const opt = this.configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)]
|
||||
if (opt) {
|
||||
// if opt is valid
|
||||
return opt.placeholder
|
||||
? opt.placeholder
|
||||
: this.defaultPlaceholders[opt.name]
|
||||
? this.defaultPlaceholders[opt.name]
|
||||
: opt.label
|
||||
? (opt.type === 'select' ? '请选择' : '请输入') + opt.label
|
||||
: null
|
||||
|
||||
// : opt.type === 'select'
|
||||
// ? '请选择'
|
||||
// : '请输入'
|
||||
}
|
||||
},
|
||||
|
||||
getType(n, c) {
|
||||
const opt = this.configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)]
|
||||
if (opt) {
|
||||
if (!opt.type || ['input', 'number' /** add more.. */].includes(opt.type)) {
|
||||
return 'input'
|
||||
} else if (['select' /** add more.. */].includes(opt.type)) {
|
||||
return 'select'
|
||||
} else if (['cascader'].includes(opt.type)) {
|
||||
return 'cascader'
|
||||
} else if (['date'].includes(opt.type)) {
|
||||
return 'date'
|
||||
}
|
||||
// add more...
|
||||
} else {
|
||||
return 'input'
|
||||
}
|
||||
},
|
||||
|
||||
init(id) {
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
this.dataForm.id = id || null
|
||||
if (this.dataForm.id) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`${this.configs.infoUrl}/${this.dataForm.id}`),
|
||||
method: 'get'
|
||||
}).then(({ data: res }) => {
|
||||
if (res && res.code === 0) {
|
||||
const dataFormKeys = Object.keys(this.dataForm)
|
||||
console.log('data form keys: ', dataFormKeys, pick(res.data, dataFormKeys))
|
||||
this.dataForm = pick(res.data, dataFormKeys)
|
||||
|
||||
// LABEL: FILE_RELATED
|
||||
/** 对文件下载进行分流 */
|
||||
this.fileList = {}
|
||||
if (this.dataForm.files) {
|
||||
console.log('files: ', this.dataForm.files)
|
||||
this.dataForm.files.forEach(file => {
|
||||
// const fileName = file.fileUrl.split('/').pop()
|
||||
/** [1] 处理 fileList */
|
||||
if (Object.hasOwn(this.fileList, file.typeCode)) {
|
||||
/** 已存在 */
|
||||
// this.fileList[file.typeCode].push({ id: file.id, name: fileName, typeCode: file.typeCode })
|
||||
this.fileList[file.typeCode].push(file)
|
||||
} else {
|
||||
// this.fileList[file.typeCode] = [{ id: file.id, name: fileName, typeCode: file.typeCode }]
|
||||
this.fileList[file.typeCode] = [file]
|
||||
}
|
||||
|
||||
/** [2] 处理 fileForm */
|
||||
if (Object.hasOwn(this.fileForm, file.typeCode)) {
|
||||
this.fileForm[file.typeCode].push(file.id)
|
||||
} else {
|
||||
this.fileForm[file.typeCode] = [file.id]
|
||||
}
|
||||
})
|
||||
console.log('after分流:', this.fileList)
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
/** 如果不是编辑,就填充自动生成的数据 */
|
||||
if (this.shouldWait)
|
||||
this.shouldWait.then(() => {
|
||||
if (this.tempForm.length) {
|
||||
console.log('create new, tempform', JSON.stringify(this.tempForm.length))
|
||||
this.tempForm.forEach(item => {
|
||||
console.log('item data', item.data)
|
||||
this.dataForm[item.name] = item.data
|
||||
})
|
||||
console.log('create new, dataform', JSON.stringify(this.dataForm))
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
emitSelectChange(name, id) {
|
||||
this.$emit('select-change', { name, id })
|
||||
},
|
||||
|
||||
handleEditorReady(val) {
|
||||
console.log('editor rready..', val)
|
||||
},
|
||||
|
||||
handleClick(btn) {
|
||||
/** 提取url */
|
||||
const urls = {}
|
||||
this.configs.operations.map(item => {
|
||||
urls[item.name] = {}
|
||||
urls[item.name].url = item.url
|
||||
urls[item.name].extraFields = item.extraFields || {}
|
||||
})
|
||||
/** 操作 */
|
||||
switch (btn.name) {
|
||||
case 'save':
|
||||
case 'update':
|
||||
/** 需要验证表单的操作 */
|
||||
this.$refs['dataForm'].validate(valid => {
|
||||
if (valid) {
|
||||
/** 对于文件上传的单独处理(合并处理) */
|
||||
if (Object.keys(this.fileForm).length) {
|
||||
console.log('fileform 有值')
|
||||
// LABEL: FILE_RELATED
|
||||
let fileIds = []
|
||||
for (const [key, item] of Object.entries(this.fileForm)) {
|
||||
if (Array.isArray(item)) {
|
||||
fileIds = fileIds.concat(item)
|
||||
} else {
|
||||
console.error('handleClick(): 上传文件数组类型不正确')
|
||||
}
|
||||
}
|
||||
this.$set(this.dataForm, 'fileIds', fileIds)
|
||||
}
|
||||
|
||||
console.log('before send: ', this.dataForm)
|
||||
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(urls[btn.name].url),
|
||||
method: btn.name === 'save' ? 'POST' : 'PUT',
|
||||
data: { ...this.dataForm, ...urls[btn.name].extraFields }
|
||||
})
|
||||
.then(({ data: res }) => {
|
||||
if (res && res.code === 0) {
|
||||
this.$message({
|
||||
message: btn.name === 'save' ? '添加成功!' : '更新成功!',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.$emit('refreshDataList')
|
||||
this.visible = false
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(res.msg)
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.$message({
|
||||
message: err,
|
||||
type: 'error',
|
||||
duration: 2000
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
return
|
||||
case 'reset':
|
||||
for (const key of Object.keys(this.dataForm)) {
|
||||
if (typeof this.dataForm[key] === 'string') {
|
||||
this.dataForm[key] = ''
|
||||
} else if (this.dataForm[key] instanceof Array) {
|
||||
this.dataForm[key].splice(0)
|
||||
} else {
|
||||
this.dataForm[key] = null
|
||||
}
|
||||
}
|
||||
break
|
||||
case 'cancel':
|
||||
this.visible = false
|
||||
// add more..
|
||||
}
|
||||
},
|
||||
|
||||
// LABEL: FILE_RELATED
|
||||
handleUploadListUpdate(filelist, typeCode = 'DefaultTypeCode') {
|
||||
console.log('before handleUploadListUpdate(): ', JSON.parse(JSON.stringify(this.fileForm)))
|
||||
// 设备类型 typeCode: EquipmentTypeFile
|
||||
// 设备信息 typeCode: EquipmentInfoFile | EquipmentInfoImage
|
||||
|
||||
// 原先写法:直接更新 dataForm 对象,不适用于有多个上传组件的需求
|
||||
// this.$set(
|
||||
// this.dataForm,
|
||||
// 'fileIds',
|
||||
// filelist.map(item => item.id)
|
||||
// )
|
||||
// console.log('handleUploadListUpdate(): ', this.dataForm)
|
||||
// 现更改为分流写法
|
||||
this.$set(
|
||||
this.fileForm,
|
||||
typeCode,
|
||||
filelist.map(item => item.id)
|
||||
)
|
||||
console.log('after handleUploadListUpdate(): ', this.fileForm)
|
||||
},
|
||||
|
||||
handleClose() {
|
||||
this.$emit('destory-dialog')
|
||||
this.visible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.super-flexible-dialog >>> .el-select,
|
||||
.super-flexible-dialog >>> .el-cascader {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.super-flexible-dialog >>> ::-webkit-scrollbar {
|
||||
width: 4px;
|
||||
border-radius: 4px;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.super-flexible-dialog >>> ::-webkit-scrollbar-thumb {
|
||||
width: 4px;
|
||||
border-radius: 4px;
|
||||
background: #ccc;
|
||||
}
|
||||
|
||||
.super-flexible-dialog >>> .hidden-input {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
284
src/components/base-dialog/AttrForm/index.vue
Normal file
284
src/components/base-dialog/AttrForm/index.vue
Normal file
@@ -0,0 +1,284 @@
|
||||
<template>
|
||||
<div class="attr-form">
|
||||
<h3>{{ title }} <el-button style="margin-left: 8px;" type="text" v-if="!isDetail && !showAddAttr" @click="showAddAttr = true">添加</el-button></h3>
|
||||
<div v-if="!showAddAttr">
|
||||
<component
|
||||
key="sub-table"
|
||||
:is="require('../../base-table/index.vue').default"
|
||||
:table-head-configs="filterTableConfigs()"
|
||||
:data="dataList"
|
||||
:max-height="500"
|
||||
@operate-event="handleOperations"
|
||||
/>
|
||||
<el-pagination
|
||||
@size-change="sizeChangeHandle"
|
||||
@current-change="currentChangeHandle"
|
||||
:current-page="pageIndex"
|
||||
:page-sizes="[5, 10, 20, 50]"
|
||||
:page-size="pageSize"
|
||||
:total="totalPage"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
>
|
||||
</el-pagination>
|
||||
</div>
|
||||
<div v-else style="background: #eee; border-radius: 8px; padding: 12px;">
|
||||
<el-row>
|
||||
<el-col>
|
||||
<el-form ref="AttrForm" :model="AttrForm" :rules="AttrFormRules" :inline="true" label-position="top">
|
||||
<el-row :gutter="20" style="padding: 0 24px;">
|
||||
<el-col :span="attrFormFields.length > 6 ? 6 : 12" v-for="field in attrFormFields" :key="field.prop + 'col'">
|
||||
<el-form-item :key="field.prop" :prop="field.prop" :label="field.name" style="width: 100%">
|
||||
<el-input v-if="field.formType === 'input' || !field.formType" v-model="AttrForm[field.prop]" placeholder="请填写" clearable />
|
||||
<el-select v-if="field.formType === 'select'" v-model="AttrForm[field.prop]" clearable>
|
||||
<el-option v-for="opt in field.formOptions" :key="opt.value" :label="opt.label" :value="opt.value" />
|
||||
</el-select>
|
||||
<!-- add more... -->
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row style="text-align: right;">
|
||||
<el-button size="small" @click="handleCloseAttrForm">取消</el-button>
|
||||
<el-button type="success" size="small" @click="handleSaveAttrForm">保存</el-button>
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BaseTable from '@/components/base-table'
|
||||
import { pick } from 'lodash/object'
|
||||
|
||||
export default {
|
||||
name: 'AttrForm',
|
||||
components: { BaseTable },
|
||||
props: {
|
||||
isDetail: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
visible: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
/** subtable 需要设置的属性 */
|
||||
title: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
url: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
tableConfigs: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
/** 表单提交需要的属性 */
|
||||
relatedId: {
|
||||
type: String,
|
||||
required: true,
|
||||
default: null
|
||||
},
|
||||
relatedField: {
|
||||
type: String,
|
||||
required: true,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
showAddAttr: false,
|
||||
dataList: [],
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
AttrForm: {}, // 需动态设置
|
||||
AttrFormRules: {} // 需动态设置
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
attrFormFields() {
|
||||
const _ = this.tableConfigs.filter(item => item.formField)
|
||||
/** 顺带配置 AttrForm */
|
||||
_.forEach(item => {
|
||||
this.$set(this.AttrForm, [item.prop], '')
|
||||
})
|
||||
|
||||
this.$set(this.AttrForm, 'id', null)
|
||||
return _
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getDataList()
|
||||
/** 设置 AttrForm 的 rules */
|
||||
for (const config of this.tableConfigs) {
|
||||
if (config.rules) {
|
||||
this.$set(this.AttrFormRules, [config.prop], config.rules)
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/** filter tableConfigs */
|
||||
filterTableConfigs() {
|
||||
// return this.tableConfigs.map(item => {
|
||||
// const {prop, name, filter} = item
|
||||
// const newConfigs = {prop,name,filter}
|
||||
// if (item.type) newConfigs.type = item.type
|
||||
// if (item.fixed) newConfigs.fixed = item.fixed
|
||||
// if (item.width) newConfigs.width = item.width
|
||||
// if (item.subcomponent) newConfigs.subcomponent = item.subcomponent
|
||||
// if (item.options) newConfigs.options = item.options
|
||||
// return newConfigs
|
||||
// })
|
||||
return this.tableConfigs
|
||||
},
|
||||
/** init dataform */
|
||||
initAttrForm() {
|
||||
Object.entries(this.AttrForm).forEach(([key, value]) => {
|
||||
if (typeof value === 'object' || typeof value === 'number') {
|
||||
this.AttrForm[key] = null
|
||||
} else if (Array.isArray(value)) {
|
||||
this.AttrForm[key] = []
|
||||
} else {
|
||||
this.AttrForm[key] = ''
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/** requests */
|
||||
getDataList() {
|
||||
this.dataListLoading = true
|
||||
// 获取动态属性列表
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`${this.url}/page`),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
page: this.pageIndex,
|
||||
limit: this.pageSize,
|
||||
[this.relatedField]: this.relatedId
|
||||
// order: 'asc/desc',
|
||||
// orderField: 'name'
|
||||
})
|
||||
}).then(({ data: res }) => {
|
||||
if (res && res.code === 0) {
|
||||
this.dataList = res.data.list
|
||||
this.totalPage = res.data.total
|
||||
} else {
|
||||
this.dataList = []
|
||||
this.totalPage = 0
|
||||
}
|
||||
this.dataListLoading = false
|
||||
})
|
||||
},
|
||||
|
||||
/** handlers */
|
||||
handleOperations({ type, data: id }) {
|
||||
switch (type) {
|
||||
case 'edit':
|
||||
{
|
||||
this.showAddAttr = true
|
||||
this.$nextTick(() => {
|
||||
this.$http.get(this.$http.adornUrl(`${this.url}/${id}`)).then(({ data: res }) => {
|
||||
if (res && res.code === 0 && res.data) {
|
||||
const neededFields = [...this.attrFormFields.map(item => item.prop), 'id']
|
||||
const filtered = pick(res.data, neededFields)
|
||||
for (let field of neededFields) {
|
||||
this.AttrForm[field] = filtered[field]
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
break
|
||||
case 'delete':
|
||||
return this.deleteHandle(id)
|
||||
}
|
||||
},
|
||||
deleteHandle(id) {
|
||||
var ids = id ? [id] : []
|
||||
|
||||
this.$confirm(`确定对id=${ids.join(',')}进行${id ? '删除' : '批量删除'}操作?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(this.url),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getDataList()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
handleCloseAttrForm() {
|
||||
this.showAddAttr = false
|
||||
this.initAttrForm()
|
||||
},
|
||||
|
||||
handleSaveAttrForm() {
|
||||
this.$refs['AttrForm'].validate(valid => {
|
||||
if (valid) {
|
||||
this.$http({
|
||||
// url: this.$http.adornUrl(`${this.url}/${!this.AttrForm.id ? '' : this.AttrForm.id}`),
|
||||
url: this.$http.adornUrl(this.url),
|
||||
method: this.AttrForm.id ? 'put' : 'post',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
data: JSON.stringify({ ...this.AttrForm, [this.relatedField]: this.relatedId })
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.showAddAttr = false
|
||||
this.getDataList()
|
||||
this.initAttrForm()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 每页数
|
||||
sizeChangeHandle(val) {
|
||||
this.pageSize = val
|
||||
this.pageIndex = 1
|
||||
this.getDataList()
|
||||
},
|
||||
// 当前页
|
||||
currentChangeHandle(val) {
|
||||
this.pageIndex = val
|
||||
this.getDataList()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.attr-form >>> .el-form .el-form-item__label {
|
||||
padding: 0;
|
||||
}
|
||||
</style>
|
||||
564
src/components/base-dialog/addOrUpdate/index.vue
Normal file
564
src/components/base-dialog/addOrUpdate/index.vue
Normal file
@@ -0,0 +1,564 @@
|
||||
<template>
|
||||
<el-dialog class="super-flexible-dialog" :title="isDetail ? title.detail : !dataForm.id ? title.add : title.edit" :visible.sync="visible" @close="handleClose">
|
||||
<div style="max-height: 60vh; overflow-y: scroll; overflow-x: hidden;">
|
||||
<el-form ref="dataForm" :model="dataForm" :rules="dataFormRules">
|
||||
<!-- 如果需要更精细一点的布局,可以根据配置项实现地再复杂一点,但此处暂时全部采用一行两列布局 -->
|
||||
<el-row v-for="n in rows" :key="n" :gutter="20">
|
||||
<el-col v-for="c in COLUMN_PER_ROW" :key="`${n}+'col'+${c}`" :span="getSpan(n, c)">
|
||||
<!-- <el-col v-for="c in COLUMN_PER_ROW" :key="`${n}+'col'+${c}`" :span="24 / COLUMN_PER_ROW"> -->
|
||||
<!-- :class="{ 'hidden-input': configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].hidden }" -->
|
||||
<el-form-item
|
||||
v-if="configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)]"
|
||||
:prop="configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].name"
|
||||
:key="`${n}-col-${c}-item`"
|
||||
:label="getLabel(n, c)"
|
||||
>
|
||||
<!-- 暂时先不实现部分输入方式 -->
|
||||
<el-input
|
||||
v-if="getType(n, c) === 'input'"
|
||||
:placeholder="getPlaceholder(n, c)"
|
||||
v-model="dataForm[configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].name]"
|
||||
clearable
|
||||
:disabled="isDetail"
|
||||
/>
|
||||
<el-radio v-if="getType(n, c) === 'radio'" v-model="dataForm[configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].name]" :disabled="isDetail" />
|
||||
<el-checkbox v-if="getType(n, c) === 'check'" v-model="dataForm[configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].name]" :disabled="isDetail" />
|
||||
<el-select
|
||||
v-if="getType(n, c) === 'select'"
|
||||
:placeholder="getPlaceholder(n, c)"
|
||||
v-model="dataForm[configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].name]"
|
||||
clearable
|
||||
:disabled="isDetail"
|
||||
@change="emitSelectChange(configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].name, $event)"
|
||||
>
|
||||
<el-option v-for="opt in configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].options" :key="opt.label" :label="opt.label" :value="opt.value" />
|
||||
</el-select>
|
||||
<el-switch v-if="getType(n, c) === 'switch'" v-model="dataForm[configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].name]" :disabled="isDetail" />
|
||||
<el-cascader
|
||||
v-if="getType(n, c) === 'cascader'"
|
||||
v-model="dataForm[configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].name]"
|
||||
:options="configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].options"
|
||||
:props="configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].props"
|
||||
:disabled="isDetail"
|
||||
/>
|
||||
<el-time-select v-if="getType(n, c) === 'time'" v-model="dataForm[configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].name]" :disabled="isDetail" />
|
||||
<el-date-picker
|
||||
v-if="getType(n, c) === 'date'"
|
||||
v-bind="configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].props"
|
||||
:placeholder="getPlaceholder(n, c)"
|
||||
v-model="dataForm[configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].name]"
|
||||
:disabled="isDetail"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<!-- extra components , like Markdown or RichEdit -->
|
||||
<template v-if="configs.extraComponents && configs.extraComponents.length > 0">
|
||||
<el-form-item v-for="(ec, index) in configs.extraComponents" :key="ec.name + index" :label="ec.label" class="extra-components">
|
||||
<component
|
||||
style="margin-top: 40px;"
|
||||
v-if="ec.hasModel"
|
||||
:is="ec.component"
|
||||
v-bind="ec.props"
|
||||
v-model="dataForm[ec.name]"
|
||||
@ready="handleEditorReady"
|
||||
:read-only="isDetail"
|
||||
/>
|
||||
<!-- <component v-if="ec.hasModel" :is="ec.component" v-bind="ec.props" v-model="dataForm[ec.name]" /> -->
|
||||
<component
|
||||
v-else
|
||||
:is="ec.component"
|
||||
v-bind="ec.props"
|
||||
@uploader-update-filelist="handleUploadListUpdate($event, ec.props.extraParams.typeCode)"
|
||||
:uploader-inject-file-list="/*用于设备分流的*/ fileList[ec.props.extraParams.typeCode]"
|
||||
:read-only="isDetail"
|
||||
/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-form>
|
||||
|
||||
<template v-if="dataForm.id && configs.subtable">
|
||||
<attr-form :related-id="dataForm.id" v-bind="configs.subtable" :is-detail="isDetail" />
|
||||
</template>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<template v-for="(operate, index) in configs.operations">
|
||||
<!-- {{ operate.name | btnNameFilter }} -->
|
||||
<el-button
|
||||
v-if="
|
||||
!isDetail &&
|
||||
(operate.showAlways ||
|
||||
(((dataForm.id && operate.showOnEdit) || (!dataForm.id && !operate.showOnEdit)) && (operate.permission ? $hasPermission(operate.permission) : true)))
|
||||
"
|
||||
:key="`operate-${index}`"
|
||||
:type="btnType[operate.name]"
|
||||
@click="handleClick(operate)"
|
||||
>{{ btnName[operate.name] }}</el-button
|
||||
>
|
||||
</template>
|
||||
<el-button v-if="isDetail" @click="handleClick({ name: 'cancel' })">返回</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AttrForm from '../AttrForm'
|
||||
import { pick } from 'lodash/object'
|
||||
|
||||
// 标题 for i18n
|
||||
const title = {
|
||||
detail: '详情',
|
||||
add: '新增',
|
||||
edit: '编辑'
|
||||
}
|
||||
|
||||
// 或者也可以改造成自定义颜色:
|
||||
const btnType = {
|
||||
save: 'success',
|
||||
update: 'primary',
|
||||
reset: 'text'
|
||||
// cancel: 'text'
|
||||
// add more...
|
||||
}
|
||||
|
||||
const btnName = {
|
||||
// for i18n
|
||||
save: '保存',
|
||||
update: '更新',
|
||||
reset: '重置',
|
||||
cancel: '取消'
|
||||
// add more...
|
||||
}
|
||||
|
||||
// 每行的列数
|
||||
const COLUMN_PER_ROW = 2
|
||||
|
||||
export default {
|
||||
name: 'AddOrUpdateDialog',
|
||||
components: { AttrForm },
|
||||
props: {
|
||||
configs: {
|
||||
/**
|
||||
* TODO: 定义及使用方式,应改用README.md文件记录
|
||||
* type: 'dialog' | 'drawer' | 'page'
|
||||
* fields: Array<string|object>
|
||||
* - fields.object: { name, type: 'number'|'textarea'|'select'|'date'|.., required: boolean, validator: boolean(是否需要验证), [options]: any[], api: string(自动获取数据的接口,一般为getcode接口)}
|
||||
* operations: Array[object], 操作名和对应的接口地址,还有permission(如,sys:dict:update)
|
||||
*/
|
||||
type: Object,
|
||||
default: () => ({}) // 此处省去类型检查,使用者自行注意就好
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
nameFilter: function(name) {
|
||||
if (!name) return null
|
||||
// for i18n
|
||||
const defaultNames = {
|
||||
name: '名称',
|
||||
code: '编码',
|
||||
remark: '备注',
|
||||
description: '描述',
|
||||
specifications: '规格'
|
||||
// add more...
|
||||
}
|
||||
|
||||
return defaultNames[name]
|
||||
}
|
||||
},
|
||||
// provide() {
|
||||
// return {
|
||||
// _df: this.dataForm
|
||||
// }
|
||||
// },
|
||||
data() {
|
||||
return {
|
||||
COLUMN_PER_ROW,
|
||||
title,
|
||||
/** 按钮相关属性 */
|
||||
btnName,
|
||||
btnType,
|
||||
defaultNames: {
|
||||
name: '名称',
|
||||
code: '编码',
|
||||
remark: '备注',
|
||||
description: '描述',
|
||||
specifications: '规格'
|
||||
// add more...
|
||||
},
|
||||
defaultPlaceholders: {}, // 自动根据 defaultNames 计算得来
|
||||
/** 表单相关属性 */
|
||||
visible: false,
|
||||
isEdit: false,
|
||||
isDetail: false,
|
||||
dataForm: {},
|
||||
dataFormRules: {},
|
||||
tempForm: [], // 临时保存自动生成的code,或其他数据
|
||||
shouldWait: null,
|
||||
fileForm: {}, // 文件上传分流用、合并用的表单,根据 typeCode 进行分流,在请求时合并
|
||||
fileList: {} // 文件加载时分流,依据 typeCode
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
rows() {
|
||||
// 本组件只实现了'一行两列'的表单布局
|
||||
return Math.ceil(this.configs.fields.length / COLUMN_PER_ROW)
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
/** 计算 defaultPlaceholders */
|
||||
const prefix = '请输入'
|
||||
Object.entries(this.defaultNames).map(([key, value]) => {
|
||||
this.defaultPlaceholders[key] = prefix + value
|
||||
})
|
||||
|
||||
/** 转换 configs.fields 的结构,把纯字符串转为对象 */
|
||||
this.$nextTick(() => {
|
||||
this.configs.fields = this.configs.fields.map(item => {
|
||||
if (typeof item === 'string') {
|
||||
return { name: item }
|
||||
}
|
||||
return item
|
||||
})
|
||||
|
||||
/** 动态设置dataForm字段 */
|
||||
this.configs.fields.forEach(item => {
|
||||
this.$set(this.dataForm, [item.name], '')
|
||||
|
||||
/** select 的默认值设置 */
|
||||
if (item.type === 'select') {
|
||||
const opts = item.options || []
|
||||
const dft = opts.find(item => item.default || false)
|
||||
if (dft) {
|
||||
this.$set(this.dataForm, [item.name], dft.value)
|
||||
}
|
||||
}
|
||||
|
||||
if (item.api) {
|
||||
/** 自动请求并填充 */
|
||||
// or this.shouldWaitPool = []
|
||||
this.shouldWait = this.$http({
|
||||
url: this.$http.adornUrl(item.api),
|
||||
method: 'POST' // 也可以改成动态决定
|
||||
}).then(({ data: res }) => {
|
||||
if (res && res.code === 0) {
|
||||
// this.dataForm[item.name] = res.data // <=== 此处需要对接口
|
||||
this.tempForm.push({ name: item.name, data: res.data })
|
||||
}
|
||||
})
|
||||
} // end if (item.api)
|
||||
|
||||
if (item.required) {
|
||||
const requiredRule = {
|
||||
required: true,
|
||||
message: '请输入必填项',
|
||||
trigger: 'change'
|
||||
}
|
||||
/** 检查是否已经存在该字段的规则 */
|
||||
const exists = this.dataFormRules[item.name] || null
|
||||
/** 设置验证规则 */
|
||||
if (exists) {
|
||||
const unset = true
|
||||
for (const rule of exists) {
|
||||
if (rule.required) unset = false
|
||||
}
|
||||
if (unset) {
|
||||
exists.push(requiredRule)
|
||||
}
|
||||
} else {
|
||||
/** 不存在已有规则 */
|
||||
this.$set(this.dataFormRules, [item.name], [requiredRule])
|
||||
}
|
||||
} // end if (item.required)
|
||||
|
||||
if (item.rules) {
|
||||
const exists = this.dataFormRules[item.name] || null
|
||||
if (exists) {
|
||||
// 浅拷贝过去
|
||||
exists.push(...item.rules)
|
||||
} else {
|
||||
this.$set(this.dataFormRules, [item.name], [...item.rules])
|
||||
}
|
||||
} // end if (item.rules)
|
||||
})
|
||||
|
||||
/** 计算默认值 */
|
||||
function calDefault(type) {
|
||||
switch (type) {
|
||||
case 'array':
|
||||
return []
|
||||
// more case...
|
||||
default:
|
||||
return ''
|
||||
}
|
||||
}
|
||||
/** 检查是否需要额外的组件 */
|
||||
this.configs.extraComponents &&
|
||||
this.configs.extraComponents.forEach(item => {
|
||||
if (Object.hasOwn(this.dataForm, [item.name])) {
|
||||
console.log('有了!')
|
||||
return
|
||||
} else {
|
||||
console.log('新建!')
|
||||
this.$set(this.dataForm, [item.name], calDefault(item.fieldType))
|
||||
}
|
||||
|
||||
console.log('component: ', item.component)
|
||||
})
|
||||
|
||||
/** 单独设置 id */
|
||||
this.$set(this.dataForm, 'id', null)
|
||||
console.log('mounted: this.dataForm', JSON.stringify(this.dataForm))
|
||||
})
|
||||
},
|
||||
|
||||
methods: {
|
||||
getSpan(n, c) {
|
||||
const opt = this.configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)]
|
||||
return opt && opt.span ? opt.span : 24 / COLUMN_PER_ROW
|
||||
},
|
||||
|
||||
getLabel(n, c) {
|
||||
const opt = this.configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)]
|
||||
if (opt) {
|
||||
// if opt is valid
|
||||
return opt.label ? opt.label : this.defaultNames[opt.name]
|
||||
}
|
||||
},
|
||||
|
||||
getPlaceholder(n, c) {
|
||||
const opt = this.configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)]
|
||||
if (opt) {
|
||||
// if opt is valid
|
||||
return opt.placeholder
|
||||
? opt.placeholder
|
||||
: this.defaultPlaceholders[opt.name]
|
||||
? this.defaultPlaceholders[opt.name]
|
||||
: opt.label
|
||||
? (opt.type === 'select' ? '请选择' : '请输入') + opt.label
|
||||
: null
|
||||
|
||||
// : opt.type === 'select'
|
||||
// ? '请选择'
|
||||
// : '请输入'
|
||||
}
|
||||
},
|
||||
|
||||
getType(n, c) {
|
||||
const opt = this.configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)]
|
||||
if (opt) {
|
||||
if (!opt.type || ['input', 'number' /** add more.. */].includes(opt.type)) {
|
||||
return 'input'
|
||||
} else if (['select' /** add more.. */].includes(opt.type)) {
|
||||
return 'select'
|
||||
} else if (['cascader'].includes(opt.type)) {
|
||||
return 'cascader'
|
||||
} else if (['date'].includes(opt.type)) {
|
||||
return 'date'
|
||||
}
|
||||
// add more...
|
||||
} else {
|
||||
return 'input'
|
||||
}
|
||||
},
|
||||
|
||||
init(id, isdetail = false) {
|
||||
this.isDetail = isdetail
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
this.dataForm.id = id || null
|
||||
if (this.dataForm.id) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`${this.configs.infoUrl}/${this.dataForm.id}`),
|
||||
method: 'get'
|
||||
}).then(({ data: res }) => {
|
||||
if (res && res.code === 0) {
|
||||
const dataFormKeys = Object.keys(this.dataForm)
|
||||
console.log('data form keys: ', dataFormKeys, pick(res.data, dataFormKeys))
|
||||
this.dataForm = pick(res.data, dataFormKeys)
|
||||
|
||||
// LABEL: FILE_RELATED
|
||||
/** 对文件下载进行分流 */
|
||||
this.fileList = {}
|
||||
if (this.dataForm.files) {
|
||||
console.log('files: ', this.dataForm.files)
|
||||
this.dataForm.files.forEach(file => {
|
||||
// const fileName = file.fileUrl.split('/').pop()
|
||||
/** [1] 处理 fileList */
|
||||
if (Object.hasOwn(this.fileList, file.typeCode)) {
|
||||
/** 已存在 */
|
||||
// this.fileList[file.typeCode].push({ id: file.id, name: fileName, typeCode: file.typeCode })
|
||||
this.fileList[file.typeCode].push(file)
|
||||
} else {
|
||||
// this.fileList[file.typeCode] = [{ id: file.id, name: fileName, typeCode: file.typeCode }]
|
||||
this.fileList[file.typeCode] = [file]
|
||||
}
|
||||
|
||||
/** [2] 处理 fileForm */
|
||||
if (Object.hasOwn(this.fileForm, file.typeCode)) {
|
||||
this.fileForm[file.typeCode].push(file.id)
|
||||
} else {
|
||||
this.fileForm[file.typeCode] = [file.id]
|
||||
}
|
||||
})
|
||||
console.log('after分流:', this.fileList)
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
/** 如果不是编辑,就填充自动生成的数据 */
|
||||
if (this.shouldWait)
|
||||
this.shouldWait.then(() => {
|
||||
if (this.tempForm.length) {
|
||||
console.log('create new, tempform', JSON.stringify(this.tempForm.length))
|
||||
this.tempForm.forEach(item => {
|
||||
console.log('item data', item.data)
|
||||
this.dataForm[item.name] = item.data
|
||||
})
|
||||
console.log('create new, dataform', JSON.stringify(this.dataForm))
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
emitSelectChange(name, id) {
|
||||
this.$emit('select-change', { name, id })
|
||||
},
|
||||
|
||||
handleEditorReady(val) {
|
||||
console.log('editor rready..', val)
|
||||
},
|
||||
|
||||
handleClick(btn) {
|
||||
/** 提取url */
|
||||
const urls = {}
|
||||
this.configs.operations.map(item => {
|
||||
urls[item.name] = {}
|
||||
urls[item.name].url = item.url
|
||||
urls[item.name].extraFields = item.extraFields || {}
|
||||
})
|
||||
/** 操作 */
|
||||
switch (btn.name) {
|
||||
case 'save':
|
||||
case 'update':
|
||||
/** 需要验证表单的操作 */
|
||||
this.$refs['dataForm'].validate(valid => {
|
||||
if (valid) {
|
||||
/** 对于文件上传的单独处理(合并处理) */
|
||||
if (Object.keys(this.fileForm).length) {
|
||||
console.log('fileform 有值')
|
||||
// LABEL: FILE_RELATED
|
||||
let fileIds = []
|
||||
for (const [key, item] of Object.entries(this.fileForm)) {
|
||||
if (Array.isArray(item)) {
|
||||
fileIds = fileIds.concat(item)
|
||||
} else {
|
||||
console.error('handleClick(): 上传文件数组类型不正确')
|
||||
}
|
||||
}
|
||||
this.$set(this.dataForm, 'fileIds', fileIds)
|
||||
}
|
||||
|
||||
console.log('before send: ', this.dataForm)
|
||||
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(urls[btn.name].url),
|
||||
method: btn.name === 'save' ? 'POST' : 'PUT',
|
||||
data: { ...this.dataForm, ...urls[btn.name].extraFields }
|
||||
})
|
||||
.then(({ data: res }) => {
|
||||
if (res && res.code === 0) {
|
||||
this.$message({
|
||||
message: btn.name === 'save' ? '添加成功!' : '更新成功!',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.$emit('refreshDataList')
|
||||
this.visible = false
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(res.msg)
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.$message({
|
||||
message: err,
|
||||
type: 'error',
|
||||
duration: 2000
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
return
|
||||
case 'reset':
|
||||
for (const key of Object.keys(this.dataForm)) {
|
||||
if (typeof this.dataForm[key] === 'string') {
|
||||
this.dataForm[key] = ''
|
||||
} else if (this.dataForm[key] instanceof Array) {
|
||||
this.dataForm[key].splice(0)
|
||||
} else {
|
||||
this.dataForm[key] = null
|
||||
}
|
||||
}
|
||||
break
|
||||
case 'cancel':
|
||||
this.visible = false
|
||||
// add more..
|
||||
}
|
||||
},
|
||||
|
||||
// LABEL: FILE_RELATED
|
||||
handleUploadListUpdate(filelist, typeCode = 'DefaultTypeCode') {
|
||||
console.log('before handleUploadListUpdate(): ', JSON.parse(JSON.stringify(this.fileForm)))
|
||||
// 设备类型 typeCode: EquipmentTypeFile
|
||||
// 设备信息 typeCode: EquipmentInfoFile | EquipmentInfoImage
|
||||
|
||||
// 原先写法:直接更新 dataForm 对象,不适用于有多个上传组件的需求
|
||||
// this.$set(
|
||||
// this.dataForm,
|
||||
// 'fileIds',
|
||||
// filelist.map(item => item.id)
|
||||
// )
|
||||
// console.log('handleUploadListUpdate(): ', this.dataForm)
|
||||
// 现更改为分流写法
|
||||
this.$set(
|
||||
this.fileForm,
|
||||
typeCode,
|
||||
filelist.map(item => item.id)
|
||||
)
|
||||
console.log('after handleUploadListUpdate(): ', this.fileForm)
|
||||
},
|
||||
|
||||
handleClose() {
|
||||
this.$emit('destory-dialog')
|
||||
this.visible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.super-flexible-dialog >>> .el-select,
|
||||
.super-flexible-dialog >>> .el-cascader {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.super-flexible-dialog >>> ::-webkit-scrollbar {
|
||||
width: 4px;
|
||||
border-radius: 4px;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.super-flexible-dialog >>> ::-webkit-scrollbar-thumb {
|
||||
width: 4px;
|
||||
border-radius: 4px;
|
||||
background: #ccc;
|
||||
}
|
||||
|
||||
.super-flexible-dialog >>> .hidden-input {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
36
src/components/base-table/components/detailComponent.js
Normal file
36
src/components/base-table/components/detailComponent.js
Normal file
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* @Author: lb
|
||||
* @CreateDate: 2022.8.8
|
||||
* @Modifier:
|
||||
* @ModifiedDate:
|
||||
* 表格里的文本组件
|
||||
* 一般用途:展示查看详情入口
|
||||
*/
|
||||
export default {
|
||||
name: 'TableTextComponent',
|
||||
props: {
|
||||
injectData: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// for i18n inject:
|
||||
defaultText: '查看详情'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
emitClick() {
|
||||
console.log('inject data:' ,this.injectData)
|
||||
this.$emit('emit-data', {
|
||||
type: this.injectData.head?.actionName || 'view-detail-action',
|
||||
data: this.injectData.head?.emitFullData ? this.injectData : this.injectData.id
|
||||
})
|
||||
}
|
||||
},
|
||||
render: function (h) {
|
||||
// console.log(this)
|
||||
return h('span', null, [h('el-button', { props: { type: 'text' }, style: { paddingLeft: 0 }, on: { click: this.emitClick } }, this.injectData.buttonContent || this.defaultText)])
|
||||
}
|
||||
}
|
||||
53
src/components/base-table/components/operationComponent.js
Normal file
53
src/components/base-table/components/operationComponent.js
Normal file
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* @Author: lb
|
||||
* @CreateDate: 2022.8.8
|
||||
* @Modifier:
|
||||
* @ModifiedDate:
|
||||
* 表格里的操作组件
|
||||
* 一般用途:展示添加删除按钮
|
||||
*/
|
||||
export default {
|
||||
name: 'TableOperations',
|
||||
props: {
|
||||
injectData: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
btnTypes: {
|
||||
add: 'primary',
|
||||
delete: 'danger',
|
||||
detail: 'info'
|
||||
// add more...
|
||||
},
|
||||
colors: {
|
||||
delete: '#FF5454',
|
||||
// add more...
|
||||
},
|
||||
text: {
|
||||
// TODO: i18n
|
||||
edit: '编辑',
|
||||
detail: '详情',
|
||||
delete: '删除',
|
||||
viewAttr: '查看属性'
|
||||
// add more...
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 发射事件
|
||||
emit(eventType) {
|
||||
this.$emit('emit-data', { type: eventType, data: this.injectData.head?.emitFullData ? this.injectData : this.injectData.id })
|
||||
}
|
||||
},
|
||||
render: function (h) {
|
||||
let btns = []
|
||||
for (const optionStr of this.injectData.head?.options) {
|
||||
// btns.push(h('el-button', { props: { type: this.btnTypes[optionStr] } }, optionStr))
|
||||
btns.push(h('el-button', { props: { type: 'text' }, style: { color: this.colors[optionStr] || '#409EFF' }, on: { click: this.emit.bind(null, optionStr) } }, this.text[optionStr]))
|
||||
}
|
||||
return h('span', null, btns)
|
||||
}
|
||||
}
|
||||
74
src/components/base-table/index.vue
Normal file
74
src/components/base-table/index.vue
Normal file
@@ -0,0 +1,74 @@
|
||||
<template>
|
||||
<div class="base-table">
|
||||
<el-table :data="data" style="width: 100%" fit border :header-cell-style="{ background: '#FAFAFA', color: '#606266', height: '40px' }" :max-height="maxHeight">
|
||||
<!-- 表格头定义 -->
|
||||
<template v-for="(head, idx) in tableHeadConfigs">
|
||||
<!-- 带type的表头 -->
|
||||
<el-table-column
|
||||
:key="idx"
|
||||
v-if="head.type"
|
||||
:type="head.type"
|
||||
:label="head.label || head.name || ''"
|
||||
:header-align="head.align || 'center'"
|
||||
:align="head.align || 'center'"
|
||||
:width="head.width || 50"
|
||||
v-bind="head.more"
|
||||
></el-table-column>
|
||||
<!-- 普通的表头 -->
|
||||
<el-table-column
|
||||
v-else
|
||||
:key="idx+'else'"
|
||||
:label="head.label ? head.label : head.name"
|
||||
:prop="head.prop"
|
||||
:width="head.width"
|
||||
:min-width="head.minWidth"
|
||||
:fixed="head.fixed"
|
||||
:show-overflow-tooltip="head.showOverflowTooltip || false"
|
||||
filter-placement="top"
|
||||
:align="head.align"
|
||||
v-bind="head.more"
|
||||
>
|
||||
<!-- 子组件 -->
|
||||
<template v-if="head.prop" slot-scope="scope">
|
||||
<component v-if="head.subcomponent" :is="head.subcomponent" :key="idx + 'sub'" :inject-data="{ ...scope.row, head }" @emit-data="handleSubEmitData" />
|
||||
<!-- 直接展示数据或应用过滤器 -->
|
||||
<span v-else>{{ scope.row[head.prop] | commonFilter(head.filter) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
</el-table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'BaseTable',
|
||||
props: {
|
||||
tableHeadConfigs: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
data: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
maxHeight: {
|
||||
type: Number,
|
||||
default: 500
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
commonFilter: (source, filterType = a => a) => {
|
||||
return filterType(source)
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {}
|
||||
},
|
||||
methods: {
|
||||
handleSubEmitData(payload) {
|
||||
this.$emit('operate-event', payload)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
197
src/components/base-upload/index.vue
Normal file
197
src/components/base-upload/index.vue
Normal file
@@ -0,0 +1,197 @@
|
||||
<template>
|
||||
<div class="base-upload" style="border-radius: 8px; margin-top: 38px; padding: 0; max-height: 500px;">
|
||||
<el-upload
|
||||
class="yd-upload"
|
||||
action="#"
|
||||
:http-request="handleUpload"
|
||||
multiple
|
||||
:file-list="fileList"
|
||||
:on-preview="handleDownload"
|
||||
:on-remove="handleRemove"
|
||||
:before-upload="/.*?image.*?/i.test(extraParams.typeCode) ? validateImage : validateFile"
|
||||
>
|
||||
<!-- :before-remove="beforeRemove" -->
|
||||
<!-- accept="image/*" -->
|
||||
<!-- <el-upload class="yd-upload" :action="$http.adornUrl(url)" multiple name="files" :data="extraParams" :file-list="fileList" :on-remove="handleRemove" :before-remove="beforeRemove"> -->
|
||||
<el-button :disabled="readOnly" size="small" type="primary">{{ buttonContent }}</el-button>
|
||||
<div v-if="tip" slot="tip" class="el-upload__tip">{{ tip }}</div>
|
||||
</el-upload>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { pick } from 'lodash/object'
|
||||
|
||||
export default {
|
||||
name: 'BaseUpload',
|
||||
props: {
|
||||
url: String,
|
||||
buttonContent: String,
|
||||
tip: {
|
||||
type: String,
|
||||
default: null
|
||||
},
|
||||
extraParams: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
uploaderInjectFileList: {
|
||||
// 从外部传进来 fileList,用于展示文件列表用
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
readOnly: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
// inject: {
|
||||
// parentDataForm: "_df"
|
||||
// },
|
||||
data() {
|
||||
return {
|
||||
fileList: []
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.fileList.splice(0)
|
||||
|
||||
this.$watch('uploaderInjectFileList', function(val) {
|
||||
if (val && val.length) {
|
||||
console.log('this.uploaderInjectFileList', this.uploaderInjectFileList)
|
||||
/** uploaderInjectFileList 里关于文件的信息比较全,需要手动过滤一下 */
|
||||
this.fileList = val.map(item => {
|
||||
const name = item.fileUrl.split('/').pop()
|
||||
return { ...pick(item, ['id', 'fileName', 'typeCode']), name }
|
||||
})
|
||||
}
|
||||
console.log('fillist: ', this.fileList)
|
||||
})
|
||||
|
||||
// if (this.parentDataForm) {
|
||||
// console.log('parent dataform: ', this.parentDataForm)
|
||||
// }
|
||||
},
|
||||
methods: {
|
||||
/** 自定义上传行为 */
|
||||
handleUpload(file) {
|
||||
const formData = new FormData()
|
||||
let files = file.file
|
||||
formData.append('files', files)
|
||||
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(this.url),
|
||||
method: 'POST',
|
||||
data: formData,
|
||||
params: {
|
||||
typeCode: this.extraParams.typeCode
|
||||
}
|
||||
}).then(({ data: res }) => {
|
||||
if (res && res.code === 0) {
|
||||
res.data.forEach(item => {
|
||||
const ext = item.fileUrl.split('.').reverse()[0]
|
||||
const name = `${item.fileName}.${ext}`
|
||||
this.fileList.push({ ...pick(item, ['id', 'fileName', 'typeCode']), name })
|
||||
})
|
||||
// TODO: 在新增和更新阶段,带入 fileIds[] 数组给后端,就可完成文件和设备类型的绑定、删除操作
|
||||
this.$emit('uploader-update-filelist', this.fileList)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/** 大小验证,由配置文件开启 */
|
||||
validateFile(file) {
|
||||
console.log('[*] 验证文件大小')
|
||||
|
||||
const isRightSize = file.size / 1024 / 1024 < 2
|
||||
if (!isRightSize) {
|
||||
// this.$message.error(this.$t('upload.picSizeAlarm'))
|
||||
this.$message.error('文件不应超过 2MB')
|
||||
}
|
||||
return isRightSize
|
||||
},
|
||||
|
||||
/** 图片验证,由配置文件开启 */
|
||||
validateImage(file) {
|
||||
console.log('[*] 验证图片')
|
||||
|
||||
const isRightSize = file.size / 1024 / 1024 < 2
|
||||
if (!isRightSize) {
|
||||
this.$message.error('文件不应超过 2MB')
|
||||
// this.$message.error(this.$t('upload.picSizeAlarm'))
|
||||
}
|
||||
|
||||
const isAccept = new RegExp('image/*').test(file.type)
|
||||
if (!isAccept) {
|
||||
// this.$message.error(this.$t('upload.picAlarm'))
|
||||
this.$message.error('只允许上传图片')
|
||||
}
|
||||
return isRightSize && isAccept
|
||||
},
|
||||
|
||||
/** 点击下载 */
|
||||
handleDownload({ id: fileId, name: fileName }) {
|
||||
const type = {
|
||||
download: 1,
|
||||
preview: 0
|
||||
}
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/attachment/downloadFile'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
attachmentId: fileId,
|
||||
type: type.download
|
||||
// fileName,
|
||||
// outputQuality,
|
||||
// scale
|
||||
}),
|
||||
responseType: 'blob'
|
||||
}).then(({ data: res }) => {
|
||||
const blob = new Blob([res])
|
||||
console.log('blob', blob)
|
||||
if ('download' in document.createElement('a')) {
|
||||
const alink = document.createElement('a')
|
||||
console.log('filename: ', fileName)
|
||||
alink.download = fileName
|
||||
alink.style.display = 'none'
|
||||
alink.target = '_blank'
|
||||
alink.href = URL.createObjectURL(blob)
|
||||
console.log('下载地址:', alink.href)
|
||||
document.body.appendChild(alink)
|
||||
alink.click()
|
||||
URL.revokeObjectURL(alink.href)
|
||||
document.body.removeChild(alink)
|
||||
} else {
|
||||
navigator.msSaveBlob(blob, fileName)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// beforeRemove(file, filelist) {
|
||||
// return this.$confirm(`确定移除 ${file.name}?`)
|
||||
// },
|
||||
|
||||
handleRemove(file, filelist) {
|
||||
// 把更新后的 fileList 传递出去
|
||||
this.$emit('uploader-update-filelist', filelist)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.base-upload >>> .yd-upload {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.base-upload >>> .el-upload--text {
|
||||
width: 100px;
|
||||
position: relative;
|
||||
left: -72px;
|
||||
}
|
||||
|
||||
.base-upload >>> .el-upload__tip {
|
||||
margin-top: 0;
|
||||
margin-left: 5px;
|
||||
}
|
||||
</style>
|
||||
@@ -76,7 +76,7 @@ export default {
|
||||
return data.name.indexOf(value) !== -1
|
||||
},
|
||||
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) {
|
||||
return this.$message.error(res.msg)
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ export default {
|
||||
return data.name.indexOf(value) !== -1
|
||||
},
|
||||
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) {
|
||||
return this.$message.error(res.msg)
|
||||
}
|
||||
|
||||
67
src/components/small-title/index.vue
Normal file
67
src/components/small-title/index.vue
Normal file
@@ -0,0 +1,67 @@
|
||||
<!--
|
||||
* @Author: lb
|
||||
* @Date: 2022-05-18 16:00:00
|
||||
* @LastEditors: lb
|
||||
* @LastEditTime: 2022-05-18 16:00:00
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<div :class="[className, { 'p-0': noPadding }]">
|
||||
<slot />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
size: {
|
||||
// 取值范围: xl lg md sm
|
||||
type: String,
|
||||
default: 'de',
|
||||
validator: function(val) {
|
||||
return ['xl', 'lg', 'de', 'md', 'sm'].indexOf(val) !== -1
|
||||
}
|
||||
},
|
||||
noPadding: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
className: function() {
|
||||
return `${this.size}-title`
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
$pxls: (xl, 28px) (lg, 24px) (de, 22px) (md, 18px) (sm, 16px);
|
||||
$mgr: 6px;
|
||||
@each $size, $height in $pxls {
|
||||
.#{$size}-title {
|
||||
padding: 8px 0;
|
||||
font-size: $height;
|
||||
line-height: $height;
|
||||
color: #000;
|
||||
font-weight: 500;
|
||||
font-family: '微软雅黑', 'Microsoft YaHei', Arial, Helvetica, sans-serif;
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
width: 4px;
|
||||
height: $height + 2px;
|
||||
border-radius: 1px;
|
||||
margin-right: $mgr;
|
||||
// background-color: #0b58ff;
|
||||
background-color: #409EFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.p-0 {
|
||||
padding: 0;
|
||||
}
|
||||
</style>
|
||||
@@ -15,6 +15,7 @@ export const messages = {
|
||||
}
|
||||
|
||||
export default new VueI18n({
|
||||
locale: Cookies.get('language') || 'zh-CN',
|
||||
// locale: Cookies.get('language') || 'zh-CN',
|
||||
locale: 'zh-CN', // 先默认中文
|
||||
messages
|
||||
})
|
||||
|
||||
@@ -31,6 +31,10 @@ Vue.use(renRegionTree)
|
||||
Vue.prototype.$http = http
|
||||
Vue.prototype.$hasPermission = hasPermission
|
||||
Vue.prototype.$getDictLabel = getDictLabel
|
||||
// is auth
|
||||
Vue.prototype.isAuth = permission => {
|
||||
return "正在检查的权限是:" + permission
|
||||
}
|
||||
|
||||
// 保存整站vuex本地储存初始状态
|
||||
window.SITE_CONFIG['storeState'] = cloneDeep(store.state)
|
||||
|
||||
24
src/mixins/dictlist-module.js
Normal file
24
src/mixins/dictlist-module.js
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
dictList: {}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
initDictList(dictTypeIdList) {
|
||||
const allDictList = JSON.parse(localStorage.getItem('dictList'))
|
||||
if (!Object.keys(allDictList).length) {
|
||||
return this.$message({
|
||||
// TODO: i18n
|
||||
message: '未能获取数据字典',
|
||||
type: 'error',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
dictTypeIdList.forEach(id => {
|
||||
this.dictList[id] = allDictList[id].map(item => ({ label: item.dictLabel, value: item.dictValue }))
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import Cookies from 'js-cookie'
|
||||
import qs from 'qs'
|
||||
export default {
|
||||
data () {
|
||||
data() {
|
||||
/* eslint-disable */
|
||||
return {
|
||||
// 设置属性
|
||||
@@ -29,22 +29,24 @@ export default {
|
||||
}
|
||||
/* eslint-enable */
|
||||
},
|
||||
created () {
|
||||
created() {
|
||||
if (this.mixinViewModuleOptions.createdIsNeed) {
|
||||
this.query()
|
||||
}
|
||||
},
|
||||
activated () {
|
||||
activated() {
|
||||
if (this.mixinViewModuleOptions.activatedIsNeed) {
|
||||
this.query()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 获取数据列表
|
||||
query () {
|
||||
query() {
|
||||
this.dataListLoading = true
|
||||
this.$http.get(
|
||||
this.mixinViewModuleOptions.getDataListURL,
|
||||
this.$http.adornUrl(
|
||||
this.mixinViewModuleOptions.getDataListURL
|
||||
),
|
||||
{
|
||||
params: {
|
||||
order: this.order,
|
||||
@@ -68,11 +70,11 @@ export default {
|
||||
})
|
||||
},
|
||||
// 多选
|
||||
dataListSelectionChangeHandle (val) {
|
||||
dataListSelectionChangeHandle(val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
// 排序
|
||||
dataListSortChangeHandle (data) {
|
||||
dataListSortChangeHandle(data) {
|
||||
if (!data.order || !data.prop) {
|
||||
this.order = ''
|
||||
this.orderField = ''
|
||||
@@ -83,13 +85,13 @@ export default {
|
||||
this.query()
|
||||
},
|
||||
// 分页, 每页条数
|
||||
pageSizeChangeHandle (val) {
|
||||
pageSizeChangeHandle(val) {
|
||||
this.page = 1
|
||||
this.limit = val
|
||||
this.query()
|
||||
},
|
||||
// 分页, 当前页
|
||||
pageCurrentChangeHandle (val) {
|
||||
pageCurrentChangeHandle(val) {
|
||||
this.page = val
|
||||
this.query()
|
||||
},
|
||||
@@ -98,7 +100,7 @@ export default {
|
||||
this.query()
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle (id) {
|
||||
addOrUpdateHandle(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.dataForm.id = id
|
||||
@@ -106,7 +108,7 @@ export default {
|
||||
})
|
||||
},
|
||||
// 关闭当前窗口
|
||||
closeCurrentTab (data) {
|
||||
closeCurrentTab(data) {
|
||||
var tabName = this.$store.state.contentTabsActiveName
|
||||
this.$store.state.contentTabs = this.$store.state.contentTabs.filter(item => item.name !== tabName)
|
||||
if (this.$store.state.contentTabs.length <= 0) {
|
||||
@@ -118,7 +120,7 @@ export default {
|
||||
}
|
||||
},
|
||||
// 删除
|
||||
deleteHandle (id) {
|
||||
deleteHandle(id) {
|
||||
if (this.mixinViewModuleOptions.deleteIsBatch && !id && this.dataListSelections.length <= 0) {
|
||||
return this.$message({
|
||||
message: this.$t('prompt.deleteBatch'),
|
||||
@@ -132,7 +134,7 @@ export default {
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http.delete(
|
||||
`${this.mixinViewModuleOptions.deleteURL}${this.mixinViewModuleOptions.deleteIsBatch ? '' : '/' + id}`,
|
||||
this.$http.adornUrl(`${this.mixinViewModuleOptions.deleteURL}${this.mixinViewModuleOptions.deleteIsBatch ? '' : '/' + id}`),
|
||||
this.mixinViewModuleOptions.deleteIsBatch ? {
|
||||
'data': id ? [id] : this.dataListSelections.map(item => item[this.mixinViewModuleOptions.deleteIsBatchKey])
|
||||
} : {}
|
||||
@@ -148,11 +150,11 @@ export default {
|
||||
this.query()
|
||||
}
|
||||
})
|
||||
}).catch(() => {})
|
||||
}).catch(() => {})
|
||||
}).catch(() => { })
|
||||
}).catch(() => { })
|
||||
},
|
||||
// 导出
|
||||
exportHandle () {
|
||||
exportHandle() {
|
||||
var params = qs.stringify({
|
||||
'token': Cookies.get('token'),
|
||||
...this.dataForm
|
||||
|
||||
@@ -2,6 +2,7 @@ import Vue from 'vue'
|
||||
import Router from 'vue-router'
|
||||
import http from '@/utils/request'
|
||||
import { isURL } from '@/utils/validate'
|
||||
import Cookies from 'js-cookie'
|
||||
|
||||
Vue.use(Router)
|
||||
|
||||
@@ -12,7 +13,7 @@ export const pageRoutes = [
|
||||
component: () => import('@/views/pages/404'),
|
||||
name: '404',
|
||||
meta: { title: '404未找到' },
|
||||
beforeEnter (to, from, next) {
|
||||
beforeEnter(to, from, next) {
|
||||
// 拦截处理特殊业务场景
|
||||
// 如果, 重定向路由包含__双下划线, 为临时添加路由
|
||||
if (/__.*/.test(to.redirectedFrom)) {
|
||||
@@ -21,7 +22,20 @@ export const pageRoutes = [
|
||||
next()
|
||||
}
|
||||
},
|
||||
{ path: '/login', component: () => import('@/views/pages/login'), name: 'login', meta: { title: '登录' } }
|
||||
{
|
||||
path: '/login',
|
||||
component: () => import('@/views/pages/login'),
|
||||
name: 'login',
|
||||
meta: { title: '登录' },
|
||||
beforeEnter(to, from, next) {
|
||||
if (Cookies.get('token')) {
|
||||
Vue.prototype.$message({ message:'已经登录过了', type: 'error' })
|
||||
next(false)
|
||||
} else {
|
||||
next()
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
// 模块路由(基于主入口布局页面)
|
||||
@@ -36,7 +50,7 @@ export const moduleRoutes = {
|
||||
]
|
||||
}
|
||||
|
||||
export function addDynamicRoute (routeParams, router) {
|
||||
export function addDynamicRoute(routeParams, router) {
|
||||
// 组装路由名称, 并判断是否已添加, 如是: 则直接跳转
|
||||
var routeName = routeParams.routeName
|
||||
var dynamicRoute = window.SITE_CONFIG['dynamicRoutes'].filter(item => item.name === routeName)[0]
|
||||
@@ -78,22 +92,25 @@ router.beforeEach((to, from, next) => {
|
||||
return next()
|
||||
}
|
||||
// 获取字典列表, 添加并全局变量保存
|
||||
http.get('/sys/dict/type/all').then(({ data: res }) => {
|
||||
http.get(http.adornUrl('/sys/dict/type/all')).then(({ data: res }) => {
|
||||
if (res.code !== 0) {
|
||||
return
|
||||
}
|
||||
window.SITE_CONFIG['dictList'] = res.data
|
||||
}).catch(() => {})
|
||||
}).catch((err) => {
|
||||
// console.log("catch /sys/dict/type/all", err)
|
||||
})
|
||||
// 获取菜单列表, 添加并全局变量保存
|
||||
http.get('/sys/menu/nav').then(({ data: res }) => {
|
||||
http.get(http.adornUrl('/sys/menu/nav')).then(({ data: res }) => {
|
||||
if (res.code !== 0) {
|
||||
Vue.prototype.$message.error(res.msg)
|
||||
return next({ name: 'login' })
|
||||
}
|
||||
console.log('menulist: ', res.data)
|
||||
window.SITE_CONFIG['menuList'] = res.data
|
||||
fnAddDynamicMenuRoutes(window.SITE_CONFIG['menuList'])
|
||||
next({ ...to, replace: true })
|
||||
}).catch(() => {
|
||||
}).catch((err) => {
|
||||
next({ name: 'login' })
|
||||
})
|
||||
})
|
||||
@@ -103,7 +120,7 @@ router.beforeEach((to, from, next) => {
|
||||
* @param {*} route 当前路由
|
||||
* @param {*} pageRoutes 页面路由
|
||||
*/
|
||||
function fnCurrentRouteIsPageRoute (route, pageRoutes = []) {
|
||||
function fnCurrentRouteIsPageRoute(route, pageRoutes = []) {
|
||||
var temp = []
|
||||
for (var i = 0; i < pageRoutes.length; i++) {
|
||||
if (route.path === pageRoutes[i].path) {
|
||||
@@ -121,7 +138,7 @@ function fnCurrentRouteIsPageRoute (route, pageRoutes = []) {
|
||||
* @param {*} menuList 菜单列表
|
||||
* @param {*} routes 递归创建的动态(菜单)路由
|
||||
*/
|
||||
function fnAddDynamicMenuRoutes (menuList = [], routes = []) {
|
||||
function fnAddDynamicMenuRoutes(menuList = [], routes = []) {
|
||||
var temp = []
|
||||
for (var i = 0; i < menuList.length; i++) {
|
||||
if (menuList[i].children && menuList[i].children.length >= 1) {
|
||||
|
||||
7
src/utils/filters.js
Normal file
7
src/utils/filters.js
Normal file
@@ -0,0 +1,7 @@
|
||||
/** filters */
|
||||
|
||||
export const dictFilter = dictTypeId => {
|
||||
return val => {
|
||||
return JSON.parse(localStorage.getItem('dictList'))[dictTypeId].find(item => item.dictValue === val)?.dictLabel || '-'
|
||||
}
|
||||
}
|
||||
@@ -73,7 +73,7 @@ export function getIconList () {
|
||||
}
|
||||
|
||||
/**
|
||||
* 树形数据转换
|
||||
* 树形数据转换,把扁平的数据,转换为树形结构的数据
|
||||
* @param {*} data
|
||||
* @param {*} id
|
||||
* @param {*} pid
|
||||
|
||||
@@ -4,6 +4,7 @@ import router from '@/router'
|
||||
import qs from 'qs'
|
||||
import { clearLoginInfo } from '@/utils'
|
||||
import isPlainObject from 'lodash/isPlainObject'
|
||||
import merge from 'lodash/merge'
|
||||
|
||||
const http = axios.create({
|
||||
baseURL: window.SITE_CONFIG['apiURL'],
|
||||
@@ -55,10 +56,52 @@ http.interceptors.response.use(response => {
|
||||
router.replace({ name: 'login' })
|
||||
return Promise.reject(response.data.msg)
|
||||
}
|
||||
// else if (response.data.code === 500) {
|
||||
// return Promise.reject(response.data.msg)
|
||||
// }
|
||||
return response
|
||||
}, error => {
|
||||
console.error(error)
|
||||
return Promise.reject(error)
|
||||
})
|
||||
|
||||
/**
|
||||
* 请求地址处理
|
||||
* @param {*} actionName action方法名称
|
||||
*/
|
||||
http.adornUrl = (actionName) => {
|
||||
// 非生产环境 && 开启代理, 接口前缀统一使用[/proxyApi/]前缀做代理拦截!
|
||||
return (process.env.NODE_ENV !== 'production' && process.env.OPEN_PROXY ? '/proxyApi/' : window.SITE_CONFIG.projURL) + actionName
|
||||
}
|
||||
|
||||
/**
|
||||
* get请求参数处理
|
||||
* @param {*} params 参数对象
|
||||
* @param {*} openDefultParams 是否开启默认参数?
|
||||
*/
|
||||
http.adornParams = (params = {}, openDefaultParams = true) => {
|
||||
var defaults = {
|
||||
't': new Date().getTime()
|
||||
}
|
||||
return openDefaultParams ? merge(defaults, params) : params
|
||||
}
|
||||
|
||||
/**
|
||||
* post请求数据处理
|
||||
* @param {*} data 数据对象
|
||||
* @param {*} openDefultdata 是否开启默认数据?
|
||||
* @param {*} contentType 数据格式
|
||||
* json: 'application/json; charset=utf-8'
|
||||
* form: 'application/x-www-form-urlencoded; charset=utf-8'
|
||||
*/
|
||||
http.adornData = (data = {}, openDefaultdata = true, contentType = 'json') => {
|
||||
var defaults = {
|
||||
't': new Date().getTime()
|
||||
}
|
||||
data = openDefaultdata ? merge(defaults, data) : data
|
||||
return contentType === 'raw' ? data : contentType === 'json' ? JSON.stringify(data) : qs.stringify(data)
|
||||
// return contentType === 'json' ? JSON.stringify(data, (_, v) => typeof v === 'bigint' ? v.toString() : v) : qs.stringify(data)
|
||||
}
|
||||
|
||||
|
||||
export default http
|
||||
|
||||
@@ -1,96 +1,96 @@
|
||||
<template>
|
||||
<main :class="['aui-content', { 'aui-content--tabs': $route.meta.isTab }]">
|
||||
<!-- tab展示内容 -->
|
||||
<template v-if="$route.meta.isTab">
|
||||
<el-dropdown class="aui-content--tabs-tools">
|
||||
<i class="el-icon-arrow-down"></i>
|
||||
<el-dropdown-menu slot="dropdown" :show-timeout="0">
|
||||
<el-dropdown-item @click.native="tabRemoveHandle($store.state.contentTabsActiveName)">{{ $t('contentTabs.closeCurrent') }}</el-dropdown-item>
|
||||
<el-dropdown-item @click.native="tabsCloseOtherHandle()">{{ $t('contentTabs.closeOther') }}</el-dropdown-item>
|
||||
<el-dropdown-item @click.native="tabsCloseAllHandle()">{{ $t('contentTabs.closeAll') }}</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
<el-tabs v-model="$store.state.contentTabsActiveName" @tab-click="tabSelectedHandle" @tab-remove="tabRemoveHandle">
|
||||
<el-tab-pane
|
||||
v-for="item in $store.state.contentTabs"
|
||||
:key="item.name"
|
||||
:name="item.name"
|
||||
:label="item.title"
|
||||
:closable="item.name !== 'home'"
|
||||
:class="{ 'is-iframe': tabIsIframe(item.iframeURL) }">
|
||||
<template v-if="item.name === 'home'">
|
||||
<svg slot="label" class="icon-svg aui-content--tabs-icon-nav" aria-hidden="true"><use xlink:href="#icon-home"></use></svg>
|
||||
</template>
|
||||
<iframe v-if="tabIsIframe(item.iframeURL)" :src="item.iframeURL" width="100%" height="100%" frameborder="0" scrolling="yes"></iframe>
|
||||
<keep-alive v-else>
|
||||
<router-view v-if="item.name === $store.state.contentTabsActiveName" />
|
||||
</keep-alive>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</template>
|
||||
<!-- 其他方式, 展示内容 -->
|
||||
<template v-else>
|
||||
<keep-alive>
|
||||
<router-view />
|
||||
</keep-alive>
|
||||
</template>
|
||||
</main>
|
||||
<main :class="['aui-content', { 'aui-content--tabs': $route.meta.isTab }]">
|
||||
<!-- tab展示内容 -->
|
||||
<template v-if="$route.meta.isTab">
|
||||
<el-dropdown class="aui-content--tabs-tools">
|
||||
<i class="el-icon-arrow-down"></i>
|
||||
<el-dropdown-menu slot="dropdown" :show-timeout="0">
|
||||
<el-dropdown-item @click.native="tabRemoveHandle($store.state.contentTabsActiveName)">{{ $t('contentTabs.closeCurrent') }}</el-dropdown-item>
|
||||
<el-dropdown-item @click.native="tabsCloseOtherHandle()">{{ $t('contentTabs.closeOther') }}</el-dropdown-item>
|
||||
<el-dropdown-item @click.native="tabsCloseAllHandle()">{{ $t('contentTabs.closeAll') }}</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
<el-tabs v-model="$store.state.contentTabsActiveName" @tab-click="tabSelectedHandle" @tab-remove="tabRemoveHandle">
|
||||
<el-tab-pane
|
||||
v-for="item in $store.state.contentTabs"
|
||||
:key="item.name"
|
||||
:name="item.name"
|
||||
:label="item.title"
|
||||
:closable="item.name !== 'home'"
|
||||
:class="{ 'is-iframe': tabIsIframe(item.iframeURL) }"
|
||||
>
|
||||
<template v-if="item.name === 'home'">
|
||||
<svg slot="label" class="icon-svg aui-content--tabs-icon-nav" aria-hidden="true"><use xlink:href="#icon-home"></use></svg>
|
||||
</template>
|
||||
<iframe v-if="tabIsIframe(item.iframeURL)" :src="item.iframeURL" width="100%" height="100%" frameborder="0" scrolling="yes"></iframe>
|
||||
<keep-alive v-else>
|
||||
<router-view v-if="item.name === $store.state.contentTabsActiveName" />
|
||||
</keep-alive>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</template>
|
||||
<!-- 其他方式, 展示内容 -->
|
||||
<template v-else>
|
||||
<keep-alive>
|
||||
<router-view />
|
||||
</keep-alive>
|
||||
</template>
|
||||
</main>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { isURL } from '@/utils/validate'
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// tabs, 是否通过iframe展示
|
||||
tabIsIframe (url) {
|
||||
return isURL(url)
|
||||
},
|
||||
// tabs, 选中tab
|
||||
tabSelectedHandle (tab) {
|
||||
tab = this.$store.state.contentTabs.filter(item => item.name === tab.name)[0]
|
||||
if (tab) {
|
||||
this.$router.push({
|
||||
'name': tab.name,
|
||||
'params': { ...tab.params },
|
||||
'query': { ...tab.query }
|
||||
})
|
||||
}
|
||||
},
|
||||
// tabs, 删除tab
|
||||
tabRemoveHandle (tabName) {
|
||||
if (tabName === 'home') {
|
||||
return false
|
||||
}
|
||||
this.$store.state.contentTabs = this.$store.state.contentTabs.filter(item => item.name !== tabName)
|
||||
if (this.$store.state.contentTabs.length <= 0) {
|
||||
this.$store.state.sidebarMenuActiveName = this.$store.state.contentTabsActiveName = 'home'
|
||||
return false
|
||||
}
|
||||
// 当前选中tab被删除
|
||||
if (tabName === this.$store.state.contentTabsActiveName) {
|
||||
let tab = this.$store.state.contentTabs[this.$store.state.contentTabs.length - 1]
|
||||
this.$router.push({
|
||||
name: tab.name,
|
||||
params: { ...tab.params },
|
||||
query: { ...tab.query }
|
||||
})
|
||||
}
|
||||
},
|
||||
// tabs, 关闭其它
|
||||
tabsCloseOtherHandle () {
|
||||
this.$store.state.contentTabs = this.$store.state.contentTabs.filter(item => {
|
||||
return item.name === 'home' || item.name === this.$store.state.contentTabsActiveName
|
||||
})
|
||||
},
|
||||
// tabs, 关闭全部
|
||||
tabsCloseAllHandle () {
|
||||
this.$store.state.contentTabs = this.$store.state.contentTabs.filter(item => item.name === 'home')
|
||||
this.$router.push({ name: 'home' })
|
||||
}
|
||||
}
|
||||
data() {
|
||||
return {}
|
||||
},
|
||||
methods: {
|
||||
// tabs, 是否通过iframe展示
|
||||
tabIsIframe(url) {
|
||||
return isURL(url)
|
||||
},
|
||||
// tabs, 选中tab
|
||||
tabSelectedHandle(tab) {
|
||||
tab = this.$store.state.contentTabs.filter(item => item.name === tab.name)[0]
|
||||
if (tab) {
|
||||
this.$router.push({
|
||||
name: tab.name,
|
||||
params: { ...tab.params },
|
||||
query: { ...tab.query }
|
||||
})
|
||||
}
|
||||
},
|
||||
// tabs, 删除tab
|
||||
tabRemoveHandle(tabName) {
|
||||
if (tabName === 'home') {
|
||||
return false
|
||||
}
|
||||
this.$store.state.contentTabs = this.$store.state.contentTabs.filter(item => item.name !== tabName)
|
||||
if (this.$store.state.contentTabs.length <= 0) {
|
||||
this.$store.state.sidebarMenuActiveName = this.$store.state.contentTabsActiveName = 'home'
|
||||
return false
|
||||
}
|
||||
// 当前选中tab被删除
|
||||
if (tabName === this.$store.state.contentTabsActiveName) {
|
||||
let tab = this.$store.state.contentTabs[this.$store.state.contentTabs.length - 1]
|
||||
this.$router.push({
|
||||
name: tab.name,
|
||||
params: { ...tab.params },
|
||||
query: { ...tab.query }
|
||||
})
|
||||
}
|
||||
},
|
||||
// tabs, 关闭其它
|
||||
tabsCloseOtherHandle() {
|
||||
this.$store.state.contentTabs = this.$store.state.contentTabs.filter(item => {
|
||||
return item.name === 'home' || item.name === this.$store.state.contentTabsActiveName
|
||||
})
|
||||
},
|
||||
// tabs, 关闭全部
|
||||
tabsCloseAllHandle() {
|
||||
this.$store.state.contentTabs = this.$store.state.contentTabs.filter(item => item.name === 'home')
|
||||
this.$router.push({ name: 'home' })
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,97 +1,95 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
:visible.sync="visible"
|
||||
:title="$t('updatePassword.title')"
|
||||
:close-on-click-modal="false"
|
||||
:close-on-press-escape="false"
|
||||
:append-to-body="true">
|
||||
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()" label-width="120px">
|
||||
<el-form-item :label="$t('updatePassword.username')">
|
||||
<span>{{ $store.state.user.name }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item prop="password" :label="$t('updatePassword.password')">
|
||||
<el-input v-model="dataForm.password" type="password" :placeholder="$t('updatePassword.password')"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="newPassword" :label="$t('updatePassword.newPassword')">
|
||||
<el-input v-model="dataForm.newPassword" type="password" :placeholder="$t('updatePassword.newPassword')"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="confirmPassword" :label="$t('updatePassword.confirmPassword')">
|
||||
<el-input v-model="dataForm.confirmPassword" type="password" :placeholder="$t('updatePassword.confirmPassword')"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template slot="footer">
|
||||
<el-button @click="visible = false">{{ $t('cancel') }}</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<el-dialog :visible.sync="visible" :title="$t('updatePassword.title')" :close-on-click-modal="false" :close-on-press-escape="false" :append-to-body="true">
|
||||
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()" label-width="120px">
|
||||
<el-form-item :label="$t('updatePassword.username')">
|
||||
<span>{{ $store.state.user.name }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item prop="password" :label="$t('updatePassword.password')">
|
||||
<el-input v-model="dataForm.password" type="password" :placeholder="$t('updatePassword.password')"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="newPassword" :label="$t('updatePassword.newPassword')">
|
||||
<el-input v-model="dataForm.newPassword" type="password" :placeholder="$t('updatePassword.newPassword')"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="confirmPassword" :label="$t('updatePassword.confirmPassword')">
|
||||
<el-input v-model="dataForm.confirmPassword" type="password" :placeholder="$t('updatePassword.confirmPassword')"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template slot="footer">
|
||||
<el-button @click="visible = false">{{ $t('cancel') }}</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import debounce from 'lodash/debounce'
|
||||
import { clearLoginInfo } from '@/utils'
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
password: '',
|
||||
newPassword: '',
|
||||
confirmPassword: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
dataRule () {
|
||||
var validateConfirmPassword = (rule, value, callback) => {
|
||||
if (this.dataForm.newPassword !== value) {
|
||||
return callback(new Error(this.$t('updatePassword.validate.confirmPassword')))
|
||||
}
|
||||
callback()
|
||||
}
|
||||
return {
|
||||
password: [
|
||||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
||||
],
|
||||
newPassword: [
|
||||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
||||
],
|
||||
confirmPassword: [
|
||||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' },
|
||||
{ validator: validateConfirmPassword, trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init () {
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmitHandle: debounce(function () {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (!valid) {
|
||||
return false
|
||||
}
|
||||
this.$http.put('/sys/user/password', 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
|
||||
clearLoginInfo()
|
||||
this.$router.replace({ name: 'login' })
|
||||
}
|
||||
})
|
||||
}).catch(() => {})
|
||||
})
|
||||
}, 1000, { 'leading': true, 'trailing': false })
|
||||
}
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
password: '',
|
||||
newPassword: '',
|
||||
confirmPassword: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
dataRule() {
|
||||
var validateConfirmPassword = (rule, value, callback) => {
|
||||
if (this.dataForm.newPassword !== value) {
|
||||
return callback(new Error(this.$t('updatePassword.validate.confirmPassword')))
|
||||
}
|
||||
callback()
|
||||
}
|
||||
return {
|
||||
password: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }],
|
||||
newPassword: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }],
|
||||
confirmPassword: [
|
||||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' },
|
||||
{ validator: validateConfirmPassword, trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmitHandle: debounce(
|
||||
function() {
|
||||
this.$refs['dataForm'].validate(valid => {
|
||||
if (!valid) {
|
||||
return false
|
||||
}
|
||||
this.$http
|
||||
.put('/sys/user/password', 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
|
||||
clearLoginInfo()
|
||||
this.$router.replace({ name: 'login' })
|
||||
}
|
||||
})
|
||||
})
|
||||
.catch(() => {})
|
||||
})
|
||||
},
|
||||
1000,
|
||||
{ leading: true, trailing: false }
|
||||
)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,103 +1,108 @@
|
||||
<template>
|
||||
<nav class="aui-navbar" :class="`aui-navbar--${$store.state.navbarLayoutType}`">
|
||||
<div class="aui-navbar__header">
|
||||
<h1 class="aui-navbar__brand" @click="$router.push({ name: 'home' })">
|
||||
<a class="aui-navbar__brand-lg" href="javascript:;">{{ $t('brand.lg') }}</a>
|
||||
<a class="aui-navbar__brand-mini" href="javascript:;">{{ $t('brand.mini') }}</a>
|
||||
</h1>
|
||||
</div>
|
||||
<div class="aui-navbar__body">
|
||||
<el-menu class="aui-navbar__menu mr-auto" mode="horizontal">
|
||||
<el-menu-item index="1" @click="$store.state.sidebarFold = !$store.state.sidebarFold">
|
||||
<svg class="icon-svg aui-navbar__icon-menu aui-navbar__icon-menu--switch" aria-hidden="true"><use xlink:href="#icon-outdent"></use></svg>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="2" @click="refresh()">
|
||||
<svg class="icon-svg aui-navbar__icon-menu aui-navbar__icon-menu--refresh" aria-hidden="true"><use xlink:href="#icon-sync"></use></svg>
|
||||
</el-menu-item>
|
||||
</el-menu>
|
||||
<el-menu class="aui-navbar__menu" mode="horizontal">
|
||||
<el-menu-item index="2">
|
||||
<a href="https://www.renren.io/" target="_blank">
|
||||
<svg class="icon-svg aui-navbar__icon-menu" aria-hidden="true"><use xlink:href="#icon-earth"></use></svg>
|
||||
</a>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="2">
|
||||
<a href="https://gitee.com/renrenio/renren-security" target="_blank">
|
||||
<svg class="icon-svg aui-navbar__icon-menu" aria-hidden="true"><use xlink:href="#gitee"></use></svg>
|
||||
</a>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="4" @click="fullscreenHandle()">
|
||||
<svg class="icon-svg aui-navbar__icon-menu" aria-hidden="true"><use xlink:href="#icon-fullscreen"></use></svg>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="5" class="aui-navbar__avatar">
|
||||
<el-dropdown placement="bottom" :show-timeout="0">
|
||||
<span class="el-dropdown-link">
|
||||
<img src="~@/assets/img/avatar.png">
|
||||
<span>{{ $store.state.user.name }}</span>
|
||||
<i class="el-icon-arrow-down"></i>
|
||||
</span>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item @click.native="updatePasswordHandle()">{{ $t('updatePassword.title') }}</el-dropdown-item>
|
||||
<el-dropdown-item @click.native="logoutHandle()">{{ $t('logout') }}</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</el-menu-item>
|
||||
</el-menu>
|
||||
</div>
|
||||
<!-- 弹窗, 修改密码 -->
|
||||
<update-password v-if="updatePasswordVisible" ref="updatePassword"></update-password>
|
||||
</nav>
|
||||
<nav class="aui-navbar" :class="`aui-navbar--${$store.state.navbarLayoutType}`">
|
||||
<div class="aui-navbar__header">
|
||||
<h1 class="aui-navbar__brand" @click="$router.push({ name: 'home' })">
|
||||
<a class="aui-navbar__brand-lg" href="javascript:;">{{ $t('brand.lg') }}</a>
|
||||
<a class="aui-navbar__brand-mini" href="javascript:;">{{ $t('brand.mini') }}</a>
|
||||
</h1>
|
||||
</div>
|
||||
<div class="aui-navbar__body">
|
||||
<el-menu class="aui-navbar__menu mr-auto" mode="horizontal">
|
||||
<el-menu-item index="1" @click="$store.state.sidebarFold = !$store.state.sidebarFold">
|
||||
<svg class="icon-svg aui-navbar__icon-menu aui-navbar__icon-menu--switch" aria-hidden="true"><use xlink:href="#icon-outdent"></use></svg>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="2" @click="refresh()">
|
||||
<svg class="icon-svg aui-navbar__icon-menu aui-navbar__icon-menu--refresh" aria-hidden="true"><use xlink:href="#icon-sync"></use></svg>
|
||||
</el-menu-item>
|
||||
</el-menu>
|
||||
<el-menu class="aui-navbar__menu" mode="horizontal">
|
||||
<el-menu-item index="2">
|
||||
<a href="https://www.renren.io/" target="_blank">
|
||||
<svg class="icon-svg aui-navbar__icon-menu" aria-hidden="true"><use xlink:href="#icon-earth"></use></svg>
|
||||
</a>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="2">
|
||||
<a href="https://gitee.com/renrenio/renren-security" target="_blank">
|
||||
<svg class="icon-svg aui-navbar__icon-menu" aria-hidden="true"><use xlink:href="#gitee"></use></svg>
|
||||
</a>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="4" @click="fullscreenHandle()">
|
||||
<svg class="icon-svg aui-navbar__icon-menu" aria-hidden="true"><use xlink:href="#icon-fullscreen"></use></svg>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="5" class="aui-navbar__avatar">
|
||||
<el-dropdown placement="bottom" :show-timeout="0">
|
||||
<span class="el-dropdown-link">
|
||||
<img src="~@/assets/img/avatar.png" />
|
||||
<span>{{ $store.state.user.name }}</span>
|
||||
<i class="el-icon-arrow-down"></i>
|
||||
</span>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item @click.native="updatePasswordHandle()">{{ $t('updatePassword.title') }}</el-dropdown-item>
|
||||
<el-dropdown-item @click.native="logoutHandle()">{{ $t('logout') }}</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</el-menu-item>
|
||||
</el-menu>
|
||||
</div>
|
||||
<!-- 弹窗, 修改密码 -->
|
||||
<update-password v-if="updatePasswordVisible" ref="updatePassword"></update-password>
|
||||
</nav>
|
||||
</template>
|
||||
<script>
|
||||
import screenfull from 'screenfull'
|
||||
import UpdatePassword from './main-navbar-update-password'
|
||||
import { clearLoginInfo } from '@/utils'
|
||||
export default {
|
||||
inject: ['refresh'],
|
||||
data () {
|
||||
return {
|
||||
updatePasswordVisible: false,
|
||||
messageTip: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
UpdatePassword
|
||||
},
|
||||
methods: {
|
||||
// 全屏
|
||||
fullscreenHandle () {
|
||||
if (!screenfull.enabled) {
|
||||
return this.$message({
|
||||
message: this.$t('fullscreen.prompt'),
|
||||
type: 'warning',
|
||||
duration: 500
|
||||
})
|
||||
}
|
||||
screenfull.toggle()
|
||||
},
|
||||
// 修改密码
|
||||
updatePasswordHandle () {
|
||||
this.updatePasswordVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.updatePassword.init()
|
||||
})
|
||||
},
|
||||
// 退出
|
||||
logoutHandle () {
|
||||
this.$confirm(this.$t('prompt.info', { 'handle': this.$t('logout') }), this.$t('prompt.title'), {
|
||||
confirmButtonText: this.$t('confirm'),
|
||||
cancelButtonText: this.$t('cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http.post('/logout').then(({ data: res }) => {
|
||||
if (res.code !== 0) {
|
||||
return this.$message.error(res.msg)
|
||||
}
|
||||
clearLoginInfo()
|
||||
this.$router.push({ name: 'login' })
|
||||
}).catch(() => {})
|
||||
}).catch(() => {})
|
||||
}
|
||||
}
|
||||
inject: ['refresh'],
|
||||
data() {
|
||||
return {
|
||||
updatePasswordVisible: false,
|
||||
messageTip: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
UpdatePassword
|
||||
},
|
||||
methods: {
|
||||
// 全屏
|
||||
fullscreenHandle() {
|
||||
if (!screenfull.enabled) {
|
||||
return this.$message({
|
||||
message: this.$t('fullscreen.prompt'),
|
||||
type: 'warning',
|
||||
duration: 500
|
||||
})
|
||||
}
|
||||
screenfull.toggle()
|
||||
},
|
||||
// 修改密码
|
||||
updatePasswordHandle() {
|
||||
this.updatePasswordVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.updatePassword.init()
|
||||
})
|
||||
},
|
||||
// 退出
|
||||
logoutHandle() {
|
||||
this.$confirm(this.$t('prompt.info', { handle: this.$t('logout') }), this.$t('prompt.title'), {
|
||||
confirmButtonText: this.$t('confirm'),
|
||||
cancelButtonText: this.$t('cancel'),
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
this.$http
|
||||
.post(this.$http.adornUrl('/logout'))
|
||||
.then(({ data: res }) => {
|
||||
if (res.code !== 0) {
|
||||
return this.$message.error(res.msg)
|
||||
}
|
||||
clearLoginInfo()
|
||||
this.$router.push({ name: 'Login' })
|
||||
})
|
||||
.catch(() => {})
|
||||
})
|
||||
.catch(() => {})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,38 +1,38 @@
|
||||
<template>
|
||||
<el-submenu v-if="menu.children && menu.children.length >= 1" :index="menu.id" :popper-append-to-body="false">
|
||||
<template slot="title">
|
||||
<svg class="icon-svg aui-sidebar__menu-icon" aria-hidden="true"><use :xlink:href="`#${menu.icon}`"></use></svg>
|
||||
<span>{{ menu.name }}</span>
|
||||
</template>
|
||||
<sub-menu v-for="item in menu.children" :key="item.id" :menu="item"></sub-menu>
|
||||
</el-submenu>
|
||||
<el-menu-item v-else :index="menu.id" @click="gotoRouteHandle(menu.id)">
|
||||
<svg class="icon-svg aui-sidebar__menu-icon" aria-hidden="true"><use :xlink:href="`#${menu.icon}`"></use></svg>
|
||||
<span>{{ menu.name }}</span>
|
||||
</el-menu-item>
|
||||
<el-submenu v-if="menu.children && menu.children.length >= 1" :index="menu.id" :popper-append-to-body="false">
|
||||
<template slot="title">
|
||||
<svg class="icon-svg aui-sidebar__menu-icon" aria-hidden="true"><use :xlink:href="`#${menu.icon}`"></use></svg>
|
||||
<span>{{ menu.name }}</span>
|
||||
</template>
|
||||
<sub-menu v-for="item in menu.children" :key="item.id" :menu="item"></sub-menu>
|
||||
</el-submenu>
|
||||
<el-menu-item v-else :index="menu.id" @click="gotoRouteHandle(menu.id)">
|
||||
<svg class="icon-svg aui-sidebar__menu-icon" aria-hidden="true"><use :xlink:href="`#${menu.icon}`"></use></svg>
|
||||
<span>{{ menu.name }}</span>
|
||||
</el-menu-item>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import SubMenu from './main-sidebar-sub-menu'
|
||||
export default {
|
||||
name: 'sub-menu',
|
||||
props: {
|
||||
menu: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
components: {
|
||||
SubMenu
|
||||
},
|
||||
methods: {
|
||||
// 通过menuId与动态(菜单)路由进行匹配跳转至指定路由
|
||||
gotoRouteHandle (menuId) {
|
||||
var route = window.SITE_CONFIG['dynamicMenuRoutes'].filter(item => item.meta.menuId === menuId)[0]
|
||||
if (route) {
|
||||
this.$router.push({ name: route.name })
|
||||
}
|
||||
}
|
||||
}
|
||||
name: 'sub-menu',
|
||||
props: {
|
||||
menu: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
components: {
|
||||
SubMenu
|
||||
},
|
||||
methods: {
|
||||
// 通过menuId与动态(菜单)路由进行匹配跳转至指定路由
|
||||
gotoRouteHandle(menuId) {
|
||||
var route = window.SITE_CONFIG['dynamicMenuRoutes'].filter(item => item.meta.menuId === menuId)[0]
|
||||
if (route) {
|
||||
this.$router.push({ name: route.name })
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
<template>
|
||||
<aside :class="['aui-sidebar', `aui-sidebar--${$store.state.sidebarLayoutSkin}`]">
|
||||
<div class="aui-sidebar__inner">
|
||||
<el-menu
|
||||
:default-active="$store.state.sidebarMenuActiveName"
|
||||
:collapse="$store.state.sidebarFold"
|
||||
:unique-opened="true"
|
||||
:collapseTransition="false"
|
||||
class="aui-sidebar__menu">
|
||||
<sub-menu v-for="menu in $store.state.sidebarMenuList" :key="menu.id" :menu="menu" />
|
||||
</el-menu>
|
||||
</div>
|
||||
</aside>
|
||||
<aside :class="['aui-sidebar', `aui-sidebar--${$store.state.sidebarLayoutSkin}`]">
|
||||
<div class="aui-sidebar__inner">
|
||||
<el-menu
|
||||
:default-active="$store.state.sidebarMenuActiveName"
|
||||
:collapse="$store.state.sidebarFold"
|
||||
:unique-opened="true"
|
||||
:collapseTransition="false"
|
||||
class="aui-sidebar__menu"
|
||||
>
|
||||
<sub-menu v-for="menu in $store.state.sidebarMenuList" :key="menu.id" :menu="menu" />
|
||||
</el-menu>
|
||||
</div>
|
||||
</aside>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import SubMenu from './main-sidebar-sub-menu'
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
}
|
||||
},
|
||||
components: {
|
||||
SubMenu
|
||||
},
|
||||
created () {
|
||||
this.$store.state.sidebarMenuList = window.SITE_CONFIG['menuList']
|
||||
}
|
||||
data() {
|
||||
return {}
|
||||
},
|
||||
components: {
|
||||
SubMenu
|
||||
},
|
||||
created() {
|
||||
this.$store.state.sidebarMenuList = window.SITE_CONFIG['menuList']
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<template>
|
||||
<div v-loading.fullscreen.lock="loading" :element-loading-text="$t('loading')" :class="['aui-wrapper', { 'aui-sidebar--fold': $store.state.sidebarFold }]">
|
||||
<template v-if="!loading">
|
||||
<main-navbar />
|
||||
<main-sidebar />
|
||||
<div class="aui-content__wrapper">
|
||||
<main-content v-if="!$store.state.contentIsNeedRefresh" />
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
<div v-loading.fullscreen.lock="loading" :element-loading-text="$t('loading')" :class="['aui-wrapper', { 'aui-sidebar--fold': $store.state.sidebarFold }]">
|
||||
<template v-if="!loading">
|
||||
<main-navbar />
|
||||
<main-sidebar />
|
||||
<div class="aui-content__wrapper">
|
||||
<main-content v-if="!$store.state.contentIsNeedRefresh" />
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -16,87 +16,93 @@ import MainSidebar from './main-sidebar'
|
||||
import MainContent from './main-content'
|
||||
import debounce from 'lodash/debounce'
|
||||
export default {
|
||||
provide () {
|
||||
return {
|
||||
// 刷新
|
||||
refresh () {
|
||||
this.$store.state.contentIsNeedRefresh = true
|
||||
this.$nextTick(() => {
|
||||
this.$store.state.contentIsNeedRefresh = false
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
loading: true
|
||||
}
|
||||
},
|
||||
components: {
|
||||
MainNavbar,
|
||||
MainSidebar,
|
||||
MainContent
|
||||
},
|
||||
watch: {
|
||||
$route: 'routeHandle'
|
||||
},
|
||||
created () {
|
||||
this.windowResizeHandle()
|
||||
this.routeHandle(this.$route)
|
||||
Promise.all([
|
||||
this.getUserInfo(),
|
||||
this.getPermissions()
|
||||
]).then(() => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 窗口改变大小
|
||||
windowResizeHandle () {
|
||||
this.$store.state.sidebarFold = document.documentElement['clientWidth'] <= 992 || false
|
||||
window.addEventListener('resize', debounce(() => {
|
||||
this.$store.state.sidebarFold = document.documentElement['clientWidth'] <= 992 || false
|
||||
}, 150))
|
||||
},
|
||||
// 路由, 监听
|
||||
routeHandle (route) {
|
||||
if (!route.meta.isTab) {
|
||||
return false
|
||||
}
|
||||
var tab = this.$store.state.contentTabs.filter(item => item.name === route.name)[0]
|
||||
if (!tab) {
|
||||
tab = {
|
||||
...window.SITE_CONFIG['contentTabDefault'],
|
||||
...route.meta,
|
||||
'name': route.name,
|
||||
'params': { ...route.params },
|
||||
'query': { ...route.query }
|
||||
}
|
||||
this.$store.state.contentTabs = this.$store.state.contentTabs.concat(tab)
|
||||
}
|
||||
this.$store.state.sidebarMenuActiveName = tab.menuId
|
||||
this.$store.state.contentTabsActiveName = tab.name
|
||||
},
|
||||
// 获取当前管理员信息
|
||||
getUserInfo () {
|
||||
return this.$http.get('/sys/user/info').then(({ data: res }) => {
|
||||
if (res.code !== 0) {
|
||||
return this.$message.error(res.msg)
|
||||
}
|
||||
this.$store.state.user.id = res.data.id
|
||||
this.$store.state.user.name = res.data.username
|
||||
this.$store.state.user.superAdmin = res.data.superAdmin
|
||||
}).catch(() => {})
|
||||
},
|
||||
// 获取权限
|
||||
getPermissions () {
|
||||
return this.$http.get('/sys/menu/permissions').then(({ data: res }) => {
|
||||
if (res.code !== 0) {
|
||||
return this.$message.error(res.msg)
|
||||
}
|
||||
window.SITE_CONFIG['permissions'] = res.data
|
||||
}).catch(() => {})
|
||||
}
|
||||
}
|
||||
provide() {
|
||||
return {
|
||||
// 刷新
|
||||
refresh() {
|
||||
this.$store.state.contentIsNeedRefresh = true
|
||||
this.$nextTick(() => {
|
||||
this.$store.state.contentIsNeedRefresh = false
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: true
|
||||
}
|
||||
},
|
||||
components: {
|
||||
MainNavbar,
|
||||
MainSidebar,
|
||||
MainContent
|
||||
},
|
||||
watch: {
|
||||
$route: 'routeHandle'
|
||||
},
|
||||
created() {
|
||||
this.windowResizeHandle()
|
||||
this.routeHandle(this.$route)
|
||||
Promise.all([this.getUserInfo(), this.getPermissions()]).then(() => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 窗口改变大小
|
||||
windowResizeHandle() {
|
||||
this.$store.state.sidebarFold = document.documentElement['clientWidth'] <= 992 || false
|
||||
window.addEventListener(
|
||||
'resize',
|
||||
debounce(() => {
|
||||
this.$store.state.sidebarFold = document.documentElement['clientWidth'] <= 992 || false
|
||||
}, 150)
|
||||
)
|
||||
},
|
||||
// 路由, 监听
|
||||
routeHandle(route) {
|
||||
if (!route.meta.isTab) {
|
||||
return false
|
||||
}
|
||||
var tab = this.$store.state.contentTabs.filter(item => item.name === route.name)[0]
|
||||
if (!tab) {
|
||||
tab = {
|
||||
...window.SITE_CONFIG['contentTabDefault'],
|
||||
...route.meta,
|
||||
name: route.name,
|
||||
params: { ...route.params },
|
||||
query: { ...route.query }
|
||||
}
|
||||
this.$store.state.contentTabs = this.$store.state.contentTabs.concat(tab)
|
||||
}
|
||||
this.$store.state.sidebarMenuActiveName = tab.menuId
|
||||
this.$store.state.contentTabsActiveName = tab.name
|
||||
},
|
||||
// 获取当前管理员信息
|
||||
getUserInfo() {
|
||||
return this.$http
|
||||
.get(this.$http.adornUrl('/sys/user/info'))
|
||||
.then(({ data: res }) => {
|
||||
if (res.code !== 0) {
|
||||
return this.$message.error(res.msg)
|
||||
}
|
||||
this.$store.state.user.id = res.data.id
|
||||
this.$store.state.user.name = res.data.username
|
||||
this.$store.state.user.superAdmin = res.data.superAdmin
|
||||
})
|
||||
.catch(() => {})
|
||||
},
|
||||
// 获取权限
|
||||
getPermissions() {
|
||||
return this.$http
|
||||
.get(this.$http.adornUrl('/sys/menu/permissions'))
|
||||
.then(({ data: res }) => {
|
||||
if (res.code !== 0) {
|
||||
return this.$message.error(res.msg)
|
||||
}
|
||||
window.SITE_CONFIG['permissions'] = res.data
|
||||
})
|
||||
.catch(() => {})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,31 +1,33 @@
|
||||
<template>
|
||||
<el-card shadow="never" class="aui-card--fill">
|
||||
<div class="mod-home">
|
||||
<h3>项目介绍</h3>
|
||||
<ul>
|
||||
<li>renren-ui基于vue、element-ui构建开发,实现<a href="https://gitee.com/renrenio/renren-ui" target="_blank">renren-security</a>后台管理前端功能,提供一套更优的前端解决方案</li>
|
||||
<li>前后端分离,通过token进行数据交互,可独立部署</li>
|
||||
<li>动态菜单,通过菜单管理统一管理访问路由</li>
|
||||
<li>演示地址:<a href="http://demo.open.renren.io/renren-security" target="_blank">http://demo.open.renren.io/renren-security</a> (账号密码:admin/admin)</li>
|
||||
</ul>
|
||||
<h3>获取帮助</h3>
|
||||
<ul>
|
||||
<li>官方社区:<a href="https://www.renren.io/community" target="_blank">https://www.renren.io/community</a></li>
|
||||
<li>前端Git地址:<a href="https://gitee.com/renrenio/renren-ui" target="_blank">https://gitee.com/renrenio/renren-ui</a></li>
|
||||
<li>后台Git地址:<a href="https://gitee.com/renrenio/renren-security" target="_blank">https://gitee.com/renrenio/renren-security</a></li>
|
||||
<li>如需关注项目最新动态,请Watch、Star项目,同时也是对项目最好的支持</li>
|
||||
</ul>
|
||||
<h3>官方微信群</h3>
|
||||
<ul>
|
||||
<li>扫码下面的二维码,关注【人人开源】公众号,回复【加群】,即可根据提示加入微信群!</li>
|
||||
<li><img src="https://cdn.renren.io/f5cef202207132229319338.jpg" alt="微信群" /></li>
|
||||
</ul>
|
||||
</div>
|
||||
</el-card>
|
||||
<el-card shadow="never" class="aui-card--fill">
|
||||
<div class="mod-home">
|
||||
<h3>项目介绍</h3>
|
||||
<ul>
|
||||
<li>
|
||||
renren-ui基于vue、element-ui构建开发,实现<a href="https://gitee.com/renrenio/renren-ui" target="_blank">renren-security</a>后台管理前端功能,提供一套更优的前端解决方案
|
||||
</li>
|
||||
<li>前后端分离,通过token进行数据交互,可独立部署</li>
|
||||
<li>动态菜单,通过菜单管理统一管理访问路由</li>
|
||||
<li>演示地址:<a href="http://demo.open.renren.io/renren-security" target="_blank">http://demo.open.renren.io/renren-security</a> (账号密码:admin/admin)</li>
|
||||
</ul>
|
||||
<h3>获取帮助</h3>
|
||||
<ul>
|
||||
<li>官方社区:<a href="https://www.renren.io/community" target="_blank">https://www.renren.io/community</a></li>
|
||||
<li>前端Git地址:<a href="https://gitee.com/renrenio/renren-ui" target="_blank">https://gitee.com/renrenio/renren-ui</a></li>
|
||||
<li>后台Git地址:<a href="https://gitee.com/renrenio/renren-security" target="_blank">https://gitee.com/renrenio/renren-security</a></li>
|
||||
<li>如需关注项目最新动态,请Watch、Star项目,同时也是对项目最好的支持</li>
|
||||
</ul>
|
||||
<h3>官方微信群</h3>
|
||||
<ul>
|
||||
<li>扫码下面的二维码,关注【人人开源】公众号,回复【加群】,即可根据提示加入微信群!</li>
|
||||
<li><img src="https://cdn.renren.io/f5cef202207132229319338.jpg" alt="微信群" /></li>
|
||||
</ul>
|
||||
</div>
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
.mod-home {
|
||||
line-height: 1.5;
|
||||
line-height: 1.5;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -72,7 +72,7 @@ export default {
|
||||
},
|
||||
// 获取信息
|
||||
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) {
|
||||
return this.$message.error(res.msg)
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ export default {
|
||||
},
|
||||
// 失败信息
|
||||
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) {
|
||||
return this.$message.error(res.msg)
|
||||
}
|
||||
|
||||
254
src/views/modules/monitoring/equipment-add-or-update.vue
Normal file
254
src/views/modules/monitoring/equipment-add-or-update.vue
Normal file
@@ -0,0 +1,254 @@
|
||||
<template>
|
||||
<el-dialog :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-item label="编码" prop="code">
|
||||
<el-input v-model="dataForm.code" placeholder="编码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备名称" prop="name">
|
||||
<el-input v-model="dataForm.name" placeholder="设备名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="英文名称" prop="enName">
|
||||
<el-input v-model="dataForm.enName" placeholder="英文名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="缩写" prop="abbr">
|
||||
<el-input v-model="dataForm.abbr" placeholder="缩写"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="进厂日期" prop="enterTime">
|
||||
<el-input v-model="dataForm.enterTime" placeholder="进厂日期"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="生产日期" prop="productionTime">
|
||||
<el-input v-model="dataForm.productionTime" placeholder="生产日期"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备类型,关联设备类型表" prop="equipmentTypeId">
|
||||
<el-input v-model="dataForm.equipmentTypeId" placeholder="设备类型,关联设备类型表"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="分组id (关联 T_EQUIPMENT_GROUP)" prop="groupId">
|
||||
<el-input v-model="dataForm.groupId" placeholder="分组id (关联 T_EQUIPMENT_GROUP)"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="0:无类别,1:上片数据设备,2:下片数据设备" prop="dataType">
|
||||
<el-input v-model="dataForm.dataType" placeholder="0:无类别,1:上片数据设备,2:下片数据设备"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="每小时生产数量" prop="tvalue">
|
||||
<el-input v-model="dataForm.tvalue" placeholder="每小时生产数量"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="单件加工时间 s/件" prop="processingTime">
|
||||
<el-input v-model="dataForm.processingTime" placeholder="单件加工时间 s/件"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="制造商" prop="manufacturer">
|
||||
<el-input v-model="dataForm.manufacturer" placeholder="制造商"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="规格" prop="spec">
|
||||
<el-input v-model="dataForm.spec" placeholder="规格"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="功能描述" prop="description">
|
||||
<el-input v-model="dataForm.description" placeholder="功能描述"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="启用状态:0 、停用,1、启用" prop="enabled">
|
||||
<el-input v-model="dataForm.enabled" placeholder="启用状态:0 、停用,1、启用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="dataForm.remark" placeholder="备注"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="删除标志,是否有效:1 可用 0不可用" prop="valid">
|
||||
<el-input v-model="dataForm.valid" placeholder="删除标志,是否有效:1 可用 0不可用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人" prop="creatorId">
|
||||
<el-input v-model="dataForm.creatorId" placeholder="创建人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人姓名" prop="creatorName">
|
||||
<el-input v-model="dataForm.creatorName" placeholder="创建人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-input v-model="dataForm.createTime" placeholder="创建时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人" prop="updaterId">
|
||||
<el-input v-model="dataForm.updaterId" placeholder="更新人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人姓名" prop="updaterName">
|
||||
<el-input v-model="dataForm.updaterName" placeholder="更新人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新时间" prop="updateTime">
|
||||
<el-input v-model="dataForm.updateTime" placeholder="更新时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="版本号" prop="version">
|
||||
<el-input v-model="dataForm.version" placeholder="版本号"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="外部系统代码" prop="externalCode">
|
||||
<el-input v-model="dataForm.externalCode" placeholder="外部系统代码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="统一用的外部代码,代表用哪个设备的数据代替该设备,目前用于生产数量统计" prop="externalCodeStatis">
|
||||
<el-input v-model="dataForm.externalCodeStatis" placeholder="统一用的外部代码,代表用哪个设备的数据代替该设备,目前用于生产数量统计"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
code: '',
|
||||
name: '',
|
||||
enName: '',
|
||||
abbr: '',
|
||||
enterTime: '',
|
||||
productionTime: '',
|
||||
equipmentTypeId: '',
|
||||
groupId: '',
|
||||
dataType: '',
|
||||
tvalue: '',
|
||||
processingTime: '',
|
||||
manufacturer: '',
|
||||
spec: '',
|
||||
description: '',
|
||||
enabled: '',
|
||||
remark: '',
|
||||
valid: '',
|
||||
creatorId: '',
|
||||
creatorName: '',
|
||||
createTime: '',
|
||||
updaterId: '',
|
||||
updaterName: '',
|
||||
updateTime: '',
|
||||
version: '',
|
||||
externalCode: '',
|
||||
externalCodeStatis: ''
|
||||
},
|
||||
dataRule: {
|
||||
code: [{ required: true, message: '编码不能为空', trigger: 'blur' }],
|
||||
name: [{ required: true, message: '设备名称不能为空', trigger: 'blur' }],
|
||||
enName: [{ required: true, message: '英文名称不能为空', trigger: 'blur' }],
|
||||
abbr: [{ required: true, message: '缩写不能为空', trigger: 'blur' }],
|
||||
enterTime: [{ required: true, message: '进厂日期不能为空', trigger: 'blur' }],
|
||||
productionTime: [{ required: true, message: '生产日期不能为空', trigger: 'blur' }],
|
||||
equipmentTypeId: [{ required: true, message: '设备类型,关联设备类型表不能为空', trigger: 'blur' }],
|
||||
groupId: [{ required: true, message: '分组id (关联 T_EQUIPMENT_GROUP)不能为空', trigger: 'blur' }],
|
||||
dataType: [{ required: true, message: '0:无类别,1:上片数据设备,2:下片数据设备不能为空', trigger: 'blur' }],
|
||||
tvalue: [{ required: true, message: '每小时生产数量不能为空', trigger: 'blur' }],
|
||||
processingTime: [{ required: true, message: '单件加工时间 s/件不能为空', trigger: 'blur' }],
|
||||
manufacturer: [{ required: true, message: '制造商不能为空', trigger: 'blur' }],
|
||||
spec: [{ required: true, message: '规格不能为空', trigger: 'blur' }],
|
||||
description: [{ required: true, message: '功能描述不能为空', trigger: 'blur' }],
|
||||
enabled: [{ required: true, message: '启用状态:0 、停用,1、启用不能为空', 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' }],
|
||||
externalCode: [{ required: true, message: '外部系统代码不能为空', trigger: 'blur' }],
|
||||
externalCodeStatis: [{ required: true, message: '统一用的外部代码,代表用哪个设备的数据代替该设备,目前用于生产数量统计不能为空', trigger: 'blur' }]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init(id) {
|
||||
this.dataForm.id = id || 0
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/equipment/${this.dataForm.id}`),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams()
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataForm.code = data.equipment.code
|
||||
this.dataForm.name = data.equipment.name
|
||||
this.dataForm.enName = data.equipment.enName
|
||||
this.dataForm.abbr = data.equipment.abbr
|
||||
this.dataForm.enterTime = data.equipment.enterTime
|
||||
this.dataForm.productionTime = data.equipment.productionTime
|
||||
this.dataForm.equipmentTypeId = data.equipment.equipmentTypeId
|
||||
this.dataForm.groupId = data.equipment.groupId
|
||||
this.dataForm.dataType = data.equipment.dataType
|
||||
this.dataForm.tvalue = data.equipment.tvalue
|
||||
this.dataForm.processingTime = data.equipment.processingTime
|
||||
this.dataForm.manufacturer = data.equipment.manufacturer
|
||||
this.dataForm.spec = data.equipment.spec
|
||||
this.dataForm.description = data.equipment.description
|
||||
this.dataForm.enabled = data.equipment.enabled
|
||||
this.dataForm.remark = data.equipment.remark
|
||||
this.dataForm.valid = data.equipment.valid
|
||||
this.dataForm.creatorId = data.equipment.creatorId
|
||||
this.dataForm.creatorName = data.equipment.creatorName
|
||||
this.dataForm.createTime = data.equipment.createTime
|
||||
this.dataForm.updaterId = data.equipment.updaterId
|
||||
this.dataForm.updaterName = data.equipment.updaterName
|
||||
this.dataForm.updateTime = data.equipment.updateTime
|
||||
this.dataForm.version = data.equipment.version
|
||||
this.dataForm.externalCode = data.equipment.externalCode
|
||||
this.dataForm.externalCodeStatis = data.equipment.externalCodeStatis
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate(valid => {
|
||||
if (valid) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/equipment/${!this.dataForm.id ? '' : this.dataForm.id}`),
|
||||
method: this.dataForm.id ? 'put' : 'post',
|
||||
data: this.$http.adornData({
|
||||
id: this.dataForm.id || undefined,
|
||||
code: this.dataForm.code,
|
||||
name: this.dataForm.name,
|
||||
enName: this.dataForm.enName,
|
||||
abbr: this.dataForm.abbr,
|
||||
enterTime: this.dataForm.enterTime,
|
||||
productionTime: this.dataForm.productionTime,
|
||||
equipmentTypeId: this.dataForm.equipmentTypeId,
|
||||
groupId: this.dataForm.groupId,
|
||||
dataType: this.dataForm.dataType,
|
||||
tvalue: this.dataForm.tvalue,
|
||||
processingTime: this.dataForm.processingTime,
|
||||
manufacturer: this.dataForm.manufacturer,
|
||||
spec: this.dataForm.spec,
|
||||
description: this.dataForm.description,
|
||||
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,
|
||||
externalCode: this.dataForm.externalCode,
|
||||
externalCodeStatis: this.dataForm.externalCodeStatis
|
||||
})
|
||||
}).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>
|
||||
0
src/views/modules/monitoring/equipment-details.vue
Normal file
0
src/views/modules/monitoring/equipment-details.vue
Normal file
365
src/views/modules/monitoring/equipment.vue
Normal file
365
src/views/modules/monitoring/equipment.vue
Normal file
@@ -0,0 +1,365 @@
|
||||
<template>
|
||||
<div class="mod-config">
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<el-form-item>
|
||||
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<el-button v-if="$hasPermission('monitoring:equipment:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
<el-button @click="exportHandle()">导出</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" @operate-event="handleOperations" @refreshDataList="getDataList" />
|
||||
<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" :configs="addOrUpdateConfigs" @refreshDataList="getDataList" @destory-dialog="addOrUpdateVisible = false" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from '@/components/base-dialog/addOrUpdate'
|
||||
// import AddOrUpdate from './equipment-add-or-update'
|
||||
import BaseTable from '@/components/base-table'
|
||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
||||
import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
import moment from 'moment'
|
||||
import CKEditor from 'ckeditor4-vue'
|
||||
|
||||
const tableConfigs = [
|
||||
{
|
||||
type: 'index',
|
||||
name: '序号'
|
||||
// more: {
|
||||
// index: function(index) {
|
||||
// return (index + 1) * 2
|
||||
// }
|
||||
// }
|
||||
},
|
||||
{ prop: 'createTime', name: '添加时间', filter: val => moment(val).format('YYYY-MM-DD HH:mm:ss') },
|
||||
{ prop: 'name', name: '设备名称' },
|
||||
{ prop: 'code', name: '设备编码' },
|
||||
{ prop: 'equipmentTypeName', name: '设备类型' },
|
||||
{ prop: 'groupName', name: '设备分组' },
|
||||
{ prop: 'enName', name: '英文名称' },
|
||||
{ prop: 'abbr', name: '缩写' },
|
||||
{ prop: 'details', name: '详情', subcomponent: TableTextComponent, actionName: 'view-detail' },
|
||||
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
|
||||
const addOrUpdateConfigs = {
|
||||
type: 'dialog',
|
||||
infoUrl: '/monitoring/equipment',
|
||||
fields: [
|
||||
{ name: 'name', label: '设备名称', required: true },
|
||||
{ name: 'code', label: '设备编码' },
|
||||
{ name: 'enName', label: '英文名称' },
|
||||
{ name: 'abbr', label: '缩写' },
|
||||
{ name: 'equipmentTypeId', label: '设备类型', required: true, type: 'select', options: [] },
|
||||
{ name: 'groupId', label: '设备分组', required: true, type: 'select', options: [] },
|
||||
{
|
||||
name: 'productionTime',
|
||||
label: '生产日期',
|
||||
type: 'date',
|
||||
props: {
|
||||
'type': 'date', // element-ui 的配置
|
||||
'placeholder': '请选择日期',
|
||||
'value-format': 'yyyy-MM-ddTHH:mm:ss',
|
||||
'style': {
|
||||
width: '100%'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'enterTime',
|
||||
label: '进厂日期',
|
||||
type: 'date',
|
||||
props: {
|
||||
'type': 'date', // element-ui 的配置
|
||||
'placeholder': '请选择日期',
|
||||
'value-format': 'yyyy-MM-ddTHH:mm:ss',
|
||||
'style': {
|
||||
width: '100%'
|
||||
}
|
||||
}
|
||||
},
|
||||
{ name: 'tvalue', label: '设备TT值', required: true, rules: [{ type: 'number', message: '请输入正确的浮点值', trigger: 'blur', transform: val => Number(val) }] },
|
||||
{ name: 'processingTime', label: '单件产品加工时间(秒)', rules: [{ type: 'number', message: '请输入正确的数值', trigger: 'blur', transform: val => Number(val) }] },
|
||||
{ name: 'manufacturer', label: '制造商' },
|
||||
{ name: 'spec', label: '设备规格' },
|
||||
{
|
||||
name: 'dataType',
|
||||
label: '数据类别',
|
||||
required: true,
|
||||
type: 'select',
|
||||
options: [
|
||||
{ value: 0, label: '无类别' },
|
||||
{ value: 1, label: '上片数据设备' },
|
||||
{ value: 2, label: '下片数据设备' }
|
||||
]
|
||||
},
|
||||
{ name: 'remark', label: '备注 ' }
|
||||
],
|
||||
// TODO: 富文本 √
|
||||
// TODO: 设备资料上传 √
|
||||
// TODO: 设备图片上传 √
|
||||
extraComponents: [
|
||||
{
|
||||
name: 'description',
|
||||
hasModel: true,
|
||||
label: '功能描述',
|
||||
fieldType: 'string',
|
||||
component: CKEditor.component,
|
||||
props: {
|
||||
value: 'tests',
|
||||
config: {
|
||||
// ckeditor 的配置: https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_config.html
|
||||
// toolbar: [['Bold']]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'files',
|
||||
label: '上传资料',
|
||||
fieldType: 'array',
|
||||
component: () => import('@/components/base-upload'),
|
||||
props: {
|
||||
// 上传组件需要的 props
|
||||
url: '/monitoring/attachment/uploadFileFormData',
|
||||
extraParams: { typeCode: 'EquipmentInfoFile' },
|
||||
buttonContent: '点击上传',
|
||||
tip: '上传文件大小不要超过 2mb (2048kb)'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'files',
|
||||
label: '设备图片',
|
||||
fieldType: 'array',
|
||||
component: () => import('@/components/base-upload'),
|
||||
props: {
|
||||
// 上传组件需要的 props
|
||||
url: '/monitoring/attachment/uploadFileFormData',
|
||||
extraParams: { typeCode: 'EquipmentInfoImage' },
|
||||
buttonContent: '点击上传',
|
||||
tip: '上传图片文件,且大小不要超过 2mb (2048kb)'
|
||||
}
|
||||
}
|
||||
],
|
||||
subtable: {
|
||||
title: '查看设备属性',
|
||||
url: '/monitoring/equipmentAttr',
|
||||
relatedField: 'equipmentId',
|
||||
tableConfigs: [
|
||||
{ type: 'index', name: '序号' },
|
||||
{ prop: 'createTime', name: '创建时间' },
|
||||
{ prop: 'attrName', name: '属性名称', formField: true },
|
||||
{ prop: 'attrValue', name: '属性值', formField: true },
|
||||
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
},
|
||||
operations: [
|
||||
{ name: 'cancel', showAlways: true },
|
||||
{ name: 'save', url: '/monitoring/equipment', permission: '', showOnEdit: false },
|
||||
{ name: 'update', url: '/monitoring/equipment', permission: '', showOnEdit: true }
|
||||
]
|
||||
}
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
tableConfigs,
|
||||
addOrUpdateConfigs,
|
||||
dataForm: {
|
||||
key: ''
|
||||
},
|
||||
dataList: [],
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
dataListLoading: false,
|
||||
dataListSelections: [],
|
||||
addOrUpdateVisible: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate,
|
||||
BaseTable
|
||||
},
|
||||
activated() {
|
||||
console.log('activated')
|
||||
this.getDataList()
|
||||
this.getGroupList()
|
||||
this.getTypeList()
|
||||
},
|
||||
methods: {
|
||||
// 获取设备类型列表
|
||||
getTypeList() {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentType/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
// page: this.pageIndex,
|
||||
// limit: this.pageSize,
|
||||
// key: this.dataForm.key
|
||||
})
|
||||
}).then(({ data }) => {
|
||||
const eqTypeConfig = this.addOrUpdateConfigs.fields.find(item => item.name === 'equipmentTypeId')
|
||||
eqTypeConfig.options = data.data?.list?.map(item => ({ value: item.id, label: item.name })) || []
|
||||
})
|
||||
},
|
||||
// 获取设备分组列表
|
||||
getGroupList() {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentGroup/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
// page: this.pageIndex,
|
||||
// limit: this.pageSize,
|
||||
// key: this.dataForm.key
|
||||
})
|
||||
}).then(({ data }) => {
|
||||
const groupConfig = this.addOrUpdateConfigs.fields.find(item => item.name === 'groupId')
|
||||
groupConfig.options = data.data?.list?.map(item => ({ value: item.id, label: item.name })) || []
|
||||
})
|
||||
},
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipment/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
page: this.pageIndex,
|
||||
limit: this.pageSize,
|
||||
key: this.dataForm.key
|
||||
})
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataList = data.data.list
|
||||
this.totalPage = data.data.total
|
||||
} else {
|
||||
this.dataList = []
|
||||
this.totalPage = 0
|
||||
}
|
||||
this.dataListLoading = false
|
||||
})
|
||||
},
|
||||
// 每页数
|
||||
sizeChangeHandle(val) {
|
||||
this.pageSize = val
|
||||
this.pageIndex = 1
|
||||
this.getDataList()
|
||||
},
|
||||
// 当前页
|
||||
currentChangeHandle(val) {
|
||||
this.pageIndex = val
|
||||
this.getDataList()
|
||||
},
|
||||
// 多选
|
||||
selectionChangeHandle(val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
handleOperations({ type, data: id }) {
|
||||
switch (type) {
|
||||
case 'view-detail':
|
||||
// const { name, code } = this.dataList.find(item => item.id === id)
|
||||
// this.$router.push({
|
||||
// name: 'monitoring-equipmentAdd',
|
||||
// params: {
|
||||
// isdetail: true,
|
||||
// equipmentId: id
|
||||
// }
|
||||
// })
|
||||
// break
|
||||
return this.addOrUpdateHandle(id, true)
|
||||
case 'edit':
|
||||
return this.addOrUpdateHandle(id)
|
||||
case 'delete':
|
||||
return this.deleteHandle(id)
|
||||
}
|
||||
},
|
||||
exportHandle() {
|
||||
// this.$http.get(this.$http.adornUrl('/monitoring/equipment/export')).then(({ data: res }) => {
|
||||
this.$http({ url: this.$http.adornUrl('/monitoring/equipment/export'), method: 'get', responseType: 'blob' }).then(res => {
|
||||
let fileName = 'equipment-list.xls'
|
||||
if (res.headers['content-disposition']) {
|
||||
const contentDisposition = res.headers['content-disposition']
|
||||
fileName = contentDisposition.slice(contentDisposition.indexOf('filename=') + 9)
|
||||
}
|
||||
|
||||
fileName = decodeURIComponent(fileName)
|
||||
|
||||
const blob = new Blob([res.data])
|
||||
|
||||
if ('download' in document.createElement('a')) {
|
||||
const alink = document.createElement('a')
|
||||
alink.download = fileName
|
||||
alink.style.display = 'none'
|
||||
alink.target = '_blank'
|
||||
alink.href = URL.createObjectURL(blob)
|
||||
document.body.appendChild(alink)
|
||||
alink.click()
|
||||
URL.revokeObjectURL(alink.href)
|
||||
document.body.removeChild(alink)
|
||||
} else {
|
||||
navigator.msSaveBlob(blob, fileName)
|
||||
}
|
||||
})
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle(id, isdetail = false) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id, isdetail)
|
||||
})
|
||||
// this.$router.push({
|
||||
// name: 'monitoring-equipmentAdd',
|
||||
// params: {
|
||||
// equipmentId: id
|
||||
// }
|
||||
// })
|
||||
},
|
||||
// 删除
|
||||
deleteHandle(id) {
|
||||
var ids = id
|
||||
? [id]
|
||||
: this.dataListSelections.map(item => {
|
||||
return item.id
|
||||
})
|
||||
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipment'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getDataList()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
32
src/views/modules/monitoring/equipmentAdd.vue
Normal file
32
src/views/modules/monitoring/equipmentAdd.vue
Normal file
@@ -0,0 +1,32 @@
|
||||
<template>
|
||||
<div class="equipment-add">
|
||||
<h2>{{ $route.params.isdetail ? '查看详情' : $route.params.equipmentId ? '编辑' : '新增' }}</h2>
|
||||
<p>id: {{ $route.params.equipmentId }}</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'EquipmentAdd',
|
||||
props: {},
|
||||
data() {
|
||||
return {}
|
||||
},
|
||||
watch: {
|
||||
'$route.params': function(val, oldVal) {}
|
||||
},
|
||||
methods: {}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.equipment-add {
|
||||
background: #fff;
|
||||
padding: 12px;
|
||||
min-height: 50vh;
|
||||
}
|
||||
|
||||
h2 {
|
||||
margin: 8px 0;
|
||||
}
|
||||
</style>
|
||||
163
src/views/modules/monitoring/equipmentAlarmLog-add-or-update.vue
Normal file
163
src/views/modules/monitoring/equipmentAlarmLog-add-or-update.vue
Normal file
@@ -0,0 +1,163 @@
|
||||
<template>
|
||||
<el-dialog :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-item label="报警信息ID,关联T_equipment_group_alarm表" prop="alarmId">
|
||||
<el-input v-model="dataForm.alarmId" placeholder="报警信息ID,关联T_equipment_group_alarm表"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="报警来源" prop="alarmSource">
|
||||
<el-input v-model="dataForm.alarmSource" placeholder="报警来源"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="报警详细内容" prop="alarmContent">
|
||||
<el-input v-model="dataForm.alarmContent" placeholder="报警详细内容"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="报警设备id 关联equipment表" prop="alarmEquipmentId">
|
||||
<el-input v-model="dataForm.alarmEquipmentId" placeholder="报警设备id 关联equipment表"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="dataForm.remark" placeholder="备注"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="删除标志,是否有效:1 可用 0不可用" prop="valid">
|
||||
<el-input v-model="dataForm.valid" placeholder="删除标志,是否有效:1 可用 0不可用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人" prop="creatorId">
|
||||
<el-input v-model="dataForm.creatorId" placeholder="创建人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人姓名" prop="creatorName">
|
||||
<el-input v-model="dataForm.creatorName" placeholder="创建人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-input v-model="dataForm.createTime" placeholder="创建时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人" prop="updaterId">
|
||||
<el-input v-model="dataForm.updaterId" placeholder="更新人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人姓名" prop="updaterName">
|
||||
<el-input v-model="dataForm.updaterName" placeholder="更新人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新时间" prop="updateTime">
|
||||
<el-input v-model="dataForm.updateTime" placeholder="更新时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="版本号" prop="version">
|
||||
<el-input v-model="dataForm.version" placeholder="版本号"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
alarmId: '',
|
||||
alarmSource: '',
|
||||
alarmContent: '',
|
||||
alarmEquipmentId: '',
|
||||
remark: '',
|
||||
valid: '',
|
||||
creatorId: '',
|
||||
creatorName: '',
|
||||
createTime: '',
|
||||
updaterId: '',
|
||||
updaterName: '',
|
||||
updateTime: '',
|
||||
version: ''
|
||||
},
|
||||
dataRule: {
|
||||
alarmId: [{ required: true, message: '报警信息ID,关联T_equipment_group_alarm表不能为空', trigger: 'blur' }],
|
||||
alarmSource: [{ required: true, message: '报警来源不能为空', trigger: 'blur' }],
|
||||
alarmContent: [{ required: true, message: '报警详细内容不能为空', trigger: 'blur' }],
|
||||
alarmEquipmentId: [{ required: true, message: '报警设备id 关联equipment表不能为空', 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: {
|
||||
init(id) {
|
||||
this.dataForm.id = id || 0
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/equipmentAlarmLog/${this.dataForm.id}`),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams()
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataForm.alarmId = data.equipmenalarmLog.alarmId
|
||||
this.dataForm.alarmSource = data.equipmenalarmLog.alarmSource
|
||||
this.dataForm.alarmContent = data.equipmenalarmLog.alarmContent
|
||||
this.dataForm.alarmEquipmentId = data.equipmenalarmLog.alarmEquipmentId
|
||||
this.dataForm.remark = data.equipmenalarmLog.remark
|
||||
this.dataForm.valid = data.equipmenalarmLog.valid
|
||||
this.dataForm.creatorId = data.equipmenalarmLog.creatorId
|
||||
this.dataForm.creatorName = data.equipmenalarmLog.creatorName
|
||||
this.dataForm.createTime = data.equipmenalarmLog.createTime
|
||||
this.dataForm.updaterId = data.equipmenalarmLog.updaterId
|
||||
this.dataForm.updaterName = data.equipmenalarmLog.updaterName
|
||||
this.dataForm.updateTime = data.equipmenalarmLog.updateTime
|
||||
this.dataForm.version = data.equipmenalarmLog.version
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate(valid => {
|
||||
if (valid) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/equipmentAlarmLog/${!this.dataForm.id ? '' : this.dataForm.id}`),
|
||||
method: this.dataForm.id ? 'put' : 'post',
|
||||
data: this.$http.adornData({
|
||||
id: this.dataForm.id || undefined,
|
||||
alarmId: this.dataForm.alarmId,
|
||||
alarmSource: this.dataForm.alarmSource,
|
||||
alarmContent: this.dataForm.alarmContent,
|
||||
alarmEquipmentId: this.dataForm.alarmEquipmentId,
|
||||
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>
|
||||
175
src/views/modules/monitoring/equipmentAlarmLog.vue
Normal file
175
src/views/modules/monitoring/equipmentAlarmLog.vue
Normal file
@@ -0,0 +1,175 @@
|
||||
<template>
|
||||
<div class="mod-config">
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<el-form-item>
|
||||
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<el-button v-if="$hasPermission('monitoring:equipmenalarmlog:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- <el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" style="width: 100%;">
|
||||
<el-table-column type="selection" header-align="center" align="center" width="50"> </el-table-column>
|
||||
<el-table-column prop="id" header-align="center" align="center" label="ID"> </el-table-column>
|
||||
<el-table-column prop="alarmId" header-align="center" align="center" label="报警信息ID,关联T_equipment_group_alarm表"> </el-table-column>
|
||||
<el-table-column prop="alarmSource" header-align="center" align="center" label="报警来源"> </el-table-column>
|
||||
<el-table-column prop="alarmContent" header-align="center" align="center" label="报警详细内容"> </el-table-column>
|
||||
<el-table-column prop="alarmEquipmentId" header-align="center" align="center" label="报警设备id 关联equipment表"> </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 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> -->
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" />
|
||||
<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>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from './equipmentAlarmLog-add-or-update'
|
||||
import BaseTable from '@/components/base-table'
|
||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
||||
import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
|
||||
const tableConfigs = [
|
||||
{ prop: 'id', name: 'ID' },
|
||||
{ prop: 'alarmId', name: '报警信息ID,关联T_equipment_group_alarm表' },
|
||||
{ prop: 'alarmSource', name: '报警来源' },
|
||||
{ prop: 'alarmContent', name: '报警详细内容' },
|
||||
{ prop: 'alarmEquipmentId', name: '报警设备id 关联equipment表' },
|
||||
{ prop: 'remark', name: '备注' },
|
||||
{ prop: 'valid', name: '删除标志,是否有效:1 可用 0不可用' },
|
||||
{ prop: 'creatorId', name: '创建人' },
|
||||
{ prop: 'creatorName', name: '创建人姓名' },
|
||||
{ prop: 'createTime', name: '创建时间' },
|
||||
{ prop: 'updaterId', name: '更新人' },
|
||||
{ prop: 'updaterName', name: '更新人姓名' },
|
||||
{ prop: 'updateTime', name: '更新时间' },
|
||||
{ prop: 'version', name: '版本号' }, { prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {tableConfigs,
|
||||
dataForm: {
|
||||
key: ''
|
||||
},
|
||||
dataList: [],
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
dataListLoading: false,
|
||||
dataListSelections: [],
|
||||
addOrUpdateVisible: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate,BaseTable
|
||||
},
|
||||
activated() {
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentAlarmLog/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
page: this.pageIndex,
|
||||
limit: this.pageSize,
|
||||
key: this.dataForm.key
|
||||
})
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataList = data.data.list
|
||||
this.totalPage = data.data.total
|
||||
} else {
|
||||
this.dataList = []
|
||||
this.totalPage = 0
|
||||
}
|
||||
this.dataListLoading = false
|
||||
})
|
||||
},
|
||||
// 每页数
|
||||
sizeChangeHandle(val) {
|
||||
this.pageSize = val
|
||||
this.pageIndex = 1
|
||||
this.getDataList()
|
||||
},
|
||||
// 当前页
|
||||
currentChangeHandle(val) {
|
||||
this.pageIndex = val
|
||||
this.getDataList()
|
||||
},
|
||||
// 多选
|
||||
selectionChangeHandle(val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
},
|
||||
// 删除
|
||||
deleteHandle(id) {
|
||||
var ids = id
|
||||
? [id]
|
||||
: this.dataListSelections.map(item => {
|
||||
return item.id
|
||||
})
|
||||
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentAlarmLog'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getDataList()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
156
src/views/modules/monitoring/equipmentAttr-add-or-update.vue
Normal file
156
src/views/modules/monitoring/equipmentAttr-add-or-update.vue
Normal file
@@ -0,0 +1,156 @@
|
||||
<template>
|
||||
<el-dialog :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-item label="设备ID" prop="equipmentId">
|
||||
<el-input v-model="dataForm.equipmentId" placeholder="设备ID"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="属性名称" prop="attrName">
|
||||
<el-input v-model="dataForm.attrName" placeholder="属性名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="属性值" prop="attrValue">
|
||||
<el-input v-model="dataForm.attrValue" placeholder="属性值"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="dataForm.remark" placeholder="备注"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="删除标志,是否有效:1 可用 0不可用" prop="valid">
|
||||
<el-input v-model="dataForm.valid" placeholder="删除标志,是否有效:1 可用 0不可用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人" prop="creatorId">
|
||||
<el-input v-model="dataForm.creatorId" placeholder="创建人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人姓名" prop="creatorName">
|
||||
<el-input v-model="dataForm.creatorName" placeholder="创建人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-input v-model="dataForm.createTime" placeholder="创建时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人" prop="updaterId">
|
||||
<el-input v-model="dataForm.updaterId" placeholder="更新人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人姓名" prop="updaterName">
|
||||
<el-input v-model="dataForm.updaterName" placeholder="更新人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新时间" prop="updateTime">
|
||||
<el-input v-model="dataForm.updateTime" placeholder="更新时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="版本号" prop="version">
|
||||
<el-input v-model="dataForm.version" placeholder="版本号"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
equipmentId: '',
|
||||
attrName: '',
|
||||
attrValue: '',
|
||||
remark: '',
|
||||
valid: '',
|
||||
creatorId: '',
|
||||
creatorName: '',
|
||||
createTime: '',
|
||||
updaterId: '',
|
||||
updaterName: '',
|
||||
updateTime: '',
|
||||
version: ''
|
||||
},
|
||||
dataRule: {
|
||||
equipmentId: [{ required: true, message: '设备ID不能为空', trigger: 'blur' }],
|
||||
attrName: [{ required: true, message: '属性名称不能为空', trigger: 'blur' }],
|
||||
attrValue: [{ 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: {
|
||||
init(id) {
|
||||
this.dataForm.id = id || 0
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/equipmentAttr/${this.dataForm.id}`),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams()
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataForm.equipmentId = data.equipmenattr.equipmentId
|
||||
this.dataForm.attrName = data.equipmenattr.attrName
|
||||
this.dataForm.attrValue = data.equipmenattr.attrValue
|
||||
this.dataForm.remark = data.equipmenattr.remark
|
||||
this.dataForm.valid = data.equipmenattr.valid
|
||||
this.dataForm.creatorId = data.equipmenattr.creatorId
|
||||
this.dataForm.creatorName = data.equipmenattr.creatorName
|
||||
this.dataForm.createTime = data.equipmenattr.createTime
|
||||
this.dataForm.updaterId = data.equipmenattr.updaterId
|
||||
this.dataForm.updaterName = data.equipmenattr.updaterName
|
||||
this.dataForm.updateTime = data.equipmenattr.updateTime
|
||||
this.dataForm.version = data.equipmenattr.version
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate(valid => {
|
||||
if (valid) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/equipmentAttr/${!this.dataForm.id ? '' : this.dataForm.id}`),
|
||||
method: this.dataForm.id ? 'put' : 'post',
|
||||
data: this.$http.adornData({
|
||||
id: this.dataForm.id || undefined,
|
||||
equipmentId: this.dataForm.equipmentId,
|
||||
attrName: this.dataForm.attrName,
|
||||
attrValue: this.dataForm.attrValue,
|
||||
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>
|
||||
184
src/views/modules/monitoring/equipmentFile-add-or-update.vue
Normal file
184
src/views/modules/monitoring/equipmentFile-add-or-update.vue
Normal file
@@ -0,0 +1,184 @@
|
||||
<template>
|
||||
<el-dialog :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-item label="设备ID" prop="equipmentId">
|
||||
<el-input v-model="dataForm.equipmentId" placeholder="设备ID"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="文件ID" prop="fileId">
|
||||
<el-input v-model="dataForm.fileId" placeholder="文件ID"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="描述" prop="description">
|
||||
<el-input v-model="dataForm.description" placeholder="描述"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="启用状态:0 、停用,1、启用" prop="enabled">
|
||||
<el-input v-model="dataForm.enabled" placeholder="启用状态:0 、停用,1、启用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="dataForm.remark" placeholder="备注"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="删除标志,是否有效:1 可用 0不可用" prop="valid">
|
||||
<el-input v-model="dataForm.valid" placeholder="删除标志,是否有效:1 可用 0不可用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人" prop="creatorId">
|
||||
<el-input v-model="dataForm.creatorId" placeholder="创建人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人姓名" prop="creatorName">
|
||||
<el-input v-model="dataForm.creatorName" placeholder="创建人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-input v-model="dataForm.createTime" placeholder="创建时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人" prop="updaterId">
|
||||
<el-input v-model="dataForm.updaterId" placeholder="更新人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人姓名" prop="updaterName">
|
||||
<el-input v-model="dataForm.updaterName" placeholder="更新人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新时间" prop="updateTime">
|
||||
<el-input v-model="dataForm.updateTime" placeholder="更新时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="版本号" prop="version">
|
||||
<el-input v-model="dataForm.version" placeholder="版本号"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="文件类型编号" prop="typeCode">
|
||||
<el-input v-model="dataForm.typeCode" placeholder="文件类型编号"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="文件名字" prop="fileName">
|
||||
<el-input v-model="dataForm.fileName" placeholder="文件名字"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="下载地址" prop="fileUrl">
|
||||
<el-input v-model="dataForm.fileUrl" placeholder="下载地址"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
equipmentId: '',
|
||||
fileId: '',
|
||||
description: '',
|
||||
enabled: '',
|
||||
remark: '',
|
||||
valid: '',
|
||||
creatorId: '',
|
||||
creatorName: '',
|
||||
createTime: '',
|
||||
updaterId: '',
|
||||
updaterName: '',
|
||||
updateTime: '',
|
||||
version: '',
|
||||
typeCode: '',
|
||||
fileName: '',
|
||||
fileUrl: ''
|
||||
},
|
||||
dataRule: {
|
||||
equipmentId: [{ required: true, message: '设备ID不能为空', trigger: 'blur' }],
|
||||
fileId: [{ required: true, message: '文件ID不能为空', trigger: 'blur' }],
|
||||
description: [{ required: true, message: '描述不能为空', trigger: 'blur' }],
|
||||
enabled: [{ required: true, message: '启用状态:0 、停用,1、启用不能为空', 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' }],
|
||||
typeCode: [{ required: true, message: '文件类型编号不能为空', trigger: 'blur' }],
|
||||
fileName: [{ required: true, message: '文件名字不能为空', trigger: 'blur' }],
|
||||
fileUrl: [{ required: true, message: '下载地址不能为空', trigger: 'blur' }]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init(id) {
|
||||
this.dataForm.id = id || 0
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/equipmentFile/${this.dataForm.id}`),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams()
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataForm.equipmentId = data.equipmenfile.equipmentId
|
||||
this.dataForm.fileId = data.equipmenfile.fileId
|
||||
this.dataForm.description = data.equipmenfile.description
|
||||
this.dataForm.enabled = data.equipmenfile.enabled
|
||||
this.dataForm.remark = data.equipmenfile.remark
|
||||
this.dataForm.valid = data.equipmenfile.valid
|
||||
this.dataForm.creatorId = data.equipmenfile.creatorId
|
||||
this.dataForm.creatorName = data.equipmenfile.creatorName
|
||||
this.dataForm.createTime = data.equipmenfile.createTime
|
||||
this.dataForm.updaterId = data.equipmenfile.updaterId
|
||||
this.dataForm.updaterName = data.equipmenfile.updaterName
|
||||
this.dataForm.updateTime = data.equipmenfile.updateTime
|
||||
this.dataForm.version = data.equipmenfile.version
|
||||
this.dataForm.typeCode = data.equipmenfile.typeCode
|
||||
this.dataForm.fileName = data.equipmenfile.fileName
|
||||
this.dataForm.fileUrl = data.equipmenfile.fileUrl
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate(valid => {
|
||||
if (valid) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/equipmentFile/${!this.dataForm.id ? '' : this.dataForm.id}`),
|
||||
method: this.dataForm.id ? 'put' : 'post',
|
||||
data: this.$http.adornData({
|
||||
id: this.dataForm.id || undefined,
|
||||
equipmentId: this.dataForm.equipmentId,
|
||||
fileId: this.dataForm.fileId,
|
||||
description: this.dataForm.description,
|
||||
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,
|
||||
typeCode: this.dataForm.typeCode,
|
||||
fileName: this.dataForm.fileName,
|
||||
fileUrl: this.dataForm.fileUrl
|
||||
})
|
||||
}).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>
|
||||
184
src/views/modules/monitoring/equipmentFile.vue
Normal file
184
src/views/modules/monitoring/equipmentFile.vue
Normal file
@@ -0,0 +1,184 @@
|
||||
<template>
|
||||
<div class="mod-config">
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<el-form-item>
|
||||
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<el-button v-if="$hasPermission('monitoring:equipmenfile:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- <el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" style="width: 100%;">
|
||||
<el-table-column type="selection" header-align="center" align="center" width="50"> </el-table-column>
|
||||
<el-table-column prop="id" header-align="center" align="center" label=""> </el-table-column>
|
||||
<el-table-column prop="equipmentId" header-align="center" align="center" label="设备ID"> </el-table-column>
|
||||
<el-table-column prop="fileId" header-align="center" align="center" label="文件ID"> </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="typeCode" header-align="center" align="center" label="文件类型编号"> </el-table-column>
|
||||
<el-table-column prop="fileName" header-align="center" align="center" label="文件名字"> </el-table-column>
|
||||
<el-table-column prop="fileUrl" 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> -->
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" />
|
||||
<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>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from './equipmentFile-add-or-update'
|
||||
import BaseTable from '@/components/base-table'
|
||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
||||
import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
|
||||
const tableConfigs = [
|
||||
{ prop: 'id', name: '' },
|
||||
{ prop: 'equipmentId', name: '设备ID' },
|
||||
{ prop: 'fileId', name: '文件ID' },
|
||||
{ prop: 'description', name: '描述' },
|
||||
{ prop: 'enabled', name: '启用状态:0 、停用,1、启用' },
|
||||
{ prop: 'remark', name: '备注' },
|
||||
{ prop: 'valid', name: '删除标志,是否有效:1 可用 0不可用' },
|
||||
{ prop: 'creatorId', name: '创建人' },
|
||||
{ prop: 'creatorName', name: '创建人姓名' },
|
||||
{ prop: 'createTime', name: '添加时间' },
|
||||
{ prop: 'updaterId', name: '更新人' },
|
||||
{ prop: 'updaterName', name: '更新人姓名' },
|
||||
{ prop: 'updateTime', name: '更新时间' },
|
||||
{ prop: 'version', name: '版本号' },
|
||||
{ prop: 'typeCode', name: '文件类型编号' },
|
||||
{ prop: 'fileName', name: '文件名字' },
|
||||
{ prop: 'fileUrl', name: '下载地址' },
|
||||
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
tableConfigs,
|
||||
dataForm: {
|
||||
key: ''
|
||||
},
|
||||
dataList: [],
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
dataListLoading: false,
|
||||
dataListSelections: [],
|
||||
addOrUpdateVisible: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate,
|
||||
BaseTable
|
||||
},
|
||||
activated() {
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentFile/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
page: this.pageIndex,
|
||||
limit: this.pageSize,
|
||||
key: this.dataForm.key
|
||||
})
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataList = data.data.list
|
||||
this.totalPage = data.data.total
|
||||
} else {
|
||||
this.dataList = []
|
||||
this.totalPage = 0
|
||||
}
|
||||
this.dataListLoading = false
|
||||
})
|
||||
},
|
||||
// 每页数
|
||||
sizeChangeHandle(val) {
|
||||
this.pageSize = val
|
||||
this.pageIndex = 1
|
||||
this.getDataList()
|
||||
},
|
||||
// 当前页
|
||||
currentChangeHandle(val) {
|
||||
this.pageIndex = val
|
||||
this.getDataList()
|
||||
},
|
||||
// 多选
|
||||
selectionChangeHandle(val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
},
|
||||
// 删除
|
||||
deleteHandle(id) {
|
||||
var ids = id
|
||||
? [id]
|
||||
: this.dataListSelections.map(item => {
|
||||
return item.id
|
||||
})
|
||||
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentFile'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getDataList()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
163
src/views/modules/monitoring/equipmentGroup-add-or-update.vue
Normal file
163
src/views/modules/monitoring/equipmentGroup-add-or-update.vue
Normal file
@@ -0,0 +1,163 @@
|
||||
<template>
|
||||
<el-dialog :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-item label="分组编码" prop="code">
|
||||
<el-input v-model="dataForm.code" placeholder="分组编码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="分组名字" prop="name">
|
||||
<el-input v-model="dataForm.name" placeholder="分组名字"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备类型id" prop="typeId">
|
||||
<el-input v-model="dataForm.typeId" placeholder="设备类型id"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="描述" prop="description">
|
||||
<el-input v-model="dataForm.description" placeholder="描述"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="dataForm.remark" placeholder="备注"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="删除标志,是否有效:1 可用 0不可用" prop="valid">
|
||||
<el-input v-model="dataForm.valid" placeholder="删除标志,是否有效:1 可用 0不可用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人" prop="creatorId">
|
||||
<el-input v-model="dataForm.creatorId" placeholder="创建人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人姓名" prop="creatorName">
|
||||
<el-input v-model="dataForm.creatorName" placeholder="创建人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-input v-model="dataForm.createTime" placeholder="创建时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人" prop="updaterId">
|
||||
<el-input v-model="dataForm.updaterId" placeholder="更新人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人姓名" prop="updaterName">
|
||||
<el-input v-model="dataForm.updaterName" placeholder="更新人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新时间" prop="updateTime">
|
||||
<el-input v-model="dataForm.updateTime" placeholder="更新时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="版本号" prop="version">
|
||||
<el-input v-model="dataForm.version" placeholder="版本号"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
code: '',
|
||||
name: '',
|
||||
typeId: '',
|
||||
description: '',
|
||||
remark: '',
|
||||
valid: '',
|
||||
creatorId: '',
|
||||
creatorName: '',
|
||||
createTime: '',
|
||||
updaterId: '',
|
||||
updaterName: '',
|
||||
updateTime: '',
|
||||
version: ''
|
||||
},
|
||||
dataRule: {
|
||||
code: [{ required: true, message: '分组编码不能为空', trigger: 'blur' }],
|
||||
name: [{ required: true, message: '分组名字不能为空', trigger: 'blur' }],
|
||||
typeId: [{ required: true, message: '设备类型id不能为空', trigger: 'blur' }],
|
||||
description: [{ 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: {
|
||||
init(id) {
|
||||
this.dataForm.id = id || 0
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/equipmentGroup/${this.dataForm.id}`),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams()
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataForm.code = data.equipmengroup.code
|
||||
this.dataForm.name = data.equipmengroup.name
|
||||
this.dataForm.typeId = data.equipmengroup.typeId
|
||||
this.dataForm.description = data.equipmengroup.description
|
||||
this.dataForm.remark = data.equipmengroup.remark
|
||||
this.dataForm.valid = data.equipmengroup.valid
|
||||
this.dataForm.creatorId = data.equipmengroup.creatorId
|
||||
this.dataForm.creatorName = data.equipmengroup.creatorName
|
||||
this.dataForm.createTime = data.equipmengroup.createTime
|
||||
this.dataForm.updaterId = data.equipmengroup.updaterId
|
||||
this.dataForm.updaterName = data.equipmengroup.updaterName
|
||||
this.dataForm.updateTime = data.equipmengroup.updateTime
|
||||
this.dataForm.version = data.equipmengroup.version
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate(valid => {
|
||||
if (valid) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/equipmentGroup/${!this.dataForm.id ? '' : this.dataForm.id}`),
|
||||
method: this.dataForm.id ? 'put' : 'post',
|
||||
data: this.$http.adornData({
|
||||
id: this.dataForm.id || undefined,
|
||||
code: this.dataForm.code,
|
||||
name: this.dataForm.name,
|
||||
typeId: this.dataForm.typeId,
|
||||
description: this.dataForm.description,
|
||||
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>
|
||||
201
src/views/modules/monitoring/equipmentGroup.vue
Normal file
201
src/views/modules/monitoring/equipmentGroup.vue
Normal file
@@ -0,0 +1,201 @@
|
||||
<template>
|
||||
<div class="mod-config">
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<el-form-item>
|
||||
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<el-button v-if="$hasPermission('monitoring:equipmentgroup:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- <el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" style="width: 100%;">
|
||||
<el-table-column type="selection" header-align="center" align="center" width="50"> </el-table-column>
|
||||
<el-table-column 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="typeId" header-align="center" align="center" label="设备类型id"> </el-table-column>
|
||||
<el-table-column prop="description" header-align="center" align="center" label="描述"> </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 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> -->
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" @operate-event="handleOperations" @refreshDataList="getDataList" />
|
||||
<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" :configs="addOrUpdateConfigs" @refreshDataList="getDataList" @destory-dialog="addOrUpdateVisible = false" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from '@/components/base-dialog/addOrUpdate'
|
||||
// import AddOrUpdate from './equipmentGroup-add-or-update'
|
||||
import BaseTable from '@/components/base-table'
|
||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
||||
import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
|
||||
const tableConfigs = [
|
||||
{ prop: 'createTime', name: '添加时间' },
|
||||
{ prop: 'name', name: '分组名称' },
|
||||
{ prop: 'code', name: '分组编码' },
|
||||
{ prop: 'remark', name: '备注' },
|
||||
{ prop: 'alarm', name: '报警', buttonContent: '查看报警', subcomponent: TableTextComponent, actionName: 'view-alarm' },
|
||||
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
|
||||
const addOrUpdateConfigs = {
|
||||
type: 'dialog',
|
||||
infoUrl: '/monitoring/equipmentGroup',
|
||||
fields: [{ name: 'name', label: '分组名称' }, { name: 'code', label: '分组编码' }, 'remark'],
|
||||
operations: [
|
||||
{ name: 'cancel', showAlways: true },
|
||||
{ name: 'save', url: '/monitoring/equipmentGroup', permission: '', showOnEdit: false },
|
||||
{ name: 'update', url: '/monitoring/equipmentGroup', permission: '', showOnEdit: true }
|
||||
]
|
||||
}
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
addOrUpdateConfigs,
|
||||
tableConfigs,
|
||||
dataForm: {
|
||||
key: ''
|
||||
},
|
||||
dataList: [],
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
dataListLoading: false,
|
||||
dataListSelections: [],
|
||||
addOrUpdateVisible: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate,
|
||||
BaseTable
|
||||
},
|
||||
activated() {
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.addOrUpdateVisible = false
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentGroup/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
page: this.pageIndex,
|
||||
limit: this.pageSize,
|
||||
key: this.dataForm.key
|
||||
})
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataList = data.data.list
|
||||
this.totalPage = data.data.total
|
||||
} else {
|
||||
this.dataList = []
|
||||
this.totalPage = 0
|
||||
}
|
||||
this.dataListLoading = false
|
||||
})
|
||||
},
|
||||
// 每页数
|
||||
sizeChangeHandle(val) {
|
||||
this.pageSize = val
|
||||
this.pageIndex = 1
|
||||
this.getDataList()
|
||||
},
|
||||
// 当前页
|
||||
currentChangeHandle(val) {
|
||||
this.pageIndex = val
|
||||
this.getDataList()
|
||||
},
|
||||
// 多选
|
||||
selectionChangeHandle(val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
handleOperations({ type, data: id }) {
|
||||
switch (type) {
|
||||
case 'view-alarm':
|
||||
const { name, code } = this.dataList.find(item => item.id === id)
|
||||
this.$router.push({
|
||||
name: 'monitoring-equipmentGroupAlarm',
|
||||
params: {
|
||||
groupName: name,
|
||||
groupCode: code,
|
||||
id
|
||||
}
|
||||
})
|
||||
break
|
||||
case 'edit':
|
||||
return this.addOrUpdateHandle(id)
|
||||
case 'delete':
|
||||
return this.deleteHandle(id)
|
||||
}
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
},
|
||||
// 删除
|
||||
deleteHandle(id) {
|
||||
var ids = id
|
||||
? [id]
|
||||
: this.dataListSelections.map(item => {
|
||||
return item.id
|
||||
})
|
||||
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentGroup'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getDataList()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,198 @@
|
||||
<template>
|
||||
<el-dialog :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-item label="设备分组ID,关联t_equipment_group" prop="equipmentGroupId">
|
||||
<el-input v-model="dataForm.equipmentGroupId" placeholder="设备分组ID,关联t_equipment_group"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="编码" prop="code">
|
||||
<el-input v-model="dataForm.code" placeholder="编码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="报警类型 字典表关联label_value" prop="typeDictValue">
|
||||
<el-input v-model="dataForm.typeDictValue" placeholder="报警类型 字典表关联label_value"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="报警级别 字典表关联label_value" prop="gradeDictValue">
|
||||
<el-input v-model="dataForm.gradeDictValue" placeholder="报警级别 字典表关联label_value"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="报警内容" prop="alarmContent">
|
||||
<el-input v-model="dataForm.alarmContent" placeholder="报警内容"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="描述" prop="description">
|
||||
<el-input v-model="dataForm.description" placeholder="描述"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="外部编码,用于对照外部系统的编码" prop="externalCode">
|
||||
<el-input v-model="dataForm.externalCode" placeholder="外部编码,用于对照外部系统的编码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="启用状态:0 、停用,1、启用" prop="enabled">
|
||||
<el-input v-model="dataForm.enabled" placeholder="启用状态:0 、停用,1、启用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="dataForm.remark" placeholder="备注"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="删除标志,是否有效:1 可用 0不可用" prop="valid">
|
||||
<el-input v-model="dataForm.valid" placeholder="删除标志,是否有效:1 可用 0不可用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人" prop="creatorId">
|
||||
<el-input v-model="dataForm.creatorId" placeholder="创建人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人姓名" prop="creatorName">
|
||||
<el-input v-model="dataForm.creatorName" placeholder="创建人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-input v-model="dataForm.createTime" placeholder="创建时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人" prop="updaterId">
|
||||
<el-input v-model="dataForm.updaterId" placeholder="更新人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人姓名" prop="updaterName">
|
||||
<el-input v-model="dataForm.updaterName" placeholder="更新人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新时间" prop="updateTime">
|
||||
<el-input v-model="dataForm.updateTime" placeholder="更新时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="版本号" prop="version">
|
||||
<el-input v-model="dataForm.version" placeholder="版本号"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="推送方式 0邮箱 1微信" prop="alarmNotify">
|
||||
<el-input v-model="dataForm.alarmNotify" placeholder="推送方式 0邮箱 1微信"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
equipmentGroupId: '',
|
||||
code: '',
|
||||
typeDictValue: '',
|
||||
gradeDictValue: '',
|
||||
alarmContent: '',
|
||||
description: '',
|
||||
externalCode: '',
|
||||
enabled: '',
|
||||
remark: '',
|
||||
valid: '',
|
||||
creatorId: '',
|
||||
creatorName: '',
|
||||
createTime: '',
|
||||
updaterId: '',
|
||||
updaterName: '',
|
||||
updateTime: '',
|
||||
version: '',
|
||||
alarmNotify: ''
|
||||
},
|
||||
dataRule: {
|
||||
equipmentGroupId: [{ required: true, message: '设备分组ID,关联t_equipment_group不能为空', trigger: 'blur' }],
|
||||
code: [{ required: true, message: '编码不能为空', trigger: 'blur' }],
|
||||
typeDictValue: [{ required: true, message: '报警类型 字典表关联label_value不能为空', trigger: 'blur' }],
|
||||
gradeDictValue: [{ required: true, message: '报警级别 字典表关联label_value不能为空', trigger: 'blur' }],
|
||||
alarmContent: [{ required: true, message: '报警内容不能为空', trigger: 'blur' }],
|
||||
description: [{ required: true, message: '描述不能为空', trigger: 'blur' }],
|
||||
externalCode: [{ required: true, message: '外部编码,用于对照外部系统的编码不能为空', trigger: 'blur' }],
|
||||
enabled: [{ required: true, message: '启用状态:0 、停用,1、启用不能为空', 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' }],
|
||||
alarmNotify: [{ required: true, message: '推送方式 0邮箱 1微信不能为空', trigger: 'blur' }]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init(id) {
|
||||
this.dataForm.id = id || 0
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/equipmentGroupAlarm/${this.dataForm.id}`),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams()
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataForm.equipmentGroupId = data.equipmengroupAlarm.equipmentGroupId
|
||||
this.dataForm.code = data.equipmengroupAlarm.code
|
||||
this.dataForm.typeDictValue = data.equipmengroupAlarm.typeDictValue
|
||||
this.dataForm.gradeDictValue = data.equipmengroupAlarm.gradeDictValue
|
||||
this.dataForm.alarmContent = data.equipmengroupAlarm.alarmContent
|
||||
this.dataForm.description = data.equipmengroupAlarm.description
|
||||
this.dataForm.externalCode = data.equipmengroupAlarm.externalCode
|
||||
this.dataForm.enabled = data.equipmengroupAlarm.enabled
|
||||
this.dataForm.remark = data.equipmengroupAlarm.remark
|
||||
this.dataForm.valid = data.equipmengroupAlarm.valid
|
||||
this.dataForm.creatorId = data.equipmengroupAlarm.creatorId
|
||||
this.dataForm.creatorName = data.equipmengroupAlarm.creatorName
|
||||
this.dataForm.createTime = data.equipmengroupAlarm.createTime
|
||||
this.dataForm.updaterId = data.equipmengroupAlarm.updaterId
|
||||
this.dataForm.updaterName = data.equipmengroupAlarm.updaterName
|
||||
this.dataForm.updateTime = data.equipmengroupAlarm.updateTime
|
||||
this.dataForm.version = data.equipmengroupAlarm.version
|
||||
this.dataForm.alarmNotify = data.equipmengroupAlarm.alarmNotify
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate(valid => {
|
||||
if (valid) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/equipmentGroupAlarm/${!this.dataForm.id ? '' : this.dataForm.id}`),
|
||||
method: this.dataForm.id ? 'put' : 'post',
|
||||
data: this.$http.adornData({
|
||||
id: this.dataForm.id || undefined,
|
||||
equipmentGroupId: this.dataForm.equipmentGroupId,
|
||||
code: this.dataForm.code,
|
||||
typeDictValue: this.dataForm.typeDictValue,
|
||||
gradeDictValue: this.dataForm.gradeDictValue,
|
||||
alarmContent: this.dataForm.alarmContent,
|
||||
description: this.dataForm.description,
|
||||
externalCode: this.dataForm.externalCode,
|
||||
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,
|
||||
alarmNotify: this.dataForm.alarmNotify
|
||||
})
|
||||
}).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>
|
||||
256
src/views/modules/monitoring/equipmentGroupAlarm.vue
Normal file
256
src/views/modules/monitoring/equipmentGroupAlarm.vue
Normal file
@@ -0,0 +1,256 @@
|
||||
<template>
|
||||
<div class="mod-config">
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<el-form-item label="设备分组名称">
|
||||
<strong>{{ $route.params.groupName }}</strong></el-form-item
|
||||
>
|
||||
|
||||
<el-form-item label="设备分组编码">
|
||||
<strong>{{ $route.params.groupCode }}</strong>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item>
|
||||
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
|
||||
</el-form-item> -->
|
||||
<br />
|
||||
<el-form-item>
|
||||
<!-- <el-button @click="getDataList()">查询</el-button> -->
|
||||
<el-button v-if="$hasPermission('monitoring:equipmentgroupalarm:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
<!-- <el-button v-if="$hasPermission('monitoring:equipmentgroupalarm:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">
|
||||
批量删除
|
||||
</el-button> -->
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- <el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" style="width: 100%;">
|
||||
<el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
|
||||
<el-table-column prop="id" header-align="center" align="center" label="ID"></el-table-column>
|
||||
<el-table-column prop="equipmentGroupId" header-align="center" align="center" label="设备分组ID,关联t_equipment_group"></el-table-column>
|
||||
<el-table-column prop="code" header-align="center" align="center" label="编码"></el-table-column>
|
||||
<el-table-column prop="typeDictValue" header-align="center" align="center" label="报警类型 字典表关联label_value"></el-table-column>
|
||||
<el-table-column prop="gradeDictValue" header-align="center" align="center" label="报警级别 字典表关联label_value"></el-table-column>
|
||||
<el-table-column prop="alarmContent" 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="externalCode" 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="alarmNotify" header-align="center" align="center" label="推送方式 0邮箱 1微信"></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> -->
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" @operate-event="handleOperations" @refreshDataList="getDataList" />
|
||||
<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" :configs="addOrUpdateConfigs" @refreshDataList="getDataList" @destory-dialog="addOrUpdateVisible = false" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// import AddOrUpdate from './equipmentGroupAlarm-add-or-update'
|
||||
import AddOrUpdate from '@/components/base-dialog/addOrUpdate'
|
||||
import BaseTable from '@/components/base-table'
|
||||
import dictListMixin from '@/mixins/dictlist-module'
|
||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
||||
// import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
|
||||
// const alarmTypeDictId = '1557925215454814210'
|
||||
// const alarmLevelDictId = '1557925289517834242'
|
||||
const dictEntries = {
|
||||
alarmType: { value: '1557925215454814210', field: 'typeDictValue' }, // field 和下面 addOrUpdateConfigs 里对应
|
||||
alarmLevel: { value: '1557925289517834242', field: 'gradeDictValue' }
|
||||
}
|
||||
|
||||
const tableConfigs = [
|
||||
{ prop: 'createTime', name: '添加时间' },
|
||||
{ prop: 'code', name: '报警编码' },
|
||||
{ prop: 'typeDictValue', name: '报警类型' },
|
||||
{ prop: 'gradeDictValue', name: '报警级别' },
|
||||
{ prop: 'alarmContent', name: '报警内容' },
|
||||
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
// { prop: 'typeDictValue', name: '报警类型 字典表关联label_value' },
|
||||
// { prop: 'gradeDictValue', name: '报警级别 字典表关联label_value' },
|
||||
// { "prop": "id", "name": "ID" },
|
||||
// { "prop": "equipmentGroupId", "name": "设备分组ID,关联t_equipment_group" },
|
||||
// { "prop": "description", "name": "描述" },
|
||||
// { "prop": "externalCode", "name": "外部编码,用于对照外部系统的编码" },
|
||||
// { "prop": "enabled", "name": "启用状态:0 、停用,1、启用" },
|
||||
// { "prop": "remark", "name": "备注" },
|
||||
// { "prop": "valid", "name": "删除标志,是否有效:1 可用 0不可用" },
|
||||
// { "prop": "creatorId", "name": "创建人" },
|
||||
// { "prop": "creatorName", "name": "创建人姓名" },
|
||||
// { "prop": "updaterId", "name": "更新人" },
|
||||
// { "prop": "updaterName", "name": "更新人姓名" },
|
||||
// { "prop": "updateTime", "name": "更新时间" },
|
||||
// { "prop": "version", "name": "版本号" },
|
||||
// { prop: 'alarmNotify', name: '推送方式 0邮箱 1微信' },
|
||||
// { prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
|
||||
const addOrUpdateConfigs = {
|
||||
type: 'dialog',
|
||||
infoUrl: '/monitoring/equipmentGroupAlarm',
|
||||
fields: [
|
||||
{ name: 'code', label: '报警编码', required: true },
|
||||
{ name: 'typeDictValue', label: '报警类型', type: 'select', options: [] },
|
||||
{ name: 'gradeDictValue', label: '报警级别', type: 'select', options: [] },
|
||||
{ name: 'alarmContent', label: '报警内容', required: true }
|
||||
],
|
||||
operations: [
|
||||
{ name: 'cancel', showAlways: true },
|
||||
{ name: 'save', url: '/monitoring/equipmentGroupAlarm', extraFields: { equipmentGroupId: null }, permission: '', showOnEdit: false },
|
||||
{ name: 'update', url: '/monitoring/equipmentGroupAlarm', extraFields: { equipmentGroupId: null }, permission: '', showOnEdit: true }
|
||||
]
|
||||
}
|
||||
|
||||
export default {
|
||||
mixins: [dictListMixin],
|
||||
data() {
|
||||
return {
|
||||
addOrUpdateConfigs,
|
||||
tableConfigs,
|
||||
dataForm: {
|
||||
key: ''
|
||||
},
|
||||
dataList: [],
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
dataListLoading: false,
|
||||
dataListSelections: [],
|
||||
addOrUpdateVisible: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate,
|
||||
BaseTable
|
||||
},
|
||||
activated() {
|
||||
this.getDictData()
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
// 获取字典数据
|
||||
getDictData() {
|
||||
this.initDictList(Object.entries(dictEntries).map(([_, item]) => item.value))
|
||||
this.addOrUpdateConfigs.fields.forEach(item => {
|
||||
if (item.options && Array.isArray(item.options)) {
|
||||
let id
|
||||
Object.entries(dictEntries).forEach(([_, d]) => {
|
||||
if (d.field === item.name) {
|
||||
id = d.value
|
||||
}
|
||||
})
|
||||
item.options = this.dictList[id]
|
||||
}
|
||||
})
|
||||
},
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentGroupAlarm/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
page: this.pageIndex,
|
||||
limit: this.pageSize,
|
||||
groupId: this.$route.params.id
|
||||
})
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataList = data.data.list
|
||||
this.totalPage = data.data.total
|
||||
} else {
|
||||
this.dataList = []
|
||||
this.totalPage = 0
|
||||
}
|
||||
this.dataListLoading = false
|
||||
})
|
||||
},
|
||||
// 每页数
|
||||
sizeChangeHandle(val) {
|
||||
this.pageSize = val
|
||||
this.pageIndex = 1
|
||||
this.getDataList()
|
||||
},
|
||||
// 当前页
|
||||
currentChangeHandle(val) {
|
||||
this.pageIndex = val
|
||||
this.getDataList()
|
||||
},
|
||||
// 多选
|
||||
selectionChangeHandle(val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
handleOperations({ type, data: id }) {
|
||||
switch (type) {
|
||||
case 'edit':
|
||||
return this.addOrUpdateHandle(id)
|
||||
case 'delete':
|
||||
return this.deleteHandle(id)
|
||||
}
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle(id) {
|
||||
this.addOrUpdateConfigs.operations.forEach(item => {
|
||||
if (item.extraFields) {
|
||||
item.extraFields.equipmentGroupId = this.$route.params.id || null
|
||||
}
|
||||
})
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
},
|
||||
// 删除
|
||||
deleteHandle(id) {
|
||||
var ids = id
|
||||
? [id]
|
||||
: this.dataListSelections.map(item => {
|
||||
return item.id
|
||||
})
|
||||
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentGroupAlarm'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getDataList()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
219
src/views/modules/monitoring/equipmentPlc-add-or-update.vue
Normal file
219
src/views/modules/monitoring/equipmentPlc-add-or-update.vue
Normal file
@@ -0,0 +1,219 @@
|
||||
<template>
|
||||
<el-dialog :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-item label="plc类型" prop="plcType">
|
||||
<el-input v-model="dataForm.plcType" placeholder="plc类型"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="编码" prop="code">
|
||||
<el-input v-model="dataForm.code" placeholder="编码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="plc名称(ip+名称对应实时数据库表名)" prop="name">
|
||||
<el-input v-model="dataForm.name" placeholder="plc名称(ip+名称对应实时数据库表名)"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="英文名称" prop="enName">
|
||||
<el-input v-model="dataForm.enName" placeholder="英文名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="描述" prop="description">
|
||||
<el-input v-model="dataForm.description" placeholder="描述"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="plc条码" prop="barcode">
|
||||
<el-input v-model="dataForm.barcode" placeholder="plc条码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="链接方式,0 tcp,1 udp等" prop="controlType">
|
||||
<el-input v-model="dataForm.controlType" placeholder="链接方式,0 tcp,1 udp等"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否监控 0 代表不监控, 1 代表监控" prop="monitor">
|
||||
<el-input v-model="dataForm.monitor" placeholder="是否监控 0 代表不监控, 1 代表监控"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否采集 0 代表不采集, 1 代表采集" prop="collection">
|
||||
<el-input v-model="dataForm.collection" placeholder="是否采集 0 代表不采集, 1 代表采集"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="IP" prop="ip">
|
||||
<el-input v-model="dataForm.ip" placeholder="IP"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="端口号" prop="port">
|
||||
<el-input v-model="dataForm.port" placeholder="端口号"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="启用状态:0 、停用,1、启用" prop="enabled">
|
||||
<el-input v-model="dataForm.enabled" placeholder="启用状态:0 、停用,1、启用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="dataForm.remark" placeholder="备注"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="删除标志,是否有效:1 可用 0不可用" prop="valid">
|
||||
<el-input v-model="dataForm.valid" placeholder="删除标志,是否有效:1 可用 0不可用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人" prop="creatorId">
|
||||
<el-input v-model="dataForm.creatorId" placeholder="创建人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人姓名" prop="creatorName">
|
||||
<el-input v-model="dataForm.creatorName" placeholder="创建人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-input v-model="dataForm.createTime" placeholder="创建时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人" prop="updaterId">
|
||||
<el-input v-model="dataForm.updaterId" placeholder="更新人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人姓名" prop="updaterName">
|
||||
<el-input v-model="dataForm.updaterName" placeholder="更新人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新时间" prop="updateTime">
|
||||
<el-input v-model="dataForm.updateTime" placeholder="更新时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="版本号" prop="version">
|
||||
<el-input v-model="dataForm.version" placeholder="版本号"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
plcType: '',
|
||||
code: '',
|
||||
name: '',
|
||||
enName: '',
|
||||
description: '',
|
||||
barcode: '',
|
||||
controlType: '',
|
||||
monitor: '',
|
||||
collection: '',
|
||||
ip: '',
|
||||
port: '',
|
||||
enabled: '',
|
||||
remark: '',
|
||||
valid: '',
|
||||
creatorId: '',
|
||||
creatorName: '',
|
||||
createTime: '',
|
||||
updaterId: '',
|
||||
updaterName: '',
|
||||
updateTime: '',
|
||||
version: ''
|
||||
},
|
||||
dataRule: {
|
||||
plcType: [{ required: true, message: 'plc类型不能为空', trigger: 'blur' }],
|
||||
code: [{ required: true, message: '编码不能为空', trigger: 'blur' }],
|
||||
name: [{ required: true, message: 'plc名称(ip+名称对应实时数据库表名)不能为空', trigger: 'blur' }],
|
||||
enName: [{ required: true, message: '英文名称不能为空', trigger: 'blur' }],
|
||||
description: [{ required: true, message: '描述不能为空', trigger: 'blur' }],
|
||||
barcode: [{ required: true, message: 'plc条码不能为空', trigger: 'blur' }],
|
||||
controlType: [{ required: true, message: '链接方式,0 tcp,1 udp等不能为空', trigger: 'blur' }],
|
||||
monitor: [{ required: true, message: '是否监控 0 代表不监控, 1 代表监控不能为空', trigger: 'blur' }],
|
||||
collection: [{ required: true, message: '是否采集 0 代表不采集, 1 代表采集不能为空', trigger: 'blur' }],
|
||||
ip: [{ required: true, message: 'IP不能为空', trigger: 'blur' }],
|
||||
port: [{ required: true, message: '端口号不能为空', trigger: 'blur' }],
|
||||
enabled: [{ required: true, message: '启用状态:0 、停用,1、启用不能为空', 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: {
|
||||
init(id) {
|
||||
this.dataForm.id = id || 0
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/equipmentPlc/${this.dataForm.id}`),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams()
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataForm.plcType = data.equipmenplc.plcType
|
||||
this.dataForm.code = data.equipmenplc.code
|
||||
this.dataForm.name = data.equipmenplc.name
|
||||
this.dataForm.enName = data.equipmenplc.enName
|
||||
this.dataForm.description = data.equipmenplc.description
|
||||
this.dataForm.barcode = data.equipmenplc.barcode
|
||||
this.dataForm.controlType = data.equipmenplc.controlType
|
||||
this.dataForm.monitor = data.equipmenplc.monitor
|
||||
this.dataForm.collection = data.equipmenplc.collection
|
||||
this.dataForm.ip = data.equipmenplc.ip
|
||||
this.dataForm.port = data.equipmenplc.port
|
||||
this.dataForm.enabled = data.equipmenplc.enabled
|
||||
this.dataForm.remark = data.equipmenplc.remark
|
||||
this.dataForm.valid = data.equipmenplc.valid
|
||||
this.dataForm.creatorId = data.equipmenplc.creatorId
|
||||
this.dataForm.creatorName = data.equipmenplc.creatorName
|
||||
this.dataForm.createTime = data.equipmenplc.createTime
|
||||
this.dataForm.updaterId = data.equipmenplc.updaterId
|
||||
this.dataForm.updaterName = data.equipmenplc.updaterName
|
||||
this.dataForm.updateTime = data.equipmenplc.updateTime
|
||||
this.dataForm.version = data.equipmenplc.version
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate(valid => {
|
||||
if (valid) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/equipmentPlc/${!this.dataForm.id ? '' : this.dataForm.id}`),
|
||||
method: this.dataForm.id ? 'put' : 'post',
|
||||
data: this.$http.adornData({
|
||||
id: this.dataForm.id || undefined,
|
||||
plcType: this.dataForm.plcType,
|
||||
code: this.dataForm.code,
|
||||
name: this.dataForm.name,
|
||||
enName: this.dataForm.enName,
|
||||
description: this.dataForm.description,
|
||||
barcode: this.dataForm.barcode,
|
||||
controlType: this.dataForm.controlType,
|
||||
monitor: this.dataForm.monitor,
|
||||
collection: this.dataForm.collection,
|
||||
ip: this.dataForm.ip,
|
||||
port: this.dataForm.port,
|
||||
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>
|
||||
205
src/views/modules/monitoring/equipmentPlc.vue
Normal file
205
src/views/modules/monitoring/equipmentPlc.vue
Normal file
@@ -0,0 +1,205 @@
|
||||
<template>
|
||||
<div class="mod-config">
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<el-form-item>
|
||||
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<el-button v-if="$hasPermission('monitoring:equipmentplc:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" @operate-event="handleOperations" @refreshDataList="getDataList" />
|
||||
<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" :configs="addOrUpdateConfigs" @refreshDataList="getDataList" @destory-dialog="addOrUpdateVisible = false" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// import AddOrUpdate from './equipmentPlc-add-or-update'
|
||||
import AddOrUpdate from '@/components/base-dialog/addOrUpdate'
|
||||
import BaseTable from '@/components/base-table'
|
||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
||||
import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
|
||||
const tableConfigs = [
|
||||
{ type: 'index', name: '序号' },
|
||||
{ prop: 'code', name: '编码' },
|
||||
{ prop: 'name', name: '名称' },
|
||||
{ prop: 'enName', name: '英文名称' },
|
||||
{ prop: 'description', name: '描述' },
|
||||
{ prop: 'barcode', name: 'plc条码' },
|
||||
{ prop: 'collection', name: '是否采集', filter: val => ({ 0: '不采集', 1: '采集' }[val]) },
|
||||
{ prop: 'ip', name: 'IP' },
|
||||
{ prop: 'port', name: '端口号' },
|
||||
{ prop: 'remark', name: '备注' },
|
||||
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
|
||||
const addOrUpdateConfigs = {
|
||||
type: 'dialog', // dialog | drawer | page
|
||||
infoUrl: '/monitoring/equipmentPlc',
|
||||
fields: [
|
||||
{ name: 'name', required: true },
|
||||
{ name: 'code', required: true },
|
||||
{ name: 'enName', label: '英文名称' },
|
||||
{
|
||||
name: 'collection',
|
||||
label: '是否采集',
|
||||
required: true,
|
||||
type: 'select',
|
||||
options: [
|
||||
{ label: '采集', value: 1 },
|
||||
{ label: '不采集', value: 0 }
|
||||
]
|
||||
},
|
||||
{ name: 'ip', label: 'IP', required: true, placeholder: '0.0.0.0' },
|
||||
{ name: 'port', label: '端口', placeholder: '443' },
|
||||
'description',
|
||||
'remark',
|
||||
{ name: 'barcode', label: 'plc条码', span: 24 }
|
||||
],
|
||||
operations: [
|
||||
{ name: 'cancel', url: true, showAlways: true },
|
||||
{ name: 'save', url: '/monitoring/equipmentPlc', permission: '', showOnEdit: false },
|
||||
{ name: 'update', url: '/monitoring/equipmentPlc', permission: '', showOnEdit: true }
|
||||
]
|
||||
// subtable: {
|
||||
// // for i18n
|
||||
// title: '动态属性',
|
||||
// url: '/monitoring/productArrt',
|
||||
// relatedField: 'productId',
|
||||
// tableConfigs: [
|
||||
// { type: 'index', name: '序号' },
|
||||
// { prop: 'createTime', name: '添加时间', filter: val => (val ? moment(val).format('YYYY-MM-DD hh:mm:ss') : '-') },
|
||||
// { prop: 'name', name: '属性名', formField: true, rules: [{ required: true, message: '必填', trigger: 'blur' }] },
|
||||
// { prop: 'code', name: '属性值', formField: true },
|
||||
// { prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
// ]
|
||||
// }
|
||||
}
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
tableConfigs,
|
||||
addOrUpdateConfigs,
|
||||
dataForm: {
|
||||
key: ''
|
||||
},
|
||||
dataList: [],
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
dataListLoading: false,
|
||||
dataListSelections: [],
|
||||
addOrUpdateVisible: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate,
|
||||
BaseTable
|
||||
},
|
||||
activated() {
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
//handleOperations
|
||||
handleOperations({ type, data: id }) {
|
||||
switch (type) {
|
||||
case 'edit':
|
||||
return this.addOrUpdateHandle(id)
|
||||
case 'delete':
|
||||
return this.deleteHandle(id)
|
||||
}
|
||||
},
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentPlc/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
page: this.pageIndex,
|
||||
limit: this.pageSize,
|
||||
key: this.dataForm.key
|
||||
})
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataList = data.data.list
|
||||
this.totalPage = data.data.total
|
||||
} else {
|
||||
this.dataList = []
|
||||
this.totalPage = 0
|
||||
}
|
||||
this.dataListLoading = false
|
||||
})
|
||||
},
|
||||
// 每页数
|
||||
sizeChangeHandle(val) {
|
||||
this.pageSize = val
|
||||
this.pageIndex = 1
|
||||
this.getDataList()
|
||||
},
|
||||
// 当前页
|
||||
currentChangeHandle(val) {
|
||||
this.pageIndex = val
|
||||
this.getDataList()
|
||||
},
|
||||
// 多选
|
||||
selectionChangeHandle(val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
},
|
||||
// 删除
|
||||
deleteHandle(id) {
|
||||
var ids = id
|
||||
? [id]
|
||||
: this.dataListSelections.map(item => {
|
||||
return item.id
|
||||
})
|
||||
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentPlc'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getDataList()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,156 @@
|
||||
<template>
|
||||
<el-dialog :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-item label="plc表iD" prop="plcId">
|
||||
<el-input v-model="dataForm.plcId" placeholder="plc表iD"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备表id" prop="equipmentId">
|
||||
<el-input v-model="dataForm.equipmentId" placeholder="设备表id"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="启用状态:0 、停用,1、启用" prop="enabled">
|
||||
<el-input v-model="dataForm.enabled" placeholder="启用状态:0 、停用,1、启用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="dataForm.remark" placeholder="备注"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="删除标志,是否有效:1 可用 0不可用" prop="valid">
|
||||
<el-input v-model="dataForm.valid" placeholder="删除标志,是否有效:1 可用 0不可用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人" prop="creatorId">
|
||||
<el-input v-model="dataForm.creatorId" placeholder="创建人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人姓名" prop="creatorName">
|
||||
<el-input v-model="dataForm.creatorName" placeholder="创建人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-input v-model="dataForm.createTime" placeholder="创建时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人" prop="updaterId">
|
||||
<el-input v-model="dataForm.updaterId" placeholder="更新人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人姓名" prop="updaterName">
|
||||
<el-input v-model="dataForm.updaterName" placeholder="更新人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新时间" prop="updateTime">
|
||||
<el-input v-model="dataForm.updateTime" placeholder="更新时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="版本号" prop="version">
|
||||
<el-input v-model="dataForm.version" placeholder="版本号"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
plcId: '',
|
||||
equipmentId: '',
|
||||
enabled: '',
|
||||
remark: '',
|
||||
valid: '',
|
||||
creatorId: '',
|
||||
creatorName: '',
|
||||
createTime: '',
|
||||
updaterId: '',
|
||||
updaterName: '',
|
||||
updateTime: '',
|
||||
version: ''
|
||||
},
|
||||
dataRule: {
|
||||
plcId: [{ required: true, message: 'plc表iD不能为空', trigger: 'blur' }],
|
||||
equipmentId: [{ required: true, message: '设备表id不能为空', trigger: 'blur' }],
|
||||
enabled: [{ required: true, message: '启用状态:0 、停用,1、启用不能为空', 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: {
|
||||
init(id) {
|
||||
this.dataForm.id = id || 0
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/equipmentPlcConnect/${this.dataForm.id}`),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams()
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataForm.plcId = data.equipmenplcConnect.plcId
|
||||
this.dataForm.equipmentId = data.equipmenplcConnect.equipmentId
|
||||
this.dataForm.enabled = data.equipmenplcConnect.enabled
|
||||
this.dataForm.remark = data.equipmenplcConnect.remark
|
||||
this.dataForm.valid = data.equipmenplcConnect.valid
|
||||
this.dataForm.creatorId = data.equipmenplcConnect.creatorId
|
||||
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
|
||||
this.dataForm.version = data.equipmenplcConnect.version
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate(valid => {
|
||||
if (valid) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/equipmentPlcConnect/${!this.dataForm.id ? '' : this.dataForm.id}`),
|
||||
method: this.dataForm.id ? 'put' : 'post',
|
||||
data: this.$http.adornData({
|
||||
id: this.dataForm.id || undefined,
|
||||
plcId: this.dataForm.plcId,
|
||||
equipmentId: this.dataForm.equipmentId,
|
||||
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>
|
||||
262
src/views/modules/monitoring/equipmentPlcConnect.vue
Normal file
262
src/views/modules/monitoring/equipmentPlcConnect.vue
Normal file
@@ -0,0 +1,262 @@
|
||||
<template>
|
||||
<div class="mod-config">
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<el-form-item>
|
||||
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<el-button v-if="$hasPermission('monitoring:equipmentplcconnect:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" @operate-event="handleOperations" @refreshDataList="getDataList" />
|
||||
|
||||
<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" :configs="addOrUpdateConfigs" @refreshDataList="getDataList" @destory-dialog="addOrUpdateVisible = false" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// import AddOrUpdate from './equipmentPlcConnect-add-or-update'
|
||||
import AddOrUpdate from '@/components/base-dialog/addOrUpdate'
|
||||
import BaseTable from '@/components/base-table'
|
||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
||||
// import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
import { dictFilter } from '@/utils/filters'
|
||||
// import axios from '@/utils/request.js'
|
||||
|
||||
const tableConfigs = [
|
||||
{ type: 'index', name: '序号' },
|
||||
{ prop: 'lineName', name: '产线' },
|
||||
{ prop: 'sectionName', name: '工段' },
|
||||
{ prop: 'equName', name: '设备' },
|
||||
{ prop: 'equCode', name: '设备编码' },
|
||||
{ prop: 'plcCode', name: 'PLC编码' },
|
||||
{ prop: 'plcName', name: 'PLC名称' },
|
||||
{ prop: 'plcIp', name: 'PLC IP' },
|
||||
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
|
||||
const UnitDictTypeId = '1557173812109242370'
|
||||
const getUnitList = function() {
|
||||
const dl = JSON.parse(localStorage.getItem('dictList'))[UnitDictTypeId] || []
|
||||
return dl.map(item => ({ label: item.dictLabel, value: item.dictValue }))
|
||||
}
|
||||
const addOrUpdateConfigs = {
|
||||
type: 'dialog',
|
||||
infoUrl: '/monitoring/equipmentPlcConnect',
|
||||
fields: [
|
||||
{ name: 'equipmentId', label: '设备', required: true, type: 'select', options: [] },
|
||||
{ name: 'plcId', label: 'PLC名称', required: true, type: 'select', options: [] }
|
||||
],
|
||||
operations: [
|
||||
{ name: 'cancel', url: true, showAlways: true },
|
||||
{ name: 'save', url: '/monitoring/equipmentPlcConnect', permission: '', showOnEdit: false },
|
||||
{ name: 'update', url: '/monitoring/equipmentPlcConnect', permission: '', showOnEdit: true }
|
||||
],
|
||||
subtable: {
|
||||
title: 'PLC采集参数',
|
||||
url: '/monitoring/equipmentPlcParam',
|
||||
relatedField: 'plcConId',
|
||||
tableConfigs: [
|
||||
{ type: 'index', name: '序号' },
|
||||
// { prop: 'plcConId', name: 'plc连接表ID' },
|
||||
{ prop: 'paramCode', name: '参数编码', formField: true, rules: [{ required: true, message: '必填', trigger: 'blur' }] },
|
||||
{ prop: 'paramName', name: '参数名称', formField: true, rules: [{ required: true, message: '必填', trigger: 'blur' }] },
|
||||
{ prop: 'paramAddress', name: '参数地址', formField: true },
|
||||
{ prop: 'unitDictValue', name: '单位', filter: dictFilter(UnitDictTypeId), formField: true, formType: 'select', formOptions: getUnitList() },
|
||||
{ prop: 'minValue', name: '最小值', formField: true },
|
||||
{ prop: 'maxValue', name: '最大值', formField: true },
|
||||
{ prop: 'defaultValue', name: '参数设定标准值', formField: true },
|
||||
{ prop: 'description', name: '描述', formField: true },
|
||||
{
|
||||
prop: 'enabled',
|
||||
name: '启用状态',
|
||||
filter: val => ['停用', '启用'][+val],
|
||||
// filter: val => ({0:'停用', 1:'启用'}[+val]),
|
||||
rules: [{ required: true, message: '必填', trigger: 'blur' }],
|
||||
formField: true,
|
||||
formType: 'select',
|
||||
formOptions: [
|
||||
{ value: 0, label: '停用' },
|
||||
{ value: 1, label: '启用' }
|
||||
]
|
||||
},
|
||||
{ prop: 'remark', name: '备注', formField: true },
|
||||
// { prop: 'createTime', name: '添加时间' },
|
||||
{
|
||||
prop: 'collection',
|
||||
name: '是否采集',
|
||||
filter: val => ['不采集', '采集'][+val],
|
||||
rules: [{ required: true, message: '必填', trigger: 'blur' }],
|
||||
formField: true,
|
||||
formType: 'select',
|
||||
formOptions: [
|
||||
{ value: 0, label: '不采集' },
|
||||
{ value: 1, label: '采集' }
|
||||
]
|
||||
},
|
||||
// { prop: 'collectionCycle', name: '采集周期(s) 暂不使用' },
|
||||
// { prop: 'reportingCycle', name: '上报周期(s) 暂不使用' },
|
||||
// { prop: 'reportingMethod', name: '上报方式 暂不使用' },
|
||||
// { prop: 'reportingCode', name: '上报编码 暂不使用' },
|
||||
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
addOrUpdateConfigs,
|
||||
tableConfigs,
|
||||
dataForm: {
|
||||
key: ''
|
||||
},
|
||||
dataList: [],
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
dataListLoading: false,
|
||||
dataListSelections: [],
|
||||
addOrUpdateVisible: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate,
|
||||
BaseTable
|
||||
},
|
||||
activated() {
|
||||
this.getEqList()
|
||||
this.getPlcList()
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
// 设备列表
|
||||
getEqList() {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipment/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
// page: this.pageIndex,
|
||||
// limit: this.pageSize,
|
||||
// key: this.dataForm.key
|
||||
})
|
||||
}).then(({ data }) => {
|
||||
const eqConfig = this.addOrUpdateConfigs.fields.find(item => item.name === 'equipmentId')
|
||||
eqConfig.options = data.data?.list?.map(item => ({ value: item.id, label: item.name })) || []
|
||||
})
|
||||
},
|
||||
// plc 列表
|
||||
getPlcList() {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentPlc/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
// page: this.pageIndex,
|
||||
// limit: this.pageSize,
|
||||
// key: this.dataForm.key
|
||||
})
|
||||
}).then(({ data }) => {
|
||||
const plcConfig = this.addOrUpdateConfigs.fields.find(item => item.name === 'plcId')
|
||||
plcConfig.options = data.data?.list?.map(item => ({ value: item.id, label: item.name })) || []
|
||||
})
|
||||
},
|
||||
handleOperations({ type, data: id }) {
|
||||
switch (type) {
|
||||
case 'edit':
|
||||
return this.addOrUpdateHandle(id)
|
||||
case 'delete':
|
||||
return this.deleteHandle(id)
|
||||
}
|
||||
},
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentPlcConnect/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
page: this.pageIndex,
|
||||
limit: this.pageSize,
|
||||
key: this.dataForm.key
|
||||
})
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataList = data.data.list
|
||||
this.totalPage = data.data.total
|
||||
} else {
|
||||
this.dataList = []
|
||||
this.totalPage = 0
|
||||
}
|
||||
this.dataListLoading = false
|
||||
})
|
||||
},
|
||||
// 每页数
|
||||
sizeChangeHandle(val) {
|
||||
this.pageSize = val
|
||||
this.pageIndex = 1
|
||||
this.getDataList()
|
||||
},
|
||||
// 当前页
|
||||
currentChangeHandle(val) {
|
||||
this.pageIndex = val
|
||||
this.getDataList()
|
||||
},
|
||||
// 多选
|
||||
selectionChangeHandle(val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
},
|
||||
// 删除
|
||||
deleteHandle(id) {
|
||||
var ids = id
|
||||
? [id]
|
||||
: this.dataListSelections.map(item => {
|
||||
return item.id
|
||||
})
|
||||
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentPlcConnect'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getDataList()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
254
src/views/modules/monitoring/equipmentPlcParam-add-or-update.vue
Normal file
254
src/views/modules/monitoring/equipmentPlcParam-add-or-update.vue
Normal file
@@ -0,0 +1,254 @@
|
||||
<template>
|
||||
<el-dialog :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-item label="plc连接表ID" prop="plcConId">
|
||||
<el-input v-model="dataForm.plcConId" placeholder="plc连接表ID"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="类型:status、data、constant" prop="type">
|
||||
<el-input v-model="dataForm.type" placeholder="类型:status、data、constant"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="参数编码" prop="paramCode">
|
||||
<el-input v-model="dataForm.paramCode" placeholder="参数编码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="参数名称" prop="paramName">
|
||||
<el-input v-model="dataForm.paramName" placeholder="参数名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="参数地址,对应实时数据库表的列名" prop="paramAddress">
|
||||
<el-input v-model="dataForm.paramAddress" placeholder="参数地址,对应实时数据库表的列名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="参数值类型:int、long、boolean、string、list 暂不使用" prop="valueType">
|
||||
<el-input v-model="dataForm.valueType" placeholder="参数值类型:int、long、boolean、string、list 暂不使用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="单位 关联数据字典表label_value" prop="unitDictValue">
|
||||
<el-input v-model="dataForm.unitDictValue" placeholder="单位 关联数据字典表label_value"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="最小值" prop="minValue">
|
||||
<el-input v-model="dataForm.minValue" placeholder="最小值"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="最大值" prop="maxValue">
|
||||
<el-input v-model="dataForm.maxValue" placeholder="最大值"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="参数设定标准值" prop="defaultValue">
|
||||
<el-input v-model="dataForm.defaultValue" placeholder="参数设定标准值"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="描述" prop="description">
|
||||
<el-input v-model="dataForm.description" placeholder="描述"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="启用状态:0 、停用,1、启用" prop="enabled">
|
||||
<el-input v-model="dataForm.enabled" placeholder="启用状态:0 、停用,1、启用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="dataForm.remark" placeholder="备注"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="删除标志,是否有效:1 可用 0不可用" prop="valid">
|
||||
<el-input v-model="dataForm.valid" placeholder="删除标志,是否有效:1 可用 0不可用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人" prop="creatorId">
|
||||
<el-input v-model="dataForm.creatorId" placeholder="创建人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人姓名" prop="creatorName">
|
||||
<el-input v-model="dataForm.creatorName" placeholder="创建人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-input v-model="dataForm.createTime" placeholder="创建时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人" prop="updaterId">
|
||||
<el-input v-model="dataForm.updaterId" placeholder="更新人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人姓名" prop="updaterName">
|
||||
<el-input v-model="dataForm.updaterName" placeholder="更新人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新时间" prop="updateTime">
|
||||
<el-input v-model="dataForm.updateTime" placeholder="更新时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="版本号" prop="version">
|
||||
<el-input v-model="dataForm.version" placeholder="版本号"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="0 代表不采集, 1 代表采集" prop="collection">
|
||||
<el-input v-model="dataForm.collection" placeholder="0 代表不采集, 1 代表采集"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="采集周期(s) 暂不使用" prop="collectionCycle">
|
||||
<el-input v-model="dataForm.collectionCycle" placeholder="采集周期(s) 暂不使用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="上报周期(s) 暂不使用" prop="reportingCycle">
|
||||
<el-input v-model="dataForm.reportingCycle" placeholder="上报周期(s) 暂不使用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="上报方式 暂不使用" prop="reportingMethod">
|
||||
<el-input v-model="dataForm.reportingMethod" placeholder="上报方式 暂不使用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="上报编码 暂不使用" prop="reportingCode">
|
||||
<el-input v-model="dataForm.reportingCode" placeholder="上报编码 暂不使用"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
plcConId: '',
|
||||
type: '',
|
||||
paramCode: '',
|
||||
paramName: '',
|
||||
paramAddress: '',
|
||||
valueType: '',
|
||||
unitDictValue: '',
|
||||
minValue: '',
|
||||
maxValue: '',
|
||||
defaultValue: '',
|
||||
description: '',
|
||||
enabled: '',
|
||||
remark: '',
|
||||
valid: '',
|
||||
creatorId: '',
|
||||
creatorName: '',
|
||||
createTime: '',
|
||||
updaterId: '',
|
||||
updaterName: '',
|
||||
updateTime: '',
|
||||
version: '',
|
||||
collection: '',
|
||||
collectionCycle: '',
|
||||
reportingCycle: '',
|
||||
reportingMethod: '',
|
||||
reportingCode: ''
|
||||
},
|
||||
dataRule: {
|
||||
plcConId: [{ required: true, message: 'plc连接表ID不能为空', trigger: 'blur' }],
|
||||
type: [{ required: true, message: '类型:status、data、constant不能为空', trigger: 'blur' }],
|
||||
paramCode: [{ required: true, message: '参数编码不能为空', trigger: 'blur' }],
|
||||
paramName: [{ required: true, message: '参数名称不能为空', trigger: 'blur' }],
|
||||
paramAddress: [{ required: true, message: '参数地址,对应实时数据库表的列名不能为空', trigger: 'blur' }],
|
||||
valueType: [{ required: true, message: '参数值类型:int、long、boolean、string、list 暂不使用不能为空', trigger: 'blur' }],
|
||||
unitDictValue: [{ required: true, message: '单位 关联数据字典表label_value不能为空', trigger: 'blur' }],
|
||||
minValue: [{ required: true, message: '最小值不能为空', trigger: 'blur' }],
|
||||
maxValue: [{ required: true, message: '最大值不能为空', trigger: 'blur' }],
|
||||
defaultValue: [{ required: true, message: '参数设定标准值不能为空', trigger: 'blur' }],
|
||||
description: [{ required: true, message: '描述不能为空', trigger: 'blur' }],
|
||||
enabled: [{ required: true, message: '启用状态:0 、停用,1、启用不能为空', 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' }],
|
||||
collection: [{ required: true, message: '0 代表不采集, 1 代表采集不能为空', trigger: 'blur' }],
|
||||
collectionCycle: [{ required: true, message: '采集周期(s) 暂不使用不能为空', trigger: 'blur' }],
|
||||
reportingCycle: [{ required: true, message: '上报周期(s) 暂不使用不能为空', trigger: 'blur' }],
|
||||
reportingMethod: [{ required: true, message: '上报方式 暂不使用不能为空', trigger: 'blur' }],
|
||||
reportingCode: [{ required: true, message: '上报编码 暂不使用不能为空', trigger: 'blur' }]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init(id) {
|
||||
this.dataForm.id = id || 0
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/equipmentPlcParam/${this.dataForm.id}`),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams()
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataForm.plcConId = data.equipmenplcParam.plcConId
|
||||
this.dataForm.type = data.equipmenplcParam.type
|
||||
this.dataForm.paramCode = data.equipmenplcParam.paramCode
|
||||
this.dataForm.paramName = data.equipmenplcParam.paramName
|
||||
this.dataForm.paramAddress = data.equipmenplcParam.paramAddress
|
||||
this.dataForm.valueType = data.equipmenplcParam.valueType
|
||||
this.dataForm.unitDictValue = data.equipmenplcParam.unitDictValue
|
||||
this.dataForm.minValue = data.equipmenplcParam.minValue
|
||||
this.dataForm.maxValue = data.equipmenplcParam.maxValue
|
||||
this.dataForm.defaultValue = data.equipmenplcParam.defaultValue
|
||||
this.dataForm.description = data.equipmenplcParam.description
|
||||
this.dataForm.enabled = data.equipmenplcParam.enabled
|
||||
this.dataForm.remark = data.equipmenplcParam.remark
|
||||
this.dataForm.valid = data.equipmenplcParam.valid
|
||||
this.dataForm.creatorId = data.equipmenplcParam.creatorId
|
||||
this.dataForm.creatorName = data.equipmenplcParam.creatorName
|
||||
this.dataForm.createTime = data.equipmenplcParam.createTime
|
||||
this.dataForm.updaterId = data.equipmenplcParam.updaterId
|
||||
this.dataForm.updaterName = data.equipmenplcParam.updaterName
|
||||
this.dataForm.updateTime = data.equipmenplcParam.updateTime
|
||||
this.dataForm.version = data.equipmenplcParam.version
|
||||
this.dataForm.collection = data.equipmenplcParam.collection
|
||||
this.dataForm.collectionCycle = data.equipmenplcParam.collectionCycle
|
||||
this.dataForm.reportingCycle = data.equipmenplcParam.reportingCycle
|
||||
this.dataForm.reportingMethod = data.equipmenplcParam.reportingMethod
|
||||
this.dataForm.reportingCode = data.equipmenplcParam.reportingCode
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate(valid => {
|
||||
if (valid) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/equipmentPlcParam/${!this.dataForm.id ? '' : this.dataForm.id}`),
|
||||
method: this.dataForm.id ? 'put' : 'post',
|
||||
data: this.$http.adornData({
|
||||
id: this.dataForm.id || undefined,
|
||||
plcConId: this.dataForm.plcConId,
|
||||
type: this.dataForm.type,
|
||||
paramCode: this.dataForm.paramCode,
|
||||
paramName: this.dataForm.paramName,
|
||||
paramAddress: this.dataForm.paramAddress,
|
||||
valueType: this.dataForm.valueType,
|
||||
unitDictValue: this.dataForm.unitDictValue,
|
||||
minValue: this.dataForm.minValue,
|
||||
maxValue: this.dataForm.maxValue,
|
||||
defaultValue: this.dataForm.defaultValue,
|
||||
description: this.dataForm.description,
|
||||
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,
|
||||
collection: this.dataForm.collection,
|
||||
collectionCycle: this.dataForm.collectionCycle,
|
||||
reportingCycle: this.dataForm.reportingCycle,
|
||||
reportingMethod: this.dataForm.reportingMethod,
|
||||
reportingCode: this.dataForm.reportingCode
|
||||
})
|
||||
}).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>
|
||||
194
src/views/modules/monitoring/equipmentPlcParam.vue
Normal file
194
src/views/modules/monitoring/equipmentPlcParam.vue
Normal file
@@ -0,0 +1,194 @@
|
||||
<template>
|
||||
<div class="mod-config">
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<el-form-item>
|
||||
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<el-button v-if="$hasPermission('monitoring:equipmenplcparam:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- <el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" style="width: 100%;">
|
||||
<el-table-column type="selection" header-align="center" align="center" width="50"> </el-table-column>
|
||||
<el-table-column prop="id" header-align="center" align="center" label="ID"> </el-table-column>
|
||||
<el-table-column prop="plcConId" header-align="center" align="center" label="plc连接表ID"> </el-table-column>
|
||||
<el-table-column prop="type" header-align="center" align="center" label="类型:status、data、constant"> </el-table-column>
|
||||
<el-table-column prop="paramCode" header-align="center" align="center" label="参数编码"> </el-table-column>
|
||||
<el-table-column prop="paramName" header-align="center" align="center" label="参数名称"> </el-table-column>
|
||||
<el-table-column prop="paramAddress" header-align="center" align="center" label="参数地址,对应实时数据库表的列名"> </el-table-column>
|
||||
<el-table-column prop="valueType" header-align="center" align="center" label="参数值类型:int、long、boolean、string、list 暂不使用"> </el-table-column>
|
||||
<el-table-column prop="unitDictValue" header-align="center" align="center" label="单位 关联数据字典表label_value"> </el-table-column>
|
||||
<el-table-column prop="minValue" header-align="center" align="center" label="最小值"> </el-table-column>
|
||||
<el-table-column prop="maxValue" header-align="center" align="center" label="最大值"> </el-table-column>
|
||||
<el-table-column prop="defaultValue" 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="collection" header-align="center" align="center" label="0 代表不采集, 1 代表采集"> </el-table-column>
|
||||
<el-table-column prop="collectionCycle" header-align="center" align="center" label="采集周期(s) 暂不使用"> </el-table-column>
|
||||
<el-table-column prop="reportingCycle" header-align="center" align="center" label="上报周期(s) 暂不使用"> </el-table-column>
|
||||
<el-table-column prop="reportingMethod" header-align="center" align="center" label="上报方式 暂不使用"> </el-table-column>
|
||||
<el-table-column prop="reportingCode" 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> -->
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" />
|
||||
<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>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from './equipmentPlcParam-add-or-update'
|
||||
import BaseTable from '@/components/base-table'
|
||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
||||
import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
|
||||
const tableConfigs = [
|
||||
{ type: 'index', name: '序号' },
|
||||
{ prop: 'plcConId', name: 'plc连接表ID' },
|
||||
{ prop: 'paramCode', name: '参数编码' },
|
||||
{ prop: 'paramName', name: '参数名称' },
|
||||
{ prop: 'paramAddress', name: '参数地址' },
|
||||
{ prop: 'unitDictValue', name: '单位' },
|
||||
{ prop: 'minValue', name: '最小值' },
|
||||
{ prop: 'maxValue', name: '最大值' },
|
||||
{ prop: 'defaultValue', name: '参数设定标准值' },
|
||||
{ prop: 'description', name: '描述' },
|
||||
{ prop: 'enabled', name: '启用状态:0 、停用,1、启用' },
|
||||
{ prop: 'remark', name: '备注' },
|
||||
// { prop: 'createTime', name: '添加时间' },
|
||||
{ prop: 'collection', name: '0 代表不采集, 1 代表采集' },
|
||||
// { prop: 'collectionCycle', name: '采集周期(s) 暂不使用' },
|
||||
// { prop: 'reportingCycle', name: '上报周期(s) 暂不使用' },
|
||||
// { prop: 'reportingMethod', name: '上报方式 暂不使用' },
|
||||
// { prop: 'reportingCode', name: '上报编码 暂不使用' },
|
||||
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
tableConfigs,
|
||||
dataForm: {
|
||||
key: ''
|
||||
},
|
||||
dataList: [],
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
dataListLoading: false,
|
||||
dataListSelections: [],
|
||||
addOrUpdateVisible: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate,
|
||||
BaseTable
|
||||
},
|
||||
activated() {
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentPlcParam/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
page: this.pageIndex,
|
||||
limit: this.pageSize,
|
||||
key: this.dataForm.key
|
||||
})
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataList = data.data.list
|
||||
this.totalPage = data.data.total
|
||||
} else {
|
||||
this.dataList = []
|
||||
this.totalPage = 0
|
||||
}
|
||||
this.dataListLoading = false
|
||||
})
|
||||
},
|
||||
// 每页数
|
||||
sizeChangeHandle(val) {
|
||||
this.pageSize = val
|
||||
this.pageIndex = 1
|
||||
this.getDataList()
|
||||
},
|
||||
// 当前页
|
||||
currentChangeHandle(val) {
|
||||
this.pageIndex = val
|
||||
this.getDataList()
|
||||
},
|
||||
// 多选
|
||||
selectionChangeHandle(val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
},
|
||||
// 删除
|
||||
deleteHandle(id) {
|
||||
var ids = id
|
||||
? [id]
|
||||
: this.dataListSelections.map(item => {
|
||||
return item.id
|
||||
})
|
||||
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentPlcParam'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getDataList()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
191
src/views/modules/monitoring/equipmentQuantity-add-or-update.vue
Normal file
191
src/views/modules/monitoring/equipmentQuantity-add-or-update.vue
Normal file
@@ -0,0 +1,191 @@
|
||||
<template>
|
||||
<el-dialog :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-item label="设备外部编码" prop="externalCode">
|
||||
<el-input v-model="dataForm.externalCode" placeholder="设备外部编码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备名称" prop="equipmentName">
|
||||
<el-input v-model="dataForm.equipmentName" placeholder="设备名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="进入设备的数量" prop="inQuantity">
|
||||
<el-input v-model="dataForm.inQuantity" placeholder="进入设备的数量"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="离开设备的数量,若plc只记录一个生产数量,也写入该字段" prop="outQuantity">
|
||||
<el-input v-model="dataForm.outQuantity" placeholder="离开设备的数量,若plc只记录一个生产数量,也写入该字段"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="" prop="okQuantity">
|
||||
<el-input v-model="dataForm.okQuantity" placeholder=""></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备上报的报废数量" prop="nokQuantity">
|
||||
<el-input v-model="dataForm.nokQuantity" placeholder="设备上报的报废数量"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="" prop="description">
|
||||
<el-input v-model="dataForm.description" placeholder=""></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="dataForm.remark" placeholder="备注"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="删除标志,是否有效:1 可用 0不可用" prop="valid">
|
||||
<el-input v-model="dataForm.valid" placeholder="删除标志,是否有效:1 可用 0不可用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人" prop="creatorId">
|
||||
<el-input v-model="dataForm.creatorId" placeholder="创建人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人姓名" prop="creatorName">
|
||||
<el-input v-model="dataForm.creatorName" placeholder="创建人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-input v-model="dataForm.createTime" placeholder="创建时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人" prop="updaterId">
|
||||
<el-input v-model="dataForm.updaterId" placeholder="更新人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人姓名" prop="updaterName">
|
||||
<el-input v-model="dataForm.updaterName" placeholder="更新人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新时间" prop="updateTime">
|
||||
<el-input v-model="dataForm.updateTime" placeholder="更新时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="版本号" prop="version">
|
||||
<el-input v-model="dataForm.version" placeholder="版本号"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="生产数量的记录时间" prop="recordTime">
|
||||
<el-input v-model="dataForm.recordTime" placeholder="生产数量的记录时间"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
externalCode: '',
|
||||
equipmentName: '',
|
||||
inQuantity: '',
|
||||
outQuantity: '',
|
||||
okQuantity: '',
|
||||
nokQuantity: '',
|
||||
description: '',
|
||||
remark: '',
|
||||
valid: '',
|
||||
creatorId: '',
|
||||
creatorName: '',
|
||||
createTime: '',
|
||||
updaterId: '',
|
||||
updaterName: '',
|
||||
updateTime: '',
|
||||
version: '',
|
||||
recordTime: ''
|
||||
},
|
||||
dataRule: {
|
||||
externalCode: [{ required: true, message: '设备外部编码不能为空', trigger: 'blur' }],
|
||||
equipmentName: [{ required: true, message: '设备名称不能为空', trigger: 'blur' }],
|
||||
inQuantity: [{ required: true, message: '进入设备的数量不能为空', trigger: 'blur' }],
|
||||
outQuantity: [{ required: true, message: '离开设备的数量,若plc只记录一个生产数量,也写入该字段不能为空', trigger: 'blur' }],
|
||||
okQuantity: [{ required: true, message: '不能为空', trigger: 'blur' }],
|
||||
nokQuantity: [{ required: true, message: '设备上报的报废数量不能为空', trigger: 'blur' }],
|
||||
description: [{ 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' }],
|
||||
recordTime: [{ required: true, message: '生产数量的记录时间不能为空', trigger: 'blur' }]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init(id) {
|
||||
this.dataForm.id = id || 0
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/equipmentQuantity/${this.dataForm.id}`),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams()
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataForm.externalCode = data.equipmenquantity.externalCode
|
||||
this.dataForm.equipmentName = data.equipmenquantity.equipmentName
|
||||
this.dataForm.inQuantity = data.equipmenquantity.inQuantity
|
||||
this.dataForm.outQuantity = data.equipmenquantity.outQuantity
|
||||
this.dataForm.okQuantity = data.equipmenquantity.okQuantity
|
||||
this.dataForm.nokQuantity = data.equipmenquantity.nokQuantity
|
||||
this.dataForm.description = data.equipmenquantity.description
|
||||
this.dataForm.remark = data.equipmenquantity.remark
|
||||
this.dataForm.valid = data.equipmenquantity.valid
|
||||
this.dataForm.creatorId = data.equipmenquantity.creatorId
|
||||
this.dataForm.creatorName = data.equipmenquantity.creatorName
|
||||
this.dataForm.createTime = data.equipmenquantity.createTime
|
||||
this.dataForm.updaterId = data.equipmenquantity.updaterId
|
||||
this.dataForm.updaterName = data.equipmenquantity.updaterName
|
||||
this.dataForm.updateTime = data.equipmenquantity.updateTime
|
||||
this.dataForm.version = data.equipmenquantity.version
|
||||
this.dataForm.recordTime = data.equipmenquantity.recordTime
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate(valid => {
|
||||
if (valid) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/equipmentQuantity/${!this.dataForm.id ? '' : this.dataForm.id}`),
|
||||
method: this.dataForm.id ? 'put' : 'post',
|
||||
data: this.$http.adornData({
|
||||
id: this.dataForm.id || undefined,
|
||||
externalCode: this.dataForm.externalCode,
|
||||
equipmentName: this.dataForm.equipmentName,
|
||||
inQuantity: this.dataForm.inQuantity,
|
||||
outQuantity: this.dataForm.outQuantity,
|
||||
okQuantity: this.dataForm.okQuantity,
|
||||
nokQuantity: this.dataForm.nokQuantity,
|
||||
description: this.dataForm.description,
|
||||
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,
|
||||
recordTime: this.dataForm.recordTime
|
||||
})
|
||||
}).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>
|
||||
187
src/views/modules/monitoring/equipmentQuantity.vue
Normal file
187
src/views/modules/monitoring/equipmentQuantity.vue
Normal file
@@ -0,0 +1,187 @@
|
||||
<template>
|
||||
<div class="mod-config">
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<el-form-item>
|
||||
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<el-button v-if="$hasPermission('monitoring:equipmenquantity:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- <el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" style="width: 100%;">
|
||||
<el-table-column type="selection" header-align="center" align="center" width="50"> </el-table-column>
|
||||
<el-table-column prop="id" header-align="center" align="center" label="id"> </el-table-column>
|
||||
<el-table-column prop="externalCode" header-align="center" align="center" label="设备外部编码"> </el-table-column>
|
||||
<el-table-column prop="equipmentName" header-align="center" align="center" label="设备名称"> </el-table-column>
|
||||
<el-table-column prop="inQuantity" header-align="center" align="center" label="进入设备的数量"> </el-table-column>
|
||||
<el-table-column prop="outQuantity" header-align="center" align="center" label="离开设备的数量,若plc只记录一个生产数量,也写入该字段"> </el-table-column>
|
||||
<el-table-column prop="okQuantity" header-align="center" align="center" label=""> </el-table-column>
|
||||
<el-table-column prop="nokQuantity" 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="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="recordTime" 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> -->
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" />
|
||||
<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>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from './equipmentQuantity-add-or-update'
|
||||
import BaseTable from '@/components/base-table'
|
||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
||||
import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
|
||||
const tableConfigs = [
|
||||
{ "prop": "id", "name": "id" },
|
||||
{ "prop": "externalCode", "name": "设备外部编码" },
|
||||
{ "prop": "equipmentName", "name": "设备名称" },
|
||||
{ "prop": "inQuantity", "name": "进入设备的数量" },
|
||||
{
|
||||
"prop": "outQuantity",
|
||||
"name": "离开设备的数量,若plc只记录一个生产数量,也写入该字段"
|
||||
},
|
||||
{ "prop": "okQuantity", "name": "" },
|
||||
{ "prop": "nokQuantity", "name": "设备上报的报废数量" },
|
||||
{ "prop": "description", "name": "" },
|
||||
{ "prop": "remark", "name": "备注" },
|
||||
{ "prop": "valid", "name": "删除标志,是否有效:1 可用 0不可用" },
|
||||
{ "prop": "creatorId", "name": "创建人" },
|
||||
{ "prop": "creatorName", "name": "创建人姓名" },
|
||||
{ "prop": "createTime", "name": "添加时间" },
|
||||
{ "prop": "updaterId", "name": "更新人" },
|
||||
{ "prop": "updaterName", "name": "更新人姓名" },
|
||||
{ "prop": "updateTime", "name": "更新时间" },
|
||||
{ "prop": "version", "name": "版本号" },
|
||||
{ "prop": "recordTime", "name": "生产数量的记录时间" }, { prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {tableConfigs,
|
||||
dataForm: {
|
||||
key: ''
|
||||
},
|
||||
dataList: [],
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
dataListLoading: false,
|
||||
dataListSelections: [],
|
||||
addOrUpdateVisible: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate,BaseTable
|
||||
},
|
||||
activated() {
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentQuantity/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
page: this.pageIndex,
|
||||
limit: this.pageSize,
|
||||
key: this.dataForm.key
|
||||
})
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataList = data.data.list
|
||||
this.totalPage = data.data.total
|
||||
} else {
|
||||
this.dataList = []
|
||||
this.totalPage = 0
|
||||
}
|
||||
this.dataListLoading = false
|
||||
})
|
||||
},
|
||||
// 每页数
|
||||
sizeChangeHandle(val) {
|
||||
this.pageSize = val
|
||||
this.pageIndex = 1
|
||||
this.getDataList()
|
||||
},
|
||||
// 当前页
|
||||
currentChangeHandle(val) {
|
||||
this.pageIndex = val
|
||||
this.getDataList()
|
||||
},
|
||||
// 多选
|
||||
selectionChangeHandle(val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
},
|
||||
// 删除
|
||||
deleteHandle(id) {
|
||||
var ids = id
|
||||
? [id]
|
||||
: this.dataListSelections.map(item => {
|
||||
return item.id
|
||||
})
|
||||
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentQuantity'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getDataList()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,184 @@
|
||||
<template>
|
||||
<el-dialog :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-item label="设备外部代码" prop="externalCode">
|
||||
<el-input v-model="dataForm.externalCode" placeholder="设备外部代码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="plc id" prop="plcId">
|
||||
<el-input v-model="dataForm.plcId" placeholder="plc id"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="plc" prop="plc">
|
||||
<el-input v-model="dataForm.plc" placeholder="plc"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备id" prop="equipmentId">
|
||||
<el-input v-model="dataForm.equipmentId" placeholder="设备id"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备名称" prop="equipmentName">
|
||||
<el-input v-model="dataForm.equipmentName" placeholder="设备名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态,0正常 1计划停机 2故障" prop="status">
|
||||
<el-input v-model="dataForm.status" placeholder="状态,0正常 1计划停机 2故障"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="记录时间" prop="logTime">
|
||||
<el-input v-model="dataForm.logTime" placeholder="记录时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="dataForm.remark" placeholder="备注"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="删除标志,是否有效:1 可用 0不可用" prop="valid">
|
||||
<el-input v-model="dataForm.valid" placeholder="删除标志,是否有效:1 可用 0不可用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人" prop="creatorId">
|
||||
<el-input v-model="dataForm.creatorId" placeholder="创建人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人姓名" prop="creatorName">
|
||||
<el-input v-model="dataForm.creatorName" placeholder="创建人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-input v-model="dataForm.createTime" placeholder="创建时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人" prop="updaterId">
|
||||
<el-input v-model="dataForm.updaterId" placeholder="更新人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人姓名" prop="updaterName">
|
||||
<el-input v-model="dataForm.updaterName" placeholder="更新人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新时间" prop="updateTime">
|
||||
<el-input v-model="dataForm.updateTime" placeholder="更新时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="版本号" prop="version">
|
||||
<el-input v-model="dataForm.version" placeholder="版本号"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
externalCode: '',
|
||||
plcId: '',
|
||||
plc: '',
|
||||
equipmentId: '',
|
||||
equipmentName: '',
|
||||
status: '',
|
||||
logTime: '',
|
||||
remark: '',
|
||||
valid: '',
|
||||
creatorId: '',
|
||||
creatorName: '',
|
||||
createTime: '',
|
||||
updaterId: '',
|
||||
updaterName: '',
|
||||
updateTime: '',
|
||||
version: ''
|
||||
},
|
||||
dataRule: {
|
||||
externalCode: [{ required: true, message: '设备外部代码不能为空', trigger: 'blur' }],
|
||||
plcId: [{ required: true, message: 'plc id不能为空', trigger: 'blur' }],
|
||||
plc: [{ required: true, message: 'plc不能为空', trigger: 'blur' }],
|
||||
equipmentId: [{ required: true, message: '设备id不能为空', trigger: 'blur' }],
|
||||
equipmentName: [{ required: true, message: '设备名称不能为空', trigger: 'blur' }],
|
||||
status: [{ 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: {
|
||||
init(id) {
|
||||
this.dataForm.id = id || 0
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/equipmentStatusLog/${this.dataForm.id}`),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams()
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataForm.externalCode = data.equipmenstatusLog.externalCode
|
||||
this.dataForm.plcId = data.equipmenstatusLog.plcId
|
||||
this.dataForm.plc = data.equipmenstatusLog.plc
|
||||
this.dataForm.equipmentId = data.equipmenstatusLog.equipmentId
|
||||
this.dataForm.equipmentName = data.equipmenstatusLog.equipmentName
|
||||
this.dataForm.status = data.equipmenstatusLog.status
|
||||
this.dataForm.logTime = data.equipmenstatusLog.logTime
|
||||
this.dataForm.remark = data.equipmenstatusLog.remark
|
||||
this.dataForm.valid = data.equipmenstatusLog.valid
|
||||
this.dataForm.creatorId = data.equipmenstatusLog.creatorId
|
||||
this.dataForm.creatorName = data.equipmenstatusLog.creatorName
|
||||
this.dataForm.createTime = data.equipmenstatusLog.createTime
|
||||
this.dataForm.updaterId = data.equipmenstatusLog.updaterId
|
||||
this.dataForm.updaterName = data.equipmenstatusLog.updaterName
|
||||
this.dataForm.updateTime = data.equipmenstatusLog.updateTime
|
||||
this.dataForm.version = data.equipmenstatusLog.version
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate(valid => {
|
||||
if (valid) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/equipmentStatusLog/${!this.dataForm.id ? '' : this.dataForm.id}`),
|
||||
method: this.dataForm.id ? 'put' : 'post',
|
||||
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>
|
||||
181
src/views/modules/monitoring/equipmentStatusLog.vue
Normal file
181
src/views/modules/monitoring/equipmentStatusLog.vue
Normal file
@@ -0,0 +1,181 @@
|
||||
<template>
|
||||
<div class="mod-config">
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<el-form-item>
|
||||
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<el-button v-if="$hasPermission('monitoring:equipmenstatuslog:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- <el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" style="width: 100%;">
|
||||
<el-table-column type="selection" header-align="center" align="center" width="50"> </el-table-column>
|
||||
<el-table-column prop="id" header-align="center" align="center" label="id"> </el-table-column>
|
||||
<el-table-column prop="externalCode" header-align="center" align="center" label="设备外部代码"> </el-table-column>
|
||||
<el-table-column prop="plcId" header-align="center" align="center" label="plc id"> </el-table-column>
|
||||
<el-table-column prop="plc" header-align="center" align="center" label="plc"> </el-table-column>
|
||||
<el-table-column prop="equipmentId" header-align="center" align="center" label="设备id"> </el-table-column>
|
||||
<el-table-column prop="equipmentName" header-align="center" align="center" label="设备名称"> </el-table-column>
|
||||
<el-table-column prop="status" header-align="center" align="center" label="状态,0正常 1计划停机 2故障"> </el-table-column>
|
||||
<el-table-column prop="logTime" header-align="center" align="center" label="记录时间"> </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 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> -->
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" />
|
||||
<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>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from './equipmentStatusLog-add-or-update'
|
||||
import BaseTable from '@/components/base-table'
|
||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
||||
import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
|
||||
const tableConfigs = [
|
||||
{ "prop": "id", "name": "id" },
|
||||
{ "prop": "externalCode", "name": "设备外部代码" },
|
||||
{ "prop": "plcId", "name": "plc id" },
|
||||
{ "prop": "plc", "name": "plc" },
|
||||
{ "prop": "equipmentId", "name": "设备id" },
|
||||
{ "prop": "equipmentName", "name": "设备名称" },
|
||||
{ "prop": "status", "name": "状态,0正常 1计划停机 2故障" },
|
||||
{ "prop": "logTime", "name": "记录时间" },
|
||||
{ "prop": "remark", "name": "备注" },
|
||||
{ "prop": "valid", "name": "删除标志,是否有效:1 可用 0不可用" },
|
||||
{ "prop": "creatorId", "name": "创建人" },
|
||||
{ "prop": "creatorName", "name": "创建人姓名" },
|
||||
{ "prop": "createTime", "name": "添加时间" },
|
||||
{ "prop": "updaterId", "name": "更新人" },
|
||||
{ "prop": "updaterName", "name": "更新人姓名" },
|
||||
{ "prop": "updateTime", "name": "更新时间" },
|
||||
{ "prop": "version", "name": "版本号" }, { prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {tableConfigs,
|
||||
dataForm: {
|
||||
key: ''
|
||||
},
|
||||
dataList: [],
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
dataListLoading: false,
|
||||
dataListSelections: [],
|
||||
addOrUpdateVisible: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate,BaseTable
|
||||
},
|
||||
activated() {
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentStatusLog/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
page: this.pageIndex,
|
||||
limit: this.pageSize,
|
||||
key: this.dataForm.key
|
||||
})
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataList = data.data.list
|
||||
this.totalPage = data.data.total
|
||||
} else {
|
||||
this.dataList = []
|
||||
this.totalPage = 0
|
||||
}
|
||||
this.dataListLoading = false
|
||||
})
|
||||
},
|
||||
// 每页数
|
||||
sizeChangeHandle(val) {
|
||||
this.pageSize = val
|
||||
this.pageIndex = 1
|
||||
this.getDataList()
|
||||
},
|
||||
// 当前页
|
||||
currentChangeHandle(val) {
|
||||
this.pageIndex = val
|
||||
this.getDataList()
|
||||
},
|
||||
// 多选
|
||||
selectionChangeHandle(val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
},
|
||||
// 删除
|
||||
deleteHandle(id) {
|
||||
var ids = id
|
||||
? [id]
|
||||
: this.dataListSelections.map(item => {
|
||||
return item.id
|
||||
})
|
||||
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentStatusLog'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getDataList()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
177
src/views/modules/monitoring/equipmentType-add-or-update.vue
Normal file
177
src/views/modules/monitoring/equipmentType-add-or-update.vue
Normal file
@@ -0,0 +1,177 @@
|
||||
<template>
|
||||
<el-dialog :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-item label="编码" prop="code">
|
||||
<el-input v-model="dataForm.code" placeholder="编码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="dataForm.name" placeholder="名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="父类ID" prop="parentId">
|
||||
<el-input v-model="dataForm.parentId" placeholder="父类ID"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="父类名称" prop="parentName">
|
||||
<el-input v-model="dataForm.parentName" placeholder="父类名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="描述" prop="description">
|
||||
<el-input v-model="dataForm.description" placeholder="描述"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="启用状态:0 、停用,1、启用" prop="enabled">
|
||||
<el-input v-model="dataForm.enabled" placeholder="启用状态:0 、停用,1、启用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="dataForm.remark" placeholder="备注"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="删除标志,是否有效:1 可用 0不可用" prop="valid">
|
||||
<el-input v-model="dataForm.valid" placeholder="删除标志,是否有效:1 可用 0不可用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人" prop="creatorId">
|
||||
<el-input v-model="dataForm.creatorId" placeholder="创建人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人姓名" prop="creatorName">
|
||||
<el-input v-model="dataForm.creatorName" placeholder="创建人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-input v-model="dataForm.createTime" placeholder="创建时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人" prop="updaterId">
|
||||
<el-input v-model="dataForm.updaterId" placeholder="更新人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人姓名" prop="updaterName">
|
||||
<el-input v-model="dataForm.updaterName" placeholder="更新人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新时间" prop="updateTime">
|
||||
<el-input v-model="dataForm.updateTime" placeholder="更新时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="版本号" prop="version">
|
||||
<el-input v-model="dataForm.version" placeholder="版本号"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
code: '',
|
||||
name: '',
|
||||
parentId: '',
|
||||
parentName: '',
|
||||
description: '',
|
||||
enabled: '',
|
||||
remark: '',
|
||||
valid: '',
|
||||
creatorId: '',
|
||||
creatorName: '',
|
||||
createTime: '',
|
||||
updaterId: '',
|
||||
updaterName: '',
|
||||
updateTime: '',
|
||||
version: ''
|
||||
},
|
||||
dataRule: {
|
||||
code: [{ required: true, message: '编码不能为空', trigger: 'blur' }],
|
||||
name: [{ required: true, message: '名称不能为空', trigger: 'blur' }],
|
||||
parentId: [{ required: true, message: '父类ID不能为空', trigger: 'blur' }],
|
||||
parentName: [{ required: true, message: '父类名称不能为空', trigger: 'blur' }],
|
||||
description: [{ required: true, message: '描述不能为空', trigger: 'blur' }],
|
||||
enabled: [{ required: true, message: '启用状态:0 、停用,1、启用不能为空', 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: {
|
||||
init(id) {
|
||||
this.dataForm.id = id || 0
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/equipmentType/${this.dataForm.id}`),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams()
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataForm.code = data.equipmentype.code
|
||||
this.dataForm.name = data.equipmentype.name
|
||||
this.dataForm.parentId = data.equipmentype.parentId
|
||||
this.dataForm.parentName = data.equipmentype.parentName
|
||||
this.dataForm.description = data.equipmentype.description
|
||||
this.dataForm.enabled = data.equipmentype.enabled
|
||||
this.dataForm.remark = data.equipmentype.remark
|
||||
this.dataForm.valid = data.equipmentype.valid
|
||||
this.dataForm.creatorId = data.equipmentype.creatorId
|
||||
this.dataForm.creatorName = data.equipmentype.creatorName
|
||||
this.dataForm.createTime = data.equipmentype.createTime
|
||||
this.dataForm.updaterId = data.equipmentype.updaterId
|
||||
this.dataForm.updaterName = data.equipmentype.updaterName
|
||||
this.dataForm.updateTime = data.equipmentype.updateTime
|
||||
this.dataForm.version = data.equipmentype.version
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate(valid => {
|
||||
if (valid) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/equipmentType/${!this.dataForm.id ? '' : this.dataForm.id}`),
|
||||
method: this.dataForm.id ? 'put' : 'post',
|
||||
data: this.$http.adornData({
|
||||
id: this.dataForm.id || undefined,
|
||||
code: this.dataForm.code,
|
||||
name: this.dataForm.name,
|
||||
parentId: this.dataForm.parentId,
|
||||
parentName: this.dataForm.parentName,
|
||||
description: this.dataForm.description,
|
||||
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>
|
||||
226
src/views/modules/monitoring/equipmentType.vue
Normal file
226
src/views/modules/monitoring/equipmentType.vue
Normal file
@@ -0,0 +1,226 @@
|
||||
<template>
|
||||
<div class="mod-config">
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<el-form-item>
|
||||
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<el-button v-if="$hasPermission('monitoring:equipmenttype:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- <el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" style="width: 100%;">
|
||||
<el-table-column type="selection" header-align="center" align="center" width="50"> </el-table-column>
|
||||
<el-table-column 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="parentId" header-align="center" align="center" label="父类ID"> </el-table-column>
|
||||
<el-table-column prop="parentName" 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 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> -->
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" @operate-event="handleOperations" @refreshDataList="getDataList" />
|
||||
<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" :configs="addOrUpdateConfigs" @refreshDataList="getDataList" @destory-dialog="addOrUpdateVisible = false" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from '@/components/base-dialog/addOrUpdate'
|
||||
// import AddOrUpdate from './equipmentType-add-or-update'
|
||||
import BaseTable from '@/components/base-table'
|
||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
||||
// import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
|
||||
const tableConfigs = [
|
||||
{ prop: 'createTime', name: '添加时间' },
|
||||
{ prop: 'name', name: '类型名称' },
|
||||
{ prop: 'code', name: '类型编码' },
|
||||
{ prop: 'remark', name: '备注' },
|
||||
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
|
||||
const addOrUpdateConfigs = {
|
||||
type: 'dialog',
|
||||
infoUrl: '/monitoring/equipmentType',
|
||||
fields: [
|
||||
{ name: 'name', label: '设备类型名称' },
|
||||
{ name: 'code', label: '设备类型编码', api: '/monitoring/equipmentType/getCode' },
|
||||
{ name: 'parentId', label: '父类', type: 'cascader', props: { label: 'name', value: 'id', checkStrictly: true, emitPath: false }, options: [] },
|
||||
'remark'
|
||||
],
|
||||
operations: [
|
||||
{ name: 'cancel', showAlways: true },
|
||||
{ name: 'save', url: '/monitoring/equipmentType', permission: '', showOnEdit: false },
|
||||
{ name: 'update', url: '/monitoring/equipmentType', permission: '', showOnEdit: true }
|
||||
],
|
||||
extraComponents: [
|
||||
{
|
||||
name: 'files',
|
||||
fieldType: 'array',
|
||||
label: '上传资料',
|
||||
component: () => import('@/components/base-upload'),
|
||||
props: { // 上传组件需要的 props
|
||||
url: "/monitoring/attachment/uploadFileFormData",
|
||||
extraParams: { typeCode: "EquipmentTypeFile" },
|
||||
buttonContent: '点击上传',
|
||||
tip: '上传文件大小不要超过 2mb (2048kb)'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
addOrUpdateConfigs,
|
||||
tableConfigs,
|
||||
dataForm: {
|
||||
key: ''
|
||||
},
|
||||
dataList: [],
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
dataListLoading: false,
|
||||
dataListSelections: [],
|
||||
addOrUpdateVisible: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate,
|
||||
BaseTable
|
||||
},
|
||||
activated() {
|
||||
this.getTreeEquipmentType()
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
// 获取设备类型树形数据
|
||||
getTreeEquipmentType() {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentType/getTree'),
|
||||
method: 'post'
|
||||
}).then(({ data: res }) => {
|
||||
if (res && res.code === 0 && res.data.length) {
|
||||
this.addOrUpdateConfigs.fields.find(item => item.name === 'parentId').options = res.data
|
||||
} else {
|
||||
this.addOrUpdateConfigs.fields.find(item => item.name === 'parentId').options.splice(0)
|
||||
}
|
||||
})
|
||||
},
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.addOrUpdateVisible = false
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentType/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
page: this.pageIndex,
|
||||
limit: this.pageSize,
|
||||
key: this.dataForm.key
|
||||
})
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataList = data.data.list
|
||||
this.totalPage = data.data.total
|
||||
} else {
|
||||
this.dataList = []
|
||||
this.totalPage = 0
|
||||
}
|
||||
this.dataListLoading = false
|
||||
})
|
||||
},
|
||||
// 每页数
|
||||
sizeChangeHandle(val) {
|
||||
this.pageSize = val
|
||||
this.pageIndex = 1
|
||||
this.getDataList()
|
||||
},
|
||||
// 当前页
|
||||
currentChangeHandle(val) {
|
||||
this.pageIndex = val
|
||||
this.getDataList()
|
||||
},
|
||||
// 多选
|
||||
selectionChangeHandle(val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
handleOperations({ type, data: id }) {
|
||||
switch (type) {
|
||||
case 'edit':
|
||||
return this.addOrUpdateHandle(id)
|
||||
case 'delete':
|
||||
return this.deleteHandle(id)
|
||||
}
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle(id) {
|
||||
// 更新树形结构
|
||||
this.getTreeEquipmentType()
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
},
|
||||
// 删除
|
||||
deleteHandle(id) {
|
||||
var ids = id
|
||||
? [id]
|
||||
: this.dataListSelections.map(item => {
|
||||
return item.id
|
||||
})
|
||||
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentType'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getDataList()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
184
src/views/modules/monitoring/equipmentTypeFile-add-or-update.vue
Normal file
184
src/views/modules/monitoring/equipmentTypeFile-add-or-update.vue
Normal file
@@ -0,0 +1,184 @@
|
||||
<template>
|
||||
<el-dialog :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-item label="设备类型ID" prop="equipmentTypeId">
|
||||
<el-input v-model="dataForm.equipmentTypeId" placeholder="设备类型ID"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="文件ID" prop="fileId">
|
||||
<el-input v-model="dataForm.fileId" placeholder="文件ID"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="文件类型编码" prop="typeCode">
|
||||
<el-input v-model="dataForm.typeCode" placeholder="文件类型编码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="文件名称" prop="fileName">
|
||||
<el-input v-model="dataForm.fileName" placeholder="文件名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="下载地址" prop="fileUrl">
|
||||
<el-input v-model="dataForm.fileUrl" placeholder="下载地址"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="描述" prop="description">
|
||||
<el-input v-model="dataForm.description" placeholder="描述"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="启用状态:0 、停用,1、启用" prop="enabled">
|
||||
<el-input v-model="dataForm.enabled" placeholder="启用状态:0 、停用,1、启用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="dataForm.remark" placeholder="备注"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="删除标志,是否有效:1 可用 0不可用" prop="valid">
|
||||
<el-input v-model="dataForm.valid" placeholder="删除标志,是否有效:1 可用 0不可用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人" prop="creatorId">
|
||||
<el-input v-model="dataForm.creatorId" placeholder="创建人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人姓名" prop="creatorName">
|
||||
<el-input v-model="dataForm.creatorName" placeholder="创建人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-input v-model="dataForm.createTime" placeholder="创建时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人" prop="updaterId">
|
||||
<el-input v-model="dataForm.updaterId" placeholder="更新人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人姓名" prop="updaterName">
|
||||
<el-input v-model="dataForm.updaterName" placeholder="更新人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新时间" prop="updateTime">
|
||||
<el-input v-model="dataForm.updateTime" placeholder="更新时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="版本号" prop="version">
|
||||
<el-input v-model="dataForm.version" placeholder="版本号"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
equipmentTypeId: '',
|
||||
fileId: '',
|
||||
typeCode: '',
|
||||
fileName: '',
|
||||
fileUrl: '',
|
||||
description: '',
|
||||
enabled: '',
|
||||
remark: '',
|
||||
valid: '',
|
||||
creatorId: '',
|
||||
creatorName: '',
|
||||
createTime: '',
|
||||
updaterId: '',
|
||||
updaterName: '',
|
||||
updateTime: '',
|
||||
version: ''
|
||||
},
|
||||
dataRule: {
|
||||
equipmentTypeId: [{ required: true, message: '设备类型ID不能为空', trigger: 'blur' }],
|
||||
fileId: [{ required: true, message: '文件ID不能为空', trigger: 'blur' }],
|
||||
typeCode: [{ required: true, message: '文件类型编码不能为空', trigger: 'blur' }],
|
||||
fileName: [{ required: true, message: '文件名称不能为空', trigger: 'blur' }],
|
||||
fileUrl: [{ required: true, message: '下载地址不能为空', trigger: 'blur' }],
|
||||
description: [{ required: true, message: '描述不能为空', trigger: 'blur' }],
|
||||
enabled: [{ required: true, message: '启用状态:0 、停用,1、启用不能为空', 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: {
|
||||
init(id) {
|
||||
this.dataForm.id = id || 0
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/equipmentTypeFile/${this.dataForm.id}`),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams()
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataForm.equipmentTypeId = data.equipmentypeFile.equipmentTypeId
|
||||
this.dataForm.fileId = data.equipmentypeFile.fileId
|
||||
this.dataForm.typeCode = data.equipmentypeFile.typeCode
|
||||
this.dataForm.fileName = data.equipmentypeFile.fileName
|
||||
this.dataForm.fileUrl = data.equipmentypeFile.fileUrl
|
||||
this.dataForm.description = data.equipmentypeFile.description
|
||||
this.dataForm.enabled = data.equipmentypeFile.enabled
|
||||
this.dataForm.remark = data.equipmentypeFile.remark
|
||||
this.dataForm.valid = data.equipmentypeFile.valid
|
||||
this.dataForm.creatorId = data.equipmentypeFile.creatorId
|
||||
this.dataForm.creatorName = data.equipmentypeFile.creatorName
|
||||
this.dataForm.createTime = data.equipmentypeFile.createTime
|
||||
this.dataForm.updaterId = data.equipmentypeFile.updaterId
|
||||
this.dataForm.updaterName = data.equipmentypeFile.updaterName
|
||||
this.dataForm.updateTime = data.equipmentypeFile.updateTime
|
||||
this.dataForm.version = data.equipmentypeFile.version
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate(valid => {
|
||||
if (valid) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/equipmentTypeFile/${!this.dataForm.id ? '' : this.dataForm.id}`),
|
||||
method: this.dataForm.id ? 'put' : 'post',
|
||||
data: this.$http.adornData({
|
||||
id: this.dataForm.id || undefined,
|
||||
equipmentTypeId: this.dataForm.equipmentTypeId,
|
||||
fileId: this.dataForm.fileId,
|
||||
typeCode: this.dataForm.typeCode,
|
||||
fileName: this.dataForm.fileName,
|
||||
fileUrl: this.dataForm.fileUrl,
|
||||
description: this.dataForm.description,
|
||||
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>
|
||||
182
src/views/modules/monitoring/equipmentTypeFile.vue
Normal file
182
src/views/modules/monitoring/equipmentTypeFile.vue
Normal file
@@ -0,0 +1,182 @@
|
||||
<template>
|
||||
<div class="mod-config">
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<el-form-item>
|
||||
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<el-button v-if="$hasPermission('monitoring:equipmentypefile:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- <el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" style="width: 100%;">
|
||||
<el-table-column type="selection" header-align="center" align="center" width="50"> </el-table-column>
|
||||
<el-table-column prop="id" header-align="center" align="center" label="ID"> </el-table-column>
|
||||
<el-table-column prop="equipmentTypeId" header-align="center" align="center" label="设备类型ID"> </el-table-column>
|
||||
<el-table-column prop="fileId" header-align="center" align="center" label="文件ID"> </el-table-column>
|
||||
<el-table-column prop="typeCode" header-align="center" align="center" label="文件类型编码"> </el-table-column>
|
||||
<el-table-column prop="fileName" header-align="center" align="center" label="文件名称"> </el-table-column>
|
||||
<el-table-column prop="fileUrl" 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 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> -->
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" />
|
||||
<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>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from './equipmentTypeFile-add-or-update'
|
||||
import BaseTable from '@/components/base-table'
|
||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
||||
import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
|
||||
const tableConfigs = [
|
||||
{ "prop": "id", "name": "ID" },
|
||||
{ "prop": "equipmentTypeId", "name": "设备类型ID" },
|
||||
{ "prop": "fileId", "name": "文件ID" },
|
||||
{ "prop": "typeCode", "name": "文件类型编码" },
|
||||
{ "prop": "fileName", "name": "文件名称" },
|
||||
{ "prop": "fileUrl", "name": "下载地址" },
|
||||
{ "prop": "description", "name": "描述" },
|
||||
{ "prop": "enabled", "name": "启用状态:0 、停用,1、启用" },
|
||||
{ "prop": "remark", "name": "备注" },
|
||||
{ "prop": "valid", "name": "删除标志,是否有效:1 可用 0不可用" },
|
||||
{ "prop": "creatorId", "name": "创建人" },
|
||||
{ "prop": "creatorName", "name": "创建人姓名" },
|
||||
{ "prop": "createTime", "name": "添加时间" },
|
||||
{ "prop": "updaterId", "name": "更新人" },
|
||||
{ "prop": "updaterName", "name": "更新人姓名" },
|
||||
{ "prop": "updateTime", "name": "更新时间" },
|
||||
{ "prop": "version", "name": "版本号" }, { prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {tableConfigs,
|
||||
dataForm: {
|
||||
key: ''
|
||||
},
|
||||
dataList: [],
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
dataListLoading: false,
|
||||
dataListSelections: [],
|
||||
addOrUpdateVisible: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate,BaseTable
|
||||
},
|
||||
activated() {
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentTypeFile/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
page: this.pageIndex,
|
||||
limit: this.pageSize,
|
||||
key: this.dataForm.key
|
||||
})
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataList = data.data.list
|
||||
this.totalPage = data.data.total
|
||||
} else {
|
||||
this.dataList = []
|
||||
this.totalPage = 0
|
||||
}
|
||||
this.dataListLoading = false
|
||||
})
|
||||
},
|
||||
// 每页数
|
||||
sizeChangeHandle(val) {
|
||||
this.pageSize = val
|
||||
this.pageIndex = 1
|
||||
this.getDataList()
|
||||
},
|
||||
// 当前页
|
||||
currentChangeHandle(val) {
|
||||
this.pageIndex = val
|
||||
this.getDataList()
|
||||
},
|
||||
// 多选
|
||||
selectionChangeHandle(val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
},
|
||||
// 删除
|
||||
deleteHandle(id) {
|
||||
var ids = id
|
||||
? [id]
|
||||
: this.dataListSelections.map(item => {
|
||||
return item.id
|
||||
})
|
||||
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentTypeFile'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getDataList()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
176
src/views/modules/monitoring/equipmentattr.vue
Normal file
176
src/views/modules/monitoring/equipmentattr.vue
Normal file
@@ -0,0 +1,176 @@
|
||||
<template>
|
||||
<div class="mod-config">
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<el-form-item>
|
||||
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<el-button v-if="$hasPermission('monitoring:equipmenattr:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- <el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" style="width: 100%;">
|
||||
<el-table-column type="selection" header-align="center" align="center" width="50"> </el-table-column>
|
||||
<el-table-column prop="id" header-align="center" align="center" label="ID"> </el-table-column>
|
||||
<el-table-column prop="equipmentId" header-align="center" align="center" label="设备ID"> </el-table-column>
|
||||
<el-table-column prop="attrName" header-align="center" align="center" label="属性名称"> </el-table-column>
|
||||
<el-table-column prop="attrValue" header-align="center" align="center" label="属性值"> </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 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> -->
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" />
|
||||
<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>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from './equipmentAttr-add-or-update'
|
||||
import BaseTable from '@/components/base-table'
|
||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
||||
import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
|
||||
const tableConfigs = [
|
||||
{ prop: 'createTime', name: '添加时间' },
|
||||
{ prop: 'equipmentId', name: '设备ID' },
|
||||
{ prop: 'attrName', name: '属性名' },
|
||||
{ prop: 'attrValue', name: '属性值' },
|
||||
// { "prop": "id", "name": "ID" },
|
||||
// { "prop": "remark", "name": "备注" },
|
||||
// { "prop": "valid", "name": "删除标志,是否有效:1 可用 0不可用" },
|
||||
// { "prop": "creatorId", "name": "创建人" },
|
||||
// { "prop": "creatorName", "name": "创建人姓名" },
|
||||
// { "prop": "updaterId", "name": "更新人" },
|
||||
// { "prop": "updaterName", "name": "更新人姓名" },
|
||||
// { "prop": "updateTime", "name": "更新时间" },
|
||||
// { prop: 'version', name: '版本号' },
|
||||
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
tableConfigs,
|
||||
dataForm: {
|
||||
key: ''
|
||||
},
|
||||
dataList: [],
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
dataListLoading: false,
|
||||
dataListSelections: [],
|
||||
addOrUpdateVisible: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate,
|
||||
BaseTable
|
||||
},
|
||||
activated() {
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentAttr/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
page: this.pageIndex,
|
||||
limit: this.pageSize,
|
||||
key: this.dataForm.key
|
||||
})
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataList = data.data.list
|
||||
this.totalPage = data.data.total
|
||||
} else {
|
||||
this.dataList = []
|
||||
this.totalPage = 0
|
||||
}
|
||||
this.dataListLoading = false
|
||||
})
|
||||
},
|
||||
// 每页数
|
||||
sizeChangeHandle(val) {
|
||||
this.pageSize = val
|
||||
this.pageIndex = 1
|
||||
this.getDataList()
|
||||
},
|
||||
// 当前页
|
||||
currentChangeHandle(val) {
|
||||
this.pageIndex = val
|
||||
this.getDataList()
|
||||
},
|
||||
// 多选
|
||||
selectionChangeHandle(val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
},
|
||||
// 删除
|
||||
deleteHandle(id) {
|
||||
var ids = id
|
||||
? [id]
|
||||
: this.dataListSelections.map(item => {
|
||||
return item.id
|
||||
})
|
||||
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentAttr'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getDataList()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
177
src/views/modules/monitoring/factory-add-or-update.vue
Normal file
177
src/views/modules/monitoring/factory-add-or-update.vue
Normal file
@@ -0,0 +1,177 @@
|
||||
<template>
|
||||
<el-dialog :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-item label="工厂编码" prop="code">
|
||||
<el-input v-model="dataForm.code" placeholder="工厂编码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="工厂名称" prop="name">
|
||||
<el-input v-model="dataForm.name" placeholder="工厂名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="地址" prop="address">
|
||||
<el-input v-model="dataForm.address" placeholder="地址"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="描述" prop="description">
|
||||
<el-input v-model="dataForm.description" placeholder="描述"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="启用状态:0 、停用,1、启用" prop="enabled">
|
||||
<el-input v-model="dataForm.enabled" placeholder="启用状态:0 、停用,1、启用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="dataForm.remark" placeholder="备注"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="删除标志,是否有效:1 可用 0不可用" prop="valid">
|
||||
<el-input v-model="dataForm.valid" placeholder="删除标志,是否有效:1 可用 0不可用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人" prop="creatorId">
|
||||
<el-input v-model="dataForm.creatorId" placeholder="创建人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人姓名" prop="creatorName">
|
||||
<el-input v-model="dataForm.creatorName" placeholder="创建人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-input v-model="dataForm.createTime" placeholder="创建时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人" prop="updaterId">
|
||||
<el-input v-model="dataForm.updaterId" placeholder="更新人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人姓名" prop="updaterName">
|
||||
<el-input v-model="dataForm.updaterName" placeholder="更新人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新时间" prop="updateTime">
|
||||
<el-input v-model="dataForm.updateTime" placeholder="更新时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="版本号" prop="version">
|
||||
<el-input v-model="dataForm.version" placeholder="版本号"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="外部系统编码" prop="externalCode">
|
||||
<el-input v-model="dataForm.externalCode" placeholder="外部系统编码"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
code: '',
|
||||
name: '',
|
||||
address: '',
|
||||
description: '',
|
||||
enabled: '',
|
||||
remark: '',
|
||||
valid: '',
|
||||
creatorId: '',
|
||||
creatorName: '',
|
||||
createTime: '',
|
||||
updaterId: '',
|
||||
updaterName: '',
|
||||
updateTime: '',
|
||||
version: '',
|
||||
externalCode: ''
|
||||
},
|
||||
dataRule: {
|
||||
code: [{ required: true, message: '工厂编码不能为空', trigger: 'blur' }],
|
||||
name: [{ required: true, message: '工厂名称不能为空', trigger: 'blur' }],
|
||||
address: [{ required: true, message: '地址不能为空', trigger: 'blur' }],
|
||||
description: [{ required: true, message: '描述不能为空', trigger: 'blur' }],
|
||||
enabled: [{ required: true, message: '启用状态:0 、停用,1、启用不能为空', 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' }],
|
||||
externalCode: [{ required: true, message: '外部系统编码不能为空', trigger: 'blur' }]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init(id) {
|
||||
this.dataForm.id = id || 0
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/factory/{this.dataForm.id}`),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams()
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataForm.code = data.factory.code
|
||||
this.dataForm.name = data.factory.name
|
||||
this.dataForm.address = data.factory.address
|
||||
this.dataForm.description = data.factory.description
|
||||
this.dataForm.enabled = data.factory.enabled
|
||||
this.dataForm.remark = data.factory.remark
|
||||
this.dataForm.valid = data.factory.valid
|
||||
this.dataForm.creatorId = data.factory.creatorId
|
||||
this.dataForm.creatorName = data.factory.creatorName
|
||||
this.dataForm.createTime = data.factory.createTime
|
||||
this.dataForm.updaterId = data.factory.updaterId
|
||||
this.dataForm.updaterName = data.factory.updaterName
|
||||
this.dataForm.updateTime = data.factory.updateTime
|
||||
this.dataForm.version = data.factory.version
|
||||
this.dataForm.externalCode = data.factory.externalCode
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate(valid => {
|
||||
if (valid) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/factory/${!this.dataForm.id ? '' : this.dataForm.id}`),
|
||||
method: this.dataForm.id ? 'put' : 'post',
|
||||
data: this.$http.adornData({
|
||||
id: this.dataForm.id || undefined,
|
||||
code: this.dataForm.code,
|
||||
name: this.dataForm.name,
|
||||
address: this.dataForm.address,
|
||||
description: this.dataForm.description,
|
||||
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,
|
||||
externalCode: this.dataForm.externalCode
|
||||
})
|
||||
}).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>
|
||||
205
src/views/modules/monitoring/factory.vue
Normal file
205
src/views/modules/monitoring/factory.vue
Normal file
@@ -0,0 +1,205 @@
|
||||
<template>
|
||||
<div class="mod-config">
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<el-form-item>
|
||||
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<el-button v-if="$hasPermission('monitoring:factory:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- <el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" style="width: 100%;">
|
||||
<el-table-column type="selection" header-align="center" align="center" width="50"> </el-table-column>
|
||||
<el-table-column 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="address" 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 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> -->
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" @operate-event="handleOperations" @refreshDataList="getDataList" />
|
||||
<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" :configs="addOrUpdateConfigs" @refreshDataList="getDataList" @destory-dialog="addOrUpdateVisible = false" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// import AddOrUpdate from './factory-add-or-update'
|
||||
import AddOrUpdate from '@/components/base-dialog/addOrUpdate'
|
||||
import BaseTable from '@/components/base-table'
|
||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
||||
import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
|
||||
const tableConfigs = [
|
||||
{ prop: 'createTime', name: '添加时间' },
|
||||
{ prop: 'name', name: '工厂名称' },
|
||||
{ prop: 'code', name: '工厂编码' },
|
||||
{ prop: 'address', name: '地址' },
|
||||
{ prop: 'remark', name: '备注' },
|
||||
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
|
||||
const addOrUpdateConfigs = {
|
||||
type: 'dialog',
|
||||
infoUrl: '/monitoring/factory',
|
||||
fields: [
|
||||
'name',
|
||||
{
|
||||
name: 'code',
|
||||
api: '/monitoring/factory/getCode'
|
||||
},
|
||||
{
|
||||
name: 'address',
|
||||
label: '地址',
|
||||
placeholder: '请输入地址'
|
||||
},
|
||||
'remark'
|
||||
],
|
||||
operations: [
|
||||
{ name: 'reset', url: true, showAlways: true },
|
||||
{ name: 'cancel', url: true, showAlways: true },
|
||||
{ name: 'save', url: '/monitoring/factory', permission: '', showOnEdit: false },
|
||||
{ name: 'update', url: '/monitoring/factory', permission: '', showOnEdit: true }
|
||||
]
|
||||
}
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
addOrUpdateConfigs,
|
||||
tableConfigs,
|
||||
dataForm: {
|
||||
key: ''
|
||||
},
|
||||
dataList: [],
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
dataListLoading: false,
|
||||
dataListSelections: [],
|
||||
addOrUpdateVisible: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate,
|
||||
BaseTable
|
||||
},
|
||||
activated() {
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.addOrUpdateVisible = false
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/factory/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
page: this.pageIndex,
|
||||
limit: this.pageSize,
|
||||
key: this.dataForm.key
|
||||
})
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataList = data.data.list
|
||||
this.totalPage = data.data.totalCount
|
||||
} else {
|
||||
this.dataList = []
|
||||
this.totalPage = 0
|
||||
}
|
||||
this.dataListLoading = false
|
||||
})
|
||||
},
|
||||
// 每页数
|
||||
sizeChangeHandle(val) {
|
||||
this.pageSize = val
|
||||
this.pageIndex = 1
|
||||
this.getDataList()
|
||||
},
|
||||
// 当前页
|
||||
currentChangeHandle(val) {
|
||||
this.pageIndex = val
|
||||
this.getDataList()
|
||||
},
|
||||
// 多选
|
||||
selectionChangeHandle(val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
handleOperations({ type, data: id }) {
|
||||
switch (type) {
|
||||
case 'edit':
|
||||
return this.addOrUpdateHandle(id)
|
||||
case 'delete':
|
||||
return this.deleteHandle(id)
|
||||
}
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
},
|
||||
// 删除
|
||||
deleteHandle(id) {
|
||||
var ids = id
|
||||
? [id]
|
||||
: this.dataListSelections.map(item => {
|
||||
return item.id
|
||||
})
|
||||
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/factory'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getDataList()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
205
src/views/modules/monitoring/product-add-or-update.vue
Normal file
205
src/views/modules/monitoring/product-add-or-update.vue
Normal file
@@ -0,0 +1,205 @@
|
||||
<template>
|
||||
<el-dialog :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-item label="编码" prop="code">
|
||||
<el-input v-model="dataForm.code" placeholder="编码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="dataForm.name" placeholder="名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="描述" prop="description">
|
||||
<el-input v-model="dataForm.description" placeholder="描述"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="外部编码,用于对照外部系统的编码" prop="externalCode">
|
||||
<el-input v-model="dataForm.externalCode" placeholder="外部编码,用于对照外部系统的编码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="规格" prop="specifications">
|
||||
<el-input v-model="dataForm.specifications" placeholder="规格"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="单位value,对应到数据字典label_value" prop="unitDictValue">
|
||||
<el-input v-model="dataForm.unitDictValue" placeholder="单位value,对应到数据字典label_value"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="一单位的面积(平方米)" prop="area">
|
||||
<el-input v-model="dataForm.area" placeholder="一单位的面积(平方米)"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="加工一单位产品需要的时间" prop="processTime">
|
||||
<el-input v-model="dataForm.processTime" placeholder="加工一单位产品需要的时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="产品类型value,对应到数据字典label_value" prop="typeDictValue">
|
||||
<el-input v-model="dataForm.typeDictValue" placeholder="产品类型value,对应到数据字典label_value"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="启用状态:0 、停用,1、启用" prop="enabled">
|
||||
<el-input v-model="dataForm.enabled" placeholder="启用状态:0 、停用,1、启用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="dataForm.remark" placeholder="备注"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="删除标志,是否有效:1 可用 0不可用" prop="valid">
|
||||
<el-input v-model="dataForm.valid" placeholder="删除标志,是否有效:1 可用 0不可用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人" prop="creatorId">
|
||||
<el-input v-model="dataForm.creatorId" placeholder="创建人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人姓名" prop="creatorName">
|
||||
<el-input v-model="dataForm.creatorName" placeholder="创建人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-input v-model="dataForm.createTime" placeholder="创建时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人" prop="updaterId">
|
||||
<el-input v-model="dataForm.updaterId" placeholder="更新人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人姓名" prop="updaterName">
|
||||
<el-input v-model="dataForm.updaterName" placeholder="更新人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新时间" prop="updateTime">
|
||||
<el-input v-model="dataForm.updateTime" placeholder="更新时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="版本号" prop="version">
|
||||
<el-input v-model="dataForm.version" placeholder="版本号"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
code: '',
|
||||
name: '',
|
||||
description: '',
|
||||
externalCode: '',
|
||||
specifications: '',
|
||||
unitDictValue: '',
|
||||
area: '',
|
||||
processTime: '',
|
||||
typeDictValue: '',
|
||||
enabled: '',
|
||||
remark: '',
|
||||
valid: '',
|
||||
creatorId: '',
|
||||
creatorName: '',
|
||||
createTime: '',
|
||||
updaterId: '',
|
||||
updaterName: '',
|
||||
updateTime: '',
|
||||
version: ''
|
||||
},
|
||||
dataRule: {
|
||||
code: [{ required: true, message: '编码不能为空', trigger: 'blur' }],
|
||||
name: [{ required: true, message: '名称不能为空', trigger: 'blur' }],
|
||||
description: [{ required: true, message: '描述不能为空', trigger: 'blur' }],
|
||||
externalCode: [{ required: true, message: '外部编码,用于对照外部系统的编码不能为空', trigger: 'blur' }],
|
||||
specifications: [{ required: true, message: '规格不能为空', trigger: 'blur' }],
|
||||
unitDictValue: [{ required: true, message: '单位value,对应到数据字典label_value不能为空', trigger: 'blur' }],
|
||||
area: [{ required: true, message: '一单位的面积(平方米)不能为空', trigger: 'blur' }],
|
||||
processTime: [{ required: true, message: '加工一单位产品需要的时间不能为空', trigger: 'blur' }],
|
||||
typeDictValue: [{ required: true, message: '产品类型value,对应到数据字典label_value不能为空', trigger: 'blur' }],
|
||||
enabled: [{ required: true, message: '启用状态:0 、停用,1、启用不能为空', 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: {
|
||||
init(id) {
|
||||
this.dataForm.id = id || 0
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/product/${this.dataForm.id}`),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams()
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataForm.code = data.data.code
|
||||
this.dataForm.name = data.data.name
|
||||
this.dataForm.description = data.data.description
|
||||
this.dataForm.externalCode = data.data.externalCode
|
||||
this.dataForm.specifications = data.data.specifications
|
||||
this.dataForm.unitDictValue = data.data.unitDictValue
|
||||
this.dataForm.area = data.data.area
|
||||
this.dataForm.processTime = data.data.processTime
|
||||
this.dataForm.typeDictValue = data.data.typeDictValue
|
||||
this.dataForm.enabled = data.data.enabled
|
||||
this.dataForm.remark = data.data.remark
|
||||
this.dataForm.valid = data.data.valid
|
||||
this.dataForm.creatorId = data.data.creatorId
|
||||
this.dataForm.creatorName = data.data.creatorName
|
||||
this.dataForm.createTime = data.data.createTime
|
||||
this.dataForm.updaterId = data.data.updaterId
|
||||
this.dataForm.updaterName = data.data.updaterName
|
||||
this.dataForm.updateTime = data.data.updateTime
|
||||
this.dataForm.version = data.data.version
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate(valid => {
|
||||
if (valid) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/product/${!this.dataForm.id ? '' : this.dataForm.id}`),
|
||||
method: this.dataForm.id ? 'put' : 'post',
|
||||
data: this.$http.adornData({
|
||||
id: this.dataForm.id || undefined,
|
||||
code: this.dataForm.code,
|
||||
name: this.dataForm.name,
|
||||
description: this.dataForm.description,
|
||||
externalCode: this.dataForm.externalCode,
|
||||
specifications: this.dataForm.specifications,
|
||||
unitDictValue: this.dataForm.unitDictValue,
|
||||
area: this.dataForm.area,
|
||||
processTime: this.dataForm.processTime,
|
||||
typeDictValue: this.dataForm.typeDictValue,
|
||||
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>
|
||||
295
src/views/modules/monitoring/product.vue
Normal file
295
src/views/modules/monitoring/product.vue
Normal file
@@ -0,0 +1,295 @@
|
||||
<template>
|
||||
<div class="mod-config">
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<el-form-item>
|
||||
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<!-- <el-button @click="addOrEdit()">测试</el-button> -->
|
||||
<!-- <el-button v-if="$hasPermission('monitoring:product:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button> -->
|
||||
<el-button v-if="$hasPermission('monitoring:product:save')" type="primary" @click="addOrEdit()">新增</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- <el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" style="width: 100%;">
|
||||
<el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
|
||||
<el-table-column 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="description" 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="specifications" header-align="center" align="center" label="规格"></el-table-column>
|
||||
<el-table-column prop="unitDictValue" header-align="center" align="center" label="单位value,对应到数据字典label_value"></el-table-column>
|
||||
<el-table-column prop="area" header-align="center" align="center" label="一单位的面积(平方米)"></el-table-column>
|
||||
<el-table-column prop="processTime" header-align="center" align="center" label="加工一单位产品需要的时间"></el-table-column>
|
||||
<el-table-column prop="typeDictValue" header-align="center" align="center" label="产品类型value,对应到数据字典label_value"></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 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> -->
|
||||
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" @operate-event="handleOperations" @refreshDataList="getDataList" />
|
||||
|
||||
<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> -->
|
||||
|
||||
<base-dialog v-if="showbasedialog" ref="basedialog" :configs="addOrUpdateConfigs" @refreshDataList="getDataList" @destory-dialog="showbasedialog = false" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// import AddOrUpdate from './product-add-or-update'
|
||||
import BaseTable from '@/components/base-table'
|
||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
||||
// import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
import BaseDialog from '@/components/base-dialog/addOrUpdate'
|
||||
import moment from 'moment'
|
||||
import dictListMixin from '@/mixins/dictlist-module'
|
||||
import { dictFilter } from '@/utils/filters'
|
||||
|
||||
const UnitDictTypeId = '1557173812109242370'
|
||||
const ProductTypeDictTypeId = '1557179530308616193'
|
||||
const tableConfigs = [
|
||||
{ type: 'index', name: '序号' },
|
||||
{ prop: 'createTime', name: '添加时间', filter: val => (val ? moment(val).format('YYYY-MM-DD hh:mm:ss') : '-') },
|
||||
{ prop: 'name', name: '产品名称' },
|
||||
{ prop: 'code', name: '产品编码' },
|
||||
{ prop: 'specifications', name: '规格' },
|
||||
{ prop: 'unitDictValue', name: '单位', filter: dictFilter(UnitDictTypeId) },
|
||||
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['viewAttr', 'delete'] }
|
||||
]
|
||||
|
||||
const addOrUpdateConfigs = {
|
||||
type: 'dialog', // dialog | drawer | page
|
||||
infoUrl: '/monitoring/product',
|
||||
fields: [
|
||||
'name',
|
||||
{
|
||||
name: 'code',
|
||||
api: '/monitoring/product/getCode'
|
||||
},
|
||||
{
|
||||
name: 'processTime',
|
||||
label: '加工时间',
|
||||
placeholder: '请输入加工时间',
|
||||
type: 'number',
|
||||
required: true,
|
||||
rules: [
|
||||
{
|
||||
type: 'number',
|
||||
trigger: 'blur',
|
||||
transform: val => Number(val),
|
||||
message: '必须输入数字'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'typeDictValue',
|
||||
label: '产品类型', // 对于非常见属性,最好自己指定label
|
||||
type: 'select',
|
||||
options: [
|
||||
// 动态获取
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'unitDictValue',
|
||||
label: '单位',
|
||||
type: 'select',
|
||||
// placeholder: '请选择单位',
|
||||
options: [
|
||||
// 动态获取
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'area',
|
||||
label: '单位平方数',
|
||||
type: 'number',
|
||||
rules: [{ type: 'number', transform: val => Number(val), message: '请输入数字', trigger: 'blur' }]
|
||||
},
|
||||
'specifications',
|
||||
'remark'
|
||||
],
|
||||
operations: [
|
||||
{ name: 'cancel', url: true, showAlways: true },
|
||||
{ name: 'save', url: '/monitoring/product', permission: '', showOnEdit: false },
|
||||
{ name: 'update', url: '/monitoring/product', permission: '', showOnEdit: true }
|
||||
],
|
||||
subtable: {
|
||||
// for i18n
|
||||
title: '动态属性',
|
||||
url: '/monitoring/productArrt',
|
||||
relatedField: 'productId',
|
||||
tableConfigs: [
|
||||
{ type: 'index', name: '序号' },
|
||||
{ prop: 'createTime', name: '添加时间', filter: val => (val ? moment(val).format('YYYY-MM-DD hh:mm:ss') : '-') },
|
||||
{ prop: 'name', name: '属性名', formField: true, rules: [{ required: true, message: '必填', trigger: 'blur' }] },
|
||||
{ prop: 'code', name: '属性值', formField: true },
|
||||
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
mixins: [dictListMixin],
|
||||
data() {
|
||||
return {
|
||||
tableConfigs,
|
||||
dataForm: {
|
||||
key: ''
|
||||
},
|
||||
dataList: [],
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
dataListLoading: false,
|
||||
dataListSelections: [],
|
||||
addOrUpdateVisible: false,
|
||||
addOrUpdateConfigs,
|
||||
showbasedialog: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
// AddOrUpdate,
|
||||
BaseTable,
|
||||
BaseDialog
|
||||
},
|
||||
created() {
|
||||
this.initDictList([UnitDictTypeId, ProductTypeDictTypeId])
|
||||
this.addOrUpdateConfigs.fields.forEach(item => {
|
||||
if (item.name) {
|
||||
if (item.name === 'typeDictValue') {
|
||||
item.options = this.dictList[ProductTypeDictTypeId]
|
||||
} else if (item.name === 'unitDictValue') {
|
||||
item.options = this.dictList[UnitDictTypeId]
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
activated() {
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
//
|
||||
addOrEdit(id) {
|
||||
this.showbasedialog = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.basedialog.init(id)
|
||||
})
|
||||
},
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
// console.log("after dialog close: ", this.showbasedialog)
|
||||
this.showbasedialog = false // 清理弹窗
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/product/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
page: this.pageIndex,
|
||||
limit: this.pageSize,
|
||||
key: this.dataForm.key
|
||||
})
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataList = data.data.list
|
||||
this.totalPage = data.data.total
|
||||
} else {
|
||||
this.dataList = []
|
||||
this.totalPage = 0
|
||||
}
|
||||
this.dataListLoading = false
|
||||
})
|
||||
},
|
||||
// 每页数
|
||||
sizeChangeHandle(val) {
|
||||
this.pageSize = val
|
||||
this.pageIndex = 1
|
||||
this.getDataList()
|
||||
},
|
||||
// 当前页
|
||||
currentChangeHandle(val) {
|
||||
this.pageIndex = val
|
||||
this.getDataList()
|
||||
},
|
||||
// 多选
|
||||
selectionChangeHandle(val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
},
|
||||
// 表格操作事件管理
|
||||
handleOperations({ type, data }) {
|
||||
switch (type) {
|
||||
case 'viewAttr': // <== 对照 tableConfig
|
||||
return this.addOrEdit(data)
|
||||
case 'delete':
|
||||
return this.deleteHandle(data)
|
||||
}
|
||||
},
|
||||
// 删除
|
||||
deleteHandle(id) {
|
||||
console.log('id is: ', id)
|
||||
var ids = id
|
||||
? [id]
|
||||
: // ? [1556817256347828335]
|
||||
this.dataListSelections.map(item => {
|
||||
return item.id
|
||||
})
|
||||
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/product'),
|
||||
method: 'delete',
|
||||
data: ids
|
||||
// or : data: this.$http.adornData(ids, false, 'raw')
|
||||
})
|
||||
// or: this.$http.delete(this.$http.adornUrl('/monitoring/product'), { data: this.$http.adornData(ids, false) })
|
||||
.then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getDataList()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
184
src/views/modules/monitoring/productArrt-add-or-update.vue
Normal file
184
src/views/modules/monitoring/productArrt-add-or-update.vue
Normal file
@@ -0,0 +1,184 @@
|
||||
<template>
|
||||
<el-dialog :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-item label="编码" prop="code">
|
||||
<el-input v-model="dataForm.code" placeholder="编码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="dataForm.name" placeholder="名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="产品id,关联产品表" prop="productId">
|
||||
<el-input v-model="dataForm.productId" placeholder="产品id,关联产品表"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="属性值" prop="value">
|
||||
<el-input v-model="dataForm.value" placeholder="属性值"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="描述" prop="description">
|
||||
<el-input v-model="dataForm.description" placeholder="描述"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="外部编码,用于对照外部系统的编码" prop="externalCode">
|
||||
<el-input v-model="dataForm.externalCode" placeholder="外部编码,用于对照外部系统的编码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="启用状态:0 、停用,1、启用" prop="enabled">
|
||||
<el-input v-model="dataForm.enabled" placeholder="启用状态:0 、停用,1、启用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="dataForm.remark" placeholder="备注"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="删除标志,是否有效:1 可用 0不可用" prop="valid">
|
||||
<el-input v-model="dataForm.valid" placeholder="删除标志,是否有效:1 可用 0不可用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人" prop="creatorId">
|
||||
<el-input v-model="dataForm.creatorId" placeholder="创建人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人姓名" prop="creatorName">
|
||||
<el-input v-model="dataForm.creatorName" placeholder="创建人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-input v-model="dataForm.createTime" placeholder="创建时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人" prop="updaterId">
|
||||
<el-input v-model="dataForm.updaterId" placeholder="更新人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人姓名" prop="updaterName">
|
||||
<el-input v-model="dataForm.updaterName" placeholder="更新人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新时间" prop="updateTime">
|
||||
<el-input v-model="dataForm.updateTime" placeholder="更新时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="版本号" prop="version">
|
||||
<el-input v-model="dataForm.version" placeholder="版本号"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
code: '',
|
||||
name: '',
|
||||
productId: '',
|
||||
value: '',
|
||||
description: '',
|
||||
externalCode: '',
|
||||
enabled: '',
|
||||
remark: '',
|
||||
valid: '',
|
||||
creatorId: '',
|
||||
creatorName: '',
|
||||
createTime: '',
|
||||
updaterId: '',
|
||||
updaterName: '',
|
||||
updateTime: '',
|
||||
version: ''
|
||||
},
|
||||
dataRule: {
|
||||
code: [{ required: true, message: '编码不能为空', trigger: 'blur' }],
|
||||
name: [{ required: true, message: '名称不能为空', trigger: 'blur' }],
|
||||
productId: [{ required: true, message: '产品id,关联产品表不能为空', trigger: 'blur' }],
|
||||
value: [{ required: true, message: '属性值不能为空', trigger: 'blur' }],
|
||||
description: [{ required: true, message: '描述不能为空', trigger: 'blur' }],
|
||||
externalCode: [{ required: true, message: '外部编码,用于对照外部系统的编码不能为空', trigger: 'blur' }],
|
||||
enabled: [{ required: true, message: '启用状态:0 、停用,1、启用不能为空', 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: {
|
||||
init(id) {
|
||||
this.dataForm.id = id || 0
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/productArrt/${this.dataForm.id}`),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams()
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataForm.code = data.producarrt.code
|
||||
this.dataForm.name = data.producarrt.name
|
||||
this.dataForm.productId = data.producarrt.productId
|
||||
this.dataForm.value = data.producarrt.value
|
||||
this.dataForm.description = data.producarrt.description
|
||||
this.dataForm.externalCode = data.producarrt.externalCode
|
||||
this.dataForm.enabled = data.producarrt.enabled
|
||||
this.dataForm.remark = data.producarrt.remark
|
||||
this.dataForm.valid = data.producarrt.valid
|
||||
this.dataForm.creatorId = data.producarrt.creatorId
|
||||
this.dataForm.creatorName = data.producarrt.creatorName
|
||||
this.dataForm.createTime = data.producarrt.createTime
|
||||
this.dataForm.updaterId = data.producarrt.updaterId
|
||||
this.dataForm.updaterName = data.producarrt.updaterName
|
||||
this.dataForm.updateTime = data.producarrt.updateTime
|
||||
this.dataForm.version = data.producarrt.version
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate(valid => {
|
||||
if (valid) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/productArrt/${!this.dataForm.id ? '' : this.dataForm.id}`),
|
||||
method: this.dataForm.id ? 'put' : 'post',
|
||||
data: this.$http.adornData({
|
||||
id: this.dataForm.id || undefined,
|
||||
code: this.dataForm.code,
|
||||
name: this.dataForm.name,
|
||||
productId: this.dataForm.productId,
|
||||
value: this.dataForm.value,
|
||||
description: this.dataForm.description,
|
||||
externalCode: this.dataForm.externalCode,
|
||||
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>
|
||||
243
src/views/modules/monitoring/productArrt.vue
Normal file
243
src/views/modules/monitoring/productArrt.vue
Normal file
@@ -0,0 +1,243 @@
|
||||
<template>
|
||||
<div class="mod-config">
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<el-form-item>
|
||||
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<el-button v-if="$hasPermission('monitoring:productarrt:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- <el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" style="width: 100%;">
|
||||
<el-table-column type="selection" header-align="center" align="center" width="50"> </el-table-column>
|
||||
<el-table-column 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="productId" header-align="center" align="center" label="产品id,关联产品表"> </el-table-column>
|
||||
<el-table-column prop="value" 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="externalCode" 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 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> -->
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" @operate-event="handleOperations" @refreshDataList="getDataList" />
|
||||
<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" :configs="addOrUpdateConfigs" ref="addOrUpdate" @refreshDataList="getDataList" @destroy-dialog="addOrUpdateVisible = false" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// import AddOrUpdate from './productArrt-add-or-update'
|
||||
import AddOrUpdate from '@/components/base-dialog/addOrUpdate'
|
||||
import BaseTable from '@/components/base-table'
|
||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
||||
// import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
|
||||
const tableConfigs = [
|
||||
{ prop: 'createTime', name: '添加时间' },
|
||||
{ prop: 'name', name: '属性名称' },
|
||||
{ prop: 'code', name: '属性编码' },
|
||||
{ prop: 'productId', name: '产品id' },
|
||||
{ prop: 'value', name: '属性值' },
|
||||
{ prop: 'description', name: '描述' },
|
||||
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
|
||||
const addOrUpdateConfigs = {
|
||||
type: 'dialog',
|
||||
infoUrl: '/monitoring/productArrt',
|
||||
fields: [
|
||||
{
|
||||
name: 'name',
|
||||
label: '属性名称',
|
||||
placeholder: '请输入属性名称'
|
||||
},
|
||||
{
|
||||
name: 'code',
|
||||
label: '属性编码',
|
||||
placeholder: '请输入属性编码'
|
||||
},
|
||||
{
|
||||
name: 'productId',
|
||||
label: '关联产品',
|
||||
type: 'select',
|
||||
options: []
|
||||
},
|
||||
{
|
||||
name: 'value',
|
||||
label: '属性值',
|
||||
placeholder: '请输入属性值'
|
||||
},
|
||||
{
|
||||
name: 'description',
|
||||
label: '描述',
|
||||
placeholder: '请输入描述'
|
||||
}
|
||||
],
|
||||
operations: [
|
||||
{ name: 'cancel', showAlways: true },
|
||||
{ name: 'save', url: '/monitoring/productArrt', permission: '', showOnEdit: false },
|
||||
{ name: 'update', url: '/monitoring/productArrt', permission: '', showOnEdit: true }
|
||||
]
|
||||
}
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
addOrUpdateConfigs,
|
||||
tableConfigs,
|
||||
dataForm: {
|
||||
key: ''
|
||||
},
|
||||
dataList: [],
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
dataListLoading: false,
|
||||
dataListSelections: [],
|
||||
addOrUpdateVisible: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate,
|
||||
BaseTable
|
||||
},
|
||||
activated() {
|
||||
this.getProductList()
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
// 获取产品列表
|
||||
getProductList() {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/product/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
limit: 999,
|
||||
page: 1
|
||||
})
|
||||
}).then(({ data: res }) => {
|
||||
if (res && res.code === 0) {
|
||||
this.addOrUpdateConfigs.fields.forEach(item => {
|
||||
if (item.name === 'productId') item.options = res.data.list.map(item => ({ label: item.name, value: item.id }))
|
||||
})
|
||||
} else {
|
||||
this.addOrUpdateConfigs.fields.forEach(item => {
|
||||
if (item.name === 'productId') item.options.splice(0)
|
||||
})
|
||||
// this.plList.splice(0)
|
||||
}
|
||||
})
|
||||
},
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/productArrt/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
page: this.pageIndex,
|
||||
limit: this.pageSize,
|
||||
key: this.dataForm.key
|
||||
})
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataList = data.data.list
|
||||
this.totalPage = data.data.total
|
||||
} else {
|
||||
this.dataList = []
|
||||
this.totalPage = 0
|
||||
}
|
||||
this.dataListLoading = false
|
||||
})
|
||||
},
|
||||
// 每页数
|
||||
sizeChangeHandle(val) {
|
||||
this.pageSize = val
|
||||
this.pageIndex = 1
|
||||
this.getDataList()
|
||||
},
|
||||
// 当前页
|
||||
currentChangeHandle(val) {
|
||||
this.pageIndex = val
|
||||
this.getDataList()
|
||||
},
|
||||
// 多选
|
||||
selectionChangeHandle(val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
handleOperations({ type, data: id }) {
|
||||
switch (type) {
|
||||
case 'edit':
|
||||
return this.addOrUpdateHandle(id)
|
||||
case 'delete':
|
||||
return this.deleteHandle(id)
|
||||
}
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
},
|
||||
// 删除
|
||||
deleteHandle(id) {
|
||||
var ids = id
|
||||
? [id]
|
||||
: this.dataListSelections.map(item => {
|
||||
return item.id
|
||||
})
|
||||
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/productArrt'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getDataList()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
233
src/views/modules/monitoring/productionLine.vue
Normal file
233
src/views/modules/monitoring/productionLine.vue
Normal file
@@ -0,0 +1,233 @@
|
||||
<template>
|
||||
<div class="mod-config">
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<el-form-item>
|
||||
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<el-button v-if="$hasPermission('monitoring:productionline:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- <el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" style="width: 100%;">
|
||||
<el-table-column type="selection" header-align="center" align="center" width="50"> </el-table-column>
|
||||
<el-table-column prop="id" header-align="center" align="center" label="id"> </el-table-column>
|
||||
<el-table-column prop="factoryId" 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="description" header-align="center" align="center" label="描述"> </el-table-column>
|
||||
<el-table-column prop="status" header-align="center" align="center" label="产线状态"> </el-table-column>
|
||||
<el-table-column prop="tvalue" 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="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 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> -->
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" @operate-event="handleOperations" @refreshDataList="getDataList" />
|
||||
<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" :configs="addOrUpdateConfigs" @refreshDataList="getDataList" @destory-dialog="addOrUpdateVisible = false" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from '@/components/base-dialog/addOrUpdate'
|
||||
import BaseTable from '@/components/base-table'
|
||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
||||
// import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
|
||||
const tableConfigs = [
|
||||
{ prop: 'createTime', name: '添加时间' },
|
||||
{ prop: 'factoryName', name: '工厂' },
|
||||
{ prop: 'name', name: '产线名称' },
|
||||
{ prop: 'code', name: '产线编码' },
|
||||
{ prop: 'status', name: '产线状态' },
|
||||
{ prop: 'description', name: '描述' },
|
||||
{ prop: 'remark', name: '备注' },
|
||||
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
|
||||
const addOrUpdateConfigs = {
|
||||
type: 'dialog',
|
||||
infoUrl: '/monitoring/productionLine',
|
||||
fields: [
|
||||
'name',
|
||||
{ name: 'code', api: '/monitoring/productionLine/getCode' },
|
||||
{
|
||||
name: 'factoryId',
|
||||
label: '工厂',
|
||||
type: 'select',
|
||||
placeholder: '请选择所属工厂',
|
||||
options: []
|
||||
},
|
||||
{
|
||||
name: 'tvalue',
|
||||
label: '产线TT值(每小时下片数量)',
|
||||
placeholder: '请输入合理数值',
|
||||
type: 'number', // TODO: 可改进为自动应用 number 验证,此时还必须添加下述规则:
|
||||
required: true,
|
||||
rules: [{ type: 'number', transform: val => Number(val), trigger: 'blur', message: '请输入数字类型' }]
|
||||
},
|
||||
'description',
|
||||
'remark'
|
||||
],
|
||||
operations: [
|
||||
{ name: 'cancel', url: true, showAlways: true },
|
||||
{ name: 'save', url: '/monitoring/productionLine', permission: '', showOnEdit: false },
|
||||
{ name: 'update', url: '/monitoring/productionLine', permission: '', showOnEdit: true }
|
||||
]
|
||||
}
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
addOrUpdateConfigs,
|
||||
tableConfigs,
|
||||
dataForm: {
|
||||
key: ''
|
||||
},
|
||||
dataList: [],
|
||||
factoryList: [],
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
dataListLoading: false,
|
||||
dataListSelections: [],
|
||||
addOrUpdateVisible: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate,
|
||||
BaseTable
|
||||
},
|
||||
activated() {
|
||||
this.getFactoryList()
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
// 获取工厂列表
|
||||
getFactoryList() {
|
||||
this.$http.get(this.$http.adornUrl('/monitoring/factory/list')).then(({ data: res }) => {
|
||||
if (res && res.code === 0) {
|
||||
this.factoryList = res.data
|
||||
} else {
|
||||
this.factoryList.splice(0)
|
||||
}
|
||||
this.addOrUpdateConfigs.fields.forEach(item => {
|
||||
if (item.name === 'factoryId') {
|
||||
console.log('res', item)
|
||||
item.options = this.factoryList.map(f => ({ value: f.id, label: f.name }))
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.addOrUpdateVisible = false
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/productionLine/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
page: this.pageIndex,
|
||||
limit: this.pageSize,
|
||||
key: this.dataForm.key
|
||||
})
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataList = data.data.list
|
||||
this.totalPage = data.data.total
|
||||
} else {
|
||||
this.dataList = []
|
||||
this.totalPage = 0
|
||||
}
|
||||
this.dataListLoading = false
|
||||
})
|
||||
},
|
||||
// 每页数
|
||||
sizeChangeHandle(val) {
|
||||
this.pageSize = val
|
||||
this.pageIndex = 1
|
||||
this.getDataList()
|
||||
},
|
||||
// 当前页
|
||||
currentChangeHandle(val) {
|
||||
this.pageIndex = val
|
||||
this.getDataList()
|
||||
},
|
||||
// 多选
|
||||
selectionChangeHandle(val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
handleOperations({ type, data: id }) {
|
||||
switch (type) {
|
||||
case 'edit':
|
||||
return this.addOrUpdateHandle(id)
|
||||
case 'delete':
|
||||
return this.deleteHandle(id)
|
||||
}
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
},
|
||||
// 删除
|
||||
deleteHandle(id) {
|
||||
var ids = id
|
||||
? [id]
|
||||
: this.dataListSelections.map(item => {
|
||||
return item.id
|
||||
})
|
||||
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/productionLine'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getDataList()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
165
src/views/modules/monitoring/productionLineRecSch.vue
Normal file
165
src/views/modules/monitoring/productionLineRecSch.vue
Normal file
@@ -0,0 +1,165 @@
|
||||
<template>
|
||||
<div class="mod-config">
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<el-form-item>
|
||||
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<el-button v-if="$hasPermission('monitoring:productionlinerecsch:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- <el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" style="width: 100%;">
|
||||
<el-table-column type="selection" header-align="center" align="center" width="50"> </el-table-column>
|
||||
<el-table-column prop="id" header-align="center" align="center" label="ID"> </el-table-column>
|
||||
<el-table-column prop="productionLineId" header-align="center" align="center" label="产线id"> </el-table-column>
|
||||
<el-table-column prop="inputNum" header-align="center" align="center" label="上一次记录时间至该条记录时间端内上片数量"> </el-table-column>
|
||||
<el-table-column prop="outputNum" header-align="center" align="center" label="上一次记录时间至该条记录时间端内下片数量"> </el-table-column>
|
||||
<el-table-column prop="recordTime" 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="sumInputNum" header-align="center" align="center" label="该记录时间点的累计上片数量"> </el-table-column>
|
||||
<el-table-column prop="sumOutputNum" 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> -->
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" />
|
||||
<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>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from './productionLineRecSch-add-or-update'
|
||||
import BaseTable from '@/components/base-table'
|
||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
||||
import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
|
||||
const tableConfigs = [
|
||||
{ prop: 'id', name: 'ID' },
|
||||
{ prop: 'productionLineId', name: '产线id' },
|
||||
{ prop: 'inputNum', name: '上一次记录时间至该条记录时间端内上片数量' },
|
||||
{ prop: 'outputNum', name: '上一次记录时间至该条记录时间端内下片数量' },
|
||||
{ prop: 'recordTime', name: '记录时间' },
|
||||
{ prop: 'valid', name: '删除标志,是否有效:1 可用 0不可用' },
|
||||
{ prop: 'sumInputNum', name: '该记录时间点的累计上片数量' },
|
||||
{ prop: 'sumOutputNum', name: '该记录时间点的累计下片数量' },
|
||||
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
tableConfigs,
|
||||
dataForm: {
|
||||
key: ''
|
||||
},
|
||||
dataList: [],
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
dataListLoading: false,
|
||||
dataListSelections: [],
|
||||
addOrUpdateVisible: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate,
|
||||
BaseTable
|
||||
},
|
||||
activated() {
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/productionLineRecSch/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
page: this.pageIndex,
|
||||
limit: this.pageSize,
|
||||
key: this.dataForm.key
|
||||
})
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataList = data.data.list
|
||||
this.totalPage = data.data.total
|
||||
} else {
|
||||
this.dataList = []
|
||||
this.totalPage = 0
|
||||
}
|
||||
this.dataListLoading = false
|
||||
})
|
||||
},
|
||||
// 每页数
|
||||
sizeChangeHandle(val) {
|
||||
this.pageSize = val
|
||||
this.pageIndex = 1
|
||||
this.getDataList()
|
||||
},
|
||||
// 当前页
|
||||
currentChangeHandle(val) {
|
||||
this.pageIndex = val
|
||||
this.getDataList()
|
||||
},
|
||||
// 多选
|
||||
selectionChangeHandle(val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
},
|
||||
// 删除
|
||||
deleteHandle(id) {
|
||||
var ids = id
|
||||
? [id]
|
||||
: this.dataListSelections.map(item => {
|
||||
return item.id
|
||||
})
|
||||
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/productionLineRecSch'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getDataList()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
191
src/views/modules/monitoring/productionline-add-or-update.vue
Normal file
191
src/views/modules/monitoring/productionline-add-or-update.vue
Normal file
@@ -0,0 +1,191 @@
|
||||
<template>
|
||||
<el-dialog :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-item label="工厂表ID" prop="factoryId">
|
||||
<el-input v-model="dataForm.factoryId" placeholder="工厂表ID"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="编码" prop="code">
|
||||
<el-input v-model="dataForm.code" placeholder="编码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="dataForm.name" placeholder="名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="描述" prop="description">
|
||||
<el-input v-model="dataForm.description" placeholder="描述"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="产线状态" prop="status">
|
||||
<el-input v-model="dataForm.status" placeholder="产线状态"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="每小时下片数量" prop="tvalue">
|
||||
<el-input v-model="dataForm.tvalue" placeholder="每小时下片数量"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="外部系统编码" prop="externalCode">
|
||||
<el-input v-model="dataForm.externalCode" placeholder="外部系统编码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="启用状态:0 、停用,1、启用" prop="enabled">
|
||||
<el-input v-model="dataForm.enabled" placeholder="启用状态:0 、停用,1、启用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="dataForm.remark" placeholder="备注"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="删除标志,是否有效:1 可用 0不可用" prop="valid">
|
||||
<el-input v-model="dataForm.valid" placeholder="删除标志,是否有效:1 可用 0不可用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人" prop="creatorId">
|
||||
<el-input v-model="dataForm.creatorId" placeholder="创建人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人姓名" prop="creatorName">
|
||||
<el-input v-model="dataForm.creatorName" placeholder="创建人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-input v-model="dataForm.createTime" placeholder="创建时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人" prop="updaterId">
|
||||
<el-input v-model="dataForm.updaterId" placeholder="更新人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人姓名" prop="updaterName">
|
||||
<el-input v-model="dataForm.updaterName" placeholder="更新人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新时间" prop="updateTime">
|
||||
<el-input v-model="dataForm.updateTime" placeholder="更新时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="版本号" prop="version">
|
||||
<el-input v-model="dataForm.version" placeholder="版本号"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
factoryId: '',
|
||||
code: '',
|
||||
name: '',
|
||||
description: '',
|
||||
status: '',
|
||||
tvalue: '',
|
||||
externalCode: '',
|
||||
enabled: '',
|
||||
remark: '',
|
||||
valid: '',
|
||||
creatorId: '',
|
||||
creatorName: '',
|
||||
createTime: '',
|
||||
updaterId: '',
|
||||
updaterName: '',
|
||||
updateTime: '',
|
||||
version: ''
|
||||
},
|
||||
dataRule: {
|
||||
factoryId: [{ required: true, message: '工厂表ID不能为空', trigger: 'blur' }],
|
||||
code: [{ required: true, message: '编码不能为空', trigger: 'blur' }],
|
||||
name: [{ required: true, message: '名称不能为空', trigger: 'blur' }],
|
||||
description: [{ required: true, message: '描述不能为空', trigger: 'blur' }],
|
||||
status: [{ required: true, message: '产线状态不能为空', trigger: 'blur' }],
|
||||
tvalue: [{ required: true, message: '每小时下片数量不能为空', trigger: 'blur' }],
|
||||
externalCode: [{ required: true, message: '外部系统编码不能为空', trigger: 'blur' }],
|
||||
enabled: [{ required: true, message: '启用状态:0 、停用,1、启用不能为空', 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: {
|
||||
init(id) {
|
||||
this.dataForm.id = id || 0
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/productionLine/${this.dataForm.id}`),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams()
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataForm.factoryId = data.productionLine.factoryId
|
||||
this.dataForm.code = data.productionLine.code
|
||||
this.dataForm.name = data.productionLine.name
|
||||
this.dataForm.description = data.productionLine.description
|
||||
this.dataForm.status = data.productionLine.status
|
||||
this.dataForm.tvalue = data.productionLine.tvalue
|
||||
this.dataForm.externalCode = data.productionLine.externalCode
|
||||
this.dataForm.enabled = data.productionLine.enabled
|
||||
this.dataForm.remark = data.productionLine.remark
|
||||
this.dataForm.valid = data.productionLine.valid
|
||||
this.dataForm.creatorId = data.productionLine.creatorId
|
||||
this.dataForm.creatorName = data.productionLine.creatorName
|
||||
this.dataForm.createTime = data.productionLine.createTime
|
||||
this.dataForm.updaterId = data.productionLine.updaterId
|
||||
this.dataForm.updaterName = data.productionLine.updaterName
|
||||
this.dataForm.updateTime = data.productionLine.updateTime
|
||||
this.dataForm.version = data.productionLine.version
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate(valid => {
|
||||
if (valid) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/productionLine/${!this.dataForm.id ? '' : this.dataForm.id}`),
|
||||
method: this.dataForm.id ? 'put' : 'post',
|
||||
data: this.$http.adornData({
|
||||
id: this.dataForm.id || undefined,
|
||||
factoryId: this.dataForm.factoryId,
|
||||
code: this.dataForm.code,
|
||||
name: this.dataForm.name,
|
||||
description: this.dataForm.description,
|
||||
status: this.dataForm.status,
|
||||
tvalue: this.dataForm.tvalue,
|
||||
externalCode: this.dataForm.externalCode,
|
||||
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>
|
||||
@@ -0,0 +1,121 @@
|
||||
<template>
|
||||
<el-dialog :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-item label="产线id" prop="productionLineId">
|
||||
<el-input v-model="dataForm.productionLineId" placeholder="产线id"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="上一次记录时间至该条记录时间端内上片数量" prop="inputNum">
|
||||
<el-input v-model="dataForm.inputNum" placeholder="上一次记录时间至该条记录时间端内上片数量"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="上一次记录时间至该条记录时间端内下片数量" prop="outputNum">
|
||||
<el-input v-model="dataForm.outputNum" placeholder="上一次记录时间至该条记录时间端内下片数量"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="记录时间" prop="recordTime">
|
||||
<el-input v-model="dataForm.recordTime" placeholder="记录时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="删除标志,是否有效:1 可用 0不可用" prop="valid">
|
||||
<el-input v-model="dataForm.valid" placeholder="删除标志,是否有效:1 可用 0不可用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="该记录时间点的累计上片数量" prop="sumInputNum">
|
||||
<el-input v-model="dataForm.sumInputNum" placeholder="该记录时间点的累计上片数量"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="该记录时间点的累计下片数量" prop="sumOutputNum">
|
||||
<el-input v-model="dataForm.sumOutputNum" placeholder="该记录时间点的累计下片数量"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
productionLineId: '',
|
||||
inputNum: '',
|
||||
outputNum: '',
|
||||
recordTime: '',
|
||||
valid: '',
|
||||
sumInputNum: '',
|
||||
sumOutputNum: ''
|
||||
},
|
||||
dataRule: {
|
||||
productionLineId: [{ required: true, message: '产线id不能为空', trigger: 'blur' }],
|
||||
inputNum: [{ required: true, message: '上一次记录时间至该条记录时间端内上片数量不能为空', trigger: 'blur' }],
|
||||
outputNum: [{ required: true, message: '上一次记录时间至该条记录时间端内下片数量不能为空', trigger: 'blur' }],
|
||||
recordTime: [{ required: true, message: '记录时间不能为空', trigger: 'blur' }],
|
||||
valid: [{ required: true, message: '删除标志,是否有效:1 可用 0不可用不能为空', trigger: 'blur' }],
|
||||
sumInputNum: [{ required: true, message: '该记录时间点的累计上片数量不能为空', trigger: 'blur' }],
|
||||
sumOutputNum: [{ required: true, message: '该记录时间点的累计下片数量不能为空', trigger: 'blur' }]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init(id) {
|
||||
this.dataForm.id = id || 0
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/productionLineRecSch/${this.dataForm.id}`),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams()
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataForm.productionLineId = data.productionLineRecSch.productionLineId
|
||||
this.dataForm.inputNum = data.productionLineRecSch.inputNum
|
||||
this.dataForm.outputNum = data.productionLineRecSch.outputNum
|
||||
this.dataForm.recordTime = data.productionLineRecSch.recordTime
|
||||
this.dataForm.valid = data.productionLineRecSch.valid
|
||||
this.dataForm.sumInputNum = data.productionLineRecSch.sumInputNum
|
||||
this.dataForm.sumOutputNum = data.productionLineRecSch.sumOutputNum
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate(valid => {
|
||||
if (valid) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/productionLineRecSch/${!this.dataForm.id ? '' : this.dataForm.id}`),
|
||||
method: this.dataForm.id ? 'put' : 'post',
|
||||
data: this.$http.adornData({
|
||||
id: this.dataForm.id || undefined,
|
||||
productionLineId: this.dataForm.productionLineId,
|
||||
inputNum: this.dataForm.inputNum,
|
||||
outputNum: this.dataForm.outputNum,
|
||||
recordTime: this.dataForm.recordTime,
|
||||
valid: this.dataForm.valid,
|
||||
sumInputNum: this.dataForm.sumInputNum,
|
||||
sumOutputNum: this.dataForm.sumOutputNum
|
||||
})
|
||||
}).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>
|
||||
369
src/views/modules/monitoring/qualityInspectionCurrent.vue
Normal file
369
src/views/modules/monitoring/qualityInspectionCurrent.vue
Normal file
@@ -0,0 +1,369 @@
|
||||
<template>
|
||||
<div class="mod-config">
|
||||
<el-form :inline="true" @keyup.enter.native="getDataList()">
|
||||
<el-form-item>
|
||||
<!-- type="datetimerange" -->
|
||||
<el-date-picker
|
||||
type="daterange"
|
||||
v-model="datetime"
|
||||
value-format="yyyy-MM-ddTHH:mm:ss"
|
||||
start-placeholder="开始时间"
|
||||
end-placeholder="结束时间"
|
||||
range-separator="至"
|
||||
:default-time="['00:00:00', '23:59:59']"
|
||||
:picker-options="quickOptions"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<!-- <el-button v-if="$hasPermission('monitoring:qualityinspectionrecord:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button> -->
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<div class="quality-inspection-current base-container">
|
||||
<el-row>
|
||||
<el-col>
|
||||
<small-title :size="'md'">上下片及检测总数统计</small-title>
|
||||
<el-row style="margin-top: 12px;">
|
||||
<base-table :data="dataListStatic" :table-head-configs="tableConfigStatic" :max-height="500" @operate-event="handleOperations" @refreshDataList="getDataList" />
|
||||
</el-row>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row style="margin-top: 28px;">
|
||||
<el-col>
|
||||
<el-row>
|
||||
<small-title :size="'md'">各产线检测类型统计</small-title>
|
||||
</el-row>
|
||||
<el-row style="margin-top: 8px;">
|
||||
<el-radio-group v-model="dataType" size="medium" @change="handleDataTypeChange">
|
||||
<el-radio-button label="表格"></el-radio-button>
|
||||
<el-radio-button label="图形"></el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-row>
|
||||
<el-row style="margin-top: 12px;">
|
||||
<base-table
|
||||
v-if="!showGraph"
|
||||
:data="dataListDynamic"
|
||||
:table-head-configs="tableConfigDynamic"
|
||||
:max-height="500"
|
||||
@operate-event="handleOperations"
|
||||
@refreshDataList="getDataList"
|
||||
/>
|
||||
<fake-chart v-else :categories="echartCategories" :type-list="echartCheckTypes" :series-data="echartsData" />
|
||||
</el-row>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import moment from 'moment'
|
||||
import BaseTable from '@/components/base-table'
|
||||
import SmallTitle from '@/components/small-title'
|
||||
import * as echarts from 'echarts'
|
||||
|
||||
const tableConfigStatic = [
|
||||
{ type: 'index', name: '序号' },
|
||||
{ name: '上片总数', prop: 'sumUp' },
|
||||
{ name: '下片总数', prop: 'sumDown' },
|
||||
{ name: '检测总数', prop: 'sumCheck' },
|
||||
{ name: '比例', prop: 'scrapRatio', filter: val => (val || val === 0 ? `${val}%` : '-') }
|
||||
]
|
||||
const tableConfigDynamic = [
|
||||
{ type: 'index', name: '序号' },
|
||||
{ name: '检测类型', prop: 'inspectionContent' },
|
||||
/** dynamic */
|
||||
{ name: '检测类型总数', prop: '' },
|
||||
{ name: '比例', prop: '' }
|
||||
]
|
||||
|
||||
const FakeChart = {
|
||||
name: 'FakeChart',
|
||||
props: {
|
||||
categories: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
typeList: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
seriesData: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
chart: null,
|
||||
defaultOpts: {
|
||||
title: {
|
||||
text: '检测类型统计数据'
|
||||
},
|
||||
tooltip: {},
|
||||
legend: {
|
||||
orient: 'vertical',
|
||||
top: 10,
|
||||
right: 20,
|
||||
data: [
|
||||
/** dynamic */
|
||||
]
|
||||
},
|
||||
xAxis: {
|
||||
data: [
|
||||
/** dynamic */
|
||||
]
|
||||
},
|
||||
yAxis: {},
|
||||
series: [
|
||||
// dynamic
|
||||
// {
|
||||
// name: '销售',
|
||||
// type: 'bar',
|
||||
// data: [23, 42, 12, 4, 3]
|
||||
// }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
categories: {
|
||||
handler: function(val, oldVal) {
|
||||
if (val && val !== oldVal) {
|
||||
this.defaultOpts.xAxis.data.push(...val)
|
||||
}
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
typeList: {
|
||||
handler: function(val, oldVal) {
|
||||
if (val && val !== oldVal) {
|
||||
this.defaultOpts.legend.data.push(...val)
|
||||
}
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
seriesData: {
|
||||
handler: function(val, oldVal) {
|
||||
if (val && val !== oldVal) {
|
||||
this.defaultOpts.series.push(...val)
|
||||
}
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
defaultOpts: {
|
||||
handler: function(val) {
|
||||
console.log('defaullt opts change: ', val)
|
||||
this.setOptions()
|
||||
},
|
||||
immediate: true,
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$nextTick(() => {
|
||||
this.initChart()
|
||||
this.setOptions()
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
initChart() {
|
||||
if (!this.chart) {
|
||||
this.chart = echarts.init(document.getElementById('bar-chart'))
|
||||
}
|
||||
},
|
||||
setOptions(opts) {
|
||||
/** prop options */
|
||||
if (opts) {
|
||||
}
|
||||
|
||||
if (this.chart) this.chart.setOption(this.defaultOpts)
|
||||
}
|
||||
},
|
||||
render: function(h) {
|
||||
return h('div', { attrs: { id: 'bar-chart' }, style: { background: '#eee', width: '100%', height: '300px', padding: '8px' } }, '')
|
||||
}
|
||||
}
|
||||
|
||||
const dict = ['表格', '图形']
|
||||
export default {
|
||||
name: 'QualityInspectionCurrent',
|
||||
components: { BaseTable, SmallTitle, FakeChart },
|
||||
data() {
|
||||
return {
|
||||
tableConfigStatic,
|
||||
tableConfigDynamic,
|
||||
dataListStatic: [],
|
||||
dataListDynamic: [],
|
||||
dict,
|
||||
dataType: dict[0], // 表格 | 图形
|
||||
showGraph: false,
|
||||
datetime: [],
|
||||
quickOptions: {
|
||||
shortcuts: [
|
||||
{
|
||||
text: '今天',
|
||||
onClick(picker) {
|
||||
const baseTime = moment().set({ hour: 0, minute: 0, second: 0, millisecond: 0 })
|
||||
const startTime = baseTime.format('yyyy-MM-DDTHH:mm:ss')
|
||||
const endTime = baseTime.set({ hour: 23, minute: 59, second: 59, millisecond: 999 }).format('yyyy-MM-DDTHH:mm:ss')
|
||||
picker.$emit('pick', [startTime, endTime])
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
echartCategories: null,
|
||||
echartCheckTypes: []
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
handleOperations() {},
|
||||
handleDataTypeChange(value) {
|
||||
this.showGraph = value === dict[0] ? false : true
|
||||
},
|
||||
getDataList() {
|
||||
this.showGraph = false
|
||||
this.dataType = '表格'
|
||||
this.echartCategories = null
|
||||
this.echartCheckTypes.splice(0)
|
||||
/** 设置默认日期 */
|
||||
const startTime =
|
||||
this.datetime[0] ||
|
||||
moment()
|
||||
.set({ hour: 0, minute: 0, second: 0 })
|
||||
.format('yyyy-MM-DDTHH:mm:ss')
|
||||
const endTime =
|
||||
this.datetime[1] ||
|
||||
moment()
|
||||
.set({ hour: 23, minute: 59, second: 59 })
|
||||
.format('yyyy-MM-DDTHH:mm:ss')
|
||||
|
||||
/** [1] 获取上下片数据 */
|
||||
this.fetchList('sx', startTime, endTime).then(({ data: res }) => {
|
||||
console.log('sx: ', res)
|
||||
this.dataListStatic = res.data || []
|
||||
})
|
||||
/** [2] 获取产线检测类型 */
|
||||
this.fetchList('pl', startTime, endTime).then(({ data: res }) => {
|
||||
console.log('pl: ', res)
|
||||
/** TODO: 解析 nameData */
|
||||
this.parseTableProps(res.data.nameData)
|
||||
|
||||
this.dataListDynamic = this.parseDynamicData(res.data.data) || []
|
||||
|
||||
this.buildGraphData()
|
||||
})
|
||||
},
|
||||
|
||||
parseTableProps(nameData) {
|
||||
const subProps = []
|
||||
const labelNameMap = new Map()
|
||||
|
||||
if (nameData.length) {
|
||||
/** 处理 nameData */
|
||||
nameData.forEach(item => {
|
||||
if (!labelNameMap.get(item.name)) {
|
||||
labelNameMap.set(item.name, 1)
|
||||
subProps.push({ name: item.name, prop: item.name })
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
this.tableConfigDynamic = [
|
||||
{ type: 'index', name: '序号' },
|
||||
{ name: '检测类型', prop: 'inspectionContent' },
|
||||
...subProps,
|
||||
{ name: '检测类型总数', prop: 'sumInput' },
|
||||
{ name: '比例', prop: 'scrapRatio', filter: val => (val || val === 0 ? `${val}%` : '-') }
|
||||
]
|
||||
|
||||
/** echarts related */
|
||||
this.echartCategories = subProps.map(item => item.name)
|
||||
},
|
||||
|
||||
parseDynamicData(data) {
|
||||
this.echartCheckTypes.splice(0)
|
||||
return data.map(item => {
|
||||
/** echarts related */
|
||||
this.echartCheckTypes.push(item.inspectionContent)
|
||||
if (item.data.length) {
|
||||
/** 解析子数组 */
|
||||
item.data.forEach(subitem => {
|
||||
item[subitem.dynamicName] = subitem.dynamicValue
|
||||
})
|
||||
}
|
||||
return item
|
||||
})
|
||||
},
|
||||
|
||||
buildGraphData() {
|
||||
/** 构造 echart 需要的数据 */
|
||||
const result = []
|
||||
|
||||
this.echartCheckTypes.forEach(ect => {
|
||||
result.push({ name: ect, type: 'bar', data: [] })
|
||||
})
|
||||
|
||||
this.dataListDynamic.forEach((inspection, index) => {
|
||||
console.log('inspection: ', inspection)
|
||||
this.echartCategories.forEach(cate => {
|
||||
if (cate in inspection) {
|
||||
result[index].data.push(inspection[cate])
|
||||
} else {
|
||||
result[index].data.push('0')
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
this.echartsData = result
|
||||
// [
|
||||
// { name: '11', type: 'bar', data: [/**产线1*/ 2, /**产线2*/ 3] },
|
||||
// { name: '222', type: 'bar', data: [1, 2, 3] }
|
||||
// ]
|
||||
|
||||
console.log('echarts data: ', this.echartsData)
|
||||
},
|
||||
|
||||
fetchList(type, startTime, endTime) {
|
||||
switch (type) {
|
||||
case 'sx':
|
||||
return this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/qualityInspectionRecord/pageCountRecordNow'),
|
||||
method: 'POST',
|
||||
data: {
|
||||
startTime,
|
||||
endTime
|
||||
}
|
||||
}).catch(err => {
|
||||
console.error(err)
|
||||
})
|
||||
case 'pl':
|
||||
return this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/qualityInspectionRecord/qualityInspectionRecordsDet'),
|
||||
method: 'POST',
|
||||
data: {
|
||||
startTime,
|
||||
endTime
|
||||
}
|
||||
}).catch(err => {
|
||||
console.error(err)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.base-container {
|
||||
min-height: 60vh;
|
||||
background: #fff;
|
||||
padding: 12px;
|
||||
}
|
||||
</style>
|
||||
216
src/views/modules/monitoring/qualityInspectionDet.vue
Normal file
216
src/views/modules/monitoring/qualityInspectionDet.vue
Normal file
@@ -0,0 +1,216 @@
|
||||
<template>
|
||||
<div class="mod-config">
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<el-form-item>
|
||||
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<el-button v-if="$hasPermission('monitoring:qualityinspectiondet:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- <el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" style="width: 100%;">
|
||||
<el-table-column type="selection" header-align="center" align="center" width="50"> </el-table-column>
|
||||
<el-table-column prop="id" header-align="center" align="center" label="ID"> </el-table-column>
|
||||
<el-table-column prop="typeId" header-align="center" align="center" label="检测类型id"> </el-table-column>
|
||||
<el-table-column prop="content" header-align="center" align="center" label="检测内容"> </el-table-column>
|
||||
<el-table-column prop="code" header-align="center" align="center" label="检测编码"> </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 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> -->
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" @operate-event="handleOperations" @refreshDataList="getDataList" />
|
||||
<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" :configs="addOrUpdateConfigs" @refreshDataList="getDataList" @destory-dialog="addOrUpdateVisible = false" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from '@/components/base-dialog/addOrUpdate'
|
||||
// import AddOrUpdate from './qualityInspectionDet-add-or-update'
|
||||
import BaseTable from '@/components/base-table'
|
||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
||||
// import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
|
||||
const tableConfigs = [
|
||||
{ prop: 'createTime', name: '添加时间' },
|
||||
{ prop: 'typeName', name: '检测类型' },
|
||||
{ prop: 'content', name: '检测内容' },
|
||||
{ prop: 'code', name: '检测编码' },
|
||||
{ prop: 'remark', name: '备注' },
|
||||
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
|
||||
const addOrUpdateConfigs = {
|
||||
type: 'dialog',
|
||||
infoUrl: '/monitoring/qualityInspectionDet',
|
||||
fields: [
|
||||
{ name: 'typeId', label: '检测类型', type: 'select', options: [] },
|
||||
{ name: 'content', label: '检测内容' },
|
||||
{ name: 'code', label: '内容编码', api: '/monitoring/qualityInspectionDet/getCode' },
|
||||
'remark'
|
||||
],
|
||||
operations: [
|
||||
{ name: 'cancel', showAlways: true },
|
||||
{ name: 'save', url: '/monitoring/qualityInspectionDet', permission: '', showOnEdit: false },
|
||||
{ name: 'update', url: '/monitoring/qualityInspectionDet', permission: '', showOnEdit: true }
|
||||
]
|
||||
}
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
addOrUpdateConfigs,
|
||||
tableConfigs,
|
||||
dataForm: {
|
||||
key: ''
|
||||
},
|
||||
dataList: [],
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
dataListLoading: false,
|
||||
dataListSelections: [],
|
||||
addOrUpdateVisible: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate,
|
||||
BaseTable
|
||||
},
|
||||
activated() {
|
||||
this.getInspectionTypeList()
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
// 获取产检测类型列表
|
||||
getInspectionTypeList() {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/qualityInspectionType/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
limit: 999,
|
||||
page: 1
|
||||
})
|
||||
}).then(({ data: res }) => {
|
||||
if (res && res.code === 0) {
|
||||
this.addOrUpdateConfigs.fields.forEach(item => {
|
||||
if (item.name === 'typeId') item.options = res.data.list.map(item => ({ label: item.name, value: item.id }))
|
||||
})
|
||||
} else {
|
||||
this.addOrUpdateConfigs.fields.forEach(item => {
|
||||
if (item.name === 'typeId') item.options.splice(0)
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.addOrUpdateVisible = false
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/qualityInspectionDet/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
page: this.pageIndex,
|
||||
limit: this.pageSize,
|
||||
key: this.dataForm.key
|
||||
})
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataList = data.data.list
|
||||
this.totalPage = data.data.total
|
||||
} else {
|
||||
this.dataList = []
|
||||
this.totalPage = 0
|
||||
}
|
||||
this.dataListLoading = false
|
||||
})
|
||||
},
|
||||
// 每页数
|
||||
sizeChangeHandle(val) {
|
||||
this.pageSize = val
|
||||
this.pageIndex = 1
|
||||
this.getDataList()
|
||||
},
|
||||
// 当前页
|
||||
currentChangeHandle(val) {
|
||||
this.pageIndex = val
|
||||
this.getDataList()
|
||||
},
|
||||
// 多选
|
||||
selectionChangeHandle(val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
handleOperations({ type, data: id }) {
|
||||
switch (type) {
|
||||
case 'edit':
|
||||
return this.addOrUpdateHandle(id)
|
||||
case 'delete':
|
||||
return this.deleteHandle(id)
|
||||
}
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
},
|
||||
// 删除
|
||||
deleteHandle(id) {
|
||||
var ids = id
|
||||
? [id]
|
||||
: this.dataListSelections.map(item => {
|
||||
return item.id
|
||||
})
|
||||
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/qualityInspectionDet'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getDataList()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
276
src/views/modules/monitoring/qualityInspectionRecord.vue
Normal file
276
src/views/modules/monitoring/qualityInspectionRecord.vue
Normal file
@@ -0,0 +1,276 @@
|
||||
<template>
|
||||
<div class="mod-config">
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<el-form-item>
|
||||
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<el-button v-if="$hasPermission('monitoring:qualityinspectionrecord:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" @operate-event="handleOperations" @refreshDataList="getDataList" />
|
||||
|
||||
<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"
|
||||
:configs="addOrUpdateConfigs"
|
||||
@refreshDataList="getDataList"
|
||||
@destory-dialog="addOrUpdateVisible = false"
|
||||
@select-change="handleSelectChange"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from '@/components/base-dialog/addOrUpdate'
|
||||
// import AddOrUpdate from './qualityInspectionRecord-add-or-update'
|
||||
import BaseTable from '@/components/base-table'
|
||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
||||
// import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
|
||||
const tableConfigs = [
|
||||
{ prop: 'createTime', name: '添加时间' },
|
||||
{
|
||||
prop: 'inspectionDetContent',
|
||||
name: '检测内容'
|
||||
// "name": "检测内容(设备推送消息时,可能无对应id,只填这个字段)"
|
||||
},
|
||||
{ prop: 'checkTime', name: '检测时间' },
|
||||
{ prop: 'productionId', name: '产线id' },
|
||||
{ prop: 'sectionId', name: '工段id' },
|
||||
{ prop: 'checkPerson', name: '检测人员' },
|
||||
// { prop: 'checkPerson', name: '检测人员,可以多个' },
|
||||
{ prop: 'source', name: '来源', filter: val => ({ 1: '手动', 2: '自动' }[val]) },
|
||||
// { prop: 'source', name: '来源 1,手动(默认) 2,自动' },
|
||||
{ prop: 'explainText', name: '描述' },
|
||||
{ prop: 'remark', name: '备注' },
|
||||
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
|
||||
const addOrUpdateConfigs = {
|
||||
type: 'dialog',
|
||||
infoUrl: '/monitoring/qualityInspectionRecord',
|
||||
fields: [
|
||||
{ name: 'checkTime', label: '检测时间', type: 'date', props: { style: 'width: 100%', type: 'datetime' }, placeholder: '请选择检测时间' },
|
||||
{ name: 'productionId', label: '产线', type: 'select', options: [] },
|
||||
{ name: 'sectionId', label: '工段', type: 'select', options: [] },
|
||||
{
|
||||
name: 'source',
|
||||
label: '来源',
|
||||
type: 'select',
|
||||
options: [
|
||||
{ value: 1, label: '手动', default: true },
|
||||
{ value: 2, label: '自动' }
|
||||
]
|
||||
},
|
||||
{ name: 'inspectionDetId', label: '检测内容', type: 'select', options: [] },
|
||||
{ name: 'checkPerson', label: '检测人员' },
|
||||
{ name: 'explainText', label: '描述' },
|
||||
'remark'
|
||||
],
|
||||
operations: [
|
||||
{ name: 'cancel', showAlways: true },
|
||||
{ name: 'save', url: '/monitoring/qualityInspectionRecord', permission: '', showOnEdit: false },
|
||||
{ name: 'update', url: '/monitoring/qualityInspectionRecord', permission: '', showOnEdit: true }
|
||||
]
|
||||
}
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
addOrUpdateConfigs,
|
||||
tableConfigs,
|
||||
dataForm: {
|
||||
key: ''
|
||||
},
|
||||
dataList: [],
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
dataListLoading: false,
|
||||
dataListSelections: [],
|
||||
addOrUpdateVisible: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate,
|
||||
BaseTable
|
||||
},
|
||||
activated() {
|
||||
this.getDataList()
|
||||
this.getInspectionDet()
|
||||
this.getWorkSections()
|
||||
this.getProductLines()
|
||||
},
|
||||
methods: {
|
||||
// handle
|
||||
async handleSelectChange({ name, id }) {
|
||||
if (name === 'productionId') {
|
||||
// 如果选择了产线,就依据此更新工单的选项
|
||||
await this.getWorkSections(id)
|
||||
}
|
||||
},
|
||||
// 获取检测内容
|
||||
getInspectionDet() {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/qualityInspectionDet/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
page: this.pageIndex,
|
||||
limit: this.pageSize,
|
||||
key: this.dataForm.key
|
||||
})
|
||||
}).then(({ data: res }) => {
|
||||
console.log('insdet:', res)
|
||||
const insDetOpt = this.addOrUpdateConfigs.fields.find(item => item.name === 'inspectionDetId')
|
||||
if (insDetOpt) {
|
||||
insDetOpt.options = res.data.list.map(item => ({ value: item.id, label: item.content })) || []
|
||||
}
|
||||
})
|
||||
},
|
||||
// 获取产线
|
||||
getProductLines() {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/productionLine/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
// page: this.pageIndex,
|
||||
// limit: this.pageSize,
|
||||
// key: this.dataForm.key
|
||||
})
|
||||
}).then(({ data: res }) => {
|
||||
const plOpt = this.addOrUpdateConfigs.fields.find(item => item.name === 'productionId')
|
||||
if (plOpt) {
|
||||
plOpt.options = res.data.list.map(item => ({ value: item.id, label: item.name })) || []
|
||||
}
|
||||
})
|
||||
},
|
||||
// 获取工段
|
||||
getWorkSections(lineId) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/workshopSection/page'),
|
||||
method: 'get',
|
||||
params: lineId
|
||||
? this.$http.adornParams({
|
||||
// page: this.pageIndex,
|
||||
// limit: this.pageSize,
|
||||
// key: this.dataForm.key
|
||||
lineId
|
||||
})
|
||||
: {}
|
||||
}).then(({ data: res }) => {
|
||||
if (this.addOrUpdateVisible) {
|
||||
if (res.data.total === 0) {
|
||||
this.$message.error('该产线没有工段')
|
||||
} else {
|
||||
this.$message.success(`该产线有 ${res.data.total} 条工段`)
|
||||
}
|
||||
}
|
||||
const wsOpt = this.addOrUpdateConfigs.fields.find(item => item.name === 'sectionId')
|
||||
if (wsOpt) {
|
||||
wsOpt.options = res.data.list.map(item => ({ value: item.id, label: item.name })) || []
|
||||
}
|
||||
})
|
||||
},
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.addOrUpdateVisible = false
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/qualityInspectionRecord/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
page: this.pageIndex,
|
||||
limit: this.pageSize,
|
||||
key: this.dataForm.key
|
||||
})
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataList = data.data.list
|
||||
this.totalPage = data.data.total
|
||||
} else {
|
||||
this.dataList = []
|
||||
this.totalPage = 0
|
||||
}
|
||||
this.dataListLoading = false
|
||||
})
|
||||
},
|
||||
// 每页数
|
||||
sizeChangeHandle(val) {
|
||||
this.pageSize = val
|
||||
this.pageIndex = 1
|
||||
this.getDataList()
|
||||
},
|
||||
// 当前页
|
||||
currentChangeHandle(val) {
|
||||
this.pageIndex = val
|
||||
this.getDataList()
|
||||
},
|
||||
// 多选
|
||||
selectionChangeHandle(val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
handleOperations({ type, data: id }) {
|
||||
switch (type) {
|
||||
case 'edit':
|
||||
return this.addOrUpdateHandle(id)
|
||||
case 'delete':
|
||||
return this.deleteHandle(id)
|
||||
}
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
},
|
||||
// 删除
|
||||
deleteHandle(id) {
|
||||
var ids = id
|
||||
? [id]
|
||||
: this.dataListSelections.map(item => {
|
||||
return item.id
|
||||
})
|
||||
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/qualityInspectionRecord'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getDataList()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
191
src/views/modules/monitoring/qualityInspectionType.vue
Normal file
191
src/views/modules/monitoring/qualityInspectionType.vue
Normal file
@@ -0,0 +1,191 @@
|
||||
<template>
|
||||
<div class="mod-config">
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<el-form-item>
|
||||
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<el-button v-if="$hasPermission('monitoring:qualityinspectiontype:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- <el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" style="width: 100%;">
|
||||
<el-table-column type="selection" header-align="center" align="center" width="50"> </el-table-column>
|
||||
<el-table-column prop="id" header-align="center" align="center" label="ID"> </el-table-column>
|
||||
<el-table-column prop="name" header-align="center" align="center" label="检测类型名称"> </el-table-column>
|
||||
<el-table-column prop="code" header-align="center" align="center" label="检测类型编码"> </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 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> -->
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" @operate-event="handleOperations" @refreshDataList="getDataList" />
|
||||
<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" :configs="addOrUpdateConfigs" @refreshDataList="getDataList" @destory-dialog="addOrUpdateVisible = false" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from '@/components/base-dialog/addOrUpdate'
|
||||
// import AddOrUpdate from './qualityInspectionType-add-or-update'
|
||||
import BaseTable from '@/components/base-table'
|
||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
||||
// import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
|
||||
const tableConfigs = [
|
||||
{ prop: 'createTime', name: '添加时间' },
|
||||
{ prop: 'name', name: '检测类型名称' },
|
||||
{ prop: 'code', name: '检测类型编码' },
|
||||
{ prop: 'remark', name: '备注' },
|
||||
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
|
||||
const addOrUpdateConfigs = {
|
||||
type: 'dialog',
|
||||
infoUrl: '/monitoring/qualityInspectionType',
|
||||
fields: [
|
||||
{ name: 'name', label: '检测类型' },
|
||||
{ name: 'code', label: '检测类型编码', api: '/monitoring/qualityInspectionType/getCode' },
|
||||
'remark'
|
||||
],
|
||||
operations: [
|
||||
{ name: 'cancel', showAlways: true },
|
||||
{ name: 'save', url: '/monitoring/qualityInspectionType', permission: '', showOnEdit: false },
|
||||
{ name: 'update', url: '/monitoring/qualityInspectionType', permission: '', showOnEdit: true }
|
||||
]
|
||||
}
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
addOrUpdateConfigs,
|
||||
tableConfigs,
|
||||
dataForm: {
|
||||
key: ''
|
||||
},
|
||||
dataList: [],
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
dataListLoading: false,
|
||||
dataListSelections: [],
|
||||
addOrUpdateVisible: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate,
|
||||
BaseTable
|
||||
},
|
||||
activated() {
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.addOrUpdateVisible = false
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/qualityInspectionType/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
page: this.pageIndex,
|
||||
limit: this.pageSize,
|
||||
key: this.dataForm.key
|
||||
})
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataList = data.data.list
|
||||
this.totalPage = data.data.total
|
||||
} else {
|
||||
this.dataList = []
|
||||
this.totalPage = 0
|
||||
}
|
||||
this.dataListLoading = false
|
||||
})
|
||||
},
|
||||
// 每页数
|
||||
sizeChangeHandle(val) {
|
||||
this.pageSize = val
|
||||
this.pageIndex = 1
|
||||
this.getDataList()
|
||||
},
|
||||
// 当前页
|
||||
currentChangeHandle(val) {
|
||||
this.pageIndex = val
|
||||
this.getDataList()
|
||||
},
|
||||
// 多选
|
||||
selectionChangeHandle(val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
handleOperations({ type, data: id }) {
|
||||
switch (type) {
|
||||
case 'edit':
|
||||
return this.addOrUpdateHandle(id)
|
||||
case 'delete':
|
||||
return this.deleteHandle(id)
|
||||
}
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
},
|
||||
// 删除
|
||||
deleteHandle(id) {
|
||||
var ids = id
|
||||
? [id]
|
||||
: this.dataListSelections.map(item => {
|
||||
return item.id
|
||||
})
|
||||
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/qualityInspectionType'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getDataList()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,157 @@
|
||||
<template>
|
||||
<el-dialog :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-item label="检测类型id" prop="typeId">
|
||||
<el-input v-model="dataForm.typeId" placeholder="检测类型id"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="检测内容" prop="content">
|
||||
<el-input v-model="dataForm.content" placeholder="检测内容"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="检测编码" prop="code">
|
||||
<el-input v-model="dataForm.code" placeholder="检测编码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="dataForm.remark" placeholder="备注"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="删除标志,是否有效:1 可用 0不可用" prop="valid">
|
||||
<el-input v-model="dataForm.valid" placeholder="删除标志,是否有效:1 可用 0不可用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人" prop="creatorId">
|
||||
<el-input v-model="dataForm.creatorId" placeholder="创建人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人姓名" prop="creatorName">
|
||||
<el-input v-model="dataForm.creatorName" placeholder="创建人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-input v-model="dataForm.createTime" placeholder="创建时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人" prop="updaterId">
|
||||
<el-input v-model="dataForm.updaterId" placeholder="更新人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人姓名" prop="updaterName">
|
||||
<el-input v-model="dataForm.updaterName" placeholder="更新人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新时间" prop="updateTime">
|
||||
<el-input v-model="dataForm.updateTime" placeholder="更新时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="版本号" prop="version">
|
||||
<el-input v-model="dataForm.version" placeholder="版本号"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
typeId: '',
|
||||
content: '',
|
||||
code: '',
|
||||
remark: '',
|
||||
valid: '',
|
||||
creatorId: '',
|
||||
creatorName: '',
|
||||
createTime: '',
|
||||
updaterId: '',
|
||||
updaterName: '',
|
||||
updateTime: '',
|
||||
version: ''
|
||||
},
|
||||
dataRule: {
|
||||
typeId: [{ required: true, message: '检测类型id不能为空', trigger: 'blur' }],
|
||||
content: [{ required: true, message: '检测内容不能为空', trigger: 'blur' }],
|
||||
code: [{ 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: {
|
||||
init(id) {
|
||||
this.dataForm.id = id || 0
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/qualityInspectionDet/${this.dataForm.id}`),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams()
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataForm.typeId = data.qualityInspectionDet.typeId
|
||||
this.dataForm.content = data.qualityInspectionDet.content
|
||||
this.dataForm.code = data.qualityInspectionDet.code
|
||||
this.dataForm.remark = data.qualityInspectionDet.remark
|
||||
this.dataForm.valid = data.qualityInspectionDet.valid
|
||||
this.dataForm.creatorId = data.qualityInspectionDet.creatorId
|
||||
this.dataForm.creatorName = data.qualityInspectionDet.creatorName
|
||||
this.dataForm.createTime = data.qualityInspectionDet.createTime
|
||||
this.dataForm.updaterId = data.qualityInspectionDet.updaterId
|
||||
this.dataForm.updaterName = data.qualityInspectionDet.updaterName
|
||||
this.dataForm.updateTime = data.qualityInspectionDet.updateTime
|
||||
this.dataForm.version = data.qualityInspectionDet.version
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate(valid => {
|
||||
if (valid) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/qualityInspectionDet/${!this.dataForm.id ? '' : this.dataForm.id}`),
|
||||
method: this.dataForm.id ? 'put' : 'post',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
data: this.$http.adornData({
|
||||
id: this.dataForm.id || undefined,
|
||||
typeId: this.dataForm.typeId,
|
||||
content: this.dataForm.content,
|
||||
code: this.dataForm.code,
|
||||
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>
|
||||
@@ -0,0 +1,191 @@
|
||||
<template>
|
||||
<el-dialog :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-item label="检测内容id" prop="inspectionDetId">
|
||||
<el-input v-model="dataForm.inspectionDetId" placeholder="检测内容id"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="检测内容(设备推送消息时,可能无对应id,只填这个字段)" prop="inspectionDetContent">
|
||||
<el-input v-model="dataForm.inspectionDetContent" placeholder="检测内容(设备推送消息时,可能无对应id,只填这个字段)"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="产线id" prop="productionId">
|
||||
<el-input v-model="dataForm.productionId" placeholder="产线id"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="工段id" prop="sectionId">
|
||||
<el-input v-model="dataForm.sectionId" placeholder="工段id"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="检测人员,可以多个" prop="checkPerson">
|
||||
<el-input v-model="dataForm.checkPerson" placeholder="检测人员,可以多个"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="检测时间" prop="checkTime">
|
||||
<el-input v-model="dataForm.checkTime" placeholder="检测时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="来源 1,手动(默认) 2,自动" prop="source">
|
||||
<el-input v-model="dataForm.source" placeholder="来源 1,手动(默认) 2,自动"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="描述" prop="explainText">
|
||||
<el-input v-model="dataForm.explainText" placeholder="描述"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="dataForm.remark" placeholder="备注"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="删除标志,是否有效:1 可用 0不可用" prop="valid">
|
||||
<el-input v-model="dataForm.valid" placeholder="删除标志,是否有效:1 可用 0不可用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人" prop="creatorId">
|
||||
<el-input v-model="dataForm.creatorId" placeholder="创建人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人姓名" prop="creatorName">
|
||||
<el-input v-model="dataForm.creatorName" placeholder="创建人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-input v-model="dataForm.createTime" placeholder="创建时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人" prop="updaterId">
|
||||
<el-input v-model="dataForm.updaterId" placeholder="更新人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人姓名" prop="updaterName">
|
||||
<el-input v-model="dataForm.updaterName" placeholder="更新人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新时间" prop="updateTime">
|
||||
<el-input v-model="dataForm.updateTime" placeholder="更新时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="版本号" prop="version">
|
||||
<el-input v-model="dataForm.version" placeholder="版本号"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
inspectionDetId: '',
|
||||
inspectionDetContent: '',
|
||||
productionId: '',
|
||||
sectionId: '',
|
||||
checkPerson: '',
|
||||
checkTime: '',
|
||||
source: '',
|
||||
explainText: '',
|
||||
remark: '',
|
||||
valid: '',
|
||||
creatorId: '',
|
||||
creatorName: '',
|
||||
createTime: '',
|
||||
updaterId: '',
|
||||
updaterName: '',
|
||||
updateTime: '',
|
||||
version: ''
|
||||
},
|
||||
dataRule: {
|
||||
inspectionDetId: [{ required: true, message: '检测内容id不能为空', trigger: 'blur' }],
|
||||
inspectionDetContent: [{ required: true, message: '检测内容(设备推送消息时,可能无对应id,只填这个字段)不能为空', trigger: 'blur' }],
|
||||
productionId: [{ required: true, message: '产线id不能为空', trigger: 'blur' }],
|
||||
sectionId: [{ required: true, message: '工段id不能为空', trigger: 'blur' }],
|
||||
checkPerson: [{ required: true, message: '检测人员,可以多个不能为空', trigger: 'blur' }],
|
||||
checkTime: [{ required: true, message: '检测时间不能为空', trigger: 'blur' }],
|
||||
source: [{ required: true, message: '来源 1,手动(默认) 2,自动不能为空', trigger: 'blur' }],
|
||||
explainText: [{ 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: {
|
||||
init(id) {
|
||||
this.dataForm.id = id || 0
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/qualityInspectionRecord/${this.dataForm.id}`),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams()
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataForm.inspectionDetId = data.qualityInspectionRecord.inspectionDetId
|
||||
this.dataForm.inspectionDetContent = data.qualityInspectionRecord.inspectionDetContent
|
||||
this.dataForm.productionId = data.qualityInspectionRecord.productionId
|
||||
this.dataForm.sectionId = data.qualityInspectionRecord.sectionId
|
||||
this.dataForm.checkPerson = data.qualityInspectionRecord.checkPerson
|
||||
this.dataForm.checkTime = data.qualityInspectionRecord.checkTime
|
||||
this.dataForm.source = data.qualityInspectionRecord.source
|
||||
this.dataForm.explainText = data.qualityInspectionRecord.explainText
|
||||
this.dataForm.remark = data.qualityInspectionRecord.remark
|
||||
this.dataForm.valid = data.qualityInspectionRecord.valid
|
||||
this.dataForm.creatorId = data.qualityInspectionRecord.creatorId
|
||||
this.dataForm.creatorName = data.qualityInspectionRecord.creatorName
|
||||
this.dataForm.createTime = data.qualityInspectionRecord.createTime
|
||||
this.dataForm.updaterId = data.qualityInspectionRecord.updaterId
|
||||
this.dataForm.updaterName = data.qualityInspectionRecord.updaterName
|
||||
this.dataForm.updateTime = data.qualityInspectionRecord.updateTime
|
||||
this.dataForm.version = data.qualityInspectionRecord.version
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate(valid => {
|
||||
if (valid) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/qualityInspectionRecord/${!this.dataForm.id ? '' : this.dataForm.id}`),
|
||||
method: this.dataForm.id ? 'put' : 'post',
|
||||
data: this.$http.adornData({
|
||||
id: this.dataForm.id || undefined,
|
||||
inspectionDetId: this.dataForm.inspectionDetId,
|
||||
inspectionDetContent: this.dataForm.inspectionDetContent,
|
||||
productionId: this.dataForm.productionId,
|
||||
sectionId: this.dataForm.sectionId,
|
||||
checkPerson: this.dataForm.checkPerson,
|
||||
checkTime: this.dataForm.checkTime,
|
||||
source: this.dataForm.source,
|
||||
explainText: this.dataForm.explainText,
|
||||
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>
|
||||
@@ -0,0 +1,149 @@
|
||||
<template>
|
||||
<el-dialog :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-item label="检测类型名称" prop="name">
|
||||
<el-input v-model="dataForm.name" placeholder="检测类型名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="检测类型编码" prop="code">
|
||||
<el-input v-model="dataForm.code" placeholder="检测类型编码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="dataForm.remark" placeholder="备注"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="删除标志,是否有效:1 可用 0不可用" prop="valid">
|
||||
<el-input v-model="dataForm.valid" placeholder="删除标志,是否有效:1 可用 0不可用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人" prop="creatorId">
|
||||
<el-input v-model="dataForm.creatorId" placeholder="创建人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人姓名" prop="creatorName">
|
||||
<el-input v-model="dataForm.creatorName" placeholder="创建人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-input v-model="dataForm.createTime" placeholder="创建时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人" prop="updaterId">
|
||||
<el-input v-model="dataForm.updaterId" placeholder="更新人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人姓名" prop="updaterName">
|
||||
<el-input v-model="dataForm.updaterName" placeholder="更新人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新时间" prop="updateTime">
|
||||
<el-input v-model="dataForm.updateTime" placeholder="更新时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="版本号" prop="version">
|
||||
<el-input v-model="dataForm.version" placeholder="版本号"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
name: '',
|
||||
code: '',
|
||||
remark: '',
|
||||
valid: '',
|
||||
creatorId: '',
|
||||
creatorName: '',
|
||||
createTime: '',
|
||||
updaterId: '',
|
||||
updaterName: '',
|
||||
updateTime: '',
|
||||
version: ''
|
||||
},
|
||||
dataRule: {
|
||||
name: [{ required: true, message: '检测类型名称不能为空', trigger: 'blur' }],
|
||||
code: [{ 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: {
|
||||
init(id) {
|
||||
this.dataForm.id = id || 0
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/qualityInspectionType/${this.dataForm.id}`),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams()
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataForm.name = data.qualityInspectionType.name
|
||||
this.dataForm.code = data.qualityInspectionType.code
|
||||
this.dataForm.remark = data.qualityInspectionType.remark
|
||||
this.dataForm.valid = data.qualityInspectionType.valid
|
||||
this.dataForm.creatorId = data.qualityInspectionType.creatorId
|
||||
this.dataForm.creatorName = data.qualityInspectionType.creatorName
|
||||
this.dataForm.createTime = data.qualityInspectionType.createTime
|
||||
this.dataForm.updaterId = data.qualityInspectionType.updaterId
|
||||
this.dataForm.updaterName = data.qualityInspectionType.updaterName
|
||||
this.dataForm.updateTime = data.qualityInspectionType.updateTime
|
||||
this.dataForm.version = data.qualityInspectionType.version
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate(valid => {
|
||||
if (valid) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/qualityInspectionType/${!this.dataForm.id ? '' : this.dataForm.id}`),
|
||||
method: this.dataForm.id ? 'put' : 'post',
|
||||
data: this.$http.adornData({
|
||||
id: this.dataForm.id || undefined,
|
||||
name: this.dataForm.name,
|
||||
code: this.dataForm.code,
|
||||
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>
|
||||
173
src/views/modules/monitoring/reportCategory.vue
Normal file
173
src/views/modules/monitoring/reportCategory.vue
Normal file
@@ -0,0 +1,173 @@
|
||||
<template>
|
||||
<div class="mod-config">
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<el-form-item>
|
||||
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<el-button v-if="$hasPermission('monitoring:reportsheetcategory:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" @operate-event="handleOperations" @refreshDataList="getDataList" />
|
||||
|
||||
<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" :configs="addOrUpdateConfigs" @refreshDataList="getDataList" @destory-dialog="addOrUpdateVisible = false" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// import AddOrUpdate from './reportSheetCategory-add-or-update'
|
||||
import AddOrUpdate from '@/components/base-dialog/addOrUpdate'
|
||||
import BaseTable from '@/components/base-table'
|
||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
||||
// import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
|
||||
const tableConfigs = [
|
||||
{ prop: 'createTime', name: '添加时间' },
|
||||
{ prop: 'name', name: '分类名称' },
|
||||
// { prop: 'code', name: '分类编码' },
|
||||
// 'description',
|
||||
// 'remark',
|
||||
{ prop: 'operations', name: '操作', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
|
||||
const addOrUpdateConfigs = {
|
||||
type: 'dialog',
|
||||
infoUrl: '/monitoring/reportSheetCategory',
|
||||
fields: [
|
||||
{ name: 'name', label: '分类名称', required: true, span: 24 },
|
||||
// { name: 'code', label: '分类编码', required: true },
|
||||
// { name: 'description', label: '描述' },
|
||||
// { name: 'remark', label: '备注' }
|
||||
],
|
||||
operations: [
|
||||
{ name: 'cancel', url: true, showAlways: true },
|
||||
{ name: 'save', url: '/monitoring/reportSheetCategory', permission: '', showOnEdit: false },
|
||||
{ name: 'update', url: '/monitoring/reportSheetCategory', permission: '', showOnEdit: true }
|
||||
]
|
||||
}
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
tableConfigs,
|
||||
addOrUpdateConfigs,
|
||||
dataForm: {
|
||||
key: ''
|
||||
},
|
||||
dataList: [],
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
dataListLoading: false,
|
||||
dataListSelections: [],
|
||||
addOrUpdateVisible: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate,
|
||||
BaseTable
|
||||
},
|
||||
activated() {
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
handleOperations({ type, data: id }) {
|
||||
switch (type) {
|
||||
case 'edit':
|
||||
return this.addOrUpdateHandle(id)
|
||||
case 'delete':
|
||||
return this.deleteHandle(id)
|
||||
}
|
||||
},
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/reportSheetCategory/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
page: this.pageIndex,
|
||||
limit: this.pageSize,
|
||||
key: this.dataForm.key
|
||||
})
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataList = data.data.list
|
||||
this.totalPage = data.data.total
|
||||
} else {
|
||||
this.dataList = []
|
||||
this.totalPage = 0
|
||||
}
|
||||
this.dataListLoading = false
|
||||
})
|
||||
},
|
||||
// 每页数
|
||||
sizeChangeHandle(val) {
|
||||
this.pageSize = val
|
||||
this.pageIndex = 1
|
||||
this.getDataList()
|
||||
},
|
||||
// 当前页
|
||||
currentChangeHandle(val) {
|
||||
this.pageIndex = val
|
||||
this.getDataList()
|
||||
},
|
||||
// 多选
|
||||
selectionChangeHandle(val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
},
|
||||
// 删除
|
||||
deleteHandle(id) {
|
||||
var ids = id
|
||||
? [id]
|
||||
: this.dataListSelections.map(item => {
|
||||
return item.id
|
||||
})
|
||||
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/reportSheetCategory'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getDataList()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
44
src/views/modules/monitoring/reportDesign.vue
Normal file
44
src/views/modules/monitoring/reportDesign.vue
Normal file
@@ -0,0 +1,44 @@
|
||||
<template>
|
||||
<div v-loading="loading" :class="$style.container">
|
||||
<iframe id="zgboke" :class="$style.mainIframe" name="mainIframe" :src="url" frameborder="0" scrolling="auto" />
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
components: {},
|
||||
props: {},
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
// url: process.env.VUE_APP_REPORT_DESIGN_URL
|
||||
url: window.SITE_CONFIG['apiURL'] + '/yd-monitor/ureport/designer'
|
||||
// url: this.$http.adornUrl('/ureport/designer')
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
const vm = this
|
||||
console.log(this.$route.query)
|
||||
const { name } = this.$route.query
|
||||
this.url += name ? '?_u=db:' + this.$route.query.name : ''
|
||||
const ifream = document.getElementById('zgboke')
|
||||
|
||||
console.log('url: ', this.url)
|
||||
ifream.onload = function() {
|
||||
console.log('加载完成')
|
||||
vm.loading = false
|
||||
}
|
||||
},
|
||||
methods: {}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" module>
|
||||
.container {
|
||||
margin: 0px 16px 0 8px;
|
||||
width: 98.5%;
|
||||
height: calc(100vh - 180px);
|
||||
.mainIframe {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
259
src/views/modules/monitoring/reportDetail.vue
Normal file
259
src/views/modules/monitoring/reportDetail.vue
Normal file
@@ -0,0 +1,259 @@
|
||||
<template>
|
||||
<div class="mod-config">
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<el-form-item>
|
||||
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<el-button v-if="$hasPermission('')" type="primary" @click="addOrUpdateHandle()">新增(跳到设计)</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" @operate-event="handleOperations" @refreshDataList="getDataList" />
|
||||
|
||||
<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" :configs="addOrUpdateConfigs" @refreshDataList="getDataList" @destory-dialog="addOrUpdateVisible = false" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// import AddOrUpdate from './equipmentPlcConnect-add-or-update'
|
||||
import AddOrUpdate from '@/components/base-dialog/addOrUpdate'
|
||||
import BaseTable from '@/components/base-table'
|
||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
||||
import axios from '@/utils/request'
|
||||
|
||||
const CategoryList = {
|
||||
name: 'CategoryList',
|
||||
props: {
|
||||
injectData: {
|
||||
type: Object,
|
||||
required: true,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
pickedId: null
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.pickedId = this.injectData[this.injectData.head.prop]
|
||||
console.log('picked id : ', this.pickedId)
|
||||
},
|
||||
methods: {
|
||||
handleChange(id) {
|
||||
this.pickedId = id
|
||||
this.$emit('emit-data', { id })
|
||||
}
|
||||
},
|
||||
render: function(h) {
|
||||
const childOptions = []
|
||||
this.injectData.head.options?.forEach(item => {
|
||||
console.log('item', item)
|
||||
childOptions.push(h('el-option', { props: { label: item.label, value: item.value } }, null)) // TODO:<=== 去他妈的
|
||||
})
|
||||
return h('el-select', { on: { change: this.handleChange } }, childOptions)
|
||||
}
|
||||
}
|
||||
|
||||
const addOrUpdateConfigs = {
|
||||
type: 'dialog',
|
||||
infoUrl: '/monitoring/equipmentPlcConnect',
|
||||
fields: [
|
||||
{ name: 'equipmentId', label: '设备', required: true, type: 'select', options: [] },
|
||||
{ name: 'plcId', label: 'PLC名称', required: true, type: 'select', options: [] }
|
||||
],
|
||||
operations: [
|
||||
{ name: 'cancel', url: true, showAlways: true },
|
||||
{ name: 'save', url: '/monitoring/equipmentPlcConnect', permission: '', showOnEdit: false },
|
||||
{ name: 'update', url: '/monitoring/equipmentPlcConnect', permission: '', showOnEdit: true }
|
||||
],
|
||||
subtable: {
|
||||
title: 'PLC采集参数',
|
||||
url: '/monitoring/equipmentPlcParam',
|
||||
relatedField: 'plcConId',
|
||||
tableConfigs: [
|
||||
{ type: 'index', name: '序号' },
|
||||
// { prop: 'plcConId', name: 'plc连接表ID' },
|
||||
{ prop: 'paramCode', name: '参数编码', formField: true, rules: [{ required: true, message: '必填', trigger: 'blur' }] },
|
||||
{ prop: 'paramName', name: '参数名称', formField: true, rules: [{ required: true, message: '必填', trigger: 'blur' }] },
|
||||
{ prop: 'paramAddress', name: '参数地址', formField: true },
|
||||
{ prop: 'description', name: '描述', formField: true },
|
||||
{
|
||||
prop: 'enabled',
|
||||
name: '启用状态',
|
||||
filter: val => ['停用', '启用'][+val],
|
||||
// filter: val => ({0:'停用', 1:'启用'}[+val]),
|
||||
rules: [{ required: true, message: '必填', trigger: 'blur' }],
|
||||
formField: true,
|
||||
formType: 'select',
|
||||
formOptions: [
|
||||
{ value: 0, label: '停用' },
|
||||
{ value: 1, label: '启用' }
|
||||
]
|
||||
},
|
||||
{ prop: 'remark', name: '备注', formField: true },
|
||||
// { prop: 'createTime', name: '添加时间' },
|
||||
{
|
||||
prop: 'collection',
|
||||
name: '是否采集',
|
||||
filter: val => ['不采集', '采集'][+val],
|
||||
rules: [{ required: true, message: '必填', trigger: 'blur' }],
|
||||
formField: true,
|
||||
formType: 'select',
|
||||
formOptions: [
|
||||
{ value: 0, label: '不采集' },
|
||||
{ value: 1, label: '采集' }
|
||||
]
|
||||
},
|
||||
// { prop: 'collectionCycle', name: '采集周期(s) 暂不使用' },
|
||||
// { prop: 'reportingCycle', name: '上报周期(s) 暂不使用' },
|
||||
// { prop: 'reportingMethod', name: '上报方式 暂不使用' },
|
||||
// { prop: 'reportingCode', name: '上报编码 暂不使用' },
|
||||
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
addOrUpdateConfigs,
|
||||
tableConfigs: [],
|
||||
dataForm: {
|
||||
key: ''
|
||||
},
|
||||
dataList: [],
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
dataListLoading: false,
|
||||
dataListSelections: [],
|
||||
addOrUpdateVisible: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate,
|
||||
BaseTable
|
||||
},
|
||||
activated() {
|
||||
this.getAllCategories()
|
||||
this.getDataList()
|
||||
},
|
||||
computed: {
|
||||
trueTableConfigs() {}
|
||||
},
|
||||
methods: {
|
||||
getAllCategories() {
|
||||
axios.get(axios.adornUrl('/monitoring/reportSheetCategory/page')).then(({ data: res }) => {
|
||||
if (res.data && res.data.list) {
|
||||
const categories = res.data.list.map(item => ({ label: item.name, value: item.id }))
|
||||
console.log('categories', categories)
|
||||
this.tableConfigs = [
|
||||
{ type: 'index', name: '序号' },
|
||||
{ prop: 'fileName', name: '报表名称' },
|
||||
{ prop: 'category', name: '报表分类', subcomponent: CategoryList, options: categories },
|
||||
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
}
|
||||
})
|
||||
},
|
||||
handleOperations({ type, data: id }) {
|
||||
switch (type) {
|
||||
case 'edit':
|
||||
return this.addOrUpdateHandle(id)
|
||||
case 'delete':
|
||||
return this.deleteHandle(id)
|
||||
}
|
||||
},
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/reportSheet/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
page: this.pageIndex,
|
||||
limit: this.pageSize,
|
||||
key: this.dataForm.key
|
||||
})
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataList = data.data.list
|
||||
this.totalPage = data.data.total
|
||||
} else {
|
||||
this.dataList = []
|
||||
this.totalPage = 0
|
||||
}
|
||||
this.dataListLoading = false
|
||||
})
|
||||
},
|
||||
// 每页数
|
||||
sizeChangeHandle(val) {
|
||||
this.pageSize = val
|
||||
this.pageIndex = 1
|
||||
this.getDataList()
|
||||
},
|
||||
// 当前页
|
||||
currentChangeHandle(val) {
|
||||
this.pageIndex = val
|
||||
this.getDataList()
|
||||
},
|
||||
// 多选
|
||||
selectionChangeHandle(val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
},
|
||||
// 删除
|
||||
deleteHandle(id) {
|
||||
var ids = id
|
||||
? [id]
|
||||
: this.dataListSelections.map(item => {
|
||||
return item.id
|
||||
})
|
||||
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentPlcConnect'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getDataList()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
141
src/views/modules/monitoring/reportList.vue
Normal file
141
src/views/modules/monitoring/reportList.vue
Normal file
@@ -0,0 +1,141 @@
|
||||
<template>
|
||||
<div class="container">
|
||||
<el-row class="sort-box" :gutter="20">
|
||||
<el-col class="sort-item" :span="4" @click.native="handleClick('')">
|
||||
<div class="sort-item-box">
|
||||
<div class="sort-item-box-top">
|
||||
<!-- <p>{{ $t('module.report.reportSort.all') }}</p> -->
|
||||
<p>全部</p>
|
||||
</div>
|
||||
<div class="sort-item-box-bottom">{{ allNum }} {{ allNum > 1 ? 'Reports' : 'Report' }}</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col v-for="item in dataList" :key="item.id" class="sort-item" @click.native="handleClick(item.id)">
|
||||
<div class="sort-item-box">
|
||||
<div class="sort-item-box-top">
|
||||
<p>{{ item.name }}</p>
|
||||
</div>
|
||||
<div class="sort-item-box-bottom">{{ item.quantity }} {{ item.quantity > 1 ? 'Reports' : 'Report' }}</div>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
dataList: [],
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
allNum: 0
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
// get list
|
||||
getDataList() {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/reportSheetCategory/list'),
|
||||
method: 'get',
|
||||
params: {}
|
||||
}).then(({ data: res }) => {
|
||||
this.allNum = 0
|
||||
if (res.data) {
|
||||
this.dataList = res.data
|
||||
res.data.forEach(item => {
|
||||
this.allNum += item.quantity
|
||||
})
|
||||
} else this.dataList.splice(0)
|
||||
})
|
||||
},
|
||||
|
||||
handleClick(id) {
|
||||
this.$router.push({
|
||||
name: 'monitoring-reportDetail',
|
||||
query: {
|
||||
sortId: id
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.container {
|
||||
padding: 20px;
|
||||
.sort-box {
|
||||
.sort-item {
|
||||
height: 400px;
|
||||
width: 280px;
|
||||
margin-bottom: 20px;
|
||||
.sort-item-box {
|
||||
width: 100%;
|
||||
height: 400px;
|
||||
background: #faefc2;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.5);
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
.sort-item-box-top {
|
||||
margin: 0 10%;
|
||||
width: 80%;
|
||||
height: 199px;
|
||||
border-bottom: 1px solid #e3d47d;
|
||||
color: #b3a995;
|
||||
position: relative;
|
||||
p {
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
bottom: 0px;
|
||||
line-height: 50px;
|
||||
font-size: 24px;
|
||||
letter-spacing: 5px;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
.sort-item-box-bottom {
|
||||
width: 100%;
|
||||
height: 200px;
|
||||
line-height: 200px;
|
||||
font-size: 24px;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
letter-spacing: 5px;
|
||||
color: #6e7680;
|
||||
}
|
||||
}
|
||||
.sort-item-box::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
right: 0;
|
||||
width: 4px;
|
||||
height: 400px;
|
||||
background: #f8e69b;
|
||||
}
|
||||
.sort-item-box::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 70px;
|
||||
width: 18px;
|
||||
height: 60px;
|
||||
background: #f8e69b;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.sort-item-box:hover {
|
||||
transition: border linear 0.2s, box-shadow linear 0.2s;
|
||||
border-color: rgba(141, 39, 142, 0.75);
|
||||
box-shadow: 0 0 5px rgba(111, 1, 32, 3);
|
||||
// border: 2px solid #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
70
src/views/modules/monitoring/reportPreview.vue
Normal file
70
src/views/modules/monitoring/reportPreview.vue
Normal file
@@ -0,0 +1,70 @@
|
||||
<!--
|
||||
* @Author: gtz
|
||||
* @Date: 2021-03-07 18:39:03
|
||||
* @LastEditors: gtz
|
||||
* @LastEditTime: 2022-02-24 16:35:51
|
||||
* @Description: file content
|
||||
-->
|
||||
<template>
|
||||
<div v-loading="loading" :class="$style.container">
|
||||
<h1 >{{ $route.query.name }}</h1>
|
||||
|
||||
<iframe id="reportView" :class="$style.mainIframe" name="mainIframe" :src="url" frameborder="0" scrolling="auto" />
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
components: {},
|
||||
props: {},
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
// url: process.env.VUE_APP_REPORT_VIEW_URL
|
||||
url: window.SITE_CONFIG['apiURL'] + '/yd-monitor/ureport/preview'
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
const vm = this
|
||||
console.log(this.$route.query)
|
||||
this.url += '?_u=db:' + this.$route.query.name + '.ureport.xml'
|
||||
// if (this.$route.query.params) {
|
||||
// const params = JSON.parse(this.$route.query.params)
|
||||
// params.map(item => {
|
||||
// this.url += '&' + item.key + '=' + item.value
|
||||
// })
|
||||
// }
|
||||
if (this.$route.query.substrateId) {
|
||||
this.url += '&substrateId=' + this.$route.query.substrateId
|
||||
}
|
||||
if (this.$route.query.equipmentId) {
|
||||
this.url += '&equipmentId=' + this.$route.query.equipmentId
|
||||
}
|
||||
if (this.$route.query.dataId) {
|
||||
this.url += '&dataId=' + this.$route.query.dataId
|
||||
}
|
||||
if (this.$route.query.workOrderNo) {
|
||||
this.url += '&workOrderNo=' + this.$route.query.workOrderNo
|
||||
}
|
||||
if (this.$route.query.id) {
|
||||
this.url += '&id=' + this.$route.query.id
|
||||
}
|
||||
const ifream = document.getElementById('reportView')
|
||||
ifream.onload = function() {
|
||||
console.log('加载完成')
|
||||
vm.loading = false
|
||||
}
|
||||
},
|
||||
methods: {}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" module>
|
||||
.container {
|
||||
margin: 0px 16px 0 8px;
|
||||
width: 98.5%;
|
||||
height: calc(100vh - 180px);
|
||||
.mainIframe {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
191
src/views/modules/monitoring/reportSheet-add-or-update.vue
Normal file
191
src/views/modules/monitoring/reportSheet-add-or-update.vue
Normal file
@@ -0,0 +1,191 @@
|
||||
<template>
|
||||
<el-dialog :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-item label="分类:关联report_sheet_category" prop="category">
|
||||
<el-input v-model="dataForm.category" placeholder="分类:关联report_sheet_category"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="编码" prop="code">
|
||||
<el-input v-model="dataForm.code" placeholder="编码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="dataForm.name" placeholder="名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="文件名称" prop="fileName">
|
||||
<el-input v-model="dataForm.fileName" placeholder="文件名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="链接地址" prop="url">
|
||||
<el-input v-model="dataForm.url" placeholder="链接地址"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="描述" prop="description">
|
||||
<el-input v-model="dataForm.description" placeholder="描述"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="启用状态:0 、停用,1、启用" prop="enabled">
|
||||
<el-input v-model="dataForm.enabled" placeholder="启用状态:0 、停用,1、启用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="dataForm.remark" placeholder="备注"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="删除标志,是否有效:1 可用 0不可用" prop="valid">
|
||||
<el-input v-model="dataForm.valid" placeholder="删除标志,是否有效:1 可用 0不可用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人" prop="creatorId">
|
||||
<el-input v-model="dataForm.creatorId" placeholder="创建人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人姓名" prop="creatorName">
|
||||
<el-input v-model="dataForm.creatorName" placeholder="创建人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-input v-model="dataForm.createTime" placeholder="创建时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人" prop="updaterId">
|
||||
<el-input v-model="dataForm.updaterId" placeholder="更新人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人姓名" prop="updaterName">
|
||||
<el-input v-model="dataForm.updaterName" placeholder="更新人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新时间" prop="updateTime">
|
||||
<el-input v-model="dataForm.updateTime" placeholder="更新时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="版本号" prop="version">
|
||||
<el-input v-model="dataForm.version" placeholder="版本号"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="报表内容" prop="content">
|
||||
<el-input v-model="dataForm.content" placeholder="报表内容"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
category: '',
|
||||
code: '',
|
||||
name: '',
|
||||
fileName: '',
|
||||
url: '',
|
||||
description: '',
|
||||
enabled: '',
|
||||
remark: '',
|
||||
valid: '',
|
||||
creatorId: '',
|
||||
creatorName: '',
|
||||
createTime: '',
|
||||
updaterId: '',
|
||||
updaterName: '',
|
||||
updateTime: '',
|
||||
version: '',
|
||||
content: ''
|
||||
},
|
||||
dataRule: {
|
||||
category: [{ required: true, message: '分类:关联report_sheet_category不能为空', trigger: 'blur' }],
|
||||
code: [{ required: true, message: '编码不能为空', trigger: 'blur' }],
|
||||
name: [{ required: true, message: '名称不能为空', trigger: 'blur' }],
|
||||
fileName: [{ required: true, message: '文件名称不能为空', trigger: 'blur' }],
|
||||
url: [{ required: true, message: '链接地址不能为空', trigger: 'blur' }],
|
||||
description: [{ required: true, message: '描述不能为空', trigger: 'blur' }],
|
||||
enabled: [{ required: true, message: '启用状态:0 、停用,1、启用不能为空', 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' }],
|
||||
content: [{ required: true, message: '报表内容不能为空', trigger: 'blur' }]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init(id) {
|
||||
this.dataForm.id = id || 0
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/reportSheet/${this.dataForm.id}`),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams()
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataForm.category = data.reporsheet.category
|
||||
this.dataForm.code = data.reporsheet.code
|
||||
this.dataForm.name = data.reporsheet.name
|
||||
this.dataForm.fileName = data.reporsheet.fileName
|
||||
this.dataForm.url = data.reporsheet.url
|
||||
this.dataForm.description = data.reporsheet.description
|
||||
this.dataForm.enabled = data.reporsheet.enabled
|
||||
this.dataForm.remark = data.reporsheet.remark
|
||||
this.dataForm.valid = data.reporsheet.valid
|
||||
this.dataForm.creatorId = data.reporsheet.creatorId
|
||||
this.dataForm.creatorName = data.reporsheet.creatorName
|
||||
this.dataForm.createTime = data.reporsheet.createTime
|
||||
this.dataForm.updaterId = data.reporsheet.updaterId
|
||||
this.dataForm.updaterName = data.reporsheet.updaterName
|
||||
this.dataForm.updateTime = data.reporsheet.updateTime
|
||||
this.dataForm.version = data.reporsheet.version
|
||||
this.dataForm.content = data.reporsheet.content
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate(valid => {
|
||||
if (valid) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/reportSheet/${!this.dataForm.id ? '' : this.dataForm.id}`),
|
||||
method: this.dataForm.id ? 'put' : 'post',
|
||||
data: this.$http.adornData({
|
||||
id: this.dataForm.id || undefined,
|
||||
category: this.dataForm.category,
|
||||
code: this.dataForm.code,
|
||||
name: this.dataForm.name,
|
||||
fileName: this.dataForm.fileName,
|
||||
url: this.dataForm.url,
|
||||
description: this.dataForm.description,
|
||||
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,
|
||||
content: this.dataForm.content
|
||||
})
|
||||
}).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>
|
||||
187
src/views/modules/monitoring/reportSheet.vue
Normal file
187
src/views/modules/monitoring/reportSheet.vue
Normal file
@@ -0,0 +1,187 @@
|
||||
<template>
|
||||
<div class="mod-config">
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<el-form-item>
|
||||
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<el-button v-if="$hasPermission('monitoring:reporsheet:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- <el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" style="width: 100%;">
|
||||
<el-table-column type="selection" header-align="center" align="center" width="50"> </el-table-column>
|
||||
<el-table-column prop="id" header-align="center" align="center" label="ID"> </el-table-column>
|
||||
<el-table-column prop="category" header-align="center" align="center" label="分类:关联report_sheet_category"> </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="fileName" header-align="center" align="center" label="文件名称"> </el-table-column>
|
||||
<el-table-column prop="url" 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="content" 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> -->
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" />
|
||||
<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>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from './reportSheet-add-or-update'
|
||||
import BaseTable from '@/components/base-table'
|
||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
||||
import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
|
||||
const tableConfigs = [
|
||||
{ prop: 'createTime', name: '创建时间' },
|
||||
{ prop: 'name', name: '报表名称' },
|
||||
{ prop: 'code', name: '报表编码' },
|
||||
{ prop: 'category', name: '报表分类' },
|
||||
// { prop: 'id', name: 'ID' },
|
||||
// { prop: 'category', name: '分类:关联report_sheet_category' },
|
||||
{ prop: 'fileName', name: '文件名称' },
|
||||
{ prop: 'url', name: '链接地址' },
|
||||
{ prop: 'description', name: '描述' },
|
||||
{ prop: 'remark', name: '备注' },
|
||||
{ prop: 'content', name: '报表内容' },
|
||||
// { prop: 'enabled', name: '启用状态:0 、停用,1、启用' },
|
||||
// { prop: 'valid', name: '删除标志,是否有效:1 可用 0不可用' },
|
||||
// { prop: 'creatorId', name: '创建人' },
|
||||
// { prop: 'creatorName', name: '创建人姓名' },
|
||||
// { prop: 'updaterId', name: '更新人' },
|
||||
// { prop: 'updaterName', name: '更新人姓名' },
|
||||
// { prop: 'updateTime', name: '更新时间' },
|
||||
// { prop: 'version', name: '版本号' },
|
||||
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
tableConfigs,
|
||||
dataForm: {
|
||||
key: ''
|
||||
},
|
||||
dataList: [],
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
dataListLoading: false,
|
||||
dataListSelections: [],
|
||||
addOrUpdateVisible: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate,
|
||||
BaseTable
|
||||
},
|
||||
activated() {
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/reportSheet/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
page: this.pageIndex,
|
||||
limit: this.pageSize,
|
||||
key: this.dataForm.key
|
||||
})
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataList = data.data.list
|
||||
this.totalPage = data.data.total
|
||||
} else {
|
||||
this.dataList = []
|
||||
this.totalPage = 0
|
||||
}
|
||||
this.dataListLoading = false
|
||||
})
|
||||
},
|
||||
// 每页数
|
||||
sizeChangeHandle(val) {
|
||||
this.pageSize = val
|
||||
this.pageIndex = 1
|
||||
this.getDataList()
|
||||
},
|
||||
// 当前页
|
||||
currentChangeHandle(val) {
|
||||
this.pageIndex = val
|
||||
this.getDataList()
|
||||
},
|
||||
// 多选
|
||||
selectionChangeHandle(val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
},
|
||||
// 删除
|
||||
deleteHandle(id) {
|
||||
var ids = id
|
||||
? [id]
|
||||
: this.dataListSelections.map(item => {
|
||||
return item.id
|
||||
})
|
||||
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/reportSheet'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getDataList()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,170 @@
|
||||
<template>
|
||||
<el-dialog :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-item label="编码" prop="code">
|
||||
<el-input v-model="dataForm.code" placeholder="编码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="dataForm.name" placeholder="名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="描述" prop="description">
|
||||
<el-input v-model="dataForm.description" placeholder="描述"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="外部编码,用于对照外部系统的编码" prop="externalCode">
|
||||
<el-input v-model="dataForm.externalCode" placeholder="外部编码,用于对照外部系统的编码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="启用状态:0 、停用,1、启用" prop="enabled">
|
||||
<el-input v-model="dataForm.enabled" placeholder="启用状态:0 、停用,1、启用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="dataForm.remark" placeholder="备注"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="删除标志,是否有效:1 可用 0不可用" prop="valid">
|
||||
<el-input v-model="dataForm.valid" placeholder="删除标志,是否有效:1 可用 0不可用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人" prop="creatorId">
|
||||
<el-input v-model="dataForm.creatorId" placeholder="创建人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人姓名" prop="creatorName">
|
||||
<el-input v-model="dataForm.creatorName" placeholder="创建人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-input v-model="dataForm.createTime" placeholder="创建时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人" prop="updaterId">
|
||||
<el-input v-model="dataForm.updaterId" placeholder="更新人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人姓名" prop="updaterName">
|
||||
<el-input v-model="dataForm.updaterName" placeholder="更新人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新时间" prop="updateTime">
|
||||
<el-input v-model="dataForm.updateTime" placeholder="更新时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="版本号" prop="version">
|
||||
<el-input v-model="dataForm.version" placeholder="版本号"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
code: '',
|
||||
name: '',
|
||||
description: '',
|
||||
externalCode: '',
|
||||
enabled: '',
|
||||
remark: '',
|
||||
valid: '',
|
||||
creatorId: '',
|
||||
creatorName: '',
|
||||
createTime: '',
|
||||
updaterId: '',
|
||||
updaterName: '',
|
||||
updateTime: '',
|
||||
version: ''
|
||||
},
|
||||
dataRule: {
|
||||
code: [{ required: true, message: '编码不能为空', trigger: 'blur' }],
|
||||
name: [{ required: true, message: '名称不能为空', trigger: 'blur' }],
|
||||
description: [{ required: true, message: '描述不能为空', trigger: 'blur' }],
|
||||
externalCode: [{ required: true, message: '外部编码,用于对照外部系统的编码不能为空', trigger: 'blur' }],
|
||||
enabled: [{ required: true, message: '启用状态:0 、停用,1、启用不能为空', 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: {
|
||||
init(id) {
|
||||
this.dataForm.id = id || 0
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/reportSheetCategory/${this.dataForm.id}`),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams()
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataForm.code = data.reporsheecategory.code
|
||||
this.dataForm.name = data.reporsheecategory.name
|
||||
this.dataForm.description = data.reporsheecategory.description
|
||||
this.dataForm.externalCode = data.reporsheecategory.externalCode
|
||||
this.dataForm.enabled = data.reporsheecategory.enabled
|
||||
this.dataForm.remark = data.reporsheecategory.remark
|
||||
this.dataForm.valid = data.reporsheecategory.valid
|
||||
this.dataForm.creatorId = data.reporsheecategory.creatorId
|
||||
this.dataForm.creatorName = data.reporsheecategory.creatorName
|
||||
this.dataForm.createTime = data.reporsheecategory.createTime
|
||||
this.dataForm.updaterId = data.reporsheecategory.updaterId
|
||||
this.dataForm.updaterName = data.reporsheecategory.updaterName
|
||||
this.dataForm.updateTime = data.reporsheecategory.updateTime
|
||||
this.dataForm.version = data.reporsheecategory.version
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate(valid => {
|
||||
if (valid) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/reportSheetCategory/${!this.dataForm.id ? '' : this.dataForm.id}`),
|
||||
method: this.dataForm.id ? 'put' : 'post',
|
||||
data: this.$http.adornData({
|
||||
id: this.dataForm.id || undefined,
|
||||
code: this.dataForm.code,
|
||||
name: this.dataForm.name,
|
||||
description: this.dataForm.description,
|
||||
externalCode: this.dataForm.externalCode,
|
||||
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>
|
||||
179
src/views/modules/monitoring/reportSheetCategory.vue
Normal file
179
src/views/modules/monitoring/reportSheetCategory.vue
Normal file
@@ -0,0 +1,179 @@
|
||||
<template>
|
||||
<div class="mod-config">
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<el-form-item>
|
||||
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<el-button v-if="$hasPermission('monitoring:reporsheecategory:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- <el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" style="width: 100%;">
|
||||
<el-table-column type="selection" header-align="center" align="center" width="50"> </el-table-column>
|
||||
<el-table-column 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="description" 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="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 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> -->
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" />
|
||||
<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>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from './reportSheetCategory-add-or-update'
|
||||
import BaseTable from '@/components/base-table'
|
||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
||||
import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
|
||||
const tableConfigs = [
|
||||
{ prop: 'createTime', name: '添加时间' },
|
||||
{ prop: 'name', name: '分类名称' },
|
||||
{ prop: 'code', name: '分类编码' },
|
||||
// { "prop": "id", "name": "ID" },
|
||||
// { "prop": "description", "name": "描述" },
|
||||
// { "prop": "externalCode", "name": "外部编码,用于对照外部系统的编码" },
|
||||
// { "prop": "enabled", "name": "启用状态:0 、停用,1、启用" },
|
||||
// { "prop": "remark", "name": "备注" },
|
||||
// { "prop": "valid", "name": "删除标志,是否有效:1 可用 0不可用" },
|
||||
// { "prop": "creatorId", "name": "创建人" },
|
||||
// { "prop": "creatorName", "name": "创建人姓名" },
|
||||
// { "prop": "updaterId", "name": "更新人" },
|
||||
// { "prop": "updaterName", "name": "更新人姓名" },
|
||||
// { "prop": "updateTime", "name": "更新时间" },
|
||||
// { prop: 'version', name: '版本号' },
|
||||
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
tableConfigs,
|
||||
dataForm: {
|
||||
key: ''
|
||||
},
|
||||
dataList: [],
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
dataListLoading: false,
|
||||
dataListSelections: [],
|
||||
addOrUpdateVisible: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate,
|
||||
BaseTable
|
||||
},
|
||||
activated() {
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/reportSheetCategory/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
page: this.pageIndex,
|
||||
limit: this.pageSize,
|
||||
key: this.dataForm.key
|
||||
})
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataList = data.data.list
|
||||
this.totalPage = data.data.total
|
||||
} else {
|
||||
this.dataList = []
|
||||
this.totalPage = 0
|
||||
}
|
||||
this.dataListLoading = false
|
||||
})
|
||||
},
|
||||
// 每页数
|
||||
sizeChangeHandle(val) {
|
||||
this.pageSize = val
|
||||
this.pageIndex = 1
|
||||
this.getDataList()
|
||||
},
|
||||
// 当前页
|
||||
currentChangeHandle(val) {
|
||||
this.pageIndex = val
|
||||
this.getDataList()
|
||||
},
|
||||
// 多选
|
||||
selectionChangeHandle(val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
},
|
||||
// 删除
|
||||
deleteHandle(id) {
|
||||
var ids = id
|
||||
? [id]
|
||||
: this.dataListSelections.map(item => {
|
||||
return item.id
|
||||
})
|
||||
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/reportSheetCategory'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getDataList()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
163
src/views/modules/monitoring/sysfile-add-or-update.vue
Normal file
163
src/views/modules/monitoring/sysfile-add-or-update.vue
Normal file
@@ -0,0 +1,163 @@
|
||||
<template>
|
||||
<el-dialog :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-item label="文件类型编号" prop="typeCode">
|
||||
<el-input v-model="dataForm.typeCode" placeholder="文件类型编号"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="文件编号" prop="fileCode">
|
||||
<el-input v-model="dataForm.fileCode" placeholder="文件编号"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="文件名称" prop="fileName">
|
||||
<el-input v-model="dataForm.fileName" placeholder="文件名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="文件路径URL" prop="fileUrl">
|
||||
<el-input v-model="dataForm.fileUrl" placeholder="文件路径URL"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="dataForm.remark" placeholder="备注"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="删除标志,是否有效:1 可用 0不可用" prop="valid">
|
||||
<el-input v-model="dataForm.valid" placeholder="删除标志,是否有效:1 可用 0不可用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人" prop="creatorId">
|
||||
<el-input v-model="dataForm.creatorId" placeholder="创建人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人姓名" prop="creatorName">
|
||||
<el-input v-model="dataForm.creatorName" placeholder="创建人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-input v-model="dataForm.createTime" placeholder="创建时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人" prop="updaterId">
|
||||
<el-input v-model="dataForm.updaterId" placeholder="更新人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人姓名" prop="updaterName">
|
||||
<el-input v-model="dataForm.updaterName" placeholder="更新人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新时间" prop="updateTime">
|
||||
<el-input v-model="dataForm.updateTime" placeholder="更新时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="版本号" prop="version">
|
||||
<el-input v-model="dataForm.version" placeholder="版本号"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
typeCode: '',
|
||||
fileCode: '',
|
||||
fileName: '',
|
||||
fileUrl: '',
|
||||
remark: '',
|
||||
valid: '',
|
||||
creatorId: '',
|
||||
creatorName: '',
|
||||
createTime: '',
|
||||
updaterId: '',
|
||||
updaterName: '',
|
||||
updateTime: '',
|
||||
version: ''
|
||||
},
|
||||
dataRule: {
|
||||
typeCode: [{ required: true, message: '文件类型编号不能为空', trigger: 'blur' }],
|
||||
fileCode: [{ required: true, message: '文件编号不能为空', trigger: 'blur' }],
|
||||
fileName: [{ required: true, message: '文件名称不能为空', trigger: 'blur' }],
|
||||
fileUrl: [{ required: true, message: '文件路径URL不能为空', 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: {
|
||||
init(id) {
|
||||
this.dataForm.id = id || 0
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/sysFile/${this.dataForm.id}`),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams()
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataForm.typeCode = data.sysFile.typeCode
|
||||
this.dataForm.fileCode = data.sysFile.fileCode
|
||||
this.dataForm.fileName = data.sysFile.fileName
|
||||
this.dataForm.fileUrl = data.sysFile.fileUrl
|
||||
this.dataForm.remark = data.sysFile.remark
|
||||
this.dataForm.valid = data.sysFile.valid
|
||||
this.dataForm.creatorId = data.sysFile.creatorId
|
||||
this.dataForm.creatorName = data.sysFile.creatorName
|
||||
this.dataForm.createTime = data.sysFile.createTime
|
||||
this.dataForm.updaterId = data.sysFile.updaterId
|
||||
this.dataForm.updaterName = data.sysFile.updaterName
|
||||
this.dataForm.updateTime = data.sysFile.updateTime
|
||||
this.dataForm.version = data.sysFile.version
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate(valid => {
|
||||
if (valid) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/sysFile/${!this.dataForm.id ? '' : this.dataForm.id}`),
|
||||
method: this.dataForm.id ? 'put' : 'post',
|
||||
data: this.$http.adornData({
|
||||
id: this.dataForm.id || undefined,
|
||||
typeCode: this.dataForm.typeCode,
|
||||
fileCode: this.dataForm.fileCode,
|
||||
fileName: this.dataForm.fileName,
|
||||
fileUrl: this.dataForm.fileUrl,
|
||||
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>
|
||||
175
src/views/modules/monitoring/sysfile.vue
Normal file
175
src/views/modules/monitoring/sysfile.vue
Normal file
@@ -0,0 +1,175 @@
|
||||
<template>
|
||||
<div class="mod-config">
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<el-form-item>
|
||||
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<el-button v-if="$hasPermission('monitoring:sysfile:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- <el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" style="width: 100%;">
|
||||
<el-table-column type="selection" header-align="center" align="center" width="50"> </el-table-column>
|
||||
<el-table-column prop="id" header-align="center" align="center" label="主键,自增"> </el-table-column>
|
||||
<el-table-column prop="typeCode" header-align="center" align="center" label="文件类型编号"> </el-table-column>
|
||||
<el-table-column prop="fileCode" header-align="center" align="center" label="文件编号"> </el-table-column>
|
||||
<el-table-column prop="fileName" header-align="center" align="center" label="文件名称"> </el-table-column>
|
||||
<el-table-column prop="fileUrl" header-align="center" align="center" label="文件路径URL"> </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 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> -->
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" />
|
||||
<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>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from './sysFile-add-or-update'
|
||||
import BaseTable from '@/components/base-table'
|
||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
||||
import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
|
||||
const tableConfigs = [
|
||||
{ "prop": "id", "name": "主键,自增" },
|
||||
{ "prop": "typeCode", "name": "文件类型编号" },
|
||||
{ "prop": "fileCode", "name": "文件编号" },
|
||||
{ "prop": "fileName", "name": "文件名称" },
|
||||
{ "prop": "fileUrl", "name": "文件路径URL" },
|
||||
{ "prop": "remark", "name": "备注" },
|
||||
{ "prop": "valid", "name": "删除标志,是否有效:1 可用 0不可用" },
|
||||
{ "prop": "creatorId", "name": "创建人" },
|
||||
{ "prop": "creatorName", "name": "创建人姓名" },
|
||||
{ "prop": "createTime", "name": "添加时间" },
|
||||
{ "prop": "updaterId", "name": "更新人" },
|
||||
{ "prop": "updaterName", "name": "更新人姓名" },
|
||||
{ "prop": "updateTime", "name": "更新时间" },
|
||||
{ "prop": "version", "name": "版本号" }, { prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {tableConfigs,
|
||||
dataForm: {
|
||||
key: ''
|
||||
},
|
||||
dataList: [],
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
dataListLoading: false,
|
||||
dataListSelections: [],
|
||||
addOrUpdateVisible: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate,BaseTable
|
||||
},
|
||||
activated() {
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/sysFile/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
page: this.pageIndex,
|
||||
limit: this.pageSize,
|
||||
key: this.dataForm.key
|
||||
})
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataList = data.data.list
|
||||
this.totalPage = data.data.total
|
||||
} else {
|
||||
this.dataList = []
|
||||
this.totalPage = 0
|
||||
}
|
||||
this.dataListLoading = false
|
||||
})
|
||||
},
|
||||
// 每页数
|
||||
sizeChangeHandle(val) {
|
||||
this.pageSize = val
|
||||
this.pageIndex = 1
|
||||
this.getDataList()
|
||||
},
|
||||
// 当前页
|
||||
currentChangeHandle(val) {
|
||||
this.pageIndex = val
|
||||
this.getDataList()
|
||||
},
|
||||
// 多选
|
||||
selectionChangeHandle(val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
},
|
||||
// 删除
|
||||
deleteHandle(id) {
|
||||
var ids = id
|
||||
? [id]
|
||||
: this.dataListSelections.map(item => {
|
||||
return item.id
|
||||
})
|
||||
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/sysFile'),
|
||||
|
||||
data: this.$http.adornData(ids, false)
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getDataList()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
172
src/views/modules/monitoring/sysfileType.vue
Normal file
172
src/views/modules/monitoring/sysfileType.vue
Normal file
@@ -0,0 +1,172 @@
|
||||
<template>
|
||||
<div class="mod-config">
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<el-form-item>
|
||||
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<el-button v-if="$hasPermission('monitoring:sysfiletype:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- <el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" style="width: 100%;">
|
||||
<el-table-column type="selection" header-align="center" align="center" width="50"> </el-table-column>
|
||||
<el-table-column prop="id" header-align="center" align="center" label="主键,自增"> </el-table-column>
|
||||
<el-table-column prop="typeCode" header-align="center" align="center" label="文件类型编号"> </el-table-column>
|
||||
<el-table-column prop="typeName" header-align="center" align="center" label="文件类型名称"> </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 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> -->
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" />
|
||||
<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>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from './sysFileType-add-or-update'
|
||||
import BaseTable from '@/components/base-table'
|
||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
||||
import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
|
||||
const tableConfigs = [
|
||||
{ "prop": "id", "name": "主键,自增" },
|
||||
{ "prop": "typeCode", "name": "文件类型编号" },
|
||||
{ "prop": "typeName", "name": "文件类型名称" },
|
||||
{ "prop": "remark", "name": "备注" },
|
||||
{ "prop": "valid", "name": "删除标志,是否有效:1 可用 0不可用" },
|
||||
{ "prop": "creatorId", "name": "创建人" },
|
||||
{ "prop": "creatorName", "name": "创建人姓名" },
|
||||
{ "prop": "createTime", "name": "添加时间" },
|
||||
{ "prop": "updaterId", "name": "更新人" },
|
||||
{ "prop": "updaterName", "name": "更新人姓名" },
|
||||
{ "prop": "updateTime", "name": "更新时间" },
|
||||
{ "prop": "version", "name": "版本号" }, { prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {tableConfigs,
|
||||
dataForm: {
|
||||
key: ''
|
||||
},
|
||||
dataList: [],
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
dataListLoading: false,
|
||||
dataListSelections: [],
|
||||
addOrUpdateVisible: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate,BaseTable
|
||||
},
|
||||
activated() {
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/sysFileType/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
page: this.pageIndex,
|
||||
limit: this.pageSize,
|
||||
key: this.dataForm.key
|
||||
})
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataList = data.data.list
|
||||
this.totalPage = data.data.total
|
||||
} else {
|
||||
this.dataList = []
|
||||
this.totalPage = 0
|
||||
}
|
||||
this.dataListLoading = false
|
||||
})
|
||||
},
|
||||
// 每页数
|
||||
sizeChangeHandle(val) {
|
||||
this.pageSize = val
|
||||
this.pageIndex = 1
|
||||
this.getDataList()
|
||||
},
|
||||
// 当前页
|
||||
currentChangeHandle(val) {
|
||||
this.pageIndex = val
|
||||
this.getDataList()
|
||||
},
|
||||
// 多选
|
||||
selectionChangeHandle(val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
},
|
||||
// 删除
|
||||
deleteHandle(id) {
|
||||
var ids = id
|
||||
? [id]
|
||||
: this.dataListSelections.map(item => {
|
||||
return item.id
|
||||
})
|
||||
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/sysFileType'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getDataList()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
149
src/views/modules/monitoring/sysfiletype-add-or-update.vue
Normal file
149
src/views/modules/monitoring/sysfiletype-add-or-update.vue
Normal file
@@ -0,0 +1,149 @@
|
||||
<template>
|
||||
<el-dialog :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-item label="文件类型编号" prop="typeCode">
|
||||
<el-input v-model="dataForm.typeCode" placeholder="文件类型编号"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="文件类型名称" prop="typeName">
|
||||
<el-input v-model="dataForm.typeName" placeholder="文件类型名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="dataForm.remark" placeholder="备注"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="删除标志,是否有效:1 可用 0不可用" prop="valid">
|
||||
<el-input v-model="dataForm.valid" placeholder="删除标志,是否有效:1 可用 0不可用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人" prop="creatorId">
|
||||
<el-input v-model="dataForm.creatorId" placeholder="创建人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人姓名" prop="creatorName">
|
||||
<el-input v-model="dataForm.creatorName" placeholder="创建人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-input v-model="dataForm.createTime" placeholder="创建时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人" prop="updaterId">
|
||||
<el-input v-model="dataForm.updaterId" placeholder="更新人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人姓名" prop="updaterName">
|
||||
<el-input v-model="dataForm.updaterName" placeholder="更新人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新时间" prop="updateTime">
|
||||
<el-input v-model="dataForm.updateTime" placeholder="更新时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="版本号" prop="version">
|
||||
<el-input v-model="dataForm.version" placeholder="版本号"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
typeCode: '',
|
||||
typeName: '',
|
||||
remark: '',
|
||||
valid: '',
|
||||
creatorId: '',
|
||||
creatorName: '',
|
||||
createTime: '',
|
||||
updaterId: '',
|
||||
updaterName: '',
|
||||
updateTime: '',
|
||||
version: ''
|
||||
},
|
||||
dataRule: {
|
||||
typeCode: [{ required: true, message: '文件类型编号不能为空', trigger: 'blur' }],
|
||||
typeName: [{ 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: {
|
||||
init(id) {
|
||||
this.dataForm.id = id || 0
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/sysFileType/${this.dataForm.id}`),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams()
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataForm.typeCode = data.sysFileType.typeCode
|
||||
this.dataForm.typeName = data.sysFileType.typeName
|
||||
this.dataForm.remark = data.sysFileType.remark
|
||||
this.dataForm.valid = data.sysFileType.valid
|
||||
this.dataForm.creatorId = data.sysFileType.creatorId
|
||||
this.dataForm.creatorName = data.sysFileType.creatorName
|
||||
this.dataForm.createTime = data.sysFileType.createTime
|
||||
this.dataForm.updaterId = data.sysFileType.updaterId
|
||||
this.dataForm.updaterName = data.sysFileType.updaterName
|
||||
this.dataForm.updateTime = data.sysFileType.updateTime
|
||||
this.dataForm.version = data.sysFileType.version
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate(valid => {
|
||||
if (valid) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/sysFileType/${!this.dataForm.id ? '' : this.dataForm.id}`),
|
||||
method: this.dataForm.id ? 'put' : 'post',
|
||||
data: this.$http.adornData({
|
||||
id: this.dataForm.id || undefined,
|
||||
typeCode: this.dataForm.typeCode,
|
||||
typeName: this.dataForm.typeName,
|
||||
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>
|
||||
220
src/views/modules/monitoring/workShopSection.vue
Normal file
220
src/views/modules/monitoring/workShopSection.vue
Normal file
@@ -0,0 +1,220 @@
|
||||
<template>
|
||||
<div class="mod-config">
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<el-form-item>
|
||||
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<el-button v-if="$hasPermission('monitoring:workshopsection:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- <el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" style="width: 100%;">
|
||||
<el-table-column type="selection" header-align="center" align="center" width="50"> </el-table-column>
|
||||
<el-table-column prop="id" header-align="center" align="center" label="id"> </el-table-column>
|
||||
<el-table-column prop="productionLineId" 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="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="sort" header-align="center" align="center" label="排序"> </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 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> -->
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" @operate-event="handleOperations" @refreshDataList="getDataList" />
|
||||
<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" :configs="addOrUpdateConfigs" @refreshDataList="getDataList" @destory-dialog="addOrUpdateVisible = false" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from '@/components/base-dialog/addOrUpdate'
|
||||
// import AddOrUpdate from './workshopSection-add-or-update'
|
||||
import BaseTable from '@/components/base-table'
|
||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
||||
import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
|
||||
const tableConfigs = [
|
||||
{ prop: 'createTime', name: '添加时间' },
|
||||
{ prop: 'name', name: '工段名称' },
|
||||
{ prop: 'code', name: '工段编码' },
|
||||
// { prop: 'productionLineId', name: '产线ID' },
|
||||
{ prop: 'productionLineName', name: '产线' },
|
||||
{ prop: 'remark', name: '备注' },
|
||||
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
|
||||
const addOrUpdateConfigs = {
|
||||
type: 'dialog',
|
||||
infoUrl: '/monitoring/workshopSection',
|
||||
fields: [
|
||||
{ name: 'name', label: '工段名称' },
|
||||
{ name: 'code', label: '工段编码', api: '/monitoring/workshopSection/getCode' },
|
||||
{ name: 'productionLineId', label: '所属产线', type: 'select', options: [] },
|
||||
'description',
|
||||
'remark'
|
||||
],
|
||||
operations: [
|
||||
{ name: 'reset', url: true, showAlways: true },
|
||||
{ name: 'cancel', url: true, showAlways: true },
|
||||
{ name: 'save', url: '/monitoring/workshopSection', permission: '', showOnEdit: false },
|
||||
{ name: 'update', url: '/monitoring/workshopSection', permission: '', showOnEdit: true }
|
||||
]
|
||||
}
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
addOrUpdateConfigs,
|
||||
tableConfigs,
|
||||
dataForm: {
|
||||
key: ''
|
||||
},
|
||||
dataList: [],
|
||||
plList: [],
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
dataListLoading: false,
|
||||
dataListSelections: [],
|
||||
addOrUpdateVisible: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate,
|
||||
BaseTable
|
||||
},
|
||||
activated() {
|
||||
this.getProductLine()
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
// 获取产线列表
|
||||
getProductLine() {
|
||||
this.$http.get(this.$http.adornUrl('/monitoring/productionLine/list')).then(({ data: res }) => {
|
||||
if (res && res.code === 0) {
|
||||
// this.plList = res.data
|
||||
console.log('res', res)
|
||||
this.addOrUpdateConfigs.fields.forEach(item => {
|
||||
if (item.name === 'productionLineId') item.options = res.data.map(item => ({ label: item.name, value: item.id }))
|
||||
})
|
||||
} else {
|
||||
this.addOrUpdateConfigs.fields.forEach(item => {
|
||||
if (item.name === 'productionLineId') item.options.splice(0)
|
||||
})
|
||||
// this.plList.splice(0)
|
||||
}
|
||||
})
|
||||
},
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.addOrUpdateVisible = false
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/workshopSection/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
page: this.pageIndex,
|
||||
limit: this.pageSize,
|
||||
key: this.dataForm.key
|
||||
})
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataList = data.data.list
|
||||
this.totalPage = data.data.total
|
||||
} else {
|
||||
this.dataList = []
|
||||
this.totalPage = 0
|
||||
}
|
||||
this.dataListLoading = false
|
||||
})
|
||||
},
|
||||
// 每页数
|
||||
sizeChangeHandle(val) {
|
||||
this.pageSize = val
|
||||
this.pageIndex = 1
|
||||
this.getDataList()
|
||||
},
|
||||
// 当前页
|
||||
currentChangeHandle(val) {
|
||||
this.pageIndex = val
|
||||
this.getDataList()
|
||||
},
|
||||
// 多选
|
||||
selectionChangeHandle(val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
handleOperations({ type, data: id }) {
|
||||
switch (type) {
|
||||
case 'edit':
|
||||
return this.addOrUpdateHandle(id)
|
||||
case 'delete':
|
||||
return this.deleteHandle(id)
|
||||
}
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
},
|
||||
// 删除
|
||||
deleteHandle(id) {
|
||||
var ids = id
|
||||
? [id]
|
||||
: this.dataListSelections.map(item => {
|
||||
return item.id
|
||||
})
|
||||
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/workshopSection'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getDataList()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
175
src/views/modules/monitoring/workShopSectionEquipment.vue
Normal file
175
src/views/modules/monitoring/workShopSectionEquipment.vue
Normal file
@@ -0,0 +1,175 @@
|
||||
<template>
|
||||
<div class="mod-config">
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<el-form-item>
|
||||
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<el-button v-if="$hasPermission('monitoring:workshopsectionequipment:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- <el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" style="width: 100%;">
|
||||
<el-table-column type="selection" header-align="center" align="center" width="50"> </el-table-column>
|
||||
<el-table-column prop="id" header-align="center" align="center" label="ID"> </el-table-column>
|
||||
<el-table-column prop="workshopSectionId" header-align="center" align="center" label="工段ID"> </el-table-column>
|
||||
<el-table-column prop="equipmentId" header-align="center" align="center" label="设备ID"> </el-table-column>
|
||||
<el-table-column prop="sort" header-align="center" align="center" label="排序"> </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 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> -->
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" />
|
||||
<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>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from './workshopSectionEquipment-add-or-update'
|
||||
import BaseTable from '@/components/base-table'
|
||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
||||
import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
|
||||
const tableConfigs = [
|
||||
{ prop: 'createTime', name: '添加时间' },
|
||||
{ prop: 'workshopSectionId', name: '工段ID' },
|
||||
{ prop: 'equipmentId', name: '设备ID' },
|
||||
{ prop: 'sort', name: '排序' },
|
||||
{ prop: 'remark', name: '备注' },
|
||||
// { prop: 'id', name: 'ID' },
|
||||
// { prop: 'valid', name: '删除标志,是否有效:1 可用 0不可用' },
|
||||
// { prop: 'creatorId', name: '创建人' },
|
||||
// { prop: 'creatorName', name: '创建人姓名' },
|
||||
// { prop: 'updaterId', name: '更新人' },
|
||||
// { prop: 'updaterName', name: '更新人姓名' },
|
||||
// { prop: 'updateTime', name: '更新时间' },
|
||||
// { prop: 'version', name: '版本号' },
|
||||
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
tableConfigs,
|
||||
dataForm: {
|
||||
key: ''
|
||||
},
|
||||
dataList: [],
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
dataListLoading: false,
|
||||
dataListSelections: [],
|
||||
addOrUpdateVisible: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate,
|
||||
BaseTable
|
||||
},
|
||||
activated() {
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/workshopSectionEquipment/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
page: this.pageIndex,
|
||||
limit: this.pageSize,
|
||||
key: this.dataForm.key
|
||||
})
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataList = data.data.list
|
||||
this.totalPage = data.data.total
|
||||
} else {
|
||||
this.dataList = []
|
||||
this.totalPage = 0
|
||||
}
|
||||
this.dataListLoading = false
|
||||
})
|
||||
},
|
||||
// 每页数
|
||||
sizeChangeHandle(val) {
|
||||
this.pageSize = val
|
||||
this.pageIndex = 1
|
||||
this.getDataList()
|
||||
},
|
||||
// 当前页
|
||||
currentChangeHandle(val) {
|
||||
this.pageIndex = val
|
||||
this.getDataList()
|
||||
},
|
||||
// 多选
|
||||
selectionChangeHandle(val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
},
|
||||
// 删除
|
||||
deleteHandle(id) {
|
||||
var ids = id
|
||||
? [id]
|
||||
: this.dataListSelections.map(item => {
|
||||
return item.id
|
||||
})
|
||||
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/workshopSectionEquipment'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getDataList()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
184
src/views/modules/monitoring/workshopsection-add-or-update.vue
Normal file
184
src/views/modules/monitoring/workshopsection-add-or-update.vue
Normal file
@@ -0,0 +1,184 @@
|
||||
<template>
|
||||
<el-dialog :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-item label="产线ID" prop="productionLineId">
|
||||
<el-input v-model="dataForm.productionLineId" placeholder="产线ID"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="编码" prop="code">
|
||||
<el-input v-model="dataForm.code" placeholder="编码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="dataForm.name" placeholder="名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="描述" prop="description">
|
||||
<el-input v-model="dataForm.description" placeholder="描述"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="启用状态:0 、停用,1、启用" prop="enabled">
|
||||
<el-input v-model="dataForm.enabled" placeholder="启用状态:0 、停用,1、启用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="排序" prop="sort">
|
||||
<el-input v-model="dataForm.sort" placeholder="排序"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="dataForm.remark" placeholder="备注"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="删除标志,是否有效:1 可用 0不可用" prop="valid">
|
||||
<el-input v-model="dataForm.valid" placeholder="删除标志,是否有效:1 可用 0不可用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人" prop="creatorId">
|
||||
<el-input v-model="dataForm.creatorId" placeholder="创建人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人姓名" prop="creatorName">
|
||||
<el-input v-model="dataForm.creatorName" placeholder="创建人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-input v-model="dataForm.createTime" placeholder="创建时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人" prop="updaterId">
|
||||
<el-input v-model="dataForm.updaterId" placeholder="更新人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人姓名" prop="updaterName">
|
||||
<el-input v-model="dataForm.updaterName" placeholder="更新人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新时间" prop="updateTime">
|
||||
<el-input v-model="dataForm.updateTime" placeholder="更新时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="版本号" prop="version">
|
||||
<el-input v-model="dataForm.version" placeholder="版本号"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="外部系统编码" prop="externalCode">
|
||||
<el-input v-model="dataForm.externalCode" placeholder="外部系统编码"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
productionLineId: '',
|
||||
code: '',
|
||||
name: '',
|
||||
description: '',
|
||||
enabled: '',
|
||||
sort: '',
|
||||
remark: '',
|
||||
valid: '',
|
||||
creatorId: '',
|
||||
creatorName: '',
|
||||
createTime: '',
|
||||
updaterId: '',
|
||||
updaterName: '',
|
||||
updateTime: '',
|
||||
version: '',
|
||||
externalCode: ''
|
||||
},
|
||||
dataRule: {
|
||||
productionLineId: [{ required: true, message: '产线ID不能为空', trigger: 'blur' }],
|
||||
code: [{ required: true, message: '编码不能为空', trigger: 'blur' }],
|
||||
name: [{ required: true, message: '名称不能为空', trigger: 'blur' }],
|
||||
description: [{ required: true, message: '描述不能为空', trigger: 'blur' }],
|
||||
enabled: [{ required: true, message: '启用状态:0 、停用,1、启用不能为空', trigger: 'blur' }],
|
||||
sort: [{ 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' }],
|
||||
externalCode: [{ required: true, message: '外部系统编码不能为空', trigger: 'blur' }]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init(id) {
|
||||
this.dataForm.id = id || 0
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/workshopSection/${this.dataForm.id}`),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams()
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataForm.productionLineId = data.workshopSection.productionLineId
|
||||
this.dataForm.code = data.workshopSection.code
|
||||
this.dataForm.name = data.workshopSection.name
|
||||
this.dataForm.description = data.workshopSection.description
|
||||
this.dataForm.enabled = data.workshopSection.enabled
|
||||
this.dataForm.sort = data.workshopSection.sort
|
||||
this.dataForm.remark = data.workshopSection.remark
|
||||
this.dataForm.valid = data.workshopSection.valid
|
||||
this.dataForm.creatorId = data.workshopSection.creatorId
|
||||
this.dataForm.creatorName = data.workshopSection.creatorName
|
||||
this.dataForm.createTime = data.workshopSection.createTime
|
||||
this.dataForm.updaterId = data.workshopSection.updaterId
|
||||
this.dataForm.updaterName = data.workshopSection.updaterName
|
||||
this.dataForm.updateTime = data.workshopSection.updateTime
|
||||
this.dataForm.version = data.workshopSection.version
|
||||
this.dataForm.externalCode = data.workshopSection.externalCode
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate(valid => {
|
||||
if (valid) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/workshopSection/${!this.dataForm.id ? '' : this.dataForm.id}`),
|
||||
method: this.dataForm.id ? 'put' : 'post',
|
||||
data: this.$http.adornData({
|
||||
id: this.dataForm.id || undefined,
|
||||
productionLineId: this.dataForm.productionLineId,
|
||||
code: this.dataForm.code,
|
||||
name: this.dataForm.name,
|
||||
description: this.dataForm.description,
|
||||
enabled: this.dataForm.enabled,
|
||||
sort: this.dataForm.sort,
|
||||
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,
|
||||
externalCode: this.dataForm.externalCode
|
||||
})
|
||||
}).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>
|
||||
@@ -0,0 +1,156 @@
|
||||
<template>
|
||||
<el-dialog :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-item label="工段ID" prop="workshopSectionId">
|
||||
<el-input v-model="dataForm.workshopSectionId" placeholder="工段ID"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备ID" prop="equipmentId">
|
||||
<el-input v-model="dataForm.equipmentId" placeholder="设备ID"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="排序" prop="sort">
|
||||
<el-input v-model="dataForm.sort" placeholder="排序"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="dataForm.remark" placeholder="备注"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="删除标志,是否有效:1 可用 0不可用" prop="valid">
|
||||
<el-input v-model="dataForm.valid" placeholder="删除标志,是否有效:1 可用 0不可用"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人" prop="creatorId">
|
||||
<el-input v-model="dataForm.creatorId" placeholder="创建人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建人姓名" prop="creatorName">
|
||||
<el-input v-model="dataForm.creatorName" placeholder="创建人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-input v-model="dataForm.createTime" placeholder="创建时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人" prop="updaterId">
|
||||
<el-input v-model="dataForm.updaterId" placeholder="更新人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人姓名" prop="updaterName">
|
||||
<el-input v-model="dataForm.updaterName" placeholder="更新人姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更新时间" prop="updateTime">
|
||||
<el-input v-model="dataForm.updateTime" placeholder="更新时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="版本号" prop="version">
|
||||
<el-input v-model="dataForm.version" placeholder="版本号"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
workshopSectionId: '',
|
||||
equipmentId: '',
|
||||
sort: '',
|
||||
remark: '',
|
||||
valid: '',
|
||||
creatorId: '',
|
||||
creatorName: '',
|
||||
createTime: '',
|
||||
updaterId: '',
|
||||
updaterName: '',
|
||||
updateTime: '',
|
||||
version: ''
|
||||
},
|
||||
dataRule: {
|
||||
workshopSectionId: [{ required: true, message: '工段ID不能为空', trigger: 'blur' }],
|
||||
equipmentId: [{ required: true, message: '设备ID不能为空', trigger: 'blur' }],
|
||||
sort: [{ 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: {
|
||||
init(id) {
|
||||
this.dataForm.id = id || 0
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/workshopSectionEquipment/${this.dataForm.id}`),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams()
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataForm.workshopSectionId = data.workshopSectionEquipment.workshopSectionId
|
||||
this.dataForm.equipmentId = data.workshopSectionEquipment.equipmentId
|
||||
this.dataForm.sort = data.workshopSectionEquipment.sort
|
||||
this.dataForm.remark = data.workshopSectionEquipment.remark
|
||||
this.dataForm.valid = data.workshopSectionEquipment.valid
|
||||
this.dataForm.creatorId = data.workshopSectionEquipment.creatorId
|
||||
this.dataForm.creatorName = data.workshopSectionEquipment.creatorName
|
||||
this.dataForm.createTime = data.workshopSectionEquipment.createTime
|
||||
this.dataForm.updaterId = data.workshopSectionEquipment.updaterId
|
||||
this.dataForm.updaterName = data.workshopSectionEquipment.updaterName
|
||||
this.dataForm.updateTime = data.workshopSectionEquipment.updateTime
|
||||
this.dataForm.version = data.workshopSectionEquipment.version
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate(valid => {
|
||||
if (valid) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/monitoring/workshopSectionEquipment/${!this.dataForm.id ? '' : this.dataForm.id}`),
|
||||
method: this.dataForm.id ? 'put' : 'post',
|
||||
data: this.$http.adornData({
|
||||
id: this.dataForm.id || undefined,
|
||||
workshopSectionId: this.dataForm.workshopSectionId,
|
||||
equipmentId: this.dataForm.equipmentId,
|
||||
sort: this.dataForm.sort,
|
||||
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>
|
||||
@@ -1,225 +1,205 @@
|
||||
<template>
|
||||
<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-item :label="$t('oss.type')" size="mini">
|
||||
<el-radio-group v-model="dataForm.type">
|
||||
<el-radio :label="1">{{ $t('oss.type1') }}</el-radio>
|
||||
<el-radio :label="2">{{ $t('oss.type2') }}</el-radio>
|
||||
<el-radio :label="3">{{ $t('oss.type3') }}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<template v-if="dataForm.type === 1">
|
||||
<el-form-item size="mini">
|
||||
<a href="https://s.qiniu.com/7Rfaym" target="_blank">免费申请(七牛)10GB储存空间</a>
|
||||
</el-form-item>
|
||||
<el-form-item prop="qiniuDomain" :label="$t('oss.qiniuDomain')">
|
||||
<el-input v-model="dataForm.qiniuDomain" :placeholder="$t('oss.qiniuDomainTips')"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="qiniuPrefix" :label="$t('oss.qiniuPrefix')">
|
||||
<el-input v-model="dataForm.qiniuPrefix" :placeholder="$t('oss.qiniuPrefixTips')"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="qiniuAccessKey" :label="$t('oss.qiniuAccessKey')">
|
||||
<el-input v-model="dataForm.qiniuAccessKey" :placeholder="$t('oss.qiniuAccessKeyTips')"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="qiniuSecretKey" :label="$t('oss.qiniuSecretKey')">
|
||||
<el-input v-model="dataForm.qiniuSecretKey" :placeholder="$t('oss.qiniuSecretKeyTips')"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="qiniuBucketName" :label="$t('oss.qiniuBucketName')">
|
||||
<el-input v-model="dataForm.qiniuBucketName" :placeholder="$t('oss.qiniuBucketNameTips')"></el-input>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<template v-else-if="dataForm.type === 2">
|
||||
<el-form-item size="mini">
|
||||
<a href="https://www.aliyun.com/minisite/goods?userCode=y93lfwbg" target="_blank">免费领取阿里云优惠券</a>
|
||||
</el-form-item>
|
||||
<el-form-item prop="aliyunDomain" :label="$t('oss.aliyunDomain')">
|
||||
<el-input v-model="dataForm.aliyunDomain" :placeholder="$t('oss.aliyunDomainTips')"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="aliyunPrefix" :label="$t('oss.aliyunPrefix')">
|
||||
<el-input v-model="dataForm.aliyunPrefix" :placeholder="$t('oss.aliyunPrefixTips')"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="aliyunEndPoint" :label="$t('oss.aliyunEndPoint')">
|
||||
<el-input v-model="dataForm.aliyunEndPoint" :placeholder="$t('oss.aliyunEndPointTips')"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="aliyunAccessKeyId" :label="$t('oss.aliyunAccessKeyId')">
|
||||
<el-input v-model="dataForm.aliyunAccessKeyId" :placeholder="$t('oss.aliyunAccessKeyIdTips')"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="aliyunAccessKeySecret" :label="$t('oss.aliyunAccessKeySecret')">
|
||||
<el-input v-model="dataForm.aliyunAccessKeySecret" :placeholder="$t('oss.aliyunAccessKeySecretTips')"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="aliyunBucketName" :label="$t('oss.aliyunBucketName')">
|
||||
<el-input v-model="dataForm.aliyunBucketName" :placeholder="$t('oss.aliyunBucketNameTips')"></el-input>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<template v-else-if="dataForm.type === 3">
|
||||
<el-form-item size="mini">
|
||||
<a href="https://curl.qcloud.com/zt3xdYbZ" target="_blank">免费领取腾讯云优惠券</a>
|
||||
</el-form-item>
|
||||
<el-form-item prop="qcloudDomain" :label="$t('oss.qcloudDomain')">
|
||||
<el-input v-model="dataForm.qcloudDomain" :placeholder="$t('oss.qcloudDomainTips')"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="qcloudPrefix" :label="$t('oss.qcloudPrefix')">
|
||||
<el-input v-model="dataForm.qcloudPrefix" :placeholder="$t('oss.qcloudPrefixTips')"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="qcloudAppId" :label="$t('oss.qcloudAppId')">
|
||||
<el-input v-model="dataForm.qcloudAppId" :placeholder="$t('oss.qcloudAppIdTips')"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="qcloudSecretId" :label="$t('oss.qcloudSecretId')">
|
||||
<el-input v-model="dataForm.qcloudSecretId" :placeholder="$t('oss.qcloudSecretIdTips')"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="qcloudSecretKey" :label="$t('oss.qcloudSecretKey')">
|
||||
<el-input v-model="dataForm.qcloudSecretKey" :placeholder="$t('oss.qcloudSecretKeyTips')"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="qcloudBucketName" :label="$t('oss.qcloudBucketName')">
|
||||
<el-input v-model="dataForm.qcloudBucketName" :placeholder="$t('oss.qcloudBucketNameTips')"></el-input>
|
||||
</el-form-item>
|
||||
<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-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-shanghai" :label="$t('oss.qcloudRegionShanghai')"></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-chongqing" :label="$t('oss.qcloudRegionChongqing')"></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="na-toronto" :label="$t('oss.qcloudRegionToronto')"></el-option>
|
||||
<el-option value="eu-frankfurt" :label="$t('oss.qcloudRegionFrankfurt')"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-form>
|
||||
<template slot="footer">
|
||||
<el-button @click="visible = false">{{ $t('cancel') }}</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<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-item :label="$t('oss.type')" size="mini">
|
||||
<el-radio-group v-model="dataForm.type">
|
||||
<el-radio :label="1">{{ $t('oss.type1') }}</el-radio>
|
||||
<el-radio :label="2">{{ $t('oss.type2') }}</el-radio>
|
||||
<el-radio :label="3">{{ $t('oss.type3') }}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<template v-if="dataForm.type === 1">
|
||||
<el-form-item size="mini">
|
||||
<a href="https://s.qiniu.com/7Rfaym" target="_blank">免费申请(七牛)10GB储存空间</a>
|
||||
</el-form-item>
|
||||
<el-form-item prop="qiniuDomain" :label="$t('oss.qiniuDomain')">
|
||||
<el-input v-model="dataForm.qiniuDomain" :placeholder="$t('oss.qiniuDomainTips')"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="qiniuPrefix" :label="$t('oss.qiniuPrefix')">
|
||||
<el-input v-model="dataForm.qiniuPrefix" :placeholder="$t('oss.qiniuPrefixTips')"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="qiniuAccessKey" :label="$t('oss.qiniuAccessKey')">
|
||||
<el-input v-model="dataForm.qiniuAccessKey" :placeholder="$t('oss.qiniuAccessKeyTips')"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="qiniuSecretKey" :label="$t('oss.qiniuSecretKey')">
|
||||
<el-input v-model="dataForm.qiniuSecretKey" :placeholder="$t('oss.qiniuSecretKeyTips')"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="qiniuBucketName" :label="$t('oss.qiniuBucketName')">
|
||||
<el-input v-model="dataForm.qiniuBucketName" :placeholder="$t('oss.qiniuBucketNameTips')"></el-input>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<template v-else-if="dataForm.type === 2">
|
||||
<el-form-item size="mini">
|
||||
<a href="https://www.aliyun.com/minisite/goods?userCode=y93lfwbg" target="_blank">免费领取阿里云优惠券</a>
|
||||
</el-form-item>
|
||||
<el-form-item prop="aliyunDomain" :label="$t('oss.aliyunDomain')">
|
||||
<el-input v-model="dataForm.aliyunDomain" :placeholder="$t('oss.aliyunDomainTips')"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="aliyunPrefix" :label="$t('oss.aliyunPrefix')">
|
||||
<el-input v-model="dataForm.aliyunPrefix" :placeholder="$t('oss.aliyunPrefixTips')"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="aliyunEndPoint" :label="$t('oss.aliyunEndPoint')">
|
||||
<el-input v-model="dataForm.aliyunEndPoint" :placeholder="$t('oss.aliyunEndPointTips')"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="aliyunAccessKeyId" :label="$t('oss.aliyunAccessKeyId')">
|
||||
<el-input v-model="dataForm.aliyunAccessKeyId" :placeholder="$t('oss.aliyunAccessKeyIdTips')"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="aliyunAccessKeySecret" :label="$t('oss.aliyunAccessKeySecret')">
|
||||
<el-input v-model="dataForm.aliyunAccessKeySecret" :placeholder="$t('oss.aliyunAccessKeySecretTips')"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="aliyunBucketName" :label="$t('oss.aliyunBucketName')">
|
||||
<el-input v-model="dataForm.aliyunBucketName" :placeholder="$t('oss.aliyunBucketNameTips')"></el-input>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<template v-else-if="dataForm.type === 3">
|
||||
<el-form-item size="mini">
|
||||
<a href="https://curl.qcloud.com/zt3xdYbZ" target="_blank">免费领取腾讯云优惠券</a>
|
||||
</el-form-item>
|
||||
<el-form-item prop="qcloudDomain" :label="$t('oss.qcloudDomain')">
|
||||
<el-input v-model="dataForm.qcloudDomain" :placeholder="$t('oss.qcloudDomainTips')"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="qcloudPrefix" :label="$t('oss.qcloudPrefix')">
|
||||
<el-input v-model="dataForm.qcloudPrefix" :placeholder="$t('oss.qcloudPrefixTips')"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="qcloudAppId" :label="$t('oss.qcloudAppId')">
|
||||
<el-input v-model="dataForm.qcloudAppId" :placeholder="$t('oss.qcloudAppIdTips')"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="qcloudSecretId" :label="$t('oss.qcloudSecretId')">
|
||||
<el-input v-model="dataForm.qcloudSecretId" :placeholder="$t('oss.qcloudSecretIdTips')"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="qcloudSecretKey" :label="$t('oss.qcloudSecretKey')">
|
||||
<el-input v-model="dataForm.qcloudSecretKey" :placeholder="$t('oss.qcloudSecretKeyTips')"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="qcloudBucketName" :label="$t('oss.qcloudBucketName')">
|
||||
<el-input v-model="dataForm.qcloudBucketName" :placeholder="$t('oss.qcloudBucketNameTips')"></el-input>
|
||||
</el-form-item>
|
||||
<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-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-shanghai" :label="$t('oss.qcloudRegionShanghai')"></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-chongqing" :label="$t('oss.qcloudRegionChongqing')"></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="na-toronto" :label="$t('oss.qcloudRegionToronto')"></el-option>
|
||||
<el-option value="eu-frankfurt" :label="$t('oss.qcloudRegionFrankfurt')"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-form>
|
||||
<template slot="footer">
|
||||
<el-button @click="visible = false">{{ $t('cancel') }}</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import debounce from 'lodash/debounce'
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
type: 0,
|
||||
qiniuDomain: '',
|
||||
qiniuPrefix: '',
|
||||
qiniuAccessKey: '',
|
||||
qiniuSecretKey: '',
|
||||
qiniuBucketName: '',
|
||||
aliyunDomain: '',
|
||||
aliyunPrefix: '',
|
||||
aliyunEndPoint: '',
|
||||
aliyunAccessKeyId: '',
|
||||
aliyunAccessKeySecret: '',
|
||||
aliyunBucketName: '',
|
||||
qcloudDomain: '',
|
||||
qcloudPrefix: '',
|
||||
qcloudAppId: 0,
|
||||
qcloudSecretId: '',
|
||||
qcloudSecretKey: '',
|
||||
qcloudBucketName: '',
|
||||
qcloudRegion: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
dataRule () {
|
||||
return {
|
||||
qiniuDomain: [
|
||||
{ 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' }
|
||||
],
|
||||
qiniuBucketName: [
|
||||
{ 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' }
|
||||
],
|
||||
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: {
|
||||
'dataForm.type' (val) {
|
||||
this.$refs['dataForm'].clearValidate()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init () {
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
this.getInfo()
|
||||
})
|
||||
},
|
||||
// 获取信息
|
||||
getInfo () {
|
||||
this.$http.get('/sys/oss/info').then(({ data: res }) => {
|
||||
if (res.code !== 0) {
|
||||
return this.$message.error(res.msg)
|
||||
}
|
||||
this.dataForm = res.data
|
||||
}).catch(() => {})
|
||||
},
|
||||
// 表单提交
|
||||
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 })
|
||||
}
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
type: 0,
|
||||
qiniuDomain: '',
|
||||
qiniuPrefix: '',
|
||||
qiniuAccessKey: '',
|
||||
qiniuSecretKey: '',
|
||||
qiniuBucketName: '',
|
||||
aliyunDomain: '',
|
||||
aliyunPrefix: '',
|
||||
aliyunEndPoint: '',
|
||||
aliyunAccessKeyId: '',
|
||||
aliyunAccessKeySecret: '',
|
||||
aliyunBucketName: '',
|
||||
qcloudDomain: '',
|
||||
qcloudPrefix: '',
|
||||
qcloudAppId: 0,
|
||||
qcloudSecretId: '',
|
||||
qcloudSecretKey: '',
|
||||
qcloudBucketName: '',
|
||||
qcloudRegion: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
dataRule() {
|
||||
return {
|
||||
qiniuDomain: [{ 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' }],
|
||||
qiniuBucketName: [{ 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' }],
|
||||
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: {
|
||||
'dataForm.type'(val) {
|
||||
this.$refs['dataForm'].clearValidate()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
this.getInfo()
|
||||
})
|
||||
},
|
||||
// 获取信息
|
||||
getInfo() {
|
||||
this.$http
|
||||
.get(this.$http.adornUrl('/sys/oss/info'))
|
||||
.then(({ data: res }) => {
|
||||
if (res.code !== 0) {
|
||||
return this.$message.error(res.msg)
|
||||
}
|
||||
this.dataForm = res.data
|
||||
})
|
||||
.catch(() => {})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmitHandle: debounce(
|
||||
function() {
|
||||
this.$refs['dataForm'].validate(valid => {
|
||||
if (!valid) {
|
||||
return false
|
||||
}
|
||||
this.$http
|
||||
.post(this.$http.adornUrl('/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>
|
||||
|
||||
@@ -1,65 +1,58 @@
|
||||
<template>
|
||||
<el-dialog :visible.sync="visible" :title="$t('oss.upload')" :close-on-click-modal="false" :close-on-press-escape="false">
|
||||
<el-upload
|
||||
:action="url"
|
||||
:file-list="fileList"
|
||||
drag
|
||||
multiple
|
||||
:before-upload="beforeUploadHandle"
|
||||
:on-success="successHandle"
|
||||
class="text-center">
|
||||
<i class="el-icon-upload"></i>
|
||||
<div class="el-upload__text" v-html="$t('upload.text')"></div>
|
||||
<div class="el-upload__tip" slot="tip">{{ $t('upload.tip', { 'format': 'jpg、png、gif' }) }}</div>
|
||||
</el-upload>
|
||||
</el-dialog>
|
||||
<el-dialog :visible.sync="visible" :title="$t('oss.upload')" :close-on-click-modal="false" :close-on-press-escape="false">
|
||||
<el-upload :action="url" :file-list="fileList" drag multiple :before-upload="beforeUploadHandle" :on-success="successHandle" class="text-center">
|
||||
<i class="el-icon-upload"></i>
|
||||
<div class="el-upload__text" v-html="$t('upload.text')"></div>
|
||||
<div class="el-upload__tip" slot="tip">{{ $t('upload.tip', { format: 'jpg、png、gif' }) }}</div>
|
||||
</el-upload>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Cookies from 'js-cookie'
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
visible: false,
|
||||
url: '',
|
||||
num: 0,
|
||||
fileList: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init () {
|
||||
this.visible = true
|
||||
this.url = `${window.SITE_CONFIG['apiURL']}/sys/oss/upload?token=${Cookies.get('token')}`
|
||||
this.num = 0
|
||||
this.fileList = []
|
||||
},
|
||||
// 上传之前
|
||||
beforeUploadHandle (file) {
|
||||
if (file.type !== 'image/jpg' && file.type !== 'image/jpeg' && file.type !== 'image/png' && file.type !== 'image/gif') {
|
||||
this.$message.error(this.$t('upload.tip', { 'format': 'jpg、png、gif' }))
|
||||
return false
|
||||
}
|
||||
this.num++
|
||||
},
|
||||
// 上传成功
|
||||
successHandle (res, file, fileList) {
|
||||
if (res.code !== 0) {
|
||||
return this.$message.error(res.msg)
|
||||
}
|
||||
this.fileList = fileList
|
||||
this.num--
|
||||
if (this.num === 0) {
|
||||
this.$message({
|
||||
message: this.$t('prompt.success'),
|
||||
type: 'success',
|
||||
duration: 500,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.$emit('refreshDataList')
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
url: '',
|
||||
num: 0,
|
||||
fileList: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
this.visible = true
|
||||
this.url = `${window.SITE_CONFIG['apiURL']}/sys/oss/upload?token=${Cookies.get('token')}`
|
||||
this.num = 0
|
||||
this.fileList = []
|
||||
},
|
||||
// 上传之前
|
||||
beforeUploadHandle(file) {
|
||||
if (file.type !== 'image/jpg' && file.type !== 'image/jpeg' && file.type !== 'image/png' && file.type !== 'image/gif') {
|
||||
this.$message.error(this.$t('upload.tip', { format: 'jpg、png、gif' }))
|
||||
return false
|
||||
}
|
||||
this.num++
|
||||
},
|
||||
// 上传成功
|
||||
successHandle(res, file, fileList) {
|
||||
if (res.code !== 0) {
|
||||
return this.$message.error(res.msg)
|
||||
}
|
||||
this.fileList = fileList
|
||||
this.num--
|
||||
if (this.num === 0) {
|
||||
this.$message({
|
||||
message: this.$t('prompt.success'),
|
||||
type: 'success',
|
||||
duration: 500,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.$emit('refreshDataList')
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,48 +1,43 @@
|
||||
<template>
|
||||
<el-card shadow="never" class="aui-card--fill">
|
||||
<div class="mod-oss__oss">
|
||||
<el-form :inline="true" :model="dataForm">
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="configHandle()">{{ $t('oss.config') }}</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="uploadHandle()">{{ $t('oss.upload') }}</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="danger" @click="deleteHandle()">{{ $t('deleteBatch') }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-table
|
||||
v-loading="dataListLoading"
|
||||
:data="dataList"
|
||||
border
|
||||
@selection-change="dataListSelectionChangeHandle"
|
||||
@sort-change="dataListSortChangeHandle"
|
||||
style="width: 100%;">
|
||||
<el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
|
||||
<el-table-column prop="url" :label="$t('oss.url')" header-align="center" align="center"></el-table-column>
|
||||
<el-table-column prop="createDate" :label="$t('oss.createDate')" sortable="custom" header-align="center" align="center" width="180"></el-table-column>
|
||||
<el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">{{ $t('delete') }}</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination
|
||||
:current-page="page"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:page-size="limit"
|
||||
:total="total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
@size-change="pageSizeChangeHandle"
|
||||
@current-change="pageCurrentChangeHandle">
|
||||
</el-pagination>
|
||||
<!-- 弹窗, 云存储配置 -->
|
||||
<config v-if="configVisible" ref="config"></config>
|
||||
<!-- 弹窗, 上传文件 -->
|
||||
<upload v-if="uploadVisible" ref="upload" @refreshDataList="getDataList"></upload>
|
||||
</div>
|
||||
</el-card>
|
||||
<el-card shadow="never" class="aui-card--fill">
|
||||
<div class="mod-oss__oss">
|
||||
<el-form :inline="true" :model="dataForm">
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="configHandle()">{{ $t('oss.config') }}</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="uploadHandle()">{{ $t('oss.upload') }}</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="danger" @click="deleteHandle()">{{ $t('deleteBatch') }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-table v-loading="dataListLoading" :data="dataList" border @selection-change="dataListSelectionChangeHandle" @sort-change="dataListSortChangeHandle" style="width: 100%;">
|
||||
<el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
|
||||
<el-table-column prop="url" :label="$t('oss.url')" header-align="center" align="center"></el-table-column>
|
||||
<el-table-column prop="createDate" :label="$t('oss.createDate')" sortable="custom" header-align="center" align="center" width="180"></el-table-column>
|
||||
<el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">{{ $t('delete') }}</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination
|
||||
:current-page="page"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:page-size="limit"
|
||||
:total="total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
@size-change="pageSizeChangeHandle"
|
||||
@current-change="pageCurrentChangeHandle"
|
||||
>
|
||||
</el-pagination>
|
||||
<!-- 弹窗, 云存储配置 -->
|
||||
<config v-if="configVisible" ref="config"></config>
|
||||
<!-- 弹窗, 上传文件 -->
|
||||
<upload v-if="uploadVisible" ref="upload" @refreshDataList="getDataList"></upload>
|
||||
</div>
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -50,39 +45,39 @@ import mixinViewModule from '@/mixins/view-module'
|
||||
import Config from './oss-config'
|
||||
import Upload from './oss-upload'
|
||||
export default {
|
||||
mixins: [mixinViewModule],
|
||||
data () {
|
||||
return {
|
||||
mixinViewModuleOptions: {
|
||||
getDataListURL: '/sys/oss/page',
|
||||
getDataListIsPage: true,
|
||||
deleteURL: '/sys/oss',
|
||||
deleteIsBatch: true
|
||||
},
|
||||
dataForm: {},
|
||||
configVisible: false,
|
||||
uploadVisible: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
Config,
|
||||
Upload
|
||||
},
|
||||
methods: {
|
||||
// 云存储配置
|
||||
configHandle () {
|
||||
this.configVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.config.init()
|
||||
})
|
||||
},
|
||||
// 上传文件
|
||||
uploadHandle () {
|
||||
this.uploadVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.upload.init()
|
||||
})
|
||||
}
|
||||
}
|
||||
mixins: [mixinViewModule],
|
||||
data() {
|
||||
return {
|
||||
mixinViewModuleOptions: {
|
||||
getDataListURL: '/sys/oss/page',
|
||||
getDataListIsPage: true,
|
||||
deleteURL: '/sys/oss',
|
||||
deleteIsBatch: true
|
||||
},
|
||||
dataForm: {},
|
||||
configVisible: false,
|
||||
uploadVisible: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
Config,
|
||||
Upload
|
||||
},
|
||||
methods: {
|
||||
// 云存储配置
|
||||
configHandle() {
|
||||
this.configVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.config.init()
|
||||
})
|
||||
},
|
||||
// 上传文件
|
||||
uploadHandle() {
|
||||
this.uploadVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.upload.init()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,154 +1,164 @@
|
||||
<template>
|
||||
<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-item prop="name" :label="$t('dept.name')">
|
||||
<el-input v-model="dataForm.name" :placeholder="$t('dept.name')"></el-input>
|
||||
</el-form-item>
|
||||
<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-tree
|
||||
:data="deptList"
|
||||
:props="{ label: 'name', children: 'children' }"
|
||||
node-key="id"
|
||||
ref="deptListTree"
|
||||
:highlight-current="true"
|
||||
:expand-on-click-node="false"
|
||||
accordion
|
||||
@current-change="deptListTreeCurrentChangeHandle">
|
||||
</el-tree>
|
||||
</el-popover>
|
||||
<el-input v-model="dataForm.parentName" v-popover:deptListPopover :readonly="true" :placeholder="$t('dept.parentName')">
|
||||
<i
|
||||
v-if="$store.state.user.superAdmin === 1 && dataForm.pid !== '0'"
|
||||
slot="suffix"
|
||||
@click.stop="deptListTreeSetDefaultHandle()"
|
||||
class="el-icon-circle-close el-input__icon">
|
||||
</i>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="sort" :label="$t('dept.sort')">
|
||||
<el-input-number v-model="dataForm.sort" controls-position="right" :min="0" :label="$t('dept.sort')"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template slot="footer">
|
||||
<el-button @click="visible = false">{{ $t('cancel') }}</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<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-item prop="name" :label="$t('dept.name')">
|
||||
<el-input v-model="dataForm.name" :placeholder="$t('dept.name')"></el-input>
|
||||
</el-form-item>
|
||||
<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-tree
|
||||
:data="deptList"
|
||||
:props="{ label: 'name', children: 'children' }"
|
||||
node-key="id"
|
||||
ref="deptListTree"
|
||||
:highlight-current="true"
|
||||
:expand-on-click-node="false"
|
||||
accordion
|
||||
@current-change="deptListTreeCurrentChangeHandle"
|
||||
>
|
||||
</el-tree>
|
||||
</el-popover>
|
||||
<el-input v-model="dataForm.parentName" v-popover:deptListPopover :readonly="true" :placeholder="$t('dept.parentName')">
|
||||
<i
|
||||
v-if="$store.state.user.superAdmin === 1 && dataForm.pid !== '0'"
|
||||
slot="suffix"
|
||||
@click.stop="deptListTreeSetDefaultHandle()"
|
||||
class="el-icon-circle-close el-input__icon"
|
||||
>
|
||||
</i>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="sort" :label="$t('dept.sort')">
|
||||
<el-input-number v-model="dataForm.sort" controls-position="right" :min="0" :label="$t('dept.sort')"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template slot="footer">
|
||||
<el-button @click="visible = false">{{ $t('cancel') }}</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import debounce from 'lodash/debounce'
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
visible: false,
|
||||
deptList: [],
|
||||
deptListVisible: false,
|
||||
dataForm: {
|
||||
id: '',
|
||||
name: '',
|
||||
pid: '',
|
||||
parentName: '',
|
||||
sort: 0
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
dataRule () {
|
||||
return {
|
||||
name: [
|
||||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
||||
],
|
||||
parentName: [
|
||||
{ required: true, message: this.$t('validate.required'), trigger: 'change' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init () {
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
this.getDeptList().then(() => {
|
||||
if (this.dataForm.id) {
|
||||
this.getInfo()
|
||||
} else if (this.$store.state.user.superAdmin === 1) {
|
||||
this.deptListTreeSetDefaultHandle()
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
// 获取部门列表
|
||||
getDeptList () {
|
||||
return this.$http.get('/sys/dept/list').then(({ data: res }) => {
|
||||
if (res.code !== 0) {
|
||||
return this.$message.error(res.msg)
|
||||
}
|
||||
this.deptList = res.data
|
||||
}).catch(() => {})
|
||||
},
|
||||
// 获取信息
|
||||
getInfo () {
|
||||
this.$http.get(`/sys/dept/${this.dataForm.id}`).then(({ data: res }) => {
|
||||
if (res.code !== 0) {
|
||||
return this.$message.error(res.msg)
|
||||
}
|
||||
this.dataForm = {
|
||||
...this.dataForm,
|
||||
...res.data
|
||||
}
|
||||
if (this.dataForm.pid === '0') {
|
||||
return this.deptListTreeSetDefaultHandle()
|
||||
}
|
||||
this.$refs.deptListTree.setCurrentKey(this.dataForm.pid)
|
||||
}).catch(() => {})
|
||||
},
|
||||
// 上级部门树, 设置默认值
|
||||
deptListTreeSetDefaultHandle () {
|
||||
this.dataForm.pid = '0'
|
||||
this.dataForm.parentName = this.$t('dept.parentNameDefault')
|
||||
},
|
||||
// 上级部门树, 选中
|
||||
deptListTreeCurrentChangeHandle (data) {
|
||||
this.dataForm.pid = data.id
|
||||
this.dataForm.parentName = data.name
|
||||
this.deptListVisible = false
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmitHandle: debounce(function () {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (!valid) {
|
||||
return false
|
||||
}
|
||||
this.$http[!this.dataForm.id ? 'post' : 'put']('/sys/dept', 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 })
|
||||
}
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
deptList: [],
|
||||
deptListVisible: false,
|
||||
dataForm: {
|
||||
id: '',
|
||||
name: '',
|
||||
pid: '',
|
||||
parentName: '',
|
||||
sort: 0
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
dataRule() {
|
||||
return {
|
||||
name: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }],
|
||||
parentName: [{ required: true, message: this.$t('validate.required'), trigger: 'change' }]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
this.getDeptList().then(() => {
|
||||
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 }) => {
|
||||
if (res.code !== 0) {
|
||||
return this.$message.error(res.msg)
|
||||
}
|
||||
this.deptList = res.data
|
||||
})
|
||||
.catch(() => {})
|
||||
},
|
||||
// 获取信息
|
||||
getInfo() {
|
||||
this.$http
|
||||
.get(this.$http.adornUrl(`/sys/dept/${this.dataForm.id}`))
|
||||
.then(({ data: res }) => {
|
||||
if (res.code !== 0) {
|
||||
return this.$message.error(res.msg)
|
||||
}
|
||||
this.dataForm = {
|
||||
...this.dataForm,
|
||||
...res.data
|
||||
}
|
||||
if (this.dataForm.pid === '0') {
|
||||
return this.deptListTreeSetDefaultHandle()
|
||||
}
|
||||
this.$refs.deptListTree.setCurrentKey(this.dataForm.pid)
|
||||
})
|
||||
.catch(() => {})
|
||||
},
|
||||
// 上级部门树, 设置默认值
|
||||
deptListTreeSetDefaultHandle() {
|
||||
this.dataForm.pid = '0'
|
||||
this.dataForm.parentName = this.$t('dept.parentNameDefault')
|
||||
},
|
||||
// 上级部门树, 选中
|
||||
deptListTreeCurrentChangeHandle(data) {
|
||||
this.dataForm.pid = data.id
|
||||
this.dataForm.parentName = data.name
|
||||
this.deptListVisible = false
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmitHandle: debounce(
|
||||
function() {
|
||||
this.$refs['dataForm'].validate(valid => {
|
||||
if (!valid) {
|
||||
return false
|
||||
}
|
||||
this.$http[!this.dataForm.id ? 'post' : 'put']('/sys/dept', 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>
|
||||
|
||||
<style lang="scss">
|
||||
.mod-sys__dept {
|
||||
.dept-list {
|
||||
.el-input__inner,
|
||||
.el-input__suffix {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
.dept-list {
|
||||
.el-input__inner,
|
||||
.el-input__suffix {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,43 +1,43 @@
|
||||
<template>
|
||||
<el-card shadow="never" class="aui-card--fill">
|
||||
<div class="mod-sys__dept">
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<el-form-item>
|
||||
<el-button v-if="$hasPermission('sys:dept:save')" type="primary" @click="addOrUpdateHandle()">{{ $t('add') }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-table v-loading="dataListLoading" :data="dataList" row-key="id" border style="width: 100%;">
|
||||
<el-table-column prop="name" :label="$t('dept.name')" header-align="center" min-width="150"></el-table-column>
|
||||
<el-table-column prop="parentName" :label="$t('dept.parentName')" header-align="center" align="center"></el-table-column>
|
||||
<el-table-column prop="sort" :label="$t('dept.sort')" header-align="center" align="center" width="80"></el-table-column>
|
||||
<el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-button v-if="$hasPermission('sys:dept:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">{{ $t('update') }}</el-button>
|
||||
<el-button v-if="$hasPermission('sys:dept:delete')" type="text" size="small" @click="deleteHandle(scope.row.id)">{{ $t('delete') }}</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 弹窗, 新增 / 修改 -->
|
||||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
|
||||
</div>
|
||||
</el-card>
|
||||
<el-card shadow="never" class="aui-card--fill">
|
||||
<div class="mod-sys__dept">
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<el-form-item>
|
||||
<el-button v-if="$hasPermission('sys:dept:save')" type="primary" @click="addOrUpdateHandle()">{{ $t('add') }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-table v-loading="dataListLoading" :data="dataList" row-key="id" border style="width: 100%;">
|
||||
<el-table-column prop="name" :label="$t('dept.name')" header-align="center" min-width="150"></el-table-column>
|
||||
<el-table-column prop="parentName" :label="$t('dept.parentName')" header-align="center" align="center"></el-table-column>
|
||||
<el-table-column prop="sort" :label="$t('dept.sort')" header-align="center" align="center" width="80"></el-table-column>
|
||||
<el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-button v-if="$hasPermission('sys:dept:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">{{ $t('update') }}</el-button>
|
||||
<el-button v-if="$hasPermission('sys:dept:delete')" type="text" size="small" @click="deleteHandle(scope.row.id)">{{ $t('delete') }}</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 弹窗, 新增 / 修改 -->
|
||||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
|
||||
</div>
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import mixinViewModule from '@/mixins/view-module'
|
||||
import AddOrUpdate from './dept-add-or-update'
|
||||
export default {
|
||||
mixins: [mixinViewModule],
|
||||
data () {
|
||||
return {
|
||||
mixinViewModuleOptions: {
|
||||
getDataListURL: '/sys/dept/list',
|
||||
deleteURL: '/sys/dept'
|
||||
}
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate
|
||||
}
|
||||
mixins: [mixinViewModule],
|
||||
data() {
|
||||
return {
|
||||
mixinViewModuleOptions: {
|
||||
getDataListURL: '/sys/dept/list',
|
||||
deleteURL: '/sys/dept'
|
||||
}
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user