Commit b43a6fec authored by 黎博's avatar 黎博

bug fix

parent 47a79d00
......@@ -6,7 +6,8 @@
<el-option v-for="item in moduleList" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
<el-button class="filter-item" type="primary" icon="el-icon-search" @click="searchIndex">搜索</el-button>
<el-button class="filter-item" style="margin-left: 10px;" type="primary" icon="el-icon-edit" @click="handleCreate">添加</el-button>
<el-button class="filter-item" style="margin-left: 10px;" type="primary" icon="el-icon-edit"
@click="handleCreate">添加</el-button>
</div>
<el-table :data="indexList" border fit highlight-current-row style="width: 100%;">
......@@ -34,17 +35,18 @@
<!-- 新增更新对话框 -->
<el-dialog :title="dialogName" :visible.sync="dialogFormVisible">
<el-form ref="dataForm" :rules="rules" :model="temp" label-position="left" label-width="105px" style="width: 90%; margin-left:40px;">
<el-form-item label="类型" prop="type">
<el-select v-model="temp.module" class="filter-item" placeholder="请选择模块">
<el-form ref="dataFormRef" :rules="rules" :model="dataForm" label-position="left" label-width="105px"
style="width: 90%; margin-left:40px;">
<el-form-item label="类型" prop="module">
<el-select v-model="dataForm.module" class="filter-item" placeholder="请选择模块">
<el-option v-for="item in moduleList" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="名称" prop="remark" style="width:100%">
<el-input v-model="temp.name" />
<el-form-item label="名称" prop="name" style="width:100%">
<el-input v-model="dataForm.name" />
</el-form-item>
<el-form-item label="地址" style="width:100%">
<el-input :autosize="{ minRows: 2, maxRows: 4}" v-model="temp.url" type="textarea" placeholder="请输入地址" />
<el-form-item label="地址" prop="url" style="width:100%">
<el-input :autosize="{ minRows: 2, maxRows: 4}" v-model="dataForm.url" type="textarea" placeholder="请输入地址" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
......@@ -54,9 +56,9 @@
</el-dialog>
<!-- 删除对话框 -->
<el-dialog :visible.sync="dialogDeleteVisible" :data="temp" title="删除导航">
<el-dialog :visible.sync="dialogDeleteVisible" :data="dataForm" title="删除导航">
<span>
确定要删除 {{ temp.name }} 吗?
确定要删除 {{ dataForm.name }} 吗?
</span>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogDeleteVisible = false">取消</el-button>
......@@ -84,11 +86,15 @@ export default {
},
indexList: [],
moduleList: [],
temp: {},
dataForm: {},
dialogName: '',
dialogFormVisible: false,
dialogDeleteVisible: false,
rules: {}
rules: {
module: [{ required: true, message: '模块不能为空', trigger: 'blur' }],
name: [{ required: true, message: '名称不能为空', trigger: 'blur' }],
url: [{ required: true, message: 'url不能为空', trigger: 'blur' }]
}
}
},
created() {
......@@ -112,13 +118,18 @@ export default {
// 打开新增对话框
handleCreate() {
this.dialogName = '新增导航'
this.temp = {}
this.dataForm = {}
this.dialogFormVisible = true
},
// 新增/更新导航
createOrUpdateNavigate() {
// 表单验证
this.$refs.dataFormRef.validate((valid) => {
if (!valid) {
return false
} else {
if (this.dialogName === '新增导航') {
addNavigate(this.temp).then((resp) => {
addNavigate(this.dataForm).then((resp) => {
if (resp.data.data === true) {
this.dialogFormVisible = false
this.getNavigateList()
......@@ -129,7 +140,7 @@ export default {
})
}
if (this.dialogName === '更新导航') {
updateNavigate(this.temp).then((resp) => {
updateNavigate(this.dataForm).then((resp) => {
if (resp.data.data === true) {
this.getNavigateList()
this.dialogFormVisible = false
......@@ -139,30 +150,30 @@ export default {
}
})
}
}
})
},
// 打开新窗口
openWindow(row) {},
// 打开更新对话框
handleUpdate(row) {
console.log(row)
this.dialogName = '更新导航'
this.dataForm = {}
this.dataForm = row
this.dialogFormVisible = true
this.temp = {}
this.temp.id = row.id
this.temp.module = row.moduleId
this.temp.name = row.name
this.temp.url = row.url
},
// 删除
handleDelete(row) {
this.temp = {}
this.temp = row
this.dataForm = {}
this.dataForm = row
this.dialogDeleteVisible = true
},
// 删除导航
deleteData() {
var formdata = new FormData()
formdata.set('id', this.temp.id)
deleteNavigate(formdata).then(resp => {
formdata.set('id', this.dataForm.id)
deleteNavigate(formdata).then((resp) => {
if (resp.data.data === true) {
this.dialogDeleteVisible = false
this.getNavigateList()
......
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