update 更新除涉及dialog之外的所有操作

This commit is contained in:
lb 2023-03-09 15:07:55 +08:00
parent faa1daa343
commit 79ed2d4f6a
6 changed files with 160 additions and 39 deletions

View File

@ -39,8 +39,8 @@
<script> <script>
// window.SITE_CONFIG['apiURL'] = 'http://192.168.1.103:8080/pms-am'; // window.SITE_CONFIG['apiURL'] = 'http://192.168.1.103:8080/pms-am';
// window.SITE_CONFIG['apiURL'] = 'http://192.168.1.49:8080/pms-am'; // tengyun // window.SITE_CONFIG['apiURL'] = 'http://192.168.1.49:8080/pms-am'; // tengyun
window.SITE_CONFIG['apiURL'] = 'http://192.168.1.62:8080/pms-am'; // tao // window.SITE_CONFIG['apiURL'] = 'http://192.168.1.62:8080/pms-am'; // tao
// window.SITE_CONFIG['apiURL'] = 'http://192.168.1.21:8080/pms-am'; // xv window.SITE_CONFIG['apiURL'] = 'http://192.168.1.21:8080/pms-am'; // xv
</script> </script>
<% } %> <% } %>
<!-- 集成测试环境 --> <!-- 集成测试环境 -->

View File

@ -81,7 +81,7 @@ export default {
style: { color: this.colors[opt.name] || '#0b58ff' }, style: { color: this.colors[opt.name] || '#0b58ff' },
on: { click: this.emit.bind(null, opt) } on: { click: this.emit.bind(null, opt) }
}, },
opt.icon ? opt.showText ? this.text[opt.name] ?? opt.label : '' : '' opt.icon ? opt.showText ? this.text[opt.name] ?? opt.label : '' : opt.label ?? this.text[opt.name]
) )
) )
} }

View File

