my.vue 11 KB

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