update order

This commit is contained in:
lb 2023-03-07 15:34:43 +08:00
parent 5f5a9f645d
commit 1bbb5c76de
2 changed files with 130 additions and 53 deletions

View File

@ -3,45 +3,80 @@ import TableTextComponent from "@/components/noTemplateComponents/detailComponen
import StatusComponent from "@/components/noTemplateComponents/statusComponent";
import { timeFilter, dictFilter } from "@/utils/filters";
function changeOrderSort(orderId, location) {
/** this - vue instance, 0 - to top, 1 - up, 2 - down, 3 - to bottom */
return this.$http.get('/pms/order/change', { params: { id: orderId, location } }).then(({ data: res }) => {
if (res.code === 0) {
} else throw new Error(`${res.code}: ${res.msg}`)
}).catch(err => {
this.$message({
message: err,
type: 'error',
duration: 1500
})
})
}
export default function () {
const operations = {
'ongoing': ['edit'],
'pending': ['edit', 'delete'],
'finished': ['edit']
'ongoing': [
{ name: 'view-detail', label: '查看详情' },
{ name: 'end-order', label: '结束订单' },
{ name: 'confirm-order', label: '确认订单' },
{ name: 'move-to-top', label: 'to top', icon: 'top' },
{ name: 'move-up', label: 'up', icon: 'top' },
{ name: 'move-down', label: 'down', icon: 'top' },
{ name: 'move-to-bottom', label: 'to bottom', icon: 'top' },
{ name: 'destroy-order', label: '废除订单' },
],
'pending': [
{ name: 'confirm-order', label: '确认订单' },
{ name: 'edit' },
{ name: 'move-to-top', label: 'to top' },
{ name: 'move-up', label: 'up' },
{ name: 'move-down', label: 'down' },
{ name: 'move-to-bottom', label: 'to bottom' },
{ name: 'delete' },
],
'finished': [
{ name: 'view-detail', label: '查看详情' }
]
}
const genTableProps = (type /** ongoing, pending, finished */) =>
[
{ type: 'index', label: '序号' },
{ prop: "createTime", label: "添加时间", filter: timeFilter },
{ prop: "statusDictValue", label: "订单状态", filter: dictFilter('order_status') }, // 不可编辑
{ prop: "code", label: "订单号" },
{ prop: "cate", label: "子订单号" },
{ prop: "productCode", label: "物料编号" }, // select, filterable
{ prop: "shapeCode", label: "砖型编号" }, // select, filterable
{ prop: "brand", label: "牌号" }, // select, filterable
{ prop: "addon", label: "addon" },
{ prop: "ai", label: "版本号" }, // auto display according to the 配方
{ prop: "shortDesc", label: "物料号销售文本" },
{ prop: "bomCode", label: "配方编码" },
{ prop: "pressCode", label: "压机号" }, // select, filterable
{ prop: "blenderCode", label: "混料机号" }, // select, filterable
{ prop: "kilnCode", label: "隧道窑号" }, // select, filterable
{ prop: "prodqty", label: "订单砖数" },
{ prop: "ktmp", label: "烧成温度" },
{ prop: "tt", label: "烧成时间" },
{ prop: "yieldqty", label: "已生产数量" }, // uneditable
{ prop: "soqty", label: "销售订单数" },
{ prop: "saleNo", label: "销售订单号" },
{ prop: "saleOrderItem", label: "销售订单item号" },
{ prop: "packTechCode", label: "包装工艺代码" }, // select, filterable
{ prop: "specifications", label: "生产订单类型" },
{ prop: "deliveryTime", label: "发货时间" },
{ prop: "customerCode", label: "客户" },
{ width: 80, type: 'index', label: '序号' },
{ width: 120, prop: "createTime", label: "添加时间", filter: timeFilter },
{ width: 200, prop: "code", label: "订单号" },
{ width: 120, prop: "statusDictValue", label: "订单状态", filter: dictFilter('order_status') }, // 不可编辑
{ width: 200, prop: "cate", label: "子订单号" },
{ width: 200, prop: "productCode", label: "物料编号" }, // select, filterable
{ width: 200, prop: "shapeCode", label: "砖型编号" }, // select, filterable
{ width: 120, prop: "brand", label: "牌号" }, // select, filterable
{ width: 80, prop: "addon", label: "addon" },
{ width: 120, prop: "ai", label: "版本号" }, // auto display according to the 配方
{ width: 200, prop: "shortDesc", label: "物料号销售文本" },
{ width: 200, prop: "bomCode", label: "配方编码" },
{ width: 200, prop: "pressCode", label: "压机号" }, // select, filterable
{ width: 200, prop: "blenderCode", label: "混料机号" }, // select, filterable
{ width: 200, prop: "kilnCode", label: "隧道窑号" }, // select, filterable
{ width: 120, prop: "prodqty", label: "订单砖数" },
{ width: 120, prop: "ktmp", label: "烧成温度" },
{ width: 120, prop: "tt", label: "烧成时间" },
{ width: 120, prop: "yieldqty", label: "已生产数量" }, // uneditable
{ width: 120, prop: "soqty", label: "销售订单数" },
{ width: 200, prop: "saleNo", label: "销售订单号" },
{ width: 200, prop: "saleOrderItem", label: "销售订单item号" },
{ width: 200, prop: "packTechCode", label: "包装工艺代码" }, // select, filterable
{ width: 80, prop: "specifications", label: "生产订单类型" },
{ width: 120, prop: "deliveryTime", label: "发货时间" },
{ width: 120, prop: "customerCode", label: "客户" },
// { prop: "description", label: "详情", subcomponent: TableTextComponent },
{ prop: "pcsKilnCar", label: "托盘码放砖数", },
{ prop: "remark", label: "备注" },
{ width: 120, prop: "pcsKilnCar", label: "托盘码放砖数", },
{ width: 200, prop: "remark", label: "备注" },
{
prop: "operations",
name: "操作",

View File

@ -1,31 +1,73 @@
<template>
<ListViewWithHead :table-configs="tableConfigs" :head-config="headFormConfigs" :dialog-configs="dialogConfigs" />
<!-- <ListViewWithHead :table-configs="tableConfigs" :head-config="headFormConfigs" :dialog-configs="dialogConfigs" /> -->
<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 initConfig from "./config";
// import ListViewWithHead from "./components/ListViewWithHead.vue";
export default {
name: 'OrderView',
components: { ListViewWithHead },
provide() {
return {
urls: this.allUrls
}
},
data() {
const { tableConfigs, headFormConfigs, urls, dialogConfigs } = initConfig.call(this);
return {
tableConfigs,
headFormConfigs,
allUrls: urls,
dialogConfigs,
};
},
created() {},
mounted() {},
methods: {},
name: "OrderView",
// components: { ListViewWithHead },
provide() {
return {
urls: this.allUrls,
};
},
data() {
// const { tableConfigs, headFormConfigs, urls, dialogConfigs } = initConfig.call(this);
// return {
// tableConfigs,
// headFormConfigs,
// allUrls: urls,
// dialogConfigs,
// };
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() {},
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);
},
},
};
</script>