index.vue 11 KB

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