index.vue 10 KB

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