pms-aomei/src/views/modules/pms/order/index.vue

75 lines
2.3 KiB
Vue
Raw Normal View History

2023-03-07 15:29:08 +08:00
<template>
2023-03-08 11:17:52 +08:00
<ListViewWithHead :table-configs="tableConfigs" :head-configs="headFormConfigs" :dialog-configs="dialogConfigs" />
2023-03-08 10:52:14 +08:00
<!-- <div style="padding: 16px; background: #fff; border-radius: 8px">
2023-03-07 15:34:43 +08:00
<el-table :data="dataList">
<el-table-column key="id" prop="id" label="ID"></el-table-column>
<el-table-column key="name" prop="name" label="名字"></el-table-column>
<el-table-column key="age" prop="age" label="年龄"></el-table-column>
<el-table-column key="opt" label="操作">
<template slot-scope="scope">
<el-button @click.native.prevent="handleUp(scope)">up</el-button>
<el-button @click.native.prevent="handleDown(scope)">down</el-button>
</template>
</el-table-column>
</el-table>
2023-03-08 10:52:14 +08:00
</div> -->
2023-03-07 15:29:08 +08:00
</template>
<script>
2023-03-07 15:34:43 +08:00
import initConfig from "./config";
2023-03-08 10:52:14 +08:00
import ListViewWithHead from "./components/ListViewWithHead.vue";
2023-03-07 15:29:08 +08:00
export default {
2023-03-07 15:34:43 +08:00
name: "OrderView",
2023-03-08 10:52:14 +08:00
components: { ListViewWithHead },
2023-03-07 15:34:43 +08:00
provide() {
return {
urls: this.allUrls,
};
},
data() {
2023-03-08 10:52:14 +08:00
const { tableConfigs, headFormConfigs, urls, dialogConfigs } = initConfig.call(this);
2023-03-07 15:34:43 +08:00
return {
2023-03-08 10:52:14 +08:00
tableConfigs,
headFormConfigs,
allUrls: urls,
dialogConfigs,
2023-03-07 15:34:43 +08:00
};
2023-03-08 10:52:14 +08:00
// return {
// dataList: [
// { id: 1, name: "张三", age: 12 },
// { id: 2, name: "李四", age: 13 },
// { id: 3, name: "王五", age: 14 },
// { id: 4, name: "陈鼻", age: 15 },
// { id: 5, name: "肖上唇", age: 16 },
// ],
// limit: 20
// };
2023-03-07 15:34:43 +08:00
},
created() {},
mounted() {},
methods: {
handleUp({ $index, row }) {
console.log("row: ", $index, row);
// const { id } = row;
// const index = this.dataList.findIndex((o) => o.id === id);
// console.log("index: ", index);
if ($index === 0) return;
const [item] = this.dataList.splice($index, 1);
console.log("item: ", item);
this.dataList.splice($index - 1, 0, item);
console.log("dataList: ", this.dataList);
// this.dataList
},
handleDown({ $index, row }) {
// const { id } = row;
if ($index === this.limit) return;
const [item] = this.dataList.splice($index, 1);
this.dataList.splice($index + 1, 0, item);
},
},
2023-03-07 15:29:08 +08:00
};
</script>
<style scoped></style>