PurchaseInquiryFormForm.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615
  1. <template>
  2. <a-spin :spinning="loading">
  3. <JFormContainer :disabled="disabled">
  4. <template #detail>
  5. <a-form v-bind="formItemLayout" name="PuechaseInquiryFormForm" ref="formRef">
  6. <a-row>
  7. <a-col :span="12">
  8. <a-form-item label="询价单号(bill code)" v-bind="validateInfos.billCode" id="PuechaseInquiryFormForm-billCode" name="billCode">
  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="单据日期(bill date)" v-bind="validateInfos.billDate" id="PuechaseInquiryFormForm-billDate" name="billDate" :label-col="formItemLayout.labelCol1" :wrapper-col="formItemLayout.wrapperCol1">
  14. <a-date-picker placeholder="请选择单据日期(bill date)" v-model:value="formData.billDate" 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="询价项目(inquiry project)" v-bind="validateInfos.projectName" id="PuechaseInquiryFormForm-projectName" name="projectName">
  19. <a-input-search v-model:value="formData.projectName" placeholder="请输入询价项目(inquiry project)" AutoComplete="off" :disabled="notAllowEdit" allow-clear enter-button="Search" @search="onSearchProject"></a-input-search>
  20. </a-form-item>
  21. </a-col>
  22. <a-col :span="12">
  23. <a-form-item label="询价供应商(inquiry supplier)" v-bind="validateInfos.inquirySuppiler" id="PuechaseInquiryFormForm-inquirySuppiler" name="inquirySuppiler" :label-col="formItemLayout.labelCol1" :wrapper-col="formItemLayout.wrapperCol1">
  24. <JSelectInput v-model:value="formData.inquirySuppiler" placeholder="请选择" allow-clear :options="supplierOption" @change="changeSupplier"></JSelectInput>
  25. </a-form-item>
  26. </a-col>
  27. <a-col :span="12">
  28. <a-form-item label="询价有效期(inquiry period)" v-bind="validateInfos.inquiryPeriodEnd" id="PuechaseInquiryFormForm-inquiryPeriodEnd" name="inquiryPeriodEnd">
  29. <a-range-picker v-model:value="inquiryPeriod" :format="['YYYY-MM-DD','YYYY-MM-DD']" @change="onChangeInquiryPeriod" style="width: 100%" />
  30. </a-form-item>
  31. </a-col>
  32. <a-col :span="12">
  33. <a-form-item label="优先级(priority)" v-bind="validateInfos.priority" id="PuechaseInquiryFormForm-priority" name="priority" :label-col="formItemLayout.labelCol1" :wrapper-col="formItemLayout.wrapperCol1">
  34. <JDictSelectTag v-model:value="formData.priority" placeholder="请选择" dictCode="priority"/>
  35. </a-form-item>
  36. </a-col>
  37. <a-col :span="12">
  38. <a-form-item label="产品分类(production class)" v-bind="validateInfos.productionClass" id="PuechaseInquiryFormForm-productionClass" name="productionClass">
  39. <JSelectInput v-model:value="formData.productionClass" placeholder="请选择" :options="classOption" ></JSelectInput>
  40. </a-form-item>
  41. </a-col>
  42. <a-col :span="12">
  43. <a-form-item label="机型(model)" v-bind="validateInfos.model" id="PuechaseInquiryFormForm-model" name="model" :label-col="formItemLayout.labelCol1" :wrapper-col="formItemLayout.wrapperCol1">
  44. <JDictSelectTag v-model:value="formData.model" placeholder="请选择" dictCode="model_typer" disabled/>
  45. </a-form-item>
  46. </a-col>
  47. <a-col :span="12">
  48. <a-form-item label="厂家(maker)" v-bind="validateInfos.maker" id="PuechaseInquiryFormForm-maker" name="maker">
  49. <a-input v-model:value="formData.maker" placeholder="请输入厂家(maker)" allow-clear disabled></a-input>
  50. </a-form-item>
  51. </a-col>
  52. <a-col :span="12">
  53. <a-form-item label="交货地点(place of delivery)" v-bind="validateInfos.placeDelivery" id="PuechaseInquiryFormForm-placeDelivery" name="placeDelivery" :label-col="formItemLayout.labelCol1" :wrapper-col="formItemLayout.wrapperCol1">
  54. <a-input v-model:value="formData.placeDelivery" placeholder="" allow-clear AutoComplete="off" ></a-input>
  55. </a-form-item>
  56. </a-col>
  57. <a-col :span="12">
  58. <a-form-item label="付款条件(payment terms)" v-bind="validateInfos.paymentTerms" id="quotationFormForm-paymentTerms" name="paymentTerms" >
  59. <JDictSelectTag v-model:value="formData.paymentTerms" placeholder="请选择" dictCode="payment_terms" style="width: 100%;margin-right: 1%;"/>
  60. </a-form-item>
  61. </a-col>
  62. <!-- <a-col :span="12">
  63. <a-form-item label="报价有效期(quotation validity period)" v-bind="validateInfos.quotationValidity" id="PuechaseInquiryFormForm-quotationValidity" name="quotationValidity" :label-col="formItemLayout.labelCol1" :wrapper-col="formItemLayout.wrapperCol1">
  64. <a-input v-model:value="formData.quotationValidity" placeholder="请输入" />
  65. </a-form-item>
  66. </a-col> -->
  67. <a-col :span="12">
  68. <a-form-item label="发货方式(delivery)" v-bind="validateInfos.delivery" id="PuechaseInquiryFormForm-delivery" name="delivery" :label-col="formItemLayout.labelCol1" :wrapper-col="formItemLayout.wrapperCol1">
  69. <JDictSelectTag v-model:value="formData.delivery" placeholder="请选择" dictCode="delivery_methods" />
  70. </a-form-item>
  71. </a-col>
  72. <a-col :span="12">
  73. <a-form-item label="采购询价组(procurement inquiry team)" v-bind="validateInfos.inquiryTeamName" id="PuechaseInquiryFormForm-inquiryTeamName" name="inquiryTeam">
  74. <!-- <JDictSelectTag v-model:value="formData.inquiryTeam" placeholder="请选择" dictCode="procurement_inquiry_team" disabled/> -->
  75. <a-input v-model:value="formData.inquiryTeamName" disabled></a-input>
  76. </a-form-item>
  77. </a-col>
  78. <a-col :span="12">
  79. <a-form-item label="询价备注(inquiry notes)" v-bind="validateInfos.inquiryNotes" id="PuechaseInquiryFormForm-inquiryNotes" name="inquiryNotes" :label-col="formItemLayout.labelCol1" :wrapper-col="formItemLayout.wrapperCol1">
  80. <a-input v-model:value="formData.inquiryNotes" placeholder="请输入询价备注(inquiry notes)" allow-clear AutoComplete="off"></a-input>
  81. </a-form-item>
  82. </a-col>
  83. <a-col :span="12">
  84. <a-form-item label="附件(attachs)" v-bind="validateInfos.attachs" id="PuechaseInquiryFormForm-attachs" name="attachs" >
  85. <JUpload v-model:value="formData.attachs"></JUpload>
  86. </a-form-item>
  87. </a-col>
  88. </a-row>
  89. </a-form>
  90. </template>
  91. </JFormContainer>
  92. <!-- 子表单区域 -->
  93. <a-tabs v-model:activeKey="activeKey" animated style=" padding: 24px;padding-top: 0px;">
  94. <a-tab-pane tab="采购询价单 - 产品明细(product details)" key="PuechaseInquiryFormProduct" :forceRender="true">
  95. <a-button type="primary" @click="SelectCustomerInquiry" style="margin-right: 1%;margin-bottom: 1%;"> 选择客户询价单(select customer inquiry form)</a-button>
  96. <a-button type="primary" @click="selectProducts" style="margin-right: 1%;margin-bottom: 1%;"> 选择产品(select product)</a-button>
  97. <j-vxe-table
  98. :keep-source="true"
  99. resizable
  100. ref="PuechaseInquiryFormProductTableRef"
  101. :loading="PuechaseInquiryFormProductTable.loading"
  102. :columns="PuechaseInquiryFormProductTable.columns"
  103. :dataSource="PuechaseInquiryFormProductTable.dataSource"
  104. :height="340"
  105. :disabled="disabled"
  106. :rowNumber="true"
  107. :rowSelection="true"
  108. asyncRemove
  109. >
  110. <template #action="props">
  111. <a-popconfirm title="确定删除吗?" @confirm="handleDelete1(props)">
  112. <a>删除(delete)</a>
  113. </a-popconfirm>
  114. </template>
  115. </j-vxe-table>
  116. </a-tab-pane>
  117. <a-tab-pane tab="采购询价单 - 船明细(ship details)" key="PuechaseInquiryFormShip" :forceRender="true">
  118. <j-vxe-table
  119. :keep-source="true"
  120. resizable
  121. ref="PuechaseInquiryFormShipTableRef"
  122. :loading="PuechaseInquiryFormShipTable.loading"
  123. :columns="PuechaseInquiryFormShipTable.columns"
  124. :dataSource="PuechaseInquiryFormShipTable.dataSource"
  125. :height="340"
  126. :disabled="disabled"
  127. :rowNumber="true"
  128. :rowSelection="true"
  129. >
  130. <template #action="props" >
  131. <a @click="viewAccessory(props)" >查看配件信息(view accessory information)</a>
  132. </template>
  133. </j-vxe-table>
  134. </a-tab-pane>
  135. </a-tabs>
  136. <BaseShipArchiveAccessoriesModal ref="BaseShipArchiveAccessoriesListRef"></BaseShipArchiveAccessoriesModal>
  137. <SelectPrpductModal ref="SelectPrpductModalRef" @selectProduct="addProduct"></SelectPrpductModal>
  138. <SelectProjectModal ref="SelectProjectModalRef" @selectProject="addProject"></SelectProjectModal>
  139. <SelectCustomerInquiryModal ref="SelectCustomerInquiryModalRef" @selectCustomerInquiry="addProductFromCustomer"></SelectCustomerInquiryModal>
  140. </a-spin>
  141. </template>
  142. <script lang="ts">
  143. import { defineComponent, ref, reactive, computed, toRaw, onMounted } from 'vue';
  144. import { defHttp } from '/@/utils/http/axios';
  145. import { useValidateAntFormAndTable } from '/@/hooks/system/useJvxeMethods';
  146. import { queryQurcodeInquiryFormShipListByMainId, queryPurcodeInquiryFormProductListByMainId, queryDataById, saveOrUpdate } from '../purchaseInquiryForm.api';
  147. import { JVxeTable } from '/@/components/jeecg/JVxeTable';
  148. import {PuechaseInquiryFormShipColumns, PuechaseInquiryFormProductColumns} from '../PurchaseInquiryForm.data';
  149. import BaseShipArchiveAccessoriesModal from '../../../publicComponents/BaseShipArchiveAccessoriesModal.vue';
  150. import SelectPrpductModal from '../../../publicComponents/SelectPrpductModal.vue';
  151. import SelectProjectModal from '../../../publicComponents/SelectProjectModal.vue';
  152. import SelectCustomerInquiryModal from './SelectCustomerInquiryModal.vue';
  153. import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
  154. import JUpload from '/@/components/Form/src/jeecg/components/JUpload/JUpload.vue';
  155. import { JDictSelectTag} from '/@/components/Form';
  156. import JSelectInput from '/@/components/Form/src/jeecg/components/JSelectInput.vue';
  157. import { Form ,message} from 'ant-design-vue';
  158. import moment from 'moment';
  159. const useForm = Form.useForm;
  160. export default defineComponent({
  161. name: "PuechaseInquiryFormForm",
  162. components:{
  163. JVxeTable,
  164. JFormContainer,
  165. BaseShipArchiveAccessoriesModal,
  166. SelectPrpductModal,
  167. JUpload,
  168. SelectProjectModal,
  169. JDictSelectTag,
  170. JSelectInput,
  171. SelectCustomerInquiryModal,
  172. },
  173. props:{
  174. formDisabled:{
  175. type: Boolean,
  176. default: false
  177. },
  178. formData: { type: Object, default: ()=>{} },
  179. formBpm: { type: Boolean, default: true }
  180. },
  181. emits:['success'],
  182. setup(props, {emit}) {
  183. var classOption = ref([]);
  184. const loading = ref(false);
  185. const formRef = ref();
  186. var SelectPrpductModalRef = ref()
  187. var SelectProjectModalRef = ref()
  188. var SelectCustomerInquiryModalRef = ref()
  189. var inquiryPeriod = ref([])
  190. const PuechaseInquiryFormShipTableRef = ref();
  191. const PuechaseInquiryFormShipTable = reactive<Record<string, any>>({
  192. loading: false,
  193. columns: PuechaseInquiryFormShipColumns,
  194. dataSource: []
  195. });
  196. const PuechaseInquiryFormProductTableRef = ref();
  197. const PuechaseInquiryFormProductTable = reactive<Record<string, any>>({
  198. loading: false,
  199. columns: PuechaseInquiryFormProductColumns,
  200. dataSource: []
  201. });
  202. var BaseShipArchiveAccessoriesListRef = ref();
  203. const activeKey = ref('PuechaseInquiryFormProduct');
  204. var notAllowEdit = ref(false);
  205. var supplierOption = ref([]);
  206. const formData = reactive<Record<string, any>>({
  207. id: '',
  208. status: undefined,
  209. delFlag: undefined,
  210. otherStatus: '',
  211. submit: '',
  212. billDate: moment(new Date()).format('YYYY-MM-DD'),
  213. billCode: '',
  214. inquiryProject: '',
  215. inquirySuppiler:"",
  216. inquiryPeriodEnd: '',
  217. inquiryPeriodBegin: ' ',
  218. inquiryCustomer: '',
  219. priority: '',
  220. productionClass: '',
  221. model: '',
  222. maker: '',
  223. paymentTerms:'',
  224. delivery:'',
  225. deliveryTime: '',
  226. inquiryTeam: '',
  227. inquiryTeamName:'',
  228. quotationValidity:'',
  229. attachs: '',
  230. inquiryNotes: '',
  231. sourceCode:'',
  232. projectName:'',
  233. placeDelivery:'',
  234. suppilerName:'',
  235. saleAttachs:'',
  236. paymentTermsInfo:'',
  237. sourceId:""
  238. });
  239. //表单验证
  240. const validatorRules = reactive({
  241. });
  242. const {resetFields, validate, validateInfos} = useForm(formData, validatorRules, {immediate: false});
  243. const dbData = {};
  244. const formItemLayout = {
  245. labelCol: {xs: {span: 24}, sm: {span: 7}},
  246. wrapperCol: {xs: {span: 24}, sm: {span: 16}},
  247. labelCol1: {xs: {span: 24}, sm: {span: 9}},
  248. wrapperCol1: {xs: {span: 24}, sm: {span: 14}},
  249. };
  250. // 表单禁用
  251. const disabled = computed(()=>{
  252. if(props.formBpm === true){
  253. if(props.formData.disabled === false){
  254. return false;
  255. }else{
  256. return true;
  257. }
  258. }
  259. return props.formDisabled;
  260. });
  261. function add() {
  262. resetFields();
  263. PuechaseInquiryFormShipTable.dataSource = [];
  264. PuechaseInquiryFormProductTable.dataSource = [];
  265. activeKey.value = 'PuechaseInquiryFormProduct'
  266. getSupplierOption()
  267. getOptiom()
  268. inquiryPeriod.value = []
  269. notAllowEdit.value=false
  270. }
  271. async function edit(row) {
  272. //主表数据
  273. await queryMainData(row.id);
  274. //子表数据
  275. const PuechaseInquiryFormShipDataList = await queryQurcodeInquiryFormShipListByMainId(row['id']);
  276. PuechaseInquiryFormShipTable.dataSource = [...PuechaseInquiryFormShipDataList];
  277. const PuechaseInquiryFormProductDataList = await queryPurcodeInquiryFormProductListByMainId(row['id']);
  278. PuechaseInquiryFormProductTable.dataSource = [...PuechaseInquiryFormProductDataList];
  279. getSupplierOption()
  280. getOptiom()
  281. inquiryPeriod.value[0]=formData.inquiryPeriodBegin?moment(formData.inquiryPeriodBegin):''
  282. inquiryPeriod.value[1]=formData.inquiryPeriodEnd?moment(formData.inquiryPeriodEnd):''
  283. notAllowEdit.value=true
  284. }
  285. async function queryMainData(id) {
  286. const row = await queryDataById(id);
  287. resetFields();
  288. const tmpData = {};
  289. Object.keys(formData).forEach((key) => {
  290. if(row.hasOwnProperty(key)){
  291. tmpData[key] = row[key]
  292. }
  293. })
  294. //赋值
  295. Object.assign(formData,tmpData);
  296. }
  297. const {getSubFormAndTableData, transformData} = useValidateAntFormAndTable(activeKey, {
  298. 'purInquiryFormShip': PuechaseInquiryFormShipTableRef,
  299. 'purInquiryFormProduct': PuechaseInquiryFormProductTableRef,
  300. });
  301. async function getFormData() {
  302. try {
  303. // 触发表单验证
  304. await validate();
  305. } catch ({ errorFields }) {
  306. if (errorFields) {
  307. const firstField = errorFields[0];
  308. if (firstField) {
  309. formRef.value.scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
  310. }
  311. }
  312. return Promise.reject(errorFields);
  313. }
  314. return transformData(toRaw(formData))
  315. }
  316. async function submitForm() {
  317. if(formData.sourceCode==''){
  318. message.warning('请选择客户询价单')
  319. }else{
  320. const mainData = await getFormData();
  321. const subData = await getSubFormAndTableData();
  322. const values = Object.assign({}, dbData, mainData, subData);
  323. console.log('表单提交数据', values)
  324. const isUpdate = values.id ? true : false
  325. await saveOrUpdate(values, isUpdate);
  326. //关闭弹窗
  327. emit('success');
  328. }
  329. }
  330. function setFieldsValue(values) {
  331. if(values){
  332. Object.keys(values).map(k=>{
  333. formData[k] = values[k];
  334. });
  335. }
  336. }
  337. /**
  338. * 值改变事件触发-树控件回调
  339. * @param key
  340. * @param value
  341. */
  342. function handleFormChange(key, value) {
  343. formData[key] = value;
  344. }
  345. async function handleDelete(prop) {
  346. var newArray = [...PuechaseInquiryFormShipTable.dataSource]
  347. newArray.splice(prop.rowIndex, 1)
  348. PuechaseInquiryFormShipTable.dataSource = newArray
  349. }
  350. async function handleDelete1(prop) {
  351. var newArray = [...PuechaseInquiryFormProductTable.dataSource]
  352. newArray.splice(prop.rowIndex, 1)
  353. PuechaseInquiryFormProductTable.dataSource = newArray
  354. if( PuechaseInquiryFormProductTable.dataSource.length!==0){
  355. var arr = []
  356. PuechaseInquiryFormProductTable.dataSource.map(item=>{
  357. if(item.sourceId){
  358. arr.push(item.sourceId)
  359. }
  360. })
  361. if(arr.length==0){
  362. formData.sourceCode = ''
  363. notAllowEdit.value=false
  364. }
  365. }else{
  366. notAllowEdit.value=false
  367. formData.sourceCode = ''
  368. }
  369. }
  370. function addShip(data){
  371. var arr = data.concat(PuechaseInquiryFormShipTable.dataSource)
  372. arr.map(item=>item.shipowner = item.relateCustomer)
  373. PuechaseInquiryFormShipTable.dataSource=arr
  374. }
  375. function addProduct(data){
  376. data.map(item=>{
  377. item.productClass = item.classId_dictText
  378. item.productCode = item.code
  379. item.productId = item.id
  380. item.unit = item.measurementUnit
  381. item.needShip = '0'
  382. item.shipInspection =''
  383. })
  384. var arrProduct = data.concat(PuechaseInquiryFormProductTable.dataSource)
  385. PuechaseInquiryFormProductTable.dataSource=arrProduct
  386. }
  387. function addProject(data) {
  388. if(data.length!==0){
  389. formData.inquiryProject = data[0].id
  390. formData.projectName = data[0].code
  391. }else{
  392. formData.inquiryProject = ''
  393. formData.projectName = ''
  394. }
  395. }
  396. function addProductFromCustomer(data){
  397. debugger
  398. data.map(item=>{
  399. item.productClass = item.productClass
  400. item.productCode = item.productCode
  401. item.unit = item.unit
  402. item.sourceId = item.childId
  403. item.model = item.childModel
  404. item.deliveryTime = formData.deliveryTime
  405. })
  406. var arrProduct = data.concat(PuechaseInquiryFormProductTable.dataSource)
  407. notAllowEdit.value=true
  408. inquiryPeriod.value[0]=data[0].inquiryPeriodBegin?moment(data[0].inquiryPeriodBegin):''
  409. inquiryPeriod.value[1]=data[0].inquiryPeriodEnd?moment(data[0].inquiryPeriodEnd):''
  410. console.log(inquiryPeriod);
  411. debugger
  412. formData.inquiryPeriodBegin=data[0].inquiryPeriodBegin?moment(data[0].inquiryPeriodBegin):''
  413. formData.inquiryPeriodEnd=data[0].inquiryPeriodEnd?moment(data[0].inquiryPeriodEnd):''
  414. PuechaseInquiryFormProductTable.dataSource=arrProduct
  415. formData.inquiryProject = data[0].inquiryProject
  416. formData.projectName = data[0].projectName
  417. formData.sourceCode = data[0].billCode
  418. formData.priority = data[0].priority
  419. formData.model = data[0].headModel
  420. formData.maker = data[0].maker
  421. formData.inquiryTeam = data[0].inquiryTeam
  422. formData.inquiryTeamName = data[0].inquiryTeam_dictText
  423. formData.productionClass = data[0].productionClass
  424. formData.saleAttachs =data[0].attachs
  425. getShipList(data[0].headId)
  426. }
  427. function getShipList(id){
  428. let params = {id:id}
  429. defHttp.get({url:'/saleCode/saleInquiryForm/querySaleInquiryFormShipByMainId',params}, { isTransformResponse: false }).then(res=>{
  430. if(res){
  431. PuechaseInquiryFormShipTable.dataSource = res.result
  432. }
  433. })
  434. }
  435. function viewAccessory(prop){
  436. BaseShipArchiveAccessoriesListRef.value.getTable(prop.row)
  437. }
  438. function selectProducts(){
  439. SelectPrpductModalRef.value.getTable()
  440. }
  441. function setNeed(){
  442. const values = PuechaseInquiryFormProductTableRef.value.getSelectionData()
  443. values.map(item=>{
  444. PuechaseInquiryFormProductTable.dataSource.map(event=>{
  445. if(item.id == event.id){
  446. event.needShip = 1
  447. }
  448. })
  449. const xTable = PuechaseInquiryFormProductTableRef.value!.getXTable();//关键代码 如果不更新 重新加载表格即可
  450. xTable.loadData(PuechaseInquiryFormProductTable.dataSource)
  451. })
  452. }
  453. function setNotNeed(){
  454. const values = PuechaseInquiryFormProductTableRef.value.getSelectionData()
  455. values.map(item=>{
  456. PuechaseInquiryFormProductTable.dataSource.map(event=>{
  457. if(item.id == event.id){
  458. event.needShip = 0
  459. }
  460. })
  461. const xTable = PuechaseInquiryFormProductTableRef.value!.getXTable();//关键代码 如果不更新 重新加载表格即可
  462. xTable.loadData(PuechaseInquiryFormProductTable.dataSource)
  463. })
  464. }
  465. function onSearchProject(){
  466. SelectProjectModalRef.value.getTable()
  467. }
  468. function getSupplierOption(){
  469. defHttp
  470. .get({ url: '/cuspCode/cuspSupplierProfile/list'}, { isTransformResponse: false })
  471. .then((res) => {
  472. if (res.success) {
  473. supplierOption.value = []
  474. res.result.records.forEach(element => {
  475. var obj = {
  476. label: element.name?element.name:'无名称请维护',
  477. value: element.id?element.id:'',
  478. paymentTerms:element.paymentTerms?element.paymentTerms:''
  479. };
  480. supplierOption.value.push( obj)
  481. });
  482. }
  483. })
  484. .finally(() => {
  485. // loading.value = false;
  486. });
  487. }
  488. function onChangeInquiryPeriod(data){
  489. inquiryPeriod.value = data
  490. formData.inquiryPeriodBegin = data[0].format('YYYY-MM-DD')
  491. formData.inquiryPeriodEnd = data[1].format('YYYY-MM-DD')
  492. }
  493. function SelectCustomerInquiry(){
  494. SelectCustomerInquiryModalRef.value.getTable(formData)
  495. }
  496. function changeSupplier(prop){
  497. if(prop){
  498. supplierOption.value.map(item=>{
  499. if(item.value==prop){
  500. formData.suppilerName = item.label
  501. formData.paymentTerms = item.paymentTerms
  502. }
  503. })
  504. }else{
  505. formData.inquirySuppiler = ''
  506. formData.suppilerName = ''
  507. }
  508. }
  509. // 产品分类
  510. function getOptiom(){
  511. defHttp.get({ url: 'baseCode/baseProductClass/list'}, { isTransformResponse: false })
  512. .then((res) => {
  513. if (res.success) {
  514. classOption.value = []
  515. res.result.records.forEach(element => {
  516. var obj = {
  517. label: element.name?element.name:'无名称请维护',
  518. value: element.id?element.id:''
  519. };
  520. classOption.value.push( obj)
  521. });
  522. }
  523. }).finally(() => {
  524. // loading.value = false;
  525. });
  526. }
  527. return {
  528. PuechaseInquiryFormShipTableRef,
  529. PuechaseInquiryFormShipTable,
  530. PuechaseInquiryFormProductTableRef,
  531. PuechaseInquiryFormProductTable,
  532. validatorRules,
  533. validateInfos,
  534. activeKey,
  535. loading,
  536. formData,
  537. setFieldsValue,
  538. handleFormChange,
  539. formItemLayout,
  540. disabled,
  541. getFormData,
  542. submitForm,
  543. add,
  544. edit,
  545. formRef,
  546. addShip,
  547. addProduct,
  548. BaseShipArchiveAccessoriesListRef,
  549. viewAccessory,
  550. handleDelete,
  551. handleDelete1,
  552. selectProducts,
  553. setNeed,
  554. setNotNeed,
  555. SelectPrpductModalRef,
  556. SelectProjectModalRef,
  557. SelectCustomerInquiryModalRef,
  558. onSearchProject,
  559. addProject,
  560. getSupplierOption,
  561. supplierOption,
  562. inquiryPeriod,
  563. onChangeInquiryPeriod,
  564. SelectCustomerInquiry,
  565. addProductFromCustomer,
  566. changeSupplier,
  567. notAllowEdit,
  568. getOptiom,
  569. classOption
  570. }
  571. }
  572. });
  573. </script>
  574. <style lang="less" scoped>
  575. /** 时间和数字输入框样式 */
  576. :deep(.ant-input-number) {
  577. width: 100%;
  578. }
  579. :deep(.ant-calendar-picker) {
  580. width: 100%;
  581. }
  582. /deep/.vxe-table--body-wrapper{
  583. height: 100% !important;
  584. }
  585. /deep/.ant-modal-body{
  586. padding: 24px !important;
  587. }
  588. /deep/.ant-form-item{
  589. margin-bottom: 8px !important;
  590. }
  591. </style>