liujun0708-动火作业流程图逻辑修改
parent
c055b24d14
commit
8b2cb2dff5
|
@ -0,0 +1,317 @@
|
||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<div class="filter-container">
|
||||||
|
<el-input v-model="KEYWORDS" placeholder="搜索" class="filter-item" style="width: 200px;" />
|
||||||
|
<el-button class="filter-item" type="primary" icon="el-icon-search" @click="getQuery">
|
||||||
|
搜索
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
<el-table ref="multipleTable" :data="varList" :header-cell-style="{'font-weight': 'bold','color': '#000'}" tooltip-effect="dark" border fit highlight-current-row>
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column type="index" label="序号" width="50" align="center" />
|
||||||
|
<el-table-column prop="NAME" label="名称" width="180" />
|
||||||
|
<el-table-column prop="CONTENT" label="内容" show-overflow-tooltip="true" />
|
||||||
|
<el-table-column prop="DEPARTMENT_NAME" width="180" align="center" label="附件" >
|
||||||
|
<template v-if="row.FILE_URL" slot-scope="{row}">
|
||||||
|
<el-button type="primary" icon="el-icon-down" size="mini" @click="download(row)">下载</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column label="操作" align="center" width="300">
|
||||||
|
<template slot-scope="{row}">
|
||||||
|
<el-button type="primary" icon="el-icon-document" size="mini" @click="handleDetail(row)">查看</el-button>
|
||||||
|
<el-button type="primary" icon="el-icon-edit" size="mini" @click="handleEdit(row)">编辑</el-button>
|
||||||
|
<el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDelete(row.ID,row.NAME)">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<div class="page-btn-group">
|
||||||
|
<div>
|
||||||
|
<template>
|
||||||
|
<el-button type="primary" icon="el-icon-plus" @click="handleAdd">新增</el-button>
|
||||||
|
<el-button type="danger" icon="el-icon-delete" plain @click="makeAll('0')">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
<pagination :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" />
|
||||||
|
</div>
|
||||||
|
<el-dialog :visible.sync="dialogFormEdit" :title="dialogType==='editUser'?'修改':'新增'" width="600px">
|
||||||
|
<el-form ref="form" :rules="rules" :model="form" label-width="110px" style="width: 500px;">
|
||||||
|
|
||||||
|
<el-form-item label="名称" prop="NAME">
|
||||||
|
<el-input v-model="form.NAME" placeholder="这里输入名称..." />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="内容" prop="CONTENT">
|
||||||
|
<el-input
|
||||||
|
v-model="form.CONTENT"
|
||||||
|
:rows="10"
|
||||||
|
type="textarea"
|
||||||
|
placeholder="请输入内容"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="附件">
|
||||||
|
<el-upload
|
||||||
|
ref="upload"
|
||||||
|
:on-change="handleEditChange"
|
||||||
|
:on-remove="handleRemove"
|
||||||
|
:auto-upload="false"
|
||||||
|
:limit="1"
|
||||||
|
action="#" >
|
||||||
|
<el-button size="small" type="primary">点击上传</el-button>
|
||||||
|
</el-upload>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="dialogFormEdit = false">取 消</el-button>
|
||||||
|
<el-button type="primary" @click="confirm">确 定</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
<el-dialog :visible.sync="dialogFormShow" title="查看" width="800px">
|
||||||
|
<table class="table-ui">
|
||||||
|
<tr>
|
||||||
|
<td class="tbg">内容</td>
|
||||||
|
<td>
|
||||||
|
<div v-html="form.CONTENT" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr v-if="form.FILE_URL">
|
||||||
|
<td class="tbg">附件</td>
|
||||||
|
<td><a @click="download(form)">下载</a></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="dialogFormShow = false">关 闭</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import Pagination from '@/components/Pagination'
|
||||||
|
import { requestFN } from '@/utils/request'
|
||||||
|
import { upload } from '@/utils/upload'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: { Pagination },
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
listQuery: {
|
||||||
|
page: 1,
|
||||||
|
limit: 10
|
||||||
|
},
|
||||||
|
total: 0,
|
||||||
|
varList: [],
|
||||||
|
KEYWORDS: '',
|
||||||
|
dialogFormEdit: false,
|
||||||
|
dialogFormShow: false,
|
||||||
|
dialogType: 'add',
|
||||||
|
form: {
|
||||||
|
NAME: '',
|
||||||
|
TYPE: '',
|
||||||
|
CONTENT: ''
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
TYPE: [
|
||||||
|
{ required: true, message: '名称不能为空', trigger: 'blur' },
|
||||||
|
{ min: 2, max: 30, message: '长度在 2 到 30 个字符', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
NAME: [
|
||||||
|
{ required: true, message: '类型不能为空', trigger: 'blur' },
|
||||||
|
{ min: 2, max: 30, message: '长度在 2 到 30 个字符', trigger: 'blur' }]
|
||||||
|
|
||||||
|
},
|
||||||
|
FFILE: []
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
//* ************************下载**********************
|
||||||
|
download(obj) {
|
||||||
|
this.$confirm('确定要下载此文件吗?', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
this.downloadUrl = config.fileUrl + obj.FILE_URL
|
||||||
|
const _this = this
|
||||||
|
setTimeout(function() {
|
||||||
|
window.open(_this.downloadUrl)
|
||||||
|
}, 200)
|
||||||
|
}).catch(() => {
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// **********************文件上传*********************
|
||||||
|
handleEditChange(file) {
|
||||||
|
file.MATERIALS_ID = Math.random()
|
||||||
|
const is5M = file.size / 1024 / 1024 < 5
|
||||||
|
if (is5M) this.FFILE.push(file)
|
||||||
|
},
|
||||||
|
handleRemove(file, fileList) {
|
||||||
|
this.FFILE = fileList
|
||||||
|
},
|
||||||
|
upload(fun) {
|
||||||
|
const formData = new FormData()
|
||||||
|
|
||||||
|
for (let i = 0; i < this.FFILE.length; i++) {
|
||||||
|
if (this.FFILE[i].raw) {
|
||||||
|
formData.append('FFILE', this.FFILE[i].raw)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
upload(
|
||||||
|
'/file/upload',
|
||||||
|
formData
|
||||||
|
).then((data) => {
|
||||||
|
fun(data.fileurl)
|
||||||
|
}).catch((e) => {
|
||||||
|
})
|
||||||
|
},
|
||||||
|
//* *******************列表查询******************************
|
||||||
|
|
||||||
|
getList() {
|
||||||
|
this.listLoading = true
|
||||||
|
requestFN(
|
||||||
|
'/dangerousGoods/list?showCount=' + this.listQuery.limit + '¤tPage=' + this.listQuery.page,
|
||||||
|
{
|
||||||
|
name: this.KEYWORDS
|
||||||
|
}
|
||||||
|
).then((data) => {
|
||||||
|
this.listLoading = false
|
||||||
|
this.varList = data.varList
|
||||||
|
this.total = data.page.totalResult
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
this.listLoading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
//* ****************************数据查看*******************************
|
||||||
|
handleDetail(v) {
|
||||||
|
this.dialogFormShow = true
|
||||||
|
this.form = {
|
||||||
|
NAME: v.NAME,
|
||||||
|
TYPE: v.TYPE,
|
||||||
|
CONTENT: v.CONTENT,
|
||||||
|
FILE_URL: v.FILE_URL
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//* ***************************数据保存**********************************
|
||||||
|
handleEdit(v) {
|
||||||
|
this.dialogFormEdit = true
|
||||||
|
this.form = {
|
||||||
|
NAME: v.NAME,
|
||||||
|
TYPE: v.TYPE,
|
||||||
|
CONTENT: v.CONTENT,
|
||||||
|
ID: v.ID
|
||||||
|
}
|
||||||
|
this.dialogType = 'editUser'
|
||||||
|
this.$refs.upload.clearFiles()
|
||||||
|
},
|
||||||
|
handleAdd() {
|
||||||
|
this.dialogFormEdit = true
|
||||||
|
this.form = {}
|
||||||
|
this.dialogType = 'saveUser'
|
||||||
|
this.$refs.upload.clearFiles()
|
||||||
|
},
|
||||||
|
confirm() {
|
||||||
|
this.$refs.form.validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (this.FFILE.length > 0) {
|
||||||
|
this.upload((v) => {
|
||||||
|
this.form.FILE_URL = v
|
||||||
|
this.$refs.upload.clearFiles()
|
||||||
|
this.dataSave()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.dataSave()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
dataSave() {
|
||||||
|
this.listLoading = true
|
||||||
|
requestFN(
|
||||||
|
'/dangerousGoods/save', this.form
|
||||||
|
).then((data) => {
|
||||||
|
this.listLoading = false
|
||||||
|
this.dialogFormEdit = false
|
||||||
|
this.varList = []
|
||||||
|
this.listQuery.page = 1
|
||||||
|
this.getList()
|
||||||
|
}).catch((e) => {
|
||||||
|
this.listLoading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
//* *****************************删除********************************
|
||||||
|
handleDelete(id, name) {
|
||||||
|
this.$confirm('确定要删除[' + name + ']吗?', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
this.listLoading = true
|
||||||
|
requestFN(
|
||||||
|
'/dangerousGoods/delete',
|
||||||
|
{
|
||||||
|
id: id
|
||||||
|
}
|
||||||
|
).then((data) => {
|
||||||
|
if (data.result == 'success') {
|
||||||
|
this.listLoading = false
|
||||||
|
this.getList()
|
||||||
|
}
|
||||||
|
}).catch((e) => {
|
||||||
|
this.listLoading = false
|
||||||
|
})
|
||||||
|
}).catch(() => {
|
||||||
|
})
|
||||||
|
},
|
||||||
|
makeAll() {
|
||||||
|
const _selectData = this.$refs.multipleTable.selection
|
||||||
|
console.info('_selectData')
|
||||||
|
console.info(_selectData)
|
||||||
|
if (_selectData == null || _selectData.length == 0) {
|
||||||
|
this.$message({
|
||||||
|
message: '请选中要删除的项...',
|
||||||
|
type: 'error'
|
||||||
|
})
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
const ids = _selectData.map((item, index) => {
|
||||||
|
return item.ID
|
||||||
|
}).join(',')
|
||||||
|
|
||||||
|
this.$confirm('确定要删除选中的数据吗?', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
this.listLoading = true
|
||||||
|
requestFN(
|
||||||
|
'/dangerousGoods/deleteAll',
|
||||||
|
{
|
||||||
|
ids: ids
|
||||||
|
}
|
||||||
|
).then(() => {
|
||||||
|
this.listLoading = false
|
||||||
|
this.varList = []
|
||||||
|
this.listQuery.page = 1
|
||||||
|
this.$refs.multipleTable.clearSelection()
|
||||||
|
this.getList()
|
||||||
|
}).catch((e) => {
|
||||||
|
this.listLoading = false
|
||||||
|
})
|
||||||
|
}).catch(() => {
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getQuery() {
|
||||||
|
this.$refs.multipleTable.clearSelection()
|
||||||
|
this.getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
|
@ -0,0 +1,330 @@
|
||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<div class="filter-container">
|
||||||
|
<el-input v-model="KEYWORDS" placeholder="搜索" class="filter-item" style="width: 200px;" />
|
||||||
|
<el-button class="filter-item" type="primary" icon="el-icon-search" @click="getQuery">
|
||||||
|
搜索
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
<el-table ref="multipleTable" :data="varList" :header-cell-style="{'font-weight': 'bold','color': '#000'}" tooltip-effect="dark" border fit highlight-current-row>
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column type="index" label="序号" width="50" align="center" />
|
||||||
|
<el-table-column prop="NAME" label="中文名称" width="180" />
|
||||||
|
<el-table-column prop="NAME_EN" label="英文名称" width="180" />
|
||||||
|
<el-table-column prop="CONTENT" label="内容" show-overflow-tooltip="true" />
|
||||||
|
<el-table-column prop="DEPARTMENT_NAME" width="180" align="center" label="附件" >
|
||||||
|
<template v-if="row.FILE_URL" slot-scope="{row}">
|
||||||
|
<el-button type="primary" icon="el-icon-down" size="mini" @click="download(row)">下载</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column label="操作" align="center" width="300">
|
||||||
|
<template slot-scope="{row}">
|
||||||
|
<el-button type="primary" icon="el-icon-document" size="mini" @click="handleDetail(row)">查看</el-button>
|
||||||
|
<el-button type="primary" icon="el-icon-edit" size="mini" @click="handleEdit(row)">编辑</el-button>
|
||||||
|
<el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDelete(row.ID,row.NAME)">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<div class="page-btn-group">
|
||||||
|
<div>
|
||||||
|
<template>
|
||||||
|
<el-button type="primary" icon="el-icon-plus" @click="handleAdd">新增</el-button>
|
||||||
|
<el-button type="danger" icon="el-icon-delete" plain @click="makeAll('0')">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
<pagination :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" />
|
||||||
|
</div>
|
||||||
|
<el-dialog :visible.sync="dialogFormEdit" :title="dialogType==='editUser'?'修改':'新增'" width="600px">
|
||||||
|
<el-form ref="form" :rules="rules" :model="form" label-width="110px" style="width: 500px;">
|
||||||
|
|
||||||
|
<el-form-item label="名称" prop="NAME">
|
||||||
|
<el-input v-model="form.NAME" placeholder="这里输入名称..." />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="英文姓名" prop="NAME_EN">
|
||||||
|
<el-input v-model="form.NAME_EN" placeholder="这里输入英文姓名..." />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="内容" prop="CONTENT">
|
||||||
|
<el-input
|
||||||
|
v-model="form.CONTENT"
|
||||||
|
:rows="10"
|
||||||
|
type="textarea"
|
||||||
|
placeholder="请输入内容"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="附件">
|
||||||
|
<el-upload
|
||||||
|
ref="upload"
|
||||||
|
:on-change="handleEditChange"
|
||||||
|
:on-remove="handleRemove"
|
||||||
|
:auto-upload="false"
|
||||||
|
:limit="1"
|
||||||
|
action="#" >
|
||||||
|
<el-button size="small" type="primary">点击上传</el-button>
|
||||||
|
</el-upload>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="dialogFormEdit = false">取 消</el-button>
|
||||||
|
<el-button type="primary" @click="confirm">确 定</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
<el-dialog :visible.sync="dialogFormShow" title="查看" width="800px">
|
||||||
|
<table class="table-ui">
|
||||||
|
<tr>
|
||||||
|
<td class="tbg">内容</td>
|
||||||
|
<td>
|
||||||
|
<div v-html="form.CONTENT" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr v-if="form.FILE_URL">
|
||||||
|
<td class="tbg">附件</td>
|
||||||
|
<td><a @click="download(form)">下载</a></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="dialogFormShow = false">关 闭</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import Pagination from '@/components/Pagination'
|
||||||
|
import { requestFN } from '@/utils/request'
|
||||||
|
import { upload } from '@/utils/upload'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: { Pagination },
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
listQuery: {
|
||||||
|
page: 1,
|
||||||
|
limit: 10
|
||||||
|
},
|
||||||
|
total: 0,
|
||||||
|
varList: [],
|
||||||
|
KEYWORDS: '',
|
||||||
|
dialogFormShow: false,
|
||||||
|
dialogFormEdit: false,
|
||||||
|
dialogType: 'add',
|
||||||
|
form: {
|
||||||
|
NAME: '',
|
||||||
|
NAME_EN: '',
|
||||||
|
CONTENT: ''
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
NAME_EN: [
|
||||||
|
{ required: true, message: '名称不能为空', trigger: 'blur' },
|
||||||
|
{ min: 2, max: 30, message: '长度在 2 到 30 个字符', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
NAME: [
|
||||||
|
{ required: true, message: '英文名称不能为空', trigger: 'blur' },
|
||||||
|
{ min: 2, max: 30, message: '长度在 2 到 30 个字符', trigger: 'blur' }]
|
||||||
|
|
||||||
|
},
|
||||||
|
FFILE: []
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
//* ************************下载**********************
|
||||||
|
download(obj) {
|
||||||
|
this.$confirm('确定要下载此文件吗?', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
this.downloadUrl = config.fileUrl + obj.FILE_URL
|
||||||
|
const _this = this
|
||||||
|
setTimeout(function() {
|
||||||
|
window.open(_this.downloadUrl)
|
||||||
|
}, 200)
|
||||||
|
}).catch(() => {
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// **********************文件上传*********************
|
||||||
|
handleEditChange(file) {
|
||||||
|
file.MATERIALS_ID = Math.random()
|
||||||
|
const is5M = file.size / 1024 / 1024 < 5
|
||||||
|
if (is5M) this.FFILE.push(file)
|
||||||
|
},
|
||||||
|
handleRemove(file, fileList) {
|
||||||
|
this.FFILE = fileList
|
||||||
|
},
|
||||||
|
upload(fun) {
|
||||||
|
const formData = new FormData()
|
||||||
|
|
||||||
|
for (let i = 0; i < this.FFILE.length; i++) {
|
||||||
|
if (this.FFILE[i].raw) {
|
||||||
|
formData.append('FFILE', this.FFILE[i].raw)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
upload(
|
||||||
|
'/file/upload',
|
||||||
|
formData
|
||||||
|
).then((data) => {
|
||||||
|
fun(data.fileurl)
|
||||||
|
}).catch((e) => {
|
||||||
|
})
|
||||||
|
},
|
||||||
|
//* *******************列表查询******************************
|
||||||
|
|
||||||
|
getList() {
|
||||||
|
this.listLoading = true
|
||||||
|
requestFN(
|
||||||
|
'/hazardousChemicals/list?showCount=' + this.listQuery.limit + '¤tPage=' + this.listQuery.page,
|
||||||
|
{
|
||||||
|
name: this.KEYWORDS
|
||||||
|
}
|
||||||
|
).then((data) => {
|
||||||
|
this.listLoading = false
|
||||||
|
this.varList = data.varList
|
||||||
|
this.total = data.page.totalResult
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
this.listLoading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
//* ****************************数据查看*******************************
|
||||||
|
handleDetail(v) {
|
||||||
|
this.dialogFormShow = true
|
||||||
|
this.form = {
|
||||||
|
NAME: v.NAME,
|
||||||
|
CONTENT: v.CONTENT,
|
||||||
|
FILE_URL: v.FILE_URL
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//* ***************************数据保存**********************************
|
||||||
|
handleEdit(v) {
|
||||||
|
this.dialogFormEdit = true
|
||||||
|
this.form = {
|
||||||
|
NAME: v.NAME,
|
||||||
|
NAME_EN: v.NAME_EN,
|
||||||
|
CONTENT: v.CONTENT,
|
||||||
|
ID: v.ID
|
||||||
|
}
|
||||||
|
this.dialogType = 'editUser'
|
||||||
|
this.$refs.upload.clearFiles()
|
||||||
|
},
|
||||||
|
handleAdd() {
|
||||||
|
this.dialogFormEdit = true
|
||||||
|
this.form = {}
|
||||||
|
this.dialogType = 'saveUser'
|
||||||
|
this.$refs.upload.clearFiles()
|
||||||
|
},
|
||||||
|
confirm() {
|
||||||
|
this.$refs.form.validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (this.FFILE.length > 0) {
|
||||||
|
this.upload((v) => {
|
||||||
|
this.form.FILE_URL = v
|
||||||
|
this.$refs.upload.clearFiles()
|
||||||
|
this.dataSave()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.dataSave()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
dataSave() {
|
||||||
|
this.listLoading = true
|
||||||
|
requestFN(
|
||||||
|
'/hazardousChemicals/save', this.form
|
||||||
|
).then((data) => {
|
||||||
|
this.listLoading = false
|
||||||
|
this.dialogFormEdit = false
|
||||||
|
this.varList = []
|
||||||
|
this.listQuery.page = 1
|
||||||
|
this.getList()
|
||||||
|
}).catch((e) => {
|
||||||
|
this.listLoading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
//* *****************************删除********************************
|
||||||
|
handleDelete(id, name) {
|
||||||
|
this.$confirm('确定要删除[' + name + ']吗?', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
this.listLoading = true
|
||||||
|
requestFN(
|
||||||
|
'/hazardousChemicals/delete',
|
||||||
|
{
|
||||||
|
id: id
|
||||||
|
}
|
||||||
|
).then((data) => {
|
||||||
|
if (data.result == 'success') {
|
||||||
|
this.listLoading = false
|
||||||
|
this.getList()
|
||||||
|
}
|
||||||
|
}).catch((e) => {
|
||||||
|
this.listLoading = false
|
||||||
|
})
|
||||||
|
}).catch(() => {
|
||||||
|
})
|
||||||
|
},
|
||||||
|
makeAll() {
|
||||||
|
const _selectData = this.$refs.multipleTable.selection
|
||||||
|
console.info('_selectData')
|
||||||
|
console.info(_selectData)
|
||||||
|
if (_selectData == null || _selectData.length == 0) {
|
||||||
|
this.$message({
|
||||||
|
message: '请选中要删除的项...',
|
||||||
|
type: 'error'
|
||||||
|
})
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
const ids = _selectData.map((item, index) => {
|
||||||
|
return item.ID
|
||||||
|
}).join(',')
|
||||||
|
|
||||||
|
this.$confirm('确定要删除选中的数据吗?', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
this.listLoading = true
|
||||||
|
requestFN(
|
||||||
|
'/hazardousChemicals/deleteAll',
|
||||||
|
{
|
||||||
|
ids: ids
|
||||||
|
}
|
||||||
|
).then(() => {
|
||||||
|
this.listLoading = false
|
||||||
|
this.varList = []
|
||||||
|
this.listQuery.page = 1
|
||||||
|
this.$refs.multipleTable.clearSelection()
|
||||||
|
this.getList()
|
||||||
|
}).catch((e) => {
|
||||||
|
this.listLoading = false
|
||||||
|
})
|
||||||
|
}).catch(() => {
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getQuery() {
|
||||||
|
this.$refs.multipleTable.clearSelection()
|
||||||
|
this.getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style>
|
||||||
|
.el-tooltip__popper{
|
||||||
|
max-width:20%;
|
||||||
|
}
|
||||||
|
.el-tooltip__popper,.el-tooltip__popper.is-dark{
|
||||||
|
background:rgb(48, 65, 86) !important;
|
||||||
|
color: #fff !important;
|
||||||
|
line-height: 24px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
@ -0,0 +1,291 @@
|
||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<div class="filter-container">
|
||||||
|
<el-input v-model="KEYWORDS" placeholder="搜索" class="filter-item" style="width: 200px;" />
|
||||||
|
<el-button class="filter-item" type="primary" icon="el-icon-search" @click="getQuery">
|
||||||
|
搜索
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
<el-table ref="multipleTable" :data="varList" :header-cell-style="{'font-weight': 'bold','color': '#000'}" tooltip-effect="dark" border fit highlight-current-row>
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column type="index" label="序号" width="50" align="center" />
|
||||||
|
<el-table-column prop="NAME" label="中文名称" width="180" />
|
||||||
|
<el-table-column prop="TYPE" label="类型" width="180" />
|
||||||
|
<el-table-column prop="CONTENT" label="内容" show-overflow-tooltip="true" />
|
||||||
|
<el-table-column prop="DEPARTMENT_NAME" width="180" align="center" label="附件" >
|
||||||
|
<template v-if="row.FILE_URL" slot-scope="{row}">
|
||||||
|
<el-button type="primary" icon="el-icon-down" size="mini" @click="download(row)">下载</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column label="操作" align="center" width="200">
|
||||||
|
<template slot-scope="{row}">
|
||||||
|
<el-button type="primary" icon="el-icon-edit" size="mini" @click="handleEdit(row)">编辑</el-button>
|
||||||
|
<el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDelete(row.ID,row.NAME)">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<div class="page-btn-group">
|
||||||
|
<div>
|
||||||
|
<template>
|
||||||
|
<el-button type="primary" icon="el-icon-plus" @click="handleAdd">新增</el-button>
|
||||||
|
<el-button type="danger" icon="el-icon-delete" plain @click="makeAll('0')">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
<pagination :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" />
|
||||||
|
</div>
|
||||||
|
<el-dialog :visible.sync="dialogFormEdit" :title="dialogType==='editUser'?'修改':'新增'" width="600px">
|
||||||
|
<el-form ref="form" :rules="rules" :model="form" label-width="110px" style="width: 500px;">
|
||||||
|
|
||||||
|
<el-form-item label="名称" prop="NAME">
|
||||||
|
<el-input v-model="form.NAME" placeholder="这里输入名称..." />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="类型" prop="TYPE">
|
||||||
|
<el-input v-model="form.TYPE" placeholder="这里输入类型..." />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="内容" prop="CONTENT">
|
||||||
|
<el-input
|
||||||
|
v-model="form.CONTENT"
|
||||||
|
:rows="10"
|
||||||
|
type="textarea"
|
||||||
|
placeholder="请输入内容"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="附件">
|
||||||
|
<el-upload
|
||||||
|
ref="upload"
|
||||||
|
:on-change="handleEditChange"
|
||||||
|
:on-remove="handleRemove"
|
||||||
|
:auto-upload="false"
|
||||||
|
:limit="1"
|
||||||
|
action="#" >
|
||||||
|
<el-button size="small" type="primary">点击上传</el-button>
|
||||||
|
</el-upload>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="dialogFormEdit = false">取 消</el-button>
|
||||||
|
<el-button type="primary" @click="confirm">确 定</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import Pagination from '@/components/Pagination'
|
||||||
|
import { requestFN } from '@/utils/request'
|
||||||
|
import { upload } from '@/utils/upload'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: { Pagination },
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
listQuery: {
|
||||||
|
page: 1,
|
||||||
|
limit: 10
|
||||||
|
},
|
||||||
|
total: 0,
|
||||||
|
varList: [],
|
||||||
|
KEYWORDS: '',
|
||||||
|
dialogFormEdit: false,
|
||||||
|
dialogType: 'add',
|
||||||
|
form: {
|
||||||
|
NAME: '',
|
||||||
|
TYPE: '',
|
||||||
|
CONTENT: ''
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
TYPE: [
|
||||||
|
{ required: true, message: '名称不能为空', trigger: 'blur' },
|
||||||
|
{ min: 2, max: 30, message: '长度在 2 到 30 个字符', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
NAME: [
|
||||||
|
{ required: true, message: '类型不能为空', trigger: 'blur' },
|
||||||
|
{ min: 2, max: 30, message: '长度在 2 到 30 个字符', trigger: 'blur' }]
|
||||||
|
|
||||||
|
},
|
||||||
|
FFILE: []
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
//* ************************下载**********************
|
||||||
|
download(obj) {
|
||||||
|
this.$confirm('确定要下载此文件吗?', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
this.downloadUrl = config.fileUrl + obj.FILE_URL
|
||||||
|
const _this = this
|
||||||
|
setTimeout(function() {
|
||||||
|
window.open(_this.downloadUrl)
|
||||||
|
}, 200)
|
||||||
|
}).catch(() => {
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// **********************文件上传*********************
|
||||||
|
handleEditChange(file) {
|
||||||
|
file.MATERIALS_ID = Math.random()
|
||||||
|
const is5M = file.size / 1024 / 1024 < 5
|
||||||
|
if (is5M) this.FFILE.push(file)
|
||||||
|
},
|
||||||
|
handleRemove(file, fileList) {
|
||||||
|
this.FFILE = fileList
|
||||||
|
},
|
||||||
|
upload(fun) {
|
||||||
|
const formData = new FormData()
|
||||||
|
|
||||||
|
for (let i = 0; i < this.FFILE.length; i++) {
|
||||||
|
if (this.FFILE[i].raw) {
|
||||||
|
formData.append('FFILE', this.FFILE[i].raw)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
upload(
|
||||||
|
'/file/upload',
|
||||||
|
formData
|
||||||
|
).then((data) => {
|
||||||
|
fun(data.fileurl)
|
||||||
|
}).catch((e) => {
|
||||||
|
})
|
||||||
|
},
|
||||||
|
//* *******************列表查询******************************
|
||||||
|
|
||||||
|
getList() {
|
||||||
|
this.listLoading = true
|
||||||
|
requestFN(
|
||||||
|
'/manufacturingtechnique/list?showCount=' + this.listQuery.limit + '¤tPage=' + this.listQuery.page,
|
||||||
|
{
|
||||||
|
name: this.KEYWORDS
|
||||||
|
}
|
||||||
|
).then((data) => {
|
||||||
|
this.listLoading = false
|
||||||
|
this.varList = data.varList
|
||||||
|
this.total = data.page.totalResult
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
this.listLoading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
//* ***************************数据保存**********************************
|
||||||
|
handleEdit(v) {
|
||||||
|
this.dialogFormEdit = true
|
||||||
|
this.form = {
|
||||||
|
NAME: v.NAME,
|
||||||
|
TYPE: v.TYPE,
|
||||||
|
CONTENT: v.CONTENT,
|
||||||
|
ID: v.ID
|
||||||
|
}
|
||||||
|
this.dialogType = 'editUser'
|
||||||
|
this.$refs.upload.clearFiles()
|
||||||
|
},
|
||||||
|
handleAdd() {
|
||||||
|
this.dialogFormEdit = true
|
||||||
|
this.form = {}
|
||||||
|
this.dialogType = 'saveUser'
|
||||||
|
this.$refs.upload.clearFiles()
|
||||||
|
},
|
||||||
|
confirm() {
|
||||||
|
this.$refs.form.validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (this.FFILE.length > 0) {
|
||||||
|
this.upload((v) => {
|
||||||
|
this.form.FILE_URL = v
|
||||||
|
this.$refs.upload.clearFiles()
|
||||||
|
this.dataSave()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.dataSave()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
dataSave() {
|
||||||
|
this.listLoading = true
|
||||||
|
requestFN(
|
||||||
|
'/manufacturingtechnique/save', this.form
|
||||||
|
).then((data) => {
|
||||||
|
this.listLoading = false
|
||||||
|
this.dialogFormEdit = false
|
||||||
|
this.varList = []
|
||||||
|
this.listQuery.page = 1
|
||||||
|
this.getList()
|
||||||
|
}).catch((e) => {
|
||||||
|
this.listLoading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
//* *****************************删除********************************
|
||||||
|
handleDelete(id, name) {
|
||||||
|
this.$confirm('确定要删除[' + name + ']吗?', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
this.listLoading = true
|
||||||
|
requestFN(
|
||||||
|
'/manufacturingtechnique/delete',
|
||||||
|
{
|
||||||
|
id: id
|
||||||
|
}
|
||||||
|
).then((data) => {
|
||||||
|
if (data.result == 'success') {
|
||||||
|
this.listLoading = false
|
||||||
|
this.getList()
|
||||||
|
}
|
||||||
|
}).catch((e) => {
|
||||||
|
this.listLoading = false
|
||||||
|
})
|
||||||
|
}).catch(() => {
|
||||||
|
})
|
||||||
|
},
|
||||||
|
makeAll() {
|
||||||
|
const _selectData = this.$refs.multipleTable.selection
|
||||||
|
console.info('_selectData')
|
||||||
|
console.info(_selectData)
|
||||||
|
if (_selectData == null || _selectData.length == 0) {
|
||||||
|
this.$message({
|
||||||
|
message: '请选中要删除的项...',
|
||||||
|
type: 'error'
|
||||||
|
})
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
const ids = _selectData.map((item, index) => {
|
||||||
|
return item.ID
|
||||||
|
}).join(',')
|
||||||
|
|
||||||
|
this.$confirm('确定要删除选中的数据吗?', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
this.listLoading = true
|
||||||
|
requestFN(
|
||||||
|
'/manufacturingtechnique/deleteAll',
|
||||||
|
{
|
||||||
|
ids: ids
|
||||||
|
}
|
||||||
|
).then(() => {
|
||||||
|
this.listLoading = false
|
||||||
|
this.varList = []
|
||||||
|
this.listQuery.page = 1
|
||||||
|
this.$refs.multipleTable.clearSelection()
|
||||||
|
this.getList()
|
||||||
|
}).catch((e) => {
|
||||||
|
this.listLoading = false
|
||||||
|
})
|
||||||
|
}).catch(() => {
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getQuery() {
|
||||||
|
this.$refs.multipleTable.clearSelection()
|
||||||
|
this.getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
|
@ -0,0 +1,450 @@
|
||||||
|
<template>
|
||||||
|
<div class="icons-container">
|
||||||
|
<el-container>
|
||||||
|
<el-aside width="300px" style="background-color:#fff">
|
||||||
|
<el-input v-model="filterText" placeholder="输入关键字进行过滤" style="margin:10px 0" />
|
||||||
|
<el-tree
|
||||||
|
ref="tree"
|
||||||
|
:data="nodeData"
|
||||||
|
:props="defaultProps"
|
||||||
|
:filter-node-method="filterNode"
|
||||||
|
:load="getTreeNode"
|
||||||
|
lazy
|
||||||
|
class="filter-tree"
|
||||||
|
accordion
|
||||||
|
@node-click="handleNodeClick" />
|
||||||
|
</el-aside>
|
||||||
|
<el-main>
|
||||||
|
<div class="filter-btn-group">
|
||||||
|
<div><el-button type="primary" icon="el-icon-plus" @click="handleAdd">新增</el-button></div>
|
||||||
|
</div>
|
||||||
|
<el-table v-loading="listLoading" ref="multipleTable" :data="varList" :header-cell-style="{'font-weight': 'bold','color': '#000'}" tooltip-effect="dark" border fit highlight-current-row>
|
||||||
|
<!-- <el-table-column :reserve-selection="true" type="selection" width="55" align="center" />-->
|
||||||
|
<el-table-column type="index" label="序号" width="50" align="center" />
|
||||||
|
<el-table-column label="名称" prop="NAME"/>
|
||||||
|
<el-table-column prop="TYPE_DIC_NAME" label="类型" />
|
||||||
|
<el-table-column prop="CONTENT" label="内容" />
|
||||||
|
<el-table-column label="附件" width="100" align="center" >
|
||||||
|
<template v-if="row.FILE_URL" slot-scope="{row}">
|
||||||
|
<el-button type="primary" icon="el-icon-down" size="mini" @click="download(row)">下载</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" width="200">
|
||||||
|
<template slot-scope="{row}">
|
||||||
|
<el-button type="primary" icon="el-icon-edit" size="mini" @click="handleEdit(row)">编辑</el-button>
|
||||||
|
<el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDelete(row.ID, row.NAME)">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<div class="page-btn-group">
|
||||||
|
<div />
|
||||||
|
<pagination :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" />
|
||||||
|
</div>
|
||||||
|
</el-main>
|
||||||
|
</el-container>
|
||||||
|
|
||||||
|
<el-dialog :visible.sync="dialogFormAdd" :title="msg==='edit'?'修改':'新增'" width="580px">
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="100px" style="width: 500px;">
|
||||||
|
<el-form-item label="名称" prop="NAME">
|
||||||
|
<el-input v-model="form.NAME" placeholder="这里输入名称..." />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="类型" prop="TYPE_DIC_ID">
|
||||||
|
<Treeselect
|
||||||
|
:options="treeData"
|
||||||
|
:normalizer="normalizer"
|
||||||
|
v-model="form.TYPE_DIC_ID"
|
||||||
|
:disable-branch-nodes="true"
|
||||||
|
placeholder="请选择法规"
|
||||||
|
no-options-text="暂无数据"
|
||||||
|
no-children-text="暂无数据"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="内容" prop="CONTENT">
|
||||||
|
<el-input
|
||||||
|
v-model="form.CONTENT"
|
||||||
|
:rows="10"
|
||||||
|
type="textarea"
|
||||||
|
placeholder="请输入内容"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="附件">
|
||||||
|
<el-upload
|
||||||
|
ref="upload"
|
||||||
|
:on-change="handleEditChange"
|
||||||
|
:on-remove="handleRemove"
|
||||||
|
:auto-upload="false"
|
||||||
|
:limit="1"
|
||||||
|
action="#" >
|
||||||
|
<el-button size="small" type="primary">点击上传</el-button>
|
||||||
|
|
||||||
|
</el-upload>
|
||||||
|
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="dialogFormAdd = false">取 消</el-button>
|
||||||
|
<el-button type="primary" @click="confirm()">确 定</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import Pagination from '@/components/Pagination'
|
||||||
|
import { requestFN } from '@/utils/request'
|
||||||
|
import Tinymce from '@/components/Tinymce'
|
||||||
|
import { upload } from '@/utils/upload'
|
||||||
|
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
||||||
|
import { Treeselect } from '@riophae/vue-treeselect'
|
||||||
|
export default {
|
||||||
|
components: { Pagination, Tinymce, Treeselect },
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
normalizer(node) {
|
||||||
|
return {
|
||||||
|
id: node.DICTIONARIES_ID,
|
||||||
|
label: node.name,
|
||||||
|
children: node.nodes
|
||||||
|
}
|
||||||
|
},
|
||||||
|
listLoading: false,
|
||||||
|
downloadUrl: '',
|
||||||
|
form: {
|
||||||
|
NAME: '',
|
||||||
|
CONTENT: ''
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
NAME: [
|
||||||
|
{ required: true, message: '名称不能为空', trigger: 'change' },
|
||||||
|
{ min: 2, max: 130, message: '长度在 2 到 130 个字符', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
CONTENT: [
|
||||||
|
{ required: true, message: '内容不能为空', trigger: 'change' }
|
||||||
|
|
||||||
|
]
|
||||||
|
},
|
||||||
|
filterText: '',
|
||||||
|
nodeData: [],
|
||||||
|
defaultProps: {
|
||||||
|
value: 'DICTIONARIES_ID',
|
||||||
|
children: 'nodes',
|
||||||
|
label: 'NAME'
|
||||||
|
},
|
||||||
|
dialogFormAdd: false,
|
||||||
|
varList: [],
|
||||||
|
FFILE: [],
|
||||||
|
uploadfileurl: '',
|
||||||
|
|
||||||
|
listQuery: {
|
||||||
|
page: 1,
|
||||||
|
limit: 10
|
||||||
|
},
|
||||||
|
total: 0,
|
||||||
|
DICTIONARIES_ID: '',
|
||||||
|
TYPE: 1,
|
||||||
|
msg: 'add',
|
||||||
|
add: false,
|
||||||
|
del: false,
|
||||||
|
edit: false,
|
||||||
|
resMsg: '',
|
||||||
|
treeData: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
filterText(val) {
|
||||||
|
this.$refs.tree.filter(val)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
// 初始化方法
|
||||||
|
this.dialogFormEdit = false
|
||||||
|
this.varList = []
|
||||||
|
this.listQuery.page = 1
|
||||||
|
this.getList()
|
||||||
|
this.getTreeList()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getTreeList() {
|
||||||
|
requestFN(
|
||||||
|
'/regulations/listTree',
|
||||||
|
{
|
||||||
|
}
|
||||||
|
).then((data) => {
|
||||||
|
this.treeData = JSON.parse(data.zTreeNodes)
|
||||||
|
}).catch((e) => {
|
||||||
|
})
|
||||||
|
},
|
||||||
|
RegulationsSave() {
|
||||||
|
this.listLoading = true
|
||||||
|
this.form.FILE_URL = this.uploadfileurl
|
||||||
|
requestFN(
|
||||||
|
'/regulations/' + this.msg,
|
||||||
|
this.form
|
||||||
|
).then((data) => {
|
||||||
|
if (data.result == 'fail') {
|
||||||
|
this.$message({
|
||||||
|
message: data.resMsg,
|
||||||
|
type: 'error'
|
||||||
|
})
|
||||||
|
this.erroMsg = Math.random()
|
||||||
|
this.$nextTick(() => { this.erroMsg = '' })
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
this.listLoading = false
|
||||||
|
this.dialogFormAdd = false
|
||||||
|
this.getList(this.DICTIONARIES_ID, 1)
|
||||||
|
|
||||||
|
this.msg = 'add'
|
||||||
|
}).catch((e) => {
|
||||||
|
this.resMsg = e.resMsg
|
||||||
|
this.listLoading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
RegulationsEdit() {
|
||||||
|
this.listLoading = true
|
||||||
|
this.form.FILE_URL = this.uploadfileurl
|
||||||
|
debugger
|
||||||
|
requestFN(
|
||||||
|
'/regulations/' + this.msg,
|
||||||
|
this.form
|
||||||
|
).then((data) => {
|
||||||
|
this.listLoading = false
|
||||||
|
this.dialogFormAdd = false
|
||||||
|
this.getList(this.DICTIONARIES_ID, 1)
|
||||||
|
this.msg = 'add'
|
||||||
|
}).catch((e) => {
|
||||||
|
this.resMsg = e.resMsg
|
||||||
|
this.listLoading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// **********************文件上传*********************
|
||||||
|
handleEditChange(file) {
|
||||||
|
file.MATERIALS_ID = Math.random()
|
||||||
|
const is5M = file.size / 1024 / 1024 < 5
|
||||||
|
if (is5M) this.FFILE.push(file)
|
||||||
|
},
|
||||||
|
handleRemove(file, fileList) {
|
||||||
|
this.FFILE = fileList
|
||||||
|
},
|
||||||
|
confirm() {
|
||||||
|
debugger
|
||||||
|
// this.form.TYPE_DIC_ID = this.DICTIONARIES_ID
|
||||||
|
if (this.form.TYPE_DIC_ID === '' || this.form.TYPE_DIC_ID === null) {
|
||||||
|
this.$message({
|
||||||
|
message: '请选择法规类型...',
|
||||||
|
type: 'error'
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.$refs.form.validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (this.FFILE.length > 0) {
|
||||||
|
this.upload((v) => {
|
||||||
|
this.$refs.upload.clearFiles()
|
||||||
|
|
||||||
|
this.uploadfileurl = v
|
||||||
|
if (this.form.ID) {
|
||||||
|
this.RegulationsEdit()
|
||||||
|
} else {
|
||||||
|
this.RegulationsSave()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
if (this.form.ID) {
|
||||||
|
this.RegulationsEdit()
|
||||||
|
} else {
|
||||||
|
this.RegulationsSave()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
upload(fun) {
|
||||||
|
const formData = new FormData()
|
||||||
|
|
||||||
|
for (let i = 0; i < this.FFILE.length; i++) {
|
||||||
|
if (this.FFILE[i].raw) {
|
||||||
|
formData.append('FFILE', this.FFILE[i].raw)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
upload(
|
||||||
|
'/file/upload',
|
||||||
|
formData
|
||||||
|
).then((data) => {
|
||||||
|
fun(data.fileurl)
|
||||||
|
}).catch((e) => {
|
||||||
|
})
|
||||||
|
},
|
||||||
|
//* ************************下载********************************
|
||||||
|
download(obj) {
|
||||||
|
this.$confirm('确定要下载此文件吗?', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
this.listLoading = false
|
||||||
|
this.downloadUrl = config.fileUrl + obj.FILE_URL
|
||||||
|
|
||||||
|
const _this = this
|
||||||
|
setTimeout(function() {
|
||||||
|
window.open(_this.downloadUrl)
|
||||||
|
// _this.$refs.downloadUrl.dispatchEvent(new MouseEvent('click'))
|
||||||
|
}, 200)
|
||||||
|
}).catch(() => {
|
||||||
|
this.listLoading = false
|
||||||
|
})
|
||||||
|
this.listLoading = false
|
||||||
|
},
|
||||||
|
|
||||||
|
filterNode(value, data) {
|
||||||
|
if (!value) return true
|
||||||
|
return data.NAME.indexOf(value) !== -1
|
||||||
|
},
|
||||||
|
handleAdd() {
|
||||||
|
this.FFILE = []
|
||||||
|
|
||||||
|
this.dialogFormAdd = true
|
||||||
|
this.resetForm()
|
||||||
|
this.form.YNDEL = 'no'
|
||||||
|
if (this.$refsform !== undefined) {
|
||||||
|
this.$refs.form.resetFields()
|
||||||
|
}
|
||||||
|
this.msg = 'add'
|
||||||
|
this.$refs.upload.clearFiles()
|
||||||
|
},
|
||||||
|
handleEdit(data) {
|
||||||
|
this.FFILE = []
|
||||||
|
this.form = {
|
||||||
|
NAME: data.NAME,
|
||||||
|
CONTENT: data.CONTENT,
|
||||||
|
TYPE_DIC_ID: data.TYPE_DIC_ID,
|
||||||
|
ID: data.ID
|
||||||
|
}
|
||||||
|
this.dialogFormAdd = true
|
||||||
|
this.msg = 'edit'
|
||||||
|
this.$refs.upload.clearFiles()
|
||||||
|
},
|
||||||
|
getTreeNode(node, resolve) {
|
||||||
|
if (node.level === 0) {
|
||||||
|
requestFN(
|
||||||
|
'/regulations/getRegulationsLevels',
|
||||||
|
{
|
||||||
|
DICTIONARIES_ID: this.DICTIONARIES_ID
|
||||||
|
}
|
||||||
|
).then((data) => {
|
||||||
|
resolve(data.list)
|
||||||
|
}).catch((e) => {
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
requestFN(
|
||||||
|
'/dictionaries/getLevels',
|
||||||
|
{
|
||||||
|
DICTIONARIES_ID: node.data.DICTIONARIES_ID
|
||||||
|
}
|
||||||
|
).then((data) => {
|
||||||
|
resolve(data.list)
|
||||||
|
}).catch((e) => {
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getList(DICTIONARIES_ID) {
|
||||||
|
this.listLoading = true
|
||||||
|
if (DICTIONARIES_ID) {
|
||||||
|
this.DICTIONARIES_ID = DICTIONARIES_ID
|
||||||
|
}
|
||||||
|
requestFN(
|
||||||
|
'/regulations/list?showCount=' + this.listQuery.limit + '¤tPage=' + this.listQuery.page,
|
||||||
|
{
|
||||||
|
id: this.DICTIONARIES_ID
|
||||||
|
}
|
||||||
|
).then((data) => {
|
||||||
|
this.listLoading = false
|
||||||
|
this.varList = data.varList
|
||||||
|
this.total = data.page.totalResult
|
||||||
|
this.FFILE = []
|
||||||
|
}).catch((e) => {
|
||||||
|
this.listLoading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleNodeClick(node, data, value) {
|
||||||
|
this.getList(node.DICTIONARIES_ID, 1)
|
||||||
|
},
|
||||||
|
resetForm() {
|
||||||
|
this.form = {
|
||||||
|
NAME: '',
|
||||||
|
CONTENT: '',
|
||||||
|
ID: '',
|
||||||
|
FILE_URL: '',
|
||||||
|
TYPE_DIC_ID: null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
handleDelete(id, name) {
|
||||||
|
this.$confirm('确定要删除[' + name + ']吗?', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
this.listLoading = true
|
||||||
|
requestFN(
|
||||||
|
'/regulations/delete',
|
||||||
|
{
|
||||||
|
id: id
|
||||||
|
}
|
||||||
|
).then((data) => {
|
||||||
|
if (data.result == 'success') {
|
||||||
|
this.listLoading = false
|
||||||
|
this.getList(this.DICTIONARIES_ID, 1)
|
||||||
|
}
|
||||||
|
}).catch((e) => {
|
||||||
|
this.listLoading = false
|
||||||
|
})
|
||||||
|
}).catch(() => {
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.el-dialog__body {
|
||||||
|
padding: 0;
|
||||||
|
background: red;
|
||||||
|
}
|
||||||
|
.mark_up {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
margin-left: 90px;
|
||||||
|
}
|
||||||
|
.icons-container {
|
||||||
|
margin: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
.grid {
|
||||||
|
position: relative;
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-item {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
height: 70px;
|
||||||
|
text-align: center;
|
||||||
|
width: 100px;
|
||||||
|
float: left;
|
||||||
|
font-size: 24px;
|
||||||
|
color: #24292e;
|
||||||
|
cursor: pointer;
|
||||||
|
span {
|
||||||
|
display: block;
|
||||||
|
font-size: 14px;
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.disabled {
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
Loading…
Reference in New Issue