|
@@ -5,44 +5,57 @@
|
|
|
<a-form v-bind="formItemLayout" name="StoreConsignmentInForm" ref="formRef">
|
|
|
<a-row>
|
|
|
|
|
|
- <a-col :span="12">
|
|
|
- <a-form-item label="单据日期" v-bind="validateInfos.billDate" id="StoreConsignmentInForm-billDate" name="billDate">
|
|
|
- <a-date-picker placeholder="请选择单据日期" v-model:value="formData.billDate" value-format="YYYY-MM-DD" style="width: 100%" allow-clear />
|
|
|
- </a-form-item>
|
|
|
- </a-col>
|
|
|
+
|
|
|
<a-col :span="12">
|
|
|
<a-form-item label="单据编码" v-bind="validateInfos.billCode" id="StoreConsignmentInForm-billCode" name="billCode">
|
|
|
- <a-input v-model:value="formData.billCode" placeholder="请输入单据编码" disabled allow-clear ></a-input>
|
|
|
+ <a-input v-model:value="formData.billCode" placeholder="自动生成" disabled allow-clear ></a-input>
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
<a-col :span="12">
|
|
|
- <a-form-item label="项目(project)" v-bind="validateInfos.project" id="StoreConsignmentInForm-project" name="project">
|
|
|
- <a-input v-model:value="formData.project" placeholder="请输入项目(project)" allow-clear ></a-input>
|
|
|
- </a-form-item>
|
|
|
- </a-col>
|
|
|
- <a-col :span="12">
|
|
|
- <a-form-item label="项目名称" v-bind="validateInfos.projectName" id="StoreConsignmentInForm-projectName" name="projectName">
|
|
|
- <a-input v-model:value="formData.projectName" placeholder="请输入项目名称" allow-clear ></a-input>
|
|
|
+ <a-form-item label="单据日期" v-bind="validateInfos.billDate" id="StoreConsignmentInForm-billDate" name="billDate">
|
|
|
+ <a-date-picker placeholder="请选择单据日期" v-model:value="formData.billDate" value-format="YYYY-MM-DD" style="width: 100%" allow-clear />
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
+
|
|
|
<a-col :span="12">
|
|
|
- <a-form-item label="客户" v-bind="validateInfos.customer" id="StoreConsignmentInForm-customer" name="customer">
|
|
|
- <a-input v-model:value="formData.customer" placeholder="请输入客户" allow-clear ></a-input>
|
|
|
+ <a-form-item label="客户简称" v-bind="validateInfos.customer" id="StoreConsignmentInForm-customerName" name="customerName">
|
|
|
+ <ApiSelect
|
|
|
+ :api="cuspCustomerList"
|
|
|
+ showSearch
|
|
|
+ v-model:value="formData.customer"
|
|
|
+ :filterOption="true"
|
|
|
+ resultField="records"
|
|
|
+ labelField="abbreviation"
|
|
|
+ valueField="id"
|
|
|
+ optionFilterProp="label"
|
|
|
+ />
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
<a-col :span="12">
|
|
|
- <a-form-item label="客户名称" v-bind="validateInfos.customerName" id="StoreConsignmentInForm-customerName" name="customerName">
|
|
|
- <a-input v-model:value="formData.customerName" placeholder="请输入客户名称" allow-clear ></a-input>
|
|
|
+ <a-form-item label="客户全称" v-bind="validateInfos.customer" id="StoreConsignmentInForm-customer" name="customer">
|
|
|
+ <!-- <a-input v-model:value="formData.customer" placeholder="请输入客户" allow-clear ></a-input> -->
|
|
|
+ <ApiSelect
|
|
|
+ :api="cuspCustomerList"
|
|
|
+ showSearch
|
|
|
+ v-model:value="formData.customer"
|
|
|
+ :filterOption="true"
|
|
|
+ resultField="records"
|
|
|
+ labelField="name"
|
|
|
+ valueField="id"
|
|
|
+ optionFilterProp="label"
|
|
|
+ />
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
<a-col :span="12">
|
|
|
<a-form-item label="仓库(warehouse)" v-bind="validateInfos.warehouse" id="StoreConsignmentInForm-warehouse" name="warehouse">
|
|
|
- <a-input v-model:value="formData.warehouse" placeholder="请输入仓库(warehouse)" allow-clear ></a-input>
|
|
|
+ <!-- <a-input v-model:value="formData.warehouse" placeholder="请输入仓库(warehouse)" allow-clear ></a-input> -->
|
|
|
+ <JDictSelectTag v-model:value="formData.warehouse" placeholder="请选择" dictCode="warehouse" />
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
<a-col :span="12">
|
|
|
<a-form-item label="货位(goods allocation)" v-bind="validateInfos.goodsAllocation" id="StoreConsignmentInForm-goodsAllocation" name="goodsAllocation">
|
|
|
- <a-input v-model:value="formData.goodsAllocation" placeholder="请输入货位(goods allocation)" allow-clear ></a-input>
|
|
|
+ <!-- <a-input v-model:value="formData.goodsAllocation" placeholder="请输入货位(goods allocation)" allow-clear ></a-input> -->
|
|
|
+ <JDictSelectTag v-model:value="formData.goodsAllocation" placeholder="请选择" dictCode="goods_allocation" />
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
<a-col :span="12">
|
|
@@ -52,7 +65,7 @@
|
|
|
</a-col>
|
|
|
<a-col :span="12">
|
|
|
<a-form-item label="附件(attachs)" v-bind="validateInfos.attachs" id="StoreConsignmentInForm-attachs" name="attachs">
|
|
|
- <a-input v-model:value="formData.attachs" placeholder="请输入附件(attachs)" allow-clear ></a-input>
|
|
|
+ <JUpload v-model:value="formData.attachs" />
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
</a-row>
|
|
@@ -63,6 +76,11 @@
|
|
|
<!-- 子表单区域 -->
|
|
|
<a-tabs v-model:activeKey="activeKey" animated>
|
|
|
<a-tab-pane tab="寄存代发入库-子表产品明细" key="storeConsignmentInDetails" :forceRender="true">
|
|
|
+
|
|
|
+ <a-button type="primary" style="margin-right: 1%; margin-bottom: 1%" @click="selectProductList" :disabled="disabled">
|
|
|
+ 选择产品(select product)</a-button
|
|
|
+ >
|
|
|
+
|
|
|
<j-vxe-table
|
|
|
:keep-source="true"
|
|
|
resizable
|
|
@@ -73,10 +91,17 @@
|
|
|
:height="340"
|
|
|
:disabled="disabled"
|
|
|
:rowNumber="true"
|
|
|
- :rowSelection="true"
|
|
|
- :toolbar="true"/>
|
|
|
+ :rowSelection="false"
|
|
|
+ >
|
|
|
+ <template #action="props">
|
|
|
+ <a-popconfirm title="确定删除吗?" @confirm="handleDelete(props)" v-if="!disabled">
|
|
|
+ <a>删除(delete)</a>
|
|
|
+ </a-popconfirm>
|
|
|
+ </template>
|
|
|
+ </j-vxe-table>
|
|
|
</a-tab-pane>
|
|
|
<a-tab-pane tab="寄存代发入库-子表船明细" key="storeConsignmentInShip" :forceRender="true">
|
|
|
+ <a-button type="primary" style="margin-right: 1%; margin-bottom: 1%" @click="selectShip" :disabled="disabled"> 选择船(select ship)</a-button>
|
|
|
<j-vxe-table
|
|
|
:keep-source="true"
|
|
|
resizable
|
|
@@ -88,9 +113,17 @@
|
|
|
:disabled="disabled"
|
|
|
:rowNumber="true"
|
|
|
:rowSelection="true"
|
|
|
- :toolbar="true"/>
|
|
|
+ >
|
|
|
+ <template #action="props">
|
|
|
+ <a @click="viewAccessory(props)">查看配件信息(view accessory information)</a>
|
|
|
+ </template>
|
|
|
+ </j-vxe-table>
|
|
|
</a-tab-pane>
|
|
|
</a-tabs>
|
|
|
+
|
|
|
+ <BaseShipArchiveAccessoriesModal ref="BaseShipArchiveAccessoriesModalRef" />
|
|
|
+ <SelectPrpductModal ref="SelectPrpductModalRef" @select-product="addProduct" />
|
|
|
+ <SelectShipSModal ref="SelectShipSModalRef" @select="addShip" />
|
|
|
</a-spin>
|
|
|
</template>
|
|
|
|
|
@@ -98,12 +131,21 @@
|
|
|
import { defineComponent, ref, reactive, computed, toRaw, onMounted } from 'vue';
|
|
|
import { defHttp } from '/@/utils/http/axios';
|
|
|
import { useValidateAntFormAndTable } from '/@/hooks/system/useJvxeMethods';
|
|
|
- import { queryStoreConsignmentInDetailsListByMainId, queryStoreConsignmentInShipListByMainId, queryDataById, saveOrUpdate } from '../StoreConsignmentIn.api';
|
|
|
+ import { queryStoreConsignmentInDetailsListByMainId, queryStoreConsignmentInShipListByMainId, queryDataById, saveOrUpdate,cuspCustomerList } from '../StoreConsignmentIn.api';
|
|
|
import { JVxeTable } from '/@/components/jeecg/JVxeTable';
|
|
|
import {storeConsignmentInDetailsColumns, storeConsignmentInShipColumns} from '../StoreConsignmentIn.data';
|
|
|
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
|
|
|
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
|
|
|
- import { Form } from 'ant-design-vue';
|
|
|
+ import { ApiSelect} from '/@/components/Form';
|
|
|
+ import { Form, message } from 'ant-design-vue';
|
|
|
+ import dayjs from 'dayjs';
|
|
|
+ import { initDictOptions } from '/@/utils/dict';
|
|
|
+
|
|
|
+ import BaseShipArchiveAccessoriesModal from '../../../publicComponents/BaseShipArchiveAccessoriesModal.vue';
|
|
|
+ import SelectPrpductModal from '../../../publicComponents/SelectPrpductModal.vue';
|
|
|
+ import SelectShipSModal from '../../../publicComponents/SelectShipSModal.vue';
|
|
|
+
|
|
|
+ import JUpload from '/@/components/Form/src/jeecg/components/JUpload/JUpload.vue';
|
|
|
const useForm = Form.useForm;
|
|
|
|
|
|
export default defineComponent({
|
|
@@ -111,7 +153,12 @@
|
|
|
components:{
|
|
|
JDictSelectTag,
|
|
|
JVxeTable,
|
|
|
- JFormContainer,
|
|
|
+ JFormContainer,
|
|
|
+ ApiSelect,
|
|
|
+ BaseShipArchiveAccessoriesModal,
|
|
|
+ SelectPrpductModal,
|
|
|
+ SelectShipSModal,
|
|
|
+ JUpload,
|
|
|
},
|
|
|
props:{
|
|
|
formDisabled:{
|
|
@@ -125,6 +172,12 @@
|
|
|
setup(props, {emit}) {
|
|
|
const loading = ref(false);
|
|
|
const formRef = ref();
|
|
|
+
|
|
|
+
|
|
|
+ const SelectPrpductModalRef = ref();
|
|
|
+ const SelectShipSModalRef = ref();
|
|
|
+ const BaseShipArchiveAccessoriesModalRef = ref();
|
|
|
+
|
|
|
const storeConsignmentInDetailsTableRef = ref();
|
|
|
const storeConsignmentInDetailsTable = reactive<Record<string, any>>({
|
|
|
loading: false,
|
|
@@ -140,11 +193,8 @@
|
|
|
const activeKey = ref('storeConsignmentInDetails');
|
|
|
const formData = reactive<Record<string, any>>({
|
|
|
id: '',
|
|
|
- submit: '',
|
|
|
- billDate: '',
|
|
|
+ billDate: dayjs(new Date()).format('YYYY-MM-DD'),
|
|
|
billCode: '',
|
|
|
- project: '',
|
|
|
- projectName: '',
|
|
|
customer: '',
|
|
|
customerName: '',
|
|
|
warehouse: '',
|
|
@@ -155,6 +205,10 @@
|
|
|
|
|
|
//表单验证
|
|
|
const validatorRules = reactive({
|
|
|
+ billDate: [{ required: true, message: '请选择日期(select billDate)' }],
|
|
|
+ customer: [{ required: true, message: '请选择客户(select customer)' }],
|
|
|
+ warehouse: [{ required: true, message: '请选择仓库(select warehouse)' }],
|
|
|
+ goodsAllocation: [{ required: true, message: '请选择货位(select goodsAllocation)' }],
|
|
|
});
|
|
|
const {resetFields, validate, validateInfos} = useForm(formData, validatorRules, {immediate: false});
|
|
|
const dbData = {};
|
|
@@ -181,7 +235,51 @@
|
|
|
resetFields();
|
|
|
storeConsignmentInDetailsTable.dataSource = [];
|
|
|
storeConsignmentInShipTable.dataSource = [];
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ function addProduct(data) {
|
|
|
+ data.map((item) => {
|
|
|
+ item.productClass = item.classId_dictText;
|
|
|
+ item.productCode = item.code;
|
|
|
+ item.productId = item.id;
|
|
|
+ item.id = undefined;
|
|
|
+ });
|
|
|
+ var xTable = storeConsignmentInDetailsTableRef.value!.getXTable();
|
|
|
+ var arrProduct = xTable.data.concat(data);
|
|
|
+ storeConsignmentInDetailsTable.dataSource = arrProduct;
|
|
|
+ }
|
|
|
+ function selectProductList() {
|
|
|
+ SelectPrpductModalRef.value.getTable();
|
|
|
+ }
|
|
|
+
|
|
|
+ //入库明细-删除行
|
|
|
+ function handleDelete(prop) {
|
|
|
+ var xTable = storeConsignmentInDetailsTableRef.value!.getXTable();
|
|
|
+ var newArray = [...xTable.data];
|
|
|
+ newArray.splice(prop.rowIndex, 1);
|
|
|
+ storeConsignmentInDetailsTable.dataSource = newArray;
|
|
|
+ }
|
|
|
+
|
|
|
+ //查看配件信息
|
|
|
+ function viewAccessory(prop) {
|
|
|
+ BaseShipArchiveAccessoriesModalRef.value.getTable(prop.row);
|
|
|
+ }
|
|
|
+ function selectShip() {
|
|
|
+ SelectShipSModalRef.value.getTable();
|
|
|
}
|
|
|
+ function addShip(data) {
|
|
|
+ data.map((item) => {
|
|
|
+ item.shipowner = item.relateCustomer;
|
|
|
+ item.shipId = item.id;
|
|
|
+ item.id = undefined;
|
|
|
+ });
|
|
|
+ var xTable = storeConsignmentInShipTableRef.value!.getXTable();
|
|
|
+ var arr = xTable.data.concat(data);
|
|
|
+ storeConsignmentInShipTable.dataSource = arr;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
async function edit(row) {
|
|
|
//主表数据
|
|
@@ -228,14 +326,22 @@
|
|
|
}
|
|
|
|
|
|
async function submitForm() {
|
|
|
- const mainData = await getFormData();
|
|
|
- const subData = await getSubFormAndTableData();
|
|
|
- const values = Object.assign({}, dbData, mainData, subData);
|
|
|
- console.log('表单提交数据', values)
|
|
|
- const isUpdate = values.id ? true : false
|
|
|
- await saveOrUpdate(values, isUpdate);
|
|
|
- //关闭弹窗
|
|
|
- emit('success');
|
|
|
+ var xTable = storeConsignmentInDetailsTableRef.value!.getXTable();
|
|
|
+ if (xTable.data.length == 0) {
|
|
|
+ message.error('请添加产品明细!');
|
|
|
+ } else {
|
|
|
+
|
|
|
+ const mainData = await getFormData();
|
|
|
+ const subData = await getSubFormAndTableData();
|
|
|
+ const values = Object.assign({}, dbData, mainData, subData);
|
|
|
+ console.log('表单提交数据', values)
|
|
|
+ const isUpdate = values.id ? true : false
|
|
|
+ await saveOrUpdate(values, isUpdate);
|
|
|
+ //关闭弹窗
|
|
|
+ emit('success');
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
function setFieldsValue(values) {
|
|
@@ -275,6 +381,16 @@
|
|
|
add,
|
|
|
edit,
|
|
|
formRef,
|
|
|
+ cuspCustomerList,
|
|
|
+ selectProductList,
|
|
|
+ SelectPrpductModalRef,
|
|
|
+ addProduct,
|
|
|
+ selectShip,
|
|
|
+ SelectShipSModalRef,
|
|
|
+ addShip,
|
|
|
+ handleDelete,
|
|
|
+ BaseShipArchiveAccessoriesModalRef,
|
|
|
+ viewAccessory
|
|
|
}
|
|
|
}
|
|
|
});
|