Commit dd416239 by wangyalan-git

字典管理增删改查

parent 5db5764a
......@@ -14,7 +14,7 @@ module.exports = {
// 代理列表, 是否开启代理通过[./dev.env.js]配置
proxyTable: devEnv.OPEN_PROXY === false ? {} : {
'/proxyApi': {
target: 'http://192.168.31.108:8085/bapi',
target: 'http://192.168.31.118:8085/bapi',
changeOrigin: true,
pathRewrite: {
'^/proxyApi': '/'
......
export const tableOption = {
border: true,
selection: true,
index: false,
indexLabel: '序号',
stripe: true,
menuAlign: 'center',
menuWidth: 350,
align: 'center',
refreshBtn: false,
columnBtn: false,
searchSize: 'mini',
addBtn: false,
editBtn: false,
delBtn: false,
viewBtn: false,
props: {
label: 'label',
value: 'value'
},
column: [{
label: '参数名',
prop: 'paramName',
search: true
}, {
label: '参数编码',
prop: 'paramCode',
search: true
}, {
label: '参数值',
prop: 'paramValue',
search: true
}, {
label: '备注',
prop: 'remark'
}]
}
<template>
<el-dialog
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
<el-form-item label="参数名" prop="paramName">
<el-input v-model="dataForm.paramName" placeholder="参数名"></el-input>
</el-form-item>
<el-form-item label="参数编码" prop="paramCode">
<el-input v-model="dataForm.paramCode" placeholder="参数编码" :disabled="dataForm.id ? true: false"></el-input>
</el-form-item>
<el-form-item label="参数值" prop="paramValue">
<el-input v-model="dataForm.paramValue" placeholder="参数值"></el-input>
</el-form-item>
<el-form-item label="参数类型" prop="paramType">
<el-radio-group v-model="dataForm.paramType" :disabled="dataForm.id ? true: false">
<el-radio :label="1">变量</el-radio>
<el-radio :label="2">json</el-radio>
<el-radio :label="3">sql变量</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注" prop="remark" >
<el-input v-model="dataForm.remark" placeholder="备注" :disabled="dataForm.id ? true: false"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data () {
return {
visible: false,
dataForm: {
id: 0,
paramName: '',
paramCode: '',
paramValue: '',
paramType: 1,
remark: ''
},
dataRule: {
paramName: [
{ required: true, message: '参数名不能为空', trigger: 'blur' }
],
paramCode: [
{ required: true, message: '参数编码不能为空', trigger: 'blur' }
],
paramValue: [
{ required: true, message: '参数值不能为空', trigger: 'blur' }
],
paramType: [
{
required: true,message: '参数类型不能为空',trigger: 'change'
}]
}
}
},
methods: {
init (id,row) {
console.log('字典详情',row)
this.dataForm.id = id || 0
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.dataForm.paramName = row.paramName
this.dataForm.paramCode = row.paramCode
this.dataForm.paramValue = row.paramValue
this.dataForm.paramType = row.paramType
this.dataForm.remark = row.remark
}
})
},
// 表单提交
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/sys/dictionary/updateBaseParam`),
method: 'post',
data: this.$http.adornData({
'id': this.dataForm.id || undefined,
'paramName': this.dataForm.paramName,
'paramCode': this.dataForm.paramCode,
'paramValue': this.dataForm.paramValue,
'paramType': this.dataForm.paramType,
'remark': this.dataForm.remark
})
}).then(({data}) => {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
})
}
}
}
</script>
<template>
<div class="mod-config">
<avue-crud ref="crud"
:page="page"
:data="dataList"
:option="tableOption"
@search-change="searchChange"
@selection-change="selectionChange"
@on-load="getDataList">
<template slot="menuLeft">
<el-button type="primary"
icon="el-icon-plus"
size="small"
@click.stop="addOrUpdateHandle()">新增</el-button>
<!-- <el-button type="danger"-->
<!-- @click="deleteHandle()"-->
<!-- size="small"-->
<!-- :disabled="dataListSelections.length <= 0">批量删除</el-button>-->
</template>
<template slot-scope="scope"
slot="menu">
<el-button type="primary"
icon="el-icon-edit"
size="small"
@click.stop="addOrUpdateHandle(scope.row.id,scope.row)">编辑</el-button>
<el-button type="danger"
icon="el-icon-delete"
size="small"
@click.stop="deleteHandle(scope.row.id,scope.row)">删除</el-button>
</template>
</avue-crud>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible"
ref="addOrUpdate"
@refreshDataList="getDataList"></add-or-update>
</div>
</template>
<script>
import { tableOption } from '@/crud/sys/dictionary'
import AddOrUpdate from './dictionary-add-or-update'
export default {
data () {
return {
dataList: [],
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false,
tableOption: tableOption,
page: {
total: 0, // 总页数
currentPage: 1, // 当前页数
pageSize: 10 // 每页显示多少条
}
}
},
components: {
AddOrUpdate
},
methods: {
// 获取数据列表
getDataList (page, params) {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/sys/dictionary/queryListPage'),
method: 'get',
params: this.$http.adornParams(
Object.assign(
{
current: page == null ? this.page.currentPage : page.currentPage,
size: page == null ? this.page.pageSize : page.pageSize
},
params
)
)
}).then(({ data }) => {
this.dataList = data.records
this.page.total = data.total
this.dataListLoading = false
})
},
// 条件查询
searchChange (params) {
this.getDataList(this.page, params)
},
// 多选变化
selectionChange (val) {
this.dataListSelections = val
},
// 新增 / 修改
addOrUpdateHandle (id,row) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id,row)
})
},
// 删除
deleteHandle (id,row) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.id
})
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let currentRow = row
currentRow.isDelete= 1
this.$http({
url: this.$http.adornUrl('/sys/dictionary/updateBaseParam'),
method: 'POST',
data: this.$http.adornData(currentRow)
}).then(({ data }) => {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
})
}).catch(() => { })
}
}
}
</script>
......@@ -8,7 +8,7 @@
window.SITE_CONFIG['baseUrl'] = 'http://192.168.0.143:8085'
// 静态资源文件url
window.SITE_CONFIG['resourcesUrl'] = 'http://192.168.31.108/zhqgImages'
window.SITE_CONFIG['resourcesUrl'] = 'http://192.168.31.118/zhqgImages'
// cdn地址 = 域名 + 版本号
window.SITE_CONFIG['domain'] = './' // 域名
window.SITE_CONFIG['version'] = '' // 版本号(年月日时分)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment