endTeamList.vue 11 KB

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