detailsPageEdit.vue 37 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217
  1. <template>
  2. <div class="borderless">
  3. <div class="customer-head">
  4. <div class="customer-back">
  5. <!-- <i class="back-icon el-icon-arrow-left"></i><i style="font-style:normal">返回管理列表</i>-->
  6. <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
  7. @click="backToList">返回列表
  8. </el-button>
  9. </div>
  10. <el-button
  11. class="el-button--small-yh add-customer-btn"
  12. type="success" style="right: 140px;" @click="copyOrder">
  13. 复制新单
  14. </el-button>
  15. <el-button
  16. class="el-button--small-yh add-customer-btn"
  17. type="primary"
  18. :disabled="disabled"
  19. @click="editCustomer(false)"
  20. >{{ form.id ? '确认修改' : '确认新增' }}
  21. </el-button>
  22. </div>
  23. <div style="margin-top: 60px">
  24. <el-form :model="form" ref="form" label-width="130px" class="demo-ruleForm">
  25. <containerTitle title="基础资料"></containerTitle>
  26. <basic-container style="margin-bottom: 10px">
  27. <el-row>
  28. <el-col v-for="(item,index) in basicData.column" :key="index" :span="item.span?item.span:8">
  29. <el-form-item :label="item.label" :prop="item.prop" :rules="item.rules">
  30. <!-- <avue-input-tree v-if="item.prop === 'corpsTypeId'" leaf-only multiple :props="{label:'title'}" v-model="form[item.prop]" placeholder="请选择内容" type="tree" :dic="dic"-->
  31. <!-- ></avue-input-tree>-->
  32. <el-date-picker v-if="item.type === 'datetime'" style="width: 100%;" v-model="form[item.prop]"
  33. size="small" type="datetime" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss"/>
  34. <selectComponent v-else-if="item.prop === 'corpId' || item.prop === 'salesCompany'" v-model="form[item.prop]"
  35. :configuration="configuration" style="width: 100%"/>
  36. <el-select v-else-if="item.prop === 'purchaseMode'" v-model="form[item.prop]" placeholder="请选择" clearable filterable style="width: 100%" size="small">
  37. <el-option v-for="(item,index) in procurementMethodOption" :key="index" :label="item.dictValue" :value="item.dictValue"></el-option>
  38. </el-select>
  39. <avue-input-tree
  40. v-else-if="item.prop === 'warehouseType'"
  41. leaf-only
  42. placeholder="请选择内容"
  43. :dic="warehouseType"
  44. type="tree"
  45. v-model="form[item.prop]"
  46. style="width: 100%"
  47. size="small"
  48. @change="warehouseTreeChange"
  49. >
  50. </avue-input-tree>
  51. <el-select v-else-if="item.prop === 'storageId'" v-model="form[item.prop]" placeholder="请选择" clearable filterable style="width: 100%" size="small">
  52. <el-option v-for="(item,index) in warehouseName" :key="index" :label="item.cname" :value="item.id" size="small"></el-option>
  53. </el-select>
  54. <el-input type="age" v-else v-model="form[item.prop]" size="small" autocomplete="off" :disabled="item.disabled"></el-input>
  55. </el-form-item>
  56. </el-col>
  57. </el-row>
  58. </basic-container>
  59. <containerTitle title="商品信息"></containerTitle>
  60. <basic-container style="margin-bottom: 10px">
  61. <avue-crud
  62. :option="customerContact"
  63. v-model="contactsForm"
  64. :data="contactsData"
  65. ref="crudContact"
  66. @row-save="rowSave"
  67. @row-click="handleRowClick"
  68. @row-update="rowUpdate"
  69. @row-del="rowDel"
  70. >
  71. <template slot="code" slot-scope="{row,index}">
  72. <span style="float: left;padding-top: 2px">{{ row.code }}</span>
  73. <el-button type="text" size="mini" style="float: right" @click="commodityChoice(row)">选择</el-button>
  74. </template>
  75. <template slot-scope="{row,index}" slot="menu">
  76. <el-button
  77. type="text"
  78. size="small"
  79. @click="rowCell(row,index)"
  80. >{{ row.$cellEdit ? '保存' : '修改' }}
  81. </el-button>
  82. </template>
  83. <template slot="menuLeft" slot-scope="{size}">
  84. <el-button type="primary"
  85. icon="el-icon-plus"
  86. size="small"
  87. @click="commoditySelection"
  88. >录入明细
  89. </el-button>
  90. <el-button type="info" :size="size" icon="el-icon-printer">报 表</el-button>
  91. </template>
  92. </avue-crud>
  93. </basic-container>
  94. <containerTitle title="费用明细"></containerTitle>
  95. <basic-container style="margin-bottom: 10px">
  96. <avue-crud
  97. :option="advantageProject"
  98. v-model="advantageProjectForm"
  99. :data="advantageProjectData"
  100. ref="crudProject"
  101. @row-save="rowSaveProject"
  102. @row-update="rowUpdateProject"
  103. @row-del="rowDelProject"
  104. >
  105. <template slot="code" slot-scope="{row,index}">
  106. <span style="float: left;padding-top: 2px">{{ row.code }}</span>
  107. <el-button type="text" size="mini" style="float: right" @click="choice(row)">选择</el-button>
  108. </template>
  109. <template slot="corpId" slot-scope="{ row }">
  110. <selectComponent v-if="row.$cellEdit" v-model="row.corpId"
  111. :configuration="configuration" @receiveList="receiveList"/>
  112. <span v-else>
  113. <span v-for="item in configuration.dicData" v-if="item.id == row.corpId">{{ item.cname }}</span>
  114. </span>
  115. </template>
  116. <template slot-scope="{row,index}" slot="menu">
  117. <el-button
  118. type="text"
  119. size="small"
  120. @click="rowCellTwo(row,index)"
  121. >{{ row.$cellEdit ? '保存' : '修改' }}
  122. </el-button>
  123. </template>
  124. <template slot="menuLeft" slot-scope="{size}">
  125. <el-button type="primary"
  126. icon="el-icon-plus"
  127. size="small"
  128. @click="costIncrease"
  129. >录入明细
  130. </el-button>
  131. </template>
  132. </avue-crud>
  133. </basic-container>
  134. <containerTitle title="附件上传"></containerTitle>
  135. <basic-container style="margin-bottom: 40px">
  136. <avue-crud
  137. :option="bankOfDeposit"
  138. v-model="bankOfDepositForm"
  139. :data="bankOfDepositData"
  140. @row-save="rowSaveBankOfDeposit"
  141. @row-update="rowUpdateBankOfDeposit"
  142. @row-del="rowDelBankOfDeposit"
  143. :upload-after="uploadAfter"
  144. ></avue-crud>
  145. </basic-container>
  146. </el-form>
  147. </div>
  148. <el-dialog
  149. title="导入商品"
  150. append-to-body
  151. class="el-dialogDeep"
  152. :visible.sync="dialogVisible"
  153. width="80%"
  154. :close-on-click-modal="false"
  155. :destroy-on-close="true"
  156. :close-on-press-escape="false"
  157. @close="closeGoods">
  158. <el-row style="height: 0;">
  159. <el-col :span="5">
  160. <div>
  161. <el-scrollbar>
  162. <basic-container>
  163. <avue-tree :option="treeOption" :data="treeDataGoods" @node-click="nodeClick"/>
  164. </basic-container>
  165. </el-scrollbar>
  166. </div>
  167. </el-col>
  168. <el-col :span="19">
  169. <basic-container>
  170. <avue-crud :option="optionTwo"
  171. :table-loading="loading"
  172. :data="data"
  173. ref="crud"
  174. @refresh-change="refreshChange"
  175. @selection-change="selectionChange"
  176. :page.sync="page"
  177. @on-load="onLoad"></avue-crud>
  178. </basic-container>
  179. </el-col>
  180. </el-row>
  181. <span slot="footer" class="dialog-footer">
  182. <el-button @click="dialogVisible = false">取 消</el-button>
  183. <el-button type="primary" @click="importGoods" v-if="commodityData !== true">导入</el-button>
  184. <el-button type="primary" @click="importChoice" v-if="commodityData === true"
  185. :disabled="tableData.length !== 1">导入</el-button>
  186. </span>
  187. </el-dialog>
  188. <el-dialog
  189. title="导入费用"
  190. append-to-body
  191. class="el-dialogDeep"
  192. :visible.sync="dialogCost"
  193. width="80%"
  194. :close-on-click-modal="false"
  195. :destroy-on-close="true"
  196. :close-on-press-escape="false"
  197. @close="closeFees">
  198. <el-row style="height: 0;">
  199. <el-col :span="5">
  200. <div>
  201. <el-scrollbar>
  202. <basic-container>
  203. <avue-tree :option="treeOptionCost" :data="treeData" @node-click="nodeClickCost"/>
  204. </basic-container>
  205. </el-scrollbar>
  206. </div>
  207. </el-col>
  208. <el-col :span="19">
  209. <basic-container>
  210. <avue-crud :option="optionTwoCost"
  211. :table-loading="loadingCost"
  212. :data="dataCost"
  213. ref="crud"
  214. @refresh-change="refreshChangeCost"
  215. @selection-change="selectionChangeCost"
  216. :page.sync="pageCost"
  217. @on-load="onLoadCost">
  218. </avue-crud>
  219. </basic-container>
  220. </el-col>
  221. </el-row>
  222. <span slot="footer" class="dialog-footer">
  223. <el-button @click="dialogCost = false">取 消</el-button>
  224. <el-button type="primary" @click="importCost" v-if="choiceData !== true">导入</el-button>
  225. <el-button type="primary" @click="choiceCost" v-if="choiceData === true"
  226. :disabled="tableDataCost.length !== 1">导入</el-button>
  227. </span>
  228. </el-dialog>
  229. <!--打印-->
  230. <el-dialog
  231. title="打印单"
  232. append-to-body
  233. class="el-dialogDeep"
  234. :visible.sync="printVisible"
  235. width="100%"
  236. fullscreen
  237. :close-on-click-modal="false"
  238. :close-on-press-escape="false">
  239. <div class="print-div">
  240. <div
  241. style="
  242. display: flex;
  243. flex-direction: column;
  244. justify-content: center;
  245. align-item: center;
  246. font-size: 24px;
  247. margin-bottom: 5px;
  248. width: 100%;
  249. text-align: center;
  250. "
  251. >
  252. <div><b>VITAL INDUSTRIAL GROUP LIMITED</b></div>
  253. <div>NO.37 DONGHAI ROAD, QINGDAO, CHINA</div>
  254. <div>TEL:0086-532-86019080 FAX:0086-532-86019080</div>
  255. <div>
  256. <b>COMMERCIAL INVOICE</b>
  257. <span style="float: right">ORIGINAL</span>
  258. </div>
  259. </div>
  260. <div class="print_table" style="display: flex">
  261. <table
  262. border="0"
  263. cellspacing="0"
  264. cellpadding="0"
  265. style="width: 100%; line-height: 30px"
  266. >
  267. <tr>
  268. <td colspan="5" rowspan="3">MESSERS:</td>
  269. <td colspan="2">INVOICE NO.</td>
  270. <td colspan="3"></td>
  271. </tr>
  272. <tr>
  273. <td colspan="2">DATE</td>
  274. <td colspan="3"></td>
  275. </tr>
  276. <tr>
  277. <td colspan="2">INCOTERM .</td>
  278. <td colspan="3"></td>
  279. </tr>
  280. <tr>
  281. <td colspan="5">PI NO.:</td>
  282. <td colspan="2">DELIVERY PORT</td>
  283. <td colspan="3"></td>
  284. </tr>
  285. <tr>
  286. <td rowspan="2">NO.</td>
  287. <td rowspan="2">DESCRIPTION</td>
  288. <td>THICK</td>
  289. <td>LENGTH</td>
  290. <td>WIDTH</td>
  291. <td rowspan="2">SHEETS</td>
  292. <td rowspan="2">CRATES</td>
  293. <td>UNIT PRICE</td>
  294. <td>TOTAL</td>
  295. <td>T. AMOUNT</td>
  296. </tr>
  297. <tr>
  298. <td>mm</td>
  299. <td>mm</td>
  300. <td>mm</td>
  301. <td>US$/M²</td>
  302. <td>M²</td>
  303. <td>US$</td>
  304. </tr>
  305. <tr>
  306. <td>1</td>
  307. <td></td>
  308. <td></td>
  309. <td></td>
  310. <td></td>
  311. <td></td>
  312. <td></td>
  313. <td></td>
  314. <td></td>
  315. <td></td>
  316. </tr>
  317. <tr>
  318. <td>2</td>
  319. <td></td>
  320. <td></td>
  321. <td></td>
  322. <td></td>
  323. <td></td>
  324. <td></td>
  325. <td></td>
  326. <td></td>
  327. <td></td>
  328. </tr>
  329. <tr>
  330. <td>3</td>
  331. <td></td>
  332. <td></td>
  333. <td></td>
  334. <td></td>
  335. <td></td>
  336. <td></td>
  337. <td></td>
  338. <td></td>
  339. <td></td>
  340. </tr>
  341. <tr>
  342. <td colspan="9" style="text-align: right">FUMIGATION COST:</td>
  343. <td></td>
  344. </tr>
  345. <tr>
  346. <td colspan="9" style="text-align: right">INSURANCE:</td>
  347. <td></td>
  348. </tr>
  349. <tr>
  350. <td colspan="9" style="text-align: right">TOTAL:</td>
  351. <td>0.00</td>
  352. </tr>
  353. </table>
  354. </div>
  355. <div class="print-footer" style="margin-top: 8px">
  356. <div style="font-weight: bold">TOTAL AMOUNT: U.S. DOLLARS NINE THOUSAND FORTY SIX CENTS TWENTY FIVE ONLY.
  357. </div>
  358. </div>
  359. </div>
  360. </el-dialog>
  361. </div>
  362. </template>
  363. <script>
  364. import {
  365. typeSave, detail, deleteDetails,
  366. corpstypeTree,
  367. corpsattn,
  368. corpsbank,
  369. corpsfiles,
  370. corpsitem,
  371. getList
  372. } from "@/api/basicData/receipt"
  373. import customerContact from "./configuration/customerContact.json"
  374. import advantageProject from "./configuration/advantageProject.json"
  375. import bankOfDeposit from "./configuration/bankOfDeposit.json"
  376. import commodity from "./configuration/commodity.json"
  377. import optionTwoCost from "./configuration/mainListCost.json"
  378. import {getDeptLazyTree, customerList,getDeptLazyTreeTwo} from "@/api/basicData/basicFeesDesc";
  379. import {customerList as wareHouseType} from "@/api/basicData/basicStorageType"
  380. import {customerList as selectWareHouse} from "@/api/basicData/basicStorageDesc"
  381. export default {
  382. name: "detailsPage",
  383. props: {
  384. detailData: {
  385. type: Object
  386. }
  387. },
  388. data() {
  389. return {
  390. configuration: {
  391. multipleChoices: false,
  392. multiple: false,
  393. collapseTags: false,
  394. placeholder: '请点击右边按钮选择',
  395. dicData: []
  396. },
  397. form: {},
  398. data: [],
  399. loadingCost: false,
  400. choiceData: false,
  401. commodityData: false,
  402. dataCost: [],
  403. choiceIndex: '',
  404. dialogCost: false,
  405. treeDeptId: '',
  406. treeDeptIdCost: '',
  407. pageCost: {
  408. pageSize: 10,
  409. currentPage: 1,
  410. total: 0
  411. },
  412. page: {
  413. pageSize: 10,
  414. currentPage: 1,
  415. total: 0
  416. },
  417. loading: false,
  418. contactsForm: {},
  419. optionTwo: commodity,
  420. optionTwoCost: optionTwoCost,
  421. treeData: [],
  422. treeDataGoods: [],
  423. treeOptionCost: {
  424. nodeKey: 'id',
  425. lazy: true,
  426. treeLoad: function (node, resolve) {
  427. const parentId = (node.level === 0) ? 0 : node.data.id;
  428. getDeptLazyTree(parentId).then(res => {
  429. resolve(res.data.data.map(item => {
  430. return {
  431. ...item,
  432. leaf: !item.hasChildren
  433. }
  434. }))
  435. });
  436. },
  437. addBtn: false,
  438. menu: false,
  439. size: 'small',
  440. props: {
  441. labelText: '标题',
  442. label: 'title',
  443. value: 'value',
  444. children: 'children'
  445. }
  446. },
  447. treeOption: {
  448. nodeKey: 'id',
  449. lazy: true,
  450. treeLoad: function (node, resolve) {
  451. const parentId = (node.level === 0) ? 0 : node.data.id;
  452. getDeptLazyTreeTwo(parentId).then(res => {
  453. resolve(res.data.data.map(item => {
  454. return {
  455. ...item,
  456. leaf: !item.hasChildren
  457. }
  458. }))
  459. });
  460. },
  461. addBtn: false,
  462. menu: false,
  463. size: 'small',
  464. props: {
  465. labelText: '标题',
  466. label: 'title',
  467. value: 'value',
  468. children: 'children'
  469. }
  470. },
  471. dialogVisible: false,
  472. advantageProjectForm: {},
  473. bankOfDepositForm: {},
  474. contactsData: [],
  475. advantageProjectData: [],
  476. disabled: false,
  477. bankOfDepositData: [],
  478. tableDataCost: [],
  479. dic: [],
  480. tableData: [],
  481. customerContact: customerContact,
  482. advantageProject: advantageProject,
  483. bankOfDeposit: bankOfDeposit,
  484. basicData: {
  485. column: [
  486. {
  487. label: '系统编号',//发货通知(点击)
  488. prop: 'sysNo',
  489. disabled: true,
  490. rules: [
  491. {
  492. required: false,
  493. message: ' ',
  494. trigger: 'blur'
  495. }
  496. ]
  497. }, {
  498. label: '采购方式',
  499. prop: 'purchaseMode',
  500. rules: [
  501. {
  502. required: true,
  503. message: ' ',
  504. trigger: 'blur'
  505. }
  506. ]
  507. }, {
  508. label: '供应商',
  509. prop: 'corpId',
  510. rules: [
  511. {
  512. required: true,
  513. message: ' ',
  514. trigger: 'blur'
  515. }
  516. ]
  517. }, {
  518. label: '所属公司',
  519. prop: 'salesCompany',
  520. rules: [
  521. {
  522. required: true,
  523. message: ' ',
  524. trigger: 'blur'
  525. }
  526. ]
  527. },{
  528. label: '仓库类型',
  529. prop: 'warehouseType',//字典表
  530. rules: [
  531. {
  532. required: true,
  533. message: ' ',
  534. trigger: 'blur'
  535. }
  536. ]
  537. }, {
  538. label: '仓库名称',
  539. prop: 'storageId',
  540. rules: [
  541. {
  542. required: true,
  543. message: ' ',
  544. trigger: 'blur'
  545. }
  546. ]
  547. }, {
  548. label: '匹配订单号',
  549. prop: 'srcOrderNo',
  550. rules: [
  551. {
  552. required: true,
  553. message: ' ',
  554. trigger: 'blur'
  555. }
  556. ]
  557. },{
  558. label: '入库金额',
  559. prop: 'deliveryAmount',
  560. rules: [
  561. {
  562. required: true,
  563. message: ' ',
  564. trigger: 'blur'
  565. }
  566. ]
  567. }, {
  568. label: '采购金额',
  569. prop: 'purchaseAmount',
  570. rules: [
  571. {
  572. required: true,
  573. message: ' ',
  574. trigger: 'blur'
  575. }
  576. ]
  577. },{
  578. label: '入库数量',
  579. prop: 'totalQuantity',
  580. rules: [
  581. {
  582. required: true,
  583. message: ' ',
  584. trigger: 'blur'
  585. }
  586. ]
  587. }, {
  588. label: '费用合计',
  589. prop: 'totalCost',
  590. rules: [
  591. {
  592. required: false,
  593. message: ' ',
  594. trigger: 'blur'
  595. }
  596. ]
  597. }, {
  598. label: '入库日期',
  599. prop: 'businessDate',
  600. type: 'datetime',
  601. rules: [
  602. {
  603. required: true,
  604. message: ' ',
  605. trigger: 'blur'
  606. }
  607. ]
  608. }, {
  609. label: "入库单备注",
  610. span: 24,
  611. prop: "deliveryRemarks",
  612. mock: {
  613. type: 'county'
  614. }
  615. }
  616. ]
  617. },
  618. statusOption: [],
  619. procurementMethodOption: [],
  620. // 仓库类型
  621. warehouseType: [],
  622. // 仓库名称
  623. warehouseName: [],
  624. // 第一次进入
  625. firstComing: false,
  626. // 费用信息排序的最大值
  627. maxFeeNum: 0,
  628. maxGoodsNum: 0,
  629. }
  630. },
  631. //初始化查询
  632. created() {
  633. this.getWorkDicts("procurement_method").then(res => {
  634. this.procurementMethodOption = res.data.data
  635. })
  636. wareHouseType().then(res => {
  637. this.warehouseType = res.data.data.records
  638. this.warehouseType.forEach(item => {
  639. this.$set(item, 'label', item.cname)
  640. this.$set(item, 'value', item.id)
  641. if (item.hasChildren) {
  642. this.$set(item, 'children', [])
  643. }
  644. })
  645. let result = [], temp = {}
  646. for(let i = 0; i < this.warehouseType.length;i++) {
  647. temp[this.warehouseType[i].id] = this.warehouseType[i]
  648. }
  649. for (let j = 0;j < this.warehouseType.length;j++) {
  650. let current = this.warehouseType[j]
  651. let tempCurrentParent = temp[current.parentId]
  652. if (tempCurrentParent) {
  653. if (!tempCurrentParent["children"]) {
  654. tempCurrentParent["children"] = []
  655. }
  656. tempCurrentParent["children"].push(current)
  657. } else {
  658. result.push(current)
  659. }
  660. }
  661. this.warehouseType = result
  662. });
  663. if (this.detailData.id) {
  664. this.queryData(this.detailData.id)
  665. }else if (this.detailData.form){
  666. console.log(this.detailData.form)
  667. this.form = JSON.parse(this.detailData.form);
  668. delete this.form.createTime
  669. delete this.form.id
  670. delete this.form.sysNo
  671. this.contactsData = this.form.orderItemsList
  672. delete this.form.orderItemsList
  673. this.configuration.dicData = this.form.corpName
  674. delete this.form.corpName
  675. this.$set(this.form, 'deliveryStatus', '录入')
  676. if (this.form.belongToCorpList) {
  677. this.$set(this.form, 'salesCompany', this.form.belongToCorpId)
  678. delete this.form.belongToCorpId
  679. this.configuration.dicData = this.configuration.dicData.concat(this.form.belongToCorpList)
  680. }
  681. delete this.form.belongToCorpList
  682. this.contactsData.forEach(item => {
  683. delete item.id
  684. delete item.pid
  685. })
  686. } else if (this.detailData.copyId) {
  687. this.queryData(this.detailData.copyId, true)
  688. }
  689. },
  690. watch: {
  691. },
  692. methods: {
  693. queryData(id, isCopy = false) {
  694. detail(id).then(res => {
  695. console.log(res.data.data)
  696. this.form = res.data.data;
  697. this.contactsData = this.form.deliveryItemsList
  698. this.advantageProjectData = this.form.deliveryFeesList
  699. this.bankOfDepositData = this.form.deliveryFilesList
  700. this.configuration.dicData = this.form.corpName
  701. let feesData = []
  702. this.form.deliveryFeesList.forEach(item => {
  703. let a = {
  704. cname: item.corpName,
  705. id: item.corpId
  706. }
  707. feesData.push(a)
  708. })
  709. this.configuration.dicData = this.configuration.dicData.concat(feesData)
  710. // 去重
  711. this.removeRepeat()
  712. if (this.form.companyName) {
  713. this.configuration.dicData = this.configuration.dicData.concat(this.form.companyName)
  714. }
  715. delete this.form.deliveryItemsList
  716. delete this.form.deliveryFeesList
  717. delete this.form.deliveryFilesList
  718. delete this.form.corpName
  719. delete this.form.companyName
  720. // 获取最大值
  721. let num = []
  722. this.advantageProjectData.forEach(item => {
  723. num.push(item.sort)
  724. })
  725. if (num.length == 0) {
  726. this.maxFeeNum = 0;
  727. } else {
  728. this.maxFeeNum = num.reduce((a, b) => {
  729. return b > a? b: a;
  730. })
  731. }
  732. let goodsNum = []
  733. this.contactsData.forEach(item => {
  734. goodsNum.push(item.sort)
  735. })
  736. if (goodsNum.length == 0) {
  737. this.maxGoodsNum = 0;
  738. } else {
  739. this.maxGoodsNum = goodsNum.reduce((a, b) => {
  740. return b > a? b: a;
  741. })
  742. }
  743. if (isCopy) {
  744. delete this.form.id
  745. delete this.form.sysNo
  746. this.contactsData.forEach(item => {
  747. delete item.id
  748. delete item.pid
  749. })
  750. this.advantageProjectData.forEach(item => {
  751. delete item.id
  752. delete item.pid
  753. })
  754. this.bankOfDepositData.forEach(item => {
  755. delete item.id
  756. delete item.pid
  757. })
  758. }
  759. });
  760. },
  761. copyOrder() {
  762. this.queryData(this.form.id, true)
  763. },
  764. // 类别变换时触发
  765. warehouseTreeChange(id) {
  766. this.warehouseName = []
  767. if (this.firstComing) {
  768. if (!this.form.storageId) {
  769. this.$set(this.form, 'storageId', null)
  770. } else {
  771. this.form.storageId = null
  772. }
  773. }
  774. let data = {
  775. storageTypeId: id
  776. }
  777. selectWareHouse(data).then(res => {
  778. this.warehouseName = res.data.data.records
  779. })
  780. this.firstComing = true
  781. },
  782. //点击行可编辑
  783. handleRowClick(row, event, column) {
  784. console.log(row.$index)
  785. },
  786. //商品编辑
  787. rowCell(row, index) {
  788. console.log(row)
  789. this.$refs.crudContact.rowCell(row, index)
  790. },
  791. //费用编辑
  792. rowCellTwo(row, index) {
  793. console.log(row)
  794. this.$refs.crudProject.rowCell(row, index)
  795. },
  796. //费用新增触发
  797. costIncrease() {
  798. this.dialogCost = !this.dialogCost
  799. this.choiceData = false
  800. },
  801. //商品新增触发
  802. commoditySelection() {
  803. this.dialogVisible = !this.dialogVisible
  804. this.commodityData = false
  805. },
  806. //点击费用明细选择触发
  807. choice(row) {
  808. this.dialogCost = !this.dialogCost
  809. this.choiceData = true
  810. console.log(row)
  811. this.choiceIndex = row.$index
  812. },
  813. //点击商品明细选择触发
  814. commodityChoice(row) {
  815. this.dialogVisible = !this.dialogVisible
  816. this.commodityData = true
  817. console.log(row)
  818. this.choiceIndexT = row.$index
  819. },
  820. //导入商品触发
  821. importChoice() {
  822. if (this.tableData.length === 1) {
  823. this.contactsData[this.choiceIndexT].cname = this.tableData[0].cname
  824. this.contactsData[this.choiceIndexT].code = this.tableData[0].code
  825. this.contactsData[this.choiceIndexT].typeno = this.tableData[0].typeno
  826. this.contactsData[this.choiceIndexT].specificationAndModel = this.tableData[0].specificationAndModel
  827. this.contactsData[this.choiceIndexT].itemId = this.tableData[0].id
  828. }
  829. this.dialogVisible = !this.dialogVisible
  830. this.commodityData = false
  831. },
  832. //费用编辑导入触发
  833. choiceCost() {
  834. console.log('1111')
  835. if (this.tableDataCost.length === 1) {
  836. this.advantageProjectData[this.choiceIndex].feeName = this.tableDataCost[0].cname
  837. this.advantageProjectData[this.choiceIndex].itemId = this.tableDataCost[0].id
  838. this.advantageProjectData[this.choiceIndex].code = this.tableDataCost[0].code
  839. }
  840. this.dialogCost = !this.dialogCost
  841. this.choiceData = false
  842. },
  843. //费用导入触发
  844. importCost() {
  845. console.log('111111')
  846. // this.advantageProjectForm = this.advantageProjectForm.concat(this.tableDataCost)
  847. if (this.tableDataCost.length > 0) {
  848. for (let item in this.tableDataCost) {
  849. console.log(this.tableDataCost[item])
  850. this.tableDataCost[item].itemId = this.tableDataCost[item].id
  851. this.tableDataCost[item].feeName = this.tableDataCost[item].cname
  852. this.tableDataCost[item].sort = this.maxFeeNum + 1
  853. this.maxFeeNum++
  854. delete this.tableDataCost[item].id
  855. this.$refs.crudProject.rowCellAdd(this.tableDataCost[item]);
  856. this.$refs.crudProject.rowCell(this.tableDataCost[item], this.advantageProjectForm.length - 1)
  857. }
  858. }
  859. this.tableDataCost = []
  860. this.dialogCost = false
  861. },
  862. //确认导入触发
  863. importGoods() {
  864. // this.contactsData = this.contactsData.concat(this.tableData)
  865. if (this.tableData.length > 0) {
  866. for (let item in this.tableData) {
  867. console.log(this.tableData[item])
  868. this.tableData[item].itemId = this.tableData[item].id
  869. this.tableData[item].priceCategory = this.tableData[item].goodsTypeName
  870. delete this.tableData[item].goodsTypeName
  871. delete this.tableData[item].id
  872. delete this.tableData[item].status
  873. delete this.tableData[item].isDeleted
  874. this.$set(this.tableData[item], 'specificationAndModel', this.tableData[item].specs)
  875. this.$set(this.tableData[item], 'purchaseQuantity', 0)
  876. this.$set(this.tableData[item], 'actualQuantity', 0)
  877. this.$set(this.tableData[item], 'purchaseAmount', 0)
  878. this.$set(this.tableData[item], 'deliveryAmount', 0)
  879. this.tableData[item].sort = this.maxGoodsNum + 1
  880. this.maxGoodsNum++
  881. this.$refs.crudContact.rowCellAdd(this.tableData[item]);
  882. this.$refs.crudContact.rowCell(this.tableData[item], this.contactsData.length - 1)
  883. }
  884. }
  885. this.tableData = []
  886. this.dialogVisible = false
  887. },
  888. closeGoods() {
  889. this.treeDataGoods = [];
  890. this.treeDeptId = "";
  891. },
  892. closeFees() {
  893. this.treeDeptIdCost = "";
  894. this.treeData = [];
  895. },
  896. //选中触发
  897. selectionChange(list) {
  898. console.log(list);
  899. this.tableData = list
  900. },
  901. //费用选中触发
  902. selectionChangeCost(list) {
  903. console.log(list);
  904. this.tableDataCost = list
  905. },
  906. //导入页左商品类型查询
  907. nodeClick(data) {
  908. this.treeDeptId = data.id;
  909. this.page.currentPage = 1;
  910. this.onLoad(this.page);
  911. },
  912. //导入页左费用类型查询
  913. nodeClickCost(data) {
  914. this.treeDeptIdCost = data.id;
  915. this.pageCost.currentPage = 1;
  916. this.onLoadCost(this.pageCost);
  917. },
  918. //刷新触发
  919. refreshChange() {
  920. this.treeDeptId = '';
  921. this.page.currentPage = 1;
  922. this.onLoad(this.page);
  923. },
  924. //费用刷新触发
  925. refreshChangeCost() {
  926. this.treeDeptIdCost = '';
  927. this.pageCost.currentPage = 1;
  928. this.onLoadCost(this.pageCost);
  929. },
  930. //新增商品信息保存触发
  931. rowSave(row, done, loading) {
  932. console.log(row)
  933. console.log(this.contactsData)
  934. // this.contactsData.push(row)
  935. done()
  936. },
  937. //修改商品信息触发
  938. rowUpdate(row, index, done, loading) {
  939. done(row);
  940. },
  941. //删除商品信息触发
  942. rowDel(row, index, donerowDel) {
  943. this.$confirm("确定将选择数据删除?", {
  944. confirmButtonText: "确定",
  945. cancelButtonText: "取消",
  946. type: "warning"
  947. }).then(() => {
  948. //商品判断是否需要调用删除接口
  949. if (row.id) {
  950. corpsattn(row.id).then(res => {
  951. this.$message({
  952. type: "success",
  953. message: "操作成功!"
  954. });
  955. this.contactsData.splice(index, 1);
  956. })
  957. } else {
  958. this.$message({
  959. type: "success",
  960. message: "操作成功!"
  961. });
  962. this.contactsData.splice(index, 1);
  963. }
  964. })
  965. },
  966. //新增费用明细保存触发
  967. rowSaveProject(row, done, loading) {
  968. // this.advantageProjectData.push(row)
  969. done()
  970. },
  971. //修改费用明细触发
  972. rowUpdateProject(row, index, done, loading) {
  973. done(row);
  974. },
  975. //商品列表查询
  976. onLoad(page, params = {}) {
  977. this.loading = true;
  978. getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId).then(res => {
  979. console.log(res)
  980. const data = res.data.data;
  981. this.page.total = data.total;
  982. this.data = data.records;
  983. this.loading = false;
  984. });
  985. },
  986. //费用查询
  987. onLoadCost(page, params = {}) {
  988. this.loadingCost = true;
  989. let queryParams = Object.assign({}, params, {
  990. pageSize: page.pageSize,
  991. pageNum: page.currentPage,
  992. parentId: 0,
  993. feesTypeId: this.treeDeptIdCost
  994. })
  995. customerList(queryParams).then(res => {
  996. console.log(res)
  997. const data = res.data.data;
  998. this.pageCost.total = data.total;
  999. this.dataCost = data.records;
  1000. this.loadingCost = false;
  1001. });
  1002. },
  1003. //删除费用明细触发
  1004. rowDelProject(row, index, donerowDel) {
  1005. this.$confirm("确定将选择数据删除?", {
  1006. confirmButtonText: "确定",
  1007. cancelButtonText: "取消",
  1008. type: "warning"
  1009. }).then(() => {
  1010. //费用判断是否需要调用删除接口
  1011. if (row.id) {
  1012. corpsitem(row.id).then(res => {
  1013. this.$message({
  1014. type: "success",
  1015. message: "操作成功!"
  1016. });
  1017. this.advantageProjectData.splice(index, 1);
  1018. })
  1019. } else {
  1020. this.$message({
  1021. type: "success",
  1022. message: "操作成功!"
  1023. });
  1024. this.advantageProjectData.splice(index, 1);
  1025. }
  1026. })
  1027. },
  1028. //新增附件上传保存触发
  1029. rowSaveBankOfDeposit(row, done, loading) {
  1030. this.bankOfDepositData.push(row)
  1031. done()
  1032. },
  1033. //修改附件上传触发
  1034. rowUpdateBankOfDeposit(row, index, done, loading) {
  1035. done(row);
  1036. },
  1037. //删除附件上传触发
  1038. rowDelBankOfDeposit(row, index, donerowDel) {
  1039. this.$confirm("确定将选择数据删除?", {
  1040. confirmButtonText: "确定",
  1041. cancelButtonText: "取消",
  1042. type: "warning"
  1043. }).then(() => {
  1044. //附件判断是否需要调用删除接口
  1045. if (row.id) {
  1046. corpsbank(row.id).then(res => {
  1047. this.$message({
  1048. type: "success",
  1049. message: "操作成功!"
  1050. });
  1051. this.bankOfDepositData.splice(index, 1);
  1052. })
  1053. } else {
  1054. this.$message({
  1055. type: "success",
  1056. message: "操作成功!"
  1057. });
  1058. this.bankOfDepositData.splice(index, 1);
  1059. }
  1060. })
  1061. },
  1062. uploadAfter(res, done) {
  1063. if (res.originalName) {
  1064. this.bankOfDepositForm.fileName = this.bankOfDepositForm.fileName
  1065. ? this.bankOfDepositForm.fileName
  1066. : res.originalName;
  1067. }
  1068. done();
  1069. },
  1070. // 去重
  1071. removeRepeat() {
  1072. let obj = []
  1073. this.configuration.dicData = this.configuration.dicData.reduce((current,next) => {
  1074. obj[next.id] ? '': obj[next.id] = true && current.push(next)
  1075. return current
  1076. }, [])
  1077. },
  1078. receiveList(data){
  1079. this.configuration.dicData = this.configuration.dicData.concat(data)
  1080. this.removeRepeat()
  1081. },
  1082. //修改提交触发
  1083. editCustomer(isBack = false) {
  1084. console.log(this.form)
  1085. this.$refs["form"].validate((valid) => {
  1086. if (valid) {
  1087. //商品信息
  1088. this.form.deliveryItemsList = this.contactsData
  1089. this.form.deliveryFeesList = this.advantageProjectData
  1090. this.form.deliveryFilesList = this.bankOfDepositData
  1091. if (typeof this.form.corpsTypeId == 'object') {
  1092. this.form.corpsTypeId = this.form.corpsTypeId.join(",")
  1093. }
  1094. this.disabled = true
  1095. typeSave(this.form).then(res => {
  1096. this.$message({type: "success", message: this.form.id ? "修改成功!" : "新增成功!"});
  1097. this.disabled = false
  1098. if (isBack) {
  1099. //成功关闭此页面回到列表页
  1100. this.$emit("goBack");
  1101. } else {
  1102. this.queryData(res.data.data.id)
  1103. }
  1104. })
  1105. } else {
  1106. return false;
  1107. }
  1108. });
  1109. },
  1110. //返回列表
  1111. backToList() {
  1112. this.$confirm("是否保存当前页面?", "提示", {
  1113. confirmButtonText: "保存",
  1114. cancelButtonText: "取消",
  1115. type: "warning",
  1116. }).then(() => {
  1117. this.editCustomer(true)
  1118. }).catch(() => {
  1119. this.$emit("goBack");
  1120. })
  1121. }
  1122. }
  1123. }
  1124. </script>
  1125. <style lang="scss" scoped>
  1126. .customer-head {
  1127. position: fixed;
  1128. top: 105px;
  1129. width: 100%;
  1130. margin-left: -10px;
  1131. height: 62px;
  1132. background: #ffffff;
  1133. box-shadow: 0 4px 12px 0px rgba(232, 232, 235, 1);
  1134. z-index: 999;
  1135. /* display: flex;
  1136. justify-content: left; */
  1137. }
  1138. .customer-back {
  1139. cursor: pointer;
  1140. line-height: 62px;
  1141. font-size: 16px;
  1142. color: #323233;
  1143. font-weight: 400;
  1144. }
  1145. .back-icon {
  1146. line-height: 64px;
  1147. font-size: 20px;
  1148. margin-right: 8px;
  1149. }
  1150. .add-customer-btn {
  1151. position: fixed;
  1152. right: 36px;
  1153. top: 115px;
  1154. }
  1155. ::v-deep .el-form-item {
  1156. margin-bottom: 0;
  1157. }
  1158. .el-dialogDeep {
  1159. ::v-deep .el-dialog {
  1160. margin: 1vh auto 0 !important;
  1161. padding-bottom: 10px !important;
  1162. .el-dialog__body, .el-dialog__footer {
  1163. padding-bottom: 0 !important;
  1164. padding-top: 0 !important;
  1165. }
  1166. }
  1167. }
  1168. .print-div {
  1169. color: #000;
  1170. }
  1171. .print_table {
  1172. table {
  1173. border-right: 1px solid #000;
  1174. border-bottom: 1px solid #000;
  1175. font-size: 12px;
  1176. margin-bottom: 5px;
  1177. }
  1178. table td {
  1179. border-left: 1px solid #000;
  1180. border-top: 1px solid #000;
  1181. vertical-align: middle;
  1182. padding: 2px;
  1183. text-align: center;
  1184. }
  1185. }
  1186. .table {
  1187. border-collapse: collapse;
  1188. border-spacing: 0;
  1189. background-color: transparent;
  1190. display: table;
  1191. width: 99%;
  1192. max-width: 100%;
  1193. margin: 0 auto;
  1194. }
  1195. .table td {
  1196. text-align: left;
  1197. vertical-align: middle;
  1198. font-size: 14px;
  1199. color: #000000;
  1200. padding: 10.5px 0 10.5px 30px;
  1201. //border: 1px solid #000;
  1202. }
  1203. </style>