approvalDetail.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. <template>
  2. <div>
  3. <Toptitle :title="type==1?'请购审批详情':type==2?'采购审批详情':type==3?'到货审批详情':'质检审批详情'">
  4. <slot name="titleButton">
  5. <Button @click="approval(1)"
  6. type="success"
  7. style="margin-right:10px;">通过</Button>
  8. <Button @click="approval(2)"
  9. type="error"
  10. style="margin-right:10px;">驳回</Button>
  11. <Button @click="goback()"
  12. type="primary"
  13. style="margin-right:10px;">返回</Button>
  14. </slot>
  15. </Toptitle>
  16. <div class="body">
  17. <div class="header">
  18. <Steps :current="1">
  19. <Step title="开始审批"></Step>
  20. <Step title="1级审批"></Step>
  21. <Step title="2级审批"></Step>
  22. <Step title="审批完成"></Step>
  23. </Steps>
  24. </div>
  25. <div class="info_wrapper">
  26. <div class="info">
  27. <div class="info_item"><span>制单人: </span><span>{{orderInfo.nickname}}</span></div>
  28. <div class="info_item"><span>请购类型: </span><span>{{orderInfo.type==1?'请购':orderInfo.type==2?'采购':orderInfo.type==3?'到货':'质检'}}</span></div>
  29. <div class="info_item"><span>项目名称: </span><span>{{orderInfo.title}}</span></div>
  30. <div class="info_item"><span>单据号: </span><span>{{orderInfo.order_no}}</span></div>
  31. <div class="info_item"><span>制单日期: </span><span>{{func.replaceDate(orderInfo.crt_time)}}</span></div>
  32. <div class="info_item"><span>备注: </span><span>{{orderInfo.remark}}</span></div>
  33. </div>
  34. <div class="info_fixed">
  35. <Steps :current="99"
  36. size="small"
  37. direction="vertical">
  38. <Step v-for="item in oaInfo"
  39. :key="item.level">
  40. <div slot="title">
  41. {{func.replaceDate(item.upd_time)}}
  42. 审批人:{{item.nickname}}
  43. </div>
  44. </Step>
  45. </Steps>
  46. </div>
  47. </div>
  48. <div class="content">
  49. <div class="content_header">
  50. </div>
  51. <Table :columns="tableColumns"
  52. :data="tableData"
  53. max-height="600"
  54. show-summary
  55. :summary-method="handleSummary"
  56. border>
  57. <template slot="Set"
  58. slot-scope="{row,index}">
  59. <a style="margin:0 5px"
  60. v-show="$route.query.type!=3"
  61. @click="handleSet(row,index,3,areaItem.product,areaIndex)">详情</a>
  62. </template>
  63. </Table>
  64. </div>
  65. </div>
  66. </div>
  67. </template>
  68. <script>
  69. // 这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  70. // 例如:import 《组件名称》 from '《组件路径》';
  71. export default {
  72. name: '',
  73. components: {
  74. },
  75. props: {},
  76. // import引入的组件需要注入到对象中才能使用
  77. data () {
  78. // 这里存放数据
  79. return {
  80. setpContent: [],
  81. orderInfo: {},
  82. oaInfo: [],
  83. tableData: [],
  84. type: null,
  85. tableColumns: [
  86. { title: '物料名称', key: 'type_title', align: 'center', tooltip: true, minWidth: 80 },
  87. { title: '物料分类', key: 'title', align: 'center', minWidth: 80 },
  88. {
  89. title: '物料规格', key: 'measure', align: 'center', minWidth: 80,
  90. render: (h, params) => { return h('span', {}, `${params.row.long || 0}*${params.row.width || 0}*${params.row.high || 0}`) }
  91. },
  92. { title: '计量单位', key: 'unit', align: 'center', tooltip: true, minWidth: 70 },
  93. { title: '数量', key: 'num', align: 'center', tooltip: true, minWidth: 40 },
  94. {
  95. title: '到货时间', key: '', align: 'center', tooltip: true, minWidth: 150,
  96. render: (h, params) => { return h('span', {}, this.func.replaceDate(params.row.arrive_time)) }
  97. },
  98. { title: '建议供应商', key: 'supply_title', align: 'center', tooltip: true, minWidth: 120 },
  99. ],
  100. }
  101. },
  102. // 生命周期 - 创建完成(可以访问当前this实例)
  103. created () {
  104. },
  105. // 生命周期 - 挂载完成(可以访问DOM元素)
  106. mounted () {
  107. this.axios({
  108. method: 'get',
  109. url: '/api/purchase_oa_detail',
  110. params: {
  111. oa_order_no: this.$route.query.oa_order_no
  112. }
  113. }).then((res) => {
  114. this.orderInfo = res.data.detail
  115. this.type = this.orderInfo.type
  116. this.oaInfo = res.data.oa
  117. this.tableData = res.data.list
  118. }).catch((err) => { });
  119. },
  120. methods: {
  121. handleSet (row, index) {
  122. this.$router.push({
  123. path: '/cms/BidSystem/DeepeningOrder/approvalProductDetail',
  124. query: {
  125. oa_id: row.id,
  126. // order_no: row.order_no,
  127. // type: 'oa',
  128. currency_type: this.currency_type,
  129. }
  130. })
  131. },
  132. approval (status) {
  133. let params = {
  134. status,
  135. type: this.orderInfo.type,
  136. oa_order_no: this.$route.query.oa_order_no
  137. }
  138. this.axios.post('/api/purchase_oa_pull', params).then(res => {
  139. if (res.code == 200) {
  140. this.$Message.success(res.msg || '无提示')
  141. // this.goback()
  142. }
  143. })
  144. },
  145. goback () { this.$router.go(-1) },
  146. handleSummary ({ columns, data }) {
  147. const sums = {};
  148. columns.forEach((column, index) => {
  149. const key = column.key;
  150. if (index === 0) {
  151. sums[key] = {
  152. key,
  153. value: '合计'
  154. };
  155. return;
  156. } else if (index === 2) {
  157. sums[key] = {
  158. key,
  159. value: ''
  160. };
  161. }
  162. const values = data.map(item => Number(item[key]));
  163. if (!values.every(value => isNaN(value))) {
  164. const v = values.reduce((prev, curr) => {
  165. const value = Number(curr);
  166. if (!isNaN(value)) {
  167. return prev + curr;
  168. } else {
  169. return prev;
  170. }
  171. }, 0);
  172. sums[key] = {
  173. key,
  174. value: v
  175. };
  176. } else {
  177. sums[key] = {
  178. key,
  179. value: ''
  180. };
  181. }
  182. });
  183. return sums;
  184. }
  185. },
  186. // 监听属性 类似于data概念
  187. computed: {},
  188. // 监控data中的数据变化
  189. watch: {},
  190. beforeCreate () { }, // 生命周期 - 创建之前
  191. beforeMount () { }, // 生命周期 - 挂载之前
  192. beforeUpdate () { }, // 生命周期 - 更新之前
  193. updated () { }, // 生命周期 - 更新之后
  194. beforeDestroy () { }, // 生命周期 - 销毁之前
  195. destroyed () { }, // 生命周期 - 销毁完成
  196. activated () { }, // 如果页面有keep-alive缓存功能,这个函数会触发
  197. }
  198. </script>
  199. <style lang='scss' scoped>
  200. .body {
  201. margin-top: 10px;
  202. .header {
  203. margin: 20px 10px;
  204. }
  205. .info_wrapper {
  206. display: flex;
  207. justify-content: space-around;
  208. .info {
  209. display: flex;
  210. justify-content: flex-start;
  211. flex-wrap: wrap;
  212. .info_item {
  213. width: 250px;
  214. padding: 0 10px 10px 10px;
  215. }
  216. }
  217. .info_fixed {
  218. width: 100%;
  219. max-height: 150px;
  220. padding-top: 20px;
  221. padding-left: 5px;
  222. border: 1px solid #ffffbb;
  223. overflow: hidden;
  224. overflow-y: auto;
  225. background-color: #ffffbb;
  226. text-align: center;
  227. /deep/.ivu-steps-head-inner {
  228. margin: 0;
  229. }
  230. /deep/.ivu-steps-title,
  231. /deep/.ivu-steps-head {
  232. background: transparent;
  233. }
  234. }
  235. }
  236. .content {
  237. .content_header {
  238. margin: 20px 0;
  239. display: flex;
  240. justify-content: flex-end;
  241. }
  242. .addArea {
  243. position: relative;
  244. padding: 15px;
  245. margin-bottom: 30px;
  246. border-radius: 5px;
  247. box-shadow: 1px 1px 5px 1px #999;
  248. /deep/ .ivu-form-item {
  249. display: inline-block;
  250. width: 220px;
  251. }
  252. }
  253. }
  254. }
  255. </style>