index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <!-- <el-form-item label="公司名" prop="companyId">-->
  5. <!-- <el-select filterable v-model="queryParams.companyId" placeholder="请选择公司名" clearable size="small">-->
  6. <!-- <el-option-->
  7. <!-- v-for="item in companys"-->
  8. <!-- :key="item.companyId"-->
  9. <!-- :label="item.companyName"-->
  10. <!-- :value="item.companyId"-->
  11. <!-- />-->
  12. <!-- </el-select>-->
  13. <!-- </el-form-item>-->
  14. <el-form-item label="公司名" prop="companyId">
  15. <select-tree
  16. v-model="selectedCompanyList"
  17. :raw-data="deptList"
  18. placeholder="请选择销售"
  19. :parentSelectable="true"
  20. :multiple="true"
  21. component-width="300px"
  22. :max-display-tags="3"
  23. :check-strictly="false"
  24. :return-leaf-only="false"
  25. ></select-tree>
  26. </el-form-item>
  27. <!-- <el-form-item label="部门" prop="type">-->
  28. <!-- <TreeselectVue-->
  29. <!-- style="width: 220px"-->
  30. <!-- :clearable="false"-->
  31. <!-- v-model="queryParams.deptId"-->
  32. <!-- :options="deptOptions"-->
  33. <!-- clearable-->
  34. <!-- :show-count="true"-->
  35. <!-- placeholder="请选择归属部门"-->
  36. <!-- />-->
  37. <!-- </el-form-item>-->
  38. <el-form-item label="员工" prop="companyUserName">
  39. <el-input
  40. v-model="queryParams.companyUserName"
  41. placeholder="所属员工"
  42. clearable
  43. size="small"
  44. @keyup.enter.native="handleQuery"
  45. />
  46. </el-form-item>
  47. <el-form-item label="会员ID" prop="userId">
  48. <el-input
  49. v-model="queryParams.userId"
  50. placeholder="请输入会员ID"
  51. clearable
  52. size="small"
  53. @keyup.enter.native="handleQuery"
  54. />
  55. </el-form-item>
  56. <el-form-item label="电话" prop="phone">
  57. <el-input
  58. v-model="queryParams.phone"
  59. placeholder="请输入电话"
  60. clearable
  61. size="small"
  62. @keyup.enter.native="handleQuery"
  63. />
  64. </el-form-item>
  65. <el-form-item label="加密电话" prop="phoneMk">
  66. <el-input
  67. v-model="queryParams.phoneMk"
  68. placeholder="请输入电话"
  69. clearable
  70. size="small"
  71. @keyup.enter.native="handleQuery"
  72. />
  73. </el-form-item>
  74. <el-form-item label="营期" prop="courseId">
  75. <el-select
  76. v-model="queryParams.periodId"
  77. placeholder="请选择课程"
  78. filterable
  79. clearable
  80. size="small"
  81. remote
  82. :remote-method="remoteMethod"
  83. :loading="loadingPeriod"
  84. @focus="handleFocus"
  85. >
  86. <el-option
  87. v-for="dict in periodLists"
  88. :key="dict.periodId"
  89. :label="dict.periodName"
  90. :value="parseInt(dict.periodId)"
  91. />
  92. </el-select>
  93. </el-form-item>
  94. <el-form-item label="课程" prop="courseId">
  95. <el-select filterable v-model="queryParams.courseId" placeholder="请选择课程" clearable size="small" @change="courseChange(queryParams.courseId)">
  96. <el-option
  97. v-for="dict in courseLists"
  98. :key="dict.dictValue"
  99. :label="dict.dictLabel"
  100. :value="parseInt(dict.dictValue)"
  101. />
  102. </el-select>
  103. </el-form-item>
  104. <el-form-item label="小节" prop="videoId">
  105. <el-select filterable v-model="queryParams.videoId" placeholder="请选择小节" clearable size="small">
  106. <el-option
  107. v-for="dict in videoList"
  108. :key="dict.dictValue"
  109. :label="dict.dictLabel"
  110. :value="parseInt(dict.dictValue)"
  111. />
  112. </el-select>
  113. </el-form-item>
  114. <el-form-item label="创建时间" prop="createTime">
  115. <el-date-picker v-model="createTime" size="small" style="width: 220px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
  116. range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" @change="change"></el-date-picker>
  117. </el-form-item>
  118. <el-form-item>
  119. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  120. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  121. </el-form-item>
  122. </el-form>
  123. <el-row :gutter="10" class="mb8">
  124. <el-col :span="1.5">
  125. <el-button
  126. type="warning"
  127. plain
  128. icon="el-icon-download"
  129. size="mini"
  130. :loading="exportLoading"
  131. @click="handleExport"
  132. v-hasPermi="['course:courseRedPacketLog:export']"
  133. >导出</el-button>
  134. </el-col>
  135. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  136. </el-row>
  137. <el-tabs type="card" v-model="activeName" @tab-click="handleClick">
  138. <el-tab-pane label="全部" name="00"></el-tab-pane>
  139. <el-tab-pane label="待发送" name="0"></el-tab-pane>
  140. <el-tab-pane label="已发送" name="1"></el-tab-pane>
  141. </el-tabs>
  142. <el-table border v-loading="loading" :data="courseRedPacketLogList" @selection-change="handleSelectionChange">
  143. <el-table-column type="selection" width="55" align="center" />
  144. <!-- <el-table-column label="记录编号" align="center" prop="logId" />-->
  145. <el-table-column label="批次单号" align="center" prop="outBatchNo" />
  146. <el-table-column label="营期名称" align="center" prop="periodName" />
  147. <el-table-column label="课程名称" align="center" prop="courseId" >
  148. <template slot-scope="scope">
  149. <span prop="status" v-for="(item, index) in courseLists" v-if="scope.row.courseId==item.dictValue">{{item.dictLabel}}</span>
  150. </template>
  151. </el-table-column>
  152. <el-table-column label="小节名称" align="center" prop="title" />
  153. <el-table-column label="会员id" align="center" prop="userId" />
  154. <el-table-column label="会员名称" align="center" prop="fsNickName" />
  155. <el-table-column label="会员电话" align="center" prop="phone" />
  156. <el-table-column label="所属员工" align="center" prop="companyUserName" />
  157. <el-table-column label="所属公司" align="center" prop="companyName" />
  158. <el-table-column label="员工部门" align="center" prop="deptName" />
  159. <el-table-column label="转帐金额" align="center" prop="amount" />
  160. <el-table-column label="状态" align="center" prop="status" >
  161. <template slot-scope="scope">
  162. <el-tag>{{ scope.row.status === 0 ? "发送中" : "已完成" }}</el-tag>
  163. </template>
  164. </el-table-column>
  165. <el-table-column label="企微账号" align="center" prop="qwUserName" />
  166. <el-table-column label="创建时间" align="center" prop="createTime" />
  167. </el-table>
  168. <pagination
  169. v-show="total>0"
  170. :total="total"
  171. :page.sync="queryParams.pageNum"
  172. :limit.sync="queryParams.pageSize"
  173. @pagination="getList"
  174. />
  175. <!-- 添加或修改短链课程看课记录对话框 -->
  176. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  177. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  178. <el-form-item label="课程id" prop="courseId">
  179. <el-input v-model="form.courseId" placeholder="请输入课程id" />
  180. </el-form-item>
  181. <el-form-item label="会员id" prop="userId">
  182. <el-input v-model="form.userId" placeholder="请输入会员id" />
  183. </el-form-item>
  184. <el-form-item label="小节id" prop="videoId">
  185. <el-input v-model="form.videoId" placeholder="请输入小节id" />
  186. </el-form-item>
  187. <el-form-item label="员工id" prop="companyUserId">
  188. <el-input v-model="form.companyUserId" placeholder="请输入员工id" />
  189. </el-form-item>
  190. <el-form-item label="公司id" prop="companyId">
  191. <el-input v-model="form.companyId" placeholder="请输入公司id" />
  192. </el-form-item>
  193. <el-form-item label="转帐金额" prop="amount">
  194. <el-input v-model="form.amount" placeholder="请输入转帐金额" />
  195. </el-form-item>
  196. <el-form-item label="企微userid" prop="qwUserId">
  197. <el-input v-model="form.qwUserId" placeholder="请输入分享企微userid" />
  198. </el-form-item>
  199. </el-form>
  200. <div slot="footer" class="dialog-footer">
  201. <el-button type="primary" @click="submitForm">确 定</el-button>
  202. <el-button @click="cancel">取 消</el-button>
  203. </div>
  204. </el-dialog>
  205. </div>
  206. </template>
  207. <script>
  208. import { courseList,videoList,getCourseRedPacketLog, delCourseRedPacketLog, addCourseRedPacketLog, updateCourseRedPacketLog, exportCourseRedPacketLog,listCourseRedPacketLogPage } from "@/api/course/courseRedPacketLog";
  209. import { getCompanyList } from "@/api/company/company";
  210. import { periodList } from "@/api/course/userCoursePeriod";
  211. import {treeselect} from "../../../api/company/companyDept";
  212. import SelectTree from '@/components/TreeSelect/index.vue'
  213. import { getDeptData } from '@/api/system/employeeStats'
  214. export default {
  215. name: "CourseRedPacketLog",
  216. components: {SelectTree},
  217. data() {
  218. return {
  219. companys:[],
  220. selectedCompanyList: [],
  221. deptList: [],
  222. // 遮罩层
  223. loading: true,
  224. loadingPeriod: false,
  225. // 导出遮罩层
  226. exportLoading: false,
  227. // 选中数组
  228. ids: [],
  229. // 非单个禁用
  230. single: true,
  231. // 非多个禁用
  232. multiple: true,
  233. // 显示搜索条件
  234. showSearch: true,
  235. activeName:"00",
  236. courseLists:[],
  237. periodLists:[],
  238. videoList:[],
  239. // 总条数
  240. total: 0,
  241. // 短链课程看课记录表格数据
  242. courseRedPacketLogList: [],
  243. // 弹出层标题
  244. title: "",
  245. // 是否显示弹出层
  246. open: false,
  247. queryPeriod: {
  248. pageNum: 1,
  249. pageSize: 20
  250. },
  251. // 查询参数
  252. queryParams: {
  253. pageNum: 1,
  254. pageSize: 10,
  255. courseId: null,
  256. userId: null,
  257. videoId: null,
  258. companyUserId: null,
  259. companyId: null,
  260. amount: null,
  261. qwUserId: null,
  262. subCateId: null,
  263. phone: null,
  264. phoneMk: null,
  265. sTime:null,
  266. eTime:null,
  267. userIds: null
  268. },
  269. createTime:null,
  270. // 表单参数
  271. form: {},
  272. // 表单校验
  273. rules: {
  274. }
  275. };
  276. },
  277. created() {
  278. this.getList();
  279. getCompanyList().then(response => {
  280. this.companys = response.data;
  281. });
  282. courseList().then(response => {
  283. this.courseLists = response.list;
  284. });
  285. getDeptData().then(response => {
  286. this.deptList = response.data;
  287. })
  288. periodList(this.queryPeriod).then(response => {
  289. this.periodLists = response.data;
  290. });
  291. // this.getList();
  292. },
  293. methods: {
  294. // 远程搜索方法
  295. async remoteMethod(query) {
  296. this.searchKeyword = query
  297. if (query !== '') {
  298. this.loadingPeriod = true
  299. await this.getPeriodList(query)
  300. this.loadingPeriod = false
  301. } else {
  302. // 如果输入为空,可以清空列表或加载默认数据
  303. this.periodLists = []
  304. }
  305. },
  306. // 获取营期列表
  307. async getPeriodList(keyword = '') {
  308. try {
  309. const params = {
  310. periodName: keyword, // 搜索关键词
  311. pageNum: 1,
  312. pageSize: 50 // 根据需求调整
  313. }
  314. const response = await periodList(params)
  315. this.periodLists = response.data.list || response.data || []
  316. } catch (error) {
  317. console.error('获取营期列表失败:', error)
  318. this.periodLists = []
  319. }
  320. },
  321. // 下拉框获取焦点时加载数据
  322. async handleFocus() {
  323. if (this.periodLists.length === 0) {
  324. this.getPeriodList();
  325. }
  326. },
  327. handleClick(tab, event) {
  328. this.activeName=tab.name;
  329. if(tab.name == "00") {
  330. this.queryParams.status = null;
  331. } else {
  332. this.queryParams.status = tab.name;
  333. }
  334. this.getList();
  335. },
  336. /** 查询短链课程看课记录列表 */
  337. getList() {
  338. this.loading = true;
  339. if(this.selectedCompanyList != null && this.selectedCompanyList.length > 0) {
  340. this.queryParams.userIds = this.selectedCompanyList;
  341. }else {
  342. this.queryParams.userIds = [];
  343. }
  344. listCourseRedPacketLogPage(this.queryParams).then(response => {
  345. this.courseRedPacketLogList = response.data.list;
  346. this.total = response.data.total;
  347. this.loading = false;
  348. })
  349. },
  350. change(){
  351. if(this.createTime!=null){
  352. this.queryParams.sTime=this.createTime[0];
  353. this.queryParams.eTime=this.createTime[1];
  354. }else{
  355. this.queryParams.sTime=null;
  356. this.queryParams.eTime=null;
  357. }
  358. },
  359. courseChange(row){
  360. if(row==""){
  361. this.videoList=[]
  362. this.queryParams.videoId=null
  363. }else{
  364. videoList(row).then(response => {
  365. this.videoList=response.list
  366. });
  367. }
  368. },
  369. // 取消按钮
  370. cancel() {
  371. this.open = false;
  372. this.reset();
  373. },
  374. // 表单重置
  375. reset() {
  376. this.form = {
  377. logId: null,
  378. courseId: null,
  379. userId: null,
  380. videoId: null,
  381. companyUserId: null,
  382. companyId: null,
  383. amount: null,
  384. createTime: null,
  385. qwUserId: null
  386. };
  387. this.resetForm("form");
  388. },
  389. /** 搜索按钮操作 */
  390. handleQuery() {
  391. this.queryParams.pageNum = 1;
  392. this.getList();
  393. },
  394. /** 重置按钮操作 */
  395. resetQuery() {
  396. this.resetForm("queryForm");
  397. this.createTime=null;
  398. this.queryParams.sTime=null;
  399. this.queryParams.eTime=null;
  400. this.selectedCompanyList = [];
  401. this.queryParams.pageNum = 1; // Reset to first page
  402. this.queryParams.pageSize = 10; // Reset to default page size
  403. this.queryParams.periodId=null;
  404. this.handleQuery();
  405. },
  406. // 多选框选中数据
  407. handleSelectionChange(selection) {
  408. this.ids = selection.map(item => item.logId)
  409. this.single = selection.length!==1
  410. this.multiple = !selection.length
  411. },
  412. /** 新增按钮操作 */
  413. handleAdd() {
  414. this.reset();
  415. this.open = true;
  416. this.title = "添加短链课程看课记录";
  417. },
  418. /** 修改按钮操作 */
  419. handleUpdate(row) {
  420. this.reset();
  421. const logId = row.logId || this.ids
  422. getCourseRedPacketLog(logId).then(response => {
  423. this.form = response.data;
  424. this.open = true;
  425. this.title = "修改短链课程看课记录";
  426. });
  427. },
  428. /** 提交按钮 */
  429. submitForm() {
  430. this.$refs["form"].validate(valid => {
  431. if (valid) {
  432. if (this.form.logId != null) {
  433. updateCourseRedPacketLog(this.form).then(response => {
  434. this.msgSuccess("修改成功");
  435. this.open = false;
  436. this.getList();
  437. });
  438. } else {
  439. addCourseRedPacketLog(this.form).then(response => {
  440. this.msgSuccess("新增成功");
  441. this.open = false;
  442. this.getList();
  443. });
  444. }
  445. }
  446. });
  447. },
  448. /** 删除按钮操作 */
  449. handleDelete(row) {
  450. const logIds = row.logId || this.ids;
  451. this.$confirm('是否确认删除短链课程看课记录编号为"' + logIds + '"的数据项?', "警告", {
  452. confirmButtonText: "确定",
  453. cancelButtonText: "取消",
  454. type: "warning"
  455. }).then(function() {
  456. return delCourseRedPacketLog(logIds);
  457. }).then(() => {
  458. this.getList();
  459. this.msgSuccess("删除成功");
  460. }).catch(() => {});
  461. },
  462. /** 导出按钮操作 */
  463. handleExport() {
  464. if(this.selectedCompanyList != null && this.selectedCompanyList.length > 0) {
  465. this.queryParams.userIds = this.selectedCompanyList;
  466. }else {
  467. this.queryParams.userIds = [];
  468. }
  469. const queryParams = this.queryParams;
  470. this.$confirm('是否确认导出所有短链课程看课记录数据项?', "警告", {
  471. confirmButtonText: "确定",
  472. cancelButtonText: "取消",
  473. type: "warning"
  474. }).then(() => {
  475. const loadingInstance = this.$loading({
  476. lock: true,
  477. text: '正在导出数据,请稍候...',
  478. background: 'rgba(0, 0, 0, 0.7)'
  479. });
  480. this.exportLoading = true;
  481. // return exportCourseRedPacketLog(queryParams);
  482. return exportCourseRedPacketLog(queryParams).finally(res=>{
  483. loadingInstance.close();
  484. })
  485. }).then(response => {
  486. this.download(response.msg);
  487. this.exportLoading = false;
  488. }).catch(() => {}).finally(res=>{
  489. });
  490. }
  491. }
  492. };
  493. </script>