index.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <template>
  2. <div class="page">
  3. <template-page v-show="!formDialog" ref="pageRef" :get-list="getList" :table-attributes="tableAttributes" :table-events="tableEvents" :operationColumnWidth="110"
  4. :options-evens-group="optionsEvensGroup" :moreParameters="moreParameters" :column-parsing="columnParsing"
  5. :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="SUBMIT">提交</el-radio-button>
  11. <el-radio-button label="PAY_NOT_TAKE">已支付未提货</el-radio-button>
  12. <el-radio-button label="PAY_TAKE">已支付已提货</el-radio-button>
  13. <el-radio-button label="CANCEL">取消订单</el-radio-button>
  14. </el-radio-group>
  15. <br><br>
  16. </div>
  17. </template-page>
  18. <div class="detail" v-if="formDialog">
  19. <attachmentSalesOrderDetail :id="id" @back="backList" :formType="formDialogType" :title="'配件销售订单' + formDialogTitles[formDialogType]"></attachmentSalesOrderDetail>
  20. </div>
  21. </div>
  22. </template>
  23. <script>
  24. import TemplatePage from '@/components/template/template-page-1.vue'
  25. import attachmentSalesOrderDetail from '../components/attachmentSalesOrderDetail.vue'
  26. import import_mixin from '@/components/template/import_mixin.js'
  27. import ImageUpload from '@/components/file-upload'
  28. import { downloadFiles } from '@/utils/util'
  29. import { required, mobileRequired, mobile, httpUrl, email } from '@/components/template/rules_verify.js'
  30. import { listPageV2,pageExport, getDetail, add, edit, submit } from "@/api/auxiliaryFittings/auxiliarySalesOrder";
  31. export default {
  32. components: { TemplatePage, ImageUpload, attachmentSalesOrderDetail },
  33. mixins: [import_mixin],
  34. data() {
  35. return {
  36. // 事件组合
  37. optionsEvensGroup: [
  38. [
  39. [
  40. {
  41. name: '新建',
  42. click: this.addData
  43. }
  44. ]
  45. ]
  46. ],
  47. // 表格属性
  48. tableAttributes: {
  49. // 启用勾选列
  50. selectColumn: true
  51. },
  52. // 表格事件
  53. tableEvents: {
  54. 'selection-change': this.selectionChange
  55. },
  56. // 勾选选中行
  57. recordSelected: [],
  58. /** 表单变量 */
  59. formDialogType: 0,
  60. formDialogTitles: ["新增","编辑", "详情"],
  61. formDialog: false,
  62. id: '',
  63. flag: ''
  64. }
  65. },
  66. computed: {
  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. pam.params.push({ "param": "a.goods_type", "compare": "=", "value": 'P' },{'param': 'a.flag', "compare": "=", "value": this.flag})
  88. cb && cb(pam)
  89. return listPageV2(pam)
  90. } catch (error) {
  91. console.log(error)
  92. }
  93. },
  94. // 列表导出函数
  95. exportList: pageExport,
  96. // 表格列解析渲染数据更改
  97. columnParsing(item, defaultData) {
  98. if (item.jname === 'idCardImg') {
  99.         defaultData.render = (h, { row, index, column }) => {
  100.           return (
  101.             <div style="padding:0 6px;cursor: pointer;">
  102.               {row.idCardImg ? row.idCardImg.split(",").map(url => <el-image src={url} preview-src-list={[url]} fit="fit" style="width:80px;height:80px;" />) : null}
  103.             </div>
  104.           )
  105.         }
  106.       }
  107. return defaultData
  108. },
  109. // 监听勾选变化
  110. selectionChange(data) {
  111. this.recordSelected = data
  112. },
  113. // 表格操作列
  114. operation(h, { row, index, column }) {
  115. return (
  116. <div class='operation-btns'>
  117. <el-button type="text" onClick={() => {
  118. this.id = row.salesId
  119. this.formDialogType = row.flag == 'SAVE'?1:2
  120. this.openForm()
  121. }}>{row.flag == 'SAVE'?'编辑':"详情"}</el-button>
  122. {row.flag == 'PAY_NOT_TAKE'?<el-button type="text" onClick={() => {
  123. this.id = row.salesId
  124. this.formDialogType = row.flag == 'SAVE'?1:2
  125. this.openForm()
  126. }}>确认提货</el-button>:null}
  127. </div>
  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>