deptWatchLog.vue 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
  4. <el-form-item label="部门" prop="deptId">
  5. <treeselect style="width: 220px" :clearable="false" v-model="queryParams.deptId" :options="deptOptions" clearable :show-count="true" placeholder="仅显示销售所在部门层级" />
  6. </el-form-item>
  7. <el-form-item label="记录编号" prop="logId">
  8. <el-input
  9. v-model="queryParams.logId"
  10. placeholder="请输入记录编号"
  11. clearable
  12. size="small"
  13. />
  14. </el-form-item>
  15. <el-form-item label="看课方式" prop="sendType">
  16. <el-select v-model="queryParams.sendType" placeholder="选择看课方式" clearable size="small" @change="handleSendTypeChange">
  17. <el-option
  18. v-for="dict in sendTypeOptions"
  19. :key="dict.dictValue"
  20. :label="dict.dictLabel"
  21. :value="dict.dictValue"
  22. />
  23. </el-select>
  24. </el-form-item>
  25. <el-form-item label="会员ID" prop="userId">
  26. <el-input
  27. v-model="queryParams.userId"
  28. placeholder="请输入会员ID"
  29. clearable
  30. size="small"
  31. @keyup.enter.native="handleQuery"
  32. />
  33. </el-form-item>
  34. <el-form-item label="会员昵称" prop="nickName">
  35. <el-input
  36. v-model="queryParams.nickName"
  37. placeholder="请输入会员昵称"
  38. clearable
  39. size="small"
  40. @keyup.enter.native="handleQuery"
  41. />
  42. </el-form-item>
  43. <el-form-item label="企微客户昵称" prop="nickName" >
  44. <el-input
  45. v-model="queryParams.externalUserName"
  46. placeholder="请输入企微客户昵称"
  47. clearable
  48. size="small"
  49. @keyup.enter.native="handleQuery"
  50. />
  51. </el-form-item>
  52. <el-form-item v-if="companyName === undefined || companyName === 1" label="所属销售" prop="companyUserId">
  53. <el-select v-model="queryParams.companyUserId" clearable filterable remote
  54. placeholder="请输入关键词" :remote-method="loadCompanyUserOptions"
  55. v-select-load-more="loadMoreCompanyUserOptions"
  56. :loading="companyUserOptionsLoading">
  57. <el-option
  58. v-for="item in companyUserOptions"
  59. :key="item.dictValue"
  60. :label="item.dictLabel"
  61. :value="item.dictValue">
  62. </el-option>
  63. </el-select>
  64. </el-form-item>
  65. <el-form-item v-if="companyName==2" label="所属销售" prop="companyUserId">
  66. <el-select v-model="queryParams.companyUserId" clearable filterable remote
  67. placeholder="请输入关键词"
  68. v-select-load-more="loadMoreCompanyUserOptions"
  69. :loading="companyUserOptionsLoading">
  70. <el-option
  71. v-for="item in companyUserOptionsByAll"
  72. :key="item.dictValue"
  73. :label="item.dictLabel"
  74. :value="item.dictValue">
  75. </el-option>
  76. </el-select>
  77. </el-form-item>
  78. <el-form-item label="课程" prop="courseId">
  79. <el-select filterable v-model="queryParams.courseId" placeholder="请选择课程" clearable size="small" @change="courseChange(queryParams.courseId)">
  80. <el-option
  81. v-for="dict in courseLists"
  82. :key="dict.dictValue"
  83. :label="dict.dictLabel"
  84. :value="dict.dictValue"
  85. />
  86. </el-select>
  87. </el-form-item>
  88. <el-form-item label="小节" prop="videoId">
  89. <el-select filterable v-model="queryParams.videoId" placeholder="请选择小节" clearable size="small">
  90. <el-option
  91. v-for="dict in videoList"
  92. :key="dict.dictValue"
  93. :label="dict.dictLabel"
  94. :value="dict.dictValue"
  95. >
  96. <span style="float: left">{{ dict.dictLabel }}</span>
  97. <span style="float: right; color: #8492a6; font-size: 13px">ID: {{ dict.dictValue }}</span>
  98. <span v-if="dict.isDel === 1" style="float: right; color: #f56c6c; font-size: 13px; margin-right: 10px">已删除</span>
  99. </el-option>
  100. </el-select>
  101. </el-form-item>
  102. <!-- sop名称 -->
  103. <el-form-item label="SOP名称" prop="sopId" v-if="queryParams.sendType == 2">
  104. <el-autocomplete
  105. v-model="sopSearchText"
  106. :fetch-suggestions="querySopAsync"
  107. placeholder="请输入SOP名称"
  108. clearable
  109. size="small"
  110. style="width: 200px"
  111. @select="handleSopSelect"
  112. @clear="handleSopClear"
  113. :trigger-on-focus="false"
  114. >
  115. <template slot-scope="{ item }">
  116. <div class="sop-item">
  117. <span class="sop-name">{{ item.name }}</span>
  118. </div>
  119. </template>
  120. </el-autocomplete>
  121. </el-form-item>
  122. <el-form-item label="企微ID" prop="qwUserUserId">
  123. <el-input
  124. v-model="queryParams.qwUserUserId"
  125. placeholder="请输入所属企微ID"
  126. clearable
  127. size="small"
  128. @keyup.enter.native="handleQuery"
  129. />
  130. </el-form-item>
  131. <el-form-item label="企微员工名称" prop="qwUserName">
  132. <el-input
  133. v-model="queryParams.qwUserName"
  134. placeholder="请输入所属企微员工名称"
  135. clearable
  136. size="small"
  137. @keyup.enter.native="handleQuery"
  138. />
  139. </el-form-item>
  140. <!-- <el-form-item label="部门名称" prop="deptName">-->
  141. <!-- <el-input-->
  142. <!-- v-model="queryParams.deptName"-->
  143. <!-- placeholder="请输入部门名称"-->
  144. <!-- clearable-->
  145. <!-- size="small"-->
  146. <!-- @keyup.enter.native="handleQuery"-->
  147. <!-- />-->
  148. <!-- </el-form-item>-->
  149. <!-- 营期时间 -->
  150. <!-- <el-form-item label="营期时间" prop="scheduleTime">
  151. <el-input
  152. v-model="scheduleTimeText"
  153. placeholder="请选择营期时间"
  154. readonly
  155. @click.native="showScheduleCalendar = true"
  156. />
  157. <calendar
  158. v-model="scheduleTime"
  159. mode="during"
  160. :show.sync="showScheduleCalendar"
  161. @change="handleScheduleTimeChange"
  162. :key="scheduleCalendarKey"
  163. />
  164. </el-form-item> -->
  165. <el-form-item label="营期时间" prop="scheduleTime">
  166. <el-date-picker
  167. v-model="scheduleTimeText"
  168. type="daterange"
  169. range-separator="至"
  170. start-placeholder="开始日期"
  171. end-placeholder="结束日期"
  172. value-format="yyyy-MM-dd"
  173. style="width: 240px"
  174. @change="handleScheduleTimeChange"
  175. />
  176. </el-form-item>
  177. <!-- 创建时间 -->
  178. <!-- <el-form-item label="创建时间" prop="createTime">
  179. <el-input
  180. v-model="createTimeText"
  181. placeholder="请选择创建时间"
  182. readonly
  183. @click.native="showCreateCalendar = true"
  184. />
  185. <calendar
  186. v-model="createTime"
  187. mode="during"
  188. :show.sync="showCreateCalendar"
  189. @change="createChange"
  190. :key="createCalendarKey"
  191. />
  192. </el-form-item> -->
  193. <el-form-item label="创建时间" prop="createTime">
  194. <el-date-picker
  195. v-model="createTimeText"
  196. type="datetimerange"
  197. range-separator="至"
  198. start-placeholder="开始日期"
  199. end-placeholder="结束日期"
  200. value-format="yyyy-MM-dd HH:mm:ss"
  201. @change="createChange"
  202. :default-time="['00:00:00', '23:59:59']"
  203. />
  204. </el-form-item>
  205. <!-- 最新更新时间 -->
  206. <!-- <el-form-item label="最新更新时间" prop="updateTime">
  207. <el-input
  208. v-model="updateTimeText"
  209. placeholder="请选择更新时间"
  210. readonly
  211. @click.native="showUpdateCalendar = true"
  212. />
  213. <calendar
  214. v-model="updateTime"
  215. mode="during"
  216. :show.sync="showUpdateCalendar"
  217. @change="updateChange"
  218. :key="updateCalendarKey"
  219. />
  220. </el-form-item> -->
  221. <el-form-item label="最新更新时间" prop="updateTime">
  222. <el-date-picker
  223. v-model="updateTimeText"
  224. type="datetimerange"
  225. range-separator="至"
  226. start-placeholder="开始日期"
  227. end-placeholder="结束日期"
  228. value-format="yyyy-MM-dd HH:mm:ss"
  229. @change="updateChange"
  230. :default-time="['00:00:00', '23:59:59']"
  231. />
  232. </el-form-item>
  233. <!-- 进线时间 -->
  234. <!-- <el-form-item label="进线时间" prop="qecCreateTime">
  235. <el-input
  236. v-model="qecCreateTimeText"
  237. placeholder="请选择进线时间"
  238. readonly
  239. @click.native="showQecCalendar = true"
  240. />
  241. <calendar
  242. v-model="qecCreateTime"
  243. mode="during"
  244. :show.sync="showQecCalendar"
  245. @change="qecCreateTimeChange"
  246. :key="qecCalendarKey"
  247. />
  248. </el-form-item> -->
  249. <el-form-item label="进线时间" prop="qecCreateTime">
  250. <el-date-picker
  251. v-model="qecCreateTimeText"
  252. type="daterange"
  253. range-separator="至"
  254. start-placeholder="开始日期"
  255. end-placeholder="结束日期"
  256. value-format="yyyy-MM-dd"
  257. style="width: 240px"
  258. @change="qecCreateTimeChange"
  259. />
  260. </el-form-item>
  261. <el-form-item label="营期课程时间" prop="periodTime" v-if="queryParams.sendType==1">
  262. <el-date-picker
  263. v-model="periodTimeText"
  264. type="datetimerange"
  265. align="right"
  266. unlink-panels
  267. value-format="yyyy-MM-dd HH:mm:ss"
  268. range-separator="至"
  269. start-placeholder="开始日期"
  270. end-placeholder="结束日期"
  271. :picker-options="pickerOptions"
  272. @change="qecPeriodTimeChange"
  273. :default-time="['00:00:00', '23:59:59']">
  274. </el-date-picker>
  275. </el-form-item>
  276. <!-- 记录类型 - 仅在全部选项卡时显示 -->
  277. <el-form-item label="记录类型" prop="logType" v-if="activeName === '00'">
  278. <el-select
  279. v-model="queryParams.logType"
  280. placeholder="请选择记录类型"
  281. clearable
  282. size="small"
  283. filterable>
  284. <el-option
  285. v-for="dict in logTypeOptions"
  286. :key="dict.dictValue"
  287. :label="dict.dictLabel"
  288. :value="dict.dictValue"
  289. />
  290. </el-select>
  291. </el-form-item>
  292. <el-form-item>
  293. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  294. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  295. </el-form-item>
  296. </el-form>
  297. <!-- <el-row :gutter="10" class="mb8">-->
  298. <!-- <el-col :span="1.5">-->
  299. <!-- <el-button-->
  300. <!-- type="warning"-->
  301. <!-- plain-->
  302. <!-- icon="el-icon-download"-->
  303. <!-- size="mini"-->
  304. <!-- :loading="exportLoading"-->
  305. <!-- @click="handleExport"-->
  306. <!-- v-hasPermi="['course:courseWatchLog:export']"-->
  307. <!-- >导出</el-button>-->
  308. <!-- </el-col>-->
  309. <!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
  310. <!-- </el-row>-->
  311. <el-tabs type="card" v-model="activeName" @tab-click="handleClickX">
  312. <el-tab-pane label="全部" name="00"></el-tab-pane>
  313. <el-tab-pane v-for="(item,index) in logTypeOptions" :label="item.dictLabel" :name="item.dictValue"></el-tab-pane>
  314. </el-tabs>
  315. <el-table border v-loading="loading" :data="courseWatchLogList" @selection-change="handleSelectionChange">
  316. <el-table-column type="selection" width="55" align="center" />
  317. <el-table-column label="记录编号" align="center" prop="logId" />
  318. <el-table-column label="企微客户" align="center" prop="externalUserName"/>
  319. <el-table-column label="客户头像" align="center" prop="externalUserAvatar">
  320. <template slot-scope="scope">
  321. <el-popover
  322. placement="right"
  323. trigger="hover">
  324. <img slot="reference" :src="scope.row.externalUserAvatar" style="width: 40px;height: 40px">
  325. <img :src="scope.row.externalUserAvatar" style="max-width: 250px;max-height: 250px">
  326. </el-popover>
  327. </template>
  328. </el-table-column>
  329. <el-table-column label="会员ID" align="center" prop="userId" />
  330. <el-table-column label="会员昵称" align="center" prop="fsNickName">
  331. <template slot-scope="scope">
  332. <div style="display: flex;white-space: nowrap">
  333. <div style="margin: auto">
  334. {{scope.row.fsNickName}}
  335. </div>
  336. <el-popover
  337. placement="right"
  338. title=""
  339. trigger="hover">
  340. <img slot="reference" :src="scope.row.fsAvatar" style="width: 30px;height: 30px">
  341. <img :src="scope.row.fsAvatar" style="max-width: 200px;max-height: 200px">
  342. </el-popover>
  343. </div>
  344. </template>
  345. </el-table-column>
  346. <el-table-column label="课程名称" align="center" prop="courseName" />
  347. <el-table-column label="小节名称" align="center" prop="videoName" />
  348. <el-table-column label="记录类型" align="center" prop="logType">
  349. <template slot-scope="scope">
  350. <dict-tag :options="logTypeOptions" :value="scope.row.logType"/>
  351. </template>
  352. </el-table-column>
  353. <el-table-column label="播放时长" align="center" prop="duration" />
  354. <el-table-column label="所属销售" align="center" prop="companyUserName" />
  355. <!-- <el-table-column label="所属公司" align="center" prop="companyName" />-->
  356. <el-table-column label="企微员工名称" align="center" prop="qwUserName" />
  357. <!-- <el-table-column label="所属发送方式" align="center" prop="sendType" />-->
  358. <el-table-column label="创建时间" align="center" prop="createTime" />
  359. <el-table-column label="更新时间" align="center" prop="updateTime" />
  360. <el-table-column label="完课时间" align="center" prop="finishTime" />
  361. <el-table-column label="营期时间" align="center" prop="campPeriodTime" />
  362. <el-table-column label="进线时间" align="center" prop="qecCreateTime" />
  363. <el-table-column label="是否领奖" align="center" prop="rewardType" >
  364. <template slot-scope="scope">
  365. <el-tag
  366. :type="scope.row.rewardType ? 'success' : 'info'"
  367. effect="plain"
  368. >
  369. {{ scope.row.rewardType ? '已领取' : '未领取' }}
  370. </el-tag>
  371. </template>
  372. </el-table-column>
  373. <el-table-column
  374. fixed="right"
  375. label="操作"
  376. width="100">
  377. <template slot-scope="scope">
  378. <el-button @click="openAnswerLogFun(scope.row)" type="text" size="small">答题记录</el-button>
  379. <el-button @click="openRedLogFun(scope.row)" type="text" size="small">红包记录</el-button>
  380. </template>
  381. </el-table-column>
  382. </el-table>
  383. <pagination
  384. v-show="total>0"
  385. :total="total"
  386. :page.sync="queryParams.pageNum"
  387. :limit.sync="queryParams.pageSize"
  388. @pagination="getList"
  389. />
  390. <el-drawer title="答题记录" :visible.sync="openAnswerLog" size="70%" append-to-body>
  391. <el-table border v-loading="" :data="answerLogsList">
  392. <el-table-column label="会员用户" align="center" prop="userName">
  393. <template slot-scope="scope">
  394. <div style="display: flex;white-space: nowrap">
  395. <div style="margin: auto">
  396. {{ scope.row.userName }}
  397. </div>
  398. <el-popover
  399. placement="right"
  400. title=""
  401. trigger="hover">
  402. <img slot="reference" :src="scope.row.fsAvatar" style="width: 30px;height: 30px">
  403. <img :src="scope.row.fsAvatar" style="max-width: 200px;max-height: 200px">
  404. </el-popover>
  405. </div>
  406. </template>
  407. </el-table-column>
  408. <el-table-column label="课程名称" align="center" prop="courseName"/>
  409. <el-table-column label="小节名称" align="center" prop="videoName"/>
  410. <el-table-column label="是否全部正确" align="center" prop="isRightText"/>
  411. <template slot-scope="scope">
  412. <dict-tag :options="sysCompanyOr" :value="scope.row.isRight" style="margin-bottom: 5px;"></dict-tag>
  413. <el-button type="text" size="mini" @click="showContentDialog(scope.row.questionJson)">
  414. 查看详情
  415. </el-button>
  416. </template>
  417. <el-table-column label="销售名称" align="center" prop="companyUserName"/>
  418. <el-table-column label="企微员工名称" align="center" prop="qwUserName"/>
  419. <el-table-column label="公司名称" align="center" prop="companyName"/>
  420. <el-table-column label="创建时间" align="center" prop="createTime"/>
  421. </el-table>
  422. <pagination
  423. v-show="answerLogTotal>0"
  424. :total="answerLogTotal"
  425. :page.sync="answerLogQueryParams.pageNum"
  426. :limit.sync="answerLogQueryParams.pageSize"
  427. @pagination="answerLogList"
  428. />
  429. </el-drawer>
  430. <el-drawer title="红包记录" :visible.sync="openRedLog" size="70%" append-to-body>
  431. <el-table border v-loading="" :data="redLogsList">
  432. <el-table-column type="selection" width="55" align="center" />
  433. <el-table-column label="记录编号" align="center" prop="logId" />
  434. <el-table-column label="批次单号" align="center" prop="outBatchNo" />
  435. <el-table-column label="课程名称" align="center" prop="courseId" >
  436. <template slot-scope="scope">
  437. <span prop="status" v-for="(item, index) in courseLists" v-if="scope.row.courseId==item.dictValue">{{item.dictLabel}}</span>
  438. </template>
  439. </el-table-column>
  440. <el-table-column label="小节名称" align="center" prop="title" />
  441. <!-- <el-table-column label="会员id" align="center" prop="userId" />-->
  442. <el-table-column label="会员用户" align="center" prop="fsNickName">
  443. <template slot-scope="scope">
  444. <div style="display: flex;white-space: nowrap">
  445. <div style="margin: auto">
  446. {{scope.row.fsNickName}}
  447. </div>
  448. <el-popover
  449. placement="right"
  450. title=""
  451. trigger="hover">
  452. <img slot="reference" :src="scope.row.fsAvatar" style="width: 30px;height: 30px">
  453. <img :src="scope.row.fsAvatar" style="max-width: 200px;max-height: 200px">
  454. </el-popover>
  455. </div>
  456. </template>
  457. </el-table-column>
  458. <!-- <el-table-column label="会员电话" align="center" prop="phone" />-->
  459. <!-- <el-table-column label="所属销售" align="center" prop="companyUserName" />-->
  460. <!-- <el-table-column label="所属公司" align="center" prop="companyName" />-->
  461. <el-table-column label="转账金额" align="center" prop="amount" />
  462. <el-table-column label="状态" align="center" prop="status" >
  463. <template slot-scope="scope">
  464. <el-tag>
  465. {{
  466. scope.row.status === 0 ? "发送中" :
  467. scope.row.status === 2 ? "待补发" :
  468. "已完成"
  469. }}
  470. </el-tag>
  471. </template>
  472. </el-table-column>
  473. <el-table-column label="所属企微" align="center" prop="qwUserName" />
  474. <el-table-column label="创建时间" align="center" prop="createTime" />
  475. <el-table-column label="备注" align="center" prop="remark" />
  476. </el-table>
  477. <pagination
  478. v-show="redLogTotal>0"
  479. :total="redLogTotal"
  480. :page.sync="redLogQueryParams.pageNum"
  481. :limit.sync="redLogQueryParams.pageSize"
  482. @pagination="redLogList"
  483. />
  484. </el-drawer>
  485. <el-dialog :visible.sync="contentDialog.isDialogVisible" title="消息详情" width="30%" append-to-body>
  486. <div>
  487. <div v-for="(item, index) in contentDialog.json || []" :key="index">
  488. <el-card class="box-card" style="margin-top: 2%">
  489. <div>题目:<span style="color: #0464f4">{{item.title}}</span></div>
  490. <div>答题:<span style="color: #000000">{{item.answer}}</span></div>
  491. <div>是否答题正确:
  492. <span :style="{color: item.status === 1 ? 'green' : 'red'}">
  493. {{ item.status === 1 ? '正确' : '错误' }}
  494. </span>
  495. </div>
  496. </el-card>
  497. </div>
  498. </div>
  499. <span slot="footer" class="dialog-footer">
  500. <el-button @click="contentDialog.isDialogVisible = false">关闭</el-button>
  501. </span>
  502. </el-dialog>
  503. </div>
  504. </template>
  505. <script>
  506. import {
  507. addCourseWatchLog,
  508. delCourseWatchLog,
  509. deptListCourseWatchLog,
  510. exportCourseWatchLog,
  511. getCourseWatchLog,
  512. updateCourseWatchLog
  513. } from "@/api/course/courseWatchLog";
  514. import {courseList, myListCourseRedPacketLog, videoListByWatch} from '@/api/course/courseRedPacketLog'
  515. import {myListLogs} from "@/api/course/courseAnswerlogs";
  516. import {getCompanyUserListLikeName} from "@/api/company/companyUser";
  517. import {getTask} from "@/api/common";
  518. import Vue from 'vue'
  519. import Calendar from 'vue-mobile-calendar'
  520. import {infoSop} from "@/api/qw/sop";
  521. import {myDeptTreeselect} from "../../../api/company/companyDept";
  522. import Treeselect from "@riophae/vue-treeselect";
  523. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  524. Vue.use(Calendar)
  525. export default {
  526. name: "CourseWatchLog",
  527. components: {Treeselect},
  528. data() {
  529. return {
  530. companyName:process.env.VUE_APP_COURSE_COMPANY_NAME,
  531. sopSearchText: '', // SOP搜索框显示的文本
  532. selectedSopId: null, // 选中的SOP ID
  533. sendTypeOptions:[{
  534. dictLabel:"会员",dictValue:'1'
  535. },
  536. {
  537. dictLabel:"企微",dictValue:'2'
  538. }
  539. ],
  540. // 日历 key 控制刷新
  541. scheduleCalendarKey: 0,
  542. createCalendarKey: 0,
  543. updateCalendarKey: 0,
  544. qecCalendarKey: 0,
  545. periodTimeKey: 0,
  546. createTimeText: '',
  547. scheduleTimeText: '', // 新增
  548. updateTimeText: '', // 新增
  549. qecCreateTimeText: '', // 新增
  550. periodTimeText: '', // 营期课程时间
  551. scheduleTime: [], // 改为数组
  552. createTime: [], // 改为数组
  553. updateTime: [], // 改为数组
  554. qecCreateTime: [], // 改为数组
  555. periodTime: [], // 改为数组
  556. // 控制日历显隐
  557. showScheduleCalendar: false,
  558. showCreateCalendar: false,
  559. showUpdateCalendar: false,
  560. showQecCalendar: false,
  561. deptOptions:[],
  562. activeName:"00",
  563. courseLists:[],
  564. videoList:[],
  565. logTypeOptions:[],
  566. //发送的消息
  567. contentDialog:{
  568. isDialogVisible:false,
  569. json: [],
  570. },
  571. // 遮罩层
  572. loading: true,
  573. // 导出遮罩层
  574. exportLoading: false,
  575. // 选中数组
  576. ids: [],
  577. // 非单个禁用
  578. single: true,
  579. // 非多个禁用
  580. multiple: true,
  581. // 显示搜索条件
  582. showSearch: true,
  583. // 总条数
  584. total: 0,
  585. // 短链课程看课记录表格数据
  586. courseWatchLogList: [],
  587. // 弹出层标题
  588. title: "",
  589. // 是否显示弹出层
  590. open: false,
  591. //答题记录
  592. openAnswerLog: false,
  593. loadingAnswerLog: true,
  594. answerLogsList: [],
  595. answerLogTotal: 0,
  596. answerLogQueryParams: {
  597. pageNum: 1,
  598. pageSize: 10,
  599. },
  600. //红包记录
  601. openRedLog: false,
  602. loadingRedLog: true,
  603. redLogsList: [],
  604. redLogTotal: 0,
  605. redLogQueryParams: {
  606. pageNum: 1,
  607. pageSize: 10,
  608. },
  609. pickerOptions: {
  610. disabledDate(time) {
  611. // 获取13天前的日期(加上今天就是14天)
  612. const sixDaysAgo = new Date();
  613. sixDaysAgo.setDate(sixDaysAgo.getDate() - 13);
  614. sixDaysAgo.setHours(0, 0, 0, 0);
  615. // 获取明天的日期(不包括今天)
  616. const tomorrow = new Date();
  617. tomorrow.setDate(tomorrow.getDate() + 1);
  618. tomorrow.setHours(0, 0, 0, 0);
  619. return time.getTime() < sixDaysAgo.getTime() || time.getTime() >= tomorrow.getTime();
  620. }
  621. },
  622. // 查询参数
  623. queryParams: {
  624. pageNum: 1,
  625. pageSize: 10,
  626. logId: null,
  627. userId: null,
  628. nickName: null,
  629. videoId: null,
  630. logType: null,
  631. qwExternalContactId: null,
  632. externalUserName:null,
  633. duration: null,
  634. qwUserId: null,
  635. qwUserName: null, //企微名称
  636. qwUserUserId: null, //企微id
  637. deptName: null, //部门名称
  638. companyUserId: null,
  639. companyId: null,
  640. courseId: null,
  641. sTime:null,
  642. eTime:null,
  643. upSTime:null,
  644. upETime:null,
  645. qecSTime:null,
  646. qecETime:null,
  647. periodSTime:null,
  648. periodETime:null,
  649. scheduleStartTime: null,
  650. scheduleEndTime: null,
  651. sendType:process.env.VUE_APP_COURSE_DEFAULT,
  652. sopId: null, // sopId
  653. },
  654. // 表单参数
  655. form: {},
  656. // 表单校验
  657. rules: {
  658. },
  659. // 员工选项列表
  660. companyUserOptionsParams: {
  661. name: undefined,
  662. hasNextPage: false,
  663. pageNum: 1,
  664. pageSize: 200
  665. },
  666. companyUserOptionsLoading: false,
  667. companyUserOptions: [],
  668. companyUserOptionsByAll: [],
  669. };
  670. },
  671. created() {
  672. courseList().then(response => {
  673. this.courseLists = response.list;
  674. });
  675. myDeptTreeselect().then(response => {
  676. this.deptOptions = response.data;
  677. });
  678. this.getDicts("sys_course_watch_log_type").then(response => {
  679. this.logTypeOptions = response.data;
  680. });
  681. // 设置默认当天时间 xgb 防止频繁查询大量数据
  682. this.setToday();
  683. this.getList();
  684. this.getCompanyUserListLikeName(true);
  685. this.loading=false;
  686. },
  687. methods: {
  688. showContentDialog(questionJson){
  689. // 解析 JSON 字符串为 JavaScript 对象
  690. // 替换非法换行符等控制字符
  691. const sanitizedJson = questionJson.replace(/[\u0000-\u001F\u007F]/g, '');
  692. this.contentDialog.json = JSON.parse(sanitizedJson);
  693. this.contentDialog.isDialogVisible = true;
  694. },
  695. setToday(){
  696. const today = new Date();
  697. const todayStart = new Date(today);
  698. todayStart.setHours(0, 0, 0, 0);
  699. const todayEnd = new Date(today);
  700. todayEnd.setHours(23, 59, 59, 999);
  701. this.createTimeText = [this.formatDate(todayStart), this.formatDate(todayEnd)];
  702. this.queryParams.sTime = this.formatDate(todayStart);
  703. this.queryParams.eTime = this.formatDate(todayEnd);
  704. },
  705. handleSendTypeChange() {
  706. setTimeout(() => {
  707. this.handleQuery(); // 重新查询列表
  708. }, 200);
  709. },
  710. // 重置日历组件
  711. resetCalendars() {
  712. this.scheduleTime = [];
  713. this.createTime = [];
  714. this.updateTime = [];
  715. this.qecCreateTime = [];
  716. this.periodTime = [];
  717. this.scheduleTimeText = '';
  718. this.createTimeText = '';
  719. this.updateTimeText = '';
  720. this.qecCreateTimeText = '';
  721. this.periodTimeText = [];
  722. // 强制刷新日历组件
  723. this.scheduleCalendarKey++;
  724. this.createCalendarKey++;
  725. this.updateCalendarKey++;
  726. this.qecCalendarKey++;
  727. this.periodTimeKey++;
  728. },
  729. formatDateRange(dates) {
  730. if (!dates || dates.length < 2) return '';
  731. return dates.map(date => date.format('YYYY-MM-DD')).join(' ~ ');
  732. },
  733. courseChange(row){
  734. this.queryParams.videoId=null;
  735. if(row === ''){
  736. this.videoList=[];
  737. return
  738. }
  739. videoListByWatch(row).then(response => {
  740. this.videoList=response.list
  741. });
  742. },
  743. handleClickX(tab,event){
  744. this.activeName=tab.name;
  745. if(tab.name=="00"){
  746. this.queryParams.logType=null;
  747. }else{
  748. this.queryParams.logType=tab.name;
  749. }
  750. this.getList()
  751. },
  752. /** 查询短链课程看课记录列表 */
  753. getList() {
  754. // xgb 看课数据量太大必须限制时间if (this.isEmptyArray(this.createTimeText) &&
  755. if (this.isEmptyArray(this.createTimeText) &&
  756. this.isEmptyArray(this.updateTimeText) &&
  757. this.isEmptyArray(this.scheduleTimeText)) {
  758. this.$message.warning('请选择创建时间或营期时间或最新更新时间');
  759. return;
  760. }
  761. this.loading = true;
  762. if(this.queryParams.logType == "10"){
  763. this.queryParams.logType = null;
  764. }
  765. deptListCourseWatchLog(this.queryParams).then(response => {
  766. this.courseWatchLogList = response.rows;
  767. this.total = response.total;
  768. this.loading = false;
  769. }).catch(() => {
  770. this.loading = false;
  771. }
  772. );
  773. },
  774. // 添加辅助方法
  775. isEmptyArray(arr) {
  776. return !arr || arr.length === 0;
  777. },
  778. // 取消按钮
  779. cancel() {
  780. this.open = false;
  781. this.reset();
  782. },
  783. // 表单重置
  784. reset() {
  785. this.form = {
  786. logId: null,
  787. userId: null,
  788. videoId: null,
  789. logType: null,
  790. createTime: null,
  791. updateTime: null,
  792. qwExternalContactId: null,
  793. externalUserName:null,
  794. duration: null,
  795. qwUserId: null,
  796. companyUserId: null,
  797. companyId: null,
  798. courseId: null,
  799. scheduleStartTime: null,
  800. scheduleEndTime: null,
  801. };
  802. this.scheduleTime=null;
  803. this.resetForm("form");
  804. },
  805. /** 搜索按钮操作 */
  806. handleQuery() {
  807. this.queryParams.pageNum = 1;
  808. this.getList();
  809. },
  810. /** 重置按钮操作 */
  811. resetQuery() {
  812. this.resetForm("queryForm");
  813. this.createTime = null;
  814. this.scheduleTime = null;
  815. this.qecCreateTime=null;
  816. this.queryParams.sTime = null;
  817. this.queryParams.eTime = null;
  818. this.queryParams.upSTime = null;
  819. this.queryParams.upETime = null;
  820. this.queryParams.qecSTime = null;
  821. this.queryParams.qecETime = null;
  822. this.queryParams.periodSTime = null;
  823. this.queryParams.periodDTime = null;
  824. this.queryParams.scheduleStartTime = null;
  825. this.queryParams.scheduleEndTime = null;
  826. this.queryParams.sopId = null; // 重置SOP ID
  827. this.scheduleTime=null;
  828. this.updateTime=null;
  829. this.queryParams.externalUserName=null;
  830. // 重置SOP搜索
  831. this.handleSopClear();
  832. // 统一重置日历组件
  833. this.resetCalendars();
  834. this.setToday();
  835. this.handleQuery();
  836. },
  837. // 多选框选中数据
  838. handleSelectionChange(selection) {
  839. this.ids = selection.map(item => item.logId)
  840. this.single = selection.length!==1
  841. this.multiple = !selection.length
  842. },
  843. /** 新增按钮操作 */
  844. handleAdd() {
  845. this.reset();
  846. this.open = true;
  847. this.title = "添加短链课程看课记录";
  848. },
  849. /** 修改按钮操作 */
  850. handleUpdate(row) {
  851. this.reset();
  852. const logId = row.logId || this.ids
  853. getCourseWatchLog(logId).then(response => {
  854. this.form = response.data;
  855. this.open = true;
  856. this.title = "修改短链课程看课记录";
  857. });
  858. },
  859. /** 提交按钮 */
  860. submitForm() {
  861. this.$refs["form"].validate(valid => {
  862. if (valid) {
  863. if (this.form.logId != null) {
  864. updateCourseWatchLog(this.form).then(response => {
  865. this.msgSuccess("修改成功");
  866. this.open = false;
  867. this.getList();
  868. });
  869. } else {
  870. addCourseWatchLog(this.form).then(response => {
  871. this.msgSuccess("新增成功");
  872. this.open = false;
  873. this.getList();
  874. });
  875. }
  876. }
  877. });
  878. },
  879. /** 删除按钮操作 */
  880. handleDelete(row) {
  881. const logIds = row.logId || this.ids;
  882. this.$confirm('是否确认删除短链课程看课记录编号为"' + logIds + '"的数据项?', "警告", {
  883. confirmButtonText: "确定",
  884. cancelButtonText: "取消",
  885. type: "warning"
  886. }).then(function() {
  887. return delCourseWatchLog(logIds);
  888. }).then(() => {
  889. this.getList();
  890. this.msgSuccess("删除成功");
  891. }).catch(() => {});
  892. },
  893. /** 导出按钮操作 */
  894. handleExport() {
  895. // xgb 看课数据量太大必须限制时间
  896. if (this.isEmptyArray(this.createTimeText) &&
  897. this.isEmptyArray(this.updateTimeText) &&
  898. this.isEmptyArray(this.scheduleTimeText)) {
  899. this.$message.warning('请选择创建时间或营期时间或最新更新时间');
  900. return;
  901. }
  902. const that = this
  903. const queryParams = this.queryParams;
  904. this.$confirm('是否确认导出所有短链课程看课记录数据项?', "警告", {
  905. confirmButtonText: "确定",
  906. cancelButtonText: "取消",
  907. type: "warning"
  908. }).then(() => {
  909. this.exportLoading = true;
  910. return exportCourseWatchLog(queryParams);
  911. }).then(response => {
  912. if (response.code === 200){
  913. that.msgSuccess(response.msg);
  914. that.taskId = response.data;
  915. that.time = setInterval(function(){
  916. //查订单
  917. getTask(that.taskId).then(res => {
  918. if(res.data.status === 1){
  919. that.exportLoading = false;
  920. clearTimeout(that.time)
  921. that.time = null;
  922. that.download(res.data.fileUrl);
  923. }
  924. });
  925. },10000);
  926. } else {
  927. that.msgError(response.msg)
  928. that.exportLoading = false
  929. }
  930. }).catch(() => {});
  931. },
  932. openAnswerLogFun(row) {
  933. this.openAnswerLog = true;
  934. this.answerLogQueryParams.watchLogId = row.logId;
  935. this.answerLogList();
  936. },
  937. answerLogList() {
  938. this.loadingAnswerLog = true;
  939. myListLogs(this.answerLogQueryParams).then(e => {
  940. this.answerLogsList = e.rows;
  941. this.answerLogTotal = e.total;
  942. this.loadingAnswerLog = false;
  943. })
  944. },
  945. openRedLogFun(row) {
  946. this.openRedLog = true;
  947. this.redLogQueryParams.watchLogId = row.logId;
  948. this.redLogList();
  949. },
  950. redLogList() {
  951. this.loadingRedLog = true;
  952. console.info("------------dept",this.redLogQueryParams)
  953. myListCourseRedPacketLog(this.redLogQueryParams).then(e => {
  954. this.redLogsList = e.rows;
  955. this.redLogTotal = e.total;
  956. this.loadingRedLog = false;
  957. })
  958. },
  959. // 营期时间
  960. handleScheduleTimeChange(scheduleTime) {
  961. if (scheduleTime && scheduleTime.length >= 2) {
  962. if(!this.checkDateRangeLimit(scheduleTime)){
  963. this.scheduleTimeText = null;
  964. this.queryParams.scheduleStartTime=null;
  965. this.queryParams.scheduleStartTime=null;
  966. return;
  967. }
  968. // this.scheduleTimeText = this.formatDateRange(scheduleTime);
  969. this.queryParams.scheduleStartTime = scheduleTime[0] || null;
  970. this.queryParams.scheduleEndTime = scheduleTime[1] || null;
  971. } else {
  972. this.scheduleTimeText = [];
  973. this.queryParams.scheduleStartTime = null;
  974. this.queryParams.scheduleEndTime = null;
  975. }
  976. },
  977. checkDateRangeLimit(dateRange) {
  978. if (dateRange && dateRange.length >= 2) {
  979. const startDate = new Date(dateRange[0]);
  980. const endDate = new Date(dateRange[1]);
  981. // 设置时间为当天开始,避免时间部分影响计算
  982. startDate.setHours(0, 0, 0, 0);
  983. endDate.setHours(0, 0, 0, 0);
  984. const timeDiff = Math.abs(endDate - startDate);
  985. const diffDays = Math.ceil(timeDiff / (1000 * 60 * 60 * 24));
  986. if (diffDays > 31) { // maxDays-1 因为包含起始日
  987. this.$message.warning('时间区间不能超过一个月');
  988. return false;
  989. }
  990. }
  991. return true;
  992. },
  993. // 创建时间
  994. createChange(createTime) {
  995. if (createTime && createTime.length >= 2) {
  996. if(!this.checkDateRangeLimit(createTime)){
  997. this.createTimeText = null;
  998. this.queryParams.sTime=null;
  999. this.queryParams.eTime=null;
  1000. return;
  1001. }
  1002. // this.createTimeText = this.formatDateRange(createTime);
  1003. this.queryParams.sTime = this.formatDate(createTime[0]) || null;
  1004. this.queryParams.eTime = this.formatDate(createTime[1]) || null;
  1005. } else {
  1006. this.createTimeText = '';
  1007. this.queryParams.sTime = null;
  1008. this.queryParams.eTime = null;
  1009. }
  1010. },
  1011. // 更新时间
  1012. updateChange(updateTime) {
  1013. if (updateTime && updateTime.length >= 2) {
  1014. if(!this.checkDateRangeLimit(updateTime)){
  1015. this.updateTimeText = null;
  1016. this.queryParams.upSTime=null;
  1017. this.queryParams.upETime=null;
  1018. return;
  1019. }
  1020. this.updateTimeText = this.formatDateRange(updateTime);
  1021. this.queryParams.upSTime = updateTime[0] || null;
  1022. this.queryParams.upETime = updateTime[1] || null;
  1023. } else {
  1024. this.updateTimeText = '';
  1025. this.queryParams.upSTime = null;
  1026. this.queryParams.upETime = null;
  1027. }
  1028. },
  1029. // 进线时间
  1030. qecCreateTimeChange(qecCreateTime) {
  1031. if (qecCreateTime && qecCreateTime.length >= 2) {
  1032. // 检查选择的日期范围是否超过7天(包括起始和结束日期)
  1033. const startDate = new Date(qecCreateTime[0]);
  1034. const endDate = new Date(qecCreateTime[1]);
  1035. // 设置时间为当天开始,避免时间部分影响计算
  1036. startDate.setHours(0, 0, 0, 0);
  1037. endDate.setHours(0, 0, 0, 0);
  1038. const timeDiff = Math.abs(endDate - startDate);
  1039. const diffDays = Math.ceil(timeDiff / (1000 * 60 * 60 * 24));
  1040. // 如果超过6天的范围(总共7天,包括起始日)
  1041. if (diffDays > 6) {
  1042. this.$message.error('进线时间选择范围不能超过7天');
  1043. // 清空选择
  1044. this.qecCreateTime = [];
  1045. this.qecCreateTimeText = [];
  1046. this.queryParams.qecSTime = null;
  1047. this.queryParams.qecETime = null;
  1048. this.qecCalendarKey++;
  1049. return;
  1050. }
  1051. // this.qecCreateTimeText = this.formatDateRange(qecCreateTime);
  1052. this.queryParams.qecSTime = qecCreateTime[0] || null;
  1053. this.queryParams.qecETime = qecCreateTime[1] || null;
  1054. } else {
  1055. this.qecCreateTimeText = '';
  1056. this.queryParams.qecSTime = null;
  1057. this.queryParams.qecETime = null;
  1058. }
  1059. },
  1060. //营期课程时间
  1061. qecPeriodTimeChange(periodTime){
  1062. if (periodTime && periodTime.length >= 2) {
  1063. // 检查选择的日期范围是否超过7天(包括起始和结束日期)
  1064. const startDate = new Date(periodTime[0]);
  1065. const endDate = new Date(periodTime[1]);
  1066. // 设置时间为当天开始,避免时间部分影响计算
  1067. startDate.setHours(0, 0, 0, 0);
  1068. endDate.setHours(0, 0, 0, 0);
  1069. const timeDiff = Math.abs(endDate - startDate);
  1070. const diffDays = Math.ceil(timeDiff / (1000 * 60 * 60 * 24));
  1071. // 如果超过6天的范围(总共7天,包括起始日)
  1072. if (diffDays > 13) {
  1073. this.$message.error('时间选择范围不能超过14天');
  1074. // 清空选择
  1075. this.periodTime = [];
  1076. this.periodTimeText = [];
  1077. this.queryParams.periodSTime = null;
  1078. this.queryParams.periodETime = null;
  1079. this.periodTimeKey++;
  1080. return;
  1081. }
  1082. this.queryParams.periodSTime = this.formatDate(periodTime[0]) || null;
  1083. this.queryParams.periodETime = this.formatDate(periodTime[1]) || null;
  1084. } else {
  1085. this.periodTimeText = '';
  1086. this.queryParams.periodSTime = null;
  1087. this.queryParams.periodETime = null;
  1088. }
  1089. },
  1090. formatDate(date) {
  1091. if (!date) return ''
  1092. // 确保 date 是 Date 对象
  1093. let dateObj = date
  1094. if (typeof date === 'string') {
  1095. dateObj = new Date(date)
  1096. }
  1097. // 如果转换失败,返回空字符串
  1098. if (!(dateObj instanceof Date) || isNaN(dateObj.getTime())) {
  1099. return ''
  1100. }
  1101. // 使用更安全的格式化方法
  1102. const year = dateObj.getFullYear()
  1103. const month = String(dateObj.getMonth() + 1).padStart(2, '0')
  1104. const day = String(dateObj.getDate()).padStart(2, '0')
  1105. const hours = String(dateObj.getHours()).padStart(2, '0')
  1106. const minutes = String(dateObj.getMinutes()).padStart(2, '0')
  1107. const seconds = String(dateObj.getSeconds()).padStart(2, '0')
  1108. return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
  1109. },
  1110. /**
  1111. * 根据名称模糊查询用户列表
  1112. * @param query 参数
  1113. */
  1114. loadCompanyUserOptions(query) {
  1115. this.companyUserOptions = [];
  1116. if (query === '') {
  1117. return;
  1118. }
  1119. this.companyUserOptionsParams.pageNum = 1
  1120. this.companyUserOptionsParams.name = query
  1121. this.companyUserOptionsLoading = true;
  1122. this.getCompanyUserListLikeName()
  1123. },
  1124. /**
  1125. * 获取员工列表
  1126. */
  1127. getCompanyUserListLikeName(isAll) {
  1128. if (isAll){
  1129. getCompanyUserListLikeName(this.companyUserOptionsParams).then(response => {
  1130. this.companyUserOptionsByAll = [...this.companyUserOptions, ...response.data.list]
  1131. this.companyUserOptionsParams.hasNextPage = response.data.hasNextPage
  1132. this.companyUserOptionsLoading = false;
  1133. });
  1134. }else {
  1135. this.companyUserOptionsParams.pageSize=10;
  1136. getCompanyUserListLikeName(this.companyUserOptionsParams).then(response => {
  1137. this.companyUserOptions = [...this.companyUserOptions, ...response.data.list]
  1138. this.companyUserOptionsParams.hasNextPage = response.data.hasNextPage
  1139. this.companyUserOptionsLoading = false;
  1140. });
  1141. }
  1142. },
  1143. /**
  1144. * 加载更多员工选项
  1145. */
  1146. loadMoreCompanyUserOptions() {
  1147. if (!this.companyUserOptionsParams.hasNextPage) {
  1148. return;
  1149. }
  1150. this.companyUserOptionsParams.pageNum += 1
  1151. this.getCompanyUserListLikeName()
  1152. },
  1153. /**
  1154. * 选择SOP
  1155. * @param {object} item - 选中的SOP项
  1156. */
  1157. handleSopSelect(item) {
  1158. this.selectedSopId = item.id;
  1159. this.queryParams.sopId = item.id;
  1160. this.sopSearchText = item.name;
  1161. },
  1162. /**
  1163. * 清空SOP选择
  1164. */
  1165. handleSopClear() {
  1166. this.selectedSopId = null;
  1167. this.queryParams.sopId = null;
  1168. this.sopSearchText = '';
  1169. },
  1170. /**
  1171. * 异步查询SOP列表
  1172. * @param {string} queryString - 查询字符串
  1173. * @param {function} callback - 回调函数
  1174. */
  1175. querySopAsync(queryString, callback) {
  1176. if (!queryString) {
  1177. callback([]);
  1178. return;
  1179. }
  1180. infoSop({ name: queryString }).then(response => {
  1181. if (response && response.rows) {
  1182. const suggestions = response.rows.map(item => ({
  1183. value: item.name,
  1184. id: item.id,
  1185. name: item.name
  1186. }));
  1187. callback(suggestions);
  1188. } else {
  1189. callback([]);
  1190. }
  1191. }).catch(error => {
  1192. console.error('通过sop查询失败:', error);
  1193. callback([]);
  1194. });
  1195. },
  1196. updateQwuser() {
  1197. for (const user of this.myQwUserList) {
  1198. if (user.dictValue == this.queryParams.qwUserId) {
  1199. this.queryParams.corpId = user.corpId;
  1200. break;
  1201. }
  1202. }
  1203. this.getList();
  1204. },
  1205. }
  1206. };
  1207. </script>