|
@@ -0,0 +1,323 @@
|
|
|
+<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="yjCode">
|
|
|
+ <el-input
|
|
|
+ v-model="queryParams.yjCode"
|
|
|
+ placeholder="请输入硬件编码"
|
|
|
+ clearable
|
|
|
+ @keyup.enter.native="handleQuery"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="门店码" prop="mchnt">
|
|
|
+ <el-input
|
|
|
+ v-model="queryParams.mchnt"
|
|
|
+ placeholder="请输入门店码"
|
|
|
+ clearable
|
|
|
+ @keyup.enter.native="handleQuery"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="数据状态" prop="state">
|
|
|
+ <el-select v-model="queryParams.state" placeholder="请选择数据状态" clearable>
|
|
|
+ <el-option
|
|
|
+ v-for="dict in dict.type.sys_yes_no"
|
|
|
+ :key="dict.value"
|
|
|
+ :label="dict.label"
|
|
|
+ :value="dict.value"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </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:yj: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:yj:export']"
|
|
|
+ >导出</el-button>
|
|
|
+ </el-col>
|
|
|
+ <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <el-table v-loading="loading" :data="yjList" >
|
|
|
+ <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="yjCode" />
|
|
|
+ <el-table-column label="门店码" align="center" prop="mchnt" />
|
|
|
+ <el-table-column label="数据状态" align="center" prop="state">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.state"/>
|
|
|
+ </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="['lnst:yj:edit']"
|
|
|
+ >修改</el-button>
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ icon="el-icon-delete"
|
|
|
+ @click="handleDelete(scope.row,scope.$index)"
|
|
|
+ v-hasPermi="['lnst:yj: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="yjCode">
|
|
|
+ <el-input v-model="form.yjCode" placeholder="请输入硬件编码" />
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="门店码" prop="mchnt">
|
|
|
+ <el-input v-model="form.mchnt" placeholder="请输入门店码" />
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="数据状态" prop="state">
|
|
|
+ <el-radio-group v-model="form.state">
|
|
|
+ <el-radio
|
|
|
+ v-for="dict in dict.type.sys_yes_no"
|
|
|
+ :key="dict.value"
|
|
|
+:label="parseInt(dict.value)"
|
|
|
+ >{{dict.label}}</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </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 {addYj, delYj, getYj, listYj, updateYj} from "@/api/lnst/yj.js";
|
|
|
+ import {chineseOne, idCard, Regular} from '@/utils/regular'
|
|
|
+
|
|
|
+ export default {
|
|
|
+ name: "Yj",
|
|
|
+ dicts: ['sys_yes_no'],
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ // 遮罩层
|
|
|
+ loading: true,
|
|
|
+ submitFormLoading: false,
|
|
|
+ // 选中数组
|
|
|
+ ids: [],
|
|
|
+ // 非单个禁用
|
|
|
+ single: true,
|
|
|
+ // 非多个禁用
|
|
|
+ multiple: true,
|
|
|
+ // 显示搜索条件
|
|
|
+ showSearch: true,
|
|
|
+ // 总条数
|
|
|
+ total: 0,
|
|
|
+ // 老年食堂硬件信息表格数据
|
|
|
+ yjList: [],
|
|
|
+ // 弹出层标题
|
|
|
+ title: "",
|
|
|
+ // 是否显示弹出层
|
|
|
+ open: false,
|
|
|
+ // 查询参数
|
|
|
+ queryParams: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ },
|
|
|
+ // 表单参数
|
|
|
+ form: {},
|
|
|
+ // 表单校验
|
|
|
+ rules: {
|
|
|
+ yjCode: [
|
|
|
+ { max: 72, message: '硬件编码不能超过72个字符', trigger: 'blur'},
|
|
|
+ ],
|
|
|
+ mchnt: [
|
|
|
+ { max: 32, message: '门店码不能超过32个字符', trigger: 'blur'},
|
|
|
+ ],
|
|
|
+ createBmjsc: [
|
|
|
+ { max: 60, message: '部门检索串不能超过60个字符', trigger: 'blur'},
|
|
|
+ ],
|
|
|
+ createQhjsc: [
|
|
|
+ { max: 80, message: '区划检索串不能超过80个字符', trigger: 'blur'},
|
|
|
+ ],
|
|
|
+ createAreaCode: [
|
|
|
+ { max: 12, message: '创建人行政区划编码不能超过12个字符', trigger: 'blur'},
|
|
|
+ ],
|
|
|
+ state: [
|
|
|
+ { required: true, message: "数据状态不能为空", trigger: "blur" },
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ /** 查询老年食堂硬件信息列表 */
|
|
|
+ getList() {
|
|
|
+ this.loading = true;
|
|
|
+ listYj(this.queryParams).then(response => {
|
|
|
+ this.yjList = response.rows;
|
|
|
+ this.total = response.total;
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 取消按钮
|
|
|
+ cancel() {
|
|
|
+ this.open = false;
|
|
|
+ this.reset();
|
|
|
+ },
|
|
|
+ // 表单重置
|
|
|
+ reset() {
|
|
|
+ this.submitFormLoading =false;
|
|
|
+ this.form = {
|
|
|
+ id: null,
|
|
|
+ yjCode: null,
|
|
|
+ mchnt: null,
|
|
|
+ createBmjsc: null,
|
|
|
+ createQhjsc: null,
|
|
|
+ createAreaCode: null,
|
|
|
+ state: 0
|
|
|
+ };
|
|
|
+ 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
|
|
|
+ getYj(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) {
|
|
|
+ updateYj({...formData,id:this.form.id}).then(response => {
|
|
|
+ this.$modal.msgSuccess("修改成功");
|
|
|
+ this.open = false;
|
|
|
+ this.yjList=this.dataReplacement(this.yjList,this.form.id,formData);
|
|
|
+ // this.getList();
|
|
|
+ }).finally(()=>this.submitFormLoading =false);
|
|
|
+ }else{
|
|
|
+ this.$modal.msgSuccess("修改成功");
|
|
|
+ this.open = false;
|
|
|
+ this.submitFormLoading = false;
|
|
|
+ }
|
|
|
+ /****** sks 需要改动的地方 end ******/
|
|
|
+ } else {
|
|
|
+ addYj(this.form).then(response => {
|
|
|
+ this.$modal.msgSuccess("新增成功");
|
|
|
+ this.open = false;
|
|
|
+ // this.getList();
|
|
|
+ /****** sks 需要改动的地方 start ******/
|
|
|
+ if (this.queryParams.pageSize===this.yjList.length)
|
|
|
+ {
|
|
|
+ this.yjList.pop();
|
|
|
+ }
|
|
|
+ this.yjList.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 delYj(ids);
|
|
|
+ }).then(() => {
|
|
|
+ // this.getList();
|
|
|
+ /****** sks 需要改动的地方 ind参数需要传进来 start ******/
|
|
|
+ this.yjList.splice(index,1);
|
|
|
+ if(this.yjList.length===0)
|
|
|
+ {
|
|
|
+ this.getList();
|
|
|
+ }else {
|
|
|
+ this.total--;
|
|
|
+ }
|
|
|
+ this.$modal.msgSuccess("删除成功");
|
|
|
+ /****** sks 需要改动的地方 end ******/
|
|
|
+ }).catch(() => {});
|
|
|
+ },
|
|
|
+ /** 导出按钮操作 */
|
|
|
+ handleExport() {
|
|
|
+ this.download('lnst/yj/export', {
|
|
|
+ ...this.queryParams
|
|
|
+ }, `yj_${new Date().getTime()}.xlsx`)
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|