181 lines
5.2 KiB
Vue
181 lines
5.2 KiB
Vue
<template>
|
|
<div class="main-container">
|
|
<div class="inner-sidebar">
|
|
<a href="#ongoing" :class="{ active: activeTable === '#ongoing' }">进行中的订单</a>
|
|
<a href="#pending" :class="{ active: activeTable === '#pending' }">等待订单</a>
|
|
<a href="#finished" :class="{ active: activeTable === '#finished' }">完成订单</a>
|
|
</div>
|
|
|
|
<div class="list-view-with-head-list">
|
|
<!-- <ListViewWithHead :table-configs="tableConfigs" :head-configs="headFormConfigs" :dialog-configs="dialogConfigs" /> -->
|
|
<ListSectionWithHead
|
|
id="ongoing"
|
|
:refresh-key="keys.ongoing"
|
|
:extra-search-conditions="{ code: '' }"
|
|
:page-url="allUrls.confirmedOrder"
|
|
:table-config="{ table: null, column: tableConfigs.ongoingTable }"
|
|
:head-config="{ title: '进行中的订单', form: headFormConfigs.ongoingTableSearch }"
|
|
:dialog-config="null"
|
|
@refresh-tables="handleRefreshTable"
|
|
/>
|
|
<ListSectionWithHead
|
|
id="pending"
|
|
:refresh-key="keys.pending"
|
|
:extra-search-conditions="{ code: '' }"
|
|
:page-url="allUrls.unConfirmedOrder"
|
|
:table-config="{ table: null, column: tableConfigs.pendingTable }"
|
|
:head-config="{ title: '等待中的订单', form: headFormConfigs.pendingTableSearch }"
|
|
:dialog-config="null"
|
|
@refresh-tables="handleRefreshTable"
|
|
/>
|
|
<ListSectionWithHead
|
|
id="finished"
|
|
:refresh-key="keys.finished"
|
|
:extra-search-conditions="{ code: '' }"
|
|
:page-url="allUrls.finishedOrder"
|
|
:table-config="{ table: null, column: tableConfigs.finishedTable }"
|
|
:head-config="{ title: '完成的订单', form: headFormConfigs.finishedTableSearch }"
|
|
:dialog-config="null"
|
|
@refresh-tables="handleRefreshTable"
|
|
/>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- <div style="padding: 16px; background: #fff; border-radius: 8px">
|
|
<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>
|
|
</div> -->
|
|
</template>
|
|
|
|
<script>
|
|
import initConfig from "./config";
|
|
import ListViewWithHead from "./components/ListViewWithHead.vue";
|
|
import ListSectionWithHead from "./components/ListSectionWithHead.vue";
|
|
export default {
|
|
name: "OrderView",
|
|
components: { ListViewWithHead, ListSectionWithHead },
|
|
provide() {
|
|
return {
|
|
urls: this.allUrls,
|
|
};
|
|
},
|
|
data() {
|
|
const { tableConfigs, headFormConfigs, urls, dialogConfigs } = initConfig.call(this);
|
|
return {
|
|
tableConfigs,
|
|
headFormConfigs,
|
|
allUrls: urls,
|
|
dialogConfigs,
|
|
activeTable: "",
|
|
keys: {
|
|
ongoing: Math.random().toString(),
|
|
pending: Math.random().toString(),
|
|
finished: Math.random().toString(),
|
|
},
|
|
};
|
|
// 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
|
|
// };
|
|
},
|
|
created() {},
|
|
mounted() {},
|
|
watch: {
|
|
$route: function (route) {
|
|
if (route.hash) {
|
|
this.activeTable = route.hash;
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
handleUp({ $index, row }) {
|
|
console.log("row: ", $index, row);
|
|
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);
|
|
},
|
|
//
|
|
handleRefreshTable(tableNameList) {
|
|
if (Array.isArray(tableNameList)) {
|
|
tableNameList.forEach(name => {
|
|
this.keys[name] = Math.random().toString()
|
|
})
|
|
} else {
|
|
console.log('handleRefreshTable 需要传递数组!')
|
|
}
|
|
}
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style scoped>
|
|
.main-container {
|
|
min-height: inherit;
|
|
display: flex;
|
|
}
|
|
|
|
.inner-sidebar {
|
|
position: fixed;
|
|
width: 240px;
|
|
margin-right: 16px;
|
|
padding: 8px 0;
|
|
/* min-height: inherit; */
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
}
|
|
|
|
.inner-sidebar a {
|
|
text-decoration: unset;
|
|
color: #777c;
|
|
padding: 12px;
|
|
width: 100%;
|
|
text-align: center;
|
|
}
|
|
|
|
.inner-sidebar a.active,
|
|
.inner-sidebar a:hover {
|
|
background-color: #f5f7fa;
|
|
color: #000;
|
|
}
|
|
|
|
.inner-sidebar,
|
|
.list-view-with-head-list {
|
|
background: white;
|
|
/* height: 100%; */
|
|
/* min-height: inherit; */
|
|
border-radius: 6px;
|
|
box-shadow: 0 0 1.125px 0.125px rgba(0, 0, 0, 0.125);
|
|
}
|
|
|
|
.list-view-with-head-list {
|
|
width: 1px;
|
|
margin-left: 256px;
|
|
flex-grow: 1;
|
|
}
|
|
</style>
|