Преглед на файлове

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

docs_0727
lb преди 1 година
родител
ревизия
79ed2d4f6a
променени са 6 файла, в които са добавени 160 реда и са изтрити 39 реда
  1. +2
    -2
      public/index.html
  2. +1
    -1
      src/components/noTemplateComponents/operationComponent.js
  3. +5
    -0
      src/views/modules/pms/order/components/DialogJustForm.vue
  4. +120
    -26
      src/views/modules/pms/order/components/ListSectionWithHead.vue
  5. +6
    -5
      src/views/modules/pms/order/config.js
  6. +26
    -5
      src/views/modules/pms/order/index.vue

+ 2
- 2
public/index.html Целия файл

@@ -39,8 +39,8 @@
<script>
// 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.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.62:8080/pms-am'; // tao
window.SITE_CONFIG['apiURL'] = 'http://192.168.1.21:8080/pms-am'; // xv
</script>
<% } %>
<!-- 集成测试环境 -->


+ 1
- 1
src/components/noTemplateComponents/operationComponent.js Целия файл

@@ -81,7 +81,7 @@ export default {
style: { color: this.colors[opt.name] || '#0b58ff' },
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]
)
)
}


+ 5
- 0
src/views/modules/pms/order/components/DialogJustForm.vue Целия файл

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


+ 120
- 26
src/views/modules/pms/order/components/ListSectionWithHead.vue Целия файл

@@ -26,23 +26,21 @@
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper"
></el-pagination>

<DialogJustForm ref="order-dialog" v-if="dialogVisible" />
</section>
</template>

<script>
import BaseListTable from "./BaseListTable.vue";
import BaseSearchForm from "./BaseSearchForm.vue";
import DialogWithMenu from "@/components/DialogWithMenu.vue";
import DialogJustForm from "./DialogJustForm.vue";
import moment from "moment";

const DIALOG_WITH_MENU = "DialogWithMenu";
const DIALOG_JUST_FORM = "DialogJustForm";
const dictList = JSON.parse(localStorage.getItem("dictList"));

export default {
name: "ListSectionWithHead",
components: { BaseSearchForm, BaseListTable, DialogWithMenu, DialogJustForm },
components: { BaseSearchForm, BaseListTable, DialogJustForm },
props: {
headConfig: {
type: Object,
@@ -71,18 +69,25 @@ export default {
type: Object,
default: () => ({}),
},
refreshKey: {
type: String,
required: true,
},
},
computed: {
dialogType() {
return this.dialogConfigs.menu ? DIALOG_WITH_MENU : DIALOG_JUST_FORM;
},
},

watch: {
refreshKey(newVal) {
// 外部触发更新列表
this.getAList(Object.assign({}, this.listQuery, this.extraSearchConditions, this.params));
},
},
data() {
return {
refreshLayoutKey: null,
DIALOG_WITH_MENU,
DIALOG_JUST_FORM,
dialogVisible: false,
tableLoading: false,
params: {}, // 由 search form 生成的查询条件
@@ -90,21 +95,6 @@ export default {
limit: 20,
page: 1,
},
conditions: {
ongoing: {
limit: 20,
code: "",
page: 1,
},
pending: {
limit: 20,
page: 1,
},
finished: {
limit: 20,
page: 1,
},
},
dataList: [],
totalPage: 0,
};
@@ -155,9 +145,113 @@ export default {
// 编辑、删除、跳转路由、打开弹窗(动态component)都可以在配置里加上 url
// payload: { type: string, data: string | number | object }
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": {
// 确认是否删除
return this.$confirm(`确定要删除 "${data.name}" 吗?`, "提示", {
return this.$confirm(`确定要删除 "${data.code ?? data.id}" 吗?`, "提示", {
confirmButtonText: "确认",
cancelButtonText: "我再想想",
type: "warning",
@@ -165,7 +259,7 @@ export default {
.then(() => {
// this.$http.delete(this.urls.base + `/${data}`).then((res) => {
this.$http({
url: this.urls.base,
url: '/pms/order',
method: "DELETE",
data: [`${data.id}`],
}).then(({ data: res }) => {
@@ -232,7 +326,7 @@ export default {
this.dialogVisible = true;

this.$nextTick(() => {
// this.$refs["edit-dialog"].init(/** some args... */ row_id, detail_mode);
this.$refs["order-dialog"].init(/** some args... */ row_id, detail_mode);
});
},
},


+ 6
- 5
src/views/modules/pms/order/config.js Целия файл

@@ -23,7 +23,7 @@ export default function () {
const operations = {
'ongoing': [
// { 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: 'move-up', label: '上移', icon: 'caret-top', 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-to-top', label: '至顶', icon: 'upload2', showText: true },
{ name: 'move-to-bottom', label: '至底', icon: 'download', showText: true },
'delete'
{ name: 'delete', emitFull: true, permission: '' }
],
'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: "托盘码放砖数", },
{ prop: "description", label: "详情", subcomponent: TableTextComponent },
{ width: 200, prop: "remark", label: "备注" },
{
type !== 'finished' ? {
prop: "operations",
name: "操作",
fixed: "right",
subcomponent: TableOperaionComponent,
options: operations[type],
width: operations[type].length * 64
}
}: {}
];




+ 26
- 5
src/views/modules/pms/order/index.vue Целия файл

@@ -10,28 +10,34 @@
<!-- <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"
/>
<ListSectionWithHead
@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"
/>
<ListSectionWithHead
@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>

@@ -70,6 +76,11 @@ export default {
allUrls: urls,
dialogConfigs,
activeTable: "",
keys: {
ongoing: Math.random().toString(),
pending: Math.random().toString(),
finished: Math.random().toString(),
},
};
// return {
// dataList: [
@@ -107,6 +118,16 @@ export default {
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>


Зареждане…
Отказ
Запис