From 117d4f37840c1973fa2ae0c501dc7647786e903b Mon Sep 17 00:00:00 2001
From: 祖安之光 <11848914+light-of-zuan@user.noreply.gitee.com>
Date: Fri, 20 Mar 2026 09:59:26 +0800
Subject: [PATCH] 修改名字
---
src/views/usermng/warning.vue | 472 +++++++++++++++++++++++++++++-----------------------------
1 files changed, 238 insertions(+), 234 deletions(-)
diff --git a/src/views/usermng/warning.vue b/src/views/usermng/warning.vue
index 2f5b15b..561975c 100644
--- a/src/views/usermng/warning.vue
+++ b/src/views/usermng/warning.vue
@@ -8,7 +8,8 @@
type="primary"
icon="el-icon-refresh"
@click="refreshHandle"
- >刷新</el-button>
+ >刷新
+ </el-button>
<el-select v-model="queryForm.enterprisetype" clearable placeholder="请选择企业类型">
<el-option
class="filter-item"
@@ -145,7 +146,8 @@
v-if="getBtnPermission('edit')"
type="text"
@click="showEditHandle(scope.row)"
- >编辑</el-button>
+ >编辑
+ </el-button>
</template>
</el-table-column>
</el-table>
@@ -182,7 +184,7 @@
label="警告类型:"
prop="type"
>
- {{dataForm.warntype}}
+ {{ dataForm.warntype }}
</el-form-item>
<el-form-item
label="计算周期(天):"
@@ -220,7 +222,8 @@
<el-button
type="primary"
@click="updateHandle()"
- >确认</el-button>
+ >确认
+ </el-button>
</div>
</el-dialog>
<el-dialog
@@ -242,13 +245,13 @@
label="警告类型:"
prop="type"
>
- {{dataForm.warntype}}
+ {{ dataForm.warntype }}
</el-form-item>
<el-form-item
label="企业类型:"
prop="type"
>
- {{dataForm.enterprisetype}}
+ {{ dataForm.enterprisetype }}
</el-form-item>
<el-form-item
label="预警值:"
@@ -280,247 +283,248 @@
<el-button
type="primary"
@click="updateStockHandle()"
- >确认</el-button>
+ >确认
+ </el-button>
</div>
</el-dialog>
- <div style="clear: both;" />
+ <div style="clear: both;"/>
</div>
</template>
<script>
- import { mapGetters } from 'vuex'
- import { getWarningList, editWarningInfo } from '@/api/warning'
- import { parseTime, computePageCount } from '@/utils'
- import { parseError } from '@/utils/messageDialog'
- import Cookies from 'js-cookie'
- import { Message, MessageBox } from 'element-ui'
- import { dictionaryAllItems } from '@/api/dictionary';
- import { checkBtnPermission } from '@/utils/permission'
+import {mapGetters} from 'vuex'
+import {getWarningList, editWarningInfo} from '@/api/warning'
+import {parseTime, computePageCount} from '@/utils'
+import {parseError} from '@/utils/messageDialog'
+import Cookies from 'js-cookie'
+import {Message, MessageBox} from 'element-ui'
+import {dictionaryAllItems} from '@/api/dictionary';
+import {checkBtnPermission} from '@/utils/permission'
- export default {
- name: 'warning',
- filters: {
- parseSms(value) {
- if (value == 1) {
- return '是'
- } else {
- return '否'
- }
- },
- },
- computed: {
- ...mapGetters([
- 'userType'
- ])
- },
- data() {
- return {
- sort:'id',
- order:'asc',
- pageSize: 10,
- recordTotal: 0,
- currentPage: 1,
- pageTotal: 0,
- tableKey: 0,
- warningData: null,
- listLoading: true,
- queryForm: {
- warntype: '',
- enterprisetype:'',
- },
- enterpriseTypeList:[],
- warnTypeList:[],
-
- dataForm: {
- id: '',
- warntype: '',
- period: '',
- enterprisetype: '',
- issms: '',
- minimum: '',
- maximum: '',
- },
- dialogFormVisible: false,
- dialogStockFormVisible: false,
- dataFormRules: {
- minimum: [{ required: true, message: '预警值不能为空', trigger: 'blur' }],
- maximum: [{ required: true, message: '报警值不能为空', trigger: 'blur' }],
- },
-
-
+export default {
+ name: 'warning',
+ filters: {
+ parseSms(value) {
+ if (value == 1) {
+ return '是'
+ } else {
+ return '否'
}
},
- created() {
- this.getWarningList()
- this.getDictionaryEnterpriseType()
- this.getDictionaryWarnType()
- },
- methods: {
- getWarningList() {
- const _this = this
- const params = {}
- params['sort'] = _this.sort
- params['order'] = _this.order
- params['pageIndex'] = _this.currentPage
- params['pageSize'] = _this.pageSize
- for (const i in _this.queryForm) {
- if (_this.queryForm[i] != undefined && _this.queryForm[i].toString() != '') {
- params[i] = _this.queryForm[i]
- }
- }
- _this.listLoading = true
- getWarningList(params).then(response => {
- const res = response.data
- if (res.code == 200) {
- const result = res.result;
- _this.recordTotal = result.totalCount
- _this.pageSize = result.pageSize
- _this.pageTotal = computePageCount(result.totalCount, result.pageSize)
- _this.currentPage = result.pageIndex
- _this.warningData = result.result
- } else {
- parseError({ error: res.message, vm: _this })
- }
- _this.listLoading = false
- }).catch(error => {
- _this.listLoading = false
- parseError({ error: error, vm: _this })
- })
+ },
+ computed: {
+ ...mapGetters([
+ 'userType'
+ ])
+ },
+ data() {
+ return {
+ sort: 'id',
+ order: 'asc',
+ pageSize: 10,
+ recordTotal: 0,
+ currentPage: 1,
+ pageTotal: 0,
+ tableKey: 0,
+ warningData: null,
+ listLoading: true,
+ queryForm: {
+ warntype: '',
+ enterprisetype: '',
},
- getDictionaryEnterpriseType() {
- const _this = this
- if (_this.enterpriseTypeList && _this.enterpriseTypeList.length > 0) {
- return
- }
- const params = {}
- params['dictionaryType'] = '安全监管分类'
- dictionaryAllItems(params).then(response => {
- const res = response.data
- if (res.code == 200) {
- _this.enterpriseTypeList = res.result
- } else {
- parseError({ error: res.message, vm: _this })
- }
- }).catch(error => {
- parseError({ error: error, vm: _this })
- })
+ enterpriseTypeList: [],
+ warnTypeList: [],
+
+ dataForm: {
+ id: '',
+ warntype: '',
+ period: '',
+ enterprisetype: '',
+ issms: '',
+ minimum: '',
+ maximum: '',
},
- getDictionaryWarnType() {
- const _this = this
- if (_this.warnTypeList && _this.warnTypeList.length > 0) {
- return
- }
- const params1 = {}
- params1['dictionaryType'] = '警告类型'
- dictionaryAllItems(params1).then(response => {
- const res = response.data
- if (res.code == 200) {
- _this.warnTypeList = res.result
- } else {
- parseError({ error: res.message, vm: _this })
- }
- }).catch(error => {
- parseError({ error: error, vm: _this })
- })
- },
- refreshHandle: function() {
- this.getWarningList()
- },
- queryHandle: function() {
- this.currentPage = 1
- this.getWarningList()
- },
- sortWarningChange: function(param){
- this.sort = param.prop;
- this.order = param.order;
- this.getWarningList()
- },
- handleSizeChange: function(val) {
- this.pageSize = val
- this.currentPage = 1
- this.getWarningList()
- },
- handleCurrentChange: function(val) {
- this.currentPage = val
- this.getWarningList()
- },
- getBtnPermission(btnType) {
- return checkBtnPermission(this.userType, btnType)
- },
- resetDataForm() {
- this.dataForm = {
- id: '',
- warntype: '',
- period: '',
- enterprisetype: '',
- issms: '',
- minimum: '',
- maximum: '',
- }
- },
- showEditHandle: function(row) {
- this.resetDataForm()
- this.dataForm.id = row.id
- this.dataForm.warntype = row.warntype
- this.dataForm.period = row.period
- this.dataForm.enterprisetype = row.enterprisetype
- this.dataForm.issms = row.issms
- this.dataForm.minimum = row.minimum
- this.dataForm.maximum = row.maximum
- if (this.dataForm.warntype == '购买超量'){
- this.dialogFormVisible = true
- this.$nextTick(() => {
- this.$refs['dataForm'].clearValidate()
- })
- }else {
- this.dialogStockFormVisible = true
- }
- },
- updateHandle() {
- this.$refs['dataForm'].validate((valid) => {
- const _this = this
- if (valid) {
- editWarningInfo(_this.dataForm).then(response => {
- const res = response.data
- if (res.code == 200) {
- _this.dialogFormVisible = false
- _this.$message({
- message: '更新成功',
- type: 'success'
- })
- _this.getWarningList()
- } else {
- parseError({ error: res.message, vm: _this })
- }
- }).catch(error => {
- parseError({ error: error, vm: _this })
- })
- }
- })
- },
- updateStockHandle() {
- this.$refs['dataForm'].validate((valid) => {
- const _this = this
- if (valid) {
- editWarningInfo(_this.dataForm).then(response => {
- const res = response.data
- if (res.code == 200) {
- _this.dialogStockFormVisible = false
- _this.$message({
- message: '更新成功',
- type: 'success'
- })
- _this.getWarningList()
- } else {
- parseError({ error: res.message, vm: _this })
- }
- }).catch(error => {
- parseError({ error: error, vm: _this })
- })
- }
- })
+ dialogFormVisible: false,
+ dialogStockFormVisible: false,
+ dataFormRules: {
+ minimum: [{required: true, message: '预警值不能为空', trigger: 'blur'}],
+ maximum: [{required: true, message: '报警值不能为空', trigger: 'blur'}],
},
+
}
+ },
+ created() {
+ this.getWarningList()
+ this.getDictionaryEnterpriseType()
+ this.getDictionaryWarnType()
+ },
+ methods: {
+ getWarningList() {
+ const _this = this
+ const params = {}
+ params['sort'] = _this.sort
+ params['order'] = _this.order
+ params['pageIndex'] = _this.currentPage
+ params['pageSize'] = _this.pageSize
+ for (const i in _this.queryForm) {
+ if (_this.queryForm[i] != undefined && _this.queryForm[i].toString() != '') {
+ params[i] = _this.queryForm[i]
+ }
+ }
+ _this.listLoading = true
+ getWarningList(params).then(response => {
+ const res = response.data
+ if (res.code == 200) {
+ const result = res.result;
+ _this.recordTotal = result.totalCount
+ _this.pageSize = result.pageSize
+ _this.pageTotal = computePageCount(result.totalCount, result.pageSize)
+ _this.currentPage = result.pageIndex
+ _this.warningData = result.result
+ } else {
+ parseError({error: res.message, vm: _this})
+ }
+ _this.listLoading = false
+ }).catch(error => {
+ _this.listLoading = false
+ parseError({error: error, vm: _this})
+ })
+ },
+ getDictionaryEnterpriseType() {
+ const _this = this
+ if (_this.enterpriseTypeList && _this.enterpriseTypeList.length > 0) {
+ return
+ }
+ const params = {}
+ params['dictionaryType'] = '安全监管分类'
+ dictionaryAllItems(params).then(response => {
+ const res = response.data
+ if (res.code == 200) {
+ _this.enterpriseTypeList = res.result
+ } else {
+ parseError({error: res.message, vm: _this})
+ }
+ }).catch(error => {
+ parseError({error: error, vm: _this})
+ })
+ },
+ getDictionaryWarnType() {
+ const _this = this
+ if (_this.warnTypeList && _this.warnTypeList.length > 0) {
+ return
+ }
+ const params1 = {}
+ params1['dictionaryType'] = '警告类型'
+ dictionaryAllItems(params1).then(response => {
+ const res = response.data
+ if (res.code == 200) {
+ _this.warnTypeList = res.result
+ } else {
+ parseError({error: res.message, vm: _this})
+ }
+ }).catch(error => {
+ parseError({error: error, vm: _this})
+ })
+ },
+ refreshHandle: function () {
+ this.getWarningList()
+ },
+ queryHandle: function () {
+ this.currentPage = 1
+ this.getWarningList()
+ },
+ sortWarningChange: function (param) {
+ this.sort = param.prop;
+ this.order = param.order;
+ this.getWarningList()
+ },
+ handleSizeChange: function (val) {
+ this.pageSize = val
+ this.currentPage = 1
+ this.getWarningList()
+ },
+ handleCurrentChange: function (val) {
+ this.currentPage = val
+ this.getWarningList()
+ },
+ getBtnPermission(btnType) {
+ return checkBtnPermission(this.userType, btnType)
+ },
+ resetDataForm() {
+ this.dataForm = {
+ id: '',
+ warntype: '',
+ period: '',
+ enterprisetype: '',
+ issms: '',
+ minimum: '',
+ maximum: '',
+ }
+ },
+ showEditHandle: function (row) {
+ this.resetDataForm()
+ this.dataForm.id = row.id
+ this.dataForm.warntype = row.warntype
+ this.dataForm.period = row.period
+ this.dataForm.enterprisetype = row.enterprisetype
+ this.dataForm.issms = row.issms
+ this.dataForm.minimum = row.minimum
+ this.dataForm.maximum = row.maximum
+ if (this.dataForm.warntype == '购买超量') {
+ this.dialogFormVisible = true
+ this.$nextTick(() => {
+ this.$refs['dataForm'].clearValidate()
+ })
+ } else {
+ this.dialogStockFormVisible = true
+ }
+ },
+ updateHandle() {
+ this.$refs['dataForm'].validate((valid) => {
+ const _this = this
+ if (valid) {
+ editWarningInfo(_this.dataForm).then(response => {
+ const res = response.data
+ if (res.code == 200) {
+ _this.dialogFormVisible = false
+ _this.$message({
+ message: '更新成功',
+ type: 'success'
+ })
+ _this.getWarningList()
+ } else {
+ parseError({error: res.message, vm: _this})
+ }
+ }).catch(error => {
+ parseError({error: error, vm: _this})
+ })
+ }
+ })
+ },
+ updateStockHandle() {
+ this.$refs['dataForm'].validate((valid) => {
+ const _this = this
+ if (valid) {
+ editWarningInfo(_this.dataForm).then(response => {
+ const res = response.data
+ if (res.code == 200) {
+ _this.dialogStockFormVisible = false
+ _this.$message({
+ message: '更新成功',
+ type: 'success'
+ })
+ _this.getWarningList()
+ } else {
+ parseError({error: res.message, vm: _this})
+ }
+ }).catch(error => {
+ parseError({error: error, vm: _this})
+ })
+ }
+ })
+ },
+
}
+}
</script>
--
Gitblit v1.9.2