teamDetailedList.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. <template>
  2. <div class="">
  3. <!-- m-container -->
  4. <!-- <h2>
  5. <el-page-header @back="onCancel"
  6. content="发放清单"></el-page-header>
  7. </h2> -->
  8. <!-- <div class="headWrap">
  9. <div class="left">
  10. <div class="headItem">
  11. <p>乐团名称:<span>12345</span></p>
  12. </div>
  13. <div class="headItem">
  14. <p>生成时间:<span>12345</span></p>
  15. </div>
  16. <div class="headItem">
  17. <p>确认人:<span>12345</span></p>
  18. </div>
  19. </div>
  20. <div class="right">
  21. </div>
  22. </div> -->
  23. <div class="m-core">
  24. <div class="tableWrap">
  25. <el-table
  26. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  27. :data="tableList"
  28. >
  29. <el-table-column label="商品编号" prop="sn" align="center">
  30. </el-table-column>
  31. <el-table-column label="商品名称" align="center" prop="name">
  32. </el-table-column>
  33. <el-table-column label="商品类型" align="center" prop="type">
  34. <template slot-scope="scope">
  35. <div>
  36. {{ scope.row.type | shopType }}
  37. </div>
  38. </template>
  39. </el-table-column>
  40. <el-table-column label="具体型号" align="center" prop="specification">
  41. </el-table-column>
  42. <el-table-column label="数量统计" align="center" prop="sellCount">
  43. </el-table-column>
  44. </el-table>
  45. </div>
  46. </div>
  47. <div class="btnWrap" style="margin-top: 20px">
  48. <el-button
  49. type="primary"
  50. v-if="tableList.length > 0"
  51. v-permission="'order/musicalListExport'"
  52. @click="musicalListExport"
  53. >订货清单导出</el-button
  54. >
  55. <el-button
  56. type="primary"
  57. v-if="tableList.length > 0"
  58. v-permission="'order/musicalListDetailExport'"
  59. @click="musicalListDetailExport"
  60. >分发清单导出</el-button
  61. >
  62. <el-button
  63. type="warning okBtn"
  64. v-if="team_status == 'PREPARE'&&!hasVerifyMusicalList"
  65. v-permission="'order/verifyMusicalList'"
  66. @click="okDetailList"
  67. >确认</el-button
  68. >
  69. <!-- <div class="okBtn" v-permission="'order/verifyMusicalList'"
  70. @click="okDetailList">确认</div> -->
  71. </div>
  72. </div>
  73. </template>
  74. <script>
  75. import { getTeamDetailList } from "@/api/buildTeam";
  76. import { getTeamList } from "@/api/teamServer";
  77. import { verifyMusicalList } from "@/api/orderManager";
  78. import axios from "axios";
  79. import qs from "qs";
  80. import { getToken } from "@/utils/auth";
  81. import load from "@/utils/loading";
  82. export default {
  83. data() {
  84. return {
  85. teamid: "",
  86. tableList: [],
  87. Fsearch: null,
  88. Frules: null,
  89. team_status: "",
  90. hasVerifyMusicalList:true
  91. };
  92. },
  93. mounted() {
  94. this.init();
  95. },
  96. activated() {
  97. this.init();
  98. },
  99. methods: {
  100. init() {
  101. this.team_status = this.$route.query.team_status;
  102. this.teamid = this.$route.query.id;
  103. if (this.teamid) {
  104. getTeamList({ musicGroupId: this.teamid }).then(res=>{
  105. if(res.code == 200){
  106. this.hasVerifyMusicalList = res?.data?.rows[0]?.hasVerifyMusicalList
  107. }
  108. })
  109. getTeamDetailList({ musicGroupId: this.teamid }).then((res) => {
  110. if (res.code == 200) {
  111. this.tableList = res.data ? res.data : [];
  112. }
  113. });
  114. }
  115. },
  116. onCancel() {
  117. this.$store.dispatch("delVisitedViews", this.$route);
  118. this.$router.push({ path: "/teamList" });
  119. },
  120. okDetailList() {
  121. this.$confirm(`是否确认发放清单?`, "提示", {
  122. confirmButtonText: "确定",
  123. cancelButtonText: "取消",
  124. type: "warning",
  125. })
  126. .then(() => {
  127. verifyMusicalList({ musicGroupId: this.teamid }).then((res) => {
  128. if (res.code == 200) {
  129. this.$router.push({
  130. path: "/teamList",
  131. query: { search: this.Fsearch, rules: this.Frules },
  132. });
  133. }
  134. });
  135. })
  136. .catch(() => {});
  137. },
  138. musicalListExport() {
  139. // 报表导出
  140. let url = "/api-web/order/musicalListExport";
  141. let data = {
  142. musicGroupId: this.$route.query.id,
  143. };
  144. const options = {
  145. method: "POST",
  146. headers: {
  147. Authorization: getToken(),
  148. },
  149. data: qs.stringify(data),
  150. url,
  151. responseType: "blob",
  152. };
  153. this.$confirm("您确定导出订货清单", "提示", {
  154. confirmButtonText: "确定",
  155. cancelButtonText: "取消",
  156. type: "warning",
  157. })
  158. .then(() => {
  159. load.startLoading();
  160. axios(options)
  161. .then((res) => {
  162. let blob = new Blob([res.data], {
  163. // type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
  164. type: "application/vnd.ms-excel;charset=utf-8",
  165. //word文档为application/msword,pdf文档为application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
  166. });
  167. let text = new Response(blob).text();
  168. text.then((res) => {
  169. // 判断是否报错
  170. if (res.indexOf("code") != -1) {
  171. let json = JSON.parse(res);
  172. this.$message.error(json.msg);
  173. } else {
  174. let objectUrl = URL.createObjectURL(blob);
  175. let link = document.createElement("a");
  176. let nowTime = new Date();
  177. let ymd =
  178. nowTime.getFullYear() +
  179. "" +
  180. (nowTime.getMonth() + 1) +
  181. "" +
  182. nowTime.getDate() +
  183. "" +
  184. nowTime.getHours() +
  185. "" +
  186. nowTime.getMinutes();
  187. let fname = this.$route.query.id + "-" + ymd + "订货清单.xls"; //下载文件的名字
  188. link.href = objectUrl;
  189. link.setAttribute("download", fname);
  190. document.body.appendChild(link);
  191. link.click();
  192. }
  193. });
  194. load.endLoading();
  195. })
  196. .catch((error) => {
  197. this.$message.error("导出数据失败,请联系管理员");
  198. load.endLoading();
  199. });
  200. })
  201. .catch(() => {});
  202. },
  203. musicalListDetailExport() {
  204. // 报表导出
  205. let url = "/api-web/order/musicalListDetailExport";
  206. let data = {
  207. musicGroupId: this.$route.query.id,
  208. };
  209. const options = {
  210. method: "POST",
  211. headers: {
  212. Authorization: getToken(),
  213. },
  214. data: qs.stringify(data),
  215. url,
  216. responseType: "blob",
  217. };
  218. this.$confirm("您确定导出分发清单", "提示", {
  219. confirmButtonText: "确定",
  220. cancelButtonText: "取消",
  221. type: "warning",
  222. })
  223. .then(() => {
  224. load.startLoading();
  225. axios(options)
  226. .then((res) => {
  227. let blob = new Blob([res.data], {
  228. // type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
  229. type: "application/vnd.ms-excel;charset=utf-8",
  230. //word文档为application/msword,pdf文档为application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
  231. });
  232. let text = new Response(blob).text();
  233. text.then((res) => {
  234. // 判断是否报错
  235. if (res.indexOf("code") != -1) {
  236. let json = JSON.parse(res);
  237. this.$message.error(json.msg);
  238. } else {
  239. let objectUrl = URL.createObjectURL(blob);
  240. let link = document.createElement("a");
  241. let nowTime = new Date();
  242. let ymd =
  243. nowTime.getFullYear() +
  244. "" +
  245. (nowTime.getMonth() + 1) +
  246. "" +
  247. nowTime.getDate() +
  248. "" +
  249. nowTime.getHours() +
  250. "" +
  251. nowTime.getMinutes();
  252. let fname = this.$route.query.id + "-" + ymd + "分发清单.xls"; //下载文件的名字
  253. link.href = objectUrl;
  254. link.setAttribute("download", fname);
  255. document.body.appendChild(link);
  256. link.click();
  257. }
  258. });
  259. load.endLoading();
  260. })
  261. .catch((error) => {
  262. this.$message.error("导出数据失败,请联系管理员");
  263. load.endLoading();
  264. });
  265. })
  266. .catch(() => {});
  267. },
  268. },
  269. };
  270. </script>
  271. <style lang="scss">
  272. </style>