Approval.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <template>
  2. <div>
  3. <FullPage title="采购审批列表"
  4. :list='set_list'
  5. @init='init'
  6. :loading='loading'
  7. @searchData='init'
  8. @changePage='changePage'
  9. @changeSize='changeSize'
  10. @selectTable='selectTable'
  11. :tableColums='tableColums'
  12. :tableData='tableData'
  13. :pageIndex='pageIndex'
  14. :total='total'>
  15. <div slot='titleButton'>
  16. <Button type="error"
  17. @click="approved(2)"
  18. style="margin-right:10px;"
  19. ghost>批量驳回审批</Button>
  20. <Button type="success"
  21. @click="approved(1)"
  22. style="margin-right:10px;"
  23. ghost>批量通过审批</Button>
  24. </div>
  25. <template slot='set'
  26. slot-scope='{row}'>
  27. <div>
  28. <a v-if='persimissionData["订单详情"]||persimissionData.all'
  29. @click="goPage(row)"
  30. style="margin:0 5px">查看详情</a>
  31. <a @click="singleApproved(1,row)"
  32. style="margin:0 5px;color:green"
  33. v-if="row.state == 0 ">通过</a>
  34. <a @click="singleApproved(2,row)"
  35. style="margin:0 5px;color:red"
  36. v-if="row.state == 1">驳回</a>
  37. </div>
  38. </template>
  39. </FullPage>
  40. </div>
  41. </template>
  42. <script>
  43. import { mapState } from 'vuex'
  44. export default {
  45. data () {
  46. return {
  47. tableColums: [
  48. { type: 'selection', align: 'center', fixed: 'left', minWidth: 100, },
  49. { title: '订单编号', align: 'center', key: 'order_no', width: '180' },
  50. { title: '项目名称', align: 'center', key: 'name', minWidth: 200 },
  51. // { title: '订单流水号', align: 'center', key: 'oa_order_no', minWidth: 200 },
  52. { title: '客户', align: 'center', key: 'client_name', minWidth: 100 },
  53. { title: '手机号', align: 'center', key: 'mobile', minWidth: 150 },
  54. {
  55. title: '审批类型', align: 'center', key: 'type', minWidth: 100,
  56. render (h, params) {
  57. return h('span', {
  58. props: {},
  59. style: {}
  60. }, params.row.type == 1 ? '请购' : (params.row.type == 2 ? '采购' : (params.row.type == 3 ? '到货' : '质检')))
  61. }
  62. },
  63. { title: '提交人', align: 'center', key: 'nickname', minWidth: 100 },
  64. {
  65. title: '审批状态', align: 'center', key: 'show_state', minWidth: 100,
  66. render (h, params) {
  67. return h('span', {
  68. props: {},
  69. style: {
  70. color: params.row.state == 0 ? '#FFA141' : (params.row.state == 1 ? '#32C800' : '#FF5E5C')
  71. }
  72. }, params.row.state == 0 ? '待审批' : (params.row.state == 1 ? '同意' : (params.row.state == 2 ? '驳回' : '取消')))
  73. }
  74. },
  75. {
  76. title: '提交日期', align: 'center', key: 'crt_time', minWidth: 200,
  77. render: (h, params) => h('span', {}, this.func.replaceDate(params.row.crt_time * 1))
  78. },
  79. { title: '操作', align: 'center', slot: 'set', fixed: 'right', width: '220' },
  80. ],
  81. tableData: [],
  82. pageIndex: 1,
  83. total: 0,
  84. pageSize: 10,
  85. loading: false,
  86. proxyObj: {},
  87. selectIds: [],
  88. currency_type: null,
  89. type: null,
  90. currencyTag: 'name1',
  91. userList: [],
  92. purchaseTypeList: [],
  93. }
  94. },
  95. created () {
  96. //74工装单→深化 审批 78 测量单 80 深化单 82 生产拆单
  97. let id = this.$route.query.id
  98. this.type = id == 78 ? 3 : id == 74 ? 1 : id == 80 ? 2 : ''
  99. this.currency_type = this.$route.query.id
  100. this.axios.get('/api/user').then(res => { this.userList = res.data.data }).catch(err => { console.error(err); })
  101. this.axios({ method: 'get', url: '/api/basic_purchase_list', }).then((res) => { this.purchaseTypeList = res.data.data }).catch((err) => { });
  102. },
  103. computed: {
  104. ...mapState(['persimissionData']),
  105. set_list () {
  106. return [
  107. { title: '订单号', name: 'Input', value: '', serverName: 'order_no', placeholder: '请输入订单号' },
  108. { title: '项目名称', name: 'Input', value: '', serverName: 'residential_name', placeholder: '请输入项目名称' },
  109. {
  110. title: '审批状态', name: 'Select', placeholder: '请选择', value: '', serverName: 'state',
  111. option: [
  112. { label: '待审批', value: 0 },
  113. { label: '同意', value: 1 },
  114. { label: '驳回', value: 2 },
  115. // { label: '取消', value: 3 },
  116. ]
  117. },
  118. {
  119. title: '审批类型', name: 'Select', placeholder: '请选择审批类型', value: '', serverName: 'type_id',
  120. option: [
  121. { label: '请购', value: 1 },
  122. { label: '采购', value: 2 },
  123. { label: '到货', value: 3 },
  124. { label: '质检', value: 4 },
  125. ]
  126. },
  127. {
  128. title: '提交人', name: 'Select', placeholder: '请选择提交人', value: '', serverName: 'nickname', optionName: 'nickname', optionValue: 'id',
  129. option: this.userList
  130. },
  131. { title: '提交时间', start_server: 'start_time', end_server: 'end_time', name: 'Input', start_value: '', end_value: '', isDate: true, start_placeholder: '开始日期', end_placeholder: '结束日期', },
  132. ]
  133. }
  134. },
  135. methods: {
  136. init (row) {
  137. this.pageIndex = 1
  138. row.page_index = this.pageIndex;
  139. row.page_size = this.pageSize
  140. this.proxyObj = row;
  141. this.getData(row)
  142. },
  143. getData (row) {
  144. this.loading = true;
  145. this.axios('/api/purchase_oa_list').then(res => {
  146. this.loading = false;
  147. this.tableData = res.data.data;
  148. this.total = res.data.total;
  149. })
  150. },
  151. changePage (e) {
  152. this.pageIndex = e;
  153. this.proxyObj.page_index = this.pageIndex;
  154. this.getData(this.proxyObj);
  155. },
  156. goPage (row) {
  157. this.$router.push({
  158. path: '/cms/PurchasingManage/approvalDetail',
  159. query: {
  160. oa_order_no: row.oa_order_no,
  161. order_no: row.order_no,
  162. type: 'oa',
  163. currency_type: this.currency_type,
  164. }
  165. })
  166. },
  167. goDetails (row) {
  168. this.$router.push({
  169. path: '/cms/approval/examine',
  170. query: {
  171. oa_order_no: row.oa_order_no
  172. }
  173. })
  174. },
  175. changeSize (e) {
  176. this.pageSize = e;
  177. this.proxyObj.page_size = this.page_size;
  178. this.getData(this.proxyObj)
  179. },
  180. approved (n) {
  181. if (this.selectIds.length < 1) {
  182. return this.$Message.warning('请至少选择一项')
  183. }
  184. this.confirmDelete({
  185. content: n == 1 ? '是否通过此订单审核?' : '是否驳回此订单审核',
  186. title: n == 1 ? '审批通过' : '驳回审批',
  187. type: n == 1 ? 'primary' : 'error',
  188. then: () => {
  189. this.select_post(n, this.selectIds)
  190. },
  191. cancel: () => { }
  192. })
  193. },
  194. singleApproved (n, row) {
  195. this.selectIds = [row.oa_order_no]
  196. this.approved(n)
  197. },
  198. selectTable (e) {
  199. this.selectIds = e.reduce((pre, cur) => pre.concat([cur.oa_order_no]), [])
  200. console.log('selectIds :>> ', this.selectIds);
  201. },
  202. select_post (state, arr) {//state(1:通过|2:驳回)
  203. let params = { oa_order_no: arr.join(','), status: state, type: this.type }
  204. state == 2 ? params.remark = this.remark : '';
  205. this.axios.post('/api/purchase_oa_pull', params).then(res => {
  206. if (res.code == 200) {
  207. this.$Message.success(res.msg || '无提示')
  208. this.getData(this.proxyObj)
  209. }
  210. })
  211. },
  212. }
  213. }
  214. </script>
  215. <style lang="scss" scoped>
  216. .nav {
  217. display: flex;
  218. justify-content: space-between;
  219. align-items: center;
  220. }
  221. .item-attr {
  222. display: flex;
  223. align-items: center;
  224. margin-bottom: 10px;
  225. }
  226. </style>