deliveryNoticeForm.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607
  1. <template>
  2. <a-spin :spinning="loading">
  3. <JFormContainer :disabled="disabled">
  4. <template #detail>
  5. <a-form v-bind="formItemLayout" name="quotationFormForm" ref="formRef">
  6. <a-row>
  7. <a-col :span="12">
  8. <a-form-item label="发货通知单号(bill code)" v-bind="validateInfos.billCode" id="quotationFormForm-billCode" name="billCode" :labelCol="formItemLayout.labelCol1" :wrapperCol="formItemLayout.wrapperCol1">
  9. <a-input v-model:value="formData.billCode" placeholder="自动生成" disabled></a-input>
  10. </a-form-item>
  11. </a-col>
  12. <a-col :span="12">
  13. <a-form-item label="发货日期(delivery date)" v-bind="validateInfos.deliveryDate" id="quotationFormForm-deliveryDate" name="deliveryDate">
  14. <a-date-picker placeholder="请选择发货日期(delivery date)" v-model:value="formData.deliveryDate" value-format="YYYY-MM-DD" style="width: 100%" allow-clear />
  15. </a-form-item>
  16. </a-col>
  17. <a-col :span="12">
  18. <a-form-item label="项目(project)" v-bind="validateInfos.projectName" id="quotationFormForm-projectName" name="projectName">
  19. <a-input-search v-model:value="formData.projectName" placeholder="请输入项目(project)" readonly allow-clear enter-button="Search" :disabled="notAllowEdit" @search="onSearchProject"></a-input-search>
  20. </a-form-item>
  21. </a-col>
  22. <a-col :span="12">
  23. <a-form-item label="客户(customer)" v-bind="validateInfos.customer" id="quotationFormForm-customer" name="customer" :labelCol="formItemLayout.labelCol1" :wrapperCol="formItemLayout.wrapperCol1">
  24. <JSelectInput v-model:value="formData.customer" placeholder="请选择" :options="customerOption" disabled></JSelectInput>
  25. </a-form-item>
  26. </a-col>
  27. <a-col :span="12">
  28. <a-form-item label="优先级(priority)" v-bind="validateInfos.priority" id="quotationFormForm-priority" name="priority">
  29. <JDictSelectTag v-model:value="formData.priority" placeholder="请选择" dictCode="priority" disabled/>
  30. </a-form-item>
  31. </a-col>
  32. <a-col :span="12">
  33. <a-form-item label="产品分类(production class)" v-bind="validateInfos.productionClass" id="quotationFormForm-productionClass" name="productionClass" :labelCol="formItemLayout.labelCol1" :wrapperCol="formItemLayout.wrapperCol1">
  34. <JSelectInput v-model:value="formData.productionClass" placeholder="请选择" :options="classOption" disabled></JSelectInput>
  35. </a-form-item>
  36. </a-col>
  37. <a-col :span="12">
  38. <a-form-item label="机型(model)" v-bind="validateInfos.model" id="quotationFormForm-model" name="model">
  39. <JSelectMultiple v-model:value="formData.model" placeholder="请选择" dictCode="model_typer" disabled/>
  40. </a-form-item>
  41. </a-col>
  42. <a-col :span="12">
  43. <a-form-item label="厂家(maker)" v-bind="validateInfos.maker" id="quotationFormForm-maker" name="maker" :labelCol="formItemLayout.labelCol1" :wrapperCol="formItemLayout.wrapperCol1">
  44. <a-input v-model:value="formData.maker" placeholder="请输入厂家(maker)" allow-clear disabled></a-input>
  45. </a-form-item>
  46. </a-col>
  47. <a-col :span="12">
  48. <a-form-item label="币种(currency)" v-bind="validateInfos.currency" id="quotationFormForm-currency" name="currency">
  49. <JDictSelectTag v-model:value="formData.currency" placeholder="请选择" dictCode="currency" disabled/>
  50. </a-form-item>
  51. </a-col>
  52. <a-col :span="12">
  53. <a-form-item label="交货条款(delivery terms)" v-bind="validateInfos.deliveryTerms" id="quotationFormForm-deliveryTerms" name="deliveryTerms" :labelCol="formItemLayout.labelCol1" :wrapperCol="formItemLayout.wrapperCol1">
  54. <JDictSelectTag v-model:value="formData.deliveryTerms" placeholder="请选择" dictCode="delivery_terms" disabled/>
  55. </a-form-item>
  56. </a-col>
  57. <a-col :span="12">
  58. <a-form-item label="发货方式(delivery)" v-bind="validateInfos.delivery" id="SaleOrderForm-delivery" name="delivery">
  59. <JDictSelectTag v-model:value="formData.delivery" placeholder="请选择" dictCode="delivery_methods" disabled/>
  60. </a-form-item>
  61. </a-col>
  62. <a-col :span="12">
  63. <a-form-item label="交货地点(place of delivery)" v-bind="validateInfos.deliveryAddress" id="quotationFormForm-deliveryAddress" name="deliveryAddress">
  64. <a-input v-model:value="formData.deliveryAddress" placeholder="请输入交货地点(place of delivery)" allow-clear AutoComplete="off"></a-input>
  65. </a-form-item>
  66. </a-col>
  67. <a-col :span="12">
  68. <a-form-item label="是否希望出口(isExport)" v-bind="validateInfos.isExport" id="quotationFormForm-isExport" name="isExport" :labelCol="formItemLayout.labelCol1" :wrapperCol="formItemLayout.wrapperCol1">
  69. <JDictSelectTag v-model:value="formData.isExport" placeholder="请选择" dictCode="yes_or_no"/>
  70. </a-form-item>
  71. </a-col>
  72. <a-col :span="12">
  73. <a-form-item label="质保期(warranty period)" v-bind="validateInfos.warrantyPeriod" id="SaleOrderForm-warrantyPeriod" name="warrantyPeriod">
  74. <a-input v-model:value="formData.warrantyPeriod" placeholder="请输入" style="width: 85%;margin-right: 1%;" AutoComplete="off"/>月(month)
  75. </a-form-item>
  76. </a-col>
  77. <a-col :span="12">
  78. <a-form-item label="销售部门(sale department)" v-bind="validateInfos.saleDepartment" id="SaleInquiryFormForm-saleDepartment" name="saleDepartment">
  79. <a-input v-model:value="formData.saleDepartmentName" placeholder="" allow-clear disabled></a-input>
  80. </a-form-item>
  81. </a-col>
  82. <a-col :span="12">
  83. <a-form-item label="包装要求(packaging requirement)" v-bind="validateInfos.packagingRequirement" id="quotationFormForm-packagebRequirement" name="packagebRequirement" :labelCol="formItemLayout.labelCol1" :wrapperCol="formItemLayout.wrapperCol1">
  84. <a-input v-model:value="formData.packagebRequirement" placeholder="请输入包装要求(packaging requirement)" allow-clear AutoComplete="off"></a-input>
  85. </a-form-item>
  86. </a-col>
  87. <a-col :span="12">
  88. <a-form-item label="联系人(linkMan)" v-bind="validateInfos.linkMan" id="quotationFormForm-linkMan" name="linkMan" :labelCol="formItemLayout.labelCol1" :wrapperCol="formItemLayout.wrapperCol1">
  89. <a-input v-model:value="formData.linkMan" placeholder="请输入联系人(linkMan)" allow-clear AutoComplete="off"></a-input>
  90. </a-form-item>
  91. </a-col>
  92. <a-col :span="12">
  93. <a-form-item label="收货地址(address)" v-bind="validateInfos.address" id="quotationFormForm-address" name="address">
  94. <a-input v-model:value="formData.address" placeholder="" allow-clear AutoComplete="off"></a-input>
  95. </a-form-item>
  96. </a-col>
  97. <a-col :span="12">
  98. <a-form-item label="联系电话(linkMan phone)" v-bind="validateInfos.linkNumber" id="quotationFormForm-linkNumber" name="linkNumber">
  99. <a-input v-model:value="formData.linkNumber" placeholder="" allow-clear AutoComplete="off" ></a-input>
  100. </a-form-item>
  101. </a-col>
  102. <a-col :span="12">
  103. <a-form-item label="业务员(salesman)" v-bind="validateInfos.salesman" id="quotationFormForm-salesman" name="salesman">
  104. <a-input v-model:value="formData.salesmanName" placeholder="" allow-clear disabled></a-input>
  105. </a-form-item>
  106. </a-col>
  107. <a-col :span="12">
  108. <a-form-item label="F号(F number)" v-bind="validateInfos.fnumber" id="quotationFormForm-fnumber" name="fnumber" :labelCol="formItemLayout.labelCol1" :wrapperCol="formItemLayout.wrapperCol1">
  109. <a-input v-model:value="formData.fnumber" placeholder="请选择" AutoComplete="off"/>
  110. </a-form-item>
  111. </a-col>
  112. <a-col :span="12">
  113. <a-form-item label="提单号(B/L NO)" v-bind="validateInfos.blno" id="quotationFormForm-blno" name="blno">
  114. <a-input v-model:value="formData.blno" placeholder="请输入" allow-clear AutoComplete="off"></a-input>
  115. </a-form-item>
  116. </a-col>
  117. <a-col :span="12">
  118. <a-form-item label="开票抬头(invoice header)" v-bind="validateInfos.invoiceHeader" id="SaleOrderForm-invoiceHeader" name="invoiceHeader" :labelCol="formItemLayout.labelCol1" :wrapperCol="formItemLayout.wrapperCol1">
  119. <a-input v-model:value="formData.invoiceHeader" placeholder="请输入" AutoComplete="off"/>
  120. </a-form-item>
  121. </a-col>
  122. <a-col :span="12">
  123. <a-form-item label="包装详情(packingDetails))" v-bind="validateInfos.packingDetails " id="SaleOrderForm-packingDetails " name="packingDetails " >
  124. <a-input v-model:value="formData.packingDetails " placeholder="请输入" AutoComplete="off"/>
  125. </a-form-item>
  126. </a-col>
  127. <a-col :span="12">
  128. <a-form-item label="是否有第三方运费(otherFee)" v-bind="validateInfos.otherFee" id="SaleOrderForm-otherFee" name="otherFee" :labelCol="formItemLayout.labelCol1" :wrapperCol="formItemLayout.wrapperCol1">
  129. <a-select v-model:value="formData.otherFee">
  130. <a-select-option value="是"> 是 </a-select-option>
  131. <a-select-option value="否"> 否 </a-select-option>
  132. </a-select>
  133. </a-form-item>
  134. </a-col>
  135. <a-col :span="12">
  136. <a-form-item label="备注(notes)" v-bind="validateInfos.notes" id="quotationFormForm-notes" name="notes" >
  137. <a-input v-model:value="formData.notes" placeholder="请输入备注(notes)" allow-clear AutoComplete="off"></a-input>
  138. </a-form-item>
  139. </a-col>
  140. </a-row>
  141. </a-form>
  142. </template>
  143. </JFormContainer>
  144. <!-- 子表单区域 -->
  145. <a-tabs v-model:activeKey="activeKey" animated style=" padding: 24px;padding-top: 0px;">
  146. <a-tab-pane tab="发货通知单 - 发货明细(delivery details)" key="deliveryDetailFormProduct" :forceRender="true">
  147. <a-button type="primary" @click="selectSaleOrderList"> 选择销售订单(selete saleOrder)</a-button>
  148. <j-vxe-table
  149. :keep-source="true"
  150. resizable
  151. ref="deliveryDetailFormProductTableRef"
  152. :loading="deliveryDetailFormProductTable.loading"
  153. :columns="deliveryDetailFormProductTable.columns"
  154. :dataSource="deliveryDetailFormProductTable.dataSource"
  155. :maxHeight="340"
  156. :disabled="disabled"
  157. :rowNumber="true"
  158. :rowSelection="true"
  159. asyncRemove
  160. @valueChange="changeValues"
  161. >
  162. <template #action="props">
  163. <a-popconfirm title="确定删除吗?" @confirm="handleDelete1(props)">
  164. <a>删除(delete)</a>
  165. </a-popconfirm>
  166. </template>
  167. </j-vxe-table>
  168. </a-tab-pane>
  169. <a-tab-pane tab="发货通知单 - 船明细(ship details)" key="deliveryNoticeFormShip" :forceRender="true">
  170. <j-vxe-table
  171. :keep-source="true"
  172. resizable
  173. ref="deliveryNoticeFormShipTableRef"
  174. :loading="deliveryNoticeFormShipTable.loading"
  175. :columns="deliveryNoticeFormShipTable.columns"
  176. :dataSource="deliveryNoticeFormShipTable.dataSource"
  177. :maxHeight="340"
  178. :disabled="disabled"
  179. :rowNumber="true"
  180. :rowSelection="true"
  181. >
  182. <template #action="props" >
  183. <a @click="viewAccessory(props)" >查看配件信息(view accessory information)</a>
  184. </template>
  185. </j-vxe-table>
  186. </a-tab-pane>
  187. </a-tabs>
  188. <BaseShipArchiveAccessoriesModal ref="BaseShipArchiveAccessoriesListRef"></BaseShipArchiveAccessoriesModal>
  189. <SelectProjectModal ref="SelectProjectModalRef" @selectProject="addProject"></SelectProjectModal>
  190. <SelectSaleOrderModal ref="SelectSaleOrderModalRef" @selectSaleOrder="addFormSaleOrder"></SelectSaleOrderModal>
  191. </a-spin>
  192. </template>
  193. <script lang="ts">
  194. import { defineComponent, ref, reactive, computed, toRaw, onMounted } from 'vue';
  195. import { defHttp } from '/@/utils/http/axios';
  196. import { useValidateAntFormAndTable } from '/@/hooks/system/useJvxeMethods';
  197. import { querydeliveryNoticeFormShipListByMainId,querydeliveryNoticeFormProductListByMainId,queryDataById, saveOrUpdate } from '../delivertNoticeForm.api';
  198. import { JVxeTable } from '/@/components/jeecg/JVxeTable';
  199. import {deliveryNoticeShipColumns, deliveryNoticeProductColumns} from '../delivertNoticeForm.data';
  200. import BaseShipArchiveAccessoriesModal from '../../../publicComponents/BaseShipArchiveAccessoriesModal.vue';
  201. import SelectPrpductModal from '../../../publicComponents/SelectPrpductModal.vue';
  202. import SelectProjectModal from '../../../publicComponents/SelectProjectModal.vue';
  203. import SelectSaleOrderModal from '../../../publicComponents/SelectSaleOrderModal.vue';
  204. import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
  205. import JUpload from '/@/components/Form/src/jeecg/components/JUpload/JUpload.vue';
  206. import { JDictSelectTag,JSelectMultiple} from '/@/components/Form';
  207. import JSelectInput from '/@/components/Form/src/jeecg/components/JSelectInput.vue';
  208. import { Form,message } from 'ant-design-vue';
  209. import { useUserStore } from '/@/store/modules/user';
  210. import moment from 'moment';
  211. const userStore = useUserStore();
  212. const useForm = Form.useForm;
  213. export default defineComponent({
  214. name: "deliveryNoticeForm",
  215. components:{
  216. JVxeTable,
  217. JFormContainer,
  218. BaseShipArchiveAccessoriesModal,
  219. SelectPrpductModal,
  220. JUpload,
  221. SelectProjectModal,
  222. JDictSelectTag,
  223. JSelectInput,
  224. JSelectMultiple,
  225. SelectSaleOrderModal
  226. },
  227. props:{
  228. formDisabled:{
  229. type: Boolean,
  230. default: false
  231. },
  232. formData: { type: Object, default: ()=>{} },
  233. formBpm: { type: Boolean, default: true }
  234. },
  235. emits:['success'],
  236. setup(props, {emit}) {
  237. const loading = ref(false);
  238. const formRef = ref();
  239. const SelectSaleOrderModalRef = ref();
  240. var SelectProjectModalRef = ref()
  241. const deliveryNoticeFormShipTableRef = ref();
  242. const deliveryNoticeFormShipTable = reactive<Record<string, any>>({
  243. loading: false,
  244. columns:deliveryNoticeShipColumns,
  245. dataSource: []
  246. });
  247. const deliveryDetailFormProductTableRef = ref();
  248. const deliveryDetailFormProductTable = reactive<Record<string, any>>({
  249. loading: false,
  250. columns: deliveryNoticeProductColumns,
  251. dataSource: []
  252. });
  253. var SelectShipSModalRef = ref();
  254. var BaseShipArchiveAccessoriesListRef = ref();
  255. const activeKey = ref('deliveryDetailFormProduct');
  256. var notAllowEdit = ref(false);
  257. var classOption = ref([]);
  258. var customerOption =ref([]);
  259. const formData = reactive<Record<string, any>>({
  260. id: '',
  261. status: undefined,
  262. delFlag: undefined,
  263. sourceCode:'',
  264. deliveryDate: moment(new Date()).format('YYYY-MM-DD'),
  265. billCode: '',
  266. project: '',
  267. projectName: '',
  268. customer: '',
  269. customerName: '',
  270. priority: '',
  271. productionClass: '',
  272. model: '',
  273. maker: '',
  274. currency:"",
  275. deliveryTerms: '',
  276. delivery: '',
  277. deliveryAddress:'',
  278. isExport:'',
  279. warrantyPeriod:'',
  280. saleDepartment:'',
  281. saleDepartmentName:'',
  282. packagebRequirement:'',
  283. linkMan:'',
  284. address:'',
  285. linkNumber:'',
  286. salesman: '',
  287. salesmanName: '',
  288. fnumber:"",
  289. blno: '',
  290. notes: '',
  291. invoiceHeader:'',
  292. otherFee :'',
  293. packingDetails:''
  294. });
  295. //表单验证
  296. const validatorRules = reactive({
  297. });
  298. const {resetFields, validate, validateInfos} = useForm(formData, validatorRules, {immediate: false});
  299. const dbData = {};
  300. const formItemLayout = {
  301. labelCol: {xs: {span: 24}, sm: {span: 8}},
  302. wrapperCol: {xs: {span: 24}, sm: {span: 13}},
  303. labelCol1: {xs: {span: 24}, sm: {span: 8}},
  304. wrapperCol1: {xs: {span: 24}, sm: {span: 13}},
  305. };
  306. // 表单禁用
  307. const disabled = computed(()=>{
  308. if(props.formBpm === true){
  309. if(props.formData.disabled === false){
  310. return false;
  311. }else{
  312. return true;
  313. }
  314. }
  315. return props.formDisabled;
  316. });
  317. //新增方法
  318. function add() {
  319. resetFields();
  320. deliveryNoticeFormShipTable.dataSource = [];
  321. deliveryDetailFormProductTable.dataSource = [];
  322. activeKey.value = 'deliveryDetailFormProduct'
  323. getOptiom()
  324. getCustomerOptions()
  325. formData.salesman=userStore.getUserInfo.username;
  326. formData.salesmanName=userStore.getUserInfo.realname;
  327. formData.saleDepartment = userStore.getUserInfo.orgCode
  328. formData.saleDepartmentName = userStore.getUserInfo.orgName
  329. notAllowEdit.value = false
  330. }
  331. //编辑方法
  332. async function edit(row) {
  333. //主表数据
  334. await queryMainData(row.id);
  335. //子表数据
  336. const deliveryNoticeFormShipDataList = await querydeliveryNoticeFormShipListByMainId(row['id']);
  337. deliveryNoticeFormShipTable.dataSource = [...deliveryNoticeFormShipDataList];
  338. const deliveryDetailFormProductDataList = await querydeliveryNoticeFormProductListByMainId(row['id']);
  339. deliveryDetailFormProductTable.dataSource = [...deliveryDetailFormProductDataList];
  340. getOptiom()
  341. getCustomerOptions()
  342. notAllowEdit.value=true
  343. }
  344. //获取主表
  345. async function queryMainData(id) {
  346. const row = await queryDataById(id);
  347. resetFields();
  348. const tmpData = {};
  349. Object.keys(formData).forEach((key) => {
  350. if(row.hasOwnProperty(key)){
  351. tmpData[key] = row[key]
  352. }
  353. })
  354. //赋值
  355. Object.assign(formData,tmpData);
  356. }
  357. const {getSubFormAndTableData, transformData} = useValidateAntFormAndTable(activeKey, {
  358. 'saleDeliveryShip': deliveryNoticeFormShipTableRef,
  359. 'saleDeliveryDetails': deliveryDetailFormProductTableRef,
  360. });
  361. //获取表单信息
  362. async function getFormData() {
  363. try {
  364. // 触发表单验证
  365. await validate();
  366. } catch ({ errorFields }) {
  367. if (errorFields) {
  368. const firstField = errorFields[0];
  369. if (firstField) {
  370. formRef.value.scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
  371. }
  372. }
  373. return Promise.reject(errorFields);
  374. }
  375. return transformData(toRaw(formData))
  376. }
  377. //保存
  378. async function submitForm() {
  379. if(formData.sourceCode==''){
  380. message.warning('请选择销售订单单')
  381. }else{
  382. const mainData = await getFormData();
  383. const subData = await getSubFormAndTableData();
  384. const values = Object.assign({}, dbData, mainData, subData);
  385. console.log('表单提交数据', values)
  386. const isUpdate = values.id ? true : false
  387. await saveOrUpdate(values, isUpdate);
  388. //关闭弹窗
  389. emit('success');
  390. }
  391. }
  392. function setFieldsValue(values) {
  393. if(values){
  394. Object.keys(values).map(k=>{
  395. formData[k] = values[k];
  396. });
  397. }
  398. }
  399. /**
  400. * 值改变事件触发-树控件回调
  401. * @param key
  402. * @param value
  403. */
  404. function handleFormChange(key, value) {
  405. formData[key] = value;
  406. }
  407. //产品明细-删除行
  408. async function handleDelete1(prop) {
  409. var newArray = [...deliveryDetailFormProductTable.dataSource]
  410. newArray.splice(prop.rowIndex, 1)
  411. deliveryDetailFormProductTable.dataSource = newArray
  412. if( deliveryDetailFormProductTable.dataSource.length!==0){
  413. notAllowEdit.value=true
  414. }else{
  415. formData.sourceCode=''
  416. notAllowEdit.value=false
  417. }
  418. }
  419. //选择项目
  420. function addProject(data) {
  421. if(data.length==0){
  422. formData.project =
  423. formData.projectName = ''
  424. }else{
  425. formData.project = data[0].id
  426. formData.projectName = data[0].code
  427. formData.customer =data[0].customerId
  428. formData.customerName =data[0].customerId_dictText
  429. customerOption.value.map(item=>{
  430. if(item.value==data[0].customerId){
  431. formData.priority =item.priority
  432. }
  433. })
  434. }
  435. }
  436. //获取客户列表
  437. function getCustomerOptions(){
  438. let params = {pageSize:'-1',status:1}
  439. defHttp.get({url:'/cuspCode/cuspCustomerProfile/list',params}, { isTransformResponse: false }).then(res=>{
  440. if(res){
  441. customerOption.value = []
  442. res.result.records.forEach(item=>{
  443. customerOption.value.push({
  444. label: item.name,
  445. value: item.id,
  446. priority:item.priority,
  447. intermediatorCommission:item.intermediatorCommission
  448. })
  449. })
  450. }
  451. })
  452. }
  453. //查看配件信息
  454. function viewAccessory(prop){
  455. BaseShipArchiveAccessoriesListRef.value.getTable(prop.row)
  456. }
  457. //选择项目
  458. function onSearchProject(){
  459. SelectProjectModalRef.value.getTable()
  460. }
  461. //获取产品分类下拉框
  462. function getOptiom(){
  463. defHttp
  464. .get({ url: 'baseCode/baseProductClass/list'}, { isTransformResponse: false })
  465. .then((res) => {
  466. if (res.success) {
  467. classOption.value = []
  468. res.result.records.forEach(element => {
  469. var obj = {
  470. label: element.name?element.name:'无名称请维护',
  471. value: element.id?element.id:''
  472. };
  473. classOption.value.push( obj)
  474. });
  475. }
  476. })
  477. .finally(() => {
  478. // loading.value = false;
  479. });
  480. }
  481. // 选择销售订单
  482. function selectSaleOrderList(){
  483. var obj = formData
  484. obj.sourceCode2 = formData.sourceCode
  485. SelectSaleOrderModalRef.value.getTable(obj,'delivery')
  486. }
  487. function addFormSaleOrder(data){
  488. data.map((item)=>{
  489. item.model = item.childModel
  490. item.sourceId = item.childId
  491. item.orderQuantity = item.quantity
  492. item.orderMoney = item.discountedAmount
  493. item.money=item.discountedAmount
  494. item.taxPrice = item.discountedPrice
  495. })
  496. var arrProduct = data.concat(deliveryDetailFormProductTable.dataSource)
  497. deliveryDetailFormProductTable.dataSource=arrProduct
  498. notAllowEdit.value=true
  499. formData.sourceCode =data[0].billCode
  500. formData.project = data[0].project
  501. formData.projectName = data[0].projectName
  502. formData.customerName = data[0].customerName
  503. formData.customer = data[0].customer
  504. formData.priority =data[0].priority
  505. formData.productionClass =data[0].productionClass
  506. formData.model =data[0].headModel
  507. formData.maker =data[0].maker
  508. formData.currency =data[0].currency
  509. formData.deliveryTerms =data[0].deliveryTerms
  510. formData.delivery=data[0].delivery
  511. formData.invoiceHeader=data[0].invoiceHeader
  512. formData.invoiceAddress=data[0].invoiceAddress
  513. formData.deliveryAddress=data[0].deliveryAddress
  514. formData.isExport = data[0].isExport
  515. formData.packagebRequirement = data[0].packagebRequirement
  516. formData.warrantyPeriod = data[0].warrantyPeriod
  517. formData.invoiceHeader = data[0].invoiceHeader
  518. getShipList(data[0].headId)
  519. }
  520. function getShipList(id){
  521. let params = {id:id}
  522. let url = '/saleCode/saleOrder/querySaleOrderShipByMainId'
  523. defHttp.get({url:url,params}, { isTransformResponse: false }).then(res=>{
  524. if(res){
  525. deliveryNoticeFormShipTable.dataSource = res.result
  526. }
  527. })
  528. }
  529. function changeValues(prop){
  530. if(prop.col.key=='quantity'){
  531. if(prop.row.quantity){
  532. var num= prop.row.quantity*Number(prop.row.taxPrice)
  533. prop.row.money = num.toFixed(2)
  534. }
  535. }
  536. }
  537. return {
  538. deliveryNoticeFormShipTableRef,
  539. deliveryNoticeFormShipTable,
  540. deliveryDetailFormProductTableRef,
  541. deliveryDetailFormProductTable,
  542. validatorRules,
  543. validateInfos,
  544. activeKey,
  545. loading,
  546. formData,
  547. setFieldsValue,
  548. handleFormChange,
  549. formItemLayout,
  550. disabled,
  551. getFormData,
  552. submitForm,
  553. SelectShipSModalRef,
  554. add,
  555. edit,
  556. formRef,
  557. BaseShipArchiveAccessoriesListRef,
  558. viewAccessory,
  559. handleDelete1,
  560. SelectProjectModalRef,
  561. onSearchProject,
  562. addProject,
  563. getOptiom,
  564. classOption,
  565. getCustomerOptions,
  566. customerOption,
  567. notAllowEdit,
  568. selectSaleOrderList,
  569. SelectSaleOrderModalRef,
  570. addFormSaleOrder,
  571. changeValues
  572. }
  573. }
  574. });
  575. </script>
  576. <style lang="less" scoped>
  577. /** 时间和数字输入框样式 */
  578. :deep(.ant-input-number) {
  579. width: 100%;
  580. }
  581. :deep(.ant-calendar-picker) {
  582. width: 100%;
  583. }
  584. /deep/.vxe-table--body-wrapper{
  585. height: 100% !important;
  586. }
  587. /deep/.ant-modal-body{
  588. padding: 24px !important;
  589. }
  590. /deep/.ant-form-item{
  591. margin-bottom: 8px !important;
  592. }
  593. </style>