index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  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. <el-col :span="1.5">
  82. <el-button
  83. type="primary"
  84. icon="el-icon-download"
  85. size="mini"
  86. @click="smartScreen"
  87. v-hasPermi="['appVersion:version:export']"
  88. >智慧大屏</el-button>
  89. </el-col>
  90. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  91. </el-row>
  92. <el-table v-loading="loading" :data="versionList" @selection-change="handleSelectionChange">
  93. <el-table-column type="selection" width="55" align="center" />
  94. <el-table-column label="主键" align="center" prop="fId" />
  95. <el-table-column label="参数" align="center" prop="fParamkey" />
  96. <el-table-column label="参数值" align="center" prop="fParamvalue" />
  97. <el-table-column label="状态" align="center" prop="fStatusName" />
  98. <!--<el-table-column label="扩展" align="center" prop="fParamlabel" />-->
  99. <el-table-column label="备注" align="center" prop="remark" />
  100. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  101. <template slot-scope="scope">
  102. <el-button
  103. size="mini"
  104. type="text"
  105. icon="el-icon-edit"
  106. @click="handleUpdate(scope.row)"
  107. v-hasPermi="['appVersion:version:edit']"
  108. >修改</el-button>
  109. <el-button
  110. size="mini"
  111. type="text"
  112. icon="el-icon-delete"
  113. @click="handleDelete(scope.row)"
  114. v-hasPermi="['appVersion:version:remove']"
  115. >删除</el-button>
  116. </template>
  117. </el-table-column>
  118. </el-table>
  119. <pagination
  120. v-show="total>0"
  121. :total="total"
  122. :page.sync="queryParams.pageNum"
  123. :limit.sync="queryParams.pageSize"
  124. @pagination="getList"
  125. />
  126. <!-- 添加或修改APP版本信息对话框 -->
  127. <el-dialog :title="title" :visible.sync="open" width="30" append-to-body :close-on-click-modal="false">
  128. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  129. <el-form-item label="参数" prop="fParamkey">
  130. <el-input v-model="form.fParamkey" placeholder="请输入参数" />
  131. </el-form-item>
  132. <el-form-item label="参数值" prop="fParamvalue">
  133. <el-input v-model="form.fParamvalue" placeholder="请输入参数" type="textarea" :rows="2" autosize style="width: 60%;"/>
  134. <!-- <el-upload-->
  135. <!-- class="upload-demo"-->
  136. <!-- :action="actionUrl"-->
  137. <!-- :headers="headers"-->
  138. <!-- multiple>-->
  139. <!-- <el-button size="small" type="primary">点击上传</el-button>-->
  140. <!-- </el-upload>-->
  141. </el-form-item>
  142. <el-form-item label="状态">
  143. <el-select v-model="form.fStatus" placeholder="请选择状态">
  144. <el-option label="正常" value="0"></el-option>
  145. <el-option label="停用" value="1"></el-option>
  146. </el-select>
  147. </el-form-item>
  148. <!--<el-form-item label="扩展" prop="fParamlabel">
  149. <el-input v-model="form.fParamlabel" placeholder="请输入扩展" />
  150. </el-form-item>-->
  151. <el-form-item label="备注" prop="remark">
  152. <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
  153. </el-form-item>
  154. </el-form>
  155. <div slot="footer" class="dialog-footer">
  156. <el-button type="primary" @click="submitForm">确 定</el-button>
  157. <el-button @click="cancel">取 消</el-button>
  158. </div>
  159. </el-dialog>
  160. </div>
  161. </template>
  162. <script>
  163. import { listVersion, getVersion, delVersion, addVersion, updateVersion, exportVersion } from "@/api/appVersion/version";
  164. import {getToken} from "@/utils/auth";
  165. import {currentLogin} from "@/api/warehouseCheck";
  166. export default {
  167. name: "Version",
  168. components: {
  169. },
  170. data() {
  171. return {
  172. headers: {
  173. Authorization: "Bearer " + getToken(),
  174. },
  175. actionUrl:
  176. process.env.VUE_APP_BASE_API +
  177. "/warehouseBusiness/inStock/importInstock", // 上传的图片服务器地址
  178. // 遮罩层
  179. loading: true,
  180. // 选中数组
  181. ids: [],
  182. // 非单个禁用
  183. single: true,
  184. // 非多个禁用
  185. multiple: true,
  186. // 显示搜索条件
  187. showSearch: true,
  188. // 总条数
  189. total: 0,
  190. // APP版本信息表格数据
  191. versionList: [],
  192. // 弹出层标题
  193. title: "",
  194. // 是否显示弹出层
  195. open: false,
  196. // 查询参数
  197. queryParams: {
  198. pageNum: 1,
  199. pageSize: 10,
  200. fParamkey: null,
  201. fParamvalue: null,
  202. fStatus: null,
  203. fParamlabel: null,
  204. },
  205. // 表单参数
  206. form: {},
  207. // 表单校验
  208. rules: {
  209. }
  210. };
  211. },
  212. created() {
  213. this.getList();
  214. },
  215. methods: {
  216. /** 查询APP版本信息列表 */
  217. getList() {
  218. this.loading = true;
  219. listVersion(this.queryParams).then(response => {
  220. this.versionList = response.rows;
  221. this.total = response.total;
  222. this.loading = false;
  223. });
  224. },
  225. // 取消按钮
  226. cancel() {
  227. this.open = false;
  228. this.reset();
  229. },
  230. // 表单重置
  231. reset() {
  232. this.form = {
  233. fId: null,
  234. fParamkey: null,
  235. fParamvalue: null,
  236. fStatus: 0,
  237. fParamlabel: null,
  238. createBy: null,
  239. createTime: null,
  240. updateBy: null,
  241. updateTime: null,
  242. remark: null
  243. };
  244. this.resetForm("form");
  245. },
  246. /** 搜索按钮操作 */
  247. handleQuery() {
  248. this.queryParams.pageNum = 1;
  249. this.getList();
  250. },
  251. /** 重置按钮操作 */
  252. resetQuery() {
  253. this.resetForm("queryForm");
  254. this.handleQuery();
  255. },
  256. // 多选框选中数据
  257. handleSelectionChange(selection) {
  258. this.ids = selection.map(item => item.fId)
  259. this.single = selection.length!==1
  260. this.multiple = !selection.length
  261. },
  262. /** 新增按钮操作 */
  263. handleAdd() {
  264. this.reset();
  265. this.open = true;
  266. this.title = "添加APP版本信息";
  267. },
  268. /** 修改按钮操作 */
  269. handleUpdate(row) {
  270. this.reset();
  271. const fId = row.fId || this.ids
  272. getVersion(fId).then(response => {
  273. this.form = response.data;
  274. this.form.fStatus = JSON.stringify(this.form.fStatus)
  275. this.open = true;
  276. this.title = "修改APP版本信息";
  277. });
  278. },
  279. /** 提交按钮 */
  280. submitForm() {
  281. this.$refs["form"].validate(valid => {
  282. if (valid) {
  283. if (this.form.fId != null) {
  284. updateVersion(this.form).then(response => {
  285. this.msgSuccess("修改成功");
  286. this.open = false;
  287. this.getList();
  288. });
  289. } else {
  290. addVersion(this.form).then(response => {
  291. this.msgSuccess("新增成功");
  292. this.open = false;
  293. this.getList();
  294. });
  295. }
  296. }
  297. });
  298. },
  299. /** 删除按钮操作 */
  300. handleDelete(row) {
  301. const fIds = row.fId || this.ids;
  302. this.$confirm('是否确认删除APP版本信息编号为"' + fIds + '"的数据项?', "警告", {
  303. confirmButtonText: "确定",
  304. cancelButtonText: "取消",
  305. type: "warning"
  306. }).then(function() {
  307. return delVersion(fIds);
  308. }).then(() => {
  309. this.getList();
  310. this.msgSuccess("删除成功");
  311. })
  312. },
  313. /** 导出按钮操作 */
  314. handleExport() {
  315. const queryParams = this.queryParams;
  316. this.$confirm('是否确认导出所有APP版本信息数据项?', "警告", {
  317. confirmButtonText: "确定",
  318. cancelButtonText: "取消",
  319. type: "warning"
  320. }).then(function() {
  321. return exportVersion(queryParams);
  322. }).then(response => {
  323. this.download(response.msg);
  324. })
  325. },
  326. smartScreen(){
  327. // window.open( process.env.VUE_APP_BASE_API.length - 10 + '/view.html?Authorization=' + getToken())
  328. currentLogin().then(res=>{
  329. if (res.data.userName === 'admin'){
  330. window.open( 'https://op.zdgjqd.com/view.html?Authorization=' + getToken())
  331. }else {
  332. this.$message.warning('您无此权限查看面板');
  333. }
  334. })
  335. },
  336. }
  337. };
  338. </script>