main.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <template>
  2. <div>
  3. <trade-card title="付款信息" :show="false">
  4. <avue-crud ref="crud" :data="data" :option="tableOption" @row-del="rowDel" @saveColumn="saveColumn"
  5. @resetColumn="resetColumn" :cell-style="cellStyle" @selection-change="selectionChange">
  6. <template slot="menuLeft">
  7. <el-button type="primary" icon="el-icon-plus" size="small" @click.stop="addBut">新增
  8. </el-button>
  9. <el-button type="info" size="small" @click.stop="addJFA">作业费协议
  10. </el-button>
  11. <el-button type="primary" size="small" @click.stop="askPay">请款单
  12. </el-button>
  13. </template>
  14. </avue-crud>
  15. </trade-card>
  16. <el-dialog title="作业费协议" :visible.sync="dialogVisible" width="70%" :before-close="handleClose" append-to-body>
  17. <span>
  18. <avue-tabs :option="tabOption" @change="handleChange"></avue-tabs>
  19. <avue-crud ref="crud" :data="jfaData" :option="jfaOption" :cell-style="cellStyle"
  20. @selection-change="selectionChange2">
  21. </avue-crud>
  22. </span>
  23. <span slot="footer" class="dialog-footer">
  24. <el-button size="small" @click="dialogVisible = false">取 消</el-button>
  25. <el-button type="primary" size="small" @click="importData">导 入</el-button>
  26. </span>
  27. </el-dialog>
  28. </div>
  29. </template>
  30. <script>
  31. import tableOption from "./config/mainList.json";
  32. export default {
  33. name: "detailsPageEdit",
  34. data() {
  35. return {
  36. treeStyle: "height:" + (window.innerHeight - 315) + "px",
  37. tableOption: {},
  38. dialogVisible: false,
  39. selectionList: [],
  40. selectionList2: [],
  41. jfaData: [],
  42. jfaOption: {
  43. selection: true,
  44. tip: false,
  45. header: false,
  46. menu: false,
  47. index: true,
  48. column: [
  49. {
  50. label: '客户名称',
  51. prop: 'corpname'
  52. },
  53. {
  54. label: '费用名称',
  55. prop: 'name'
  56. },
  57. {
  58. label: '计价单位',
  59. prop: 'feeUnitid'
  60. },
  61. {
  62. label: '单价',
  63. prop: 'price'
  64. },
  65. {
  66. label: '备注',
  67. prop: 'remark'
  68. }
  69. ]
  70. },
  71. tabOption: {
  72. column: [{
  73. label: '车队作业费',
  74. prop: 'tab1',
  75. },
  76. {
  77. label: '劳务作业非',
  78. prop: 'tab2',
  79. }]
  80. }
  81. };
  82. },
  83. props: {
  84. data: {
  85. type: Array
  86. }
  87. },
  88. async created() {
  89. this.tableOption = await this.getColumnData(
  90. this.getColumnName(161.2),
  91. tableOption
  92. );
  93. },
  94. methods: {
  95. cellStyle() {
  96. return "padding:0;height:40px;";
  97. },
  98. addBut() {
  99. this.$emit('addBut')
  100. },
  101. addRow() {
  102. this.data.push({ $cellEdit: true });
  103. },
  104. addJFA() {
  105. this.dialogVisible = true
  106. },
  107. importData() {
  108. if (this.selectionList2.length) {
  109. console.log('11')
  110. } else {
  111. this.$message.error("请选择作业费协议!");
  112. }
  113. },
  114. handleClose() {
  115. },
  116. askPay() {
  117. this.$message.error("请选择需要打印的明细!");
  118. },
  119. handleChange(column) {
  120. this.type = column
  121. this.$message.success(JSON.stringify(column))
  122. },
  123. rowCell(row, index) {
  124. if (row.$cellEdit == true) {
  125. this.$set(row, "$cellEdit", false);
  126. } else {
  127. this.$set(row, "$cellEdit", true);
  128. }
  129. },
  130. rowDel(row) {
  131. this.$confirm("确定删除数据?", {
  132. confirmButtonText: "确定",
  133. cancelButtonText: "取消",
  134. type: "warning"
  135. }).then(() => {
  136. this.$message({
  137. type: "success",
  138. message: "删除成功!"
  139. });
  140. this.data.splice(row.$index, 1);
  141. });
  142. },
  143. async saveColumn() {
  144. const inSave = await this.saveColumnData(
  145. this.getColumnName(161.2),
  146. this.tableOption
  147. );
  148. if (inSave) {
  149. this.$nextTick(() => {
  150. this.$refs.crud.doLayout();
  151. });
  152. this.$message.success("保存成功");
  153. //关闭窗口
  154. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  155. }
  156. },
  157. async resetColumn() {
  158. this.tableOption = tableOption;
  159. const inSave = await this.delColumnData(
  160. this.getColumnName(161.2),
  161. tableOption
  162. );
  163. if (inSave) {
  164. this.$nextTick(() => {
  165. this.$refs.crud.doLayout();
  166. });
  167. this.$message.success("重置成功");
  168. //关闭窗口
  169. setTimeout(() => {
  170. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  171. }, 1000);
  172. }
  173. }
  174. },
  175. watch: {
  176. }
  177. };
  178. </script>
  179. <style lang="scss" scoped>
  180. </style>