su
su1124
2024-01-24 51123d5ad145745f855280783c01cc2906b693d0
src/views/record/record/index.vue
@@ -1,33 +1,83 @@
<template>
    <div class="app-container">
        <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="75px">
    <el-form
      :model="queryParams"
      ref="queryForm"
      size="small"
      :inline="true"
      v-show="showSearch"
      label-width="75px"
    >
            <el-form-item label="体检号" prop="tjNum">
                <el-input v-model="queryParams.tjNum" placeholder="请输入领餐人体检号" clearable @keyup.enter.native="handleQuery" style="width: 200px;" ref="inputName" @blur="handleQuery" />
        <el-input
          v-model="queryParams.tjNum"
          placeholder="请输入领餐人体检号"
          clearable
          @keyup.enter.native="handleQuery"
          style="width: 200px"
          ref="inputName"
          @blur="hb"
        />
            </el-form-item>
            <el-form-item label="姓名" prop="tjPeopleName">
                <el-input v-model="queryParams.tjPeopleName" placeholder="请输入领餐人姓名" clearable style="width: 200px;"
                    @keyup.enter.native="handleQuery" />
        <el-input
          v-model="queryParams.tjPeopleName"
          placeholder="请输入领餐人姓名"
          clearable
          style="width: 200px"
          @keyup.enter.native="handleQuery"
        />
            </el-form-item>
            <el-form-item label="登记时间" prop="cateringId">
                <el-input v-model="queryParams.cateringId" placeholder="请输入登记时间" clearable style="width: 200px;"
                    @keyup.enter.native="handleQuery" />
        <el-input
          v-model="queryParams.cateringId"
          placeholder="请输入登记时间"
          clearable
          style="width: 200px"
          @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><br>
        <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
    ><br />
        <el-form :label-position="labelPosition"  :inline="true" label-width="75px" :model="formLabelAlign"
            class="demo-form-inline">
    <el-form
      :label-position="labelPosition"
      :inline="true"
      label-width="75px"
      :model="formLabelAlign"
      class="demo-form-inline"
    >
            <el-form-item label="配餐名称" >
                <el-input v-model="formLabelAlign.name" style="width: 200px;" placeholder="请输入配餐名称"></el-input>
        <el-input
          v-model="formLabelAlign.name"
          style="width: 200px"
          placeholder="请输入配餐名称"
        ></el-input>
            </el-form-item>
            <el-form-item label="套餐明细">
                <el-input v-model="formLabelAlign.region" style="width: 200px;" placeholder="请输入套餐明细"></el-input>
        <el-input
          v-model="formLabelAlign.region"
          style="width: 200px"
          placeholder="请输入套餐明细"
        ></el-input>
            </el-form-item>
            <el-form-item label="营养说明" >
                <el-input v-model="formLabelAlign.type" style="width: 200px;" placeholder="请输入营养说明"></el-input>
        <el-input
          v-model="formLabelAlign.type"
          style="width: 200px"
          placeholder="请输入营养说明"
        ></el-input>
            </el-form-item>
        </el-form>
@@ -43,48 +93,137 @@
                    </el-button>
                </el-col> -->
            <el-col :span="1.5">
                <el-button type="primary" icon="el-icon-plus" size="mini" :disabled="multiple" @click="handleDelete"
                    v-hasPermi="['record:record:remove']">领餐
        <el-button
          type="primary"
          icon="el-icon-plus"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['record:record:remove']"
          >领餐
                </el-button>
            </el-col>
            <el-col :span="1.5">
                <el-button type="primary" icon="el-icon-download" size="mini" @click="handleExport"
                    v-hasPermi="['record:record:export']">导出
        <el-button
          type="primary"
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['record:record:export']"
          >导出
                </el-button>
            </el-col>
            <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
      <right-toolbar
        :showSearch.sync="showSearch"
        @queryTable="getList"
      ></right-toolbar>
        </el-row>
        <el-table v-loading="loading" :data="recordList" @selection-change="handleSelectionChange" border>
    <el-table
      v-loading="loading"
      :data="recordList"
      @selection-change="handleSelectionChange"
      border
    >
            <el-table-column type="selection" width="55" align="center" />
            <!-- <el-table-column label="${comment}" align="center" prop="id"/> -->
            <el-table-column label="序号" align="center" prop="newID" width="55px" />
            <el-table-column label="领餐人体检号" align="center" prop="tjNum" :show-overflow-tooltip="true" />
            <el-table-column label="领餐人姓名" align="center" prop="tjPeopleName" :show-overflow-tooltip="true" />
            <el-table-column label="性别" align="center" prop="cateringId" :show-overflow-tooltip="true" />
            <el-table-column label="年龄" align="center" prop="cateringId" :show-overflow-tooltip="true" />
            <el-table-column label="电话" align="center" prop="cateringId" :show-overflow-tooltip="true" />
            <el-table-column label="团体/个人" align="center" prop="cateringId" :show-overflow-tooltip="true" />
            <el-table-column label="所选套餐" align="center" prop="cateringId" :show-overflow-tooltip="true" />
            <el-table-column label="登记时间" align="center" prop="cateringId" :show-overflow-tooltip="true" />
            <el-table-column label="配餐名称" align="center" prop="cateringId" :show-overflow-tooltip="true" />
            <el-table-column label="报告时间" align="center" prop="cateringId" :show-overflow-tooltip="true" />
            <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="80px">
      <el-table-column
        label="领餐人体检号"
        align="center"
        prop="tjNum"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="领餐人姓名"
        align="center"
        prop="tjPeopleName"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="性别"
        align="center"
        prop="cateringId"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="年龄"
        align="center"
        prop="cateringId"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="电话"
        align="center"
        prop="cateringId"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="团体/个人"
        align="center"
        prop="cateringId"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="所选套餐"
        align="center"
        prop="cateringId"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="登记时间"
        align="center"
        prop="cateringId"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="配餐名称"
        align="center"
        prop="cateringId"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="报告时间"
        align="center"
        prop="cateringId"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="操作"
        align="center"
        class-name="small-padding fixed-width"
        width="80px"
      >
                <template slot-scope="scope">
                    <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
                        v-hasPermi="['record:record:edit']" title="修改">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['record:record:edit']"
            title="修改"
          >
                    </el-button>
                    <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
                        v-hasPermi="['record:record:remove']" title="删除">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['record:record:remove']"
            title="删除"
          >
                    </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" />
    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
        <!-- 添加或修改领餐记录对话框 -->
        <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
