index.vue 44 KB

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