main.vue 5.5 KB

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