index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  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 label="单位名称" prop="depName">
  5. <el-input v-model="queryParams.depName" placeholder="请输入单位名称" clearable @keyup.enter.native="handleQuery"/>
  6. </el-form-item>
  7. <el-form-item>
  8. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  9. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  10. </el-form-item>
  11. </el-form>
  12. <el-row :gutter="10" class="mb8">
  13. <el-col :span="1.5">
  14. <el-button
  15. type="primary"
  16. plain
  17. icon="el-icon-plus"
  18. size="mini"
  19. @click="handleAdd"
  20. v-hasPermi="['business:ONLINE:add']"
  21. >新增</el-button>
  22. </el-col>
  23. <el-col :span="1.5">
  24. <el-button
  25. type="success"
  26. plain
  27. icon="el-icon-edit"
  28. size="mini"
  29. :disabled="single"
  30. @click="handleUpdate"
  31. v-hasPermi="['business:ONLINE:edit']"
  32. >修改</el-button>
  33. </el-col>
  34. <el-col :span="1.5">
  35. <el-button
  36. type="danger"
  37. plain
  38. icon="el-icon-delete"
  39. size="mini"
  40. :disabled="multiple"
  41. @click="handleDelete"
  42. v-hasPermi="['business:ONLINE:remove']"
  43. >删除</el-button>
  44. </el-col>
  45. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  46. </el-row>
  47. <el-table v-loading="loading" :data="ONLINEList" @selection-change="handleSelectionChange" height="calc(100vh - 300px)">
  48. <el-table-column type="selection" width="55" align="center" />
  49. <el-table-column label="单位编码" align="center" prop="deptId"/>
  50. <el-table-column label="单位名称" align="center" prop="depName" />
  51. <el-table-column label="位置" align="center" prop="location" />
  52. <el-table-column label="电话" align="center" prop="telphone" />
  53. <el-table-column label="邮箱" align="center" prop="email" />
  54. <!-- <el-table-column label="主键" align="center" prop="id">-->
  55. <!-- <template slot-scope="scope">-->
  56. <!-- <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.id"/>-->
  57. <!-- </template>-->
  58. <!-- </el-table-column>-->
  59. <!-- <el-table-column label="创建时间" align="center" prop="createTime">-->
  60. <!-- <template slot-scope="scope">-->
  61. <!-- <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.createTime"/>-->
  62. <!-- </template>-->
  63. <!-- </el-table-column>-->
  64. <!-- <el-table-column label="创建人" align="center" prop="createBy">-->
  65. <!-- <template slot-scope="scope">-->
  66. <!-- <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.createBy"/>-->
  67. <!-- </template>-->
  68. <!-- </el-table-column>-->
  69. <!-- <el-table-column label="修改时间" align="center" prop="updateTime">-->
  70. <!-- <template slot-scope="scope">-->
  71. <!-- <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.updateTime"/>-->
  72. <!-- </template>-->
  73. <!-- </el-table-column>-->
  74. <!-- <el-table-column label="修改人" align="center" prop="updateBy">-->
  75. <!-- <template slot-scope="scope">-->
  76. <!-- <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.updateBy"/>-->
  77. <!-- </template>-->
  78. <!-- </el-table-column>-->
  79. <!-- <el-table-column label="删除标志(0.正常,1.删除)" align="center" prop="delFlag">-->
  80. <!-- <template slot-scope="scope">-->
  81. <!-- <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.delFlag"/>-->
  82. <!-- </template>-->
  83. <!-- </el-table-column>-->
  84. <!-- <el-table-column label="部门id" align="center" prop="deptId">-->
  85. <!-- <template slot-scope="scope">-->
  86. <!-- <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.deptId"/>-->
  87. <!-- </template>-->
  88. <!-- </el-table-column>-->
  89. <!-- <el-table-column label="单位名称" align="center" prop="depName">-->
  90. <!-- <template slot-scope="scope">-->
  91. <!-- <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.depName"/>-->
  92. <!-- </template>-->
  93. <!-- </el-table-column>-->
  94. <!-- <el-table-column label="单位电话" align="center" prop="telphone">-->
  95. <!-- <template slot-scope="scope">-->
  96. <!-- <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.telphone"/>-->
  97. <!-- </template>-->
  98. <!-- </el-table-column>-->
  99. <!-- <el-table-column label="单位地址" align="center" prop="location">-->
  100. <!-- <template slot-scope="scope">-->
  101. <!-- <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.location"/>-->
  102. <!-- </template>-->
  103. <!-- </el-table-column>-->
  104. <!-- <el-table-column label="单位邮箱" align="center" prop="email">-->
  105. <!-- <template slot-scope="scope">-->
  106. <!-- <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.email"/>-->
  107. <!-- </template>-->
  108. <!-- </el-table-column>-->
  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-edit"-->
  115. <!-- @click="handleUpdate(scope.row)"-->
  116. <!-- v-hasPermi="['business:ONLINE:edit']"-->
  117. <!-- >修改</el-button>-->
  118. <!-- <el-button-->
  119. <!-- size="mini"-->
  120. <!-- type="text"-->
  121. <!-- icon="el-icon-delete"-->
  122. <!-- @click="handleDelete(scope.row)"-->
  123. <!-- v-hasPermi="['business:ONLINE:remove']"-->
  124. <!-- >删除</el-button>-->
  125. <!-- </template>-->
  126. <!-- </el-table-column>-->
  127. </el-table>
  128. <pagination
  129. v-show="total>0"
  130. :total="total"
  131. :page.sync="queryParams.pageNum"
  132. :limit.sync="queryParams.pageSize"
  133. @pagination="getList"
  134. />
  135. <!-- 添加或修改网上办事对话框 -->
  136. <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
  137. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  138. <el-row>
  139. <el-col :span="12">
  140. <el-form-item label="单位编码" prop="deptId"><el-input v-model="form.deptId" placeholder="请输入单位编码" /></el-form-item>
  141. </el-col>
  142. <el-col :span="12">
  143. <el-form-item label="单位名称" prop="depName"><el-input v-model="form.depName" placeholder="请输入单位名称" /></el-form-item>
  144. </el-col>
  145. </el-row>
  146. <el-row>
  147. <el-col :span="12">
  148. <el-form-item label="位置" prop="location"><el-input v-model="form.location" placeholder="请输入位置" /></el-form-item>
  149. </el-col>
  150. <el-col :span="12">
  151. <el-form-item label="联系电话" prop="telphone"><el-input v-model="form.telphone" placeholder="请输入联系电话" maxlength="50" /></el-form-item>
  152. </el-col>
  153. </el-row>
  154. <el-row>
  155. <el-col :span="12">
  156. <el-form-item label="邮箱" prop="email"><el-input v-model="form.email" placeholder="请输入联系邮箱" maxlength="20" /></el-form-item>
  157. </el-col>
  158. </el-row>
  159. </el-form>
  160. <div slot="footer" class="dialog-footer">
  161. <el-button type="primary" @click="submitForm">确 定</el-button>
  162. <el-button @click="cancel">取 消</el-button>
  163. </div>
  164. </el-dialog>
  165. </div>
  166. </template>
  167. <script>
  168. import { listONLINE, getONLINE, delONLINE, addONLINE, updateONLINE } from "@/api/portal/ONLINE/ONLINE";
  169. export default {
  170. name: "ONLINE",
  171. data() {
  172. return {
  173. // 根路径
  174. baseURL: process.env.VUE_APP_BASE_API,
  175. // 遮罩层
  176. loading: true,
  177. // 选中数组
  178. ids: [],
  179. // 非单个禁用
  180. single: true,
  181. // 非多个禁用
  182. multiple: true,
  183. // 显示搜索条件
  184. showSearch: true,
  185. // 总条数
  186. total: 0,
  187. // 网上办事表格数据
  188. ONLINEList: [],
  189. // 弹出层标题
  190. title: "",
  191. // 是否显示弹出层
  192. open: false,
  193. // 查询参数
  194. queryParams: {
  195. pageNum: 1,
  196. pageSize: 10,
  197. id: null,
  198. createTime: null,
  199. createBy: null,
  200. updateTime: null,
  201. updateBy: null,
  202. delFlag: null,
  203. deptId: null,
  204. depName: null,
  205. telphone: null,
  206. location: null,
  207. email: null
  208. },
  209. // 表单参数
  210. form: {},
  211. // 表单校验
  212. rules: {
  213. id: [
  214. { required: true, message: "主键不能为空", trigger: "blur" }
  215. ],
  216. delFlag: [
  217. { required: true, message: "删除标志(0.正常,1.删除)不能为空", trigger: "blur" }
  218. ],
  219. deptId: [
  220. { required: true, message: "部门id不能为空", trigger: "blur" }
  221. ],
  222. depName: [
  223. { required: true, message: "单位名称不能为空", trigger: "blur" }
  224. ],
  225. telphone: [
  226. { required: true, message: "单位电话不能为空", trigger: "blur" }
  227. ],
  228. location: [
  229. { required: true, message: "单位地址不能为空", trigger: "blur" }
  230. ],
  231. email: [
  232. { required: true, message: "单位邮箱不能为空", trigger: "blur" }
  233. ]
  234. }
  235. };
  236. },
  237. created() {
  238. this.getList();
  239. },
  240. methods: {
  241. /** 查询网上办事列表 */
  242. getList() {
  243. this.loading = true;
  244. listONLINE(this.queryParams).then(response => {
  245. this.ONLINEList = response.rows;
  246. this.total = response.total;
  247. this.loading = false;
  248. });
  249. },
  250. // 取消按钮
  251. cancel() {
  252. this.open = false;
  253. this.reset();
  254. },
  255. // 表单重置
  256. reset() {
  257. this.form = {
  258. id: null,
  259. delFlag: null,
  260. deptId: null,
  261. depName: null,
  262. telphone: null,
  263. location: null,
  264. email: null
  265. };
  266. this.resetForm("form");
  267. },
  268. /** 搜索按钮操作 */
  269. handleQuery() {
  270. this.queryParams.pageNum = 1;
  271. this.getList();
  272. },
  273. /** 重置按钮操作 */
  274. resetQuery() {
  275. this.resetForm("queryForm");
  276. this.handleQuery();
  277. },
  278. // 多选框选中数据
  279. handleSelectionChange(selection) {
  280. this.ids = selection.map(item => item.id)
  281. this.single = selection.length!==1
  282. this.multiple = !selection.length
  283. },
  284. /** 新增按钮操作 */
  285. handleAdd() {
  286. this.reset();
  287. this.open = true;
  288. this.title = "添加网上办事";
  289. },
  290. /** 修改按钮操作 */
  291. handleUpdate(row) {
  292. this.reset();
  293. const id = row.id || this.ids
  294. getONLINE(id).then(response => {
  295. this.form = response.data;
  296. this.open = true;
  297. this.title = "修改网上办事";
  298. });
  299. },
  300. /** 提交按钮 */
  301. submitForm() {
  302. this.$refs["form"].validate(valid => {
  303. if (valid) {
  304. if (this.form.id != null) {
  305. updateONLINE(this.form).then(response => {
  306. this.$modal.msgSuccess("修改成功");
  307. this.open = false;
  308. this.getList();
  309. });
  310. } else {
  311. addONLINE(this.form).then(response => {
  312. this.$modal.msgSuccess("新增成功");
  313. this.open = false;
  314. this.getList();
  315. });
  316. }
  317. }
  318. });
  319. },
  320. /** 删除按钮操作 */
  321. handleDelete(row) {
  322. const ids = row.id || this.ids;
  323. this.$modal.confirm('是否确认删除网上办事编号为"' + ids + '"的数据项?').then(function() {
  324. return delONLINE(ids);
  325. }).then(() => {
  326. this.getList();
  327. this.$modal.msgSuccess("删除成功");
  328. }).catch(() => {});
  329. },
  330. /** 导出按钮操作 */
  331. handleExport() {
  332. this.download('business/ONLINE/export', {
  333. ...this.queryParams
  334. }, `ONLINE_${new Date().getTime()}.xlsx`)
  335. }
  336. }
  337. };
  338. </script>