teamDetailedList.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  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.$store.dispatch("delVisitedViews", this.$route);
  130. this.$router.push({
  131. path: "/teamList",
  132. query: { search: this.Fsearch, rules: this.Frules },
  133. });
  134. }
  135. });
  136. })
  137. .catch(() => {});
  138. },
  139. musicalListExport() {
  140. // 报表导出
  141. let url = "/api-web/order/musicalListExport";
  142. let data = {
  143. musicGroupId: this.$route.query.id,
  144. };
  145. const options = {
  146. method: "POST",
  147. headers: {
  148. Authorization: getToken(),
  149. },
  150. data: qs.stringify(data),
  151. url,
  152. responseType: "blob",
  153. };
  154. this.$confirm("您确定导出订货清单", "提示", {
  155. confirmButtonText: "确定",
  156. cancelButtonText: "取消",
  157. type: "warning",
  158. })
  159. .then(() => {
  160. load.startLoading();
  161. axios(options)
  162. .then((res) => {
  163. let blob = new Blob([res.data], {
  164. // type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
  165. type: "application/vnd.ms-excel;charset=utf-8",
  166. //word文档为application/msword,pdf文档为application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
  167. });
  168. let text = new Response(blob).text();
  169. text.then((res) => {
  170. // 判断是否报错
  171. if (res.indexOf("code") != -1) {
  172. let json = JSON.parse(res);
  173. this.$message.error(json.msg);
  174. } else {
  175. let objectUrl = URL.createObjectURL(blob);
  176. let link = document.createElement("a");
  177. let nowTime = new Date();
  178. let ymd =
  179. nowTime.getFullYear() +
  180. "" +
  181. (nowTime.getMonth() + 1) +
  182. "" +
  183. nowTime.getDate() +
  184. "" +
  185. nowTime.getHours() +
  186. "" +
  187. nowTime.getMinutes();
  188. let fname = this.$route.query.id + "-" + ymd + "订货清单.xls"; //下载文件的名字
  189. link.href = objectUrl;
  190. link.setAttribute("download", fname);
  191. document.body.appendChild(link);
  192. link.click();
  193. }
  194. });
  195. load.endLoading();
  196. })
  197. .catch((error) => {
  198. this.$message.error("导出数据失败,请联系管理员");
  199. load.endLoading();
  200. });
  201. })
  202. .catch(() => {});
  203. },
  204. musicalListDetailExport() {
  205. // 报表导出
  206. let url = "/api-web/order/musicalListDetailExport";
  207. let data = {
  208. musicGroupId: this.$route.query.id,
  209. };
  210. const options = {
  211. method: "POST",
  212. headers: {
  213. Authorization: getToken(),
  214. },
  215. data: qs.stringify(data),
  216. url,
  217. responseType: "blob",
  218. };
  219. this.$confirm("您确定导出分发清单", "提示", {
  220. confirmButtonText: "确定",
  221. cancelButtonText: "取消",
  222. type: "warning",
  223. })
  224. .then(() => {
  225. load.startLoading();
  226. axios(options)
  227. .then((res) => {
  228. let blob = new Blob([res.data], {
  229. // type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
  230. type: "application/vnd.ms-excel;charset=utf-8",
  231. //word文档为application/msword,pdf文档为application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
  232. });
  233. let text = new Response(blob).text();
  234. text.then((res) => {
  235. // 判断是否报错
  236. if (res.indexOf("code") != -1) {
  237. let json = JSON.parse(res);
  238. this.$message.error(json.msg);
  239. } else {
  240. let objectUrl = URL.createObjectURL(blob);
  241. let link = document.createElement("a");
  242. let nowTime = new Date();
  243. let ymd =
  244. nowTime.getFullYear() +
  245. "" +
  246. (nowTime.getMonth() + 1) +
  247. "" +
  248. nowTime.getDate() +
  249. "" +
  250. nowTime.getHours() +
  251. "" +
  252. nowTime.getMinutes();
  253. let fname = this.$route.query.id + "-" + ymd + "分发清单.xls"; //下载文件的名字
  254. link.href = objectUrl;
  255. link.setAttribute("download", fname);
  256. document.body.appendChild(link);
  257. link.click();
  258. }
  259. });
  260. load.endLoading();
  261. })
  262. .catch((error) => {
  263. this.$message.error("导出数据失败,请联系管理员");
  264. load.endLoading();
  265. });
  266. })
  267. .catch(() => {});
  268. },
  269. },
  270. };
  271. </script>
  272. <style lang="scss">
  273. </style>