detail.vue 6.2 KB

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