|
@@ -88,7 +88,7 @@
|
|
|
<div class="h-[60vh] overflow-y-auto scroll-bar pt-3" v-loading="allLoading.orderTemplateLoadinng">
|
|
|
<GenerateForm ref="orderTemplateRef" :data="orderTemplate" :value="orderTemplateValue" />
|
|
|
<div>相关产品</div>
|
|
|
- <RelatedProducts ref="relatedProductsRef" :productTableList="productTableList" />
|
|
|
+ <RelatedProducts ref="relatedProductsRef" :productTableList="productTableList" :productTableListValue="productTableListValue" />
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
</div>
|
|
@@ -98,7 +98,7 @@
|
|
|
import { ref, reactive, onMounted, inject, defineExpose } from "vue";
|
|
|
import { getAllListByCode, getFromValue, resetFromValue, getFirstDayOfMonth, getLastDayOfMonth, formatDate, getTemplateKey } from '@/utils/tools'
|
|
|
import { post, get } from "@/utils/request";
|
|
|
-import { tableColumns, GETSYSFILED, GETPERSONNEL, GETGENERATEFOEM, MOD, GETTABLELIST, GETALLPRODUCT, GETTABLELISTPRODUCT, URL_OEDERUPDATE } from "./api";
|
|
|
+import { tableColumns, GETSYSFILED, GETPERSONNEL, GETGENERATEFOEM, MOD, GETTABLELIST, GETALLPRODUCT, GETTABLELISTPRODUCT, URL_OEDERUPDATE, URL_PRODUTWITHORDER } from "./api";
|
|
|
import { useRouter, useRoute } from "vue-router";
|
|
|
import { GenerateForm } from '@zmjs/form-design';
|
|
|
import { URL_FETALL } from "../customer/api";
|
|
@@ -153,14 +153,15 @@ const relatedProductsRef = ref<typeof RelatedProducts>()
|
|
|
const filterItems = ref<FilterItem[]>([]) // 渲染筛选条件
|
|
|
const formTable = ref([]) // 表格数据
|
|
|
const productTableList = ref([])
|
|
|
+const productTableListValue = ref([])
|
|
|
|
|
|
function saveOrder(flag: boolean) {
|
|
|
orderTemplateRef.value?.getData().then((res: any) => {
|
|
|
let productTableListData = relatedProductsRef?.value?.returnData()
|
|
|
const produt = productTableListData ? JSON.stringify(productTableListData) : []
|
|
|
allLoading.editSaveLading = true
|
|
|
- post(URL_OEDERUPDATE, {
|
|
|
- ...res,
|
|
|
+ post(URL_OEDERUPDATE, {
|
|
|
+ ...res,
|
|
|
orderEndDate: res.orderEndDate ? formatDate(res.orderEndDate) : '',
|
|
|
orderStartDate: res.orderStartDate ? formatDate(res.orderStartDate) : '',
|
|
|
orderProductDetailString: produt
|
|
@@ -184,6 +185,7 @@ function editOrder(item: any) {
|
|
|
showVisible('editOrderVisible')
|
|
|
allLoading.orderTemplateLoadinng = true
|
|
|
if (item) {
|
|
|
+ editProduct(item)
|
|
|
const templateKey = getTemplateKey(orderTemplate.value.list)
|
|
|
let formVal: templateKey = {}
|
|
|
for (let i = 0; i < orderTemplate.value.list.length; i++) {
|
|
@@ -195,6 +197,8 @@ function editOrder(item: any) {
|
|
|
}
|
|
|
if (!item) {
|
|
|
orderTemplateValue.value = {}
|
|
|
+ productTableListValue.value = []
|
|
|
+ allText.orderEditText = '新增订单'
|
|
|
}
|
|
|
setTimeout(() => {
|
|
|
orderTemplateRef.value && orderTemplateRef.value.reset()
|
|
@@ -285,6 +289,17 @@ function setFilterItems() {
|
|
|
]
|
|
|
}
|
|
|
|
|
|
+function editProduct(row: any) {
|
|
|
+ post(URL_PRODUTWITHORDER, { id: row.id }).then(({ data }) => {
|
|
|
+ const list = data.map((item: any) => {
|
|
|
+ const { id, productName, productCode, unit, unitName, typeName, type, price, inventory, quantity, discount, totalPrice } = item
|
|
|
+ return { id, productId: id, productName, productCode, unit, unitName, typeName, type, price, inventory, quantity, discount, totalPrice }
|
|
|
+ })
|
|
|
+ console.log('开始执行', list)
|
|
|
+ productTableListValue.value = list
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
function getProductTableList() {
|
|
|
post(GETTABLELISTPRODUCT, { pageIndex: -1, pageSize: -1 }).then((res) => {
|
|
|
if (res.code == 'ok') {
|