detailsPage.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <template>
  2. <div>
  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(0)">返回列表
  7. </el-button>
  8. </div>
  9. <div class="add-customer-btn">
  10. <!-- <el-button class="el-button&#45;&#45;small-yh" style="margin-right: 10px" type="primary" size="small" v-if="!editButton"-->
  11. <!-- @click="confirmEditing">编辑-->
  12. <!-- </el-button>-->
  13. <el-button
  14. class="el-button--small-yh"
  15. type="primary"
  16. size="small"
  17. @click="editCustomer">保存数据
  18. </el-button>
  19. <el-button
  20. class="el-button--small-yh"
  21. type="primary"
  22. size="small"
  23. v-if="form.id">启用
  24. </el-button>
  25. </div>
  26. </div>
  27. <div style="margin-top: 50px">
  28. <trade-card title="基础信息">
  29. <avue-form :option="optionForm" v-model="form" ref="form"></avue-form>
  30. </trade-card>
  31. <trade-card title="明细信息">
  32. <avue-crud :option="optionContacts" v-model="formContacts" ref="formContacts" :data="form.contactsList"
  33. @row-save="rowSave"
  34. @row-update="rowUpdate"
  35. @resetColumn="resetColumnTwo('formContacts','optionContacts','optionContactsBack',266.1)"
  36. @saveColumn="saveColumnTwo('formContacts','optionContacts','optionContactsBack',266.1)">
  37. <template slot-scope="scope" slot="menuLeft">
  38. <el-button type="primary" icon="el-icon-plus" :disabled="form.financeStatus == '已付款' " size="small" @click="rowAdd()">选择订单</el-button>
  39. </template>
  40. <template slot-scope="{type,size,row,index,disabled}" slot="menu">
  41. <el-button
  42. :size="size" :disabled="disabled" :type="type"
  43. :icon="row.$cellEdit?'el-icon-plus':'el-icon-edit'"
  44. @click="$refs.formContacts.rowCell(row,index)"
  45. >{{ row.$cellEdit ? '确认' : '修改' }}
  46. </el-button>
  47. <el-button icon="el-icon-delete" :size="size" :disabled="disabled" :type="type"
  48. @click="rowDelBox(row,index)">删除
  49. </el-button>
  50. </template>
  51. </avue-crud>
  52. </trade-card>
  53. </div>
  54. <el-dialog title="导入销售" append-to-body class="el-dialogDeep" :visible.sync="billDetailDialog" width="80%"
  55. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" top="10vh" v-dialog-drag>
  56. <bill-detail :params="params" :billType="billType" :flag="1" @closeFun="closeBillDetail"
  57. @importProMent="importProMent">
  58. </bill-detail>
  59. </el-dialog>
  60. </div>
  61. </template>
  62. <script>
  63. import billDetail from "@/components/bill/selectOrderDetailList";
  64. export default {
  65. name: "detailsPage",
  66. components: {
  67. billDetail
  68. },
  69. data() {
  70. return {
  71. billDetailDialog:false,
  72. disabled: false,
  73. form: {
  74. contactsList: []
  75. },
  76. optionForm: {
  77. menuBtn: false,
  78. span: 8,
  79. column: [{
  80. label: '供应商',
  81. prop: "corpId",
  82. rules: [{
  83. required: true,
  84. message: " ",
  85. trigger: "blur"
  86. }]
  87. }, {
  88. label: '付款账户',
  89. prop: "accountId",
  90. rules: [{
  91. required: true,
  92. message: " ",
  93. trigger: "blur"
  94. }]
  95. }, {
  96. label: '金额',
  97. prop: "amount",
  98. rules: [{
  99. required: true,
  100. message: " ",
  101. trigger: "blur"
  102. }]
  103. }, {
  104. label: "经办人",
  105. prop: "handledById",
  106. type: "select",
  107. props: {
  108. label: "name",
  109. value: "id"
  110. },
  111. dicUrl: "/api/blade-user/client/gainUser",
  112. filterable: true,
  113. rules: [{
  114. required: true,
  115. message: " ",
  116. trigger: "blur"
  117. }]
  118. }, {
  119. label: '付款日期',
  120. prop: "settlementDate",
  121. }, {
  122. label: '备注',
  123. prop: "remarks",
  124. type: 'textarea',
  125. span: 24,
  126. minRows: 2
  127. }]
  128. },
  129. formContacts: {},
  130. optionContacts: {},
  131. optionContactsBack: {
  132. align: 'center',
  133. index: true,
  134. addBtnText: "录入明细",
  135. refreshBtn: false,
  136. dialogDrag: true,
  137. addBtn: false,
  138. span: 8,
  139. height: 600,
  140. addRowBtn: false,
  141. editBtn: false,
  142. delBtn: false,
  143. menuWidth: 140,
  144. dialogTop: 25,
  145. dialogWidth: "80%",
  146. column: [{
  147. label: '单据编号',
  148. prop: 'attn',
  149. cell: true
  150. }, {
  151. label: '合同号',
  152. prop: 'contractNumber',
  153. cell: true
  154. }, {
  155. label: '应付金额',
  156. prop: 'accountsAmount',
  157. cell: true
  158. }, {
  159. label: '结算金额',
  160. prop: 'settlmentAmount',
  161. cell: true
  162. }, {
  163. label: '本次金额',
  164. prop: 'thisAmount',
  165. cell: true
  166. }, {
  167. label: '备注',
  168. prop: 'remarks',
  169. cell: true
  170. }]
  171. }
  172. }
  173. },
  174. async created() {
  175. this.optionContacts = await this.getColumnData(this.getColumnName(266.1), this.optionContactsBack);
  176. },
  177. methods: {
  178. rowDelBox(row, index) {
  179. this.$confirm("确定将选择数据删除?", {
  180. confirmButtonText: "确定",
  181. cancelButtonText: "取消",
  182. type: "warning"
  183. }).then(() => {
  184. if (row.id) {
  185. // tradingBox(row.id).then(res => {
  186. // this.form.contactsList.splice(index, 1);
  187. // this.$message.success("操作成功!");
  188. // });
  189. } else {
  190. this.form.contactsList.splice(index, 1);
  191. this.$message.success("操作成功!");
  192. }
  193. }
  194. )
  195. ;
  196. },
  197. rowAdd(){
  198. if (!this.form.corpId) {
  199. this.$message.warning("请先选择客户!")
  200. return
  201. }
  202. this.params = {
  203. customerId: this.form.corpId,
  204. generateTask: '已生成',
  205. bsType: 'XS',
  206. actualPaymentStatus: '2'
  207. }
  208. this.billDetailDialog = true;
  209. },
  210. rowSave(form, done, loading) {
  211. done(form)
  212. },
  213. rowUpdate(form, index, done, loading) {
  214. done(form)
  215. },
  216. //自定义列保存
  217. async saveColumnTwo(ref, option, optionBack, code) {
  218. /**
  219. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  220. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  221. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  222. */
  223. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  224. if (inSave) {
  225. this.$message.success("保存成功");
  226. //关闭窗口
  227. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  228. }
  229. },
  230. //自定义列重置
  231. async resetColumnTwo(ref, option, optionBack, code) {
  232. this[option] = this[optionBack];
  233. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  234. if (inSave) {
  235. this.$message.success("重置成功");
  236. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  237. }
  238. },
  239. backToList(type) {
  240. this.$emit("backToList", type);
  241. }
  242. }
  243. }
  244. </script>
  245. <style lang="scss" scoped>
  246. ::v-deep .el-form-item {
  247. margin-bottom: 8px !important;
  248. }
  249. </style>