detailsPageEdit.vue 27 KB

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