index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  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="链接ID" prop="linkId">
  5. <el-input
  6. v-model="queryParams.linkId"
  7. placeholder="请输入链接ID"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="客户external_userid" prop="externalUserid">
  14. <el-input
  15. v-model="queryParams.externalUserid"
  16. placeholder="请输入客户external_userid"
  17. clearable
  18. size="small"
  19. @keyup.enter.native="handleQuery"
  20. />
  21. </el-form-item>
  22. <el-form-item label="跟进人userid" prop="userid">
  23. <el-input
  24. v-model="queryParams.userid"
  25. placeholder="请输入跟进人userid"
  26. clearable
  27. size="small"
  28. @keyup.enter.native="handleQuery"
  29. />
  30. </el-form-item>
  31. <el-form-item label="会话状态,0-客户未发消息 1-客户已发送消息 2-客户发送消息状态未知" prop="chatStatus">
  32. <el-select v-model="queryParams.chatStatus" placeholder="请选择会话状态,0-客户未发消息 1-客户已发送消息 2-客户发送消息状态未知" clearable size="small">
  33. <el-option label="请选择字典生成" value="" />
  34. </el-select>
  35. </el-form-item>
  36. <el-form-item label="额外参数" prop="state">
  37. <el-input
  38. v-model="queryParams.state"
  39. placeholder="请输入额外参数"
  40. clearable
  41. size="small"
  42. @keyup.enter.native="handleQuery"
  43. />
  44. </el-form-item>
  45. <el-form-item>
  46. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  47. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  48. </el-form-item>
  49. </el-form>
  50. <el-row :gutter="10" class="mb8">
  51. <el-col :span="1.5">
  52. <el-button
  53. type="primary"
  54. plain
  55. icon="el-icon-plus"
  56. size="mini"
  57. @click="handleAdd"
  58. v-hasPermi="['qw:workUser:add']"
  59. >新增</el-button>
  60. </el-col>
  61. <el-col :span="1.5">
  62. <el-button
  63. type="success"
  64. plain
  65. icon="el-icon-edit"
  66. size="mini"
  67. :disabled="single"
  68. @click="handleUpdate"
  69. v-hasPermi="['qw:workUser:edit']"
  70. >修改</el-button>
  71. </el-col>
  72. <el-col :span="1.5">
  73. <el-button
  74. type="danger"
  75. plain
  76. icon="el-icon-delete"
  77. size="mini"
  78. :disabled="multiple"
  79. @click="handleDelete"
  80. v-hasPermi="['qw:workUser:remove']"
  81. >删除</el-button>
  82. </el-col>
  83. <el-col :span="1.5">
  84. <el-button
  85. type="warning"
  86. plain
  87. icon="el-icon-download"
  88. size="mini"
  89. :loading="exportLoading"
  90. @click="handleExport"
  91. v-hasPermi="['qw:workUser:export']"
  92. >导出</el-button>
  93. </el-col>
  94. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  95. </el-row>
  96. <el-table border v-loading="loading" :data="workUserList" @selection-change="handleSelectionChange">
  97. <el-table-column type="selection" width="55" align="center" />
  98. <el-table-column label="id" align="center" prop="id" />
  99. <el-table-column label="链接ID" align="center" prop="linkId" />
  100. <el-table-column label="客户external_userid" align="center" prop="externalUserid" />
  101. <el-table-column label="跟进人userid" align="center" prop="userid" />
  102. <el-table-column label="会话状态,0-客户未发消息 1-客户已发送消息 2-客户发送消息状态未知" align="center" prop="chatStatus" />
  103. <el-table-column label="额外参数" align="center" prop="state" />
  104. <el-table-column label="备注" align="center" prop="remark" />
  105. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  106. <template slot-scope="scope">
  107. <el-button
  108. size="mini"
  109. type="text"
  110. icon="el-icon-edit"
  111. @click="handleUpdate(scope.row)"
  112. v-hasPermi="['qw:workUser:edit']"
  113. >修改</el-button>
  114. <el-button
  115. size="mini"
  116. type="text"
  117. icon="el-icon-delete"
  118. @click="handleDelete(scope.row)"
  119. v-hasPermi="['qw:workUser:remove']"
  120. >删除</el-button>
  121. </template>
  122. </el-table-column>
  123. </el-table>
  124. <pagination
  125. v-show="total>0"
  126. :total="total"
  127. :page.sync="queryParams.pageNum"
  128. :limit.sync="queryParams.pageSize"
  129. @pagination="getList"
  130. />
  131. <!-- 添加或修改企微获客添加的用户对话框 -->
  132. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  133. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  134. <el-form-item label="链接ID" prop="linkId">
  135. <el-input v-model="form.linkId" placeholder="请输入链接ID" />
  136. </el-form-item>
  137. <el-form-item label="客户external_userid" prop="externalUserid">
  138. <el-input v-model="form.externalUserid" placeholder="请输入客户external_userid" />
  139. </el-form-item>
  140. <el-form-item label="跟进人userid" prop="userid">
  141. <el-input v-model="form.userid" placeholder="请输入跟进人userid" />
  142. </el-form-item>
  143. <el-form-item label="会话状态,0-客户未发消息 1-客户已发送消息 2-客户发送消息状态未知">
  144. <el-radio-group v-model="form.chatStatus">
  145. <el-radio label="1">请选择字典生成</el-radio>
  146. </el-radio-group>
  147. </el-form-item>
  148. <el-form-item label="额外参数" prop="state">
  149. <el-input v-model="form.state" placeholder="请输入额外参数" />
  150. </el-form-item>
  151. <el-form-item label="备注" prop="remark">
  152. <el-input v-model="form.remark" placeholder="请输入备注" />
  153. </el-form-item>
  154. </el-form>
  155. <div slot="footer" class="dialog-footer">
  156. <el-button type="primary" @click="submitForm">确 定</el-button>
  157. <el-button @click="cancel">取 消</el-button>
  158. </div>
  159. </el-dialog>
  160. </div>
  161. </template>
  162. <script>
  163. import { listWorkUser, getWorkUser, delWorkUser, addWorkUser, updateWorkUser, exportWorkUser } from "@/api/qw/workUser";
  164. export default {
  165. name: "WorkUser",
  166. data() {
  167. return {
  168. // 遮罩层
  169. loading: true,
  170. // 导出遮罩层
  171. exportLoading: false,
  172. // 选中数组
  173. ids: [],
  174. // 非单个禁用
  175. single: true,
  176. // 非多个禁用
  177. multiple: true,
  178. // 显示搜索条件
  179. showSearch: true,
  180. // 总条数
  181. total: 0,
  182. // 企微获客添加的用户表格数据
  183. workUserList: [],
  184. // 弹出层标题
  185. title: "",
  186. // 是否显示弹出层
  187. open: false,
  188. // 查询参数
  189. queryParams: {
  190. pageNum: 1,
  191. pageSize: 10,
  192. linkId: null,
  193. externalUserid: null,
  194. userid: null,
  195. chatStatus: null,
  196. state: null,
  197. },
  198. // 表单参数
  199. form: {},
  200. // 表单校验
  201. rules: {
  202. }
  203. };
  204. },
  205. created() {
  206. this.getList();
  207. },
  208. methods: {
  209. /** 查询企微获客添加的用户列表 */
  210. getList() {
  211. this.loading = true;
  212. listWorkUser(this.queryParams).then(response => {
  213. this.workUserList = response.rows;
  214. this.total = response.total;
  215. this.loading = false;
  216. });
  217. },
  218. // 取消按钮
  219. cancel() {
  220. this.open = false;
  221. this.reset();
  222. },
  223. // 表单重置
  224. reset() {
  225. this.form = {
  226. id: null,
  227. linkId: null,
  228. externalUserid: null,
  229. userid: null,
  230. chatStatus: "0",
  231. state: null,
  232. createTime: null,
  233. createBy: null,
  234. updateBy: null,
  235. updateTime: null,
  236. remark: null
  237. };
  238. this.resetForm("form");
  239. },
  240. /** 搜索按钮操作 */
  241. handleQuery() {
  242. this.queryParams.pageNum = 1;
  243. this.getList();
  244. },
  245. /** 重置按钮操作 */
  246. resetQuery() {
  247. this.resetForm("queryForm");
  248. this.handleQuery();
  249. },
  250. // 多选框选中数据
  251. handleSelectionChange(selection) {
  252. this.ids = selection.map(item => item.id)
  253. this.single = selection.length!==1
  254. this.multiple = !selection.length
  255. },
  256. /** 新增按钮操作 */
  257. handleAdd() {
  258. this.reset();
  259. this.open = true;
  260. this.title = "添加企微获客添加的用户";
  261. },
  262. /** 修改按钮操作 */
  263. handleUpdate(row) {
  264. this.reset();
  265. const id = row.id || this.ids
  266. getWorkUser(id).then(response => {
  267. this.form = response.data;
  268. this.open = true;
  269. this.title = "修改企微获客添加的用户";
  270. });
  271. },
  272. /** 提交按钮 */
  273. submitForm() {
  274. this.$refs["form"].validate(valid => {
  275. if (valid) {
  276. if (this.form.id != null) {
  277. updateWorkUser(this.form).then(response => {
  278. this.msgSuccess("修改成功");
  279. this.open = false;
  280. this.getList();
  281. });
  282. } else {
  283. addWorkUser(this.form).then(response => {
  284. this.msgSuccess("新增成功");
  285. this.open = false;
  286. this.getList();
  287. });
  288. }
  289. }
  290. });
  291. },
  292. /** 删除按钮操作 */
  293. handleDelete(row) {
  294. const ids = row.id || this.ids;
  295. this.$confirm('是否确认删除企微获客添加的用户编号为"' + ids + '"的数据项?', "警告", {
  296. confirmButtonText: "确定",
  297. cancelButtonText: "取消",
  298. type: "warning"
  299. }).then(function() {
  300. return delWorkUser(ids);
  301. }).then(() => {
  302. this.getList();
  303. this.msgSuccess("删除成功");
  304. }).catch(() => {});
  305. },
  306. /** 导出按钮操作 */
  307. handleExport() {
  308. const queryParams = this.queryParams;
  309. this.$confirm('是否确认导出所有企微获客添加的用户数据项?', "警告", {
  310. confirmButtonText: "确定",
  311. cancelButtonText: "取消",
  312. type: "warning"
  313. }).then(() => {
  314. this.exportLoading = true;
  315. return exportWorkUser(queryParams);
  316. }).then(response => {
  317. this.download(response.msg);
  318. this.exportLoading = false;
  319. }).catch(() => {});
  320. }
  321. }
  322. };
  323. </script>