index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <template>
  2. <div class="page">
  3. <template-page v-show="!formDialog" ref="pageRef" :get-list="getList" :table-attributes="tableAttributes"
  4. :table-events="tableEvents" :options-evens-group="optionsEvensGroup" :moreParameters="moreParameters"
  5. :column-parsing="columnParsing" :operation="operation()" :exportList="exportList">
  6. <div slot="moreSearch">
  7. <el-radio-group v-model="flag" size="mini" @change="changeType">
  8. <el-radio-button label="">全部</el-radio-button>
  9. <el-radio-button label="SAVE">已保存</el-radio-button>
  10. <el-radio-button label="OK">已审核</el-radio-button>
  11. </el-radio-group>
  12. <br><br>
  13. </div>
  14. </template-page>
  15. <div class="detail" v-if="formDialog">
  16. <auxiliaryAdjustPriceOrderDetail :id="id" @back="backList" :formType="formDialogType"
  17. :title="'辅材调价单' + formDialogTitles[formDialogType]"></auxiliaryAdjustPriceOrderDetail>
  18. </div>
  19. </div>
  20. </template>
  21. <script>
  22. import TemplatePage from '@/components/template/template-page-1.vue'
  23. import auxiliaryAdjustPriceOrderDetail from '../components/auxiliaryAdjustPriceOrderDetail.vue'
  24. import import_mixin from '@/components/template/import_mixin.js'
  25. import ImageUpload from '@/components/file-upload'
  26. import { downloadFiles } from '@/utils/util'
  27. import { required, mobileRequired, mobile, httpUrl, email } from '@/components/template/rules_verify.js'
  28. import { listPageV2, pageExport } from "@/api/auxiliaryFittings/auxiliaryAdjustPriceOrder";
  29. import operation_mixin from '@/components/template/operation_mixin.js'
  30. export default {
  31. components: { TemplatePage, ImageUpload, auxiliaryAdjustPriceOrderDetail },
  32. mixins: [import_mixin, operation_mixin],
  33. data() {
  34. return {
  35. // 表格属性
  36. tableAttributes: {
  37. // 启用勾选列
  38. selectColumn: true
  39. },
  40. // 表格事件
  41. tableEvents: {
  42. 'selection-change': this.selectionChange
  43. },
  44. // 勾选选中行
  45. recordSelected: [],
  46. /** 表单变量 */
  47. formDialogType: 0,
  48. formDialogTitles: ["新增", "编辑", "详情"],
  49. formDialog: false,
  50. id: '',
  51. flag: ''
  52. }
  53. },
  54. computed: {
  55. // 事件组合
  56. optionsEvensGroup() {
  57. return [
  58. [
  59. [
  60. this.optionsEvensAuth("add", {
  61. click: this.addData
  62. }),
  63. ]
  64. ]
  65. ]
  66. },
  67. // 更多参数
  68. moreParameters() {
  69. return []
  70. },
  71. formItems() { }
  72. },
  73. methods: {
  74. // 切换状态
  75. changeType(val) {
  76. this.$refs.pageRef.refreshList()
  77. },
  78. backList() {
  79. this.id = ''
  80. this.formDialog = false;
  81. this.$refs.pageRef.refreshList()
  82. },
  83. // 列表请求函数
  84. getList(p, cb) {
  85. try {
  86. var pam = JSON.parse(JSON.stringify(p))
  87. if (this.flag) {
  88. pam.params.push({ "param": "a.flag", "compare": "=", "value": this.flag })
  89. }
  90. cb && cb(pam)
  91. return listPageV2(pam)
  92. } catch (error) {
  93. console.log(error)
  94. }
  95. },
  96. // 列表导出函数
  97. exportList: pageExport,
  98. // 表格列解析渲染数据更改
  99. columnParsing(item, defaultData) {
  100. return defaultData
  101. },
  102. // 监听勾选变化
  103. selectionChange(data) {
  104. this.recordSelected = data
  105. },
  106. operation() {
  107. return this.operationBtn({
  108. edit: {
  109. conditions: ({ row, index, column }) => {
  110. return row.flag == 'SAVE'
  111. },
  112. click: ({ row, index, column }) => {
  113. this.id = row.sheetId
  114. this.formDialogType = 1
  115. this.openForm()
  116. }
  117. },
  118. detail: {
  119. conditions: ({ row, index, column }) => {
  120. return row.flag == 'OK'
  121. },
  122. click: ({ row, index, column }) => {
  123. this.id = row.sheetId
  124. this.formDialogType = 2
  125. this.openForm()
  126. }
  127. },
  128. })
  129. },
  130. addData() {
  131. this.formDialogType = 0
  132. this.openForm()
  133. },
  134. openForm() {
  135. this.formDialog = true;
  136. },
  137. // 下载导入模版
  138. handleDownload() {
  139. // downloadFiles('charging/standard/download');
  140. },
  141. }
  142. }
  143. </script>
  144. <style lang="scss" scoped>
  145. .page {
  146. height: 100%;
  147. }
  148. .tab {
  149. padding: 20px 20px 0 20px;
  150. }
  151. </style>