frockList.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  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. :replace-or-not-map="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. // 表格属性
  47. tableAttributes: {
  48. // 启用勾选列
  49. selectColumn: true
  50. }, // 关闭新增弹窗
  51. // 表格事件
  52. tableEvents: {
  53. 'selection-change': this.selectionChange
  54. },
  55. recordSelected: [],
  56. content: '新增',
  57. detailId: '',
  58. module: 'add',
  59. operateVisible: false,
  60. operateType: null,
  61. operateTitle: null
  62. }
  63. },
  64. computed: {
  65. ...mapGetters(['isTradeExaminer']),
  66. optionsEvensGroup() {
  67. return [
  68. [
  69. [
  70. {
  71. name: '添加记录',
  72. click: this.addOn(() => {
  73. this.visible = true
  74. })
  75. }
  76. ]
  77. ],
  78. ...(() => {
  79. console.log(this.isTradeExaminer, 9999)
  80. return this.isTradeExaminer
  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; index++) {
  92. if (!(this.recordSelected[index].orderStatus == '登录成功' && this.recordSelected[index].status == '跟进中')) {
  93. this.$message.error('请选择审核通过并且跟进中的数据')
  94. return
  95. }
  96. }
  97. this.operateType = 'update'
  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; index++) {
  114. if (this.recordSelected[index].orderStatus !== '登录成功') {
  115. this.$message.error('请选择审核通过的数据')
  116. return
  117. }
  118. }
  119. this.operateType = 'replace'
  120. this.operateTitle = '替换业务员'
  121. this.operateVisible = true
  122. }
  123. }
  124. ]
  125. ],
  126. [
  127. [
  128. {
  129. name: '删除',
  130. click: () => {
  131. if (this.recordSelected.length === 0) {
  132. this.$message.error('请选择需要删除的数据')
  133. return
  134. }
  135. for (let index = 0; index < this.recordSelected.length; index++) {
  136. if (this.recordSelected[index].orderStatus !== '登录成功') {
  137. this.$message.error('请选择审核通过的数据')
  138. return
  139. }
  140. }
  141. this.operateType = 'delete'
  142. this.operateTitle = '删除'
  143. this.operateVisible = true
  144. }
  145. }
  146. ]
  147. ]
  148. ]
  149. : []
  150. })()
  151. ]
  152. }
  153. },
  154. methods: {
  155. // 列表请求函数
  156. getList(...p) {
  157. this.recordSelected = []
  158. return getLoginFrockList(...p)
  159. },
  160. // 列表导出函数
  161. exportList: exportLoginFrock,
  162. // 表格列解析渲染数据更改
  163. columnParsing(item, defaultData) {
  164. return defaultData
  165. },
  166. // 监听勾选变化
  167. selectionChange(data) {
  168. this.recordSelected = data
  169. console.log(data)
  170. },
  171. operation() {
  172. return (h, { row, index, column }) => {
  173. return (
  174. <div class='operation-btns'>
  175. {this.isTradeExaminer && row.orderStatus === 'WAIT' ? (
  176. <el-button
  177. size='mini'
  178. type='text'
  179. onClick={() => {
  180. this.content = '审核'
  181. this.module = 'examine'
  182. this.detailId = row.id
  183. this.visible = true
  184. }}
  185. >
  186. 审核
  187. </el-button>
  188. ) : null}
  189. {
  190. <el-button
  191. size='mini'
  192. type='text'
  193. onClick={() => {
  194. this.content = '详情'
  195. this.module = 'detail'
  196. this.detailId = row.id
  197. this.visible = true
  198. }}
  199. >
  200. 详情
  201. </el-button>
  202. }
  203. {(row.orderStatus === 'SAVE' || row.orderStatus === 'RETURN')
  204. ? <el-button
  205. size='mini'
  206. type='text'
  207. onClick={() => {
  208. this.content = '编辑'
  209. this.module = 'edit'
  210. this.detailId = row.id
  211. this.visible = true
  212. }}
  213. >
  214. 编辑
  215. </el-button> : null
  216. }
  217. {row.orderStatus === 'OK' && row.status === 'ING'
  218. ? <el-button size='mini' type='text' onClick={() => {
  219. this.operateType = 'update'
  220. this.operateTitle = '更新'
  221. this.recordSelected = [row]
  222. this.operateVisible = true
  223. }}>
  224. 更新
  225. </el-button> : null
  226. }
  227. {!this.isTradeExaminer && ((row.orderStatus === 'OK' || row.orderStatus === 'FAIL') && row.status === 'ING' && !row.isApplyUpdate) ? (
  228. <el-button
  229. size='mini'
  230. type='text'
  231. onClick={() => {
  232. this.detailId = row.id
  233. this.operateType = 'apply'
  234. this.operateTitle = '申请修改'
  235. this.operateVisible = true
  236. }}
  237. >
  238. 申请修改
  239. </el-button>
  240. ) : null}
  241. {this.isTradeExaminer && ((row.orderStatus === 'OK' || row.orderStatus === 'FAIL') && row.isApplyUpdate) ? (
  242. <el-button
  243. size='mini'
  244. type='text'
  245. onClick={() => {
  246. this.detailId = row.id
  247. this.operateType = 'examine'
  248. this.operateTitle = '审核修改'
  249. this.operateVisible = true
  250. }}
  251. >
  252. 审核修改
  253. </el-button>
  254. ) : null}
  255. </div>
  256. )
  257. }
  258. },
  259. handleClose() {
  260. this.addOff(() => {
  261. this.content = '新增'
  262. this.module = 'add'
  263. this.detailId = ''
  264. this.operateVisible = false
  265. this.operateTitle = null
  266. this.operateType = null
  267. this.visible = false
  268. this.$refs.pageRef.refreshList()
  269. })()
  270. }
  271. }
  272. }
  273. </script>
  274. <style lang="scss" scoped></style>