code init

This commit is contained in:
chenxiaoxi
2021-05-25 18:06:45 +08:00
parent 02698d6dab
commit f54a8d4fa1
1367 changed files with 540755 additions and 21713 deletions
@@ -0,0 +1,872 @@
<!--预警管理--预警条款-->
<template>
<div class="warning-clause v-class">
<el-form inline :model="standardForm" ref="ruleForm" class="label-input-form">
<div class="search-area-item">
<el-form-item :label="$t('m.dateOfEnforcement')" class="serch-form-item">
<el-date-picker
v-model="materialDate"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
</el-form-item>
<el-form-item :label="$t('m.warningDate')" class="serch-form-item btn-box">
<el-date-picker
v-model="warningDate"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
</el-form-item>
<el-form-item class="serch-form-item btn-box">
<el-button
icon="el-icon-search"
type="primary"
class="searchAngNewBtn"
@click="searchStandLaws"></el-button>
</el-form-item>
<el-form-item class="serch-form-item btn-box">
<el-button
type="primary"
class="searchAngNewBtn"
@click="resetSelect">{{$t('m.clearQuery')}}</el-button>
</el-form-item>
</div>
<div class="search-area-item">
<!-- <el-form-item class="serch-form-item btn-box">-->
<!-- <el-button-->
<!-- type="primary"-->
<!-- class="searchAngNewBtn"-->
<!-- @click="standsAdd(1, null)"-->
<!-- v-btn-permission="'SDXRQ8LV6K'"-->
<!-- >新增</el-button>-->
<!-- </el-form-item>-->
<!-- <el-form-item class="serch-form-item btn-box">-->
<!-- <el-button-->
<!-- type="primary"-->
<!-- class="searchAngNewBtn"-->
<!-- @click="warningStandardsDel"-->
<!-- v-btn-permission="'SDXRQ8LV6K'"-->
<!-- >导出</el-button>-->
<!-- </el-form-item>-->
<!-- <el-form-item class="serch-form-item btn-box">-->
<!-- <el-button-->
<!-- type="danger"-->
<!-- class="searchAngNewBtn"-->
<!-- @click="warningStandardsDel"-->
<!-- v-btn-permission="'ATBANPLHCM'">删除</el-button>-->
<!-- </el-form-item>-->
</div>
</el-form>
<!-- :reserve-selection="true" -->
<div class="content">
<div class="action-bar">
<el-button type="primary" size="mini" @click="standsAdd(1, null)">新增</el-button>
<el-button type="danger" size="mini" @click="warningStandardsDel">批量删除</el-button>
<el-button type="primary" size="mini" @click="exportStandard('apart')" v-btn-permission="'J2X4KHNN4N'">导出</el-button>
<el-button type="primary" size="mini" @click="exportStandard('all')" v-btn-permission="'NLDJF75Msde'">全部导出</el-button>
</div>
<div class="table-wrap">
<el-table
ref="selection"
:data="warningData"
tooltip-effect="dark"
style="width: 100%"
border
row-key="id"
:header-cell-style="{background: '#f8f8f9', color: '#515a6e'}"
@selection-change="handleSelectionChange"
height="100%"
>
<el-table-column
type="selection"
width="55"
align="center">
</el-table-column>
<el-table-column
prop="standNum"
:label="$t('m.standardNumber')"
align="center"
>
</el-table-column>
<el-table-column
prop="itemsName"
:label="$t('m.name')"
align="center">
</el-table-column>
<el-table-column
prop="describes"
:label="$t('m.content')"
align="center">
</el-table-column>
<el-table-column
prop="putTime"
:label="$t('m.putTime')"
align="center">
</el-table-column>
<el-table-column
prop="creationTime"
:label="$t('m.warningDate')"
align="center">
</el-table-column>
<el-table-column :label="$t('m.action')" align="center">
<template slot-scope="scope">
<!-- <el-button-->
<!-- class="opera-btn"-->
<!-- size="mini"-->
<!-- type="primary"-->
<!-- @click="standsAdd(3, scope.row)">查看</el-button>-->
<el-button
class="opera-btn"
size="mini"
type="warning"
v-btn-permission="'VWUD78DHGM'"
@click="standsAdd(2, scope.row)">{{$t('m.edit')}}</el-button>
<el-button
class="opera-btn"
size="mini"
type="danger"
v-btn-permission="'GAPG2L7CWP'"
@click="classDel(scope.row)">{{$t('m.delete')}}</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
<!--分页-->
<pagination
:page="tableFlag === '' ? standardForm.page : tableFlag.page"
:total="total"
@pageChange="pageChange"
@pageSizeChange="pageSizeChange"></pagination>
<loading :loading="loading">数据获取中</loading>
<!--新增抽屉-->
<!-- :class="classObject"-->
<el-drawer
:title="title"
:visible.sync="dialogState"
direction="rtl"
custom-class="demo-drawer"
ref="drawer"
size="800px"
:before-close="handleClose"
>
<div class="demo-drawer__content" v-if="this.oprState === 1 || this.oprState === 2">
<el-form :model="warningModelData" ref="warningModelData" :rules="classRules">
<el-row>
<el-col :span="12">
<el-form-item label="条目名称"
prop="itemName"
:label-width="formLabelWidth"
class="add-form-item">
<el-input
v-model.trim="warningModelData.itemName"
autocomplete="off"
clearable
placeholder="请点击按钮选择"></el-input>
</el-form-item>
</el-col>
<el-row>
<el-col :span="12">
<el-form-item label="" class="add-form-item">
<el-button
type="primary"
class="chooseBtn"
@click="openDialog"
>选择</el-button>
</el-form-item>
</el-col>
</el-row>
<el-col :span="12">
<el-form-item label="预警信息分类"
:label-width="formLabelWidth"
prop="sarPutType"
class="add-form-item">
<!-- @change="getAddSelectCountry"-->
<el-select v-model="warningModelData.sarPutType" placeholder="请选择预警信息分类">
<el-option v-for="type in typeOptions" :label="type.label" :value="type.value === undefined ? '' :type.value" :key="type.value">{{ type.label }}</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="实施日期"
class="add-form-item"
:label-width="formLabelWidth"
prop="putTime">
<el-date-picker
v-model="warningModelData.putTime"
value-format="yyyy-MM-dd"
type="date"
placeholder="请选择实施日期">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="预警日期"
class="add-form-item"
:label-width="formLabelWidth"
prop="creationTime">
<el-date-picker
v-model="warningModelData.creationTime"
value-format="yyyy-MM-dd"
type="date"
placeholder="请选择预警日期">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div class="demo-drawer__footer">
<el-button size="mini" @click="closeModal('warningModelData')">取 消</el-button>
<el-button size="mini" type="primary" @click="saveWarning('warningModelData')">提交</el-button>
</div>
</div>
<div class="demo-drawer__content" v-else>
<div class="check-item-row">
<div class="check-item-col1">
<div class="check-item-label"> 选项:</div>
<div class="check-item-value">{{warningModelData.dicTypeName}}</div>
</div>
<div class="check-item-col1">
<div class="check-item-label">排序号:</div>
<div class="check-item-value">{{warningModelData.showIndex}}</div>
</div>
</div>
<div class="check-item-row">
<div class="check-item-col2">
<div class="check-item-label">描述:</div>
<div class="check-item-value">{{warningModelData.describes}}</div>
</div>
<div class="check-item-col2">
<div class="check-item-label"></div>
<div class="check-item-value"></div>
</div>
</div>
</div>
</el-drawer>
<!--内部弹窗-->
<el-dialog title="条目" :visible.sync="chooseDialog">
<el-table
ref="multipleTable"
:data="stahndinfoList"
tooltip-effect="dark"
style="width: 100%"
border
class="drag-table"
:header-cell-style="{background: '#f8f8f9', color: '#515a6e'}"
@selection-change="standSelectChange">
<el-table-column
type="selection"
width="55"
align="center">
</el-table-column>
<el-table-column
prop="itemsNum"
label="条目号"
align="center"
>
</el-table-column>
<el-table-column
prop="itemsName"
label="条目名称"
align="center">
</el-table-column>
<el-table-column
prop="remarks"
label="备注"
align="center">
</el-table-column>
<el-table-column
prop="standName"
label="标准名称"
align="center">
</el-table-column>
<el-table-column
prop="standNum"
label="标准编号"
align="center">
</el-table-column>
<!-- <el-table-column-->
<!-- prop="standStateShow"-->
<!-- label="标准状态"-->
<!-- align="center">-->
<!-- </el-table-column>-->
</el-table>
<pagination
class="pagination"
:page="configPage"
:total="configTotal"
@pageChange="configuraPageChange"
@pageSizeChange="configuraPageSizeChange">
</pagination>
<div slot="footer" class="dialog-footer">
<el-button size="mini" @click="chooseDialog = false">取 消</el-button>
<el-button size="mini" type="primary" @click="submitStand">确 定</el-button>
</div>
</el-dialog>
<!--导出文件改名字模态框-->
<el-dialog :visible.sync="exportModelFlag" title="导出文件" width="30%">
<el-form :inline="true" class="label-input-form">
<el-form-item label="导出名称" class="serch-form-item">
<el-input v-model="exportName" placeholder="请输入导出文件名称" :maxlength="30" clearable label="导出名称"/>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" class="searchAngNewBtn" size="mini" @click="exportTestItem">确定</el-button>
<el-button type="primary" class="searchAngNewBtn" size="mini" @click="cancal">取消</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
export default {
name: 'warningClause',
data () {
return {
tableHeight: null,
// 查询条件
standardForm: {
// 实施日期
putTime1: '',
putTime2: '',
// 预警日期
creationTime1: '',
creationTime2: '',
pageSize: this.$store.getters.userInfo.configContent,
page: 1,
warnType: 'ITEM'
},
page: 1,
tableFlag: '',
// 实施日期中间变量
putTime1: '',
putTime2: '',
// 预警日期中间变量
creationTime1: '',
creationTime2: '',
// 实施日期
materialDate: [],
// 预警日期
warningDate: [],
total: 0,
rows: 10,
loading: false,
// 列表数据
warningData: [],
// 抽屉打开
dialogState: false,
// form-item label宽度
formLabelWidth: '80px',
// 新增弹窗数据
warningModelData: {
// 预警时间
creationTime: '',
// 预警信息分类
sarPutType: '',
// 实施日期
putTime: '',
// 判断法规类型是国内还是国外,从内部弹窗里查
sarType: '',
// 条目名称
itemName: '',
// 标准id
sarId: '',
// 条目id
itemId: '',
// 预警类型
warnType: 'ITEM'
},
// 弹窗标题
title: '',
typeOptions: [
{
label: '新车型条款预警',
value: 'NEWCAR'
},
{
label: '在产车条款预警',
value: 'PRODUCT'
}
],
configPage: 1,
configTotal: 0,
configRows: 10,
stahndinfoList: [],
// 表单验证
classRules: {
itemName: [
{required: true, message: '条目名称不能为空', trigger: 'change'}
],
sarPutType: [
{required: true, message: '预警信息分类不能为空', trigger: 'change'}
],
putTime: [
{required: true, message: '实施日期不能为空', trigger: 'blur'}
],
creationTime: [
{required: true, message: '预警日期不能为空', trigger: 'blur'}
]
},
// 中间变量
standName1: '',
describes1: '',
standCode1: '',
// 判断是新增or 编辑 or 查看
oprState: 0,
// 多选时接收选中行数据
selectNum: [],
singleSelection: [],
// 选择标准弹窗
chooseDialog: false,
sarStandardsSearch: {
page: 1,
pageSize: this.$store.getters.userInfo.configContent
},
// 导出文件模态框控制,和文件名称
saveExportType: '',
exportModelFlag: false,
exportName: '',
SarExportSearchEo: {}
}
},
methods: {
// 多选
// 多选
handleSelectionChange (val) {
const data = []
val.map((item) => {
data.push(item.id)
})
this.selectNum = data.toString()
console.log('this.selectNum', this.selectNum)
},
standSelectChange (val) {
this.singleSelection = val
console.log('this.singleSelection', this.singleSelection)
if (this.singleSelection.length > 1) {
this.$message({
message: '最多只能选择一条警告',
type: 'warning'
})
this.$refs.multipleTable.clearSelection()
}
},
// 条件查询
searchStandLaws () {
this.page = 1
// this.tableFlag = item
this.pageChange(1)
this.standardForm.putTime1 = this.materialDate[0]
this.standardForm.putTime2 = this.materialDate[1]
this.standardForm.creationTime1 = this.warningDate[0]
this.standardForm.creationTime2 = this.warningDate[0]
this.putTime1 = this.standardForm.putTime1
this.putTime2 = this.standardForm.putTime2
this.creationTime1 = this.standardForm.creationTime1
this.creationTime2 = this.standardForm.creationTime2
// 执行列表查询
this.getStandLawsByPage()
},
// 分页查询
getStandLawsByPage (item, flag) {
if (item) {
item.pageSize = this.$store.getters.userInfo.configContent
}
const data = {}
flag && (this.standardForm.page = this.page)
data.putTime1 = this.putTime1
data.putTime2 = this.putTime2
data.creationTime1 = this.creationTime1
data.creationTime2 = this.creationTime2
data.page = this.standardForm.page
data.pageSize = this.standardForm.pageSize
data.warnType = this.standardForm.warnType
this.standardForm.pageSize = this.$store.getters.userInfo.configContent
this.SarExportSearchEo = item || this.standardForm
this.loading = true
this.$http.get('lawss/msgSarPutTime/page', item || data, {
_this: this,
loading: this.loading
}, res => {
if (res.ok) {
this.warningData = res.data.list
this.total = res.data.count
this.loading = false
}
}, e => {
})
},
// 清空查询
resetSelect () {
this.page = 1
this.standardForm.putTime1 = ''
this.standardForm.putTime2 = ''
this.standardForm.creationTime1 = ''
this.standardForm.creationTime2 = ''
this.putTime1 = ''
this.putTime2 = ''
this.creationTime1 = ''
this.creationTime2 = ''
this.materialDate = []
this.warningDate = []
// 执行列表查询
this.getStandLawsByPage(this.tableFlag, 1)
},
// 新增,编辑弹窗打开
standsAdd (oprState, row) {
this.oprState = oprState
if (this.oprState === 1) {
this.title = '新增'
this.dialogState = true
} else {
this.title = '编辑'
this.warningModelData = row
this.warningModelData.itemName = row.itemsName
this.dialogState = true
}
},
// 新增预警标准确定
saveWarning () {
this.$refs['warningModelData'].validate((valid) => {
if (valid) {
if (this.oprState === 1) {
this.$http.post('lawss/msgSarPutTime/addmsgSarPutTime', this.warningModelData, {
_this: this
}, res => {
if (res.ok) {
this.closeModal()
} else {
this.dialogState = true
}
})
} else {
this.$http.post('lawss/msgSarPutTime/updateemsgSarPutTime', this.warningModelData, {
_this: this
}, res => {
if (res.ok) {
this.closeModal()
} else {
this.dialogState = true
}
})
}
} else {
}
})
},
// 取消
closeModal () {
this.page = 1
this.getStandLawsByPage(this.tableFlag, 1)
this.warningModelData = {
// 预警时间
creationTime: '',
// 预警信息分类
sarPutType: '',
// 实施日期
putTime: '',
// 判断法规类型是国内还是国外,从内部弹窗里查
sarType: '',
// 标准名称
itemName: '',
// 标准id
sarId: '',
// 条目id
itemId: '',
// 预警类型
warnType: 'ITEM'
}
this.$nextTick(() => {
this.$refs['warningModelData'].resetFields()
})
this.dialogState = false
},
// 关闭弹窗
handleClose () {
this.page = 1
this.getStandLawsByPage(this.tableFlag, 1)
this.warningModelData = {
// 预警时间
creationTime: '',
// 预警信息分类
sarPutType: '',
// 实施日期
putTime: '',
// 判断法规类型是国内还是国外,从内部弹窗里查
sarType: '',
// 标准名称
itemName: '',
// 标准id
sarId: '',
// 条目id
itemId: '',
// 预警类型
warnType: 'ITEM'
}
this.$nextTick(() => {
if (this.$refs['warningModelData']) {
this.$refs['warningModelData'].resetFields()
}
})
this.dialogState = false
},
// 打开选择弹窗
openDialog () {
this.getDomesticStandardTable()
this.chooseDialog = true
},
submitStand () {
console.log('this.singleSelection', this.singleSelection)
this.warningModelData.itemName = this.singleSelection[0].itemsName
this.warningModelData.sarType = this.singleSelection[0].itemsType
this.warningModelData.sarId = this.singleSelection[0].standId
this.warningModelData.itemId = this.singleSelection[0].id
this.chooseDialog = false
console.log('this.warningModelData', this.warningModelData)
this.$refs.multipleTable.clearSelection()
this.singleSelection = []
},
// 分页查询国内标准
getDomesticStandardTable (item) {
this.sarStandardsSearch.page = this.configPage
this.sarStandardsSearch.validFlag = 0
this.$http.get('lawss/sarStandItems/getSarStandItemsList', this.sarStandardsSearch, {
_this: this, loading: 'loading'
}, res => {
if (res.ok) {
const arr = res.data.list
this.stahndinfoList = arr
this.configTotal = res.data.count
this.$nextTick(() => {
this.stahndinfoList.map((item) => {
if (this.warningModelData.sarId === item.id) {
this.singleSelection.push(item)
this.$refs.multipleTable.toggleRowSelection(item, true)
}
})
})
}
}, e => {
})
},
// 删除
classDel (row) {
this.$confirm('确认删除该条数据?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http.post('lawss/msgSarPutTime/deletemsgSarPutTime', {
ids: row.id
}, {
_this: this, loading: 'loading'
}, res => {
if (res.ok) {
this.$message({
showClose: true,
message: '删除成功',
type: 'success'
})
this.page = 1
this.getStandLawsByPage(this.tableFlag, 1)
}
})
})
},
// 批量删除
warningStandardsDel () {
if (this.selectNum.length === 0) {
this.$message.error('请先选择要删除的数据!')
} else {
this.$confirm('确认删除选中数据?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http.post('lawss/msgSarPutTime/deletemsgSarPutTime', {ids: this.selectNum}, {
_this: this
}, res => {
if (res.ok) {
this.$message({
showClose: true,
message: '删除成功',
type: 'success'
})
this.page = 1
this.getStandLawsByPage(this.tableFlag, 1)
this.selectNum = []
}
}, e => {
})
}).catch(() => {
// 取消删除,清空选择
// this.$refs.selections.clearSelection()
})
}
},
// 导出选中的标准 此处因为复选框没有设置好,所以先设置导出所有数据
exportStandard (type) {
// 区别是选择导出还是全部导出
this.saveExportType = type
if (type === 'apart') {
if (this.selectNum.length > 0) {
this.exportName = ''
this.exportModelFlag = true
} else {
this.$message({
message: '请先选择要导出的数据',
type: 'warning'
})
}
} else {
this.exportName = ''
this.exportModelFlag = true
}
},
// 导出确定功能
exportTestItem () {
if (this.saveExportType === 'apart') {
if (this.selectNum != null && this.selectNum !== '') {
window.open('/api/lawss/msgSarPutTime/exportStandardsInfoExcel?exportType=' + this.saveExportType + '&exportContent=' + this.selectNum + '&exportName=' + this.exportName)
this.$message.success('导出信息成功')
}
} else if (this.saveExportType === 'all') {
// if (this.SarExportSearchEo.dicTypeCode === '') {
// delete this.SarExportSearchEo.dicTypeCode
// }
// let exportEO = this.tableFlag === '' ? this.standardForm : this.tableFlag
let exportEOStr = JSON.stringify(this.SarExportSearchEo)
exportEOStr = exportEOStr.replace(/""/g, null)
window.open('/api/lawss/msgSarPutTime/exportStandardsInfoExcel?exportType=' + this.saveExportType + '&exportContent=' + exportEOStr + '&exportName=' + this.exportName)
this.$message.success('导出信息成功')
}
this.exportModelFlag = false
},
// 导出取消按钮关闭模态、置空
cancal () {
this.exportModelFlag = false
},
pageChange (page) {
let pageObj
if (this.tableFlag !== '') {
this.tableFlag.page = page
pageObj = this.tableFlag
} else {
this.standardForm.page = page
pageObj = this.standardForm
}
this.getStandLawsByPage(pageObj)
},
pageSizeChange (pageSize) {
this.standardForm.pageSize = this.$store.getters.userInfo.configContent
this.rows = pageSize
this.getStandLawsByPage(this.tableFlag)
},
// 分页点击后方法
configuraPageChange (page) {
this.configPage = page
this.getDomesticStandardTable()
},
// 分页每页显示数改变后方法
configuraPageSizeChange (pageSize) {
this.sarStandardsSearch.pageSize = this.$store.getters.userInfo.configContent
this.configRows = pageSize
// this.selectConfiguraStand()
this.getDomesticStandardTable()
// 此处需要调用接口,修改个人配置
}
},
mounted () {
this.getStandLawsByPage()
this.tableHeight = $('.content').height() - 44
window.onresize = () => {
this.tableHeight = $('.content').height() - 44
}
}
}
</script>
<style lang="less" scoped>
.warning-clause {
position: relative;
height: 100%;
padding: 10px 10px 0;
background: #fff;
display: flex;
flex-direction: column;
.label-input-form {
display: flex;
justify-content: space-between;
}
.action-bar {
margin-bottom: 5px;
}
.content{
width: 100%;
flex: auto;
overflow-y: auto;
display: flex;
flex-direction: column;
padding: 0;
.table-wrap {
flex: auto;
overflow: hidden;
}
}
.demo-drawer__content{
// border: 1px solid #ccc;
padding: 0 15px;
}
.chooseBtn{
height: 32px;
padding: 0 15px;
color: #fff;
background-color: #3391CE;
border-color: #3391CE;
&.is-disabled {
background-color: #b0d3ed !important;
border-color: #bcd1e0 !important;
}
}
.chooseBtn:hover {
padding: 0 15px;
background-color: #3391CE;
border-color: #3391CE;
}
.chooseBtn:focus {
padding: 0 15px;
}
.el-form--inline {
.el-form-item {
margin-right: 5px;
&:last-child {
margin-right: 0;
}
/deep/.el-form-item__content {
line-height: normal;
}
}
}
.action-bar {
line-height: normal;
padding: 0;
margin-bottom: 10px;
}
.pagination {
position: static;
/deep/.pagination-slot {
padding: 0;
}
}
.el-range-separator {
width: auto;
}
}
</style>
@@ -0,0 +1,860 @@
<!--预警管理--预警标准-->
<template>
<div class="warning-standard v-class">
<div class="search-area">
<div class="left">
<el-form :inline="true" :model="standardForm" ref="ruleForm" class="label-input-form">
<el-form-item :label="$t('m.putTime')" class="search-item">
<el-date-picker
v-model="materialDate"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
</el-form-item>
<el-form-item :label="$t('m.warningDate')" class="search-item">
<el-date-picker
v-model="warningDate"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
</el-form-item>
<el-form-item class="search-item btn-box">
<el-button
icon="el-icon-search"
type="primary"
class="common-button-primary"
round
@click="searchStandLaws"></el-button>
</el-form-item>
<el-form-item class="search-item btn-box">
<el-button
class="common-button-default"
icon="el-icon-refresh-left"
round
@click="resetSelect"></el-button>
</el-form-item>
</el-form>
</div>
<div class="right"></div>
</div>
<!-- :reserve-selection="true" -->
<div class="content">
<div class="action-bar">
<el-button type="primary" size="mini" @click="standsAdd(1, null)">新增</el-button>
<el-button type="danger" size="mini" @click="warningStandardsDel">批量删除</el-button>
<el-button type="primary" size="mini" @click="exportStandard('apart')" v-btn-permission="'J2X4KHNN4N'">导出</el-button>
<el-button type="primary" size="mini" @click="exportStandard('all')" v-btn-permission="'NLDJF75Msde'">全部导出</el-button>
</div>
<div class="table-wrap">
<el-table
ref="selection"
:data="warningData"
tooltip-effect="dark"
style="width: 100%"
border
row-key="id"
:header-cell-style="{background: '#f8f8f9', color: '#515a6e'}"
@selection-change="handleSelectionChange"
height="100%"
>
<el-table-column
type="selection"
width="55"
align="center">
</el-table-column>
<el-table-column
prop="standNum"
:label="$t('m.standardNumber')"
align="center"
>
</el-table-column>
<el-table-column
prop="standName"
:label="$t('m.name')"
align="center">
</el-table-column>
<!-- <el-table-column-->
<!-- prop="describes"-->
<!-- label="内容"-->
<!-- width="400"-->
<!-- align="center">-->
<!-- </el-table-column>-->
<el-table-column
prop="putTime"
:label="$t('m.dateOfEnforcement')"
align="center">
</el-table-column>
<el-table-column
prop="creationTime"
:label="$t('m.warningDate')"
align="center">
</el-table-column>
<el-table-column :label="$t('m.action')" align="center">
<template slot-scope="scope">
<!-- <el-button-->
<!-- class="opera-btn"-->
<!-- size="mini"-->
<!-- type="primary"-->
<!-- @click="standsAdd(3, scope.row)">查看</el-button>-->
<el-button
class="opera-btn"
size="mini"
type="warning"
v-btn-permission="'VWUD78DHGM'"
@click="standsAdd(2, scope.row)">{{$t('m.edit')}}</el-button>
<el-button
class="opera-btn"
size="mini"
type="danger"
v-btn-permission="'GAPG2L7CWP'"
@click="classDel(scope.row)">{{$t('m.delete')}}</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
<!--分页-->
<pagination
:page="tableFlag === '' ? standardForm.page : tableFlag.page"
:total="total"
@pageChange="pageChange"
@pageSizeChange="pageSizeChange"></pagination>
<loading :loading="loading">数据获取中</loading>
<!--新增抽屉-->
<!-- :class="classObject"-->
<el-drawer
:title="title"
:visible.sync="dialogState"
direction="rtl"
custom-class="demo-drawer"
ref="drawer"
size="800px"
:before-close="handleClose"
>
<div class="demo-drawer__content" v-if="this.oprState === 1 || this.oprState === 2">
<el-form :model="warningModelData" ref="warningModelData" :rules="classRules">
<el-row>
<el-col :span="12">
<el-form-item :label="$t('m.standName')"
prop="standName"
:label-width="formLabelWidth"
class="add-form-item">
<el-input v-model="warningModelData.standName" readonly placeholder="请点击按钮选择"></el-input>
</el-form-item>
</el-col>
<!-- <el-row>-->
<el-col :span="12">
<el-form-item label="" class="add-form-item">
<el-button
type="primary"
class="chooseBtn"
@click="openDialog"
>{{$t('m.select')}}</el-button>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item :label="$t('m.classificationOfEarlyWarningInformation')"
:label-width="formLabelWidth"
prop="sarPutType"
class="add-form-item">
<!-- @change="getAddSelectCountry"-->
<el-select v-model="warningModelData.sarPutType" :placeholder="$t('m.pleaseSelectWarningInformationClassification')">
<el-option v-for="type in typeOptions" :label="type.label" :value="type.value === undefined ? '' :type.value" :key="type.value">{{ type.label }}</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('m.putTime')"
class="add-form-item"
:label-width="formLabelWidth"
prop="putTime">
<el-date-picker
v-model="warningModelData.putTime"
value-format="yyyy-MM-dd"
type="date"
:placeholder="$t('m.selectImplementationDate')">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item :label="$t('m.warningDate')"
class="add-form-item"
:label-width="formLabelWidth"
prop="creationTime">
<el-date-picker
v-model="warningModelData.creationTime"
value-format="yyyy-MM-dd"
type="date"
:placeholder="$t('m.pleaseSselectWarningDate')">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div class="demo-drawer__footer">
<el-button size="mini" @click="closeModal('warningModelData')">{{$t('m.cancel')}}</el-button>
<el-button size="mini" type="primary" @click="saveWarning('warningModelData')">{{$t('m.submit')}}</el-button>
</div>
</div>
<div class="demo-drawer__content" v-else>
<div class="check-item-row">
<div class="check-item-col1">
<div class="check-item-label"> 选项:</div>
<div class="check-item-value">{{warningModelData.dicTypeName}}</div>
</div>
<div class="check-item-col1">
<div class="check-item-label">排序号:</div>
<div class="check-item-value">{{warningModelData.showIndex}}</div>
</div>
</div>
<div class="check-item-row">
<div class="check-item-col2">
<div class="check-item-label">描述:</div>
<div class="check-item-value">{{warningModelData.describes}}</div>
</div>
<div class="check-item-col2">
<div class="check-item-label"></div>
<div class="check-item-value"></div>
</div>
</div>
</div>
</el-drawer>
<!--内部弹窗-->
<el-dialog title="标准" :visible.sync="chooseDialog">
<el-table
ref="multipleTable"
:data="stahndinfoList"
tooltip-effect="dark"
style="width: 100%"
border
class="drag-table"
:header-cell-style="{background: '#f8f8f9', color: '#515a6e'}"
@selection-change="standSelectChange">
<el-table-column
type="selection"
width="55"
align="center">
</el-table-column>
<el-table-column
prop="standNumber"
label="标准号"
align="center"
>
</el-table-column>
<el-table-column
prop="standName"
label="标准名称"
align="center">
</el-table-column>
<el-table-column
prop="regionShow"
label="区域"
align="center">
</el-table-column>
<el-table-column
prop="countryShow"
label="国家/地区"
align="center">
</el-table-column>
<!-- <el-table-column-->
<!-- prop="standNatureShow"-->
<!-- label="标准性质"-->
<!-- align="center">-->
<!-- </el-table-column>-->
<el-table-column
prop="standStateShow"
label="标准状态"
align="center">
</el-table-column>
</el-table>
<pagination
class="pagination"
:page="configPage"
:total="configTotal"
@pageChange="configuraPageChange"
@pageSizeChange="configuraPageSizeChange">
</pagination>
<div slot="footer" class="dialog-footer">
<el-button size="mini" @click="chooseDialog = false">取 消</el-button>
<el-button size="mini" type="primary" @click="submitStand">确 定</el-button>
</div>
</el-dialog>
<!--导出文件改名字模态框-->
<el-dialog :visible.sync="exportModelFlag" title="导出文件" width="30%">
<el-form :inline="true" class="label-input-form">
<el-form-item label="导出名称" class="serch-form-item">
<el-input v-model="exportName" placeholder="请输入导出文件名称" :maxlength="30" clearable label="导出名称"/>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" class="searchAngNewBtn" size="mini" @click="exportTestItem">确定</el-button>
<el-button type="primary" class="searchAngNewBtn" size="mini" @click="cancal">取消</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
export default {
name: 'warningStandard',
data () {
return {
// 查询条件
standardForm: {
// 实施日期
putTime1: '',
putTime2: '',
// 预警日期
creationTime1: '',
creationTime2: '',
pageSize: this.$store.getters.userInfo.configContent,
page: 1,
warnType: 'STAND'
},
page: 1,
// 实施日期中间变量
putTime1: '',
putTime2: '',
// 预警日期中间变量
creationTime1: '',
creationTime2: '',
// 实施日期
materialDate: [],
// 预警日期
warningDate: [],
total: 0,
rows: 10,
loading: false,
// 列表数据
warningData: [],
// 抽屉打开
dialogState: false,
// form-item label宽度
formLabelWidth: '100px',
// 新增弹窗数据
warningModelData: {
// 预警类型
warnType: 'STAND',
// 预警时间
creationTime: '',
// 预警信息分类
sarPutType: '',
// 实施日期
putTime: '',
// 判断法规类型是国内还是国外,从内部弹窗里查
sarType: '',
// 标准名称
standName: '',
// 标准id
sarId: ''
//
},
// 弹窗标题
title: '',
typeOptions: [
{
label: '在产车实施日期预警',
value: 'PRODUCT'
},
{
label: '新定型车实施预期预警',
value: 'NEWCAR'
},
{
label: '新生产车实施日期预警',
value: 'NEWPRODUCT'
}
],
configPage: 1,
configTotal: 0,
configRows: 10,
stahndinfoList: [],
// 表单验证
classRules: {
standName: [
{required: true, message: '标准名称不能为空', trigger: 'change'}
],
sarPutType: [
{required: true, message: '预警信息分类不能为空', trigger: 'change'}
],
putTime: [
{required: true, message: '实施日期不能为空', trigger: 'blur'}
],
creationTime: [
{required: true, message: '预警日期不能为空', trigger: 'blur'}
]
},
// 中间变量
standName1: '',
describes1: '',
standCode1: '',
// 判断是新增or 编辑 or 查看
oprState: 0,
// 多选时接收选中行数据
selectNum: [],
// 单选
singleSelection: [],
// 选择标准弹窗
chooseDialog: false,
sarStandardsSearch: {
page: 1,
pageSize: this.$store.getters.userInfo.configContent
},
// 导出文件模态框控制,和文件名称
saveExportType: '',
exportModelFlag: false,
exportName: '',
SarExportSearchEo: {},
tableFlag: ''
}
},
methods: {
// 多选
handleSelectionChange (val) {
const data = []
val.map((item) => {
data.push(item.id)
})
this.selectNum = data.toString()
console.log('this.selectNum', this.selectNum)
},
standSelectChange (val) {
this.singleSelection = val
console.log('this.singleSelection', this.singleSelection)
if (this.singleSelection.length > 1) {
this.$message({
message: '最多只能选择一条警告',
type: 'warning'
})
this.$refs.multipleTable.clearSelection()
}
},
// 条件查询
searchStandLaws () {
this.page = 1
// this.tableFlag = item
this.pageChange(1)
this.standardForm.putTime1 = this.materialDate[0]
this.standardForm.putTime2 = this.materialDate[1]
this.standardForm.creationTime1 = this.warningDate[0]
this.standardForm.creationTime2 = this.warningDate[1]
this.putTime1 = this.standardForm.putTime1
this.putTime2 = this.standardForm.putTime2
this.creationTime1 = this.standardForm.creationTime1
this.creationTime2 = this.standardForm.creationTime2
// 执行列表查询
this.getStandLawsByPage()
},
// 分页查询
getStandLawsByPage (item, flag) {
if (item) {
item.pageSize = this.$store.getters.userInfo.configContent
}
const data = {}
flag && (this.standardForm.page = this.page)
data.putTime1 = this.putTime1
data.putTime2 = this.putTime2
data.creationTime1 = this.creationTime1
data.creationTime2 = this.creationTime2
data.page = this.standardForm.page
data.pageSize = this.standardForm.pageSize
data.warnType = this.standardForm.warnType
this.standardForm.pageSize = this.$store.getters.userInfo.configContent
this.SarExportSearchEo = item || this.standardForm
this.loading = true
this.$http.get('lawss/msgSarPutTime/page', item || data, {
_this: this,
loading: this.loading
}, res => {
if (res.ok) {
this.warningData = res.data.list
this.total = res.data.count
this.loading = false
}
}, e => {
})
},
// 清空查询
resetSelect () {
this.page = 1
this.standardForm.putTime1 = ''
this.standardForm.putTime2 = ''
this.standardForm.creationTime1 = ''
this.standardForm.creationTime2 = ''
this.putTime1 = ''
this.putTime2 = ''
this.creationTime1 = ''
this.creationTime2 = ''
this.materialDate = []
this.warningDate = []
// 执行列表查询
this.getStandLawsByPage(this.tableFlag, 1)
},
// 新增,编辑弹窗打开
standsAdd (oprState, row) {
this.oprState = oprState
if (this.oprState === 1) {
this.title = '新增'
this.dialogState = true
this.$nextTick(() => {
if (this.$refs['warningModelData']) {
this.$refs['warningModelData'].resetFields()
}
})
} else {
this.title = '编辑'
this.warningModelData = row
this.dialogState = true
}
},
// 新增预警标准确定
saveWarning () {
this.$refs['warningModelData'].validate((valid) => {
if (valid) {
if (this.oprState === 1) {
this.$http.post('lawss/msgSarPutTime/addmsgSarPutTime', this.warningModelData, {
_this: this
}, res => {
if (res.ok) {
this.closeModal()
} else {
this.dialogState = true
}
})
} else {
this.$http.post('lawss/msgSarPutTime/updateemsgSarPutTime', this.warningModelData, {
_this: this
}, res => {
if (res.ok) {
this.closeModal()
} else {
this.dialogState = true
}
})
}
} else {
}
})
},
// 取消
closeModal () {
this.page = 1
this.getStandLawsByPage()
this.warningModelData = {
// 预警类型
warnType: 'STAND',
// 预警时间
creationTime: '',
// 预警信息分类
sarPutType: '',
// 实施日期
putTime: '',
// 判断法规类型是国内还是国外,从内部弹窗里查
sarType: '',
// 标准名称
standName: '',
// 标准id
sarId: ''
}
this.$nextTick(() => {
this.$refs['warningModelData'].resetFields()
})
this.dialogState = false
},
// 关闭弹窗
handleClose () {
this.page = 1
this.getStandLawsByPage(this.tableFlag, 1)
this.warningModelData = {
// 预警类型
warnType: 'STAND',
// 预警时间
creationTime: '',
// 预警信息分类
sarPutType: '',
// 实施日期
putTime: '',
// 判断法规类型是国内还是国外,从内部弹窗里查
sarType: '',
// 标准名称
standName: '',
// 标准id
sarId: ''
}
this.$nextTick(() => {
if (this.$refs['warningModelData']) {
this.$refs['warningModelData'].resetFields()
}
})
this.dialogState = false
},
// 打开选择弹窗
openDialog () {
// this.singleSelection = []
this.getDomesticStandardTable()
this.chooseDialog = true
},
// 分页查询国内标准
getDomesticStandardTable (item) {
this.sarStandardsSearch.page = this.configPage
this.sarStandardsSearch.validFlag = 0
this.$http.get('lawss/sarStandardsInfo/getSarStandardsInfoPage', this.sarStandardsSearch, {
_this: this, loading: 'loading'
}, res => {
if (res.ok) {
const arr = res.data.list
this.stahndinfoList = arr
this.configTotal = res.data.count
this.$nextTick(() => {
this.stahndinfoList.map((item) => {
if (this.warningModelData.sarId === item.id) {
this.singleSelection.push(item)
this.$refs.multipleTable.toggleRowSelection(item, true)
}
})
})
}
}, e => {
})
},
submitStand () {
this.warningModelData.standName = this.singleSelection[0].standName
this.warningModelData.sarType = this.singleSelection[0].standType
this.warningModelData.sarId = this.singleSelection[0].id
this.chooseDialog = false
this.$refs.multipleTable.clearSelection()
this.singleSelection = []
},
// 删除
classDel (row) {
this.$confirm('确认删除该条数据?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
confirmButtonClass: 'common-button-primary',
roundButton: true
}).then(() => {
this.$http.post('lawss/msgSarPutTime/deletemsgSarPutTime', {
ids: row.id
}, {
_this: this, loading: 'loading'
}, res => {
if (res.ok) {
this.$message({
showClose: true,
message: '删除成功',
type: 'success'
})
this.page = 1
this.getStandLawsByPage(this.tableFlag, 1)
}
})
})
},
// 批量删除
warningStandardsDel () {
if (this.selectNum.length === 0) {
this.$message.error('请先选择要删除的数据!')
} else {
this.$confirm('确认删除选中数据?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
confirmButtonClass: 'common-button-primary',
roundButton: true
}).then(() => {
this.$http.post('lawss/msgSarPutTime/deletemsgSarPutTime', {ids: this.selectNum}, {
_this: this
}, res => {
if (res.ok) {
this.$message({
showClose: true,
message: '删除成功',
type: 'success'
})
this.page = 1
this.getStandLawsByPage(this.tableFlag, 1)
this.selectNum = []
}
}, e => {
})
}).catch(() => {
// 取消删除,清空选择
// this.$refs.selections.clearSelection()
})
}
},
// 导出选中的标准 此处因为复选框没有设置好,所以先设置导出所有数据
exportStandard (type) {
// 区别是选择导出还是全部导出
this.saveExportType = type
if (type === 'apart') {
if (this.selectNum.length > 0) {
this.exportName = ''
this.exportModelFlag = true
} else {
this.$message({
message: '请先选择要导出的数据',
type: 'warning'
})
}
} else {
this.exportName = ''
this.exportModelFlag = true
}
},
// 导出确定功能
exportTestItem () {
if (this.saveExportType === 'apart') {
if (this.selectNum != null && this.selectNum !== '') {
window.open('/api/lawss/msgSarPutTime/exportStandardsInfoExcel?exportType=' + this.saveExportType + '&exportContent=' + this.selectNum + '&exportName=' + this.exportName)
this.$message.success('导出信息成功')
}
} else if (this.saveExportType === 'all') {
// if (this.SarExportSearchEo.dicTypeCode === '') {
// delete this.SarExportSearchEo.dicTypeCode
// }
// let exportEO = this.tableFlag === '' ? this.standardForm : this.tableFlag
let exportEOStr = JSON.stringify(this.SarExportSearchEo)
exportEOStr = exportEOStr.replace(/""/g, null)
window.open('/api/lawss/msgSarPutTime/exportStandardsInfoExcel?exportType=' + this.saveExportType + '&exportContent=' + exportEOStr + '&exportName=' + this.exportName)
this.$message.success('导出信息成功')
}
this.exportModelFlag = false
},
// 导出取消按钮关闭模态、置空
cancal () {
this.exportModelFlag = false
},
pageChange (page) {
let pageObj
if (this.tableFlag !== '') {
this.tableFlag.page = page
pageObj = this.tableFlag
} else {
this.standardForm.page = page
pageObj = this.standardForm
}
this.getStandLawsByPage(pageObj)
},
pageSizeChange (pageSize) {
this.standardForm.pageSize = this.$store.getters.userInfo.configContent
this.rows = pageSize
this.getStandLawsByPage(this.tableFlag)
},
// 分页点击后方法
configuraPageChange (page) {
this.configPage = page
this.getDomesticStandardTable()
},
// 分页每页显示数改变后方法
configuraPageSizeChange (pageSize) {
this.sarStandardsSearch.pageSize = this.$store.getters.userInfo.configContent
this.configRows = pageSize
// this.selectConfiguraStand()
this.getDomesticStandardTable()
// 此处需要调用接口,修改个人配置
}
},
mounted () {
this.getStandLawsByPage()
}
}
</script>
<style lang="less" scoped>
.warning-standard {
position: relative;
height: 100%;
padding: 10px 10px 0;
background: #fff;
display: flex;
flex-direction: column;
.action-bar {
margin-bottom: 5px;
}
.content {
padding: 0;
width: 100%;
flex: auto;
overflow-y: auto;
display: flex;
flex-direction: column;
.table-wrap {
flex: auto;
overflow: hidden;
}
}
.demo-drawer__content{
// border: 1px solid #ccc;
padding: 0 15px;
.demo-drawer__footer {
width: 100%;
position: absolute;
bottom: 0;
left: 0;
border-top: 1px solid #e8e8e8;
padding: 10px 16px;
text-align: right;
background: #fff;
z-index: 999;
.el-button {
width: 60px;
height: 32px;
}
}
}
.chooseBtn{
height: 32px;
padding: 0 15px;
color: #fff;
background-color: #3391CE;
border-color: #3391CE;
&.is-disabled {
background-color: #b0d3ed !important;
border-color: #bcd1e0 !important;
}
}
.chooseBtn:hover {
padding: 0 15px;
background-color: #3391CE;
border-color: #3391CE;
}
.chooseBtn:focus {
padding: 0 15px;
}
.el-form--inline {
.el-form-item {
margin-right: 5px;
&:last-child {
margin-right: 0;
}
/deep/.el-form-item__content {
line-height: normal;
}
}
}
.action-bar {
line-height: normal;
padding: 0;
margin-bottom: 10px;
}
.pagination {
position: static;
/deep/.pagination-slot {
padding: 0;
}
}
}
</style>
@@ -0,0 +1,46 @@
<template>
<div class="regulatory-repository v-class">
<panel-header :tabs="tabsList" @activated="showComponent" :active="active"></panel-header>
<panel-content>
<transition enter-active-class="" leave-active-class="">
<components :is="active"></components>
</transition>
</panel-content>
</div>
</template>
<script>
import warningStandard from './components/warningStandard'
import warningClause from './components/warningClause'
export default {
name: 'warningManage',
components: {
warningClause,
warningStandard
},
data () {
return {
active: 'warningStandard',
tabsList: [ {
title: this.$t('m.earlyWarningStandard'),
name: 'warningStandard'
}, {
title: this.$t('m.earlyWarningClause'),
name: 'warningClause'
}]
}
},
methods: {
// tabs 切换事件
showComponent (name) {
this.active = name
}
}
}
</script>
<style lang="less" scoped>
.regulatory-repository{
height: 100%;
}
</style>