list.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  1. <template>
  2. <div class="app-container">
  3. <div class="title-container">
  4. <breadcrumb id="breadcrumb-container" class="breadcrumb-container"/>
  5. </div>
  6. <y-page-list-layout :page-list="pageData" :page-para="listQuery" :get-page-list="getList">
  7. <template slot="left">
  8. <PermissionButton
  9. menu-code="_views_market_business_add"
  10. class-name="filter-item"
  11. type="primary"
  12. name
  13. size="mini"
  14. :page-jump="true"
  15. round
  16. style="float: left"
  17. />
  18. <el-input
  19. v-model="listQuery.customerName"
  20. placeholder="客户名字"
  21. clearable
  22. style="margin-left: 20px;width: 320px;float: left;">
  23. </el-input>
  24. <el-input
  25. v-model="listQuery.opportunityName"
  26. placeholder="商机名称"
  27. clearable
  28. style="margin-left: 20px;width: 320px;float: left;">
  29. </el-input>
  30. <el-select clearable style="margin-left: 20px;width: 200px;float: left;" v-model="listQuery.state" placeholder="状态">
  31. <el-option key="0" label="跟进中" value="跟进中"/>
  32. <el-option key="1" label="签约" value="签约"/>
  33. <el-option key="2" label="终止" value="终止"/>
  34. </el-select>
  35. <el-button
  36. class="filter-item"
  37. style="margin-left: 10px;float: left;"
  38. type="primary"
  39. @click="searchList"
  40. round
  41. >搜索
  42. </el-button>
  43. <el-button
  44. class="filter-item"
  45. style="float: left;"
  46. round
  47. type="warning"
  48. @click="resetSearch()"
  49. >重置
  50. </el-button>
  51. </template>
  52. <parentTable
  53. v-loading="listLoading"
  54. :data="pageData.records"
  55. slot="table"
  56. style="width: 100%;"
  57. >
  58. <el-table-column label="客户名字" align="center" width="210">
  59. <template slot-scope="{row}">
  60. <span>{{ row.customerName }}</span>
  61. </template>
  62. </el-table-column>
  63. <el-table-column label="商机名称" align="center" width="210">
  64. <template slot-scope="{row}">
  65. <span>{{ row.opportunityName }}</span>
  66. </template>
  67. </el-table-column>
  68. <el-table-column label="预计金额" align="center" width="210">
  69. <template slot-scope="{row}">
  70. <span>{{ row.estimateAmount }}</span>
  71. </template>
  72. </el-table-column>
  73. <el-table-column label="预计开展日期" align="center" width="210">
  74. <template slot-scope="{row}">
  75. <span>{{ row.estimateDate }}</span>
  76. </template>
  77. </el-table-column>
  78. <el-table-column label="状态" align="center" width="120">
  79. <template slot-scope="{row}">
  80. <el-tag>{{ row.state }}</el-tag>
  81. </template>
  82. </el-table-column>
  83. <el-table-column label="终止原因" align="center" width="210">
  84. <template slot-scope="{row}">
  85. <span>{{ row.offReason }}</span>
  86. </template>
  87. </el-table-column>
  88. <el-table-column label="客户经理" align="center" width="210">
  89. <template slot-scope="{row}">
  90. <span>{{ row.userName }}</span>
  91. </template>
  92. </el-table-column>
  93. <el-table-column label="备注" align="center" width="210">
  94. <template slot-scope="{row}">
  95. <span>{{ row.remark }}</span>
  96. </template>
  97. </el-table-column>
  98. <el-table-column label="操作" align="center" width="210">
  99. <template slot-scope="{row}">
  100. <PermissionButton
  101. menu-code="_views_market_business_detail"
  102. class-name="filter-item"
  103. name=""
  104. type="primary"
  105. :page-jump="true"
  106. :page-query="{id: row.id}"
  107. round
  108. size="mini"
  109. />
  110. <PermissionButton
  111. menu-code="_views_market_business_state"
  112. class-name="filter-item"
  113. name=""
  114. type="danger"
  115. round
  116. size="mini"
  117. @click="handleState(row.id,row.opportunityName,row.state,row.offReason)"
  118. />
  119. </template>
  120. </el-table-column>
  121. </parentTable>
  122. </y-page-list-layout>
  123. <el-dialog
  124. width="600px"
  125. title="状态流转"
  126. :visible.sync="dialogFormVisible"
  127. :close-on-click-modal="false"
  128. >
  129. <el-form
  130. ref="dataForm"
  131. v-loading="dialogLoading"
  132. :model="temp"
  133. label-position="right"
  134. label-width="110px"
  135. style="width: 400px; margin-left:50px;"
  136. >
  137. <el-form-item label="商机名称:" prop="name">
  138. <el-input v-model="temp.opportunityName" class="filter-item" readonly disabled/>
  139. </el-form-item>
  140. <el-form-item label="流转状态:" filterable prop="departmentId">
  141. <el-select v-model="temp.state" filterable class="filter-item" style="float: left;width: 100%;" placeholder="请选择">
  142. <el-option key="0" label="跟进中" value="跟进中"/>
  143. <el-option key="1" label="签约" value="签约"/>
  144. <el-option key="2" label="终止" value="终止"/>
  145. </el-select>
  146. </el-form-item>
  147. <el-form-item label="终止原因:">
  148. <el-input v-model="temp.offReason" class="filter-item" type="text"/>
  149. </el-form-item>
  150. <el-form-item label="">
  151. <el-button @click="dialogFormVisible = false">
  152. 取消
  153. </el-button>
  154. <el-button type="primary" @click="updateState()">
  155. 保存
  156. </el-button>
  157. </el-form-item>
  158. </el-form>
  159. </el-dialog>
  160. </div>
  161. </template>
  162. <script>
  163. import YPageListLayout from '@/components/YPageListLayout'
  164. import Breadcrumb from '@/components/Breadcrumb'
  165. import PermissionButton from '@/components/PermissionButton/PermissionButton'
  166. export default {
  167. name: 'ViewsStaffList',
  168. components: {
  169. Breadcrumb,
  170. YPageListLayout,
  171. PermissionButton,
  172. },
  173. filters: {
  174. statusFilter(status) {
  175. const statusMap = {
  176. published: 'success',
  177. draft: 'info',
  178. deleted: 'danger',
  179. }
  180. return statusMap[status]
  181. },
  182. },
  183. data() {
  184. return {
  185. isDisable:false,
  186. tableKey: 0,
  187. pageData: { records: [] },
  188. total: 20,
  189. dialogLoading: false,
  190. listLoading: true,
  191. listQuery: {
  192. page: 1,
  193. size: 10,
  194. descs: 'id',
  195. },
  196. listQueryKey: 'keyword',
  197. importLoading: false,
  198. AllEnum:[],
  199. dialogFormVisible:false,
  200. temp:{
  201. state:'',
  202. offReason:''
  203. }
  204. }
  205. },
  206. created() {
  207. const that = this;
  208. that.getAllEnum();
  209. that.getList();
  210. },
  211. methods: {
  212. handleState(businessId, businessName, state, offReason) {
  213. const that = this;
  214. that.temp.id = businessId;
  215. that.temp.opportunityName = businessName;
  216. that.temp.state = state;
  217. that.temp.offReason = offReason;
  218. that.dialogFormVisible = true;
  219. },
  220. updateState(){
  221. if (this.temp.id) {
  222. this.$api.business.edit(Object.assign({}, this.temp, {
  223. })).then(res => {
  224. if (res.code === 200) {
  225. this.$notify({
  226. title: '成功',
  227. message: '状态流转成功',
  228. type: 'success',
  229. duration: 2000
  230. });
  231. this.dialogFormVisible = false;
  232. this.getList();
  233. }
  234. }).catch(() => {
  235. this.dialogFormVisible = false;
  236. })
  237. }
  238. },
  239. getAllEnum() {
  240. const that = this;
  241. that.$api.globalConfig.getAllEnum().then(data => {
  242. if (data.code === 200) {
  243. that.AllEnum = data.data
  244. } else {
  245. this.$message({
  246. type: 'error',
  247. message: data.msg
  248. })
  249. }
  250. })
  251. },
  252. resetSearch() {
  253. this.listQuery = {
  254. current: 1,
  255. size: 10,
  256. descs: 'id',
  257. }
  258. this.getList()
  259. },
  260. removeHandle(row) {
  261. // console.log(data)
  262. const that = this
  263. that
  264. .$confirm('确认删除当前记录吗?', '警告', {
  265. confirmButtonText: '确认',
  266. cancelButtonText: '取消',
  267. type: 'warning',
  268. })
  269. .then(async () => {
  270. this.$api.business.delete(row.id).then((res) => {
  271. if (res.code === 200) {
  272. this.$message({
  273. type: 'success',
  274. message: '删除成功',
  275. })
  276. this.getList()
  277. }
  278. })
  279. })
  280. .catch((err) => {
  281. console.error(err)
  282. })
  283. },
  284. searchList() {
  285. // 重置分页
  286. this.listQuery.page = 1
  287. this.listQuery.size = 10
  288. this.getList()
  289. },
  290. getList() {
  291. const that = this
  292. this.listLoading = true
  293. // console.log(that.listQuery)
  294. const key = {}
  295. key[this.listQueryKey] = this.listQuery.description
  296. this.$api.business
  297. .list(Object.assign({}, that.listQuery, key))
  298. .then((res) => {
  299. that.pageData = res.data
  300. setTimeout(() => {
  301. that.listLoading = false
  302. }, 200)
  303. })
  304. .catch(() => {
  305. that.listLoading = false
  306. })
  307. },
  308. deleteInfo(id) {
  309. const that = this
  310. that.$confirm('请确认是否删除该数据?', '提示', {
  311. confirmButtonText: '确定',
  312. cancelButtonText: '取消',
  313. type: 'warning',
  314. center: true
  315. }).then(() => {
  316. that.$api.business.delete(id).then(data => {
  317. that.loading = false
  318. if (data.code === 200) {
  319. that.getList()
  320. } else {
  321. this.$message({
  322. type: 'error',
  323. message: data.msg
  324. })
  325. }
  326. })
  327. }).catch(() => {
  328. })
  329. }
  330. },
  331. }
  332. </script>
  333. <style lang="scss" scoped>
  334. .right {
  335. flex: 1;
  336. .title {
  337. font-size: 16px;
  338. font-weight: 500;
  339. color: rgba(51, 51, 51, 1);
  340. line-height: 35px;
  341. margin-bottom: 8px;
  342. }
  343. .menu-2-box {
  344. display: flex;
  345. flex-wrap: wrap;
  346. width: 100%;
  347. }
  348. .menu-2-item {
  349. display: flex;
  350. align-items: center;
  351. color: #656565;
  352. font-size: 12px;
  353. width: 230px;
  354. height: 101px;
  355. background: rgb(255, 185, 129);
  356. border-radius: 3px;
  357. padding-left: 20px;
  358. margin-right: 10px;
  359. margin-bottom: 10px;
  360. cursor: pointer;
  361. box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.04);
  362. .text {
  363. margin-left: 16px;
  364. }
  365. }
  366. }
  367. </style>