detailsPageEdit.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931
  1. <template>
  2. <div class="borderless">
  3. <div class="customer-head">
  4. <div class="customer-back">
  5. <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
  6. @click="backToList">返回列表
  7. </el-button>
  8. </div>
  9. <el-button type="primary"
  10. class="el-button--small-yh add-customer-btn-three"
  11. :disabled="!form.id"
  12. @click.stop="confirmReceipt">
  13. {{receiptDisable ?"撤销收货":"确认收货"}}
  14. </el-button>
  15. <el-button type="success"
  16. class="el-button--small-yh add-customer-btn-two"
  17. :disabled="true"
  18. @click.stop="">复制新单
  19. </el-button>
  20. <el-button
  21. class="el-button--small-yh add-customer-btn"
  22. type="primary"
  23. :disabled="disabled || receiptDisable"
  24. @click="editCustomer"
  25. >{{ form.id ? '确认修改' : '确认新增' }}
  26. </el-button>
  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. <el-date-picker v-if="item.type === 'datetime'" style="width: 100%;" v-model="form[item.prop]" :disabled="receiptDisable" size="small" type="date" placeholder="请选择日期" value-format="yyyy-MM-dd HH:mm:ss"/>
  36. <selectComponent v-else-if="item.prop === 'corpId'" v-model="form[item.prop]" :configuration="configuration"/>
  37. <el-select v-else-if="item.prop === 'storageId'" style="width: 100%" :disabled="receiptDisable" v-model="form[item.prop]" size="small" placeholder="请选择" clearable filterable>
  38. <el-option v-for="(item,index) in storageIdDic" :key="index" :label="item.cname" :value="item.id"></el-option>
  39. </el-select>
  40. <el-input type="textarea" v-else-if="(item.prop === 'deliveryRemarks')" v-model="form[item.prop]" :disabled="receiptDisable" size="small" autocomplete="off" placeholder="请输入"></el-input>
  41. <el-input v-else v-model="form[item.prop]" size="small" :disabled="item.disabled?true:false || receiptDisable" placeholder="请输入" autocomplete="off"></el-input>
  42. </el-form-item>
  43. </el-col>
  44. </el-row>
  45. </basic-container>
  46. <containerTitle title="收货明细"></containerTitle>
  47. <basic-container style="margin-bottom: 10px">
  48. <avue-crud
  49. :option="customerContact"
  50. v-model="contactsForm"
  51. :data="contactsData"
  52. ref="crudContact"
  53. @row-save="rowSave"
  54. @row-click="handleRowClick"
  55. @row-update="rowUpdate"
  56. @saveColumn="saveColumn"
  57. @row-del="rowDel"
  58. >
  59. <template slot-scope="{row}" slot="billNo">
  60. <span v-if="row.$cellEdit" class="required_fields">*</span>
  61. <el-input
  62. v-if="row.$cellEdit"
  63. v-model="row.billNo"
  64. style="width: 90%"
  65. placeholder=" "
  66. size="small"
  67. @change="bingOut(row)"
  68. ></el-input>
  69. <span v-else>{{ row.billNo }}</span>
  70. </template>
  71. <template slot-scope="{row}" slot="contractNumber">
  72. <span v-if="row.$cellEdit" class="required_fields">*</span>
  73. <el-select
  74. v-if="row.$cellEdit"
  75. style="width:90% !important;"
  76. v-model="row.contractNumber"
  77. placeholder=" "
  78. size="small"
  79. clearable
  80. filterable
  81. >
  82. <el-option
  83. style="width:90%"
  84. v-for="(item,index) in contractDic"
  85. :key="index"
  86. :label="item.orderNo"
  87. @change="sumOrderNo()"
  88. :value="item.orderNo"
  89. ></el-option>
  90. </el-select>
  91. <span v-else>{{ row.contractNumber }}</span>
  92. </template>
  93. <template slot="priceCategory" slot-scope="{row,index}">
  94. <span v-if="row.$cellEdit" class="required_fields">*</span>
  95. <el-input
  96. v-if="row.$cellEdit"
  97. v-model="row.priceCategoryNames"
  98. size="small"
  99. placeholder="请点击右侧按钮选择"
  100. :disabled="true"
  101. style="width: 63%"
  102. ></el-input>
  103. <el-button v-if="row.$cellEdit" size="small" icon="el-icon-search" @click="choice(row)"></el-button>
  104. <span v-else>{{ row.priceCategoryNames }}</span>
  105. </template>
  106. <template slot="invoiceWeight" slot-scope="{ row }">
  107. <el-input
  108. v-if="row.$cellEdit"
  109. v-model="row.invoiceWeight"
  110. placeholder="请输入"
  111. size="small"
  112. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d\d\d\d\d).*$/, "$1.$2")'
  113. @input="totalChange(row.invoiceWeight)"
  114. ></el-input>
  115. <span v-else>{{ row.invoiceWeight }}</span>
  116. </template>
  117. <template slot="billWeight" slot-scope="{ row }">
  118. <el-input
  119. v-if="row.$cellEdit"
  120. v-model="row.billWeight"
  121. placeholder="请输入"
  122. size="small"
  123. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d\d\d\d\d).*$/, "$1.$2")'
  124. @input="totalChange(row.billWeight)"
  125. ></el-input>
  126. <span v-else>{{ row.billWeight }}</span>
  127. </template>
  128. <template slot="price" slot-scope="{ row }">
  129. <el-input
  130. v-if="row.$cellEdit"
  131. v-model="row.price"
  132. placeholder="请输入"
  133. size="small"
  134. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
  135. @input="priceChange(row)"
  136. ></el-input>
  137. <span v-else>{{ row.price }}</span>
  138. </template>
  139. <template slot="actualQuantity" slot-scope="{ row }">
  140. <span v-if="row.$cellEdit" class="required_fields">*</span>
  141. <el-input
  142. v-if="row.$cellEdit"
  143. v-model="row.actualQuantity"
  144. style="width: 93%"
  145. placeholder="请输入"
  146. size="small"
  147. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
  148. @input="quantityChange(row)"
  149. ></el-input>
  150. <span v-else>{{ row.actualQuantity }}</span>
  151. </template>
  152. <template slot-scope="{row,index}" slot="menu">
  153. <el-button
  154. type="text"
  155. size="small"
  156. :disabled="receiptDisable"
  157. @click="rowCell(row,index)"
  158. >{{ row.$cellEdit ? '保存' : '修改' }}
  159. </el-button>
  160. <el-button
  161. type="text"
  162. size="small"
  163. :disabled="receiptDisable"
  164. @click="rowDel(row,index)"
  165. >删除
  166. </el-button>
  167. </template>
  168. <template slot="menuLeft" slot-scope="{size}">
  169. <el-button type="primary"
  170. icon="el-icon-plus"
  171. size="small"
  172. :disabled="receiptDisable"
  173. @click="commoditySelection"
  174. >录入明细
  175. </el-button>
  176. </template>
  177. </avue-crud>
  178. </basic-container>
  179. <containerTitle title="附件上传"></containerTitle>
  180. <basic-container style="margin-bottom: 40px">
  181. <avue-crud
  182. :option="upLoadOption"
  183. v-model="upLoadForm"
  184. :data="upLoadData"
  185. @row-save="upLoadSave"
  186. @row-update="upLoadUpdate"
  187. @row-del="upLoadDel"
  188. ></avue-crud>
  189. </basic-container>
  190. </el-form>
  191. </div>
  192. <el-dialog
  193. title="导入商品"
  194. append-to-body
  195. class="el-dialogDeep"
  196. :visible.sync="dialogVisible"
  197. width="80%"
  198. :close-on-click-modal="false"
  199. :destroy-on-close="true"
  200. :close-on-press-escape="false">
  201. <el-row style="height: 0;">
  202. <el-col :span="5">
  203. <div>
  204. <el-scrollbar>
  205. <basic-container>
  206. <avue-tree :option="treeOption" :data="treeData" @node-click="nodeClick"/>
  207. </basic-container>
  208. </el-scrollbar>
  209. </div>
  210. </el-col>
  211. <el-col :span="19">
  212. <basic-container>
  213. <avue-crud :option="optionTwo"
  214. :table-loading="loading"
  215. :data="data"
  216. ref="crud"
  217. @refresh-change="refreshChange"
  218. @selection-change="selectionChange"
  219. :page.sync="page"
  220. @on-load="onLoad"></avue-crud>
  221. </basic-container>
  222. </el-col>
  223. </el-row>
  224. <span slot="footer" class="dialog-footer">
  225. <el-button @click="dialogVisible = false">取 消</el-button>
  226. <el-button type="primary" @click="commodityConfirm" v-if="selectKind != -1" :disabled="tableData.length !== 1">确定</el-button>
  227. </span>
  228. </el-dialog>
  229. <el-dialog
  230. title="导入采购"
  231. append-to-body
  232. class="el-dialogDeep"
  233. :visible.sync="procurementDialog"
  234. width="60%"
  235. :close-on-click-modal="false"
  236. :destroy-on-close="true"
  237. :modal-append-to-body='false'
  238. :close-on-press-escape="false"
  239. v-dialog-drag>
  240. <procurement-detail
  241. @closeFun="!procurementDialog"
  242. @importProMent="importProMent"
  243. >
  244. </procurement-detail>
  245. </el-dialog>
  246. </div>
  247. </template>
  248. <script>
  249. import customerContact from "./config/customerContact.json"
  250. import commodity from "../invoice/config/commodity.json";
  251. import {getSysNo} from "@/api/importTrade/purchase";
  252. import {getDeptLazyTree, customerList} from "@/api/basicData/basicFeesDesc";
  253. import {detailReceiptList,
  254. submitReceiptList,
  255. removeGoodsItem,
  256. getStorage,
  257. getInventory,
  258. confirmReceipt,
  259. repealReceipt
  260. } from "@/api/importTrade/receipt"
  261. import {
  262. getList
  263. } from "@/api/basicData/deliveryNotice"
  264. import upLoadOption from "../../exportTrade/purchaseContract/config/uploadList.json";
  265. import {detailListData } from "@/api/importTrade/purchase";
  266. import { contrastObj,contrastList } from "@/util/contrastData";
  267. import { getOrgOrderNo } from "@/api/importTrade/salesContract"
  268. import procurementDetail from "@/components/procurement/purchase";
  269. import _ from "lodash";
  270. import importInventory from "../../salesManagement/salesContract/config/importInventory.json";
  271. export default {
  272. name: "detailsPageEdit",
  273. props: {
  274. detailData: {
  275. type: Object
  276. }
  277. },
  278. components:{
  279. procurementDetail
  280. },
  281. data() {
  282. return {
  283. form: {},
  284. disabled: false,
  285. receiptDisable:false,
  286. customerContact: {},
  287. contactsForm: {},
  288. contactsData: [],
  289. contractDic:[],
  290. selectKind:-1,
  291. configuration:{
  292. multipleChoices:false,
  293. multiple:false,
  294. disabled:false,
  295. searchShow:true,
  296. collapseTags:false,
  297. placeholder:'请点击右边按钮选择',
  298. dicData:[]
  299. },
  300. basicData: {
  301. column: [
  302. {
  303. label: '系统号',
  304. prop: 'sysNo',
  305. disabled:true,
  306. rules: [
  307. {
  308. required: false,
  309. message: ' ',
  310. trigger: 'blur'
  311. }
  312. ]
  313. }, {
  314. label: '合同号',
  315. prop: 'orderNo',
  316. rules: [
  317. {
  318. required: false,
  319. message: ' ',
  320. trigger: 'blur'
  321. }
  322. ]
  323. }, {
  324. label: '业务员',
  325. prop: 'saleman',
  326. dicData: [],
  327. rules: [
  328. {
  329. required: false,
  330. message: ' ',
  331. trigger: 'blur'
  332. }
  333. ]
  334. }, {
  335. label: '供应商',
  336. prop: 'corpId',
  337. dicData: [],
  338. rules: [
  339. {
  340. required: true,
  341. message: ' ',
  342. trigger: 'blur'
  343. }
  344. ]
  345. },
  346. {
  347. label: '仓库名称',
  348. type:'select',
  349. prop: 'storageId',
  350. dicData: [],
  351. rules: [
  352. {
  353. required: true,
  354. message: ' ',
  355. trigger: 'blur'
  356. }
  357. ]
  358. },{
  359. label: '收货日期',
  360. prop: 'businessDate',
  361. type:'datetime',
  362. rules: [
  363. {
  364. required: false,
  365. message: ' ',
  366. trigger: 'blur'
  367. }
  368. ]
  369. }, {
  370. label: '发票重量',
  371. prop: 'invoiceWeight',
  372. disabled: true,
  373. rules: [
  374. {
  375. required: false,
  376. message: ' ',
  377. trigger: 'blur'
  378. }
  379. ]
  380. },
  381. {
  382. label: '码单重量',
  383. prop: 'billWeight',
  384. disabled: true,
  385. rules: [
  386. {
  387. required: false,
  388. message: ' ',
  389. trigger: 'blur'
  390. }
  391. ]
  392. },
  393. {
  394. label: '备注',
  395. prop: 'deliveryRemarks',
  396. span: 24,
  397. mock: {
  398. type: 'county'
  399. }
  400. }
  401. ]
  402. },
  403. //上传文件
  404. upLoadOption: upLoadOption,
  405. upLoadData:[],
  406. storageIdDic:[],
  407. upLoadForm:{},
  408. dialogVisible: false,
  409. treeOption: {
  410. nodeKey: 'id',
  411. lazy: true,
  412. treeLoad: function (node, resolve) {
  413. const parentId = (node.level === 0) ? 0 : node.data.id;
  414. getDeptLazyTree(parentId).then(res => {
  415. resolve(res.data.data.map(item => {
  416. return {
  417. ...item,
  418. leaf: !item.hasChildren
  419. }
  420. }))
  421. });
  422. },
  423. treeDeptId: '',
  424. addBtn: false,
  425. menu: false,
  426. size: 'small',
  427. props: {
  428. labelText: '标题',
  429. label: 'title',
  430. value: 'value',
  431. children: 'children'
  432. }
  433. },
  434. optionTwo: commodity,
  435. loading: false,
  436. data: [],
  437. page: {
  438. pageSize: 10,
  439. currentPage: 1,
  440. total: 0
  441. },
  442. commodityData: false,
  443. tableData: [],
  444. //
  445. procurementDialog:false,
  446. //新旧数据对比
  447. oldForm:{},
  448. oldContactsData:[],
  449. oldUpLoadData:[],
  450. }
  451. },
  452. async created() {
  453. this.customerContact = await this.getColumnData(this.getColumnName(41), customerContact);
  454. getStorage().then(res =>{
  455. this.storageIdDic = res.data
  456. })
  457. if (this.detailData.id) {
  458. let id = this.detailData.id.replace(/\"/g, "")
  459. detailReceiptList(id).then(res => {
  460. this.form = res.data.data;
  461. this.oldForm = Object.assign({},res.data.data);
  462. this.receiptDisable = res.data.data.deliveryStatus === "已收货" ? true :false
  463. this.configuration.disabled = this.receiptDisable
  464. if(this.form.companyName){
  465. this.configuration.dicData = this.form.companyName
  466. }
  467. if(this.form.deliveryItemsList){
  468. this.contactsData = this.form.deliveryItemsList
  469. this.oldContactsData = this.deepClone(this.form.deliveryItemsList)
  470. }
  471. if(this.form.deliveryFilesList){
  472. this.upLoadData = this.form.deliveryFilesList
  473. this.oldUpLoadData = this.deepClone(this.form.deliveryFilesList)
  474. }
  475. })
  476. }
  477. if(this.detailData.params){
  478. detailListData(this.detailData.params.id).then(res =>{
  479. const orderNoList = [];
  480. res.data.data.itemsVOList.forEach((item,index) =>{
  481. this.detailData.params.orderItemIds.forEach((e,i) =>{
  482. if(e == index){
  483. item.srcId = item.id;
  484. item.contractNumber = res.data.data.orderNo;
  485. orderNoList.push(item.contractNumber)
  486. if(item.actualQuantity !== 0){ //如果收过货
  487. item.actualQuantity = _.subtract(item.purchaseQuantity, item.actualQuantity); //收货件数 = 采购件数 - 已收件数
  488. }else{
  489. item.actualQuantity = item.purchaseQuantity;
  490. }
  491. item.contractAmount = item.amount;
  492. delete item.id
  493. this.$refs.crudContact.rowCellAdd(item);
  494. this.$refs.crudContact.rowCell(item,this.contactsData.length - 1)
  495. }
  496. })
  497. })
  498. this.$set(this.form,'orderNo', Array.from(new Set(orderNoList)).join(","))
  499. this.$set(this.form,'saleman',res.data.data.salesName)
  500. this.$set(this.form,'corpId',res.data.data.corpsName[0].id)
  501. this.$set(this.configuration,'dicData', res.data.data.corpsName)
  502. })
  503. }
  504. },
  505. methods: {
  506. sumOrderNo(){
  507. //拿到所有明细合同号 去重加逗号放到主表合同号
  508. const contractNumberList = this.contactsData.map(item =>{item.contractNumber})
  509. this.$set(this.form,'orderNo', Array.from(new Set(contractNumberList)).join(","))
  510. },
  511. //合计
  512. totalChange(){
  513. let invoiceList = this.contactsData.map(item => {
  514. if(!item.invoiceWeight){
  515. item.invoiceWeight = 0
  516. }
  517. return parseFloat(item.invoiceWeight);
  518. });
  519. let billList = this.contactsData.map(item => {
  520. if(!item.billWeight){
  521. item.billWeight = 0
  522. }
  523. return parseFloat(item.billWeight);
  524. });
  525. this.form.invoiceWeight = invoiceList.reduce((n,m) => n + m)
  526. this.form.billWeight = billList.reduce((n,m) => n + m)
  527. },
  528. //提单号带出合同号
  529. bingOut(row){
  530. getOrgOrderNo(row.billNo).then(res =>{
  531. if(res.data){
  532. this.contractDic = res.data;
  533. row.contractNumber = res.data[0].orderNo;
  534. this.sumOrderNo()
  535. }
  536. }).catch(()=>{
  537. row.contractNumber = ''
  538. })
  539. },
  540. //单价
  541. priceChange(row) {
  542. if (!row.price) {
  543. row.price = "";
  544. row.contractAmount = 0
  545. } else {
  546. row.contractAmount = _.multiply(row.actualQuantity,row.price).toFixed(2);
  547. }
  548. },
  549. //件数
  550. quantityChange(row) {
  551. if (!row.actualQuantity) {
  552. row.actualQuantity = "";
  553. row.contractAmount = 0
  554. } else {
  555. row.contractAmount = _.multiply(row.actualQuantity,row.price).toFixed(2);
  556. }
  557. },
  558. //新增商品信息保存触发
  559. rowSave(row, done, loading) {
  560. // this.contactsData.push(row)
  561. done()
  562. },
  563. //点击行可编辑
  564. handleRowClick(row, event, column) {
  565. },
  566. //商品编辑
  567. rowCell(row, index) {
  568. this.$refs.crudContact.rowCell(row, index)
  569. },
  570. //修改商品信息触发
  571. rowUpdate(row, index, done, loading) {
  572. done(row);
  573. },
  574. //删除商品信息触发
  575. rowDel(row, index, donerowDel) {
  576. this.$confirm("确定将选择数据删除?", {
  577. confirmButtonText: "确定",
  578. cancelButtonText: "取消",
  579. type: "warning"
  580. }).then(() => {
  581. //商品判断是否需要调用删除接口
  582. if (row.id) {
  583. removeGoodsItem(row.id).then(res => {
  584. this.$message({
  585. type: "success",
  586. message: "操作成功!"
  587. });
  588. this.contactsData.splice(index, 1);
  589. })
  590. } else {
  591. this.$message({
  592. type: "success",
  593. message: "操作成功!"
  594. });
  595. this.contactsData.splice(index, 1);
  596. }
  597. })
  598. },
  599. //修改提交触发
  600. editCustomer(status) {
  601. this.$refs["form"].validate((valid) => {
  602. for (let i = 0; i < this.contactsData.length; i++) {
  603. if (this.contactsData[i].billNo === "") {
  604. return this.$message.error(`请输入第${i + 1}行的提单号`);
  605. }
  606. if (this.contactsData[i].contractNumber === "") {
  607. return this.$message.error(`请输入第${i + 1}行的合同号`);
  608. }
  609. if (this.contactsData[i].priceCategory === "") {
  610. return this.$message.error(`请输入第${i + 1}行的货物品种`);
  611. }
  612. if (this.contactsData[i].actualQuantity === "") {
  613. return this.$message.error(`请输入第${i + 1}行的件数`);
  614. }
  615. if (this.contactsData[i].actualQuantity == 0) {
  616. return this.$message.error(`请输入第${i + 1}行的件数`);
  617. }
  618. }
  619. if (valid) {
  620. let submitDto = {
  621. ...this.form,
  622. deliveryItemsList: this.contactsData,
  623. deliveryFilesList: this.upLoadData,
  624. };
  625. submitReceiptList(submitDto).then(res => {
  626. if(res.data.success){
  627. this.$message.success("保存成功!")
  628. detailReceiptList(res.data.data.id).then(res => {
  629. this.form = res.data.data;
  630. this.oldForm = Object.assign({},res.data.data);
  631. this.receiptDisable = res.data.data.deliveryStatus === "已收货" ? true :false
  632. this.configuration.dicData = this.form.companyName
  633. if(this.form.deliveryItemsList){
  634. this.contactsData = this.form.deliveryItemsList
  635. this.oldContactsData = this.deepClone(this.form.deliveryItemsList)
  636. }
  637. if(this.form.deliveryFilesList){
  638. this.upLoadData = this.form.deliveryFilesList
  639. this.oldUpLoadData = this.deepClone(this.form.deliveryFilesList)
  640. }
  641. })
  642. }
  643. })
  644. if(status === true){
  645. this.$emit("goBack");
  646. }
  647. } else {
  648. return false;
  649. }
  650. });
  651. },
  652. //确认收货
  653. confirmReceipt(){
  654. if(contrastObj(this.form,this.oldForm) || contrastList(this.contactsData,this.oldContactsData)
  655. || contrastList(this.upLoadData,this.oldUpLoadData)
  656. ){
  657. this.$confirm("请先保存在进行操作!", {
  658. confirmButtonText: "保存",
  659. cancelButtonText: "取消",
  660. type: "warning"
  661. }).then(()=>{
  662. this.editCustomer()
  663. })
  664. }else{
  665. if(!this.receiptDisable){
  666. this.$confirm("是否确认收货?", {
  667. confirmButtonText: "确定",
  668. cancelButtonText: "取消",
  669. type: "warning"
  670. }).then(()=>{
  671. this.form.deliveryItemsList = this.contactsData;
  672. confirmReceipt(this.form).then(res =>{
  673. if(res.data.success){
  674. this.$message.success("收货成功!")
  675. this.receiptDisable = res.data.data.deliveryStatus === "已收货" ? true :false
  676. }
  677. })
  678. })
  679. }else{
  680. this.$confirm("是否撤销收货!", {
  681. confirmButtonText: "确定",
  682. cancelButtonText: "取消",
  683. type: "warning"
  684. }).then(()=>{
  685. this.form.deliveryItemsList = this.contactsData;
  686. repealReceipt(this.form).then(res =>{
  687. if(res.data.success){
  688. this.$message.success("撤销成功!")
  689. this.receiptDisable = res.data.data.deliveryStatus === "已收货" ? true :false
  690. }
  691. })
  692. })
  693. }
  694. }
  695. },
  696. //导入采购明细
  697. importProMent(list){
  698. list.forEach(item =>{
  699. item.contractNumber = item.orderNo;
  700. item.contractAmount = item.amount;
  701. item.actualQuantity = item.purchaseQuantity;
  702. this.$refs.crudContact.rowCellAdd(item);
  703. })
  704. this.sumOrderNo();
  705. this.procurementDialog = false;
  706. },
  707. //上传文件保存
  708. upLoadSave(row, done, loading){
  709. this.upLoadData.push(row)
  710. done()
  711. },
  712. //修改附件上传触发
  713. upLoadUpdate(row, done){
  714. done(row);
  715. },
  716. //删除附件上传触发
  717. upLoadDel(row, index,){
  718. this.$confirm("确定将选择数据删除?", {
  719. confirmButtonText: "确定",
  720. cancelButtonText: "取消",
  721. type: "warning"
  722. }).then(() => {
  723. if (row.id){
  724. corpsbank(row.id).then(res=>{
  725. if(res.data.success){
  726. this.$message({
  727. type: "success",
  728. message: "操作成功!"
  729. });
  730. this.bankOfDepositData.splice(index, 1);
  731. }
  732. })
  733. }else {
  734. this.$message({
  735. type: "success",
  736. message: "操作成功!"
  737. });
  738. this.bankOfDepositData.splice(index, 1);
  739. }
  740. })
  741. },
  742. //选择货物品种
  743. choice(row){
  744. this.dialogVisible = true;
  745. this.selectKind = row.$index;
  746. },
  747. //选择货品
  748. commodityConfirm(){
  749. if(this.tableData){
  750. this.contactsData[this.selectKind].priceCategory = this.tableData[0].id;
  751. this.contactsData[this.selectKind].itemDescription = this.tableData[0].cnameDescription;
  752. this.$set(this.contactsData[this.selectKind],'priceCategoryNames',this.tableData[0].cname)
  753. this.dialogVisible = !this.dialogVisible
  754. this.selectKind = -1;
  755. }
  756. },
  757. //点击商品明细选择触发
  758. commodityChoice(row) {
  759. this.dialogVisible = !this.dialogVisible
  760. this.commodityData = true
  761. this.choiceIndexT = row.$index
  762. },
  763. //商品新增触发
  764. commoditySelection() {
  765. this.procurementDialog = true;
  766. // this.$refs.crudContact.rowCellAdd();
  767. // this.dialogVisible = !this.dialogVisible
  768. // this.commodityData = false
  769. },
  770. //导入页左商品类型查询
  771. nodeClick(data) {
  772. this.treeDeptId = data.id;
  773. this.page.currentPage = 1;
  774. this.onLoad(this.page);
  775. },
  776. //刷新触发
  777. refreshChange() {
  778. this.treeDeptId = '';
  779. this.page.currentPage = 1;
  780. this.onLoad(this.page);
  781. },
  782. //选中触发
  783. selectionChange(list) {
  784. this.tableData = list
  785. },
  786. //确认导入触发
  787. importGoods() {
  788. if (this.tableData.length > 0) {
  789. for (let item in this.tableData) {
  790. const params = {
  791. priceCategory: this.tableData[item].code,
  792. priceCategoryNames: this.tableData[item].cname,
  793. itemId: this.tableData[item].id,
  794. cname: this.tableData[item].cname
  795. }
  796. this.$refs.crudContact.rowCellAdd(params);
  797. this.$refs.crudContact.rowCell(params, this.contactsData.length - 1)
  798. }
  799. this.tableData = []
  800. this.dialogVisible = false
  801. }
  802. },
  803. //导入商品触发
  804. importChoice() {
  805. if (this.tableData.length === 1) {
  806. this.contactsData[this.choiceIndexT].cname = this.tableData[0].cname
  807. this.contactsData[this.choiceIndexT].code = this.tableData[0].code
  808. this.contactsData[this.choiceIndexT].typeno = this.tableData[0].typeno
  809. this.contactsData[this.choiceIndexT].specificationAndModel = this.tableData[0].specificationAndModel
  810. this.contactsData[this.choiceIndexT].itemId = this.tableData[0].id
  811. this.contactsData[this.choiceIndexT].priceCategory = this.tableData[0].goodsTypeName
  812. }
  813. this.dialogVisible = !this.dialogVisible
  814. this.commodityData = false
  815. },
  816. //商品列表查询
  817. onLoad(page, params = {}) {
  818. this.loading = true;
  819. getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId).then(res => {
  820. const data = res.data.data;
  821. this.page.total = data.total;
  822. this.data = data.records;
  823. this.loading = false;
  824. });
  825. },
  826. //返回列表
  827. backToList() {
  828. if(contrastObj(this.form,this.oldForm) || contrastList(this.contactsData,this.oldContactsData)
  829. || contrastList(this.upLoadData,this.oldUpLoadData)
  830. ){
  831. this.$confirm("是否保存当前页面?", "提示", {
  832. confirmButtonText: "保存",
  833. cancelButtonText: "取消",
  834. type: "warning",
  835. }).then(() => {
  836. this.editCustomer(true)
  837. }).catch(()=>{
  838. this.$emit("goBack");
  839. })
  840. }else{
  841. this.$emit("goBack");
  842. }
  843. },
  844. //列保存触发
  845. async saveColumn() {
  846. const inSave = await this.saveColumnData(
  847. this.getColumnName(41),
  848. this.customerContact
  849. );
  850. if (inSave) {
  851. this.$message.success("保存成功");
  852. //关闭窗口
  853. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  854. }
  855. },
  856. },
  857. }
  858. </script>
  859. <style lang="scss" scoped>
  860. .customer-head {
  861. position: fixed;
  862. top: 105px;
  863. width: 100%;
  864. margin-left: -10px;
  865. height: 62px;
  866. background: #ffffff;
  867. box-shadow: 0 4px 12px 0px rgba(232, 232, 235, 1);
  868. z-index: 999;
  869. /* display: flex;
  870. justify-content: left; */
  871. }
  872. .customer-back {
  873. cursor: pointer;
  874. line-height: 62px;
  875. font-size: 16px;
  876. color: #323233;
  877. font-weight: 400;
  878. }
  879. .back-icon {
  880. line-height: 64px;
  881. font-size: 20px;
  882. margin-right: 8px;
  883. }
  884. .add-customer-btn {
  885. position: fixed;
  886. right: 36px;
  887. top: 115px;
  888. }
  889. ::v-deep .el-form-item {
  890. margin-bottom: 0;
  891. }
  892. .required_fields{
  893. color: #F56C6C;
  894. display:inline-block;
  895. width: 7%
  896. }
  897. .add-customer-btn-two {
  898. position: fixed;
  899. right: 150px;
  900. top: 115px;
  901. }
  902. .add-customer-btn-three {
  903. position: fixed;
  904. right: 266px;
  905. top: 115px;
  906. }
  907. .el-dialogDeep {
  908. ::v-deep .el-dialog {
  909. margin: 1vh auto 0 !important;
  910. padding-bottom: 10px !important;
  911. .el-dialog__body, .el-dialog__footer {
  912. padding-bottom: 0 !important;
  913. padding-top: 0 !important;
  914. }
  915. }
  916. }
  917. ::v-deep .el-form-item__content{
  918. line-height: 32px;
  919. }
  920. </style>