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

322 lines
9.7 KiB

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