myCourseAnswerlogs.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="120px">
  4. <el-form-item label="企微账号" prop="qwUserId">
  5. <el-select v-model="queryParams.qwUserId" placeholder="企微账号" size="small" @change="updateQwuser()">
  6. <el-option
  7. v-for="dict in myQwUserList"
  8. :key="dict.dictValue"
  9. :label="dict.dictLabel + '('+dict.corpName+')'"
  10. :value="dict.dictValue"
  11. />
  12. </el-select>
  13. </el-form-item>
  14. <el-form-item label="会员ID" prop="userId">
  15. <el-input
  16. v-model="queryParams.userId"
  17. placeholder="请输入会员ID"
  18. clearable
  19. size="small"
  20. @keyup.enter.native="handleQuery"
  21. />
  22. </el-form-item>
  23. <el-form-item label="客户昵称" prop="nickName">
  24. <el-input
  25. v-model="queryParams.nickName"
  26. placeholder="请输入客户客户昵称"
  27. clearable
  28. size="small"
  29. @keyup.enter.native="handleQuery"
  30. />
  31. </el-form-item>
  32. <el-form-item label="客户电话" prop="phone">
  33. <el-input
  34. v-model="queryParams.phone"
  35. placeholder="请输入客户电话"
  36. clearable
  37. size="small"
  38. @keyup.enter.native="handleQuery"
  39. />
  40. </el-form-item>
  41. <el-form-item label="加密电话" prop="phoneMk">
  42. <el-input
  43. v-model="queryParams.phoneMk"
  44. placeholder="请输入用户加密电话"
  45. clearable
  46. size="small"
  47. @keyup.enter.native="handleQuery"
  48. />
  49. </el-form-item>
  50. <el-form-item label="课程" prop="courseId">
  51. <el-select filterable v-model="queryParams.courseId" placeholder="请选择课程" clearable size="small" @change="courseChange(queryParams.courseId)">
  52. <el-option
  53. v-for="dict in courseLists"
  54. :key="dict.dictValue"
  55. :label="dict.dictLabel"
  56. :value="parseInt(dict.dictValue)"
  57. />
  58. </el-select>
  59. </el-form-item>
  60. <el-form-item label="小节" prop="videoId">
  61. <el-select filterable v-model="queryParams.videoId" placeholder="请选择小节" clearable size="small">
  62. <el-option
  63. v-for="dict in videoList"
  64. :key="dict.dictValue"
  65. :label="dict.dictLabel"
  66. :value="parseInt(dict.dictValue)"
  67. />
  68. </el-select>
  69. </el-form-item>
  70. <el-form-item label="是否全部正确" prop="isRight">
  71. <el-select filterable v-model="queryParams.isRight" placeholder="请选择公司名" clearable size="small">
  72. <el-option
  73. v-for="dict in sysCompanyOr"
  74. :key="dict.dictValue"
  75. :label="dict.dictLabel"
  76. :value="parseInt(dict.dictValue)"
  77. />
  78. </el-select>
  79. </el-form-item>
  80. <el-form-item label="创建时间" prop="createTime">
  81. <el-date-picker v-model="createTime" size="small" style="width: 220px" value-format="yyyy-MM-dd"
  82. type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" @change="timeChange"></el-date-picker>
  83. </el-form-item>
  84. <el-form-item>
  85. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  86. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  87. </el-form-item>
  88. </el-form>
  89. <el-row :gutter="10" class="mb8">
  90. <el-col :span="1.5">
  91. <el-button
  92. type="warning"
  93. plain
  94. icon="el-icon-download"
  95. size="mini"
  96. :loading="exportLoading"
  97. @click="handleExport"
  98. v-hasPermi="['course:courseAnswerLog:myExport']"
  99. >导出</el-button>
  100. </el-col>
  101. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  102. </el-row>
  103. <el-table border v-loading="loading" :data="logsList" @selection-change="handleSelectionChange">
  104. <el-table-column type="selection" width="55" align="center" />
  105. <el-table-column label="小程序用户名" align="center" prop="userName">
  106. <template slot-scope="scope">
  107. <div style="display: flex;white-space: nowrap">
  108. <div style="margin: auto">
  109. {{scope.row.userName}}
  110. </div>
  111. <el-popover
  112. placement="right"
  113. title=""
  114. trigger="hover">
  115. <img slot="reference" :src="scope.row.fsAvatar" style="width: 30px;height: 30px">
  116. <img :src="scope.row.fsAvatar" style="max-width: 200px;max-height: 200px">
  117. </el-popover>
  118. </div>
  119. </template>
  120. </el-table-column>
  121. <el-table-column label="课程名称" align="center" prop="courseName" />
  122. <el-table-column label="小节名称" align="center" prop="videoName" />
  123. <el-table-column label="是否全部正确" align="center" prop="isRight" >
  124. <template slot-scope="scope">
  125. <dict-tag :options="sysCompanyOr" :value="scope.row.isRight"></dict-tag>
  126. </template>
  127. </el-table-column>
  128. <el-table-column label="销售名称" align="center" prop="companyUserName" />
  129. <el-table-column label="企微员工名称" align="center" prop="qwUserName" />
  130. <el-table-column label="公司名称" align="center" prop="companyName" />
  131. <el-table-column label="创建时间" align="center" prop="createTime" />
  132. </el-table>
  133. <pagination
  134. v-show="total>0"
  135. :total="total"
  136. :page.sync="queryParams.pageNum"
  137. :limit.sync="queryParams.pageSize"
  138. @pagination="getList"
  139. />
  140. </div>
  141. </template>
  142. <script>
  143. import { myListLogs, getLogs, delLogs, addLogs, updateLogs, exportLogs } from "@/api/course/courseAnswerlogs";
  144. import { courseList, videoList } from '@/api/course/courseRedPacketLog'
  145. import {allListTagGroup} from "@/api/qw/tagGroup";
  146. import {listTag} from "@/api/qw/tag";
  147. import {getMyQwUserList} from "@/api/qw/user";
  148. export default {
  149. name: "Logs",
  150. data() {
  151. return {
  152. // 遮罩层
  153. loading: false,
  154. // 导出遮罩层
  155. exportLoading: false,
  156. // 选中数组
  157. ids: [],
  158. // 非单个禁用
  159. single: true,
  160. // 非多个禁用
  161. multiple: true,
  162. // 显示搜索条件
  163. showSearch: true,
  164. // 总条数
  165. total: 0,
  166. //课程
  167. courseLists:[],
  168. //小节
  169. videoList:[],
  170. //是否
  171. sysCompanyOr:[],
  172. myQwUserList:[],
  173. // 答题日志表格数据
  174. logsList: [],
  175. // 弹出层标题
  176. title: "",
  177. // 是否显示弹出层
  178. open: false,
  179. // 查询参数
  180. queryParams: {
  181. pageNum: 1,
  182. pageSize: 10,
  183. phone: null,
  184. phoneMk: null,
  185. userId:null,
  186. courseId: null,
  187. videoId: null,
  188. qwUserId:null,
  189. companyUserName: null,
  190. companyId: null,
  191. isRight: null,
  192. sTime:null,
  193. eTime:null,
  194. },
  195. //选择时间
  196. createTime:null,
  197. // 表单参数
  198. form: {},
  199. // 表单校验
  200. rules: {
  201. }
  202. };
  203. },
  204. created() {
  205. courseList().then(response => {
  206. this.courseLists = response.list;
  207. });
  208. getMyQwUserList().then(response => {
  209. this.myQwUserList = response.data;
  210. if(this.myQwUserList!=null){
  211. this.queryParams.qwUserId=this.myQwUserList[0].dictValue
  212. this.queryParams.corpId=this.myQwUserList[0].corpId
  213. this.getList();
  214. }
  215. });
  216. this.getDicts("sys_company_or").then(response => {
  217. this.sysCompanyOr = response.data;
  218. });
  219. // this.getList();
  220. },
  221. methods: {
  222. /** 查询答题日志列表 */
  223. getList() {
  224. this.loading = true;
  225. myListLogs(this.queryParams).then(response => {
  226. this.logsList = response.rows;
  227. this.total = response.total;
  228. this.loading = false;
  229. });
  230. },
  231. //查询小节
  232. courseChange(row){
  233. videoList(row).then(response => {
  234. this.videoList=response.list
  235. });
  236. },
  237. updateQwuser(){
  238. for (const user of this.myQwUserList) {
  239. if (user.dictValue == this.queryParams.qwUserId) {
  240. this.queryParams.corpId=user.corpId;
  241. break;
  242. }
  243. }
  244. this.getList();
  245. },
  246. timeChange(){
  247. if(this.createTime!=null){
  248. this.queryParams.sTime=this.createTime[0];
  249. this.queryParams.eTime=this.createTime[1];
  250. }else{
  251. this.queryParams.sTime=null;
  252. this.queryParams.eTime=null;
  253. }
  254. },
  255. // 取消按钮
  256. cancel() {
  257. this.open = false;
  258. this.reset();
  259. },
  260. // 表单重置
  261. reset() {
  262. this.form = {
  263. logId: null,
  264. phone:null,
  265. phoneMk:null,
  266. userId: null,
  267. videoId: null,
  268. isRight: null,
  269. createTime: null,
  270. companyUserName: null,
  271. companyId: null,
  272. sTime:null,
  273. eTime:null,
  274. };
  275. this.resetForm("form");
  276. },
  277. /** 搜索按钮操作 */
  278. handleQuery() {
  279. this.queryParams.pageNum = 1;
  280. this.getList();
  281. },
  282. /** 重置按钮操作 */
  283. resetQuery() {
  284. this.resetForm("queryForm");
  285. this.queryParams.qwUserId=this.myQwUserList[0].dictValue;
  286. this.queryParams.corpId=this.myQwUserList[0].corpId;
  287. this.createTime=null;
  288. this.queryParams.sTime=null;
  289. this.queryParams.eTime=null;
  290. this.handleQuery();
  291. },
  292. // 多选框选中数据
  293. handleSelectionChange(selection) {
  294. this.ids = selection.map(item => item.logId)
  295. this.single = selection.length!==1
  296. this.multiple = !selection.length
  297. },
  298. /** 新增按钮操作 */
  299. handleAdd() {
  300. this.reset();
  301. this.open = true;
  302. this.title = "添加答题日志";
  303. },
  304. /** 修改按钮操作 */
  305. handleUpdate(row) {
  306. this.reset();
  307. const logId = row.logId || this.ids
  308. getLogs(logId).then(response => {
  309. this.form = response.data;
  310. this.open = true;
  311. this.title = "修改答题日志";
  312. });
  313. },
  314. /** 提交按钮 */
  315. submitForm() {
  316. this.$refs["form"].validate(valid => {
  317. if (valid) {
  318. if (this.form.logId != null) {
  319. updateLogs(this.form).then(response => {
  320. this.msgSuccess("修改成功");
  321. this.open = false;
  322. this.getList();
  323. });
  324. } else {
  325. addLogs(this.form).then(response => {
  326. this.msgSuccess("新增成功");
  327. this.open = false;
  328. this.getList();
  329. });
  330. }
  331. }
  332. });
  333. },
  334. /** 删除按钮操作 */
  335. handleDelete(row) {
  336. const logIds = row.logId || this.ids;
  337. this.$confirm('是否确认删除答题日志编号为"' + logIds + '"的数据项?', "警告", {
  338. confirmButtonText: "确定",
  339. cancelButtonText: "取消",
  340. type: "warning"
  341. }).then(function() {
  342. return delLogs(logIds);
  343. }).then(() => {
  344. this.getList();
  345. this.msgSuccess("删除成功");
  346. }).catch(() => {});
  347. },
  348. /** 导出按钮操作 */
  349. handleExport() {
  350. const queryParams = this.queryParams;
  351. this.$confirm('是否确认导出所有答题日志数据项?', "警告", {
  352. confirmButtonText: "确定",
  353. cancelButtonText: "取消",
  354. type: "warning"
  355. }).then(() => {
  356. this.exportLoading = true;
  357. return exportLogs(queryParams);
  358. }).then(response => {
  359. this.download(response.msg);
  360. this.exportLoading = false;
  361. }).catch(() => {});
  362. }
  363. }
  364. };
  365. </script>