check.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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/approveDataH/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: 24,
  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: 24,
  62. disabled: true,
  63. rules: [
  64. {
  65. required: false,
  66. message: ' ',
  67. trigger: 'blur'
  68. }
  69. ]
  70. },
  71. {
  72. label: '审批意见',
  73. prop: 'auditMsg',
  74. type: 'textarea',
  75. rows: 5,
  76. span: 24,
  77. rules: [
  78. {
  79. required: false,
  80. message: ' ',
  81. trigger: 'blur'
  82. }
  83. ]
  84. }
  85. ]
  86. },
  87. }
  88. },
  89. created() {
  90. let date = new Date();
  91. let strDate = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
  92. this.$set(this.form, "auditOpTime", strDate)
  93. this.$set(this.form, "auditName", this.$store.getters.userInfo.user_name)
  94. },
  95. methods: {
  96. submit(operate) {
  97. this.$confirm("是否确认此操作!", "提示", {
  98. confirmButtonText: "确认",
  99. cancelButtonText: "取消",
  100. type: "warning",
  101. }).then(() => {
  102. console.log(operate)
  103. this.checkData.operate = operate
  104. if (this.idList.length !== 0) {
  105. //批量
  106. this.buttonLoading = true
  107. batchOperation(this.idList.join(","), operate, this.form.auditMsg).then(res => {
  108. if (res.data.success) {
  109. this.$message.success("操作成功!")
  110. this.$emit("operationType")
  111. }
  112. }).finally(() => {
  113. this.buttonLoading = false
  114. })
  115. } else {
  116. //单个
  117. this.buttonLoading = true
  118. this.checkData.auditName = this.form.auditName
  119. this.checkData.auditMsg = this.form.auditMsg
  120. this.checkData.auditOpTime = this.form.auditOpTime
  121. if (this.checkData.checkType === "YPJ-XSJH" && operate === 1) {
  122. offset({ id: this.checkData.billId }).then(res => {
  123. if (res.data.data == '操作成功') {
  124. this.checkData = this.detailData.check;
  125. this.checkDialog = true;
  126. } else {
  127. this.$confirm(res.data.data, {
  128. confirmButtonText: "确定",
  129. cancelButtonText: "取消",
  130. type: "warning"
  131. }).then(() => {
  132. approvePass(this.checkData).then(res => {
  133. if (res.data.success) {
  134. this.$message.success("操作成功!")
  135. this.$emit("choceCheckFun")
  136. }
  137. if (!this.checkDetail) {
  138. //关闭付费申请页面
  139. let tag = this.$store.getters.tagList.filter(ele => ele.label === "付费申请")[0]
  140. this.$store.commit('DEL_TAG', tag)
  141. this.$store.commit("PQ_OUT_DETAIL");
  142. let tag1 = this.$store.getters.tagList.filter(ele => ele.label === "审批数据")[0]
  143. this.$store.commit('DEL_TAG', tag1)
  144. this.$router.push({
  145. path: "/approveData/index",
  146. query: { check: 'refresh' },
  147. });
  148. }
  149. }).finally(() => {
  150. this.buttonLoading = false
  151. })
  152. }).catch(() => {
  153. this.buttonLoading = false
  154. })
  155. }
  156. }).catch(() => {
  157. this.buttonLoading = false
  158. })
  159. } else {
  160. approvePass(this.checkData).then(res => {
  161. if (res.data.success) {
  162. this.$message.success("操作成功!")
  163. this.$emit("choceCheckFun")
  164. }
  165. if (!this.checkDetail) {
  166. //关闭付费申请页面
  167. let tag = this.$store.getters.tagList.filter(ele => ele.label === "付费申请")[0]
  168. this.$store.commit('DEL_TAG', tag)
  169. this.$store.commit("PQ_OUT_DETAIL");
  170. let tag1 = this.$store.getters.tagList.filter(ele => ele.label === "审批数据")[0]
  171. this.$store.commit('DEL_TAG', tag1)
  172. this.$router.push({
  173. path: "/approveData/index",
  174. query: { check: 'refresh' },
  175. });
  176. }
  177. }).finally(() => {
  178. this.buttonLoading = false
  179. })
  180. }
  181. }
  182. })
  183. }
  184. }
  185. }
  186. </script>
  187. <style lang="scss" scoped>
  188. .trading-form ::v-deep .el-form-item {
  189. margin-bottom: 8px !important;
  190. }
  191. </style>