approve.vue 7.7 KB

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