List.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. <template>
  2. <en-table-layout
  3. :tableData="tableData.data"
  4. :loading="loading"
  5. >
  6. <div slot="toolbar" class="inner-toolbar">
  7. <div class="toolbar-btns">
  8. <el-select v-model="orderType" placeholder="请选择状态" style="width: 350px" multiple size="medium" clearable @change="filterStatus">
  9. <el-option label="默认" value="0"/>
  10. <el-option label="技术跟进" value="1"/>
  11. <el-option label="生产跟进" value="2"/>
  12. <el-option label="收到款" value="3"/>
  13. <el-option label="已发货" value="4"/>
  14. <el-option label="已完成" value="5"/>
  15. <el-option label="作废" value="6"/>
  16. </el-select>
  17. <!-- <el-button-group>-->
  18. <!-- <el-button type="primary" @click="filterStatus(-1)">全部</el-button>-->
  19. <!-- <el-button @click="filterStatus(0)">默认</el-button>-->
  20. <!-- <el-button @click="filterStatus(1)" type="warning">技术跟进</el-button>-->
  21. <!-- <el-button @click="filterStatus(2)" type="warning">生产跟进</el-button>-->
  22. <!-- <el-button @click="filterStatus(3)" type="warning">收到款</el-button>-->
  23. <!-- <el-button @click="filterStatus(4)">已发货</el-button>-->
  24. <!-- <el-button @click="filterStatus(5)" type="success">已完成</el-button>-->
  25. <!-- <el-button @click="filterStatus(6)" type="danger">作废</el-button>-->
  26. <!-- </el-button-group>-->
  27. </div>
  28. <div class="toolbar-search">
  29. <en-table-search
  30. @search="searchEvent"
  31. >
  32. </en-table-search>
  33. </div>
  34. </div>
  35. <template slot="table-columns">
  36. <el-table-column label="项目号" width="150">
  37. <template slot-scope="scope">
  38. <el-tag>{{scope.row.order_no}}</el-tag>
  39. </template>
  40. </el-table-column>
  41. <el-table-column label="状态" width="130" prop="status" sortable>
  42. <template slot-scope="scope">
  43. <el-tag type="info" v-if="scope.row.status === 0">默认</el-tag>
  44. <el-tag type="warning" v-if="scope.row.status === 1">技术跟进</el-tag>
  45. <el-tag type="warning" v-if="scope.row.status === 2">生产跟进</el-tag>
  46. <el-tag type="warning" v-if="scope.row.status === 3">收到款</el-tag>
  47. <el-tag v-if="scope.row.status === 4">已发货</el-tag>
  48. <el-tag type="success" v-if="scope.row.status === 5">已完成</el-tag>
  49. <el-tag type="danger" v-if="scope.row.status === 6">作废</el-tag>
  50. </template>
  51. </el-table-column>
  52. <el-table-column label="创建时间" :formatter="MixinUnixToDate" prop="create_time" sortable width="160"></el-table-column>
  53. <el-table-column label="项目名称" prop="name" show-overflow-tooltip min-width="140" sortable></el-table-column>
  54. <el-table-column label="类型" prop="type"></el-table-column>
  55. <el-table-column label="销售" prop="sales" sortable></el-table-column>
  56. <el-table-column label="规模" prop="scale"></el-table-column>
  57. <el-table-column label="要求发货日期" :formatter="MixinUnixToDay" prop="ship_date_required" sortable width="160"></el-table-column>
  58. <el-table-column v-if="boolFounder || permissions.filter(p => p === 'draftEdit' || p === 'pjReceipt').length > 0" label="金额" width="150" sortable>
  59. <template slot-scope="scope">
  60. <el-tag v-if="scope.row.amount > 1000000" type="danger">{{ scope.row.amount | unitPrice('¥') }}</el-tag>
  61. <el-tag v-else-if="scope.row.amount > 500000" type="warning">{{ scope.row.amount | unitPrice('¥') }}</el-tag>
  62. <el-tag v-else class="success">{{ scope.row.amount | unitPrice('¥') }}</el-tag>
  63. </template>
  64. </el-table-column>
  65. <el-table-column label="授权过期" :formatter="MixinUnixToDay" prop="auth_expires" sortable></el-table-column>
  66. <el-table-column label="操作" width="150" fixed="right">
  67. <template slot-scope="scope">
  68. <el-button
  69. size="mini"
  70. type="primary"
  71. @click="gotoDetail(scope.row.id)">明细</el-button>
  72. </template>
  73. </el-table-column>
  74. </template>
  75. <el-pagination
  76. v-if="tableData"
  77. slot="pagination"
  78. @size-change="handlePageSizeChange"
  79. @current-change="handlePageCurrentChange"
  80. :current-page="tableData.page_no"
  81. :page-sizes="[20, 50, 100, 200]"
  82. :page-size="tableData.page_size"
  83. layout="total, sizes, prev, pager, next, jumper"
  84. :total="tableData.data_total">
  85. </el-pagination>
  86. </en-table-layout>
  87. </template>
  88. <script>
  89. import * as API_order from '@/api/pjOrder.js'
  90. import { Foundation } from '~/ui-utils'
  91. import Storage from '../../utils/storage'
  92. export default {
  93. name: 'pjOrderList',
  94. data() {
  95. return {
  96. boolFounder: JSON.parse(Storage.getItem('admin_user')).founder === 1,
  97. permissions: [],
  98. /** 列表loading状态 */
  99. loading: false,
  100. /** 列表参数 */
  101. params: {
  102. page_no: 1,
  103. page_size: 20,
  104. sort: 'create_time',
  105. dir: 'desc'
  106. },
  107. /** 商品列表数据 */
  108. tableData: '',
  109. /** 高级搜索数据 */
  110. advancedForm: {
  111. },
  112. orderType: []
  113. }
  114. },
  115. mounted() {
  116. if (!this.boolFounder) {
  117. this.permissions = JSON.parse(Storage.getItem('permissions'))
  118. }
  119. this.GET_List()
  120. },
  121. activated() {
  122. this.GET_List()
  123. },
  124. methods: {
  125. /** 分页大小发生改变 */
  126. handlePageSizeChange(size) {
  127. this.params.page_size = size
  128. this.GET_List()
  129. },
  130. /** 分页页数发生改变 */
  131. handlePageCurrentChange(page) {
  132. this.params.page_no = page
  133. this.GET_List()
  134. },
  135. /** 搜索事件触发 */
  136. searchEvent(data) {
  137. this.params = {
  138. ...this.params,
  139. query: data
  140. }
  141. this.params.page_no = 1
  142. Object.keys(this.advancedForm).forEach(key => delete this.params[key])
  143. this.GET_List()
  144. },
  145. /** 高级搜索事件触发 */
  146. advancedSearchEvent() {
  147. this.params = {
  148. ...this.params,
  149. page_no: 1,
  150. ...this.advancedForm
  151. }
  152. delete this.params.keyword
  153. this.params.page_no = 1
  154. this.GET_List()
  155. },
  156. GET_List() {
  157. this.loading = true
  158. API_order.getList(this.params).then(response => {
  159. this.loading = false
  160. this.tableData = response
  161. }).catch(() => (this.loading = false))
  162. },
  163. gotoDetail(id) {
  164. console.log(id)
  165. this.$router.push({ name: 'pjOrderEdit', params: { id: id, callback: this.GET_List }})
  166. },
  167. filterStatus(e) {
  168. if (e && e.length > 0) {
  169. let list = e.join(',')
  170. this.params.fixedCondition = " FIND_IN_SET(`status`, '" + list + "')"
  171. } else {
  172. delete this.params.fixedCondition
  173. }
  174. // if (status === -1) {
  175. // delete this.params.fixedCondition
  176. // } else {
  177. // this.params.fixedCondition = 'status=' + status
  178. // }
  179. this.GET_List()
  180. }
  181. }
  182. }
  183. </script>
  184. <style type="text/scss" lang="scss" scoped>
  185. /deep/ .el-table td:not(.is-left) {
  186. text-align: center;
  187. }
  188. .inner-toolbar {
  189. display: flex;
  190. width: 100%;
  191. justify-content: space-between;
  192. }
  193. .toolbar-search {
  194. margin-right: 10px;
  195. }
  196. .goods-info {
  197. display: flex;
  198. align-items: center;
  199. .goods-image {
  200. img {
  201. width: 80px;
  202. height: 80px;
  203. }
  204. }
  205. .goods-name-box {
  206. text-align: left;
  207. .goods-name {
  208. display: -webkit-box;
  209. -webkit-box-orient: vertical;
  210. -webkit-line-clamp: 2;
  211. overflow: hidden;
  212. a:hover {
  213. color: #f42424 !important;
  214. }
  215. }
  216. }
  217. }
  218. </style>