index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="所属用户" prop="userId">
  5. <el-input
  6. v-model="queryParams.userId"
  7. placeholder="请输入所属用户"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="昵称" prop="nickName">
  14. <el-input
  15. v-model="queryParams.nickName"
  16. placeholder="请输入昵称"
  17. clearable
  18. size="small"
  19. @keyup.enter.native="handleQuery"
  20. />
  21. </el-form-item>
  22. <el-form-item>
  23. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  24. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  25. </el-form-item>
  26. </el-form>
  27. <el-row :gutter="10" class="mb8">
  28. <el-col :span="1.5">
  29. <el-button
  30. type="primary"
  31. plain
  32. icon="el-icon-plus"
  33. size="mini"
  34. @click="handleAdd"
  35. v-hasPermi="['course:userTalent:add']"
  36. >新增</el-button>
  37. </el-col>
  38. <el-col :span="1.5">
  39. <el-button
  40. type="success"
  41. plain
  42. icon="el-icon-edit"
  43. size="mini"
  44. :disabled="single"
  45. @click="handleUpdate"
  46. v-hasPermi="['course:userTalent:edit']"
  47. >修改</el-button>
  48. </el-col>
  49. <el-col :span="1.5">
  50. <el-button
  51. type="danger"
  52. plain
  53. icon="el-icon-delete"
  54. size="mini"
  55. :disabled="multiple"
  56. @click="handleDelete"
  57. v-hasPermi="['course:userTalent:remove']"
  58. >删除</el-button>
  59. </el-col>
  60. <el-col :span="1.5">
  61. <el-button
  62. type="warning"
  63. plain
  64. icon="el-icon-download"
  65. size="mini"
  66. :loading="exportLoading"
  67. @click="handleExport"
  68. v-hasPermi="['course:userTalent:export']"
  69. >导出</el-button>
  70. </el-col>
  71. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  72. </el-row>
  73. <el-tabs type="card" v-model="queryParams.isAudit" @tab-click="handleClickX">
  74. <el-tab-pane v-for="(item,index) in isAuditOptions" :label="item.dictLabel" :name="item.dictValue"></el-tab-pane>
  75. </el-tabs>
  76. <el-table border v-loading="loading" :data="userTalentList" @selection-change="handleSelectionChange">
  77. <el-table-column type="selection" width="55" align="center" />
  78. <el-table-column label="达人id" align="center" prop="talentId" />
  79. <el-table-column label="所属用户" align="center" prop="userId" />
  80. <el-table-column label="昵称" align="center" prop="nickName" />
  81. <el-table-column label="头像" align="center" prop="avatar" width="120">
  82. <template slot-scope="scope">
  83. <el-popover
  84. placement="right"
  85. title=""
  86. trigger="hover"
  87. >
  88. <img slot="reference" :src="scope.row.avatar" width="100">
  89. <img :src="scope.row.avatar" style="max-width: 200px;">
  90. </el-popover>
  91. </template>
  92. </el-table-column>
  93. <el-table-column label="性别" align="center" prop="sex">
  94. <template slot-scope="scope">
  95. <span v-if="scope.row.sex === 1">
  96. <i class="el-icon-male"></i>
  97. </span>
  98. <span v-else-if="scope.row.sex === 2">
  99. <i class="el-icon-female"></i>
  100. </span>
  101. </template>
  102. </el-table-column>
  103. <el-table-column label="位置" align="center" prop="address" />
  104. <el-table-column label="达人等级" align="center" prop="level" />
  105. <el-table-column label="粉丝数" align="center" prop="fans" />
  106. <el-table-column label="获赞数" align="center" prop="likes" />
  107. <el-table-column label="作品数" align="center" prop="videoNum" />
  108. <el-table-column label="审核时间" align="center" prop="auditTime" width="180"/>
  109. <el-table-column label="创建时间" align="center" prop="createTime" width="180"/>
  110. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  111. <template slot-scope="scope">
  112. <el-button v-if="scope.row.isAudit==0"
  113. size="mini"
  114. type="text"
  115. icon="el-icon-edit"
  116. @click="auditTalent(scope.row)"
  117. v-hasPermi="['course:userTalent:audit']"
  118. >审核</el-button>
  119. <el-button
  120. size="mini"
  121. type="text"
  122. @click="handleDetails(scope.row)"
  123. >详情</el-button>
  124. <el-button
  125. size="mini"
  126. type="text"
  127. icon="el-icon-edit"
  128. @click="handleUpdate(scope.row)"
  129. v-hasPermi="['course:userTalent:edit']"
  130. >修改</el-button>
  131. <el-button
  132. size="mini"
  133. type="text"
  134. icon="el-icon-delete"
  135. @click="handleDelete(scope.row)"
  136. v-hasPermi="['course:userTalent:remove']"
  137. >删除</el-button>
  138. </template>
  139. </el-table-column>
  140. </el-table>
  141. <pagination
  142. v-show="total>0"
  143. :total="total"
  144. :page.sync="queryParams.pageNum"
  145. :limit.sync="queryParams.pageSize"
  146. @pagination="getList"
  147. />
  148. <!-- 添加或修改达人对话框 -->
  149. <el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
  150. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  151. <el-row>
  152. <el-col :span="8">
  153. <el-form-item label="昵称" prop="nickName">
  154. <el-input v-model="form.nickName" placeholder="请输入昵称" />
  155. </el-form-item>
  156. </el-col>
  157. <el-col :span="8">
  158. <el-form-item label="性别" prop="sex">
  159. <el-select v-model="form.sex" placeholder="性别" clearable size="small">
  160. <el-option
  161. v-for="dict in sexOptions"
  162. :key="dict.dictValue"
  163. :label="dict.dictLabel"
  164. :value="dict.dictValue"
  165. />
  166. </el-select>
  167. </el-form-item>
  168. </el-col>
  169. <el-col :span="8">
  170. <el-form-item label="关联用户" prop="userId" >
  171. <el-select v-model="form.userId" remote filterable reserve-keyword placeholder="输入手机号搜索" @change="selectUser" :remote-method="userMethod" >
  172. <el-option
  173. v-for="item in userList"
  174. :key="item.userId"
  175. :label="item.userId"
  176. :value="item.userId">
  177. <span style="float: left">{{ item.userId }}</span>
  178. <span style="margin-left: 30px ;">{{item.nickName}}</span>
  179. <span style="margin-left: 30px">{{ item.phone }}</span>
  180. </el-option>
  181. </el-select>
  182. </el-form-item>
  183. </el-col>
  184. </el-row>
  185. <el-form-item label="头像" prop="avatar">
  186. <ImageUpload v-model="form.avatar" type="image" :num="10" :width="150" :height="150" />
  187. </el-form-item>
  188. <el-form-item label="标题" prop="title">
  189. <el-input v-model="form.title" type="textarea" placeholder="请输入内容" />
  190. </el-form-item>
  191. <el-row>
  192. <el-col :span="8">
  193. <el-form-item label="获赞数" prop="likes">
  194. <el-input-number v-model="form.likes" :min="0" label="获赞数"></el-input-number>
  195. </el-form-item>
  196. </el-col>
  197. <el-col :span="8">
  198. <el-form-item label="达人等级" prop="level">
  199. <el-input-number v-model="form.level" :min="1" placeholder="达人等级" />
  200. </el-form-item>
  201. </el-col>
  202. </el-row>
  203. <el-form-item label="标签" prop="tags">
  204. <el-select v-model="tags" multiple placeholder="请选择标签" filterable clearable size="small">
  205. <el-option
  206. v-for="dict in tagsOptions"
  207. :key="dict.dictValue"
  208. :label="dict.dictLabel"
  209. :value="dict.dictValue"
  210. />
  211. </el-select>
  212. </el-form-item>
  213. <el-form-item label="抖音链接" prop="tiktokLink">
  214. <el-input v-model="form.tiktokLink" type="textarea" placeholder="请输入" />
  215. </el-form-item>
  216. <el-form-item label="快手链接" prop="kwaiLink">
  217. <el-input v-model="form.kwaiLink" type="textarea" placeholder="请输入" />
  218. </el-form-item>
  219. <el-form-item label="证书编号" prop="certificateCode" >
  220. <el-input v-model="form.certificateCode" placeholder="请输入证书编号" maxlength="200"/>
  221. </el-form-item>
  222. <el-form-item label="专业证书" prop="certificateImages">
  223. <ImageUpload v-model="form.certificateImages" type="image" :num="10" :width="150" :height="150" />
  224. </el-form-item>
  225. </el-form>
  226. <div slot="footer" class="dialog-footer">
  227. <el-button type="primary" @click="submitForm">确 定</el-button>
  228. <el-button @click="cancel">取 消</el-button>
  229. </div>
  230. </el-dialog>
  231. <el-dialog :title="auditDialog.title" :visible.sync="auditDialog.open" width="800px" append-to-body @close="auditDialogClose">
  232. <el-form ref="auditForm" :model="auditForm" :rules="auditRules" label-width="100px">
  233. <el-form-item label="审核" prop="isAudit">
  234. <el-radio-group v-model="auditForm.isAudit">
  235. <el-radio :label="item.dictValue" v-for="item in auditRadio" >{{item.dictLabel}}</el-radio>
  236. </el-radio-group>
  237. </el-form-item>
  238. <el-form-item label="备注" prop="remark">
  239. <el-input type="textarea" v-model="auditForm.remark" placeholder="备注" />
  240. </el-form-item>
  241. </el-form>
  242. <div slot="footer" class="dialog-footer" >
  243. <el-button type="primary" @click="submitAuditForm">提交</el-button>
  244. <el-button @click="auditDialogClose">取消</el-button>
  245. </div>
  246. </el-dialog>
  247. <el-drawer
  248. :with-header="false"
  249. size="75%"
  250. :visible.sync="show.open">
  251. <userTalentDetails ref="userTalentDetails" />
  252. </el-drawer>
  253. </div>
  254. </template>
  255. <script>
  256. import {
  257. listUserTalent,
  258. getUserTalent,
  259. delUserTalent,
  260. addUserTalent,
  261. updateUserTalent,
  262. exportUserTalent,
  263. auditUserTalent,
  264. } from '@/api/course/userTalent'
  265. import { listBySearch} from "@/api/his/user";
  266. import ImageUpload from '@/components/ImageUpload/index';
  267. import VideoUpload from '@/components/VideoUpload/index';
  268. import Editor from '@/components/Editor/wang';
  269. import userTalentDetails from '../../components/course/userTalentDetails.vue';
  270. export default {
  271. name: "UserTalent",
  272. components: {
  273. Editor,ImageUpload,userTalentDetails,VideoUpload
  274. },
  275. data() {
  276. return {
  277. show:{
  278. title:"达人详情",
  279. open :false
  280. },
  281. auditRadio: [{
  282. "dictLabel": "通过",
  283. "dictValue": 1
  284. }, {
  285. "dictLabel": "驳回",
  286. "dictValue": -1
  287. }],
  288. auditDialog:{
  289. title:"达人审核",
  290. open:false
  291. },
  292. auditForm:{},
  293. auditRules:{
  294. isAudit: [
  295. { required: true, message: "请选择审核状态", trigger: "blur" }
  296. ],
  297. },
  298. isAuditOptions:[],
  299. userParam:{
  300. phone:null
  301. },
  302. userList:[],
  303. tagsOptions:[],
  304. tags:[],
  305. sexOptions:[],
  306. // 遮罩层
  307. loading: true,
  308. // 导出遮罩层
  309. exportLoading: false,
  310. // 选中数组
  311. ids: [],
  312. // 非单个禁用
  313. single: true,
  314. // 非多个禁用
  315. multiple: true,
  316. // 显示搜索条件
  317. showSearch: true,
  318. // 总条数
  319. total: 0,
  320. // 达人表格数据
  321. userTalentList: [],
  322. // 弹出层标题
  323. title: "",
  324. // 是否显示弹出层
  325. open: false,
  326. // 查询参数
  327. queryParams: {
  328. pageNum: 1,
  329. pageSize: 10,
  330. userId: null,
  331. nickName: null,
  332. avatar: null,
  333. title: null,
  334. sex: null,
  335. position: null,
  336. tags: null,
  337. level: null,
  338. fans: null,
  339. likes: null,
  340. isDel: null,
  341. isAudit:0,
  342. },
  343. // 表单参数
  344. form: {},
  345. // 表单校验
  346. rules: {
  347. nickName: [
  348. { required: true, message: "达人昵称不能为空", trigger: "blur" }
  349. ],
  350. sex: [
  351. { required: true, message: "达人性别不能为空", trigger: "blur" }
  352. ],
  353. userId: [
  354. { required: true, message: "关联用户不能为空", trigger: "change" }
  355. ],
  356. avatar: [
  357. { required: true, message: "请上传头像", trigger: "blur" }
  358. ],
  359. title: [
  360. { required: true, message: "标题不能为空", trigger: "blur" }
  361. ],
  362. }
  363. };
  364. },
  365. created() {
  366. this.getList();
  367. this.getDicts("sys_patient_sex").then(response => {
  368. this.sexOptions = response.data;
  369. });
  370. this.getDicts("sys_course_tags").then(response => {
  371. this.tagsOptions = response.data;
  372. });
  373. this.getDicts("sys_company_isaudit").then(response => {
  374. this.isAuditOptions = response.data;
  375. });
  376. },
  377. methods: {
  378. handleVideoDuration(duration) {
  379. this.form.videoDuration = duration;
  380. },
  381. submitAuditForm(){
  382. this.$refs["auditForm"].validate(valid => {
  383. if(valid){
  384. if (this.auditForm.talentId != null) {
  385. auditUserTalent(this.auditForm).then(response => {
  386. this.msgSuccess("审核成功");
  387. this.auditDialogClose();
  388. this.getList();
  389. });
  390. }
  391. }
  392. });
  393. },
  394. auditDialogClose(){
  395. this.auditDialog.open = false;
  396. },
  397. auditTalent(row){
  398. this.auditDialog.open=true;
  399. this.auditForm.talentId=row.talentId
  400. },
  401. handleDetails(row){
  402. this.show.open=true;
  403. setTimeout(() => {
  404. this.$refs.userTalentDetails.getDetails(row.talentId);
  405. }, 500);
  406. },
  407. handleClickX(){
  408. this.getList()
  409. },
  410. selectUser(){
  411. const user = this.userList.find(item=> item.userId === this.form.userId);
  412. if(user){
  413. this.form.phone = user.phone;
  414. }
  415. },
  416. userMethod(query){
  417. if (query !== '') {
  418. this.userParam.phone = query;
  419. listBySearch(this.userParam).then(response => {
  420. this.userList = response.data;
  421. });
  422. }
  423. },
  424. /** 查询达人列表 */
  425. getList() {
  426. this.loading = true;
  427. listUserTalent(this.queryParams).then(response => {
  428. this.userTalentList = response.rows;
  429. this.total = response.total;
  430. this.loading = false;
  431. });
  432. },
  433. // 取消按钮
  434. cancel() {
  435. this.open = false;
  436. this.reset();
  437. },
  438. // 表单重置
  439. reset() {
  440. this.form = {
  441. talentId: null,
  442. userId: null,
  443. createTime: null,
  444. updateTime: null,
  445. nickName: null,
  446. avatar: null,
  447. title: null,
  448. sex: null,
  449. position: null,
  450. tags: null,
  451. level: null,
  452. fans: null,
  453. likes: null,
  454. isDel: null
  455. };
  456. this.resetForm("form");
  457. },
  458. /** 搜索按钮操作 */
  459. handleQuery() {
  460. this.queryParams.pageNum = 1;
  461. this.getList();
  462. },
  463. /** 重置按钮操作 */
  464. resetQuery() {
  465. this.resetForm("queryForm");
  466. this.handleQuery();
  467. },
  468. // 多选框选中数据
  469. handleSelectionChange(selection) {
  470. this.ids = selection.map(item => item.talentId)
  471. this.single = selection.length!==1
  472. this.multiple = !selection.length
  473. },
  474. /** 新增按钮操作 */
  475. handleAdd() {
  476. this.reset();
  477. this.userList=[];
  478. this.open = true;
  479. this.title = "添加达人";
  480. },
  481. /** 修改按钮操作 */
  482. handleUpdate(row) {
  483. this.reset();
  484. this.userList=[];
  485. const talentId = row.talentId || this.ids
  486. getUserTalent(talentId).then(response => {
  487. this.form = response.data;
  488. if(response.data.tags!=null){
  489. this.tags = response.data.tags.split(",")
  490. }
  491. this.form.sex = response.data.sex.toString();
  492. this.open = true;
  493. this.title = "修改达人";
  494. });
  495. },
  496. /** 提交按钮 */
  497. submitForm() {
  498. this.$refs["form"].validate(valid => {
  499. if(this.tags.length>0){
  500. this.form.tags=this.tags.toString();
  501. }
  502. else{
  503. this.form.tags=null
  504. }
  505. if (valid) {
  506. if (this.form.talentId != null) {
  507. updateUserTalent(this.form).then(response => {
  508. this.msgSuccess("修改成功");
  509. this.open = false;
  510. this.getList();
  511. });
  512. } else {
  513. addUserTalent(this.form).then(response => {
  514. this.msgSuccess("新增成功");
  515. this.open = false;
  516. this.getList();
  517. });
  518. }
  519. }
  520. });
  521. },
  522. /** 删除按钮操作 */
  523. handleDelete(row) {
  524. const talentIds = row.talentId || this.ids;
  525. this.$confirm('是否确认删除达人编号为"' + talentIds + '"的数据项?', "警告", {
  526. confirmButtonText: "确定",
  527. cancelButtonText: "取消",
  528. type: "warning"
  529. }).then(function() {
  530. return delUserTalent(talentIds);
  531. }).then(() => {
  532. this.getList();
  533. this.msgSuccess("删除成功");
  534. }).catch(() => {});
  535. },
  536. /** 导出按钮操作 */
  537. handleExport() {
  538. const queryParams = this.queryParams;
  539. this.$confirm('是否确认导出所有达人数据项?', "警告", {
  540. confirmButtonText: "确定",
  541. cancelButtonText: "取消",
  542. type: "warning"
  543. }).then(() => {
  544. this.exportLoading = true;
  545. return exportUserTalent(queryParams);
  546. }).then(response => {
  547. this.download(response.msg);
  548. this.exportLoading = false;
  549. }).catch(() => {});
  550. }
  551. }
  552. };
  553. </script>