index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  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 filterable v-model="queryParams.courseId" placeholder="请选择课程" clearable size="small" @change="courseChange(queryParams.courseId)">
  76. <el-option
  77. v-for="dict in courseLists"
  78. :key="dict.dictValue"
  79. :label="dict.dictLabel"
  80. :value="parseInt(dict.dictValue)"
  81. />
  82. </el-select>
  83. </el-form-item>
  84. <el-form-item label="小节" prop="videoId">
  85. <el-select filterable v-model="queryParams.videoId" placeholder="请选择小节" clearable size="small">
  86. <el-option
  87. v-for="dict in videoList"
  88. :key="dict.dictValue"
  89. :label="dict.dictLabel"
  90. :value="parseInt(dict.dictValue)"
  91. />
  92. </el-select>
  93. </el-form-item>
  94. <el-form-item label="创建时间" prop="createTime">
  95. <el-date-picker v-model="createTime" size="small" style="width: 220px" value-format="yyyy-MM-dd HH:mm:ss" type="datetimerange"
  96. range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" @change="change"></el-date-picker>
  97. </el-form-item>
  98. <el-form-item>
  99. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  100. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  101. </el-form-item>
  102. </el-form>
  103. <el-row :gutter="10" class="mb8">
  104. <el-col :span="1.5">
  105. <el-button
  106. type="warning"
  107. plain
  108. icon="el-icon-download"
  109. size="mini"
  110. :loading="exportLoading"
  111. @click="handleExport"
  112. v-hasPermi="['course:courseRedPacketLog:export']"
  113. >导出</el-button>
  114. </el-col>
  115. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  116. </el-row>
  117. <el-tabs type="card" v-model="activeName" @tab-click="handleClick">
  118. <el-tab-pane label="全部" name="00"></el-tab-pane>
  119. <el-tab-pane label="待发送" name="0"></el-tab-pane>
  120. <el-tab-pane label="已发送" name="1"></el-tab-pane>
  121. </el-tabs>
  122. <el-table border v-loading="loading" :data="courseRedPacketLogList" @selection-change="handleSelectionChange">
  123. <el-table-column type="selection" width="55" align="center" />
  124. <el-table-column label="记录编号" align="center" prop="logId" />
  125. <el-table-column label="批次单号" align="center" prop="outBatchNo" />
  126. <el-table-column label="课程名称" align="center" prop="courseId" >
  127. <template slot-scope="scope">
  128. <span prop="status" v-for="(item, index) in courseLists" v-if="scope.row.courseId==item.dictValue">{{item.dictLabel}}</span>
  129. </template>
  130. </el-table-column>
  131. <el-table-column label="小节名称" align="center" prop="title" />
  132. <el-table-column label="会员id" align="center" prop="userId" />
  133. <el-table-column label="会员电话" align="center" prop="phone" />
  134. <el-table-column label="所属销售" align="center" prop="companyUserName" />
  135. <el-table-column label="所属公司" align="center" prop="companyName" />
  136. <el-table-column label="转帐金额" align="center" prop="amount" />
  137. <el-table-column label="状态" align="center" prop="status" >
  138. <template slot-scope="scope">
  139. <el-tag>{{ scope.row.status === 0 ? "发送中" : "已完成" }}</el-tag>
  140. </template>
  141. </el-table-column>
  142. <el-table-column label="企微账号" align="center" prop="qwUserName" />
  143. <el-table-column label="创建时间" align="center" prop="createTime" />
  144. </el-table>
  145. <pagination
  146. v-show="total>0"
  147. :total="total"
  148. :page.sync="queryParams.pageNum"
  149. :limit.sync="queryParams.pageSize"
  150. @pagination="getList"
  151. />
  152. <!-- 添加或修改短链课程看课记录对话框 -->
  153. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  154. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  155. <el-form-item label="课程id" prop="courseId">
  156. <el-input v-model="form.courseId" placeholder="请输入课程id" />
  157. </el-form-item>
  158. <el-form-item label="用户id" prop="userId">
  159. <el-input v-model="form.userId" placeholder="请输入用户id" />
  160. </el-form-item>
  161. <el-form-item label="小节id" prop="videoId">
  162. <el-input v-model="form.videoId" placeholder="请输入小节id" />
  163. </el-form-item>
  164. <el-form-item label="公司员工id" prop="companyUserId">
  165. <el-input v-model="form.companyUserId" placeholder="请输入公司员工id" />
  166. </el-form-item>
  167. <el-form-item label="公司id" prop="companyId">
  168. <el-input v-model="form.companyId" placeholder="请输入公司id" />
  169. </el-form-item>
  170. <el-form-item label="转帐金额" prop="amount">
  171. <el-input v-model="form.amount" placeholder="请输入转帐金额" />
  172. </el-form-item>
  173. <el-form-item label="企微userid" prop="qwUserId">
  174. <el-input v-model="form.qwUserId" placeholder="请输入分享企微userid" />
  175. </el-form-item>
  176. </el-form>
  177. <div slot="footer" class="dialog-footer">
  178. <el-button type="primary" @click="submitForm">确 定</el-button>
  179. <el-button @click="cancel">取 消</el-button>
  180. </div>
  181. </el-dialog>
  182. </div>
  183. </template>
  184. <script>
  185. import { courseList,videoList,listCourseRedPacketLog, getCourseRedPacketLog, delCourseRedPacketLog, addCourseRedPacketLog, updateCourseRedPacketLog, exportCourseRedPacketLog } from "@/api/course/courseRedPacketLog";
  186. import { getCompanyList } from "@/api/company/company";
  187. import {treeselect} from "../../../api/company/companyDept";
  188. import SelectTree from '@/components/TreeSelect/index.vue'
  189. import { getDeptData } from '@/api/system/employeeStats'
  190. export default {
  191. name: "CourseRedPacketLog",
  192. components: { SelectTree },
  193. data() {
  194. return {
  195. selectedCompanyList: [],
  196. companys:[],
  197. deptList: [],
  198. // 遮罩层
  199. loading: false,
  200. // 导出遮罩层
  201. exportLoading: false,
  202. // 选中数组
  203. ids: [],
  204. // 非单个禁用
  205. single: true,
  206. // 非多个禁用
  207. multiple: true,
  208. // 显示搜索条件
  209. showSearch: true,
  210. activeName:"00",
  211. courseLists:[],
  212. videoList:[],
  213. // 总条数
  214. total: 0,
  215. // 短链课程看课记录表格数据
  216. courseRedPacketLogList: [],
  217. // 弹出层标题
  218. title: "",
  219. // 是否显示弹出层
  220. open: false,
  221. // 查询参数
  222. queryParams: {
  223. pageNum: 1,
  224. pageSize: 10,
  225. courseId: null,
  226. userId: null,
  227. videoId: null,
  228. companyUserId: null,
  229. companyId: null,
  230. amount: null,
  231. qwUserId: null,
  232. subCateId: null,
  233. phone: null,
  234. phoneMk: null,
  235. sTime:null,
  236. eTime:null,
  237. },
  238. createTime:null,
  239. // 表单参数
  240. form: {},
  241. // 表单校验
  242. rules: {
  243. }
  244. };
  245. },
  246. created() {
  247. getDeptData().then(response => {
  248. this.deptList = response.data;
  249. })
  250. getCompanyList().then(response => {
  251. this.companys = response.data;
  252. });
  253. courseList().then(response => {
  254. this.courseLists = response.list;
  255. });
  256. // this.getList();
  257. },
  258. methods: {
  259. handleClick(tab, event) {
  260. this.activeName=tab.name;
  261. this.queryParams.status=tab.name
  262. this.getList();
  263. },
  264. /** 查询短链课程看课记录列表 */
  265. getList() {
  266. this.loading = true;
  267. if(this.selectedCompanyList != null && this.selectedCompanyList.length > 0) {
  268. this.queryParams.companyUserIds = this.selectedCompanyList;
  269. }else {
  270. this.queryParams.companyUserIds = [];
  271. }
  272. listCourseRedPacketLog(this.queryParams).then(response => {
  273. console.log("response",response)
  274. this.courseRedPacketLogList = response.data.list;
  275. this.total = response.data.total;
  276. this.loading = false;
  277. });
  278. },
  279. change(){
  280. if(this.createTime!=null){
  281. this.queryParams.sTime=this.createTime[0];
  282. this.queryParams.eTime=this.createTime[1];
  283. }else{
  284. this.queryParams.sTime=null;
  285. this.queryParams.eTime=null;
  286. }
  287. },
  288. courseChange(row){
  289. if(row==""){
  290. this.videoList=[]
  291. this.queryParams.videoId=null
  292. }else{
  293. videoList(row).then(response => {
  294. this.videoList=response.list
  295. });
  296. }
  297. },
  298. // 取消按钮
  299. cancel() {
  300. this.open = false;
  301. this.reset();
  302. },
  303. // 表单重置
  304. reset() {
  305. this.form = {
  306. logId: null,
  307. courseId: null,
  308. userId: null,
  309. videoId: null,
  310. companyUserId: null,
  311. companyId: null,
  312. amount: null,
  313. createTime: null,
  314. qwUserId: null
  315. };
  316. this.resetForm("form");
  317. },
  318. /** 搜索按钮操作 */
  319. handleQuery() {
  320. this.queryParams.pageNum = 1;
  321. this.getList();
  322. },
  323. /** 重置按钮操作 */
  324. resetQuery() {
  325. this.resetForm("queryForm");
  326. this.createTime=null;
  327. this.queryParams.sTime=null;
  328. this.queryParams.eTime=null;
  329. this.handleQuery();
  330. },
  331. // 多选框选中数据
  332. handleSelectionChange(selection) {
  333. this.ids = selection.map(item => item.logId)
  334. this.single = selection.length!==1
  335. this.multiple = !selection.length
  336. },
  337. /** 新增按钮操作 */
  338. handleAdd() {
  339. this.reset();
  340. this.open = true;
  341. this.title = "添加短链课程看课记录";
  342. },
  343. /** 修改按钮操作 */
  344. handleUpdate(row) {
  345. this.reset();
  346. const logId = row.logId || this.ids
  347. getCourseRedPacketLog(logId).then(response => {
  348. this.form = response.data;
  349. this.open = true;
  350. this.title = "修改短链课程看课记录";
  351. });
  352. },
  353. /** 提交按钮 */
  354. submitForm() {
  355. this.$refs["form"].validate(valid => {
  356. if (valid) {
  357. if (this.form.logId != null) {
  358. updateCourseRedPacketLog(this.form).then(response => {
  359. this.msgSuccess("修改成功");
  360. this.open = false;
  361. this.getList();
  362. });
  363. } else {
  364. addCourseRedPacketLog(this.form).then(response => {
  365. this.msgSuccess("新增成功");
  366. this.open = false;
  367. this.getList();
  368. });
  369. }
  370. }
  371. });
  372. },
  373. /** 删除按钮操作 */
  374. handleDelete(row) {
  375. const logIds = row.logId || this.ids;
  376. this.$confirm('是否确认删除短链课程看课记录编号为"' + logIds + '"的数据项?', "警告", {
  377. confirmButtonText: "确定",
  378. cancelButtonText: "取消",
  379. type: "warning"
  380. }).then(function() {
  381. return delCourseRedPacketLog(logIds);
  382. }).then(() => {
  383. this.getList();
  384. this.msgSuccess("删除成功");
  385. }).catch(() => {});
  386. },
  387. getSubCateList(pid){
  388. this.form.subCateId=null;
  389. if(pid == ''){
  390. this.subCategoryOptions=[];
  391. return
  392. }
  393. getCateListByPid(pid).then(response => {
  394. this.subCategoryOptions = response.data;
  395. });
  396. },
  397. /** 导出按钮操作 */
  398. handleExport() {
  399. const queryParams = this.queryParams;
  400. this.$confirm('是否确认导出所有短链课程看课记录数据项?', "警告", {
  401. confirmButtonText: "确定",
  402. cancelButtonText: "取消",
  403. type: "warning"
  404. }).then(() => {
  405. const loadingInstance = this.$loading({
  406. lock: true,
  407. text: '正在导出数据,请稍候...',
  408. background: 'rgba(0, 0, 0, 0.7)'
  409. });
  410. this.exportLoading = true;
  411. // return exportCourseRedPacketLog(queryParams);
  412. return exportCourseRedPacketLog(queryParams).finally(res=>{
  413. loadingInstance.close();
  414. })
  415. }).then(response => {
  416. this.download(response.msg);
  417. this.exportLoading = false;
  418. }).catch(() => {}).finally(res=>{
  419. });
  420. }
  421. }
  422. };
  423. </script>