check.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <template>
  2. <div>
  3. <avue-form class="trading-form" :option="option" ref="form" v-model="form">
  4. </avue-form>
  5. <div class="dialogButton">
  6. <el-button size="small" :loading="buttonLoading" @click="$emit('choceCheckFun')">关闭</el-button>
  7. <el-button type="warning" :loading="buttonLoading" size="small" @click="submit(2)">审批驳回</el-button>
  8. <el-button type="primary" :loading="buttonLoading" size="small" @click="submit(1)">审批通过</el-button>
  9. </div>
  10. </div>
  11. </template>
  12. <script>
  13. import { approvePass,batchOperation } from "@/api/approveData/main";
  14. import {offset} from "@/api/basicData/salesOrder";
  15. export default {
  16. name: "check",
  17. props: {
  18. checkData: {
  19. type: Object
  20. },
  21. choceCheckFun:{
  22. type: Function
  23. },
  24. checkDetail:{
  25. type: Boolean
  26. },
  27. idList:{
  28. type: Array
  29. }
  30. },
  31. data() {
  32. return {
  33. form: {},
  34. list: [],
  35. currencyDic: [],
  36. buttonLoading:false,
  37. corpId: "",
  38. option: {
  39. emptyBtn: false,
  40. submitBtn: false,
  41. labelWidth: 120,
  42. menuSpan: 8,
  43. column: [
  44. {
  45. label: '审批人',
  46. prop: 'auditName',
  47. span: 12,
  48. disabled:true,
  49. rules: [
  50. {
  51. required: false,
  52. message: ' ',
  53. trigger: 'blur'
  54. }
  55. ]
  56. },
  57. {
  58. label: '审批日期',
  59. prop: 'auditOpTime',
  60. type: "datetime",
  61. span: 12,
  62. disabled:true,
  63. rules: [
  64. {
  65. required: false,
  66. message: ' ',
  67. trigger: 'blur'
  68. }
  69. ]
  70. },
  71. {
  72. label: '审批意见',
  73. prop: 'auditMsg',
  74. span: 24,
  75. rules: [
  76. {
  77. required: false,
  78. message: ' ',
  79. trigger: 'blur'
  80. }
  81. ]
  82. }
  83. ]
  84. },
  85. }
  86. },
  87. created() {
  88. let date = new Date();
  89. let strDate = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
  90. this.$set(this.form,"auditOpTime",strDate)
  91. this.$set(this.form,"auditName",this.$store.getters.userInfo.user_name)
  92. },
  93. methods: {
  94. submit(operate){
  95. this.$confirm("是否确认此操作!", "提示", {
  96. confirmButtonText: "确认",
  97. cancelButtonText: "取消",
  98. type: "warning",
  99. }).then(() => {
  100. console.log(operate)
  101. this.checkData.operate = operate
  102. if(this.idList.length !== 0){
  103. //批量
  104. this.buttonLoading = true
  105. batchOperation(this.idList.join(","),operate,this.form.auditMsg).then(res=>{
  106. if(res.data.success){
  107. this.$message.success("操作成功!")
  108. this.$emit("operationType")
  109. }
  110. }).finally(()=>{
  111. this.buttonLoading = false
  112. })
  113. }else{
  114. //单个
  115. this.buttonLoading = true
  116. this.checkData.auditName = this.form.auditName
  117. this.checkData.auditMsg = this.form.auditMsg
  118. this.checkData.auditOpTime = this.form.auditOpTime
  119. if (this.checkData.checkType === "YPJ-XSJH" && operate === 1){
  120. offset({id: this.checkData.billId}).then(res => {
  121. if (res.data.data == '操作成功') {
  122. this.checkData = this.detailData.check;
  123. this.checkDialog = true;
  124. } else {
  125. this.$confirm(res.data.data, {
  126. confirmButtonText: "确定",
  127. cancelButtonText: "取消",
  128. type: "warning"
  129. }).then(() => {
  130. approvePass(this.checkData).then(res=>{
  131. if(res.data.success){
  132. this.$message.success("操作成功!")
  133. this.$emit("choceCheckFun")
  134. }
  135. if(!this.checkDetail){
  136. //关闭付费申请页面
  137. let tag = this.$store.getters.tagList.filter(ele => ele.label === "付费申请")[0]
  138. this.$store.commit('DEL_TAG', tag)
  139. this.$store.commit("PQ_OUT_DETAIL");
  140. let tag1 = this.$store.getters.tagList.filter(ele => ele.label === "审批数据")[0]
  141. this.$store.commit('DEL_TAG', tag1)
  142. this.$router.push({
  143. path: "/approveData/index",
  144. query: {check:'refresh'},
  145. });
  146. }
  147. }).finally(()=>{
  148. this.buttonLoading = false
  149. })
  150. }).catch(()=>{
  151. this.buttonLoading = false
  152. })
  153. }
  154. }).catch(()=>{
  155. this.buttonLoading = false
  156. })
  157. }else{
  158. approvePass(this.checkData).then(res=>{
  159. if(res.data.success){
  160. this.$message.success("操作成功!")
  161. this.$emit("choceCheckFun")
  162. }
  163. if(!this.checkDetail){
  164. //关闭付费申请页面
  165. let tag = this.$store.getters.tagList.filter(ele => ele.label === "付费申请")[0]
  166. this.$store.commit('DEL_TAG', tag)
  167. this.$store.commit("PQ_OUT_DETAIL");
  168. let tag1 = this.$store.getters.tagList.filter(ele => ele.label === "审批数据")[0]
  169. this.$store.commit('DEL_TAG', tag1)
  170. this.$router.push({
  171. path: "/approveData/index",
  172. query: {check:'refresh'},
  173. });
  174. }
  175. }).finally(()=>{
  176. this.buttonLoading = false
  177. })
  178. }
  179. }
  180. })
  181. }
  182. }
  183. }
  184. </script>
  185. <style lang="scss" scoped>
  186. .trading-form ::v-deep .el-form-item {
  187. margin-bottom: 8px !important;
  188. }
  189. </style>