@@ -93,7 +232,10 @@
                    <el-input v-model="form.tjNum" placeholder="请输入领餐人体检号" />
                </el-form-item>
                <el-form-item label="领餐人姓名" prop="tjPeopleName">
                    <el-input v-model="form.tjPeopleName" placeholder="请输入领餐人姓名" />
          <el-input
            v-model="form.tjPeopleName"
            placeholder="请输入领餐人姓名"
          />
                </el-form-item>
                <el-form-item label="${comment}" prop="cateringId">
                    <el-input v-model="form.cateringId" placeholder="请输入${comment}" />
@@ -113,7 +255,7 @@
    getRecord,
    delRecord,
    addRecord,
    updateRecord
  updateRecord,
} from "@/api/record/record";
export default {
@@ -121,9 +263,9 @@
    data() {
        return {
            formLabelAlign: {
          name: '',
          region: '',
          type: ''
        name: "",
        region: "",
        type: "",
        },
        labelPosition: "right",
            // 遮罩层
@@ -150,13 +292,15 @@
                pageSize: 10,
                tjNum: null,
                tjPeopleName: null,
                cateringId: new Date(new Date().getTime() + 8 * 3600 * 1000).toJSON().substr(0, 19).replace('T', ' '),
        cateringId: new Date(new Date().getTime() + 8 * 3600 * 1000)
          .toJSON()
          .substr(0, 19)
          .replace("T", " "),
            }, 
            // 表单参数
            form: {},
            // 表单校验
            rules: {
            }
      rules: {},
        };
    },
    created() {
@@ -171,10 +315,13 @@
        /** 查询领餐记录列表 */
        getList() {
            this.loading = true;
            listRecord(this.queryParams).then(response => {
      listRecord(this.queryParams).then((response) => {
                this.recordList = response.rows;
                response.rows.forEach((item,index) => {
          item.newID=(this.queryParams.pageNum-1)*this.queryParams.pageSize+index+1
          item.newID =
            (this.queryParams.pageNum - 1) * this.queryParams.pageSize +
            index +
            1;
        });
                this.total = response.total;
                this.loading = false;
@@ -196,9 +343,14 @@
                createTime: null,
                updateBy: null,
                updateTime: null,
                deleted: null
        deleted: null,
            };
            this.resetForm("form");
    },
    hb() {
      if (this.queryParams.tjNum != null) {
        this.handleQuery();
      }
        },
        /** 搜索按钮操作 */
        handleQuery() {
@@ -212,9 +364,9 @@
        },
        // 多选框选中数据
        handleSelectionChange(selection) {
            this.ids = selection.map(item => item.id)
            this.single = selection.length !== 1
            this.multiple = !selection.length
      this.ids = selection.map((item) => item.id);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
        },
        /** 新增按钮操作 */
        handleAdd() {
@@ -225,8 +377,8 @@
        /** 修改按钮操作 */
        handleUpdate(row) {
            this.reset();
            const id = row.id || this.ids
            getRecord(id).then(response => {
      const id = row.id || this.ids;
      getRecord(id).then((response) => {
                this.form = response.data;
                this.open = true;
                this.title = "修改领餐记录";
@@ -234,16 +386,16 @@
        },
        /** 提交按钮 */
        submitForm() {
            this.$refs["form"].validate(valid => {
      this.$refs["form"].validate((valid) => {
                if (valid) {
                    if (this.form.reId != null) {
                        updateRecord(this.form).then(response => {
            updateRecord(this.form).then((response) => {
                            this.$modal.msgSuccess("修改成功");
                            this.open = false;
                            this.getList();
                        });
                    } else {
                        addRecord(this.form).then(response => {
            addRecord(this.form).then((response) => {
                            this.$modal.msgSuccess("新增成功");
                            this.open = false;
                            this.getList();
@@ -255,25 +407,31 @@
        /** 删除按钮操作 */
        handleDelete(row) {
            const reIds = row.reId || this.ids;
            this.$modal.confirm('是否确认删除编号为"' + reIds + '"的数据项?').then(function () {
      this.$modal
        .confirm('是否确认删除编号为"' + reIds + '"的数据项?')
        .then(function () {
                return delRecord(reIds);
            }).then(() => {
        })
        .then(() => {
                this.getList();
                this.$modal.msgSuccess("删除成功");
            }).catch(() => { });
        })
        .catch(() => {});
        },
        /** 复选框选中数据 */
        handleDmKsSelectionChange(selection) {
            this.checkedDmKs = selection.map(item => item.index)
        }
        ,
      this.checkedDmKs = selection.map((item) => item.index);
    },
        /** 导出按钮操作 */
        handleExport() {
            this.download('${moduleName}/${businessName}/export', {
                ...this.queryParams
            }, `${businessName}_#[[${new Date().getTime()}.xlsx`)
        }
    }
}
    ;
      this.download(
        "${moduleName}/${businessName}/export",
        {
          ...this.queryParams,
        },
        `${businessName}_#[[${new Date().getTime()}.xlsx`
      );
    },
  },
};
</script>