From 7d38a7608e97407c6c4204acf720d01fe7e956ab Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期五, 29 十一月 2024 13:36:51 +0800
Subject: [PATCH] #
---
zy-asrs-admin/src/components/orderDetl/edit.vue | 113 ++++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 85 insertions(+), 28 deletions(-)
diff --git a/zy-asrs-admin/src/components/orderDetl/edit.vue b/zy-asrs-admin/src/components/orderDetl/edit.vue
index 8f55e6e..291aafc 100644
--- a/zy-asrs-admin/src/components/orderDetl/edit.vue
+++ b/zy-asrs-admin/src/components/orderDetl/edit.vue
@@ -6,6 +6,7 @@
import { logout } from '@/config.js';
import { formatMessage } from '@/utils/localeUtils.js';
import useTableSearch from '@/utils/tableUtils.jsx';
+import { debounce } from 'lodash-es';
const context = getCurrentInstance()?.appContext.config.globalProperties;
const router = useRouter();
@@ -13,8 +14,9 @@
const TABLE_KEY = 'table-locDetl';
let tableData = ref([]);
-let editTableData = ref([]);
let deleteDetlId = ref([]);
+let orderId = ref(null);
+let isAdd = ref(false);
getColumns();
const {
@@ -27,7 +29,7 @@
columns: [],
});
-state.columns = [
+let defaultColumns = [
{
title: '#',
dataIndex: '_id',
@@ -35,13 +37,13 @@
ellipsis: true,
},
{
- title: formatMessage('db.man_loc_detl.matnr', '鐗╂枡鍙�'),
+ title: formatMessage('db.man_loc_detl.matnr', '鍟嗗搧缂栧彿'),
dataIndex: 'matnr',
width: 140,
ellipsis: true,
},
{
- title: formatMessage('db.man_loc_detl.maktx', '鐗╂枡鍚�'),
+ title: formatMessage('db.man_loc_detl.maktx', '鍟嗗搧鍚嶇О'),
dataIndex: 'maktx',
width: 140,
ellipsis: true,
@@ -60,13 +62,27 @@
ellipsis: true,
editable: true,
},
- {
- title: formatMessage('db.man_loc_detl.memo', '澶囨敞'),
- dataIndex: 'memo',
- width: 140,
- ellipsis: true,
- editable: true,
- },
+ // {
+ // title: formatMessage('db.man_loc_detl.qty', '宸插畬鎴愭暟閲�'),
+ // dataIndex: 'qty',
+ // width: 140,
+ // ellipsis: true,
+ // editable: true,
+ // },
+ // {
+ // title: formatMessage('db.man_loc_detl.workQty', '浣滀笟涓暟閲�'),
+ // dataIndex: 'workQty',
+ // width: 140,
+ // ellipsis: true,
+ // editable: true,
+ // },
+ // {
+ // title: formatMessage('db.man_loc_detl.memo', '澶囨敞'),
+ // dataIndex: 'memo',
+ // width: 140,
+ // ellipsis: true,
+ // editable: true,
+ // },
];
const fieldList = [];
@@ -76,9 +92,27 @@
fieldType: 1
})
let fieldResult = fieldResp.data;
- let tmp = state.columns;
+ let tmp = defaultColumns;
if (fieldResult.code == 200) {
let data = fieldResult.data;
+
+ if (!isAdd.value) {
+ tmp.push({
+ title: formatMessage('db.man_loc_detl.qty', '宸插畬鎴愭暟閲�'),
+ dataIndex: 'qty',
+ width: 140,
+ ellipsis: true,
+ editable: true,
+ })
+
+ tmp.push({
+ title: formatMessage('db.man_loc_detl.workQty', '浣滀笟涓暟閲�'),
+ dataIndex: 'workQty',
+ width: 140,
+ ellipsis: true,
+ editable: true,
+ })
+ }
data.forEach((item) => {
tmp.push({
@@ -91,6 +125,14 @@
})
fieldList.push(item.name);
+ })
+
+ tmp.push({
+ title: formatMessage('db.man_loc_detl.memo', '澶囨敞'),
+ dataIndex: 'memo',
+ width: 140,
+ ellipsis: true,
+ editable: true,
})
tmp.push({
@@ -113,6 +155,7 @@
const openAddDetl = ref(false);
const matChecked = ref([]);
const matQueryList = ref(null);
+const matFetching = ref(false);
const matSelectList = ref([]);
const addDetl = () => {
openAddDetl.value = true;
@@ -128,6 +171,8 @@
maktx: item.data.maktx,
batch: '',
anfme: 0,
+ qty: 0,
+ workQty: 0,
memo: ''
};
fieldList.forEach((field) => {
@@ -147,9 +192,9 @@
matChecked.value = [];
}
-const handleSearch = val => {
+const handleSearch = debounce(val => {
matQuery(val);
-}
+}, 600)
const handleSelect = (value, option) => {
let flag = true;
@@ -177,9 +222,10 @@
matQuery(null);
function matQuery(condition) {
+ matFetching.value = true;
post('/api/mat/page', {
current: 1,
- pageSize: 100,
+ pageSize: 10,
condition: condition
}).then((resp) => {
let result = resp.data;
@@ -187,11 +233,12 @@
result.data.records.forEach((item) => {
tmp.push({
value: item.matnr,
- label: item.matnr,
+ label: item.matnr + '_' + item.maktx,
data: item
})
})
matQueryList.value = tmp;
+ matFetching.value = false;
})
}
@@ -216,11 +263,18 @@
tableData.value = tmp;
}
-watch(editTableData, (newVal, oldVal) => {
- let index = 1;
- let tmp = [];
- if (newVal.length > 0) {
- newVal.forEach((item) => {
+watch(orderId, (newVal, oldVal) => {
+ if (newVal == undefined || newVal == null) {
+ tableData.value = [];
+ getColumns()
+ return;
+ }
+
+ get("/api/orderDetl/orderId/" + newVal, {}).then((resp) => {
+ let result = resp.data;
+ let index = 1;
+ let tmp = [];
+ result.data.forEach((item) => {
let data = {
_id: index++,
detlId: item.id,
@@ -228,6 +282,8 @@
maktx: item.mat$.maktx,
batch: item.batch,
anfme: item.anfme,
+ qty: item.qty,
+ workQty: item.workQty,
memo: item.memo
};
fieldList.forEach((field) => {
@@ -235,14 +291,16 @@
})
tmp.push(data)
})
- }
- tableData.value = tmp;
+ tableData.value = tmp;
+ })
+
})
defineExpose({
tableData,
- editTableData,
+ orderId,
deleteDetlId,
+ isAdd,
})
</script>
@@ -269,9 +327,7 @@
</template>
<template v-if="column.editable">
- <div>
- <a-input v-model:value="record[column.dataIndex]" />
- </div>
+ <a-input v-model:value="record[column.dataIndex]" />
</template>
</template>
</a-table>
@@ -280,7 +336,8 @@
@ok="handleAddDetlOk" @cancel="handleAddDetlCancel">
<a-select v-model:value="matChecked" :options="matQueryList" mode="multiple"
:placeholder="formatMessage('component.orderDetl.edit.selectMat', '璇烽�夋嫨鐗╂枡')" @search="handleSearch"
- @select="handleSelect" @deselect="handleDeselect"></a-select>
+ :filter-option="false" :not-found-content="matFetching ? undefined : null" @select="handleSelect"
+ @deselect="handleDeselect"></a-select>
</a-modal>
</div>
</template>
--
Gitblit v1.9.1