Commit b43a6fec authored by 黎博's avatar 黎博

bug fix

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