|
@@ -0,0 +1,292 @@
|
|
|
+<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="赛期" prop="mc">
|
|
|
+ <el-input
|
|
|
+ v-model="queryParams.mc"
|
|
|
+ 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="['system:hljndsSqwh: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="['system:hljndsSqwh:export']"-->
|
|
|
+<!-- >导出</el-button>-->
|
|
|
+<!-- </el-col>-->
|
|
|
+ <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <el-table v-loading="loading" :data="hljndsSqwhList" >
|
|
|
+ <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="赛期" align="center" prop="mc" />
|
|
|
+ <el-table-column label="状态" align="center" prop="status" >
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-switch
|
|
|
+ v-model="scope.row.status"
|
|
|
+ active-value="0"
|
|
|
+ inactive-value="99"
|
|
|
+ @change="handleStatusChange(scope.row)"
|
|
|
+ ></el-switch>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <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="['system:hljndsSqwh:edit']"
|
|
|
+ >修改</el-button>
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ icon="el-icon-delete"
|
|
|
+ @click="handleDelete(scope.row,scope.$index)"
|
|
|
+ v-hasPermi="['system:hljndsSqwh: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"
|
|
|
+ />
|
|
|
+
|
|
|
+ <!-- 添加或修改护理技能大赛_赛期维护对话框 -->
|
|
|
+ <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="赛期" prop="mc">
|
|
|
+ <el-input v-model="form.mc" 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 {addHljndsSqwh, delHljndsSqwh, getHljndsSqwh, listHljndsSqwh, updateHljndsSqwh} from "@/api/system/hljndsSqwh";
|
|
|
+ import {chineseOne, idCard, Regular} from '@/utils/regular'
|
|
|
+ import {changeStatus} from "@/api/system/hljndsSqwh";
|
|
|
+
|
|
|
+ export default {
|
|
|
+ name: "HljndsSqwh",
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ // 遮罩层
|
|
|
+ loading: true,
|
|
|
+ submitFormLoading: false,
|
|
|
+ // 选中数组
|
|
|
+ ids: [],
|
|
|
+ // 非单个禁用
|
|
|
+ single: true,
|
|
|
+ // 非多个禁用
|
|
|
+ multiple: true,
|
|
|
+ // 显示搜索条件
|
|
|
+ showSearch: true,
|
|
|
+ // 总条数
|
|
|
+ total: 0,
|
|
|
+ // 护理技能大赛_赛期维护表格数据
|
|
|
+ hljndsSqwhList: [],
|
|
|
+ // 弹出层标题
|
|
|
+ title: "",
|
|
|
+ // 是否显示弹出层
|
|
|
+ open: false,
|
|
|
+ // 查询参数
|
|
|
+ queryParams: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ },
|
|
|
+ // 表单参数
|
|
|
+ form: {},
|
|
|
+ // 表单校验
|
|
|
+ rules: {
|
|
|
+ mc: [
|
|
|
+ { required: true, message: "赛期不能为空", trigger: "blur" },
|
|
|
+ { max: 100, message: '赛期不能超过100个字符', trigger: 'blur'},
|
|
|
+ ],
|
|
|
+ createAreaCode: [
|
|
|
+ { max: 12, message: '创建人行政区划编码不能超过12个字符', trigger: 'blur'},
|
|
|
+ ],
|
|
|
+ }
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ /** 查询护理技能大赛_赛期维护列表 */
|
|
|
+ getList() {
|
|
|
+ this.loading = true;
|
|
|
+ listHljndsSqwh(this.queryParams).then(response => {
|
|
|
+ this.hljndsSqwhList = response.rows;
|
|
|
+ this.total = response.total;
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 取消按钮
|
|
|
+ cancel() {
|
|
|
+ this.open = false;
|
|
|
+ this.reset();
|
|
|
+ },
|
|
|
+ // 表单重置
|
|
|
+ reset() {
|
|
|
+ this.submitFormLoading =false;
|
|
|
+ this.form = {
|
|
|
+ id: null,
|
|
|
+ mc: null,
|
|
|
+ status: "0",
|
|
|
+ createAreaCode: 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 = "添加护理技能大赛_赛期维护";
|
|
|
+ },
|
|
|
+ /** 修改按钮操作 */
|
|
|
+ handleUpdate(row) {
|
|
|
+ this.reset();
|
|
|
+ const id = row.id || this.ids
|
|
|
+ getHljndsSqwh(id).then(response => {
|
|
|
+ this.form = response.data;
|
|
|
+ /****** sks 需要改动的地方 start ******/
|
|
|
+ this.copyForm=this.deepCopy(response.data)
|
|
|
+ /****** sks 需要改动的地方 end ******/
|
|
|
+ this.open = true;
|
|
|
+ this.title = "修改护理技能大赛_赛期维护";
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 提交按钮 */
|
|
|
+ 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) {
|
|
|
+ updateHljndsSqwh({...formData,id:this.form.id}).then(response => {
|
|
|
+ this.$modal.msgSuccess("修改成功");
|
|
|
+ this.open = false;
|
|
|
+ this.hljndsSqwhList=this.dataReplacement(this.hljndsSqwhList,this.form.id,formData);
|
|
|
+ // this.getList();
|
|
|
+ }).finally(()=>this.submitFormLoading =false);
|
|
|
+ }else{
|
|
|
+ this.$modal.msgSuccess("修改成功");
|
|
|
+ this.open = false;
|
|
|
+ this.submitFormLoading = false;
|
|
|
+ }
|
|
|
+ /****** sks 需要改动的地方 end ******/
|
|
|
+ } else {
|
|
|
+ addHljndsSqwh(this.form).then(response => {
|
|
|
+ this.$modal.msgSuccess("新增成功");
|
|
|
+ this.open = false;
|
|
|
+ // this.getList();
|
|
|
+ /****** sks 需要改动的地方 start ******/
|
|
|
+ if (this.queryParams.pageSize===this.hljndsSqwhList.length)
|
|
|
+ {
|
|
|
+ this.hljndsSqwhList.pop();
|
|
|
+ }
|
|
|
+ this.hljndsSqwhList.unshift({...this.form,id:response.data});
|
|
|
+ this.total++;
|
|
|
+ /****** sks 需要改动的地方 end ******/
|
|
|
+ }).finally(()=>this.submitFormLoading =false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleStatusChange(row) {
|
|
|
+ let text = row.status === "0" ? "启用" : "停用";
|
|
|
+ this.$modal.confirm('确认要"' + text + '""' + row.mc + '"赛期吗?').then(function() {
|
|
|
+ return changeStatus(row.id, row.status);
|
|
|
+ }).then(() => {
|
|
|
+ this.$modal.msgSuccess(text + "成功");
|
|
|
+ }).catch(function() {
|
|
|
+ row.status = row.status === "0" ? "99" : "0";
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 删除按钮操作 */
|
|
|
+ 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 delHljndsSqwh(ids);
|
|
|
+ }).then(() => {
|
|
|
+ // this.getList();
|
|
|
+ /****** sks 需要改动的地方 ind参数需要传进来 start ******/
|
|
|
+ this.hljndsSqwhList.splice(index,1);
|
|
|
+ if(this.hljndsSqwhList.length===0)
|
|
|
+ {
|
|
|
+ this.getList();
|
|
|
+ }else {
|
|
|
+ this.total--;
|
|
|
+ }
|
|
|
+ this.$modal.msgSuccess("删除成功");
|
|
|
+ /****** sks 需要改动的地方 end ******/
|
|
|
+ }).catch(() => {});
|
|
|
+ },
|
|
|
+ /** 导出按钮操作 */
|
|
|
+ handleExport() {
|
|
|
+ this.download('system/hljndsSqwh/export', {
|
|
|
+ ...this.queryParams
|
|
|
+ }, `hljndsSqwh_${new Date().getTime()}.xlsx`)
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|