detailsPage.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  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: "corpid",
  51. span: 6
  52. },
  53. {
  54. label: "提单号",
  55. prop: "mblno",
  56. span: 6
  57. },
  58. {
  59. label: "单据编号",
  60. prop: "billno",
  61. span: 6
  62. },
  63. {
  64. label: "业务日期",
  65. prop: "bsdate",
  66. span: 6
  67. },
  68. {
  69. label: "车辆类型",
  70. prop: "cartype",
  71. span: 6
  72. },
  73. {
  74. label: "出口单号",
  75. prop: "emblno",
  76. span: 6
  77. },
  78. {
  79. label: "仓库",
  80. prop: "warehouseid",
  81. span: 6
  82. },
  83. {
  84. label: "仓管员",
  85. prop: "storekeeper",
  86. span: 6
  87. },
  88. {
  89. label: "计费单位",
  90. prop: "feetUnit",
  91. span: 6
  92. },
  93. {
  94. label: "作业类型",
  95. prop: "businessType",
  96. span: 6
  97. },
  98. {
  99. label: "计划件数",
  100. prop: "planqty",
  101. span: 6
  102. },
  103. {
  104. label: "计划毛重(kg)",
  105. prop: "plangrossweight",
  106. span: 6
  107. },
  108. {
  109. label: "计划净重(kg)",
  110. prop: "plannetweight",
  111. span: 6
  112. },
  113. {
  114. label: "劳务公司",
  115. prop: "labour",
  116. span: 6
  117. },
  118. {
  119. label: "车队",
  120. prop: "fleet",
  121. span: 6
  122. },
  123. {
  124. label: "车号",
  125. prop: "truckno",
  126. span: 6
  127. },
  128. {
  129. label: "司机姓名",
  130. prop: "driverName",
  131. span: 6
  132. },
  133. {
  134. label: "司机身份证",
  135. prop: "driverIdCar",
  136. span: 6
  137. },
  138. {
  139. label: "司机电话",
  140. prop: "driverTel",
  141. span: 6
  142. },
  143. {
  144. label: "打印抬头",
  145. prop: "company",
  146. span: 6
  147. },
  148. {
  149. label: "备注",
  150. prop: "remark",
  151. type: "textarea",
  152. minRows: 2,
  153. span: 12
  154. },
  155. {
  156. label: "收费指示",
  157. prop: "remarksFees",
  158. type: "textarea",
  159. minRows: 2,
  160. span: 12
  161. }
  162. ]
  163. },
  164. data: [],
  165. loading: false,
  166. subLoading: false,
  167. pageLoading: false,
  168. };
  169. },
  170. props: {
  171. detailData: {
  172. type: Object
  173. }
  174. },
  175. async created() {
  176. if (this.detailData.id) {
  177. this.getDetail(this.detailData.id);
  178. }
  179. this.tableOption = await this.getColumnData(
  180. this.getColumnName(162),
  181. tableOption
  182. );
  183. },
  184. methods: {
  185. cellStyle() {
  186. return "padding:0;height:40px;";
  187. },
  188. addRow() {
  189. this.data.push({ $cellEdit: true });
  190. },
  191. rowCell(row, index) {
  192. if (row.$cellEdit == true) {
  193. this.$set(row, "$cellEdit", false);
  194. } else {
  195. this.$set(row, "$cellEdit", true);
  196. }
  197. },
  198. rowSave(row) {
  199. this.$set(row, "$cellEdit", false);
  200. },
  201. rowDel(row) {
  202. this.$confirm("确定删除数据?", {
  203. confirmButtonText: "确定",
  204. cancelButtonText: "取消",
  205. type: "warning"
  206. }).then(() => {
  207. this.$message({
  208. type: "success",
  209. message: "删除成功!"
  210. });
  211. this.data.splice(row.$index, 1);
  212. });
  213. },
  214. getDetail(id) {
  215. this.loading = true;
  216. this.pageLoading = true;
  217. },
  218. //修改提交触发
  219. editCustomer(status) {
  220. this.$refs["form"].validate((valid, done) => {
  221. done();
  222. if (valid) {
  223. this.subLoading = true;
  224. } else {
  225. return false;
  226. }
  227. });
  228. },
  229. //返回列表
  230. backToList() {
  231. this.$emit("goBack");
  232. },
  233. openEdit() {
  234. this.detailData.status = 2;
  235. this.option = this.$options.data().option;
  236. this.$refs.crud.refreshTable();
  237. },
  238. async saveColumn() {
  239. const inSave = await this.saveColumnData(
  240. this.getColumnName(162),
  241. this.tableOption
  242. );
  243. if (inSave) {
  244. this.$nextTick(() => {
  245. this.$refs.crud.doLayout();
  246. });
  247. this.$message.success("保存成功");
  248. //关闭窗口
  249. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  250. }
  251. },
  252. async resetColumn() {
  253. this.tableOption = tableOption;
  254. const inSave = await this.delColumnData(
  255. this.getColumnName(162),
  256. tableOption
  257. );
  258. if (inSave) {
  259. this.$nextTick(() => {
  260. this.$refs.crud.doLayout();
  261. });
  262. this.$message.success("重置成功");
  263. //关闭窗口
  264. setTimeout(() => {
  265. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  266. }, 1000);
  267. }
  268. }
  269. },
  270. watch: {
  271. }
  272. };
  273. </script>
  274. <style lang="scss" scoped>
  275. .trading-form ::v-deep .el-form-item {
  276. margin-bottom: 8px !important;
  277. }
  278. ::v-deep .el-form-item__error {
  279. display: none !important;
  280. }
  281. ::v-deep .select-component {
  282. display: flex !important;
  283. }
  284. </style>