approve.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  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="160"
  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="160"
  72. :show-overflow-tooltip="true"
  73. label="更新时间">
  74. </el-table-column>
  75. <el-table-column
  76. prop="state"
  77. header-align="center"
  78. align="center"
  79. min-width="100"
  80. label="状态">
  81. <template slot-scope="scope">
  82. <span>{{ optionsState[Number(scope.row.state) + 1].value }}</span>
  83. </template>
  84. </el-table-column>
  85. <el-table-column
  86. prop="creatorName"
  87. header-align="center"
  88. align="center"
  89. min-width="120"
  90. label="申请人">
  91. </el-table-column>
  92. <el-table-column
  93. prop="orgName"
  94. header-align="center"
  95. align="center"
  96. label="申请部门">
  97. </el-table-column>
  98. <el-table-column
  99. prop="completeDate"
  100. header-align="center"
  101. align="center"
  102. min-width="150"
  103. :show-tooltip-when-overflow="true"
  104. label="处理意见">
  105. </el-table-column>
  106. <el-table-column
  107. fixed="right"
  108. header-align="center"
  109. align="center"
  110. width="80"
  111. label="操作">
  112. <template slot-scope="scope">
  113. <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>
  114. <el-button v-else type="text" size="small" @click="detailHandle(scope.row.businessType, scope.row.businessId)">查看</el-button>
  115. </template>
  116. </el-table-column>
  117. </el-table>
  118. <el-pagination
  119. @size-change="sizeChangeHandle"
  120. @current-change="currentChangeHandle"
  121. :current-page="pageIndex"
  122. :page-sizes="[10, 20, 50, 100]"
  123. :page-size="pageSize"
  124. :total="totalPage"
  125. layout="total, sizes, prev, pager, next, jumper">
  126. </el-pagination>
  127. <!-- 弹窗, 新增 / 修改 -->
  128. <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getApprovalList"/>
  129. </div>
  130. </template>
  131. <script>
  132. import AddOrUpdate from './approve-add-or-update'
  133. import { getApprovalList } from '@/api/msg'
  134. import { getCusList } from '@/api/cus'
  135. import { checkStr } from '@/api/util'
  136. export default {
  137. name: 'order',
  138. components: {
  139. // Detail,
  140. AddOrUpdate
  141. },
  142. created () {
  143. this.optionsState = this.$store.state.common.approveStates
  144. this.queryData()
  145. },
  146. computed: {
  147. // 监听消息ID
  148. listenNotice () {
  149. return this.$route.params.notice
  150. }
  151. },
  152. watch: {
  153. listenNotice: function (notice) {
  154. console.log('notice = ' + JSON.stringify(notice))
  155. if (!notice) return
  156. this.dataForm.noticeId = notice.noticeId
  157. this.dataForm.businessId = notice.businessId
  158. this.queryData()
  159. }
  160. },
  161. data () {
  162. return {
  163. addOrUpdateVisible: false,
  164. dataForm: {},
  165. dataList: [],
  166. pageIndex: 1,
  167. pageSize: 10,
  168. totalPage: 0,
  169. dataListLoading: false,
  170. dataListSelections: [],
  171. optionsState: [],
  172. optionsType: [
  173. {
  174. code: null, value: '全部'
  175. },
  176. {
  177. code: 'warehouse_flow_in', value: '入库申请'
  178. },
  179. {
  180. code: 'warehouse_flow_out', value: '出库申请'
  181. },
  182. {
  183. code: 'contract_review', value: '合同评审'
  184. },
  185. {
  186. code: 'sale_order_flow', value: '订单评审'
  187. },
  188. {
  189. code: 'sale_purchase_flow', value: '采购申请'
  190. },
  191. {
  192. code: 'wh_template_record_flow', value: '模板出库'
  193. },
  194. {
  195. code: 'pro_technology_flow', value: '工艺评审'
  196. },
  197. // {
  198. // code: 'pro_product_flow', value: '产品'
  199. // },
  200. {
  201. code: 'wh_inventory_record_flow', value: '盘点评审'
  202. }
  203. ],
  204. optionsCustomer: []
  205. }
  206. },
  207. methods: {
  208. // 查询
  209. queryData () {
  210. this.pageIndex = 1
  211. this.getApprovalList()
  212. },
  213. // 获取数据列表
  214. getApprovalList () {
  215. this.dataList = []
  216. this.dataListLoading = true
  217. let params = {
  218. 'current': this.pageIndex,
  219. 'size': this.pageSize,
  220. 'createTime': this.dataForm.createTime ? this.dataForm.createTime : null,
  221. 'state': this.dataForm.state ? this.dataForm.state : null,
  222. 'businessType': this.dataForm.businessType ? this.dataForm.businessType : null,
  223. 'businessId': this.dataForm.businessId ? this.dataForm.businessId : null
  224. }
  225. getApprovalList(params).then(({data}) => {
  226. if (data && data.code === '200') {
  227. this.dataList = data.data.records
  228. this.totalPage = Number(data.data.total)
  229. } else {
  230. this.dataList = []
  231. this.totalPage = 0
  232. }
  233. this.dataListLoading = false
  234. })
  235. },
  236. // 每页数
  237. sizeChangeHandle (val) {
  238. this.pageSize = val
  239. this.pageIndex = 1
  240. this.getApprovalList()
  241. },
  242. // 当前页
  243. currentChangeHandle (val) {
  244. this.pageIndex = val
  245. this.getApprovalList()
  246. },
  247. // 多选
  248. selectionChangeHandle (val) {
  249. this.dataListSelections = val
  250. },
  251. // 远程方法:获取客户列表
  252. async remoteCustomer (query) {
  253. if (!query) {
  254. query = ''
  255. }
  256. await getCusList({'customerName': query}).then(({data}) => {
  257. if (data && data.code === '200') {
  258. this.optionsCustomer = []
  259. data.data.records.forEach((item) => {
  260. this.optionsCustomer.push({
  261. code: item.customerId,
  262. value: item.customerName
  263. })
  264. })
  265. }
  266. })
  267. },
  268. checkUser (row) {
  269. let currentUser = this.$store.state.user.name
  270. return checkStr(currentUser, row.approver)
  271. },
  272. // 新增 / 修改
  273. addOrUpdateHandle (businessType, businessId) {
  274. this.addOrUpdateVisible = true
  275. this.$nextTick(() => {
  276. this.$refs.addOrUpdate.init(businessType, businessId)
  277. })
  278. },
  279. // 详情
  280. detailHandle (businessType, businessId) {
  281. this.addOrUpdateVisible = true
  282. this.$nextTick(() => {
  283. this.$refs.addOrUpdate.init(businessType, businessId, true)
  284. })
  285. }
  286. }
  287. }
  288. </script>
  289. <style scoped>
  290. </style>