detailsPage.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569
  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
  10. class="el-button--small-yh add-customer-btn"
  11. type="primary"
  12. :disabled="disabled"
  13. @click="editCustomer"
  14. >{{form.id?'确认修改':'确认新增'}}
  15. </el-button>
  16. </div>
  17. <div style="margin-top: 60px">
  18. <el-form :model="form" ref="form" label-width="130px">
  19. <containerTitle title="基础信息"></containerTitle>
  20. <basic-container style="margin-bottom: 10px">
  21. <el-row>
  22. <el-col v-for="(item, index) in basicData.column" :span="item.span?item.span:8" :key="index">
  23. <el-form-item :label="item.label" :prop="item.prop" :rules="item.rules">
  24. <el-date-picker v-if="item.type === 'datetime'" style="width: 100%;" v-model="form[item.prop]" size="small" type="datetime" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss"/>
  25. <el-select v-else-if="item.type === 'select'" style="width: 100%" size="small" placeholder="请选择" clearable filterable></el-select>
  26. <el-input type="age" v-else v-model="form[item.prop]" size="small" autocomplete="off" placeholder="请输入"></el-input>
  27. </el-form-item>
  28. </el-col>
  29. </el-row>
  30. </basic-container>
  31. <!-- 商品明细-->
  32. <containerTitle title="商品明细"></containerTitle>
  33. <basic-container style="margin-bottom: 10px">
  34. <avue-crud
  35. :option="importInventory"
  36. v-model="importInventoryForm"
  37. :data="importInventoryData"
  38. ref="importInventory"
  39. @click="openDetailed"
  40. >
  41. <template slot="menuLeft" slot-scope="{size}">
  42. <el-button type="primary"
  43. icon="el-icon-plus"
  44. size="small"
  45. >新增明细</el-button>
  46. </template>
  47. </avue-crud>
  48. </basic-container>
  49. <!-- 其他费用-->
  50. <containerTitle title="其他费用"></containerTitle>
  51. <basic-container style="margin-bottom: 40px">
  52. <avue-crud
  53. :option="advantageProject"
  54. v-model="advantageProjectForm"
  55. :data="advantageProjectData"
  56. ref="crudProject"
  57. @row-save="rowSaveProject"
  58. @row-update="rowUpdateProject"
  59. @row-del="rowDelProject"
  60. >
  61. <template slot="code" slot-scope="{row,index}">
  62. <span style="float: left;padding-top: 2px">{{row.code}}</span><el-button type="text" size="mini" style="float: right" @click="choice(row)">选择</el-button>
  63. </template>
  64. <template slot-scope="{row,index}" slot="menu">
  65. <el-button
  66. type="text"
  67. size="small"
  68. @click="rowCellTwo(row,index)"
  69. >{{row.$cellEdit?'保存':'修改'}}</el-button>
  70. </template>
  71. <template slot="menuLeft" slot-scope="{size}">
  72. <el-button type="primary"
  73. icon="el-icon-plus"
  74. size="small"
  75. @click="costIncrease"
  76. >新增</el-button>
  77. </template>
  78. </avue-crud>
  79. </basic-container>
  80. <!-- 合同上传-->
  81. <containerTitle title="合同附件"></containerTitle>
  82. <basic-container style="margin-bottom: 40px">
  83. <avue-crud
  84. :option="uploadList"
  85. v-model="bankOfDepositForm"
  86. :data="bankOfDepositData"
  87. @row-save="rowSaveBankOfDeposit"
  88. @row-update="rowUpdateBankOfDeposit"
  89. @row-del="rowDelBankOfDeposit"
  90. ></avue-crud>
  91. </basic-container>
  92. </el-form>
  93. </div>
  94. <!-- 导入库存-->
  95. <el-dialog
  96. title="导入库存"
  97. append-to-body
  98. :visible.sync="dialogStock"
  99. width="80%"
  100. :close-on-click-modal="false"
  101. :destroy-on-close="true"
  102. :close-on-press-escape="false"
  103. ></el-dialog>
  104. <!-- 导入其他费用-->
  105. <el-dialog
  106. title="导入费用"
  107. append-to-body
  108. class="el-dialogDeep"
  109. :visible.sync="dialogCost"
  110. width="80%"
  111. :close-on-click-modal="false"
  112. :destroy-on-close="true"
  113. :close-on-press-escape="false">
  114. <el-row style="height: 0;">
  115. <el-col :span="5">
  116. <div>
  117. <el-scrollbar>
  118. <basic-container>
  119. <avue-tree :option="treeOptionCost" :data="treeData" @node-click="nodeClickCost"/>
  120. </basic-container>
  121. </el-scrollbar>
  122. </div>
  123. </el-col>
  124. <el-col :span="19">
  125. <basic-container>
  126. <avue-crud :option="optionTwoCost"
  127. :table-loading="loadingCost"
  128. :data="dataCost"
  129. ref="crud"
  130. @refresh-change="refreshChangeCost"
  131. @selection-change="selectionChangeCost"
  132. :page.sync="pageCost"
  133. @on-load="onLoadCost">
  134. </avue-crud>
  135. </basic-container>
  136. </el-col>
  137. </el-row>
  138. <span slot="footer" class="dialog-footer">
  139. <el-button @click="dialogCost = false">取 消</el-button>
  140. <el-button type="primary" @click="importCost" v-if="choiceData !== true">导入</el-button>
  141. <el-button type="primary" @click="choiceCost" v-if="choiceData === true" :disabled="tableDataCost.length !== 1">导入</el-button>
  142. </span>
  143. </el-dialog>
  144. </div>
  145. </template>
  146. <script>
  147. import importInventory from './config/importInventory.json';
  148. import uploadList from './config/uploadList.json';
  149. import advantageProject from "./config/advantageProject.json";
  150. import optionTwoCost from "./config/mainListCost.json";
  151. import {getDeptLazyTree,customerList} from "@/api/basicData/basicFeesDesc";
  152. export default {
  153. name: "detailsPage",
  154. data() {
  155. return {
  156. disabled: false,
  157. form: {},
  158. // 基础信息
  159. basicData: {
  160. column: [
  161. {
  162. label: '系统编号',
  163. prop: 'orderNo',
  164. rules: [
  165. {
  166. required: false,
  167. message: ' ',
  168. trigger: 'blur'
  169. }
  170. ]
  171. }, {
  172. label: '合同号',
  173. prop: 'orderNo',
  174. type:'datetime',
  175. rules: [
  176. {
  177. required: true,
  178. message: ' ',
  179. trigger: 'blur'
  180. }
  181. ]
  182. }, {
  183. label: '合同日期',
  184. prop: 'orderNo',
  185. type:'datetime',
  186. data: [],
  187. rules: [
  188. {
  189. required: true,
  190. message: ' ',
  191. trigger: 'blur'
  192. }
  193. ]
  194. }, {
  195. label: '业务员',
  196. prop: 'orderNo',
  197. type:'select',
  198. data: [],
  199. rules: [
  200. {
  201. required: true,
  202. message: ' ',
  203. trigger: 'blur'
  204. }
  205. ]
  206. }, {
  207. label: '销售公司',
  208. prop: 'orderNo',
  209. type:'select',
  210. rules: [
  211. {
  212. required: true,
  213. message: ' ',
  214. trigger: 'blur'
  215. }
  216. ]
  217. }, {
  218. label: '工厂/贸易商名称',
  219. prop: 'orderNo',
  220. type:'select',
  221. rules: [
  222. {
  223. required: true,
  224. message: ' ',
  225. trigger: 'blur'
  226. }
  227. ]
  228. }, {
  229. label: '提成标准',
  230. prop: 'orderNo',
  231. data: [],
  232. rules: [
  233. {
  234. required: true,
  235. message: ' ',
  236. trigger: 'blur'
  237. }
  238. ]
  239. }, {
  240. label: '销售单价',
  241. prop: 'orderNo',
  242. data: [],
  243. rules: [
  244. {
  245. required: true,
  246. message: ' ',
  247. trigger: 'blur'
  248. }
  249. ]
  250. }, {
  251. label: '发票重量',
  252. prop: 'orderNo',
  253. data: [],
  254. rules: [
  255. {
  256. required: true,
  257. message: ' ',
  258. trigger: 'blur'
  259. }
  260. ]
  261. }, {
  262. label: '码单重量',
  263. prop: 'orderNo',
  264. rules: [
  265. {
  266. required: true,
  267. message: ' ',
  268. trigger: 'blur'
  269. }
  270. ]
  271. }, {
  272. label: '币别',
  273. prop: 'orderNo',
  274. rules: [
  275. {
  276. required: true,
  277. message: ' ',
  278. trigger: 'blur'
  279. }
  280. ]
  281. }, {
  282. label: '汇率',
  283. prop: 'orderNo',
  284. rules: [
  285. {
  286. required: true,
  287. message: ' ',
  288. trigger: 'blur'
  289. }
  290. ]
  291. }, {
  292. label: '预收金额',
  293. prop: 'orderNo',
  294. rules: [
  295. {
  296. required: true,
  297. message: ' ',
  298. trigger: 'blur'
  299. }
  300. ]
  301. }, {
  302. label: '合同金额',
  303. prop: 'orderNo',
  304. rules: [
  305. {
  306. required: true,
  307. message: ' ',
  308. trigger: 'blur'
  309. }
  310. ]
  311. }, {
  312. label: '收款金额',
  313. prop: 'orderNo',
  314. rules: [
  315. {
  316. required: true,
  317. message: ' ',
  318. trigger: 'blur'
  319. }
  320. ]
  321. }, {
  322. label: "备注",
  323. span: 24,
  324. prop: "orderRemark",
  325. mock: {
  326. type: 'county'
  327. }
  328. }
  329. ],
  330. },
  331. // 导入库存配置
  332. importInventory: importInventory,
  333. importInventoryForm: {},
  334. importInventoryData: [],
  335. dialogStock: false,
  336. // 其他费用
  337. advantageProject: advantageProject,
  338. advantageProjectData: [],
  339. advantageProjectForm: {},
  340. dialogCost: false,
  341. choiceData: false,
  342. treeOptionCost:{
  343. nodeKey: 'id',
  344. lazy: true,
  345. treeLoad: function (node, resolve) {
  346. const parentId = (node.level === 0) ? 0 : node.data.id;
  347. getDeptLazyTree(parentId).then(res => {
  348. resolve(res.data.data.map(item => {
  349. return {
  350. ...item,
  351. leaf: !item.hasChildren
  352. }
  353. }))
  354. });
  355. },
  356. addBtn: false,
  357. menu: false,
  358. size: 'small',
  359. props: {
  360. labelText: '标题',
  361. label: 'title',
  362. value: 'value',
  363. children: 'children'
  364. }
  365. },
  366. // 导入其他费用配置
  367. optionTwoCost: optionTwoCost,
  368. loadingCost: false,
  369. dataCost:[],
  370. pageCost:{
  371. pageSize: 10,
  372. currentPage: 1,
  373. total: 0
  374. },
  375. tableDataCost: [],
  376. treeDeptIdCost: '',
  377. choiceIndex: '',
  378. // 合同上传数据
  379. uploadList: uploadList,
  380. // 合同数据
  381. bankOfDepositData: [],
  382. bankOfDepositForm: {},
  383. }
  384. },
  385. methods: {
  386. // 导入库存新增明细
  387. openDetailed() {},
  388. //其他费用编辑
  389. rowCellTwo(row, index) {
  390. console.log(row)
  391. this.$refs.crudProject.rowCell(row, index)
  392. },
  393. //其他费用新增触发
  394. costIncrease(){
  395. this.dialogCost = !this.dialogCost
  396. this.choiceData = false
  397. },
  398. //费用查询
  399. onLoadCost(page, params = {}) {
  400. this.loadingCost = true;
  401. let queryParams = Object.assign({}, params, {pageSize: page.pageSize, pageNum: page.currentPage,parentId:0,feesTypeId:this.treeDeptIdCost})
  402. customerList(queryParams).then(res => {
  403. console.log(res)
  404. const data = res.data.data;
  405. this.pageCost.total = data.total;
  406. this.dataCost = data.records;
  407. this.loadingCost = false;
  408. });
  409. },
  410. //点击费用明细选择触发
  411. choice(row){
  412. this.dialogCost = !this.dialogCost
  413. this.choiceData = true
  414. this.choiceIndex = row.$index
  415. },
  416. nodeClickCost(data){
  417. this.treeDeptIdCost = data.id;
  418. this.pageCost.currentPage = 1;
  419. this.onLoadCost(this.pageCost);
  420. },
  421. //费用刷新触发
  422. refreshChangeCost() {
  423. this.treeDeptIdCost = '';
  424. this.pageCost.currentPage = 1;
  425. this.onLoadCost(this.pageCost);
  426. },
  427. //费用选中触发
  428. selectionChangeCost(list){
  429. this.tableDataCost = list
  430. },
  431. //费用导入触发
  432. importCost(){
  433. // this.advantageProjectForm = this.advantageProjectForm.concat(this.tableDataCost)
  434. if (this.tableDataCost.length>0){
  435. for(let item in this.tableDataCost){
  436. console.log(this.tableDataCost[item])
  437. this.tableDataCost[item].itemId = this.tableDataCost[item].id
  438. this.tableDataCost[item].feeName = this.tableDataCost[item].cname
  439. delete this.tableDataCost[item].id
  440. this.$refs.crudProject.rowCellAdd(this.tableDataCost[item]);
  441. this.$refs.crudProject.rowCell(this.tableDataCost[item], this.advantageProjectForm.length-1)
  442. }
  443. }
  444. this.tableDataCost = []
  445. this.dialogCost = false
  446. },
  447. //费用编辑导入触发
  448. choiceCost(){
  449. if (this.tableDataCost.length === 1){
  450. this.advantageProjectData[this.choiceIndex].feeName = this.tableDataCost[0].cname
  451. this.advantageProjectData[this.choiceIndex].itemId = this.tableDataCost[0].id
  452. this.advantageProjectData[this.choiceIndex].code = this.tableDataCost[0].code
  453. }
  454. this.dialogCost = !this.dialogCost
  455. this.choiceData = false
  456. },
  457. //新增附件上传保存触发
  458. rowSaveBankOfDeposit(row, done, loading){
  459. this.bankOfDepositData.push(row)
  460. done()
  461. },
  462. //修改附件上传触发
  463. rowUpdateBankOfDeposit(row, index, done, loading) {
  464. done(row);
  465. },
  466. //删除附件上传触发
  467. rowDelBankOfDeposit(row, index, donerowDel) {
  468. this.$confirm("确定将选择数据删除?", {
  469. confirmButtonText: "确定",
  470. cancelButtonText: "取消",
  471. type: "warning"
  472. }).then(() => {
  473. if (row.id){
  474. corpsbank(row.id).then(res=>{
  475. this.$message({
  476. type: "success",
  477. message: "操作成功!"
  478. });
  479. this.bankOfDepositData.splice(index, 1);
  480. })
  481. }else {
  482. this.$message({
  483. type: "success",
  484. message: "操作成功!"
  485. });
  486. this.bankOfDepositData.splice(index, 1);
  487. }
  488. })
  489. },
  490. //新增明细保存触发
  491. rowSaveProject(row, done, loading){
  492. // this.advantageProjectData.push(row)
  493. done()
  494. },
  495. //修改明细触发
  496. rowUpdateProject(row, index, done, loading) {
  497. done(row);
  498. },
  499. //删除明细触发
  500. rowDelProject(row, index, donerowDel) {
  501. this.$confirm("确定将选择数据删除?", {
  502. confirmButtonText: "确定",
  503. cancelButtonText: "取消",
  504. type: "warning"
  505. }).then(() => {
  506. if (row.id){
  507. // corpsitem(row.id).then(res=>{
  508. // this.$message({
  509. // type: "success",
  510. // message: "操作成功!"
  511. // });
  512. // this.detailedData.splice(index, 1);
  513. // })
  514. }else {
  515. this.$message({
  516. type: "success",
  517. message: "操作成功!"
  518. });
  519. this.advantageProjectData.splice(index, 1);
  520. }
  521. })
  522. },
  523. backToList() {
  524. this.$router.$avueRouter.closeTag();
  525. this.$router.push({
  526. path: '/salesManagement/salesContract/index',
  527. query: {}
  528. });
  529. },
  530. },
  531. }
  532. </script>
  533. <style scoped lang="scss">
  534. .customer-head {
  535. position: fixed;
  536. top: 105px;
  537. width: 100%;
  538. margin-left: -10px;
  539. height: 62px;
  540. background: #ffffff;
  541. box-shadow: 0 4px 12px 0px rgba(232, 232, 235, 1);
  542. z-index: 999;
  543. /* display: flex;
  544. justify-content: left; */
  545. }
  546. .customer-back {
  547. cursor: pointer;
  548. line-height: 62px;
  549. font-size: 16px;
  550. color: #323233;
  551. font-weight: 400;
  552. }
  553. .add-customer-btn {
  554. position: fixed;
  555. right: 36px;
  556. top: 115px;
  557. }
  558. ::v-deep .el-form-item {
  559. margin-bottom: 0;
  560. }
  561. </style>