approve.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. <!-- 订单 -->
  2. <template>
  3. <div class="order">
  4. <el-form :inline="true" :model="dataForm" @keyup.enter.native="queryData()">
  5. <el-form-item label="状态">
  6. <el-select
  7. v-model="dataForm.state"
  8. placeholder="请选择">
  9. <el-option
  10. v-for="item in optionsState"
  11. :key="item.code"
  12. :label="item.value"
  13. :value="item.code">
  14. </el-option>
  15. </el-select>
  16. </el-form-item>
  17. <el-form-item label="申请日期">
  18. <el-date-picker
  19. v-model="dataForm.createTime"
  20. value-format="yyyy-MM-dd"
  21. type="date">
  22. </el-date-picker>
  23. </el-form-item>
  24. <el-form-item>
  25. <el-button @click="queryData()">查询</el-button>
  26. </el-form-item>
  27. </el-form>
  28. <el-table
  29. :data="dataList"
  30. border
  31. v-loading="dataListLoading"
  32. @selection-change="selectionChangeHandle"
  33. style="width: 100%;">
  34. <el-table-column
  35. label="序号"
  36. type="index"
  37. width="50"
  38. align="center">
  39. </el-table-column>
  40. <el-table-column
  41. prop="businessTypeName"
  42. header-align="center"
  43. align="center"
  44. min-width="180"
  45. label="流程类别">
  46. </el-table-column>
  47. <el-table-column
  48. prop="createTime"
  49. header-align="center"
  50. align="center"
  51. min-width="140"
  52. :show-overflow-tooltip="true"
  53. label="申请时间">
  54. </el-table-column>
  55. <el-table-column
  56. prop="updateTime"
  57. header-align="center"
  58. align="center"
  59. min-width="140"
  60. label="更新时间">
  61. </el-table-column>
  62. <el-table-column
  63. prop="state"
  64. header-align="center"
  65. align="center"
  66. min-width="100"
  67. label="状态">
  68. <template slot-scope="scope">
  69. <span>{{ optionsState[Number(scope.row.state) + 1].value }}</span>
  70. </template>
  71. </el-table-column>
  72. <el-table-column
  73. prop="creatorName"
  74. header-align="center"
  75. align="center"
  76. min-width="120"
  77. label="申请人">
  78. </el-table-column>
  79. <el-table-column
  80. prop="orgName"
  81. header-align="center"
  82. align="center"
  83. label="申请部门">
  84. </el-table-column>
  85. <el-table-column
  86. prop="completeDate"
  87. header-align="center"
  88. align="center"
  89. min-width="150"
  90. label="处理意见">
  91. </el-table-column>
  92. <el-table-column
  93. header-align="center"
  94. align="center"
  95. width="80"
  96. label="操作">
  97. <template slot-scope="scope">
  98. <el-button v-if="Number(scope.row.state) !== 3 && checkUser(scope.row)" type="text" size="small" @click="addOrUpdateHandle(scope.row.businessType, scope.row.businessId)">处理</el-button>
  99. <el-button v-else type="text" size="small" @click="detailHandle(scope.row.businessType, scope.row.businessId)">查看</el-button>
  100. </template>
  101. </el-table-column>
  102. </el-table>
  103. <el-pagination
  104. @size-change="sizeChangeHandle"
  105. @current-change="currentChangeHandle"
  106. :current-page="pageIndex"
  107. :page-sizes="[10, 20, 50, 100]"
  108. :page-size="pageSize"
  109. :total="totalPage"
  110. layout="total, sizes, prev, pager, next, jumper">
  111. </el-pagination>
  112. <!-- 弹窗, 新增 / 修改 -->
  113. <detail v-if="detailVisible" ref="detail"/>
  114. <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getApprovalList"/>
  115. </div>
  116. </template>
  117. <script>
  118. import Detail from './approve-detail'
  119. import AddOrUpdate from './approve-add-or-update'
  120. import { getApprovalList } from '@/api/msg'
  121. import { getCusList } from '@/api/cus'
  122. import { checkStr } from '@/api/util'
  123. export default {
  124. name: 'order',
  125. components: {
  126. Detail,
  127. AddOrUpdate
  128. },
  129. created () {
  130. this.queryData()
  131. },
  132. data () {
  133. return {
  134. addOrUpdateVisible: false,
  135. detailVisible: false,
  136. dataForm: {},
  137. dataList: [],
  138. pageIndex: 1,
  139. pageSize: 10,
  140. totalPage: 0,
  141. dataListLoading: false,
  142. dataListSelections: [],
  143. optionsState: [
  144. {
  145. code: null, value: '全部'
  146. },
  147. {
  148. code: '0', value: '待提交'
  149. },
  150. {
  151. code: '1', value: '待审批'
  152. },
  153. {
  154. code: '2', value: '审批中'
  155. },
  156. {
  157. code: '3', value: '审批完成'
  158. },
  159. {
  160. code: '4', value: '审批不通过'
  161. }
  162. ],
  163. optionsCustomer: []
  164. }
  165. },
  166. methods: {
  167. // 查询
  168. queryData () {
  169. this.pageIndex = 1
  170. this.getApprovalList()
  171. },
  172. // 获取数据列表
  173. getApprovalList () {
  174. this.dataListLoading = true
  175. let params = {
  176. 'current': this.pageIndex,
  177. 'size': this.pageSize,
  178. 'createTime': this.dataForm.createTime ? this.dataForm.createTime : null,
  179. 'state': this.dataForm.state ? this.dataForm.state : null
  180. }
  181. getApprovalList(params).then(({data}) => {
  182. if (data && data.code === '200') {
  183. this.dataList = data.data.records
  184. this.totalPage = Number(data.data.total)
  185. } else {
  186. this.dataList = []
  187. this.totalPage = 0
  188. }
  189. this.dataListLoading = false
  190. })
  191. },
  192. // 每页数
  193. sizeChangeHandle (val) {
  194. this.pageSize = val
  195. this.pageIndex = 1
  196. this.getApprovalList()
  197. },
  198. // 当前页
  199. currentChangeHandle (val) {
  200. this.pageIndex = val
  201. this.getApprovalList()
  202. },
  203. // 多选
  204. selectionChangeHandle (val) {
  205. this.dataListSelections = val
  206. },
  207. // 远程方法:获取客户列表
  208. async remoteCustomer (query) {
  209. if (!query) {
  210. query = ''
  211. }
  212. await getCusList({'customerName': query}).then(({data}) => {
  213. if (data && data.code === '200') {
  214. this.optionsCustomer = []
  215. data.data.records.forEach((item) => {
  216. this.optionsCustomer.push({
  217. code: item.customerId,
  218. value: item.customerName
  219. })
  220. })
  221. }
  222. })
  223. },
  224. // 新增 / 修改
  225. addOrUpdateHandle (businessType, businessId) {
  226. this.addOrUpdateVisible = true
  227. this.$nextTick(() => {
  228. this.$refs.addOrUpdate.init(businessType, businessId)
  229. })
  230. },
  231. checkUser (row) {
  232. let currentUser = this.$store.state.user.name
  233. return checkStr(currentUser, row.approver)
  234. },
  235. // 详情
  236. detailHandle (businessType, businessId) {
  237. this.detailVisible = true
  238. this.$nextTick(() => {
  239. this.$refs.detail.init(businessType, businessId)
  240. })
  241. }
  242. }
  243. }
  244. </script>
  245. <style scoped>
  246. </style>