Digital Office Automation System
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item>
  5. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  6. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  7. </el-form-item>
  8. </el-form>
  9. <el-row :gutter="10" class="mb8">
  10. <el-col :span="1.5">
  11. <el-button
  12. type="primary"
  13. plain
  14. icon="el-icon-plus"
  15. size="mini"
  16. @click="handleAdd"
  17. v-hasPermi="['system:operationSmtp:add']"
  18. >新增</el-button>
  19. </el-col>
  20. <el-col :span="1.5">
  21. <el-button
  22. type="success"
  23. plain
  24. icon="el-icon-edit"
  25. size="mini"
  26. :disabled="single"
  27. @click="handleUpdate"
  28. v-hasPermi="['system:operationSmtp:edit']"
  29. >修改</el-button>
  30. </el-col>
  31. <el-col :span="1.5">
  32. <el-button
  33. type="danger"
  34. plain
  35. icon="el-icon-delete"
  36. size="mini"
  37. :disabled="multiple"
  38. @click="handleDelete"
  39. v-hasPermi="['system:operationSmtp:remove']"
  40. >删除</el-button>
  41. </el-col>
  42. <el-col :span="1.5">
  43. <el-button
  44. type="warning"
  45. plain
  46. icon="el-icon-download"
  47. size="mini"
  48. @click="handleExport"
  49. v-hasPermi="['system:operationSmtp:export']"
  50. >导出</el-button>
  51. </el-col>
  52. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  53. </el-row>
  54. <el-table v-loading="loading" :data="operationSmtpList" @selection-change="handleSelectionChange">
  55. <el-table-column type="selection" width="55" align="center" />
  56. <el-table-column label="主键ID" align="center" prop="id" v-if="false"/>
  57. <el-table-column label="主机" align="center" prop="host" />
  58. <el-table-column label="端口" align="center" prop="port" />
  59. <el-table-column label="用户名" align="center" prop="username" />
  60. <el-table-column label="密码" align="center" prop="password" />
  61. <el-table-column label="最大发信数" align="center" prop="maxCount" />
  62. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  63. <template slot-scope="scope">
  64. <el-button
  65. size="mini"
  66. type="text"
  67. icon="el-icon-edit"
  68. @click="handleUpdate(scope.row)"
  69. v-hasPermi="['system:operationSmtp:edit']"
  70. >修改</el-button>
  71. <el-button
  72. size="mini"
  73. type="text"
  74. icon="el-icon-delete"
  75. @click="handleDelete(scope.row)"
  76. v-hasPermi="['system:operationSmtp:remove']"
  77. >删除</el-button>
  78. </template>
  79. </el-table-column>
  80. </el-table>
  81. <pagination
  82. v-show="total>0"
  83. :total="total"
  84. :page.sync="queryParams.pageNum"
  85. :limit.sync="queryParams.pageSize"
  86. @pagination="getList"
  87. />
  88. <!-- 添加或修改邮件配置对话框 -->
  89. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  90. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  91. <el-form-item label="主机" prop="host">
  92. <el-input v-model="form.host" placeholder="请输入主机" />
  93. </el-form-item>
  94. <el-form-item label="端口" prop="port">
  95. <el-input v-model="form.port" placeholder="请输入端口" />
  96. </el-form-item>
  97. <el-form-item label="用户名" prop="username">
  98. <el-input v-model="form.username" placeholder="请输入用户名" />
  99. </el-form-item>
  100. <el-form-item label="密码" prop="password">
  101. <el-input v-model="form.password" placeholder="请输入密码" />
  102. </el-form-item>
  103. <el-form-item label="最大发信数" prop="maxCount">
  104. <el-input v-model="form.maxCount" placeholder="请输入最大发信数" />
  105. </el-form-item>
  106. </el-form>
  107. <div slot="footer" class="dialog-footer">
  108. <el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
  109. <el-button @click="cancel">取 消</el-button>
  110. </div>
  111. </el-dialog>
  112. </div>
  113. </template>
  114. <script>
  115. import { listOperationSmtp, getOperationSmtp, delOperationSmtp, addOperationSmtp, updateOperationSmtp } from "@/api/system/operationSmtp";
  116. export default {
  117. name: "OperationSmtp",
  118. data() {
  119. return {
  120. // 按钮loading
  121. buttonLoading: false,
  122. // 遮罩层
  123. loading: true,
  124. // 选中数组
  125. ids: [],
  126. // 非单个禁用
  127. single: true,
  128. // 非多个禁用
  129. multiple: true,
  130. // 显示搜索条件
  131. showSearch: true,
  132. // 总条数
  133. total: 0,
  134. // 邮件配置表格数据
  135. operationSmtpList: [],
  136. // 弹出层标题
  137. title: "",
  138. // 是否显示弹出层
  139. open: false,
  140. // 查询参数
  141. queryParams: {
  142. pageNum: 1,
  143. pageSize: 10,
  144. },
  145. // 表单参数
  146. form: {},
  147. // 表单校验
  148. rules: {
  149. id: [
  150. { required: true, message: "主键ID不能为空", trigger: "blur" }
  151. ],
  152. }
  153. };
  154. },
  155. created() {
  156. this.getList();
  157. },
  158. methods: {
  159. /** 查询邮件配置列表 */
  160. getList() {
  161. this.loading = true;
  162. listOperationSmtp(this.queryParams).then(response => {
  163. this.operationSmtpList = response.rows;
  164. this.total = response.total;
  165. this.loading = false;
  166. });
  167. },
  168. // 取消按钮
  169. cancel() {
  170. this.open = false;
  171. this.reset();
  172. },
  173. // 表单重置
  174. reset() {
  175. this.form = {
  176. id: undefined,
  177. host: undefined,
  178. port: undefined,
  179. username: undefined,
  180. password: undefined,
  181. maxCount: undefined
  182. };
  183. this.resetForm("form");
  184. },
  185. /** 搜索按钮操作 */
  186. handleQuery() {
  187. this.queryParams.pageNum = 1;
  188. this.getList();
  189. },
  190. /** 重置按钮操作 */
  191. resetQuery() {
  192. this.resetForm("queryForm");
  193. this.handleQuery();
  194. },
  195. // 多选框选中数据
  196. handleSelectionChange(selection) {
  197. this.ids = selection.map(item => item.id)
  198. this.single = selection.length!==1
  199. this.multiple = !selection.length
  200. },
  201. /** 新增按钮操作 */
  202. handleAdd() {
  203. this.reset();
  204. this.open = true;
  205. this.title = "添加邮件配置";
  206. },
  207. /** 修改按钮操作 */
  208. handleUpdate(row) {
  209. this.loading = true;
  210. this.reset();
  211. const id = row.id || this.ids
  212. getOperationSmtp(id).then(response => {
  213. this.loading = false;
  214. this.form = response.data;
  215. this.open = true;
  216. this.title = "修改邮件配置";
  217. });
  218. },
  219. /** 提交按钮 */
  220. submitForm() {
  221. this.$refs["form"].validate(valid => {
  222. if (valid) {
  223. this.buttonLoading = true;
  224. if (this.form.id != null) {
  225. updateOperationSmtp(this.form).then(response => {
  226. this.$modal.msgSuccess("修改成功");
  227. this.open = false;
  228. this.getList();
  229. }).finally(() => {
  230. this.buttonLoading = false;
  231. });
  232. } else {
  233. addOperationSmtp(this.form).then(response => {
  234. this.$modal.msgSuccess("新增成功");
  235. this.open = false;
  236. this.getList();
  237. }).finally(() => {
  238. this.buttonLoading = false;
  239. });
  240. }
  241. }
  242. });
  243. },
  244. /** 删除按钮操作 */
  245. handleDelete(row) {
  246. const ids = row.id || this.ids;
  247. this.$modal.confirm('是否确认删除邮件配置编号为"' + ids + '"的数据项?').then(() => {
  248. this.loading = true;
  249. return delOperationSmtp(ids);
  250. }).then(() => {
  251. this.loading = false;
  252. this.getList();
  253. this.$modal.msgSuccess("删除成功");
  254. }).catch(() => {
  255. }).finally(() => {
  256. this.loading = false;
  257. });
  258. },
  259. /** 导出按钮操作 */
  260. handleExport() {
  261. this.download('system/operationSmtp/export', {
  262. ...this.queryParams
  263. }, `operationSmtp_${new Date().getTime()}.xlsx`)
  264. }
  265. }
  266. };
  267. </script>