startApproval.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <template>
  2. <el-dialog
  3. :title="'审批'"
  4. :close-on-click-modal="false"
  5. :before-close="closeDialog"
  6. :visible.sync="visible"
  7. :append-to-body="true"
  8. :modal="false"
  9. width="55%"
  10. >
  11. <el-form v-model="dataForm" :inline="true">
  12. <div class="form-group dialog">
  13. <el-form-item class="full" label="审批意见" prop="auditMsg">
  14. <el-input
  15. type="textarea"
  16. placeholder="审批意见"
  17. v-model="dataForm.auditMsg"
  18. ></el-input>
  19. </el-form-item>
  20. <el-form-item label="审批人" class="full" prop="auditUserId">
  21. <el-select
  22. v-model="dataForm.auditUserId"
  23. disabled
  24. placeholder="审批人"
  25. style="width: 100%"
  26. >
  27. <el-option
  28. v-for="item in optionsBranch"
  29. :key="item.userId"
  30. :label="item.userName"
  31. :value="item.userId"
  32. >
  33. </el-option>
  34. </el-select>
  35. </el-form-item>
  36. <el-form-item disabled label="审批日期">
  37. <el-date-picker
  38. v-model="dataForm.auditItem"
  39. size="large"
  40. type="date"
  41. value-format="timestamp"
  42. placeholder="审批日期"
  43. >
  44. </el-date-picker>
  45. </el-form-item>
  46. </div>
  47. </el-form>
  48. <span slot="footer" class="dialog-footer">
  49. <el-button @click="closeDia">关闭</el-button>
  50. <el-button @click="approvalRejected" :loading="subLoading">审批驳回</el-button>
  51. <el-button @click="approved" :loading="subLoading">审批通过</el-button>
  52. </span>
  53. </el-dialog>
  54. </template>
  55. <script>
  56. import { listCharge, addMblno } from "@/api/system/startApproval";
  57. import { queryUserVal } from "@/api/warehouseBusiness/agreement";
  58. import Global from "@/layout/components/global";
  59. export default {
  60. name: "startApproval",
  61. data() {
  62. return {
  63. numData: {
  64. fId: null,
  65. fMblno: null,
  66. },
  67. dataForm: {
  68. id: null,
  69. actId: null,
  70. auditMsg: null,
  71. auditUserId: null,
  72. auditItem: null,
  73. refno3: null,
  74. },
  75. visible: false,
  76. optionsBranch: [],
  77. subLoading: false,
  78. };
  79. },
  80. components: {},
  81. methods: {
  82. // changefMblno(fId,fMblno){
  83. // console.log(fId,fMblno)
  84. // this.numData.fId = fId
  85. // this.numData.fMblno = fMblno
  86. // },
  87. init(id, status, actId, fMblno) {
  88. this.optionsBranch = [];
  89. // 默认录入人
  90. queryUserVal().then((response) => {
  91. this.dataForm.auditUserId = response.user.userId;
  92. this.optionsBranch.push(response.user);
  93. });
  94. this.visible = true;
  95. if (typeof id === "undefined" || typeof actId === "undefined") {
  96. this.$message.error("未检测到对应信息,请选择");
  97. return false;
  98. }
  99. this.dataForm.id = id;
  100. this.dataForm.billId = id;
  101. this.dataForm.actId = actId;
  102. this.dataForm.fidStatus = status;
  103. if (fMblno) {
  104. this.dataForm.refno3 = fMblno;
  105. }
  106. this.$set(this.dataForm, "auditItem", Date.parse(new Date()));
  107. },
  108. getTime() {
  109. var date = new Date(this.dataForm.auditItem);
  110. var y = date.getFullYear();
  111. var m =
  112. date.getMonth() + 1 < 10
  113. ? "0" + (date.getMonth() + 1)
  114. : date.getMonth() + 1;
  115. var d = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
  116. this.$set(this.dataForm, "auditItem", y + "-" + m + "-" + d);
  117. },
  118. approved() {
  119. this.$confirm(`是否通过审批?`, "提示", {
  120. confirmButtonText: "确定",
  121. cancelButtonText: "取消",
  122. type: "warning",
  123. })
  124. .then(() => {
  125. this.getTime();
  126. this.subLoading = true;
  127. listCharge(this.dataForm, "/warehouse/paths/approved")
  128. .then((res) => {
  129. if (res.code) {
  130. this.$message({
  131. message: "审核通过",
  132. type: "success",
  133. duration: 600,
  134. });
  135. this.closeDia();
  136. this.visible = true;
  137. }
  138. })
  139. .finally(() => {
  140. this.subLoading = false;
  141. // this.closeDia();
  142. });
  143. return;
  144. })
  145. // .then((data) => {
  146. // console.log(data);
  147. // if (data && data.code == 200) {
  148. // this.$message({
  149. // message: "审核通过",
  150. // type: "success",
  151. // duration: 600,
  152. // });
  153. // this.closeDia();
  154. // this.visible = true;
  155. // // this.homePage()
  156. // } else {
  157. // this.$message.error(data.msg);
  158. // }
  159. // });
  160. },
  161. // homePage(){
  162. // let view = {
  163. // fullPath: "/finance/charge",
  164. // hash: "",
  165. // matched: Array(2),
  166. // meta: Object,
  167. // name: "Charge",
  168. // params: Object,
  169. // path: "/finance/charge",
  170. // query: Object,
  171. // title: "收费"
  172. // }
  173. // this.$router.push({ path: '/index'})
  174. // this.$store.dispatch('tagsView/delView', view).then(({ visitedViews }) => {
  175. // if (this.isActive(view)) {
  176. // this.toLastView(visitedViews, view)
  177. // }
  178. // })
  179. // Global.$emit("removeCache", "closeSelectedTag", view);
  180. // },
  181. approvalRejected() {
  182. this.$confirm(`是否驳回审批?`, "提示", {
  183. confirmButtonText: "确定",
  184. cancelButtonText: "取消",
  185. type: "warning",
  186. })
  187. .then(() => {
  188. this.dataForm.createTime = "";
  189. return listCharge(this.dataForm, "/warehouse/paths/approvalRejected");
  190. })
  191. .then((data) => {
  192. if (data && data.code == 200) {
  193. this.$message({
  194. message: "驳回审批",
  195. type: "success",
  196. duration: 600,
  197. // onClose: () => {
  198. // this.closeDia()
  199. // }
  200. });
  201. this.visible = true;
  202. this.closeDia();
  203. // this.homePage()
  204. } else {
  205. this.$message.error(data.msg);
  206. }
  207. });
  208. },
  209. closeDialog(done) {
  210. this.visible = false;
  211. this.$emit("returnApproval", this.dataForm.id, false);
  212. Object.assign(this.$data, this.$options.data.call(this));
  213. },
  214. closeDia() {
  215. this.visible = false;
  216. this.$emit("refreshDataList", this.dataForm.id, false);
  217. Object.assign(this.$data, this.$options.data.call(this));
  218. this.$router.push({path: "/morePage/stock"});
  219. },
  220. },
  221. };
  222. </script>
  223. <style scoped></style>