detailsPage.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. <template>
  2. <div class="borderless" v-loading="pageLoading">
  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. <div class="add-customer-btn">
  10. <el-button type="primary" size="small" v-if="detailData.status == 1" class="el-button--small-yh "
  11. @click.stop="openEdit">编辑
  12. </el-button>
  13. <el-button type="primary" :disabled="disabled" @click="editCustomer" :loading="subLoading"
  14. v-if="detailData.status != 1" size="small">保存数据
  15. </el-button>
  16. </div>
  17. </div>
  18. <div class="customer-main">
  19. <trade-card title="基础信息">
  20. <avue-form ref="form" class="trading-form" v-model="form" :option="option">
  21. </avue-form>
  22. </trade-card>
  23. <trade-card title="货转明细">
  24. <avue-crud ref="crud" :data="data" :option="tableOption" @row-del="rowDel" @saveColumn="saveColumn"
  25. @resetColumn="resetColumn" :cell-style="cellStyle">
  26. </avue-crud>
  27. </trade-card>
  28. <collection :data="[]" />
  29. <payment :data="[]" />
  30. </div>
  31. </div>
  32. </template>
  33. <script>
  34. import tableOption from "./config/customerContact.json";
  35. import collection from "@/components/collection/main";
  36. import payment from "@/components/payment/main";
  37. export default {
  38. name: "detailsPageEdit",
  39. data() {
  40. return {
  41. show: true,
  42. oldExchange: null,
  43. treeStyle: "height:" + (window.innerHeight - 315) + "px",
  44. switchDialog: false,
  45. form: {},
  46. disabled: false,
  47. tableOption: {},
  48. option: {
  49. menuBtn: false,
  50. labelWidth: 100,
  51. column: [
  52. {
  53. label: "提单号",
  54. prop: "mblno",
  55. span: 6
  56. },
  57. {
  58. label: "客户名称",
  59. prop: "corpid",
  60. span: 6
  61. },
  62. {
  63. label: "新客户名称",
  64. prop: "tocorpid",
  65. span: 6
  66. },
  67. {
  68. label: "货转日期",
  69. prop: "bsdate",
  70. span: 6
  71. },
  72. {
  73. label: "仓储费日期",
  74. prop: "chargedate",
  75. span: 6
  76. },
  77. {
  78. label: "仓库",
  79. prop: "warehouseid",
  80. span: 6
  81. },
  82. {
  83. label: "结算方式",
  84. prop: "stltypeid",
  85. span: 6
  86. },
  87. {
  88. label: "计费单位",
  89. prop: "feetUnit",
  90. span: 6
  91. },
  92. {
  93. label: "贸易方式",
  94. prop: "trademodeid",
  95. span: 6
  96. },
  97. {
  98. label: "业务编号",
  99. prop: "billno",
  100. span: 6
  101. },
  102. {
  103. label: "原始入库单号",
  104. prop: "originalbillno",
  105. span: 6
  106. },
  107. {
  108. label: "原始入库日期",
  109. prop: "orgStorageDate",
  110. span: 6
  111. },
  112. {
  113. label: "品牌",
  114. prop: "marks",
  115. span: 6
  116. },
  117. {
  118. label: "品名",
  119. prop: "productName",
  120. span: 6
  121. },
  122. {
  123. label: "制单人",
  124. prop: "createBy",
  125. span: 6
  126. },
  127. {
  128. label: "打印抬头",
  129. prop: "company",
  130. span: 6
  131. }
  132. ]
  133. },
  134. data: [],
  135. loading: false,
  136. subLoading: false,
  137. pageLoading: false,
  138. };
  139. },
  140. props: {
  141. detailData: {
  142. type: Object
  143. }
  144. },
  145. components: {
  146. collection,
  147. payment
  148. },
  149. async created() {
  150. if (this.detailData.id) {
  151. this.getDetail(this.detailData.id);
  152. }
  153. this.tableOption = await this.getColumnData(
  154. this.getColumnName(168),
  155. tableOption
  156. );
  157. },
  158. methods: {
  159. cellStyle() {
  160. return "padding:0;height:40px;";
  161. },
  162. addRow() {
  163. this.data.push({ $cellEdit: true });
  164. },
  165. rowCell(row, index) {
  166. if (row.$cellEdit == true) {
  167. this.$set(row, "$cellEdit", false);
  168. } else {
  169. this.$set(row, "$cellEdit", true);
  170. }
  171. },
  172. rowSave(row) {
  173. this.$set(row, "$cellEdit", false);
  174. },
  175. rowDel(row) {
  176. this.$confirm("确定删除数据?", {
  177. confirmButtonText: "确定",
  178. cancelButtonText: "取消",
  179. type: "warning"
  180. }).then(() => {
  181. this.$message({
  182. type: "success",
  183. message: "删除成功!"
  184. });
  185. this.data.splice(row.$index, 1);
  186. });
  187. },
  188. getDetail(id) {
  189. this.loading = true;
  190. this.pageLoading = true;
  191. },
  192. //修改提交触发
  193. editCustomer(status) {
  194. this.$refs["form"].validate((valid, done) => {
  195. done();
  196. if (valid) {
  197. this.subLoading = true;
  198. } else {
  199. return false;
  200. }
  201. });
  202. },
  203. //返回列表
  204. backToList() {
  205. this.$emit("goBack");
  206. },
  207. openEdit() {
  208. this.detailData.status = 2;
  209. this.option = this.$options.data().option;
  210. this.$refs.crud.refreshTable();
  211. },
  212. async saveColumn() {
  213. const inSave = await this.saveColumnData(
  214. this.getColumnName(168),
  215. this.tableOption
  216. );
  217. if (inSave) {
  218. this.$nextTick(() => {
  219. this.$refs.crud.doLayout();
  220. });
  221. this.$message.success("保存成功");
  222. //关闭窗口
  223. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  224. }
  225. },
  226. async resetColumn() {
  227. this.tableOption = tableOption;
  228. const inSave = await this.delColumnData(
  229. this.getColumnName(168),
  230. tableOption
  231. );
  232. if (inSave) {
  233. this.$nextTick(() => {
  234. this.$refs.crud.doLayout();
  235. });
  236. this.$message.success("重置成功");
  237. //关闭窗口
  238. setTimeout(() => {
  239. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  240. }, 1000);
  241. }
  242. }
  243. },
  244. watch: {
  245. }
  246. };
  247. </script>
  248. <style lang="scss" scoped>
  249. .trading-form ::v-deep .el-form-item {
  250. margin-bottom: 8px !important;
  251. }
  252. ::v-deep .el-form-item__error {
  253. display: none !important;
  254. }
  255. ::v-deep .select-component {
  256. display: flex !important;
  257. }
  258. </style>