|
@@ -0,0 +1,312 @@
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+ <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
|
|
+ <el-form-item label="appid" prop="appid">
|
|
|
+ <el-input
|
|
|
+ v-model="queryParams.appid"
|
|
|
+ placeholder="请输入appid"
|
|
|
+ clearable
|
|
|
+ @keyup.enter.native="handleQuery"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="版本号" prop="version">
|
|
|
+ <el-input
|
|
|
+ v-model="queryParams.version"
|
|
|
+ placeholder="请输入版本号"
|
|
|
+ clearable
|
|
|
+ @keyup.enter.native="handleQuery"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
|
+ <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+
|
|
|
+ <el-row :gutter="10" class="mb8">
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ plain
|
|
|
+ icon="el-icon-plus"
|
|
|
+ size="mini"
|
|
|
+ @click="handleAdd"
|
|
|
+ v-hasPermi="['lnst:bbh:add']"
|
|
|
+ >新增</el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="warning"
|
|
|
+ plain
|
|
|
+ icon="el-icon-download"
|
|
|
+ size="mini"
|
|
|
+ @click="handleExport"
|
|
|
+ v-hasPermi="['lnst:bbh:export']"
|
|
|
+ >导出</el-button>
|
|
|
+ </el-col>
|
|
|
+ <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <el-table v-loading="loading" :data="bbhList" >
|
|
|
+ <el-table-column label="序号" align="center">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{(queryParams.pageNum-1)*queryParams.pageSize + scope.$index + 1}}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="appid" align="center" prop="appid" />
|
|
|
+ <el-table-column label="版本号" align="center" prop="version" />
|
|
|
+ <el-table-column label="下载路径" align="center" prop="url" />
|
|
|
+ <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ icon="el-icon-edit"
|
|
|
+ @click="handleUpdate(scope.row)"
|
|
|
+ v-hasPermi="['lnst:bbh:edit']"
|
|
|
+ >修改</el-button>
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ icon="el-icon-delete"
|
|
|
+ @click="handleDelete(scope.row,scope.$index)"
|
|
|
+ v-hasPermi="['lnst:bbh:remove']"
|
|
|
+ >删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <pagination
|
|
|
+ v-show="total>0"
|
|
|
+ :total="total"
|
|
|
+ :page.sync="queryParams.pageNum"
|
|
|
+ :limit.sync="queryParams.pageSize"
|
|
|
+ @pagination="getList"
|
|
|
+ />
|
|
|
+
|
|
|
+ <!-- 添加或修改老年食堂app版本号信息对话框 -->
|
|
|
+ <el-dialog v-dialog-drag :title="title" :visible.sync="open" width="500px" append-to-body>
|
|
|
+ <el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
|
+
|
|
|
+ <el-form-item label="appid" prop="appid">
|
|
|
+ <el-input v-model="form.appid" placeholder="请输入appid" />
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="版本号" prop="version">
|
|
|
+ <el-input v-model="form.version" placeholder="请输入版本号" />
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="升级备注" prop="remark">
|
|
|
+ <el-input v-model="form.remark" type="textarea" maxlength="720" show-word-limit placeholder="请输入升级备注" />
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="下载路径" prop="url">
|
|
|
+ <el-input v-model="form.url" type="textarea" maxlength="720" show-word-limit placeholder="请输入下载路径" />
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button type="primary" @click="submitForm" :loading="submitFormLoading">确 定</el-button>
|
|
|
+ <el-button @click="cancel">取 消</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ import {addBbh, delBbh, getBbh, listBbh, updateBbh} from "@/api/lnst/bbh";
|
|
|
+ import {chineseOne, idCard, Regular} from '@/utils/regular'
|
|
|
+
|
|
|
+ export default {
|
|
|
+ name: "Bbh",
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ // 遮罩层
|
|
|
+ loading: true,
|
|
|
+ submitFormLoading: false,
|
|
|
+ // 选中数组
|
|
|
+ ids: [],
|
|
|
+ // 非单个禁用
|
|
|
+ single: true,
|
|
|
+ // 非多个禁用
|
|
|
+ multiple: true,
|
|
|
+ // 显示搜索条件
|
|
|
+ showSearch: true,
|
|
|
+ // 总条数
|
|
|
+ total: 0,
|
|
|
+ // 老年食堂app版本号信息表格数据
|
|
|
+ bbhList: [],
|
|
|
+ // 弹出层标题
|
|
|
+ title: "",
|
|
|
+ // 是否显示弹出层
|
|
|
+ open: false,
|
|
|
+ // 查询参数
|
|
|
+ queryParams: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ },
|
|
|
+ // 表单参数
|
|
|
+ form: {},
|
|
|
+ // 表单校验
|
|
|
+ rules: {
|
|
|
+ appid: [
|
|
|
+ { required: true, message: "appid不能为空", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ version: [
|
|
|
+ { required: true, message: "版本号不能为空", trigger: "blur" },
|
|
|
+ { max: 72, message: '版本号不能超过72个字符', trigger: 'blur'},
|
|
|
+ ],
|
|
|
+ remark: [
|
|
|
+ { required: true, message: "升级备注不能为空", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ url: [
|
|
|
+ { required: true, message: "下载路径不能为空", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ createBmjsc: [
|
|
|
+ { max: 60, message: '部门检索串不能超过60个字符', trigger: 'blur'},
|
|
|
+ ],
|
|
|
+ createQhjsc: [
|
|
|
+ { max: 80, message: '区划检索串不能超过80个字符', trigger: 'blur'},
|
|
|
+ ],
|
|
|
+ state: [
|
|
|
+ { required: true, message: "数据状态不能为空", trigger: "blur" },
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ /** 查询老年食堂app版本号信息列表 */
|
|
|
+ getList() {
|
|
|
+ this.loading = true;
|
|
|
+ listBbh(this.queryParams).then(response => {
|
|
|
+ this.bbhList = response.rows;
|
|
|
+ this.total = response.total;
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 取消按钮
|
|
|
+ cancel() {
|
|
|
+ this.open = false;
|
|
|
+ this.reset();
|
|
|
+ },
|
|
|
+ // 表单重置
|
|
|
+ reset() {
|
|
|
+ this.submitFormLoading =false;
|
|
|
+ this.form = {
|
|
|
+ id: null,
|
|
|
+ appid: null,
|
|
|
+ version: null,
|
|
|
+ remark: null,
|
|
|
+ url: null,
|
|
|
+ createBmjsc: null,
|
|
|
+ createQhjsc: null,
|
|
|
+ state: null
|
|
|
+ };
|
|
|
+ this.resetForm("form");
|
|
|
+ },
|
|
|
+ /** 搜索按钮操作 */
|
|
|
+ handleQuery() {
|
|
|
+ this.queryParams.pageNum = 1;
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ /** 重置按钮操作 */
|
|
|
+ resetQuery() {
|
|
|
+ this.resetForm("queryForm");
|
|
|
+ this.handleQuery();
|
|
|
+ },
|
|
|
+ // 多选框选中数据
|
|
|
+ handleSelectionChange(selection) {
|
|
|
+ this.ids = selection.map(item => item.id)
|
|
|
+ this.single = selection.length!==1
|
|
|
+ this.multiple = !selection.length
|
|
|
+ },
|
|
|
+ /** 新增按钮操作 */
|
|
|
+ handleAdd() {
|
|
|
+ this.reset();
|
|
|
+ this.open = true;
|
|
|
+ this.title = "添加老年食堂app版本号信息";
|
|
|
+ },
|
|
|
+ /** 修改按钮操作 */
|
|
|
+ handleUpdate(row) {
|
|
|
+ this.reset();
|
|
|
+ const id = row.id || this.ids
|
|
|
+ getBbh(id).then(response => {
|
|
|
+ this.form = response.data;
|
|
|
+ /****** sks 需要改动的地方 start ******/
|
|
|
+ this.copyForm=this.deepCopy(response.data)
|
|
|
+ /****** sks 需要改动的地方 end ******/
|
|
|
+ this.open = true;
|
|
|
+ this.title = "修改老年食堂app版本号信息";
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 提交按钮 */
|
|
|
+ submitForm() {
|
|
|
+ this.$refs["form"].validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ this.submitFormLoading = true;
|
|
|
+ if (this.form.id != null) {
|
|
|
+ /****** sks 需要改动的地方 start ******/
|
|
|
+ let formData=this.comparisonObject(this.form,this.copyForm);
|
|
|
+ if(formData) {
|
|
|
+ updateBbh({...formData,id:this.form.id}).then(response => {
|
|
|
+ this.$modal.msgSuccess("修改成功");
|
|
|
+ this.open = false;
|
|
|
+ this.bbhList=this.dataReplacement(this.bbhList,this.form.id,formData);
|
|
|
+ // this.getList();
|
|
|
+ }).finally(()=>this.submitFormLoading =false);
|
|
|
+ }else{
|
|
|
+ this.$modal.msgSuccess("修改成功");
|
|
|
+ this.open = false;
|
|
|
+ this.submitFormLoading = false;
|
|
|
+ }
|
|
|
+ /****** sks 需要改动的地方 end ******/
|
|
|
+ } else {
|
|
|
+ addBbh(this.form).then(response => {
|
|
|
+ this.$modal.msgSuccess("新增成功");
|
|
|
+ this.open = false;
|
|
|
+ // this.getList();
|
|
|
+ /****** sks 需要改动的地方 start ******/
|
|
|
+ if (this.queryParams.pageSize===this.bbhList.length)
|
|
|
+ {
|
|
|
+ this.bbhList.pop();
|
|
|
+ }
|
|
|
+ this.bbhList.unshift({...this.form,id:response.data});
|
|
|
+ this.total++;
|
|
|
+ /****** sks 需要改动的地方 end ******/
|
|
|
+ }).finally(()=>this.submitFormLoading =false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 删除按钮操作 */
|
|
|
+ handleDelete(row,index) {
|
|
|
+ const ids = row.id || this.ids;
|
|
|
+ const xh = (this.queryParams.pageNum-1)*this.queryParams.pageSize + index + 1;
|
|
|
+ this.$modal.confirm('确认删除' + this.changeDelData(row,'id','ID值',xh) + '的记录?').then(function() {
|
|
|
+ return delBbh(ids);
|
|
|
+ }).then(() => {
|
|
|
+ // this.getList();
|
|
|
+ /****** sks 需要改动的地方 ind参数需要传进来 start ******/
|
|
|
+ this.bbhList.splice(index,1);
|
|
|
+ if(this.bbhList.length===0)
|
|
|
+ {
|
|
|
+ this.getList();
|
|
|
+ }else {
|
|
|
+ this.total--;
|
|
|
+ }
|
|
|
+ this.$modal.msgSuccess("删除成功");
|
|
|
+ /****** sks 需要改动的地方 end ******/
|
|
|
+ }).catch(() => {});
|
|
|
+ },
|
|
|
+ /** 导出按钮操作 */
|
|
|
+ handleExport() {
|
|
|
+ this.download('lnst/bbh/export', {
|
|
|
+ ...this.queryParams
|
|
|
+ }, `bbh_${new Date().getTime()}.xlsx`)
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|