Lesson.vue 33 KB

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