index.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <template>
  2. <div class="business-container">
  3. <vab-query-form>
  4. <vab-query-form-top-panel>
  5. <el-form ref="queryForm" :inline="true" :model="queryForm" @submit.native.prevent>
  6. <el-form-item prop="nboName">
  7. <el-input v-model="queryForm.nboName" clearable placeholder="商机标题" @keyup.enter.native="queryData" />
  8. </el-form-item>
  9. <el-form-item prop="custName">
  10. <el-input
  11. v-model="queryForm.custName"
  12. clearable
  13. placeholder="客户名称"
  14. size="small"
  15. @keyup.enter.native="queryData" />
  16. </el-form-item>
  17. <el-form-item prop="nboType">
  18. <el-select v-model="queryForm.nboType" clearable placeholder="商机类别">
  19. <el-option v-for="dict in nboTypeOptions" :key="dict.key" :label="dict.value" :value="dict.key" />
  20. </el-select>
  21. </el-form-item>
  22. <el-form-item prop="saleName">
  23. <el-input
  24. v-model="queryForm.saleName"
  25. clearable
  26. placeholder="归属人员"
  27. size="small"
  28. @keyup.enter.native="queryData" />
  29. </el-form-item>
  30. <el-form-item>
  31. <el-button icon="el-icon-search" type="primary" @click="queryData">查询</el-button>
  32. <el-button icon="el-icon-refresh" type="primary" @click="resetQuery">重置</el-button>
  33. </el-form-item>
  34. </el-form>
  35. </vab-query-form-top-panel>
  36. <vab-query-form-left-panel :span="12">
  37. <el-button icon="el-icon-plus" type="primary" @click="handleEdit">新增项目</el-button>
  38. <el-button icon="el-icon-refresh" type="primary" @click="handleTransfer">转移项目</el-button>
  39. <el-button icon="el-icon-plus" type="primary" @click="handleEdit">创建任务</el-button>
  40. <el-button icon="el-icon-plus" type="primary" @click="handleEdit">创建工单</el-button>
  41. <el-button icon="el-icon-plus" type="primary" @click="handleEdit">创建合同</el-button>
  42. <!-- <el-button icon="el-icon-delete" type="danger" @click="handleDelete">删除</el-button>-->
  43. </vab-query-form-left-panel>
  44. <vab-query-form-right-panel :span="12">
  45. <table-tool :check-list.sync="checkList" :columns="columns" />
  46. </vab-query-form-right-panel>
  47. </vab-query-form>
  48. <el-table v-loading="listLoading" :data="list" :height="height" @selection-change="setSelectRows">
  49. <el-table-column align="center" show-overflow-tooltip type="selection" />
  50. <el-table-column
  51. v-for="(item, index) in finallyColumns"
  52. :key="index"
  53. align="center"
  54. :label="item.label"
  55. :prop="item.prop"
  56. show-overflow-tooltip
  57. :sortable="item.sortable"
  58. :width="item.width" />
  59. <el-table-column align="center" label="操作" width="120">
  60. <template #default="{ row }">
  61. <el-button type="text" @click="handleEdit(row)">跟进</el-button>
  62. <el-button type="text" @click="handleEdit(row)">编辑</el-button>
  63. <!-- <el-button type="text" @click="handleDelete(row)">删除</el-button>-->
  64. </template>
  65. </el-table-column>
  66. </el-table>
  67. <el-pagination
  68. background
  69. :current-page="queryForm.pageNo"
  70. :layout="layout"
  71. :page-size="queryForm.pageSize"
  72. :total="total"
  73. @current-change="handleCurrentChange"
  74. @size-change="handleSizeChange" />
  75. <edit ref="edit" @fetch-data="fetchData" />
  76. <transfer ref="transfer" @fetch-data="fetchData" />
  77. </div>
  78. </template>
  79. <script>
  80. import businessApi from '@/api/proj/business'
  81. import Edit from './components/BusinessEdit'
  82. import Transfer from './components/Transfer'
  83. import TableTool from '@/components/table/TableTool'
  84. export default {
  85. name: 'Business',
  86. components: { Edit, Transfer, TableTool },
  87. data() {
  88. return {
  89. height: this.$baseTableHeight(2),
  90. checkList: [],
  91. columns: [
  92. {
  93. label: '商机标题',
  94. width: 'auto',
  95. prop: 'nboName',
  96. sortable: true,
  97. disableCheck: true,
  98. },
  99. {
  100. label: '关联客户',
  101. width: 'auto',
  102. prop: 'custName',
  103. },
  104. {
  105. label: '审批状态',
  106. width: 'auto',
  107. prop: 'approStatus',
  108. },
  109. {
  110. label: '商机状态',
  111. width: 'auto',
  112. prop: 'nboPhase',
  113. },
  114. {
  115. label: '商机类别',
  116. width: 'auto',
  117. prop: 'nboType',
  118. },
  119. {
  120. label: '商机金额',
  121. width: 'auto',
  122. prop: 'nboBudget',
  123. },
  124. {
  125. label: '最后跟进时间',
  126. width: 'auto',
  127. prop: 'finalFollowTime',
  128. },
  129. {
  130. label: '下次跟进时间',
  131. width: 'auto',
  132. prop: 'nextFollowTime',
  133. },
  134. ],
  135. list: [],
  136. listLoading: true,
  137. layout: 'total, sizes, prev, pager, next, jumper',
  138. total: 0,
  139. selectRows: '',
  140. queryForm: {
  141. pageNo: 1,
  142. pageSize: 10,
  143. nboName: undefined,
  144. custName: undefined,
  145. nboType: undefined,
  146. saleName: undefined,
  147. },
  148. nboTypeOptions: [],
  149. }
  150. },
  151. computed: {
  152. finallyColumns() {
  153. return this.columns.filter((item) => this.checkList.includes(item.label))
  154. },
  155. },
  156. created() {
  157. this.fetchData()
  158. this.getDicts('proj-nbo-type').then((response) => {
  159. this.nboTypeOptions = response.data.values || []
  160. })
  161. },
  162. methods: {
  163. setSelectRows(val) {
  164. this.selectRows = val
  165. },
  166. handleTransfer(row) {
  167. this.$refs['transfer'].open(row)
  168. },
  169. handleEdit(row) {
  170. if (row.id) {
  171. this.$refs['edit'].showEdit(row)
  172. } else {
  173. this.$refs['edit'].showEdit()
  174. }
  175. },
  176. handleDelete(row) {
  177. if (row.id) {
  178. this.$baseConfirm('你确定要删除当前项吗', null, async () => {
  179. const { msg } = await businessApi.doDelete({ ids: [row.id] })
  180. this.$baseMessage(msg, 'success')
  181. await this.fetchData()
  182. })
  183. } else {
  184. if (this.selectRows.length > 0) {
  185. const ids = this.selectRows.map((item) => item.id)
  186. this.$baseConfirm('你确定要删除选中项吗', null, async () => {
  187. const { msg } = await businessApi.doDelete({ ids })
  188. this.$baseMessage(msg, 'success')
  189. await this.fetchData()
  190. })
  191. } else {
  192. this.$baseMessage('未选中任何行', 'error')
  193. return false
  194. }
  195. }
  196. },
  197. handleSizeChange(val) {
  198. this.queryForm.pageSize = val
  199. this.fetchData()
  200. },
  201. handleCurrentChange(val) {
  202. this.queryForm.pageNo = val
  203. this.fetchData()
  204. },
  205. queryData() {
  206. this.queryForm.pageNo = 1
  207. this.fetchData()
  208. },
  209. /** 重置按钮操作 */
  210. resetQuery() {
  211. this.resetForm('queryForm')
  212. this.fetchData()
  213. },
  214. async fetchData() {
  215. this.listLoading = true
  216. const { data } = await businessApi.getList(this.queryForm)
  217. const { list, total } = data
  218. this.list = list
  219. this.total = total
  220. this.listLoading = false
  221. },
  222. },
  223. }
  224. </script>