修改接口
parent
5e2336c530
commit
321d8b1fca
|
@ -7,3 +7,11 @@ export const fetchData = query => {
|
||||||
params: query
|
params: query
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const upUserData = query => {
|
||||||
|
return request({
|
||||||
|
url: 'http://127.0.0.1:8000/userlist',
|
||||||
|
method: 'put',
|
||||||
|
params: query
|
||||||
|
});
|
||||||
|
};
|
|
@ -88,14 +88,14 @@
|
||||||
</el-form>
|
</el-form>
|
||||||
<span slot="footer" class="dialog-footer">
|
<span slot="footer" class="dialog-footer">
|
||||||
<el-button @click="editVisible = false">取 消</el-button>
|
<el-button @click="editVisible = false">取 消</el-button>
|
||||||
<el-button type="primary" @click="saveEdit">确 定</el-button>
|
<el-button type="primary" @click="saveEdit(form.uuid, form.name, form.department)">确 定</el-button>
|
||||||
</span>
|
</span>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { fetchData } from '../../api/index';
|
import { fetchData, upUserData } from '../../api/index';
|
||||||
export default {
|
export default {
|
||||||
name: 'basetable',
|
name: 'basetable',
|
||||||
data() {
|
data() {
|
||||||
|
@ -120,7 +120,7 @@ export default {
|
||||||
this.getData();
|
this.getData();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 获取 easy-mock 的模拟数据
|
// 获取数据
|
||||||
getData() {
|
getData() {
|
||||||
fetchData(this.query).then(res => {
|
fetchData(this.query).then(res => {
|
||||||
console.log(res);
|
console.log(res);
|
||||||
|
@ -161,15 +161,27 @@ export default {
|
||||||
},
|
},
|
||||||
// 编辑操作
|
// 编辑操作
|
||||||
handleEdit(index, row) {
|
handleEdit(index, row) {
|
||||||
this.idx = index;
|
this.idx = index,
|
||||||
this.form = row;
|
this.form = row,
|
||||||
this.editVisible = true;
|
this.editVisible = true;
|
||||||
|
|
||||||
},
|
},
|
||||||
// 保存编辑
|
// 保存编辑
|
||||||
saveEdit() {
|
saveEdit(uuid, name, department) {
|
||||||
this.editVisible = false;
|
this.editVisible = false;
|
||||||
this.$message.success(`修改第 ${this.idx + 1} 行成功`);
|
this.$message.success(`修改成功`);
|
||||||
this.$set(this.tableData, this.idx, this.form);
|
this.uuid = uuid;
|
||||||
|
this.department = department;
|
||||||
|
this.name = name;
|
||||||
|
let data = {
|
||||||
|
department : this.department,
|
||||||
|
name : this.name,
|
||||||
|
uuid : this.uuid,
|
||||||
|
|
||||||
|
}
|
||||||
|
upUserData(data).then((res)=>{
|
||||||
|
console.log(res)
|
||||||
|
})
|
||||||
},
|
},
|
||||||
// 分页导航
|
// 分页导航
|
||||||
handlePageChange(val) {
|
handlePageChange(val) {
|
||||||
|
|
Loading…
Reference in New Issue