index.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <template-page
  3. ref="pageRef"
  4. :get-list="getList"
  5. :table-attributes="tableAttributes"
  6. :table-events="tableEvents"
  7. :options-evens-group="optionsEvensGroup"
  8. :moreParameters="moreParameters"
  9. :column-parsing="columnParsing"
  10. :exportList="exportList"
  11. >
  12. </template-page>
  13. </template>
  14. <script>
  15. import TemplatePage from '@/components/template/template-page-1.vue'
  16. import import_mixin from '@/components/template/import_mixin.js'
  17. import ImageUpload from '@/components/file-upload'
  18. import { required, mobileRequired, mobile, httpUrl, email } from '@/components/template/rules_verify.js'
  19. import { listPageV2, pageExport } from '@/api/workOrder/appraise'
  20. export default {
  21. components: { TemplatePage, ImageUpload },
  22. mixins: [import_mixin],
  23. data() {
  24. return {
  25. // 事件组合
  26. optionsEvensGroup: [],
  27. // 表格属性
  28. tableAttributes: {
  29. // 启用勾选列
  30. selectColumn: false
  31. },
  32. // 表格事件
  33. tableEvents: {
  34. 'selection-change': this.selectionChange
  35. },
  36. // 勾选选中行
  37. recordSelected: [],
  38. /** 表单变量 */
  39. formDialogType: 0,
  40. formDialogTitles: ['新增', '编辑', '详情'],
  41. formDialog: false,
  42. appraise_status: ''
  43. }
  44. },
  45. computed: {
  46. // 更多参数
  47. moreParameters() {
  48. return []
  49. },
  50. formItems() {
  51. return []
  52. }
  53. },
  54. created() {
  55. if (this.$route.query.type == 1) {
  56. this.appraise_status = 'C'
  57. this.$nextTick(() => {
  58. this.appraise_status = ''
  59. this.$router.push({ name: 'appraise', params: {}, query: {} })
  60. })
  61. }
  62. },
  63. methods: {
  64. // 列表请求函数
  65. getList(p, cb) {
  66. try {
  67. var pam = JSON.parse(JSON.stringify(p))
  68. pam.params.push({ param: 'a.appraise_status', compare: '=', value: this.appraise_status })
  69. cb && cb(pam)
  70. return listPageV2(pam)
  71. } catch (error) {
  72. console.log(error)
  73. }
  74. },
  75. // 列表导出函数
  76. exportList: pageExport,
  77. // 表格列解析渲染数据更改
  78. columnParsing(item, defaultData) {
  79. if (item.jname === 'id') {
  80. defaultData.render = (h, { row, index, column }) => {
  81. return (
  82. <div style="padding:0 6px;cursor: pointer;" class={{ 'text-view': true, 'text-view-copy': column.isCopy }}>
  83. <span
  84. style="color:#008dd4;"
  85. onClick={() => {
  86. this.$router.push({
  87. name: window.isWorkOrderPoolPath,
  88. params: {
  89. pageName: row.id,
  90. pageType: 'detail',
  91. pageCode: row.id,
  92. pagePam: 'Evaluation'
  93. }
  94. })
  95. }}
  96. >
  97. {row.id}
  98. </span>
  99. {column.isCopy ? (
  100. <i
  101. style="color:#008dd4;"
  102. class={['el-icon-document-copy', column.columnCopyClass]}
  103. data-clipboard-text={row[column.columnAttributes.prop]}
  104. ></i>
  105. ) : null}
  106. </div>
  107. )
  108. }
  109. defaultData.columnAttributes.width = 200
  110. }
  111. if (item.jname === 'appraiseImgUrl') {
  112. defaultData.render = (h, { row, index, column }) => {
  113. return (
  114. <div style="cursor: pointer;display: flex;justify-content: center;">
  115. {row.appraiseImgUrl
  116. ? row.appraiseImgUrl
  117. .split(',')
  118. .map(url => (
  119. <el-image
  120. src={this.$showImgUrl(url)}
  121. preview-src-list={[this.$showImgUrl(url)]}
  122. fit="fit"
  123. style="width:80px;height:80px;cursor: pointer;"
  124. />
  125. ))
  126. : null}
  127. </div>
  128. )
  129. }
  130. defaultData.columnAttributes.width = 200
  131. }
  132. if (item.jname === 'appraiseContent') {
  133. defaultData.render = (h, { row, index, column }) => {
  134. return <span>{row.appraiseContent}</span>
  135. }
  136. defaultData.columnAttributes.width = 200
  137. }
  138. return defaultData
  139. },
  140. // 监听勾选变化
  141. selectionChange(data) {
  142. this.recordSelected = data
  143. }
  144. }
  145. }
  146. </script>
  147. <style lang="scss" scoped>
  148. .tab {
  149. padding: 20px 20px 0 20px;
  150. }
  151. </style>