猫妈狗爸伴宠师小程序后端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

290 lines
8.3 KiB

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