index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  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="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="phone">
  28. <el-input
  29. v-model="queryParams.phone"
  30. placeholder="请输入客户电话"
  31. clearable
  32. size="small"
  33. @keyup.enter.native="handleQuery"
  34. />
  35. </el-form-item>
  36. <el-form-item label="加密电话" prop="phoneMk">
  37. <el-input
  38. v-model="queryParams.phoneMk"
  39. placeholder="请输入用户加密电话"
  40. clearable
  41. size="small"
  42. @keyup.enter.native="handleQuery"
  43. />
  44. </el-form-item>
  45. <el-form-item label="课程" prop="courseId">
  46. <el-select filterable v-model="queryParams.courseId" placeholder="请选择课程" clearable size="small" @change="courseChange(queryParams.courseId)">
  47. <el-option
  48. v-for="dict in courseLists"
  49. :key="dict.dictValue"
  50. :label="dict.dictLabel"
  51. :value="parseInt(dict.dictValue)"
  52. />
  53. </el-select>
  54. </el-form-item>
  55. <el-form-item label="小节" prop="videoId">
  56. <el-select filterable v-model="queryParams.videoId" placeholder="请选择小节" clearable size="small">
  57. <el-option
  58. v-for="dict in videoList"
  59. :key="dict.dictValue"
  60. :label="dict.dictLabel"
  61. :value="parseInt(dict.dictValue)"
  62. />
  63. </el-select>
  64. </el-form-item>
  65. <el-form-item label="销售名称" prop="companyUserName">
  66. <el-input
  67. v-model="queryParams.companyUserName"
  68. placeholder="请输入销售名称"
  69. clearable
  70. size="small"
  71. @keyup.enter.native="handleQuery"
  72. />
  73. </el-form-item>
  74. <el-form-item label="公司" prop="companyId">
  75. <el-select filterable v-model="queryParams.companyId" placeholder="请选择公司名" clearable size="small">
  76. <el-option
  77. v-for="item in companys"
  78. :key="item.companyId"
  79. :label="item.companyName"
  80. :value="item.companyId"
  81. />
  82. </el-select>
  83. </el-form-item>
  84. <el-form-item label="是否全部正确" prop="isRight">
  85. <el-select filterable v-model="queryParams.isRight" placeholder="请选择公司名" clearable size="small">
  86. <el-option
  87. v-for="dict in sysCompanyOr"
  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"
  96. type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" @change="timeChange"></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:courseAnswerLog:export']"
  113. >导出</el-button>
  114. </el-col>
  115. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  116. </el-row>
  117. <el-table border v-loading="loading" :data="logsList" @selection-change="handleSelectionChange">
  118. <el-table-column type="selection" width="55" align="center" />
  119. <el-table-column label="小程序用户名" align="center" prop="userName" />
  120. <el-table-column label="课程名称" align="center" prop="courseName" />
  121. <el-table-column label="小节名称" align="center" prop="videoName" />
  122. <el-table-column label="是否全部正确" align="center" prop="isRight" >
  123. <template slot-scope="scope">
  124. <dict-tag :options="sysCompanyOr" :value="scope.row.isRight"></dict-tag>
  125. </template>
  126. </el-table-column>
  127. <el-table-column label="销售名称" align="center" prop="companyUserName" />
  128. <el-table-column label="企微员工名称" align="center" prop="qwUserName" />
  129. <el-table-column label="公司名称" align="center" prop="companyName" />
  130. <el-table-column label="创建时间" align="center" prop="createTime" />
  131. </el-table>
  132. <pagination
  133. v-show="total>0"
  134. :total="total"
  135. :page.sync="queryParams.pageNum"
  136. :limit.sync="queryParams.pageSize"
  137. @pagination="getList"
  138. />
  139. </div>
  140. </template>
  141. <script>
  142. import { listLogs, getLogs, delLogs, addLogs, updateLogs, exportLogs } from "@/api/course/courseAnswerlogs";
  143. import { courseList, videoList } from '@/api/course/courseRedPacketLog'
  144. import { getCompanyList } from '@/api/company/company'
  145. import SelectTree from '@/components/TreeSelect/index.vue'
  146. import { getDeptData } from '@/api/system/employeeStats'
  147. export default {
  148. name: "Logs",
  149. components: { SelectTree },
  150. data() {
  151. return {
  152. selectedCompanyList: [],
  153. deptList: [],
  154. // 遮罩层
  155. loading: true,
  156. // 导出遮罩层
  157. exportLoading: false,
  158. // 选中数组
  159. ids: [],
  160. // 非单个禁用
  161. single: true,
  162. // 非多个禁用
  163. multiple: true,
  164. // 显示搜索条件
  165. showSearch: true,
  166. // 总条数
  167. total: 0,
  168. //课程
  169. courseLists:[],
  170. //小节
  171. videoList:[],
  172. //公司
  173. companys:[],
  174. //是否
  175. sysCompanyOr:[],
  176. // 答题日志表格数据
  177. logsList: [],
  178. // 弹出层标题
  179. title: "",
  180. // 是否显示弹出层
  181. open: false,
  182. // 查询参数
  183. queryParams: {
  184. pageNum: 1,
  185. pageSize: 10,
  186. phone: null,
  187. phoneMk: null,
  188. courseId: null,
  189. videoId: null,
  190. companyUserName: null,
  191. companyId: null,
  192. isRight: null,
  193. sTime:null,
  194. eTime:null,
  195. },
  196. //选择时间
  197. createTime:null,
  198. // 表单参数
  199. form: {},
  200. // 表单校验
  201. rules: {
  202. }
  203. };
  204. },
  205. created() {
  206. getDeptData().then(response => {
  207. this.deptList = response.data;
  208. })
  209. courseList().then(response => {
  210. this.courseLists = response.list;
  211. });
  212. getCompanyList().then(response => {
  213. this.companys = response.data;
  214. if(this.companys!=null&&this.companys.length>0){
  215. this.companyId=this.companys[0].companyId;
  216. this.getTreeselect();
  217. }
  218. this.companys.push({companyId:"-1",companyName:"无"})
  219. });
  220. this.getDicts("sys_company_or").then(response => {
  221. this.sysCompanyOr = response.data;
  222. });
  223. this.getList();
  224. },
  225. methods: {
  226. /** 查询答题日志列表 */
  227. getList() {
  228. this.loading = true;
  229. if(this.selectedCompanyList != null && this.selectedCompanyList.length > 0) {
  230. this.queryParams.companyUserIds = this.selectedCompanyList;
  231. }else {
  232. this.queryParams.companyUserIds = [];
  233. }
  234. listLogs(this.queryParams).then(response => {
  235. this.logsList = response.rows;
  236. this.total = response.total;
  237. this.loading = false;
  238. });
  239. },
  240. //查询小节
  241. courseChange(row){
  242. videoList(row).then(response => {
  243. this.videoList=response.list
  244. });
  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.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>