check.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. <template>
  2. <div>
  3. <!-- <avue-form class="trading-form" :option="option" ref="form" v-model="form"> </avue-form>-->
  4. <div class="dialogButton" :style="{padding: batch ? '16px' : '4px'}">
  5. <el-button v-if="!batch" size="small" :loading="buttonLoading" @click="$emit('gotoRecord', false)">上一笔</el-button>
  6. <el-button v-if="!batch" size="small" :loading="buttonLoading" @click="$emit('gotoRecord', true)">下一笔</el-button>
  7. <el-button v-if="!batch" size="small" :loading="buttonLoading" @click="$emit('choceCheckFun', false)">关闭</el-button>
  8. <el-button type="primary" :loading="buttonLoading" size="small" @click="approved(1)">审批通过</el-button>
  9. <el-button type="warning" :loading="buttonLoading" size="small" @click="submit(2)">审批驳回</el-button>
  10. <el-input
  11. style="width: 16em;margin-left: 1em;margin-right: 1em;"
  12. v-model="form.auditMsg"
  13. size="small"
  14. autocomplete="off"
  15. clearable
  16. placeholder="审批意见"
  17. >
  18. </el-input>
  19. <el-button v-if="batch" size="small" :loading="buttonLoading" @click="$emit('choceCheckFun', false)">关闭</el-button>
  20. </div>
  21. <mail-component ref="mail" @choceCheckFun="$emit('choceCheckFun', true)"></mail-component>
  22. </div>
  23. </template>
  24. <script>
  25. import { approvePass, batchOperation } from "@/api/approveDataH/main";
  26. import { offset } from "@/api/basicData/salesOrder";
  27. import mailComponent from "./component/mail-component.vue";
  28. export default {
  29. components: {
  30. mailComponent
  31. },
  32. name: "check",
  33. props: {
  34. batch:{
  35. type: Boolean,
  36. deburred: true,
  37. },
  38. checkData: {
  39. type: Object
  40. },
  41. choceCheckFun: {
  42. type: Function
  43. },
  44. gotoRecord: {
  45. type: Function
  46. },
  47. checkDetail: {
  48. type: Boolean
  49. },
  50. idList: {
  51. type: Array
  52. },
  53. objMail: {
  54. type: Object
  55. },
  56. },
  57. data() {
  58. return {
  59. form: {},
  60. list: [],
  61. currencyDic: [],
  62. buttonLoading: false,
  63. corpId: "",
  64. option: {
  65. emptyBtn: false,
  66. submitBtn: false,
  67. labelWidth: 120,
  68. menuSpan: 8,
  69. column: [
  70. {
  71. label: "审批人",
  72. prop: "auditName",
  73. span: 24,
  74. disabled: true,
  75. rules: [
  76. {
  77. required: false,
  78. message: " ",
  79. trigger: "blur"
  80. }
  81. ]
  82. },
  83. {
  84. label: "审批日期",
  85. prop: "auditOpTime",
  86. type: "datetime",
  87. span: 24,
  88. disabled: true,
  89. rules: [
  90. {
  91. required: false,
  92. message: " ",
  93. trigger: "blur"
  94. }
  95. ]
  96. },
  97. {
  98. label: "审批意见",
  99. prop: "auditMsg",
  100. type: "textarea",
  101. rows: 5,
  102. span: 24,
  103. rules: [
  104. {
  105. required: false,
  106. message: " ",
  107. trigger: "blur"
  108. }
  109. ]
  110. }
  111. ]
  112. }
  113. };
  114. },
  115. created() {
  116. let date = new Date();
  117. let strDate =
  118. date.getFullYear() +
  119. "-" +
  120. (date.getMonth() + 1) +
  121. "-" +
  122. date.getDate() +
  123. " " +
  124. date.getHours() +
  125. ":" +
  126. date.getMinutes() +
  127. ":" +
  128. date.getSeconds();
  129. this.$set(this.form, "auditOpTime", strDate);
  130. this.$set(this.form, "auditName", this.$store.getters.userInfo.user_name);
  131. },
  132. methods: {
  133. approved(operate) {
  134. if (this.checkData.checkType == "FFSQ") {
  135. this.$refs.mail.openDialog(this.checkData,this.form,this.objMail)
  136. } else {
  137. this.submit(operate);
  138. }
  139. },
  140. submit(operate) {
  141. // this.$confirm("是否确认此操作!", "提示", {
  142. // confirmButtonText: "确认",
  143. // cancelButtonText: "取消",
  144. // type: "warning",
  145. // }).then(() => {
  146. let cacheRow = this.checkData
  147. // console.log('cacheRow', cacheRow);
  148. // this.$emit("choceCheckFun", false, cacheRow);
  149. //
  150. // return
  151. if(operate===1 && !this.form.auditMsg){
  152. this.form.auditMsg = '同意!'
  153. }
  154. this.checkData.operate = operate;
  155. if (this.idList.length !== 0) {
  156. //批量
  157. this.buttonLoading = true;
  158. batchOperation(this.idList.join(","), operate, this.form.auditMsg)
  159. .then(res => {
  160. if (res.data.success) {
  161. this.$message.success("操作成功!");
  162. this.$emit("operationType");
  163. }
  164. })
  165. .finally(() => {
  166. this.buttonLoading = false;
  167. });
  168. } else {
  169. //单个
  170. this.buttonLoading = true;
  171. this.checkData.auditName = this.form.auditName;
  172. this.checkData.auditMsg = this.form.auditMsg;
  173. this.checkData.auditOpTime = this.form.auditOpTime;
  174. if (this.checkData.checkType === "YPJ-XSJH" && operate === 1) {
  175. offset({ id: this.checkData.billId })
  176. .then(res => {
  177. if (res.data.data == "操作成功") {
  178. this.checkData = this.detailData.check;
  179. this.checkDialog = true;
  180. } else {
  181. this.$confirm(res.data.data, {
  182. confirmButtonText: "确定",
  183. cancelButtonText: "取消",
  184. type: "warning"
  185. })
  186. .then(() => {
  187. approvePass(this.checkData)
  188. .then(res => {
  189. if (res.data.success) {
  190. this.$message.success("操作成功!");
  191. this.$emit("choceCheckFun", false, cacheRow);
  192. }
  193. if (!this.checkDetail) {
  194. //关闭付费申请页面
  195. let tag = this.$store.getters.tagList.filter(ele => ele.label === "付费申请")[0];
  196. this.$store.commit("DEL_TAG", tag);
  197. this.$store.commit("PQ_OUT_DETAIL");
  198. let tag1 = this.$store.getters.tagList.filter(ele => ele.label === "审批数据")[0];
  199. this.$store.commit("DEL_TAG", tag1);
  200. this.$router.push({
  201. path: "/approveDataH/index",
  202. });
  203. }
  204. })
  205. .finally(() => {
  206. this.buttonLoading = false;
  207. });
  208. })
  209. .catch(() => {
  210. this.buttonLoading = false;
  211. });
  212. }
  213. })
  214. .catch(() => {
  215. this.buttonLoading = false;
  216. });
  217. } else {
  218. approvePass(this.checkData)
  219. .then(res => {
  220. if (res.data.success) {
  221. this.$message.success("操作成功!");
  222. this.$emit("choceCheckFun", false, cacheRow);
  223. }
  224. if (!this.checkDetail) {
  225. //关闭付费申请页面
  226. let tag = this.$store.getters.tagList.filter(ele => ele.label === "付费申请")[0];
  227. this.$store.commit("DEL_TAG", tag);
  228. this.$store.commit("PQ_OUT_DETAIL");
  229. let tag1 = this.$store.getters.tagList.filter(ele => ele.label === "审批数据")[0];
  230. this.$store.commit("DEL_TAG", tag1);
  231. this.$router.push({
  232. path: "/approveDataH/index"
  233. });
  234. }
  235. })
  236. .finally(() => {
  237. this.buttonLoading = false;
  238. });
  239. }
  240. }
  241. // })
  242. }
  243. }
  244. };
  245. </script>
  246. <style lang="scss" scoped>
  247. .trading-form ::v-deep .el-form-item {
  248. margin-bottom: 8px !important;
  249. }
  250. </style>