baseInfo.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  1. <template>
  2. <div class='basea-container'>
  3. <div class="baseTop">
  4. <div class="left">
  5. <el-form :inline="true"
  6. :model="topForm">
  7. <el-form-item label="乐团编号">
  8. <el-input v-model.trim="topForm.num"
  9. disabled></el-input>
  10. </el-form-item>
  11. <el-form-item label="教务老师">
  12. <el-input v-model.trim="topForm.teacher"
  13. disabled></el-input>
  14. <!-- <el-select>
  15. <el-option label="啦啦啦"
  16. value="1"></el-option>
  17. </el-select> -->
  18. </el-form-item>
  19. <el-form-item label="所属分部">
  20. <el-input v-model.trim="topForm.section"
  21. disabled></el-input>
  22. <!-- <el-select v-model.trim="topForm.section">
  23. <el-option label="啦啦啦"
  24. value="1"></el-option>
  25. </el-select> -->
  26. </el-form-item>
  27. <el-form-item label="乐队指导">
  28. <el-input v-model.trim="topForm.boss"
  29. disabled></el-input>
  30. <!-- <el-select v-model.trim="topForm.boss">
  31. <el-option label="啦啦啦"
  32. value="1"></el-option>
  33. </el-select> -->
  34. </el-form-item>
  35. <el-form-item label="合作单位">
  36. <el-input v-model.trim="topForm.cooperate"
  37. disabled></el-input>
  38. <!-- <el-select v-model.trim="topForm.cooperate">
  39. <el-option label="啦啦啦"
  40. value="1"></el-option>
  41. </el-select> -->
  42. </el-form-item>
  43. <el-form-item label="上课地点">
  44. <el-input v-model.trim="topForm.add"
  45. disabled
  46. style="width:370px;"></el-input>
  47. </el-form-item>
  48. <el-form-item label="收费类型">
  49. <el-input v-model.trim="topForm.type"
  50. disabled></el-input>
  51. <!-- <el-select v-model.trim="topForm.type">
  52. <el-option label="啦啦啦"
  53. value="1"></el-option>
  54. </el-select> -->
  55. </el-form-item>
  56. <!-- <el-form-item label="课酬结算标准">
  57. <el-select v-model.trim="topForm.salary">
  58. <el-option label="课时默认结算"
  59. value="TEACHER_DEFAULT"></el-option>
  60. <el-option label="课时梯度结算"
  61. value="GRADIENT_SALARY"></el-option>
  62. </el-select>
  63. </el-form-item> -->
  64. </el-form>
  65. <el-button type="text"
  66. v-permission="'order/musicalListExport'"
  67. @click="musicalListExport">发放清单导出</el-button>
  68. <el-button type="text"
  69. v-permission="'order/musicalListDetailExport'"
  70. @click="musicalListDetailExport">分发清单导出</el-button>
  71. </div>
  72. <div class="right">
  73. <ul>
  74. <li v-for="(item,index) in processList"
  75. :key='index'>{{ item.createTime}} {{ item.realName }} {{item.event}}</li>
  76. </ul>
  77. </div>
  78. </div>
  79. <!-- <div class="baseBottom">
  80. <div class="qrcode code"
  81. ref="qrCodeUrl"></div>
  82. <a href="#">www.baidu.com</a>
  83. </div> -->
  84. </div>
  85. </template>
  86. <script>
  87. import {
  88. getMusicGroup,
  89. getMusicGroupProcess
  90. } from '@/api/buildTeam'
  91. import QRCode from 'qrcodejs2'
  92. import axios from 'axios'
  93. import qs from 'qs'
  94. import {
  95. getToken
  96. } from '@/utils/auth'
  97. import load from '@/utils/loading'
  98. export default {
  99. name: "tbaseInfo",
  100. props: ['teamid'],
  101. data () {
  102. return {
  103. id: '',
  104. topForm: {
  105. num: '',
  106. teacher: '',
  107. section: '',
  108. boss: '',
  109. cooperate: '',
  110. add: '',
  111. type: '',
  112. salary: ''
  113. },
  114. name: '',
  115. processList: []
  116. }
  117. },
  118. created () {
  119. // 获取乐团基本信息
  120. // let teamid = '191014135135001';
  121. // this.creatQrCode();
  122. this.init()
  123. },
  124. activated () {
  125. this.init()
  126. },
  127. methods: {
  128. init () {
  129. getMusicGroup({
  130. musicGroupId: this.teamid
  131. }).then(res => {
  132. if (res.code == 200) {
  133. this.topForm.num = res.data.id;
  134. // this.topForm.teacher = res.data.teamTeacherName;
  135. this.topForm.teacher = res.data.educationalTeacherName;
  136. this.topForm.boss = res.data.directorUserName;
  137. this.topForm.cooperate = res.data.schoolName;
  138. this.topForm.type = res.data.chargeTypeName;
  139. this.topForm.section = res.data.organName;
  140. this.topForm.add = res.data.address
  141. // 差上课地点
  142. this.$emit('getname', res.data.name)
  143. }
  144. })
  145. // 根据乐团id获取乐团流程
  146. getMusicGroupProcess({
  147. musicGroupId: this.teamid
  148. }).then(res => {
  149. if (res.code == 200) {
  150. this.processList = res.data;
  151. }
  152. })
  153. },
  154. creatQrCode () {
  155. var qrcode = new QRCode(this.$refs.qrCodeUrl, {
  156. text: 'http://www.baidu.com',
  157. width: 300,
  158. height: 300,
  159. colorDark: '#000000',
  160. colorLight: '#ffffff',
  161. correctLevel: QRCode.CorrectLevel.H
  162. })
  163. },
  164. musicalListExport () { // 报表导出
  165. let url = '/api-web/order/musicalListExport'
  166. let data = {
  167. musicGroupId: this.$route.query.id,
  168. }
  169. const options = {
  170. method: 'POST',
  171. headers: {
  172. 'Authorization': getToken()
  173. },
  174. data: qs.stringify(data),
  175. url,
  176. responseType: 'blob'
  177. }
  178. this.$confirm('您确定导出发放清单', '提示', {
  179. confirmButtonText: '确定',
  180. cancelButtonText: '取消',
  181. type: 'warning'
  182. }).then(() => {
  183. load.startLoading()
  184. axios(options).then(res => {
  185. let blob = new Blob([res.data], {
  186. // type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
  187. type: 'application/vnd.ms-excel;charset=utf-8'
  188. //word文档为application/msword,pdf文档为application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
  189. })
  190. let text = (new Response(blob)).text()
  191. text.then(res => {
  192. // 判断是否报错
  193. if(res.indexOf('code') != -1) {
  194. let json = JSON.parse(res)
  195. this.$message.error(json.msg)
  196. } else {
  197. let objectUrl = URL.createObjectURL(blob)
  198. let link = document.createElement("a")
  199. let nowTime = new Date()
  200. let ymd = nowTime.getFullYear() + '' + (nowTime.getMonth() + 1) + '' + nowTime.getDate() + '' +
  201. nowTime.getHours() +
  202. '' + nowTime.getMinutes()
  203. let fname = this.$route.query.id + '-' + ymd + '发放清单' //下载文件的名字
  204. link.href = objectUrl
  205. link.setAttribute("download", fname)
  206. document.body.appendChild(link)
  207. link.click()
  208. }
  209. })
  210. load.endLoading();
  211. }).catch(error => {
  212. this.$message.error('导出数据失败,请连接管理员');
  213. load.endLoading();
  214. })
  215. }).catch(() => { })
  216. },
  217. musicalListDetailExport () { // 报表导出
  218. let url = '/api-web/order/musicalListDetailExport'
  219. let data = {
  220. musicGroupId: this.$route.query.id
  221. }
  222. const options = {
  223. method: 'POST',
  224. headers: {
  225. 'Authorization': getToken()
  226. },
  227. data: qs.stringify(data),
  228. url,
  229. responseType: 'blob'
  230. }
  231. this.$confirm('您确定导出分发清单', '提示', {
  232. confirmButtonText: '确定',
  233. cancelButtonText: '取消',
  234. type: 'warning'
  235. }).then(() => {
  236. load.startLoading()
  237. axios(options).then(res => {
  238. let blob = new Blob([res.data], {
  239. // type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
  240. type: 'application/vnd.ms-excel;charset=utf-8'
  241. //word文档为application/msword,pdf文档为application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
  242. })
  243. let text = (new Response(blob)).text()
  244. text.then(res => {
  245. // 判断是否报错
  246. if(res.indexOf('code') != -1) {
  247. let json = JSON.parse(res)
  248. this.$message.error(json.msg)
  249. } else {
  250. let objectUrl = URL.createObjectURL(blob)
  251. let link = document.createElement("a")
  252. let nowTime = new Date()
  253. let ymd = nowTime.getFullYear() + '' + (nowTime.getMonth() + 1) + '' + nowTime.getDate() + '' +
  254. nowTime.getHours() +
  255. '' + nowTime.getMinutes()
  256. let fname = this.$route.query.id + '-' + ymd + '分发清单' //下载文件的名字
  257. link.href = objectUrl
  258. link.setAttribute("download", fname)
  259. document.body.appendChild(link)
  260. link.click()
  261. }
  262. })
  263. load.endLoading();
  264. }).catch(error => {
  265. this.$message.error('导出数据失败,请连接管理员');
  266. load.endLoading();
  267. })
  268. }).catch(() => { })
  269. }
  270. },
  271. }
  272. </script>
  273. <style lang="scss" scope>
  274. .basea-container {
  275. margin-top: 35px;
  276. .baseTop {
  277. display: flex;
  278. flex-direction: row;
  279. justify-content: space-between;
  280. .left {
  281. max-width: 750px;
  282. .el-select {
  283. width: 180px !important;
  284. }
  285. }
  286. .right {
  287. height: 40vh;
  288. overflow: scroll;
  289. ul {
  290. li {
  291. list-style: none;
  292. line-height: 22px;
  293. font-size: 14px;
  294. color: #aaa;
  295. }
  296. }
  297. &::-webkit-scrollbar {
  298. display: none;
  299. }
  300. }
  301. }
  302. .baseBottom {
  303. margin-top: 40px;
  304. display: flex;
  305. flex-direction: column;
  306. justify-content: center;
  307. align-items: center;
  308. .code {
  309. width: 300px;
  310. height: 300px;
  311. background-color: red;
  312. margin-bottom: 20px;
  313. }
  314. .btnList {
  315. width: 300px;
  316. display: flex;
  317. flex-direction: row;
  318. justify-content: space-between;
  319. margin-top: 60px;
  320. div {
  321. cursor: pointer;
  322. width: 120px;
  323. height: 40px;
  324. line-height: 40px;
  325. border-radius: 4px;
  326. color: #fff;
  327. text-align: center;
  328. }
  329. .closeBtn {
  330. background-color: #777;
  331. }
  332. .okBtn {
  333. background-color: #f97215;
  334. }
  335. }
  336. }
  337. }
  338. </style>