index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  1. <template>
  2. <div class="app-container">
  3. <el-row :gutter="24" class="baseInfo">
  4. <el-col :xs="12" :sm="12" :lg="6" class="ivu-mb">
  5. <el-card :bordered="false" dis-hover :padding="12">
  6. <div slot="header" class="acea-row row-between-wrapper">
  7. <span>加微记录数</span>
  8. </div>
  9. <div v-if="count" class="content">
  10. <span class="content-number spBlock mb15">
  11. <count-to :start-val="0" :end-val="totalRecordCount || 0" :duration="2600" class="card-panel-num" />
  12. </span>
  13. </div>
  14. </el-card>
  15. </el-col>
  16. <el-col :xs="12" :sm="12" :lg="6" class="ivu-mb">
  17. <el-card :bordered="false" dis-hover :padding="12">
  18. <div slot="header" class="acea-row row-between-wrapper">
  19. <span>加微成功数</span>
  20. </div>
  21. <div v-if="count" class="content">
  22. <span class="content-number spBlock mb15">
  23. <count-to :start-val="0" :end-val="successRecordCount || 0" :duration="2600" class="card-panel-num" />
  24. </span>
  25. </div>
  26. </el-card>
  27. </el-col>
  28. <el-col :xs="12" :sm="12" :lg="6" class="ivu-mb">
  29. <el-card :bordered="false" dis-hover :padding="12">
  30. <div slot="header" class="acea-row row-between-wrapper">
  31. <span>今日加微</span>
  32. </div>
  33. <div v-if="count" class="content">
  34. <span class="content-number spBlock mb15">
  35. <count-to :start-val="0" :end-val="todayRecordCount || 0" :duration="2600" class="card-panel-num" />
  36. </span>
  37. </div>
  38. </el-card>
  39. </el-col>
  40. </el-row>
  41. <el-form v-show="showSearch" ref="queryForm" :model="queryParams" :inline="true" label-width="96px">
  42. <!-- <el-form-item label="任务" prop="roboticId">-->
  43. <!-- <el-select v-model="queryParams.roboticId" filterable clearable>-->
  44. <!-- &lt;!&ndash; 默认选项 &ndash;&gt;-->
  45. <!-- <el-option label="所有任务" :value="null" />-->
  46. <!-- &lt;!&ndash; 动态列表 &ndash;&gt;-->
  47. <!-- <el-option-->
  48. <!-- v-for="item in roboticList"-->
  49. <!-- :key="item.id"-->
  50. <!-- :label="item.name"-->
  51. <!-- :value="item.id"-->
  52. <!-- />-->
  53. <!-- </el-select>-->
  54. <!-- </el-form-item>-->
  55. <el-form-item prop="roboticId">
  56. <el-select
  57. v-model="queryParams.roboticId"
  58. filterable
  59. clearable
  60. placeholder="请选择任务"
  61. @change="handleQuery"
  62. class="task-select"
  63. >
  64. <i slot="prefix" class="el-icon-s-operation" />
  65. <el-option label="所有任务" :value="null" />
  66. <el-option
  67. v-for="item in roboticList"
  68. :key="item.id"
  69. :label="item.name"
  70. :value="item.id"
  71. />
  72. </el-select>
  73. </el-form-item>
  74. <!-- <el-form-item label="销售" prop="wxAccountId">-->
  75. <!-- <el-select v-model="queryParams.wxAccountId" filterable clearable>-->
  76. <!-- <el-option-->
  77. <!-- v-for="item in accountList"-->
  78. <!-- :key="item.id"-->
  79. <!-- :label="item.companyUserName + '-' + item.wxNickName"-->
  80. <!-- :value="item.id"-->
  81. <!-- />-->
  82. <!-- </el-select>-->
  83. <!-- </el-form-item>-->
  84. <el-form-item label="状态" prop="status">
  85. <el-select v-model="queryParams.status" clearable>
  86. <el-option label="执行中" :value="1" />
  87. <el-option label="执行成功" :value="2" />
  88. <el-option label="执行失败" :value="3" />
  89. </el-select>
  90. </el-form-item>
  91. <el-form-item label="执行时间" prop="time">
  92. <el-date-picker
  93. v-model="queryParams.time"
  94. type="datetimerange"
  95. range-separator="-"
  96. value-format="yyyy-MM-dd HH:mm:ss"
  97. start-placeholder="开始时间"
  98. end-placeholder="结束时间"
  99. :default-time="['00:00:00', '23:59:59']"
  100. />
  101. </el-form-item>
  102. <el-form-item>
  103. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">查找</el-button>
  104. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  105. </el-form-item>
  106. </el-form>
  107. <el-row :gutter="10" class="mb8">
  108. <el-col :span="1.5">
  109. <el-button
  110. v-hasPermi="['company:addwxlog:list']"
  111. type="warning"
  112. icon="el-icon-download"
  113. size="mini"
  114. @click="handleExport"
  115. >导出</el-button>
  116. </el-col>
  117. <right-toolbar :show-search.sync="showSearch" @queryTable="handleQuery" />
  118. </el-row>
  119. <el-table v-loading="loading" :data="companyClientList">
  120. <el-table-column label="记录 ID" align="center" prop="logId" width="90" />
  121. <el-table-column label="任务 ID" align="center" prop="roboticId" width="90" />
  122. <el-table-column label="企微账号" align="center" prop="wxAccountName" width="180" />
  123. <el-table-column label="微信昵称" align="center" prop="wxClientName" />
  124. <el-table-column label="手机号" align="center" prop="phone" />
  125. <!-- <el-table-column label="话术" align="center" prop="dialogName" />-->
  126. <el-table-column label="加微类型" align="center" width="100">
  127. <template slot-scope="scope">
  128. <el-tag v-if="scope.row.isWeCom == 1" type="success">个微</el-tag>
  129. <el-tag v-else-if="scope.row.isWeCom == 2" type="primary">企微</el-tag>
  130. </template>
  131. </el-table-column>
  132. <el-table-column label="客户意向度" align="center" prop="intention" />
  133. <el-table-column label="是否添加" align="center" prop="status" width="100">
  134. <template slot-scope="scope">
  135. <el-tag :type="getIsAddStatusType(scope.row.isAdd)">
  136. {{ getIsAddStatusLabel(scope.row.isAdd) }}
  137. </el-tag>
  138. </template>
  139. </el-table-column>
  140. <el-table-column label="公司" align="center" prop="companyName" />
  141. <el-table-column label="添加时间" align="center" prop="addTime" />
  142. <el-table-column label="状态" align="center" prop="status" width="100">
  143. <template slot-scope="scope">
  144. <el-tag :type="getStatusType(scope.row.status)">
  145. {{ getStatusLabel(scope.row.status) }}
  146. </el-tag>
  147. </template>
  148. </el-table-column>
  149. <el-table-column label="执行时间" align="center" prop="runTime" width="180">
  150. <template slot-scope="scope">
  151. <span>{{ parseTime(scope.row.runTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
  152. </template>
  153. </el-table-column>
  154. <!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">-->
  155. <!-- <template slot-scope="scope">-->
  156. <!-- &lt;!&ndash; <el-button&ndash;&gt;-->
  157. <!-- &lt;!&ndash; size="mini"&ndash;&gt;-->
  158. <!-- &lt;!&ndash; type="text"&ndash;&gt;-->
  159. <!-- &lt;!&ndash; icon="el-icon-edit"&ndash;&gt;-->
  160. <!-- &lt;!&ndash; @click="handleUpdate(scope.row)"&ndash;&gt;-->
  161. <!-- &lt;!&ndash; v-hasPermi="['company:companyClient:edit']"&ndash;&gt;-->
  162. <!-- &lt;!&ndash; >修改</el-button>&ndash;&gt;-->
  163. <!-- <el-button-->
  164. <!-- size="mini"-->
  165. <!-- type="text"-->
  166. <!-- icon="el-icon-delete"-->
  167. <!-- @click="handleDelete(scope.row)"-->
  168. <!-- v-hasPermi="['company:addwxlog:remove']"-->
  169. <!-- >删除-->
  170. <!-- </el-button>-->
  171. <!-- </template>-->
  172. <!-- </el-table-column>-->
  173. </el-table>
  174. <pagination
  175. v-show="total > 0"
  176. :total="total"
  177. :page.sync="queryParams.pageNum"
  178. :limit.sync="queryParams.pageSize"
  179. @pagination="getList"
  180. />
  181. </div>
  182. </template>
  183. <script>
  184. import { listAllAddWx, exportAddwx, delCompanyClient } from '@/api/company/addwx'
  185. // import { addWxStatistics } from '@/api/company/companyClient'
  186. import { listAll as roboticListAll } from '@/api/company/companyVoiceRobotic'
  187. import { listAll as accountListAll } from '@/api/company/companyAccount'
  188. import CountTo from 'vue-count-to'
  189. export default {
  190. name: 'WxClientStatistics',
  191. components: { CountTo },
  192. data() {
  193. return {
  194. loading: false,
  195. showSearch: true,
  196. total: 0,
  197. companyClientList: [],
  198. roboticList: [],
  199. accountList: [],
  200. count: {},
  201. totalRecordCount: 0,
  202. successRecordCount: 0,
  203. todayRecordCount:0,
  204. queryParams: {
  205. pageNum: 1,
  206. pageSize: 10,
  207. roboticId: null,
  208. wxAccountId: null,
  209. status: null,
  210. time: []
  211. }
  212. }
  213. },
  214. created() {
  215. this.initOptions()
  216. this.handleQuery()
  217. },
  218. methods: {
  219. initOptions() {
  220. roboticListAll().then((res) => {
  221. this.roboticList = res.data || []
  222. })
  223. accountListAll().then((res) => {
  224. this.accountList = res.data || []
  225. })
  226. },
  227. getQueryData() {
  228. const params = JSON.parse(JSON.stringify(this.queryParams))
  229. if (params.time && params.time.length === 2) {
  230. params.beginTime = params.time[0]
  231. params.endTime = params.time[1]
  232. }
  233. delete params.time
  234. return params
  235. },
  236. getList() {
  237. this.loading = true
  238. listAllAddWx(this.getQueryData())
  239. .then((response) => {
  240. this.companyClientList = response.rows || []
  241. this.total = response.total || 0
  242. this.successRecordCount = response.successRecordCount || 0
  243. this.totalRecordCount = response.totalRecordCount || 0
  244. this.todayRecordCount = response.todayRecordCount || 0
  245. })
  246. .finally(() => {
  247. this.loading = false
  248. })
  249. },
  250. // statis() {
  251. // addWxStatistics(this.getQueryData()).then((res) => {
  252. // this.count = res || {}
  253. // })
  254. // },
  255. getStatusLabel(value) {
  256. if (value === 1) return '执行中'
  257. if (value === 2) return '成功'
  258. if (value === 3) return '失败'
  259. return '-'
  260. },
  261. getStatusType(value) {
  262. if (value === 1) return 'warning'
  263. if (value === 2) return 'success'
  264. if (value === 3) return 'danger'
  265. return 'info'
  266. },
  267. getIsAddStatusLabel(value) {
  268. if (value === 0) return '失败'
  269. if (value === 1) return '成功'
  270. if (value === 2) return '加微中'
  271. return '-'
  272. },
  273. getIsAddStatusType(value) {
  274. if (value === 0) return 'danger'
  275. if (value === 1) return 'success'
  276. if (value === 2) return 'warning'
  277. return 'info'
  278. },
  279. handleQuery() {
  280. this.queryParams.pageNum = 1
  281. // this.statis()
  282. this.getList()
  283. },
  284. resetQuery() {
  285. this.resetForm('queryForm')
  286. this.handleQuery()
  287. },
  288. handleExport() {
  289. const queryParams = this.getQueryData()
  290. this.$confirm('是否确认导出查询出的短链课程看课记录数据项?', "警告", {
  291. confirmButtonText: "确定",
  292. cancelButtonText: "取消",
  293. type: "warning"
  294. }).then(() => {
  295. this.exportLoading = true;
  296. return exportAddwx(queryParams)
  297. }).then((response) => {
  298. this.download(response.msg)
  299. this.exportLoading = false;
  300. }).catch(() => {})
  301. },
  302. /** 删除按钮操作 */
  303. handleDelete(row) {
  304. const ids = row.logId || this.ids;
  305. this.$confirm('是否确认删除编号为 "' + ids + '" 的加微信日志数据项?', "警告", {
  306. confirmButtonText: "确定",
  307. cancelButtonText: "取消",
  308. type: "warning"
  309. }).then(function () {
  310. return delCompanyClient(ids);
  311. }).then(() => {
  312. this.getList();
  313. this.msgSuccess("删除成功");
  314. }).catch(function () {
  315. });
  316. },
  317. }
  318. }
  319. </script>
  320. <style rel="stylesheet/scss" lang="scss" scoped>
  321. .baseInfo {
  322. margin-bottom: 30px;
  323. }
  324. .content {
  325. .card-panel-num {
  326. display: inline-block;
  327. font-size: 30px;
  328. }
  329. &-time {
  330. font-size: 14px;
  331. }
  332. }
  333. .task-select .el-input__inner {
  334. background-color: #ecf5ff;
  335. border: 1px solid #409EFF;
  336. border-radius: 20px;
  337. height: 36px;
  338. padding-left: 15px;
  339. box-shadow: 0 2px 6px rgba(64,158,255,0.1);
  340. transition: all 0.2s;
  341. }
  342. .task-select .el-input__inner:hover {
  343. border-color: #66b1ff;
  344. }
  345. .task-select .el-input.is-focus .el-input__inner {
  346. border-color: #409EFF;
  347. box-shadow: 0 0 8px rgba(64,158,255,0.3);
  348. background-color: #ffffff;
  349. }
  350. </style>