userVideo.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
  4. <el-alert
  5. title="注意事项"
  6. type="warning"
  7. description="请先搜索相关【企业微信账号名称】,获取视频号信息"
  8. :closable="false"
  9. show-icon>
  10. </el-alert>
  11. <el-form-item label="企微账号名称" prop="qwUserName" >
  12. <el-input
  13. v-model="queryParams.qwUserName"
  14. placeholder="请输入企微账号名称"
  15. clearable
  16. size="small"
  17. @keyup.enter.native="handleQuery"
  18. />
  19. </el-form-item>
  20. <el-form-item label="封面标题" prop="nickname">
  21. <el-input
  22. v-model="queryParams.nickname"
  23. placeholder="请输入封面标题"
  24. clearable
  25. size="small"
  26. @keyup.enter.native="handleQuery"
  27. />
  28. </el-form-item>
  29. <el-form-item>
  30. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  31. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  32. </el-form-item>
  33. </el-form>
  34. <el-row :gutter="10" class="mb8">
  35. <el-col :span="1.5">
  36. <el-button
  37. type="danger"
  38. plain
  39. icon="el-icon-delete"
  40. size="mini"
  41. :disabled="multiple"
  42. @click="handleDelete"
  43. >删除</el-button>
  44. </el-col>
  45. </el-row>
  46. <el-table border v-loading="loading" :data="QwUserVideoList" @selection-change="handleSelectionChange">
  47. <el-table-column type="selection" width="55" align="center" />
  48. <el-table-column label="封面图片" align="center" prop="coverUrl">
  49. <template slot-scope="scope">
  50. <el-popover
  51. placement="right"
  52. title=""
  53. trigger="hover"
  54. >
  55. <img slot="reference" :src="scope.row.coverUrl" width="100" >
  56. <img :src="scope.row.coverUrl" style="max-width: 300px;">
  57. </el-popover>
  58. </template>
  59. </el-table-column>
  60. <el-table-column label="头像" align="center" prop="avatar">
  61. <template slot-scope="scope">
  62. <el-popover
  63. placement="right"
  64. title=""
  65. trigger="hover">
  66. <img slot="reference" :src="scope.row.coverUrl" style="width: 50px;height: 50px">
  67. <img :src="scope.row.coverUrl" style="max-width: 200px;max-height: 200px">
  68. </el-popover>
  69. </template>
  70. </el-table-column>
  71. <el-table-column label="封面标题" align="center" prop="nickname" />
  72. <el-table-column label="简介" align="center" prop="desc" >
  73. <template slot-scope="scope">
  74. <el-tooltip class="item" effect="dark" :content="scope.row.desc" placement="top">
  75. <div style="display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; text-overflow: ellipsis;">
  76. <span>{{ scope.row.desc }}</span>
  77. </div>
  78. </el-tooltip>
  79. </template>
  80. </el-table-column>
  81. <el-table-column label="视频地址" align="center" prop="url">
  82. <template slot-scope="scope">
  83. <el-tooltip class="item" effect="dark" :content="scope.row.url" placement="top">
  84. <div style="display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; text-overflow: ellipsis;">
  85. <span>{{ scope.row.url }}</span>
  86. </div>
  87. </el-tooltip>
  88. </template>
  89. </el-table-column>
  90. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  91. <template slot-scope="scope">
  92. <el-button
  93. size="mini"
  94. type="text"
  95. icon="el-icon-check"
  96. @click="handleChangeVideoNum(scope.row)"
  97. >选择此视频号</el-button>
  98. </template>
  99. </el-table-column>
  100. </el-table>
  101. <pagination
  102. v-show="total>0"
  103. :total="total"
  104. :page.sync="queryParams.pageNum"
  105. :limit.sync="queryParams.pageSize"
  106. @pagination="getList"
  107. />
  108. </div>
  109. </template>
  110. <script>
  111. import { listQwUserVideo, getQwUserVideo, delQwUserVideo, addQwUserVideo, updateQwUserVideo, exportQwUserVideo } from "@/api/qw/userVideo";
  112. export default {
  113. name: "userVideo",
  114. data() {
  115. return {
  116. // 遮罩层
  117. loading: false,
  118. // 导出遮罩层
  119. exportLoading: false,
  120. // 选中数组
  121. ids: [],
  122. // 非单个禁用
  123. single: true,
  124. // 非多个禁用
  125. multiple: true,
  126. // 显示搜索条件
  127. showSearch: true,
  128. // 总条数
  129. total: 0,
  130. // 企业微信的视频号表格数据
  131. QwUserVideoList: [],
  132. // 弹出层标题
  133. title: "",
  134. // 是否显示弹出层
  135. open: false,
  136. // 查询参数
  137. queryParams: {
  138. pageNum: 1,
  139. pageSize: 10,
  140. appKey: null,
  141. senderName: null,
  142. qwUserName:null,
  143. objectId: null,
  144. coverUrl: null,
  145. thumbUrl: null,
  146. avatar: null,
  147. nickname: null,
  148. desc: null,
  149. url: null,
  150. extras: null,
  151. },
  152. // 表单参数
  153. form: {},
  154. // 表单校验
  155. rules: {
  156. }
  157. };
  158. },
  159. created() {
  160. this.getList();
  161. },
  162. methods: {
  163. /** 查询企业微信的视频号列表 */
  164. getList() {
  165. this.loading = true;
  166. listQwUserVideo(this.queryParams).then(response => {
  167. this.QwUserVideoList = response.rows;
  168. this.total = response.total;
  169. this.loading = false;
  170. });
  171. },
  172. // 取消按钮
  173. cancel() {
  174. this.open = false;
  175. this.reset();
  176. },
  177. // 表单重置
  178. reset() {
  179. this.form = {
  180. id: null,
  181. appKey: null,
  182. senderName: null,
  183. objectId: null,
  184. coverUrl: null,
  185. thumbUrl: null,
  186. avatar: null,
  187. nickname: null,
  188. desc: null,
  189. url: null,
  190. extras: null
  191. };
  192. this.resetForm("form");
  193. },
  194. /** 搜索按钮操作 */
  195. handleQuery() {
  196. this.queryParams.pageNum = 1;
  197. this.getList();
  198. },
  199. /** 重置按钮操作 */
  200. resetQuery() {
  201. this.resetForm("queryForm");
  202. this.handleQuery();
  203. },
  204. // 多选框选中数据
  205. handleSelectionChange(selection) {
  206. this.ids = selection.map(item => item.id)
  207. this.single = selection.length!==1
  208. this.multiple = !selection.length
  209. },
  210. handleChangeVideoNum(val){
  211. this.$emit("videoResult",val)
  212. },
  213. /** 提交按钮 */
  214. submitForm() {
  215. this.$refs["form"].validate(valid => {
  216. if (valid) {
  217. if (this.form.id != null) {
  218. updateQwUserVideo(this.form).then(response => {
  219. this.msgSuccess("修改成功");
  220. this.open = false;
  221. this.getList();
  222. });
  223. } else {
  224. addQwUserVideo(this.form).then(response => {
  225. this.msgSuccess("新增成功");
  226. this.open = false;
  227. this.getList();
  228. });
  229. }
  230. }
  231. });
  232. },
  233. /** 删除按钮操作 */
  234. handleDelete(row) {
  235. const ids = row.id || this.ids;
  236. this.$confirm('是否确认删除企业微信的视频号编号为"' + ids + '"的数据项?', "警告", {
  237. confirmButtonText: "确定",
  238. cancelButtonText: "取消",
  239. type: "warning"
  240. }).then(function() {
  241. return delQwUserVideo(ids);
  242. }).then(() => {
  243. this.getList();
  244. this.msgSuccess("删除成功");
  245. }).catch(() => {});
  246. },
  247. /** 导出按钮操作 */
  248. handleExport() {
  249. const queryParams = this.queryParams;
  250. this.$confirm('是否确认导出所有企业微信的视频号数据项?', "警告", {
  251. confirmButtonText: "确定",
  252. cancelButtonText: "取消",
  253. type: "warning"
  254. }).then(() => {
  255. this.exportLoading = true;
  256. return exportQwUserVideo(queryParams);
  257. }).then(response => {
  258. this.download(response.msg);
  259. this.exportLoading = false;
  260. }).catch(() => {});
  261. }
  262. }
  263. };
  264. </script>