index.vue 11 KB

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