@ -5,6 +5,7 @@
@close="handleClose" @close="handleClose"
:destroy-on-close="false" :destroy-on-close="false"
:close-on-click-modal="configs.clickModalToClose ?? true" :close-on-click-modal="configs.clickModalToClose ?? true"
:fullscreen="fullscreen"
> >
<!-- title --> <!-- title -->
<div slot="title" class="dialog-title"> <div slot="title" class="dialog-title">
@ -105,6 +106,10 @@ export default {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
fullscreen: {
type: Boolean,
default: false
}
}, },
inject: ["urls"], inject: ["urls"],
data() { data() {

View File

@ -26,23 +26,21 @@
:total="totalPage" :total="totalPage"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
></el-pagination> ></el-pagination>
<DialogJustForm ref="order-dialog" v-if="dialogVisible" />
</section> </section>
</template> </template>
<script> <script>
import BaseListTable from "./BaseListTable.vue"; import BaseListTable from "./BaseListTable.vue";
import BaseSearchForm from "./BaseSearchForm.vue"; import BaseSearchForm from "./BaseSearchForm.vue";
import DialogWithMenu from "@/components/DialogWithMenu.vue";
import DialogJustForm from "./DialogJustForm.vue"; import DialogJustForm from "./DialogJustForm.vue";
import moment from "moment"; import moment from "moment";
const DIALOG_WITH_MENU = "DialogWithMenu";
const DIALOG_JUST_FORM = "DialogJustForm";
const dictList = JSON.parse(localStorage.getItem("dictList")); const dictList = JSON.parse(localStorage.getItem("dictList"));
export default { export default {
name: "ListSectionWithHead", name: "ListSectionWithHead",
components: { BaseSearchForm, BaseListTable, DialogWithMenu, DialogJustForm }, components: { BaseSearchForm, BaseListTable, DialogJustForm },
props: { props: {
headConfig: { headConfig: {
type: Object, type: Object,
@ -71,18 +69,25 @@ export default {
type: Object, type: Object,
default: () => ({}), default: () => ({}),
}, },
refreshKey: {
type: String,
required: true,
},
}, },
computed: { computed: {
dialogType() { dialogType() {
return this.dialogConfigs.menu ? DIALOG_WITH_MENU : DIALOG_JUST_FORM; return this.dialogConfigs.menu ? DIALOG_WITH_MENU : DIALOG_JUST_FORM;
}, },
}, },
watch: {
refreshKey(newVal) {
//
this.getAList(Object.assign({}, this.listQuery, this.extraSearchConditions, this.params));
},
},
data() { data() {
return { return {
refreshLayoutKey: null, refreshLayoutKey: null,
DIALOG_WITH_MENU,
DIALOG_JUST_FORM,
dialogVisible: false, dialogVisible: false,
tableLoading: false, tableLoading: false,
params: {}, // search form params: {}, // search form
@ -90,21 +95,6 @@ export default {
limit: 20, limit: 20,
page: 1, page: 1,
}, },
conditions: {
ongoing: {
limit: 20,
code: "",
page: 1,
},
pending: {
limit: 20,
page: 1,
},
finished: {
limit: 20,
page: 1,
},
},
dataList: [], dataList: [],
totalPage: 0, totalPage: 0,
}; };
@ -155,9 +145,113 @@ export default {
// component url // component url
// payload: { type: string, data: string | number | object } // payload: { type: string, data: string | number | object }
switch (type) { switch (type) {
//
case "confirm-order": {
this.$http
.post("/pms/order/confirm", data, {
headers: {
"Content-Type": "application/json",
},
})
.then(({ data: res }) => {
if (res.code === 0) {
// success
this.$message({
message: "已确认!",
type: "success",
duration: 2000,
onClose: () => {
this.getAList(Object.assign({}, this.listQuery, this.extraSearchConditions, this.params));
this.$emit("refresh-tables", ["ongoing"]);
},
});
} else {
// failed
throw new Error(res.msg);
}
})
.catch((errMsg) => {
this.$message({
message: errMsg,
type: "error",
duration: 2000,
});
});
break;
}
//
case "destroy-order":
//
case "end-order": {
this.$http
.post("/pms/order/end", data, {
headers: {
"Content-Type": "application/json",
},
})
.then(({ data: res }) => {
if (res.code === 0) {
// success
this.$message({
message: "已结束订单!",
type: "success",
duration: 2000,
onClose: () => {
this.getAList(Object.assign({}, this.listQuery, this.extraSearchConditions, this.params));
this.$emit("refresh-tables", ["finished"]);
},
});
} else {
// failed
throw new Error(res.msg);
}
})
.catch((errMsg) => {
this.$message({
message: errMsg,
type: "error",
duration: 2000,
});
});
break;
}
//
case "move-up":
//
case "move-down":
//
case "move-to-top":
//
case "move-to-bottom": {
const locationMap = {
"move-up": 1,
"move-down": 2,
"move-to-bottom": 3,
"move-to-top": 0,
};
return this.$http
.get("/pms/order/change", { params: { id: data, location: locationMap[type] } })
.then(({ data: res }) => {
if (res.code === 0) {
// success
this.getAList(Object.assign({}, this.listQuery, this.extraSearchConditions, this.params));
} else {
// failed
throw new Error(res.msg);
}
})
.catch((errMsg) => {
this.$message({
message: errMsg,
type: "error",
duration: 2000,
});
});
}
case "delete": { case "delete": {
// //
return this.$confirm(`确定要删除 "${data.name}" 吗?`, "提示", { return this.$confirm(`确定要删除 "${data.code ?? data.id}" 吗?`, "提示", {
confirmButtonText: "确认", confirmButtonText: "确认",
cancelButtonText: "我再想想", cancelButtonText: "我再想想",
type: "warning", type: "warning",
@ -165,7 +259,7 @@ export default {
.then(() => { .then(() => {
// this.$http.delete(this.urls.base + `/${data}`).then((res) => { // this.$http.delete(this.urls.base + `/${data}`).then((res) => {
this.$http({ this.$http({
url: this.urls.base, url: '/pms/order',
method: "DELETE", method: "DELETE",
data: [`${data.id}`], data: [`${data.id}`],
}).then(({ data: res }) => { }).then(({ data: res }) => {
@ -232,7 +326,7 @@ export default {
this.dialogVisible = true; this.dialogVisible = true;
this.$nextTick(() => { this.$nextTick(() => {
// this.$refs["edit-dialog"].init(/** some args... */ row_id, detail_mode); this.$refs["order-dialog"].init(/** some args... */ row_id, detail_mode);
}); });
}, },
}, },

View File

@ -23,7 +23,7 @@ export default function () {
const operations = { const operations = {
'ongoing': [ 'ongoing': [
// { name: 'view-detail', label: '查看详情' }, // { name: 'view-detail', label: '查看详情' },
{ name: 'confirm-order', label: '确认', icon: 'success', showText: true }, // { name: 'confirm-order', label: '确认', icon: 'success', showText: true },
{ name: 'end-order', label: '结束', icon: 'error', showText: true }, { name: 'end-order', label: '结束', icon: 'error', showText: true },
{ name: 'move-up', label: '上移', icon: 'caret-top', showText: true }, { name: 'move-up', label: '上移', icon: 'caret-top', showText: true },
{ name: 'move-down', label: '下移', icon: 'caret-bottom', showText: true }, { name: 'move-down', label: '下移', icon: 'caret-bottom', showText: true },
@ -38,10 +38,11 @@ export default function () {
{ name: 'move-down', label: '下移', icon: 'caret-bottom', showText: true }, { name: 'move-down', label: '下移', icon: 'caret-bottom', showText: true },
{ name: 'move-to-top', label: '至顶', icon: 'upload2', showText: true }, { name: 'move-to-top', label: '至顶', icon: 'upload2', showText: true },
{ name: 'move-to-bottom', label: '至底', icon: 'download', showText: true }, { name: 'move-to-bottom', label: '至底', icon: 'download', showText: true },
'delete' { name: 'delete', emitFull: true, permission: '' }
], ],
'finished': [ 'finished': [
{ name: 'end-order', label: '结束订单', icon: 'error', showText: true }, // { name: 'view', label: '查看详情' }
// { name: 'end-order', label: '结束订单', icon: 'error', showText: true },
] ]
} }
@ -76,14 +77,14 @@ export default function () {
{ width: 120, prop: "pcsKilnCar", label: "托盘码放砖数", }, { width: 120, prop: "pcsKilnCar", label: "托盘码放砖数", },
{ prop: "description", label: "详情", subcomponent: TableTextComponent }, { prop: "description", label: "详情", subcomponent: TableTextComponent },
{ width: 200, prop: "remark", label: "备注" }, { width: 200, prop: "remark", label: "备注" },
{ type !== 'finished' ? {
prop: "operations", prop: "operations",
name: "操作", name: "操作",
fixed: "right", fixed: "right",
subcomponent: TableOperaionComponent, subcomponent: TableOperaionComponent,
options: operations[type], options: operations[type],
width: operations[type].length * 64 width: operations[type].length * 64
} }: {}
]; ];

View File

@ -10,28 +10,34 @@
<!-- <ListViewWithHead :table-configs="tableConfigs" :head-configs="headFormConfigs" :dialog-configs="dialogConfigs" /> --> <!-- <ListViewWithHead :table-configs="tableConfigs" :head-configs="headFormConfigs" :dialog-configs="dialogConfigs" /> -->
<ListSectionWithHead <ListSectionWithHead
id="ongoing" id="ongoing"
:refresh-key="keys.ongoing"
:extra-search-conditions="{ code: '' }" :extra-search-conditions="{ code: '' }"
:page-url="allUrls.confirmedOrder" :page-url="allUrls.confirmedOrder"
:table-config="{ table: null, column: tableConfigs.ongoingTable }" :table-config="{ table: null, column: tableConfigs.ongoingTable }"
:head-config="{ title: '进行中的订单', form: headFormConfigs.ongoingTableSearch }" :head-config="{ title: '进行中的订单', form: headFormConfigs.ongoingTableSearch }"
:dialog-config="null" :dialog-config="null"
/> @refresh-tables="handleRefreshTable"
<ListSectionWithHead />
<ListSectionWithHead
id="pending" id="pending"
:refresh-key="keys.pending"
:extra-search-conditions="{ code: '' }" :extra-search-conditions="{ code: '' }"
:page-url="allUrls.unConfirmedOrder" :page-url="allUrls.unConfirmedOrder"
:table-config="{ table: null, column: tableConfigs.pendingTable }" :table-config="{ table: null, column: tableConfigs.pendingTable }"
:head-config="{ title: '等待中的订单', form: headFormConfigs.pendingTableSearch }" :head-config="{ title: '等待中的订单', form: headFormConfigs.pendingTableSearch }"
:dialog-config="null" :dialog-config="null"
/> @refresh-tables="handleRefreshTable"
<ListSectionWithHead />
<ListSectionWithHead
id="finished" id="finished"
:refresh-key="keys.finished"
:extra-search-conditions="{ code: '' }" :extra-search-conditions="{ code: '' }"
:page-url="allUrls.finishedOrder" :page-url="allUrls.finishedOrder"
:table-config="{ table: null, column: tableConfigs.finishedTable }" :table-config="{ table: null, column: tableConfigs.finishedTable }"
:head-config="{ title: '完成的订单', form: headFormConfigs.finishedTableSearch }" :head-config="{ title: '完成的订单', form: headFormConfigs.finishedTableSearch }"
:dialog-config="null" :dialog-config="null"
/> @refresh-tables="handleRefreshTable"
/>
</div> </div>
</div> </div>
@ -70,6 +76,11 @@ export default {
allUrls: urls, allUrls: urls,
dialogConfigs, dialogConfigs,
activeTable: "", activeTable: "",
keys: {
ongoing: Math.random().toString(),
pending: Math.random().toString(),
finished: Math.random().toString(),
},
}; };
// return { // return {
// dataList: [ // dataList: [
@ -107,6 +118,16 @@ export default {
const [item] = this.dataList.splice($index, 1); const [item] = this.dataList.splice($index, 1);
this.dataList.splice($index + 1, 0, item); 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> </script>