detailsPageEdit.vue 43 KB

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