index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  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="deptId">
  5. <treeselect style="width:205.4px" v-model="queryParams.deptId" :options="deptOptions" :show-count="true" placeholder="请选择所属部门" />
  6. </el-form-item>
  7. <el-form-item label="客户编号" prop="customerCode">
  8. <el-input
  9. style="width:220px"
  10. v-model="queryParams.customerCode"
  11. placeholder="请输入客户编号"
  12. clearable
  13. size="small"
  14. @keyup.enter.native="handleQuery"
  15. />
  16. </el-form-item>
  17. <el-form-item label="员工姓名" prop="companyUserNickName">
  18. <el-input
  19. style="width:220px"
  20. v-model="queryParams.companyUserNickName"
  21. placeholder="请输入员工姓名"
  22. clearable
  23. size="small"
  24. @keyup.enter.native="handleQuery"
  25. />
  26. </el-form-item>
  27. <el-form-item label="手机号" prop="phone">
  28. <el-input
  29. style="width:220px"
  30. v-model="queryParams.phone"
  31. placeholder="请输入发送手机号"
  32. clearable
  33. size="small"
  34. @keyup.enter.native="handleQuery"
  35. />
  36. </el-form-item>
  37. <el-form-item label="提交时间" prop="createTime">
  38. <el-date-picker
  39. style="width:220px"
  40. clearable size="small"
  41. v-model="dateRange"
  42. type="daterange"
  43. value-format="yyyy-MM-dd"
  44. start-placeholder="开始日期"
  45. end-placeholder="结束日期">
  46. </el-date-picker>
  47. </el-form-item>
  48. <el-form-item label="是否回复" prop="isReply">
  49. <el-select style="width:220px" v-model="queryParams.isReply" placeholder="请选择是否回复" clearable size="small">
  50. <el-option :key="1" label="是" :value="1"/>
  51. <el-option :key="0" label="否" :value="0"/>
  52. </el-select>
  53. </el-form-item>
  54. <el-form-item label="状态" prop="status">
  55. <el-select style="width:220px" v-model="queryParams.status" placeholder="请选择状态" clearable size="small">
  56. <el-option
  57. v-for="dict in statusOptions"
  58. :key="dict.dictValue"
  59. :label="dict.dictLabel"
  60. :value="dict.dictValue"
  61. />
  62. </el-select>
  63. </el-form-item>
  64. <el-form-item>
  65. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  66. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  67. </el-form-item>
  68. </el-form>
  69. <el-row :gutter="10" class="mb8">
  70. <el-col :span="1.5">
  71. <el-button
  72. type="warning"
  73. icon="el-icon-download"
  74. size="mini"
  75. @click="handleExport"
  76. v-hasPermi="['company:companySmsLogs:export']"
  77. >导出</el-button>
  78. </el-col>
  79. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  80. </el-row>
  81. <el-table height="500" border v-loading="loading" :data="companySmsLogsList" @selection-change="handleSelectionChange">
  82. <el-table-column type="selection" width="55" align="center" />
  83. <el-table-column label="ID" align="center" prop="logsId" />
  84. <el-table-column label="客户编码" align="center" prop="customerCode" />
  85. <el-table-column label="客户名称" align="center" prop="customerName" :show-overflow-tooltip="true">
  86. <template slot-scope="scope">
  87. <el-link @click="handleShow(scope.row)" :underline="false" type="primary" >{{scope.row.customerName}}</el-link>
  88. </template>
  89. </el-table-column>
  90. <el-table-column label="手机号" align="center" prop="phone" />
  91. <el-table-column label="短信内容" show-overflow-tooltip align="center" prop="content" />
  92. <el-table-column label="发送者" align="center" prop="companyUserNickName" />
  93. <el-table-column label="提交时间" align="center" prop="createTime" width="180">
  94. </el-table-column>
  95. <el-table-column label="发送时间" align="center" prop="sendTime" width="180">
  96. </el-table-column>
  97. <el-table-column label="状态" align="center" prop="status" >
  98. <template slot-scope="scope">
  99. <el-tag prop="status" v-for="(item, index) in statusOptions" :type="scope.row.status==1?'success':'danger'" v-if="scope.row.status==item.dictValue">{{item.dictLabel}}</el-tag>
  100. </template>
  101. </el-table-column>
  102. <el-table-column label="回复内容" align="center" prop="replyContent" />
  103. </el-table>
  104. <pagination
  105. v-show="total>0"
  106. :total="total"
  107. :page.sync="queryParams.pageNum"
  108. :limit.sync="queryParams.pageSize"
  109. @pagination="getList"
  110. />
  111. <el-drawer
  112. size="75%"
  113. :title="show.title" :visible.sync="show.open"
  114. >
  115. <customer-details ref="customerDetails" />
  116. </el-drawer>
  117. </div>
  118. </template>
  119. <script>
  120. import { listCompanySmsLogs, getCompanySmsLogs, delCompanySmsLogs, addCompanySmsLogs, updateCompanySmsLogs, exportCompanySmsLogs } from "@/api/company/companySmsLogs";
  121. import Editor from '@/components/Editor';
  122. import customerDetails from '../../crm/components/customerDetails.vue';
  123. import { treeselect } from "@/api/company/companyDept";
  124. import Treeselect from "@riophae/vue-treeselect";
  125. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  126. export default {
  127. name: "CompanySmsLogs",
  128. components: { customerDetails,Editor,Treeselect },
  129. data() {
  130. return {
  131. // 部门树选项
  132. deptOptions: undefined,
  133. // 部门名称
  134. deptName: undefined,
  135. show:{
  136. title:"客户详情",
  137. open:false,
  138. },
  139. statusOptions:[],
  140. // 遮罩层
  141. loading: true,
  142. // 选中数组
  143. ids: [],
  144. // 非单个禁用
  145. single: true,
  146. // 非多个禁用
  147. multiple: true,
  148. // 显示搜索条件
  149. showSearch: true,
  150. // 总条数
  151. total: 0,
  152. dateRange:[],
  153. // 短信发送记录表格数据
  154. companySmsLogsList: [],
  155. // 弹出层标题
  156. title: "",
  157. // 是否显示弹出层
  158. open: false,
  159. // 查询参数
  160. queryParams: {
  161. pageNum: 1,
  162. pageSize: 10,
  163. companyId: null,
  164. userId: null,
  165. customerId: null,
  166. tempId: null,
  167. tempCode: null,
  168. phone: null,
  169. content: null,
  170. sendTime: null,
  171. status: null,
  172. isReply:null,
  173. },
  174. // 表单参数
  175. form: {},
  176. // 表单校验
  177. rules: {
  178. }
  179. };
  180. },
  181. created() {
  182. this.getDicts("company_sms_logs_status").then((response) => {
  183. this.statusOptions = response.data;
  184. });
  185. this.getList();
  186. this.getTreeselect();
  187. },
  188. methods: {
  189. handleShow(row){
  190. var that=this;
  191. that.show.open=true;
  192. setTimeout(() => {
  193. that.$refs.customerDetails.getDetails(row.customerId);
  194. }, 200);
  195. },
  196. /** 查询短信发送记录列表 */
  197. getList() {
  198. this.loading = true;
  199. listCompanySmsLogs(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
  200. this.companySmsLogsList = response.rows;
  201. this.total = response.total;
  202. this.loading = false;
  203. });
  204. },
  205. // 取消按钮
  206. cancel() {
  207. this.open = false;
  208. this.reset();
  209. },
  210. // 表单重置
  211. reset() {
  212. this.form = {
  213. logsId: null,
  214. companyId: null,
  215. userId: null,
  216. customerId: null,
  217. tempId: null,
  218. tempCode: null,
  219. phone: null,
  220. content: null,
  221. createTime: null,
  222. sendTime: null,
  223. status: 0
  224. };
  225. this.resetForm("form");
  226. },
  227. /** 搜索按钮操作 */
  228. handleQuery() {
  229. this.queryParams.pageNum = 1;
  230. this.getList();
  231. },
  232. /** 重置按钮操作 */
  233. resetQuery() {
  234. this.resetForm("queryForm");
  235. this.handleQuery();
  236. },
  237. // 多选框选中数据
  238. handleSelectionChange(selection) {
  239. this.ids = selection.map(item => item.logsId)
  240. this.single = selection.length!==1
  241. this.multiple = !selection.length
  242. },
  243. /** 新增按钮操作 */
  244. handleAdd() {
  245. this.reset();
  246. this.open = true;
  247. this.title = "添加短信发送记录";
  248. },
  249. /** 修改按钮操作 */
  250. handleUpdate(row) {
  251. this.reset();
  252. const logsId = row.logsId || this.ids
  253. getCompanySmsLogs(logsId).then(response => {
  254. this.form = response.data;
  255. this.open = true;
  256. this.title = "修改短信发送记录";
  257. });
  258. },
  259. /** 提交按钮 */
  260. submitForm() {
  261. this.$refs["form"].validate(valid => {
  262. if (valid) {
  263. if (this.form.logsId != null) {
  264. updateCompanySmsLogs(this.form).then(response => {
  265. if (response.code === 200) {
  266. this.msgSuccess("修改成功");
  267. this.open = false;
  268. this.getList();
  269. }
  270. });
  271. } else {
  272. addCompanySmsLogs(this.form).then(response => {
  273. if (response.code === 200) {
  274. this.msgSuccess("新增成功");
  275. this.open = false;
  276. this.getList();
  277. }
  278. });
  279. }
  280. }
  281. });
  282. },
  283. /** 删除按钮操作 */
  284. handleDelete(row) {
  285. const logsIds = row.logsId || this.ids;
  286. this.$confirm('是否确认删除短信发送记录编号为"' + logsIds + '"的数据项?', "警告", {
  287. confirmButtonText: "确定",
  288. cancelButtonText: "取消",
  289. type: "warning"
  290. }).then(function() {
  291. return delCompanySmsLogs(logsIds);
  292. }).then(() => {
  293. this.getList();
  294. this.msgSuccess("删除成功");
  295. }).catch(function() {});
  296. },
  297. /** 导出按钮操作 */
  298. handleExport() {
  299. const queryParams = this.queryParams;
  300. this.$confirm('是否确认导出所有短信发送记录数据项?', "警告", {
  301. confirmButtonText: "确定",
  302. cancelButtonText: "取消",
  303. type: "warning"
  304. }).then(function() {
  305. return exportCompanySmsLogs(queryParams);
  306. }).then(response => {
  307. this.download(response.msg);
  308. }).catch(function() {});
  309. },
  310. getTreeselect() {
  311. treeselect().then((response) => {
  312. this.deptOptions = response.data;
  313. });
  314. },
  315. }
  316. };
  317. </script>