猫妈狗爸伴宠师小程序后端代码
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.

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