detailsPage.vue 6.0 KB

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