index.vue 11 KB

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