index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  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="phone">
  5. <el-input
  6. v-model="queryParams.phone"
  7. placeholder="请输入客户电话"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="客户昵称" prop="nickName">
  14. <el-input
  15. v-model="queryParams.nickName"
  16. placeholder="请输入客户客户昵称"
  17. clearable
  18. size="small"
  19. @keyup.enter.native="handleQuery"
  20. />
  21. </el-form-item>
  22. <el-form-item label="加密电话" prop="phoneMk">
  23. <el-input
  24. v-model="queryParams.phoneMk"
  25. placeholder="请输入用户加密电话"
  26. clearable
  27. size="small"
  28. @keyup.enter.native="handleQuery"
  29. />
  30. </el-form-item>
  31. <el-form-item label="课程" prop="courseId">
  32. <el-select filterable v-model="queryParams.courseId" placeholder="请选择课程" clearable size="small" @change="courseChange(queryParams.courseId)">
  33. <el-option
  34. v-for="dict in courseLists"
  35. :key="dict.dictValue"
  36. :label="dict.dictLabel"
  37. :value="parseInt(dict.dictValue)"
  38. />
  39. </el-select>
  40. </el-form-item>
  41. <el-form-item label="小节" prop="videoId">
  42. <el-select filterable v-model="queryParams.videoId" placeholder="请选择小节" clearable size="small">
  43. <el-option
  44. v-for="dict in videoList"
  45. :key="dict.dictValue"
  46. :label="dict.dictLabel"
  47. :value="parseInt(dict.dictValue)"
  48. />
  49. </el-select>
  50. </el-form-item>
  51. <el-form-item label="销售名称" prop="companyUserName">
  52. <el-input
  53. v-model="queryParams.companyUserName"
  54. placeholder="请输入销售名称"
  55. clearable
  56. size="small"
  57. @keyup.enter.native="handleQuery"
  58. />
  59. </el-form-item>
  60. <el-form-item label="公司" prop="companyId">
  61. <el-select filterable v-model="queryParams.companyId" placeholder="请选择公司名" clearable size="small">
  62. <el-option
  63. v-for="item in companys"
  64. :key="item.companyId"
  65. :label="item.companyName"
  66. :value="item.companyId"
  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:export']"
  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 { listLogs, getLogs, delLogs, addLogs, updateLogs, exportLogs } from "@/api/course/qw/courseAnswerlogs";
  144. import { courseList, videoList } from '@/api/course/courseRedPacketLog'
  145. import { getCompanyList } from '@/api/company/company'
  146. export default {
  147. name: "Logs",
  148. data() {
  149. return {
  150. // 遮罩层
  151. loading: true,
  152. // 导出遮罩层
  153. exportLoading: false,
  154. // 选中数组
  155. ids: [],
  156. // 非单个禁用
  157. single: true,
  158. // 非多个禁用
  159. multiple: true,
  160. // 显示搜索条件
  161. showSearch: true,
  162. // 总条数
  163. total: 0,
  164. //课程
  165. courseLists:[],
  166. //小节
  167. videoList:[],
  168. //公司
  169. companys:[],
  170. //是否
  171. sysCompanyOr:[],
  172. // 答题日志表格数据
  173. logsList: [],
  174. // 弹出层标题
  175. title: "",
  176. // 是否显示弹出层
  177. open: false,
  178. // 查询参数
  179. queryParams: {
  180. pageNum: 1,
  181. pageSize: 10,
  182. phone: null,
  183. phoneMk: null,
  184. courseId: null,
  185. videoId: null,
  186. companyUserName: null,
  187. companyId: null,
  188. isRight: null,
  189. sTime:null,
  190. eTime:null,
  191. },
  192. //选择时间
  193. createTime:null,
  194. // 表单参数
  195. form: {},
  196. // 表单校验
  197. rules: {
  198. }
  199. };
  200. },
  201. created() {
  202. courseList().then(response => {
  203. this.courseLists = response.list;
  204. });
  205. getCompanyList().then(response => {
  206. this.companys = response.data;
  207. if(this.companys!=null&&this.companys.length>0){
  208. this.companyId=this.companys[0].companyId;
  209. this.getTreeselect();
  210. }
  211. this.companys.push({companyId:"-1",companyName:"无"})
  212. });
  213. this.getDicts("sys_company_or").then(response => {
  214. this.sysCompanyOr = response.data;
  215. });
  216. this.getList();
  217. },
  218. methods: {
  219. /** 查询答题日志列表 */
  220. getList() {
  221. this.loading = true;
  222. listLogs(this.queryParams).then(response => {
  223. this.logsList = response.rows;
  224. this.total = response.total;
  225. this.loading = false;
  226. });
  227. },
  228. //查询小节
  229. courseChange(row){
  230. videoList(row).then(response => {
  231. this.videoList=response.list
  232. });
  233. },
  234. timeChange(){
  235. if(this.createTime!=null){
  236. this.queryParams.sTime=this.createTime[0];
  237. this.queryParams.eTime=this.createTime[1];
  238. }else{
  239. this.queryParams.sTime=null;
  240. this.queryParams.eTime=null;
  241. }
  242. },
  243. // 取消按钮
  244. cancel() {
  245. this.open = false;
  246. this.reset();
  247. },
  248. // 表单重置
  249. reset() {
  250. this.form = {
  251. logId: null,
  252. phone:null,
  253. phoneMk:null,
  254. userId: null,
  255. videoId: null,
  256. isRight: null,
  257. createTime: null,
  258. companyUserName: null,
  259. companyId: null,
  260. sTime:null,
  261. eTime:null,
  262. };
  263. this.resetForm("form");
  264. },
  265. /** 搜索按钮操作 */
  266. handleQuery() {
  267. this.queryParams.pageNum = 1;
  268. this.getList();
  269. },
  270. /** 重置按钮操作 */
  271. resetQuery() {
  272. this.resetForm("queryForm");
  273. this.createTime=null;
  274. this.queryParams.sTime=null;
  275. this.queryParams.eTime=null;
  276. this.handleQuery();
  277. },
  278. // 多选框选中数据
  279. handleSelectionChange(selection) {
  280. this.ids = selection.map(item => item.logId)
  281. this.single = selection.length!==1
  282. this.multiple = !selection.length
  283. },
  284. /** 新增按钮操作 */
  285. handleAdd() {
  286. this.reset();
  287. this.open = true;
  288. this.title = "添加答题日志";
  289. },
  290. /** 修改按钮操作 */
  291. handleUpdate(row) {
  292. this.reset();
  293. const logId = row.logId || this.ids
  294. getLogs(logId).then(response => {
  295. this.form = response.data;
  296. this.open = true;
  297. this.title = "修改答题日志";
  298. });
  299. },
  300. /** 提交按钮 */
  301. submitForm() {
  302. this.$refs["form"].validate(valid => {
  303. if (valid) {
  304. if (this.form.logId != null) {
  305. updateLogs(this.form).then(response => {
  306. this.msgSuccess("修改成功");
  307. this.open = false;
  308. this.getList();
  309. });
  310. } else {
  311. addLogs(this.form).then(response => {
  312. this.msgSuccess("新增成功");
  313. this.open = false;
  314. this.getList();
  315. });
  316. }
  317. }
  318. });
  319. },
  320. /** 删除按钮操作 */
  321. handleDelete(row) {
  322. const logIds = row.logId || this.ids;
  323. this.$confirm('是否确认删除答题日志编号为"' + logIds + '"的数据项?', "警告", {
  324. confirmButtonText: "确定",
  325. cancelButtonText: "取消",
  326. type: "warning"
  327. }).then(function() {
  328. return delLogs(logIds);
  329. }).then(() => {
  330. this.getList();
  331. this.msgSuccess("删除成功");
  332. }).catch(() => {});
  333. },
  334. /** 导出按钮操作 */
  335. handleExport() {
  336. const queryParams = this.queryParams;
  337. this.$confirm('是否确认导出所有答题日志数据项?', "警告", {
  338. confirmButtonText: "确定",
  339. cancelButtonText: "取消",
  340. type: "warning"
  341. }).then(() => {
  342. this.exportLoading = true;
  343. return exportLogs(queryParams);
  344. }).then(response => {
  345. this.download(response.msg);
  346. this.exportLoading = false;
  347. }).catch(() => {});
  348. }
  349. }
  350. };
  351. </script>