Lesson.vue 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893
  1. <template>
  2. <div class="context">
  3. <div class="panel">
  4. <h5>课目管理</h5>
  5. </div>
  6. <div class="change">
  7. <el-button type="primary" @click="addLesson" v-if="userLevel != 4" size="mini">新增课程</el-button>
  8. <el-button @click="lessonStudenChange" v-if="userLevel != 4" size="mini">增删课程会员</el-button>
  9. <el-button type="danger" @click="delList" v-if="userLevel != 4" size="mini">删除</el-button>
  10. <el-button type="success" @click="query" :disabled="serachBtnStatus" size="mini">刷新</el-button>
  11. </div>
  12. <div class="table">
  13. <el-table
  14. :data="tableData"
  15. border
  16. is-horizontal-resize
  17. :default-sort="{prop: 'date', order: 'descending'}"
  18. element-loading-background="rgba(0, 0, 0, 0.8)"
  19. @selection-change="handleSelectionChange"
  20. @current-change="clickChange"
  21. >
  22. >
  23. <el-table-column label="选择" width="55">
  24. <template slot-scope="scope">
  25. <el-radio v-model="tableRadio" :label="scope.row"><i></i></el-radio>
  26. </template>
  27. </el-table-column>
  28. <el-table-column label="序号" type="index" width="50" align="center">
  29. <template scope="scope">
  30. <span>{{(start) + scope.$index + 1}}</span>
  31. </template>
  32. </el-table-column>
  33. <el-table-column
  34. prop="ClassSelf.ClassName"
  35. label="课程名称"
  36. >
  37. </el-table-column>
  38. <el-table-column
  39. prop="ClassSelf.ShopId"
  40. label="是否跨店"
  41. width="110"
  42. align="center"
  43. sortable
  44. >
  45. <template slot-scope="scope">
  46. <span v-if="scope.row.ClassSelf.ShopId != 0">否</span>
  47. <span v-if="scope.row.ClassSelf.ShopId == 0">是</span>
  48. </template>
  49. </el-table-column>
  50. <el-table-column
  51. prop="ClassSelf.ShopId"
  52. label="课程类型"
  53. width="110"
  54. align="center"
  55. sortable
  56. >
  57. <template slot-scope="scope">
  58. <span v-if="scope.row.ClassSelf.ClassType != 0">占用课时</span>
  59. <span v-if="scope.row.ClassSelf.ClassType == 0">不占课时</span>
  60. </template>
  61. </el-table-column>
  62. <el-table-column
  63. prop="ClassSelf.ConsumeHour"
  64. label="消耗课时"
  65. sortable
  66. >
  67. </el-table-column>
  68. <el-table-column
  69. prop="ClassSelf.TopLimit"
  70. label="建议上课人数"
  71. sortable
  72. >
  73. </el-table-column>
  74. <el-table-column
  75. prop="ClassSelf.WxVisible"
  76. label="微信可见"
  77. v-if="userLevel != 4"
  78. >
  79. <template slot-scope="scope">
  80. <el-switch
  81. v-model="scope.row.ClassSelf.WxVisible"
  82. :active-value="1"
  83. :inactive-value="0"
  84. active-color="#409EFF"
  85. inactive-color="#D9D9D9"
  86. @change=changeWechat($event,scope.row.ClassSelf)
  87. >
  88. </el-switch>
  89. </template>
  90. </el-table-column>
  91. <el-table-column
  92. prop="ClassSelf.ClassColor"
  93. label="课程颜色"
  94. width="110"
  95. v-if="userLevel != 4"
  96. >
  97. <template slot-scope="scope">
  98. <el-color-picker :predefine="predefineColors" v-model="scope.row.ClassSelf.ClassColor"
  99. @change="changeColor(scope.row.ClassSelf.ClassColor,scope.row.ClassSelf)"></el-color-picker>
  100. </template>
  101. </el-table-column>
  102. <el-table-column
  103. prop="ClassSelf.Memo"
  104. label="备注">
  105. <template slot-scope="scope">
  106. <el-popover
  107. placement="top"
  108. title="标题"
  109. width="200"
  110. trigger="hover"
  111. :content="scope.row.ClassSelf.Memo">
  112. <span slot="reference"
  113. v-if="scope.row.ClassSelf.Memo.length > 6">{{ scope.row.ClassSelf.Memo.substr(0, 6) }} ....</span>
  114. </el-popover>
  115. <span v-if="scope.row.ClassSelf.Memo.length <= 6">{{ scope.row.ClassSelf.Memo }}</span>
  116. </template>
  117. </el-table-column>
  118. <el-table-column
  119. prop="ClassSelf.ClassId"
  120. label="操作"
  121. width="120px"
  122. >
  123. <template slot-scope="scope">
  124. <el-button type="text" @click="editLesson(scope.row.ClassSelf)" v-if="userLevel != 4">编辑
  125. </el-button>
  126. <el-button type="text" @click="Lessonmember(scope.row.Userlist)">课程会员</el-button>
  127. </template>
  128. </el-table-column>
  129. </el-table>
  130. <br>
  131. <el-pagination
  132. background
  133. :total="pageination.total"
  134. :page-size="pageination.pageItem"
  135. @current-change="pageChange"
  136. ></el-pagination>
  137. </div>
  138. <el-dialog :title="dialogTitle" :visible.sync="dialogLesson" :width="form.btnType == 0? '1200px':'650px'">
  139. <div>
  140. <div class="pull-left">
  141. <el-form ref="form" :model="form" label-width="160px">
  142. <el-form-item label="课程名称" :required="true">
  143. <el-input v-model="form.ClassName"></el-input>
  144. </el-form-item>
  145. <el-form-item label="消耗课时">
  146. <el-input-number v-model="form.ConsumeHour" :min="0" :max="99999"
  147. label="(天)"></el-input-number>
  148. </el-form-item>
  149. <el-form-item label="建议上课人数">
  150. <el-input-number v-model="form.TopLimit" :min="0" :max="99999"
  151. label="(天)"></el-input-number>
  152. </el-form-item>
  153. <el-form-item label="微信可见" v-if="form.btnType == 0">
  154. <el-switch
  155. v-model="form.wxVisible"
  156. :active-value="1"
  157. :inactive-value="0"
  158. active-color="#409EFF"
  159. inactive-color="#D9D9D9">
  160. </el-switch>
  161. </el-form-item>
  162. <el-form-item label="是否可选课">
  163. <el-switch
  164. v-model="form.ClassType"
  165. :active-value="1"
  166. :inactive-value="0"
  167. active-color="#409EFF"
  168. inactive-color="#D9D9D9">
  169. </el-switch>
  170. </el-form-item>
  171. <el-form-item label="是否跨店">
  172. <el-switch
  173. v-model="form.allUse"
  174. :active-value="0"
  175. :inactive-value="1"
  176. active-color="#409EFF"
  177. inactive-color="#D9D9D9"
  178. >
  179. <!--:disabled="true"-->
  180. </el-switch>
  181. </el-form-item>
  182. <el-form-item label="课程颜色">
  183. <el-color-picker :predefine="predefineColors" v-model="form.ClassColor"></el-color-picker>
  184. </el-form-item>
  185. <el-form-item label="备注">
  186. <el-input v-model="form.Memo"></el-input>
  187. </el-form-item>
  188. </el-form>
  189. </div>
  190. <div class="pull-right" v-if="form.btnType == 0">
  191. <el-form ref="form" :model="form" label-width="160px">
  192. <el-form-item label="课程会员">
  193. <el-transfer filterable v-model="form.dialogValue" :data="form.dialogdata"
  194. :titles="['全部会员','已选会员']"></el-transfer>
  195. </el-form-item>
  196. </el-form>
  197. </div>
  198. </div>
  199. <div class="dialogFooter">
  200. <el-button type="primary" size="small" v-if="form.btnType == 0" @click="confirmAddLesson">确定</el-button>
  201. <el-button type="primary" size="small" v-if="form.btnType == 1" @click="confirmEditLesson">确定
  202. </el-button>
  203. <el-button size="small" @click="dialogLesson = false">取消</el-button>
  204. </div>
  205. </el-dialog>
  206. <el-dialog title="增删课程会员" :visible.sync="dialogVisible" width="650px">
  207. <div class="dialogTitle">
  208. <span>基础功能</span>
  209. </div>
  210. <div>
  211. <el-transfer filterable v-model="dialogValue" :data="form.dialogdata"
  212. :titles="['会员列表', '已添加会员']"></el-transfer>
  213. </div>
  214. <div class="dialogFooter">
  215. <el-button type="primary" size="small" @click="cofirmClassVipuserEdit">确定</el-button>
  216. <el-button @click=" dialogVisible = false" size="small">取消</el-button>
  217. </div>
  218. </el-dialog>
  219. <el-dialog title="课程会员" :visible.sync="dialogTableVisible" style="overflow-y: scroll">
  220. <el-table :data="gridData">
  221. <el-table-column property="Name" label="姓名" width="200"></el-table-column>
  222. <el-table-column property="Phone" label="手机"></el-table-column>
  223. <el-table-column property="VipType" label="会员类型">
  224. <template slot-scope="scope">
  225. <span v-if="scope.row.VipType == 1">年费会员</span>
  226. <span v-if="scope.row.VipType == 2">充值会员</span>
  227. </template>
  228. </el-table-column>
  229. <el-table-column property="ExpTime" label="有效期" :formatter="filterFmtDate"></el-table-column>
  230. </el-table>
  231. </el-dialog>
  232. </div>
  233. </template>
  234. <script>
  235. import Global from '../Global.js'
  236. import {
  237. ClassAdd,
  238. ClassEdit,
  239. ClassListQuery,
  240. ClassColorEdit,
  241. ClassStatusEdit,
  242. VipUserListQuery,
  243. ClassVisibleStatusEdit,
  244. ClassVipuserQuery,
  245. ClassVipuserEdit,
  246. testTable,
  247. testSelect
  248. } from "../api/getApiRes";
  249. let qs = require('qs');
  250. export default {
  251. data() {
  252. return {
  253. serachBtnStatus: false,
  254. dialogLesson: false,//新增课程
  255. dialogVisible: false,
  256. dialogTableVisible: false,
  257. dialogTitle: '',
  258. dialogdata: [],
  259. gridData: [],
  260. dialogValue: [],
  261. allTableData: [],
  262. start: 0,
  263. draw: 1,
  264. // panel 配置项目
  265. panel: {
  266. usercode: '',
  267. username: '',
  268. compname: '',
  269. keyword: '',
  270. USERCODE: '',
  271. taskstatus: 99,
  272. tableData: [],
  273. allTableData: [],
  274. draw: 1,
  275. start: 0,
  276. recordsTotal: 0,
  277. limit: '10',
  278. multipleSort: false,
  279. loading: false,
  280. fileList: [],
  281. multipleSelection: [],
  282. detectedmac: '',
  283. options: [
  284. {value: 99, label: '全部'},
  285. {value: 1, label: '进行中'},
  286. {value: 2, label: '已完成'},
  287. ],
  288. time1: globalBt(),
  289. },
  290. form: {
  291. ClassName: "",
  292. ConsumeHour: 0,
  293. TopLimit: 0,
  294. ClassType: 0,
  295. wxVisible: 1,
  296. ClassColor: "#ffffff",
  297. teacherId: "",
  298. classId: "",
  299. allUse: "",
  300. Memo: "",
  301. dialogdata: [],//穿梭待选
  302. dialogValue: [],//穿梭已选
  303. },
  304. multipleSelection: [],
  305. pageination: {
  306. pageItem: 100,
  307. pageoptions: pageOptions(),
  308. total: 100,
  309. pageIndex: 1,
  310. },
  311. tableData: [],
  312. tableRadio: [],
  313. userLevel: localStorage.userLevel,
  314. predefineColors: [
  315. '#8ABFF7',
  316. '#73C1BC',
  317. '#ADE5C7',
  318. '#CBECF0',
  319. '#DCEDC8',
  320. '#EBF2DB',
  321. '#C9D1FD',
  322. '#C6ACF4',
  323. '#E2B5FA',
  324. '#E1BEE7',
  325. '#FFA5D9',
  326. '#F89A9A',
  327. '#F2B1AC',
  328. '#F8BBD0',
  329. '#FFCDD2',
  330. '#FCC66C',
  331. '#D6B9A7',
  332. '#D9D9C4',
  333. '#FCECBE',
  334. '#E9E9E9',
  335. '#FFA5FC',
  336. '#B7BEFF',
  337. '#91E5FF',
  338. '#97FFF8',
  339. '#A7FFB8',
  340. '#75FF65',
  341. '#FFFF94',
  342. '#FFE0AC',
  343. '#FFB770',
  344. '#FFCCB5'
  345. ]
  346. }
  347. },
  348. mounted() {
  349. this.panelSelect();
  350. this.getTableQuery();
  351. },
  352. methods: {
  353. clickChange(item) {
  354. this.tableRadio = item
  355. },
  356. // 课程会员增删
  357. cofirmClassVipuserEdit() {
  358. let that = this;
  359. let userlist = that.dialogValue.toString();
  360. let param = {
  361. token: localStorage.token,
  362. classId: this.form.classId,
  363. userlist: userlist,
  364. };
  365. let postdata = qs.stringify(param);
  366. ClassVipuserEdit(postdata).then(res => {
  367. let json = res;
  368. if (json.Code == 0) {
  369. that.$message({
  370. showClose: true,
  371. message: '接口修改成功!',
  372. type: 'success'
  373. });
  374. that.dialogVisible = false;
  375. that.getTableQuery();
  376. } else {
  377. that.$message.error(json.Memo + ' 错误码:' + json.Code);
  378. }
  379. })
  380. },
  381. // 确认添加课程
  382. confirmAddLesson() {
  383. let that = this;
  384. // checkNum
  385. if (!that.form.ClassName) {
  386. this.$message.error('错了哦,课程名称不能为空');
  387. return false
  388. }
  389. if (that.form.ClassName.length > 8) {
  390. this.$message.error('错了哦,课程名称字数超过8个字');
  391. return false
  392. }
  393. if (that.form.Memo) {
  394. if (that.form.Memo.length > 200) {
  395. this.$message.error('错了哦,备注字数超过200个字');
  396. return false
  397. }
  398. }
  399. // 通用是0,非通用是shopid
  400. let shopId = that.form.allUse == 0 ? 0 : localStorage.ShopId;
  401. let userlist = that.form.dialogValue.toString();
  402. let param = {
  403. token: localStorage.token,
  404. shopId: shopId,
  405. className: that.form.ClassName,
  406. consumeHour: that.form.ConsumeHour,
  407. topLimit: that.form.TopLimit,
  408. classType: that.form.ClassType,
  409. wxVisible: that.form.wxVisible,
  410. classColor: that.form.ClassColor,
  411. userlist: userlist,
  412. teacherId: 0,//预留
  413. memo: that.form.Memo,
  414. };
  415. let postdata = qs.stringify(param);
  416. ClassAdd(postdata).then(res => {
  417. let json = res;
  418. if (json.Code == 0) {
  419. // 关闭弹窗
  420. that.dialogLesson = false;
  421. // 重载列表
  422. that.getTableQuery();
  423. that.$message({
  424. showClose: true,
  425. message: '添加课程成功!',
  426. type: 'success'
  427. });
  428. } else {
  429. that.$message.error(json.Memo + ' 错误码:' + json.Code);
  430. }
  431. })
  432. },
  433. confirmEditLesson() {
  434. let that = this;
  435. // checkNum
  436. if (!that.form.ClassName) {
  437. this.$message.error('错了哦,课程名称不能为空');
  438. return false
  439. }
  440. if (that.form.ClassName.length > 8) {
  441. this.$message.error('错了哦,课程名称字数超过8个字');
  442. return false
  443. }
  444. if (that.form.Memo) {
  445. if (that.form.Memo.length > 200) {
  446. this.$message.error('错了哦,备注字数超过200个字');
  447. return false
  448. }
  449. }
  450. let teacherId = that.form.dialogValue ? that.form.dialogValue.toString() : '';
  451. // 通用是0,非通用是shopid
  452. let shopId = that.form.allUse == 0 ? 0 : localStorage.ShopId;
  453. let param = {
  454. token: localStorage.token,
  455. shopId: shopId,
  456. classId: that.form.classId,
  457. className: that.form.ClassName,
  458. consumeHour: that.form.ConsumeHour,
  459. topLimit: that.form.TopLimit,
  460. classType: that.form.ClassType,
  461. wxVisible: that.form.wxVisible,
  462. classColor: that.form.ClassColor,
  463. teacherId: teacherId,
  464. memo: that.form.Memo,
  465. };
  466. let postdata = qs.stringify(param);
  467. ClassEdit(postdata).then(res => {
  468. let json = res;
  469. if (json.Code == 0) {
  470. // 关闭弹窗
  471. that.dialogLesson = false;
  472. // 重载列表
  473. that.getTableQuery();
  474. that.$message({
  475. showClose: true,
  476. message: '会员课程调整成功!',
  477. type: 'success'
  478. });
  479. } else {
  480. that.$message.error(json.Memo + ' 错误码:' + json.Code);
  481. }
  482. })
  483. },
  484. // 新增课程
  485. addLesson() {
  486. this.form.btnType = 0; //新增
  487. // clear
  488. this.form.ClassName = '';
  489. this.form.ConsumeHour = 0;
  490. this.form.TopLimit = 0;
  491. this.form.wxVisible = 1;
  492. this.form.ClassColor = "#ffffff";
  493. this.form.Memo = "";
  494. this.form.dialogValue = [];
  495. this.dialogLesson = true;
  496. this.dialogTitle = '新增课程'
  497. this.panelSelect();
  498. },
  499. // 改色
  500. changeColor(c, row) {
  501. let that = this;
  502. let param = {
  503. token: localStorage.token,
  504. classId: row.ClassId,//
  505. classColor: c,//
  506. };
  507. let postdata = qs.stringify(param);
  508. ClassColorEdit(postdata).then(res => {
  509. let json = res;
  510. if (json.Code == 0) {
  511. that.$message({
  512. showClose: true,
  513. message: '课程颜色已编辑',
  514. type: 'success'
  515. });
  516. // 重载列表
  517. that.getTableQuery();
  518. } else {
  519. that.$message.error(json.Memo + ' 错误码:' + json.Code);
  520. }
  521. })
  522. },
  523. // 删除
  524. delList() {
  525. let that = this;
  526. if (this.tableRadio.length == 0) {
  527. this.$message.error("请先选中一条记录");
  528. return false
  529. }
  530. let row = that.tableRadio;
  531. let param = {
  532. token: localStorage.token,
  533. classId: row.ClassSelf.ClassId,
  534. status: 9,//0禁用1启用9删除
  535. };
  536. let postdata = qs.stringify(param);
  537. this.$confirm('此操作将永久删除该课程, 是否继续?', '提示', {
  538. confirmButtonText: '确定',
  539. cancelButtonText: '取消',
  540. type: 'warning'
  541. }).then(() => {
  542. ClassStatusEdit(postdata).then(res => {
  543. let json = res;
  544. if (json.Code == 0) {
  545. that.$message({
  546. showClose: true,
  547. message: '选中的课程已删除!',
  548. type: 'success'
  549. });
  550. // 重载列表
  551. that.getTableQuery();
  552. } else {
  553. that.$message.error(json.Memo + ' 错误码:' + json.Code);
  554. }
  555. });
  556. }).catch(() => {
  557. this.$message({
  558. type: 'info',
  559. message: '已取消删除'
  560. });
  561. });
  562. },
  563. // 加载选项
  564. panelSelect() {
  565. let that = this;
  566. let param = {
  567. token: localStorage.token,
  568. vipType: '',
  569. start: 1,
  570. expDay: '',
  571. tableMax: 9999,
  572. };
  573. let postdata = qs.stringify(param);
  574. VipUserListQuery(postdata).then(res => {
  575. let json = res;
  576. if (json.Code == 0) {
  577. if (json.Rs == null) return false;
  578. // that.dialogdata = json.Rs;
  579. that.form.dialogdata = turnResToOption(json.Rs)
  580. } else {
  581. that.$message.error(json.Memo + ' 错误码:' + json.Code);
  582. }
  583. })
  584. },
  585. // 微信可见与否
  586. changeWechat(e, row) {
  587. let that = this;
  588. let param = {
  589. token: localStorage.token,
  590. classId: row.ClassId,//
  591. wxVisible: e,//
  592. };
  593. let postdata = qs.stringify(param);
  594. ClassVisibleStatusEdit(postdata).then(res => {
  595. let json = res;
  596. let text = parseInt(e) == 1 ? '可见' : '不可见';
  597. if (json.Code == 0) {
  598. that.$message({
  599. showClose: true,
  600. message: '当前用户微信已' + text,
  601. type: 'success'
  602. });
  603. // 重载列表
  604. that.getTableQuery();
  605. } else {
  606. that.$message.error(json.Memo + ' 错误码:' + json.Code);
  607. }
  608. })
  609. },
  610. // 增删会员课程
  611. lessonStudenChange() {
  612. this.panelSelect();
  613. if (this.tableRadio.length == 0) {
  614. this.$message.error("请先选中一条记录");
  615. return false
  616. }
  617. let row = this.tableRadio;
  618. let userArrary = [];
  619. row.Userlist.map(function (item) {
  620. userArrary.push(item.Id)
  621. });
  622. this.form.classId = row.ClassSelf.ClassId;
  623. this.dialogValue = userArrary;
  624. this.dialogVisible = true
  625. // 读取左侧会员列表
  626. },
  627. handleSelectionChange(val) {
  628. this.multipleSelection = val;
  629. },
  630. clearForm() {
  631. // clear
  632. this.form.ClassName = '';
  633. this.form.ConsumeHour = 0;
  634. this.form.TopLimit = 0;
  635. this.form.wxVisible = 1;
  636. this.form.ClassColor = '';
  637. this.form.Memo = '';
  638. },
  639. // 编辑
  640. editLesson(row) {
  641. let that = this;
  642. this.clearForm();
  643. this.form.btnType = 1; //编辑
  644. this.form.ClassName = row.ClassName;
  645. this.form.ConsumeHour = row.ConsumeHour;
  646. this.form.TopLimit = row.TopLimit;
  647. this.form.wxVisible = row.WxVisible;
  648. this.form.ClassColor = row.ClassColor;
  649. this.form.Memo = row.Memo;
  650. this.form.dialogValue = row.teacherId;
  651. this.form.classId = row.ClassId;
  652. this.form.ClassType = row.ClassType;
  653. this.form.ShopId = row.ShopId;
  654. this.form.allUse = row.ShopId;
  655. this.dialogLesson = true;
  656. // 读取已选的会员
  657. console.log(row);
  658. this.form.dialogValue = [];
  659. this.dialogTitle = '编辑课程'
  660. },
  661. Lessonmember(Userlist) {
  662. this.dialogTableVisible = true;
  663. this.gridData = Userlist;
  664. },
  665. // 查询按钮
  666. query() {
  667. let that = this;
  668. this.getTableQuery();
  669. that.serachBtnStatus = true;
  670. let totalTime = 2
  671. let clock = window.setInterval(() => {
  672. totalTime--
  673. if (totalTime < 0) {
  674. totalTime = 2;
  675. that.serachBtnStatus = false;
  676. }
  677. }, 1000)
  678. this.$message.success('查询完毕');
  679. },
  680. // 页面数据查询
  681. getTableQuery() {
  682. let that = this;
  683. that.loading = true;
  684. let param = {
  685. token: localStorage.token,
  686. supregionid: 0,//
  687. regionid: this.panel.regionid,//
  688. comid: 1,//
  689. tagname: that.panel.tagname,//标签名
  690. start: 1,//
  691. tableMax: 9999,//
  692. };
  693. let postdata = qs.stringify(param);
  694. ClassListQuery(postdata).then(res => {
  695. let json = res;
  696. if (json.Code == 0) {
  697. that.loading = false;
  698. if (json.Rs) {
  699. that.allTableData = json.Rs;
  700. that.recordsTotal = json.Rs.length;
  701. } else {
  702. that.allTableData = [];
  703. that.recordsTotal = 0;
  704. }
  705. // 设置分页数据
  706. that.setPaginations();
  707. } else {
  708. that.$message.error(json.Memo + ' 错误码:' + json.Code);
  709. }
  710. })
  711. },
  712. // 设置分页数据
  713. setPaginations() {
  714. // 分页属性
  715. let that = this;
  716. that.pageination.total = that.recordsTotal;
  717. // 默认分页
  718. that.tableData = that.allTableData.filter((item, index) => {
  719. return index < that.pageination.pageItem;
  720. });
  721. },
  722. // 每页显示数量
  723. handleSizeChange() {
  724. let that = this;
  725. that.tableData = that.allTableData.filter((item, index) => {
  726. return index < that.pageination.pageItem;
  727. });
  728. that.draw = that.pageination.pageItem;
  729. that.getTableQuery();
  730. },
  731. // 翻页
  732. pageChange(pageIndex) {
  733. let that = this;
  734. // 获取当前页
  735. let index = that.pageination.pageItem * (pageIndex - 1);
  736. // 数据总数
  737. let nums = that.pageination.pageItem * pageIndex;
  738. // 容器
  739. let tables = [];
  740. for (var i = index; i < nums; i++) {
  741. if (that.allTableData[i]) {
  742. tables.push(that.allTableData[i])
  743. }
  744. this.tableData = tables;
  745. }
  746. that.start = index * that.draw;
  747. // that.getTableQuery();
  748. },
  749. // 过滤时间
  750. filterFmtDate(value, row, column) {
  751. let that = this;
  752. if (column == "0001-01-01T08:05:43+08:05") {
  753. return '无有效期';
  754. } else {
  755. return nonTfmtDate(column, 11);
  756. }
  757. },
  758. },
  759. watch: {
  760. $route(to) {
  761. if (to.name == 'Lesson') {
  762. this.panelSelect();
  763. this.getTableQuery();
  764. }
  765. },
  766. },
  767. }
  768. </script>
  769. <style scoped>
  770. @import "../assets/css/panel.css";
  771. .context {
  772. /* height: 770px; */
  773. overflow-y: scroll;
  774. display: block;
  775. margin: 0 auto;
  776. background-color: #fff !important;
  777. padding: 30px;
  778. }
  779. .panel-body {
  780. padding: 20px;
  781. background: #F0F2F5;
  782. }
  783. .change {
  784. width: 100%;
  785. overflow: hidden;
  786. display: block;
  787. margin: 0 auto;
  788. padding-top: 10px;
  789. padding-bottom: 10px;
  790. }
  791. .change button {
  792. float: left;
  793. }
  794. .change button.pull-right {
  795. float: right;
  796. }
  797. .dialogTitle {
  798. width: 100%;
  799. overflow: hidden;
  800. display: block;
  801. margin: 0 auto;
  802. color: #000000;
  803. font-size: 18px;
  804. text-align: center;
  805. }
  806. .dialogTitle span {
  807. width: 169px;
  808. height: 40px;
  809. line-height: 40px;
  810. text-align: center;
  811. color: #fff;
  812. background: #3799FF;
  813. border-radius: 250px;
  814. font-size: 18px;
  815. overflow: hidden;
  816. display: block;
  817. margin: 0 auto;
  818. margin-bottom: 30px;
  819. }
  820. .dialogTitle em {
  821. float: none;
  822. font-style: normal;
  823. color: #3799FF;
  824. margin: 0;
  825. }
  826. /deep/ .el-transfer-panel__item .el-checkbox__input {
  827. left: 40px;
  828. }
  829. .dialogFooter {
  830. width: 90%;
  831. overflow: hidden;
  832. display: block;
  833. margin: 0 auto;
  834. margin-top: 10px;
  835. }
  836. .dialogFooter button {
  837. float: right;
  838. margin-left: 10px;
  839. }
  840. .pull-left {
  841. width: 30%;
  842. float: left;
  843. }
  844. .pull-right {
  845. width: 70%;
  846. float: right;
  847. }
  848. /deep/ .el-transfer-panel__item .el-checkbox__input {
  849. left: 15px;
  850. }
  851. /deep/ .el-dialog .el-input__inner {
  852. min-width: 180px;
  853. }
  854. /*隐藏调色盘*/
  855. .el-color-dropdown__main-wrapper {
  856. display: none !important;
  857. }
  858. /deep/ .el-color-dropdown__main-wrapper {
  859. display: none !important;
  860. }
  861. </style>