approve.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. <!-- 订单 -->
  2. <template>
  3. <div class="order">
  4. <template v-if="!addOrUpdateVisible">
  5. <el-form :inline="true" :model="dataForm" @keyup.enter.native="queryData()">
  6. <el-form-item label="业务类型">
  7. <el-select
  8. v-model="dataForm.businessType"
  9. placeholder="请选择">
  10. <el-option
  11. v-for="item in optionsType"
  12. :key="item.code"
  13. :label="item.value"
  14. :value="item.code">
  15. </el-option>
  16. </el-select>
  17. </el-form-item>
  18. <el-form-item label="状态">
  19. <el-select
  20. v-model="dataForm.state"
  21. placeholder="请选择">
  22. <el-option
  23. v-for="item in optionsState"
  24. :key="item.code"
  25. :label="item.value"
  26. :value="item.code">
  27. </el-option>
  28. </el-select>
  29. </el-form-item>
  30. <el-form-item label="申请日期">
  31. <el-date-picker
  32. v-model="dataForm.createTime"
  33. value-format="yyyy-MM-dd"
  34. type="date">
  35. </el-date-picker>
  36. </el-form-item>
  37. <el-form-item>
  38. <el-button @click="queryData()">查询</el-button>
  39. </el-form-item>
  40. </el-form>
  41. <el-table
  42. :data="dataList"
  43. border
  44. v-loading="dataListLoading"
  45. @selection-change="selectionChangeHandle"
  46. style="width: 100%;">
  47. <el-table-column
  48. label="序号"
  49. type="index"
  50. width="50"
  51. align="center">
  52. </el-table-column>
  53. <el-table-column
  54. prop="businessTypeName"
  55. header-align="center"
  56. align="center"
  57. min-width="180"
  58. label="流程类别">
  59. </el-table-column>
  60. <el-table-column
  61. prop="createTime"
  62. header-align="center"
  63. align="center"
  64. min-width="160"
  65. :show-overflow-tooltip="true"
  66. label="申请时间">
  67. </el-table-column>
  68. <el-table-column
  69. prop="updateTime"
  70. header-align="center"
  71. align="center"
  72. min-width="160"
  73. :show-overflow-tooltip="true"
  74. label="更新时间">
  75. </el-table-column>
  76. <el-table-column
  77. prop="state"
  78. header-align="center"
  79. align="center"
  80. min-width="100"
  81. label="状态">
  82. <template slot-scope="scope">
  83. <span>{{(optionsState.find(t=>t.code === scope.row.state.toString())).value}}</span>
  84. </template>
  85. </el-table-column>
  86. <el-table-column
  87. prop="creatorName"
  88. header-align="center"
  89. align="center"
  90. min-width="120"
  91. label="申请人">
  92. </el-table-column>
  93. <el-table-column
  94. prop="orgName"
  95. header-align="center"
  96. align="center"
  97. min-width="140"
  98. :show-tooltip-when-overflow="true"
  99. label="申请部门">
  100. </el-table-column>
  101. <el-table-column
  102. fixed="right"
  103. header-align="center"
  104. align="center"
  105. width="80"
  106. label="操作">
  107. <template slot-scope="scope">
  108. <el-button v-if="Number(scope.row.state) !== 3 && checkUser(scope.row)" type="text" size="small" @click="addOrUpdateHandle(scope.row)">处理</el-button>
  109. <el-button v-else type="text" size="small" @click="detailHandle(scope.row)">查看</el-button>
  110. </template>
  111. </el-table-column>
  112. </el-table>
  113. <el-pagination
  114. @size-change="sizeChangeHandle"
  115. @current-change="currentChangeHandle"
  116. :current-page="pageIndex"
  117. :page-sizes="[10, 20, 50, 100]"
  118. :page-size="pageSize"
  119. :total="totalPage"
  120. layout="total, sizes, prev, pager, next, jumper">
  121. </el-pagination>
  122. </template>
  123. <!-- 弹窗, 新增 / 修改 -->
  124. <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getApprovalList" @onChose="onChose"/>
  125. </div>
  126. </template>
  127. <script>
  128. import AddOrUpdate from './approve-add-or-update'
  129. import { getApprovalList } from '@/api/msg'
  130. import { readNotices } from '@/utils/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. computed: {
  144. // 监听消息ID
  145. listenNotice () {
  146. return this.$route.params.notice
  147. }
  148. },
  149. watch: {
  150. listenNotice: function (notice) {
  151. // console.log('notice = ' + JSON.stringify(notice))
  152. if (!notice) return
  153. this.dataForm.noticeId = notice.noticeId
  154. this.dataForm.businessId = notice.businessId
  155. this.queryData()
  156. }
  157. },
  158. data () {
  159. return {
  160. addOrUpdateVisible: false,
  161. dataForm: {},
  162. dataList: [],
  163. pageIndex: 1,
  164. pageSize: 10,
  165. totalPage: 0,
  166. dataListLoading: false,
  167. dataListSelections: [],
  168. optionsState: [],
  169. optionsType: [
  170. {
  171. code: null, value: '全部'
  172. },
  173. {
  174. code: 'warehouse_flow_in', value: '入库申请'
  175. },
  176. {
  177. code: 'warehouse_flow_out', value: '出库申请'
  178. },
  179. {
  180. code: 'contract_review', value: '合同评审'
  181. },
  182. {
  183. code: 'sale_order_flow', value: '订单评审'
  184. },
  185. {
  186. code: 'sale_purchase_flow', value: '采购申请'
  187. },
  188. {
  189. code: 'wh_template_record_flow', value: '模板出库'
  190. },
  191. {
  192. code: 'pro_technology_flow', value: '工艺评审'
  193. },
  194. {
  195. code: 'pro_product_flow', value: '产品评审'
  196. },
  197. {
  198. code: 'wh_inventory_record_flow', value: '盘点评审'
  199. },
  200. {
  201. code: 'supplier_review_flow', value: '供应商评审'
  202. },
  203. {
  204. code: 'submit_expense_flow', value: '报销审批'
  205. },
  206. {
  207. code: 'pur_commission_flow', value: '委外审批'
  208. }
  209. ],
  210. optionsCustomer: []
  211. }
  212. },
  213. methods: {
  214. onChose () {
  215. this.addOrUpdateVisible = false
  216. },
  217. // 查询
  218. queryData () {
  219. this.pageIndex = 1
  220. this.getApprovalList()
  221. },
  222. // 获取数据列表
  223. getApprovalList () {
  224. this.dataList = []
  225. this.dataListLoading = true
  226. let params = {
  227. 'current': this.pageIndex,
  228. 'size': this.pageSize,
  229. 'createTime': this.dataForm.createTime ? this.dataForm.createTime : null,
  230. 'state': this.dataForm.state ? this.dataForm.state : null,
  231. 'businessType': this.dataForm.businessType ? this.dataForm.businessType : null,
  232. 'businessId': this.dataForm.businessId ? this.dataForm.businessId : null
  233. }
  234. getApprovalList(params).then(({data}) => {
  235. if (data && data.code === '200') {
  236. this.dataList = data.data.records
  237. this.totalPage = Number(data.data.total)
  238. } else {
  239. this.dataList = []
  240. this.totalPage = 0
  241. }
  242. this.dataListLoading = false
  243. })
  244. },
  245. // 每页数
  246. sizeChangeHandle (val) {
  247. this.pageSize = val
  248. this.pageIndex = 1
  249. this.getApprovalList()
  250. },
  251. // 当前页
  252. currentChangeHandle (val) {
  253. this.pageIndex = val
  254. this.getApprovalList()
  255. },
  256. // 多选
  257. selectionChangeHandle (val) {
  258. this.dataListSelections = val
  259. },
  260. // 远程方法:获取客户列表
  261. async remoteCustomer (query) {
  262. if (!query) {
  263. query = ''
  264. }
  265. await getCusList({'customerName': query}).then(({data}) => {
  266. if (data && data.code === '200') {
  267. this.optionsCustomer = []
  268. data.data.records.forEach((item) => {
  269. this.optionsCustomer.push({
  270. code: item.customerId,
  271. value: item.customerName
  272. })
  273. })
  274. }
  275. })
  276. },
  277. checkUser (row) {
  278. let currentUser = this.$store.state.user.id
  279. return checkStr(currentUser, row.currentApprover)
  280. },
  281. // 新增 / 修改
  282. addOrUpdateHandle (row) {
  283. this.addOrUpdateVisible = true
  284. // 已查看
  285. if (row.noticeIds) {
  286. readNotices(this, row.noticeIds)
  287. }
  288. this.$nextTick(() => {
  289. this.$refs.addOrUpdate.init(row.businessType, row.businessId)
  290. })
  291. },
  292. // 详情
  293. detailHandle (row) {
  294. this.addOrUpdateVisible = true
  295. this.$nextTick(() => {
  296. this.$refs.addOrUpdate.init(row.businessType, row.businessId, true)
  297. })
  298. // 已查看
  299. if (row.noticeIds) {
  300. readNotices(this, row.noticeIds)
  301. }
  302. }
  303. }
  304. }
  305. </script>
  306. <style scoped>
  307. </style>