frockList.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. <template>
  2. <template-page
  3. ref="pageRef"
  4. :get-list="getList"
  5. :export-list="exportList"
  6. :pofx="true"
  7. :operation="operation()"
  8. :column-parsing="columnParsing"
  9. :operation-column-width="200"
  10. :options-evens-group="optionsEvensGroup"
  11. :table-attributes="tableAttributes"
  12. :table-events="tableEvents"
  13. :replaceOrNotMap ="false"
  14. >
  15. <Popu v-if="visible">
  16. <el-page-header slot="head" :content="content" @back="handleClose" />
  17. <FrockForm
  18. v-if="['add', 'edit','apply'].includes(module)"
  19. :detail-id="detailId"
  20. :module="module"
  21. @updateList="handleClose"
  22. />
  23. <Detail v-if="['detail'].includes(module)" :detail-id="detailId" :module="module" @updateList="handleClose" />
  24. <Examine v-if="['examine'].includes(module)" :detail-id="detailId" :module="module" @updateList="handleClose" />
  25. </Popu>
  26. <Operate v-if="operateVisible" :operate-visible="operateVisible" :operate-type="operateType" :operate-title="operateTitle" :detail-id="detailId" :record-selected="recordSelected" @close="handleClose" />
  27. </template-page>
  28. </template>
  29. <script>
  30. import TemplatePage from '@/components/template/template-page-1.vue'
  31. import import_mixin from '@/components/template/import_mixin.js'
  32. import add_callback_mixin from '@/components/template/add_callback_mixin.js'
  33. import Popu from '@/components/template/popu.vue'
  34. import FrockForm from './frockForm.vue'
  35. import Detail from './detail.vue'
  36. import Examine from './examine.vue'
  37. import Operate from '../components/operate.vue'
  38. import { getLoginFrockList, exportLoginFrock } from '@/api/frock'
  39. import { mapGetters } from 'vuex'
  40. export default {
  41. components: { TemplatePage, Popu, FrockForm, Detail, Examine, Operate },
  42. mixins: [import_mixin, add_callback_mixin],
  43. data() {
  44. return {
  45. visible: false,
  46. optionsEvensGroup: [
  47. [
  48. [
  49. {
  50. name: '添加记录',
  51. click: this.addOn(() => {
  52. this.visible = true
  53. })
  54. }
  55. ]
  56. ],
  57. ...(() => {
  58. return this.isTradeExaminer
  59. ? [
  60. [
  61. [
  62. {
  63. name: '更新',
  64. click: () => {
  65. if (this.recordSelected.length === 0) {
  66. this.$message.error('请选择需要更新的数据')
  67. return
  68. }
  69. for (let index = 0; index < this.recordSelected.length.length; index++) {
  70. if (this.recordSelected[index].orderStatus !== '登录成功') {
  71. this.$message.error('请选择审核通过的数据')
  72. return
  73. }
  74. }
  75. this.operateType = 'update'
  76. this.operateTitle = '更新'
  77. this.operateVisible = true
  78. }
  79. }
  80. ]
  81. ],
  82. [
  83. [
  84. {
  85. name: '替换业务员',
  86. click: () => {
  87. if (this.recordSelected.length === 0) {
  88. this.$message.error('请选择需要替换业务员的数据')
  89. return
  90. }
  91. for (let index = 0; index < this.recordSelected.length.length; index++) {
  92. if (this.recordSelected[index].orderStatus !== '登录成功') {
  93. this.$message.error('请选择审核通过的数据')
  94. return
  95. }
  96. }
  97. this.operateType = 'replace'
  98. this.operateTitle = '替换业务员'
  99. this.operateVisible = true
  100. }
  101. }
  102. ]
  103. ],
  104. [
  105. [
  106. {
  107. name: '删除',
  108. click: () => {
  109. if (this.recordSelected.length === 0) {
  110. this.$message.error('请选择需要删除的数据')
  111. return
  112. }
  113. for (let index = 0; index < this.recordSelected.length.length; index++) {
  114. if (this.recordSelected[index].orderStatus !== '登录成功') {
  115. this.$message.error('请选择审核通过的数据')
  116. return
  117. }
  118. }
  119. this.operateType = 'delete'
  120. this.operateTitle = '删除'
  121. this.operateVisible = true
  122. }
  123. }
  124. ]
  125. ]
  126. ]
  127. : []
  128. })()
  129. ],
  130. // 表格属性
  131. tableAttributes: {
  132. // 启用勾选列
  133. selectColumn: true
  134. }, // 关闭新增弹窗
  135. // 表格事件
  136. tableEvents: {
  137. 'selection-change': this.selectionChange
  138. },
  139. recordSelected: [],
  140. content: '新增',
  141. detailId: '',
  142. module: 'add',
  143. operateVisible: false,
  144. operateType: null,
  145. operateTitle: null
  146. }
  147. },
  148. computed: {
  149. ...mapGetters(['isTradeExaminer'])
  150. },
  151. methods: {
  152. // 列表请求函数
  153. getList(...p) {
  154. this.recordSelected = []
  155. return getLoginFrockList(...p)
  156. },
  157. // 列表导出函数
  158. exportList: exportLoginFrock,
  159. // 表格列解析渲染数据更改
  160. columnParsing(item, defaultData) {
  161. return defaultData
  162. },
  163. // 监听勾选变化
  164. selectionChange(data) {
  165. this.recordSelected = data
  166. console.log(data)
  167. },
  168. operation() {
  169. return (h, { row, index, column }) => {
  170. return (
  171. <div class='operation-btns'>
  172. {this.isTradeExaminer && row.orderStatus === 'WAIT' ? (
  173. <el-button
  174. size='mini'
  175. type='text'
  176. onClick={() => {
  177. this.content = '审核'
  178. this.module = 'examine'
  179. this.detailId = row.id
  180. this.visible = true
  181. }}
  182. >
  183. 审核
  184. </el-button>
  185. ) : null}
  186. <el-button
  187. size='mini'
  188. type='text'
  189. onClick={() => {
  190. this.content = '详情'
  191. this.module = 'detail'
  192. this.detailId = row.id
  193. this.visible = true
  194. }}
  195. >
  196. 详情
  197. </el-button>
  198. {(row.orderStatus === 'SAVE' || row.orderStatus === 'RETURN')
  199. ? <el-button
  200. size='mini'
  201. type='text'
  202. onClick={() => {
  203. this.content = '编辑'
  204. this.module = 'edit'
  205. this.detailId = row.id
  206. this.visible = true
  207. }}
  208. >
  209. 编辑
  210. </el-button> : null
  211. }
  212. {row.orderStatus === 'OK'
  213. ? <el-button size='mini' type='text' onClick={() => {
  214. this.operateType = 'update'
  215. this.operateTitle = '更新'
  216. this.recordSelected = [row]
  217. this.operateVisible = true
  218. }}>
  219. 更新
  220. </el-button> : null
  221. }
  222. {!this.isTradeExaminer && (row.orderStatus === 'OK' || row.orderStatus === 'FAIL' && !row.isApplyUpdate) ? (
  223. <el-button
  224. size='mini'
  225. type='text'
  226. onClick={() => {
  227. this.detailId = row.id
  228. this.operateType = 'apply'
  229. this.operateTitle = '申请修改'
  230. this.operateVisible = true
  231. }}
  232. >
  233. 申请修改
  234. </el-button>
  235. ) : null}
  236. {this.isTradeExaminer && (row.orderStatus === 'OK' || row.orderStatus === 'FAIL' && row.isApplyUpdate) ? (
  237. <el-button
  238. size='mini'
  239. type='text'
  240. onClick={() => {
  241. this.detailId = row.id
  242. this.operateType = 'examine'
  243. this.operateTitle = '审核修改'
  244. this.operateVisible = true
  245. }}
  246. >
  247. 审核修改
  248. </el-button>
  249. ) : null}
  250. </div>
  251. )
  252. }
  253. },
  254. handleClose() {
  255. this.addOff(() => {
  256. this.content = '新增'
  257. this.module = 'add'
  258. this.detailId = ''
  259. this.operateVisible = false
  260. this.operateTitle = null
  261. this.operateType = null
  262. this.visible = false
  263. this.$refs.pageRef.refreshList()
  264. })()
  265. }
  266. }
  267. }
  268. </script>
  269. <style lang="scss" scoped></style>