detail.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <template>
  2. <div class="activeDetail">
  3. <div
  4. class="activeDetail-main"
  5. v-if="powers && powers.length > 0 && powers.some((item) => item == '007')"
  6. >
  7. <el-tabs v-model="activeTabs">
  8. <el-tab-pane label="新建商品" name="0" v-if="queryType === 'add'">
  9. <base-form
  10. v-if="newTime !== ''"
  11. :type="queryType"
  12. :id="queryId"
  13. :newTime="newTime"
  14. :sitem="sitem"
  15. @refresh="refresh"
  16. />
  17. </el-tab-pane>
  18. <el-tab-pane label="商品详情" name="1" v-if="queryType !== 'add'">
  19. <!-- <el-collapse v-model="activeNames" style="margin: -18px 0 0 0">
  20. <el-collapse-item title="商品详情" name="0"> -->
  21. <base-form
  22. v-if="newTime !== ''"
  23. :type="queryType"
  24. :id="queryId"
  25. :newTime="newTime"
  26. :sitem="sitem"
  27. @refresh="refresh"
  28. />
  29. <!-- </el-collapse-item> -->
  30. <!-- <el-collapse-item title="采购部门审批" name="1">
  31. <exam-form
  32. :statusList="statusList"
  33. :newTime="newTime"
  34. :disabled="false"
  35. :isMust="false"
  36. @searchChange="examForm"
  37. />
  38. 123 </el-collapse-item> -->
  39. <!-- </el-collapse> -->
  40. </el-tab-pane>
  41. <!-- <el-tab-pane label="审批记录" name="2" v-if="queryType !== 'add'">
  42. 111
  43. </el-tab-pane> -->
  44. </el-tabs>
  45. </div>
  46. <div v-else>
  47. <no-auth></no-auth>
  48. </div>
  49. </div>
  50. </template>
  51. <script>
  52. import asyncRequest from "@/apis/service/goodStore/active";
  53. import resToken from "@/mixins/resToken";
  54. import { mapGetters } from "vuex";
  55. import baseForm from "./components/baseForm";
  56. export default {
  57. name: "activeDetail",
  58. mixins: [resToken],
  59. components: {
  60. baseForm,
  61. },
  62. computed: {
  63. ...mapGetters(["tablebtnSize", "searchSize", "size"]),
  64. powers() {
  65. let tran =
  66. this.$store.getters.btnList.find(
  67. (item) => item.menu_route == "activeDetail"
  68. ) || {};
  69. if (tran && tran.action && tran.action.length > 0) {
  70. return tran.action;
  71. } else {
  72. return [];
  73. }
  74. },
  75. },
  76. data() {
  77. return {
  78. statusList: [],
  79. size: "small",
  80. activeTabs: "1",
  81. activeNames: ["0", "1"],
  82. newTime: "",
  83. loading: false,
  84. queryType: "",
  85. queryId: "",
  86. status: "",
  87. sitem: null,
  88. };
  89. },
  90. mounted() {
  91. this.initForm();
  92. },
  93. methods: {
  94. async initForm() {
  95. const { id, type } = this.$route.query;
  96. this.queryId = id;
  97. this.queryType = type;
  98. this.activeTabs = type === "add" ? "0" : "1";
  99. this.loading = true;
  100. if (this.queryType === "add") {
  101. this.sitem = {};
  102. this.getNewTime();
  103. } else {
  104. await this.initData();
  105. }
  106. this.loading = false;
  107. },
  108. // 点击业务审核的保存按钮
  109. async examForm(e) {
  110. console.log(e);
  111. if (!this.loading) {
  112. let type = e.state === "1" ? "1" : e.rebut;
  113. await this.setstatus(type, "提交采购部门审核", e.remark);
  114. }
  115. },
  116. async setstatus(type, detail, remark) {
  117. await this.$confirm(`确定要${detail}?`, {
  118. confirmButtonText: "确定",
  119. cancelButtonText: "取消",
  120. type: "warning",
  121. })
  122. .then(async () => {
  123. let _model = {
  124. spuCode: this.queryId,
  125. status: type,
  126. remark: remark,
  127. };
  128. let res = await asyncRequest.status(_model);
  129. if (res && res.code === 0) {
  130. this.$notify.success({
  131. title: "提交成功!",
  132. message: "",
  133. });
  134. await this.initForm();
  135. } else if (res && res.code >= 100 && res.code <= 104) {
  136. await this.logout();
  137. } else {
  138. this.$message.warning(res.message);
  139. }
  140. })
  141. .catch(() => {
  142. console.log("取消");
  143. });
  144. },
  145. handleClick(row) {
  146. console.log(row);
  147. },
  148. refresh(e) {
  149. const { spuCode } = e;
  150. let model = {
  151. id: this.queryType === "add" ? spuCode : this.queryId,
  152. type: "view",
  153. };
  154. this.routeReGoto("activeDetail", model);
  155. },
  156. async initData() {
  157. this.loading = true;
  158. const { code, message, data } = await asyncRequest.detail({
  159. id: this.queryId,
  160. });
  161. this.loading = false;
  162. if (code === 0) {
  163. this.sitem = JSON.parse(JSON.stringify(data));
  164. const { status } = this.sitem;
  165. this.status = status;
  166. this.getNewTime();
  167. } else if (code >= 100 && code <= 104) {
  168. await this.logout();
  169. } else {
  170. this.$message.warning(message);
  171. }
  172. },
  173. getNewTime() {
  174. this.newTime = new Date().valueOf();
  175. },
  176. },
  177. };
  178. </script>
  179. <style lang="scss" scoped>
  180. .activeDetail {
  181. position: relative;
  182. height: 100%;
  183. width: 100%;
  184. box-sizing: border-box;
  185. .activeDetail-main {
  186. overflow-y: scroll;
  187. position: relative;
  188. padding: 10px;
  189. height: 100%;
  190. width: 100%;
  191. }
  192. .activeDetail-title {
  193. border-top: 1px solid #ebeef5;
  194. span {
  195. height: 50px;
  196. line-height: 50px;
  197. font-family: "微软雅黑", sans-serif;
  198. font-weight: 400;
  199. font-style: normal;
  200. font-size: 16fpx;
  201. text-align: left;
  202. }
  203. }
  204. /deep/ .ddiv {
  205. border-top: 1px solid #dcdfe6;
  206. }
  207. /deep/ .dtitle {
  208. width: 40px;
  209. text-align: center;
  210. height: 100%;
  211. min-height: 100%;
  212. ul {
  213. padding: 12px 0 0 0;
  214. }
  215. }
  216. /deep/ .dmain {
  217. padding: 20px 0 0 0;
  218. width: calc(100% - 40px);
  219. border-left: 1px solid #dcdfe6;
  220. }
  221. }
  222. </style>