linwenling
2023-08-27 188d4a764d8bcedf53ac67127b4b9e142f79b1eb
ruoyi-ui/src/views/travel/index.vue
@@ -2,7 +2,7 @@
  <div class="app-container" style="opacity: 1;">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
      <h1 style="font-size:21px">完美旅途</h1>
      <el-form-item label="时间" prop="startTime">
      <el-form-item label="时间" prop="startTime" >
        <el-date-picker
          v-model="dateRange"
          style="width: 240px;"
@@ -91,10 +91,7 @@
    <!-- 这里有个familyList数组 是在data()中定义的 -->
    <el-table v-loading="loading" :data="travelpriceList"  @selection-change="handleSelectionChange" @row-click="handleShow" :row-class-name="tableRowClassName" style="background: #FFEFF2;  border-radius: 14px 14px 14px 14px;">
      <el-table-column type="selection" width="55"  align="center" />
      <el-table-column fixed label="序号" sortable type="index" :index="(queryParams.pageNum-1)*queryParams.pageSize+1" width="40"/>
      <el-table-column label="旅游名称" prop="tableName" sortable width="100" />
      <el-table-column label="标题" prop="title" sortable width="100" />
      <el-table-column label="去向" prop="destination" sortable width="50" />
      <el-table-column fixed label="序号" sortable type="index" :index="(queryParams.pageNum-1)*queryParams.pageSize+1" width="60px"/>
      <el-table-column label="起" prop="startTime" sortable width="100" align="center">
        <template slot-scope="scope">{{scope.row.startTime? scope.row.startTime: '————'}}</template>
      </el-table-column>
@@ -102,7 +99,9 @@
        <template slot-scope="scope">{{scope.row.endTime? scope.row.endTime: '————'}}</template>
      </el-table-column>
      <el-table-column label="总天数" prop="totalDay" sortable width="100" />
      <el-table-column label="旅游名称" prop="tableName" sortable width="100" />
      <el-table-column label="标题" prop="title" sortable width="130px" />
      <el-table-column label="去向" prop="destination" sortable width="80px" />
      <el-table-column label="旅游性质" prop="property" sortable width="100" />
      <el-table-column label="旅游方式" prop="type" sortable width="100" />
      <el-table-column label="总金额" prop="totalCost" sortable width="100" />
@@ -115,14 +114,14 @@
      <el-table-column label="操作" align="center" sortable width="200" >
        <template slot-scope="scope" v-if="scope.row.roleId !== 1">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['familymodel:economy:info']"
            v-hasPermi="['person:travel:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
@@ -133,41 +132,55 @@
          <el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)" v-hasPermi="['familymodel:economy:info']">
            <el-button size="mini" type="text" icon="el-icon-d-arrow-right"  @click="handleCheck(scope.row)">查看详情</el-button>
          </el-dropdown>
          <el-button class="button" size="mini" type="text"  @click="handleShow"  v-hasPermi="['system:role:add']">
            <sapn v-html="'\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'"></sapn> </el-button>
          <!-- <el-button class="button" size="mini" type="text"  @click="handleShow"  v-hasPermi="['system:role:add']">
            <sapn v-html="'\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'"></sapn> </el-button> -->
        </template>
      </el-table-column>
    </el-table>
    <div style="background-color: #FEF7FC;">
      <el-dialog :title="title" :visible.sync="openDataScope" width="1300px" append-to-body >
        <div style="background-color: #FEF7FC;">
          <el-table v-loading="loading" :data="detailList" @selection-change="handleSelectionChange" :row-class-name="tableRowClassName"  >
            <el-table-column type="selection" width="50"  align="center" />
            <el-table-column  label="序号" sortable type="index" :index="(queryParams.pageNum-1)*queryParams.pageSize+1" width="80px"/>
            <el-table-column label="时间" prop="happenTime" sortable width="150" align="center">
              <template slot-scope="scope">{{scope.row.happenTime? scope.row.happenTime: '————'}}</template>
            </el-table-column>
            <el-table-column label="内容" prop="content" sortable :show-overflow-tooltip="true" width="100px" />
            <el-table-column label="总金额" prop="totalCost" sortable :show-overflow-tooltip="true" width="100px" />
            <el-table-column label="餐费" prop="eat" sortable :show-overflow-tooltip="true" width="100px" />
            <el-table-column label="住宿" prop="stay" sortable :show-overflow-tooltip="true" width="100px" />
            <el-table-column label="交通" prop="traffic" sortable :show-overflow-tooltip="true" width="100px" />
            <el-table-column label="门票" prop="entrance" sortable :show-overflow-tooltip="true" width="100px" />
            <el-table-column label="购物" prop="shopping" sortable :show-overflow-tooltip="true" width="100px" />
    <el-dialog :title="title" :visible.sync="openDataScope" width="1500px" append-to-body >
      <div style="background-color: #FEF7FC;">
        <el-table v-loading="loading" :data="detailList" @selection-change="handleSelectionChange" :row-class-name="tableRowClassName"  >
          <el-table-column type="selection" width="50"  align="center" />
          <el-table-column  label="序号" sortable type="index" :index="(queryParams.pageNum-1)*queryParams.pageSize+1" width="150"/>
          <el-table-column label="时间" prop="happenTime" sortable width="150" align="center">
            <template slot-scope="scope">{{scope.row.happenTime? scope.row.happenTime: '————'}}</template>
          </el-table-column>
          <el-table-column label="内容" prop="content" sortable :show-overflow-tooltip="true" width="160" />
          <el-table-column label="总金额" prop="totalCost" sortable :show-overflow-tooltip="true" width="160" />
          <el-table-column label="餐费" prop="eat" sortable :show-overflow-tooltip="true" width="160" />
          <el-table-column label="住宿" prop="stay" sortable :show-overflow-tooltip="true" width="160" />
          <el-table-column label="交通" prop="traffic" sortable :show-overflow-tooltip="true" width="150" />
          <el-table-column label="门票" prop="entrance" sortable :show-overflow-tooltip="true" width="150" />
          <el-table-column label="购物" prop="shopping" sortable :show-overflow-tooltip="true" width="150" />
            <el-table-column label="操作" align="center" sortable class-name="small-padding fixed-width">
              <template slot-scope="scope" v-if="scope.row.roleId !== 1">
        </el-table>
        <pagination
          v-show="total>0"
          :total="total"
          :page.sync="queryParams.pageNum"
          :limit.sync="queryParams.pageSize"
          @pagination="getList"
          style="background: #FEF7FC;"
        />
      </div>
                <el-button
                  size="mini"
                  type="text"
                  icon="el-icon-edit"
                  @click="handleUpdate1(scope.row)"
                  v-hasPermi="['familymodel:economy:info']"
                >修改</el-button>
    </el-dialog>
              </template>
            </el-table-column>
          </el-table>
          <pagination
            v-show="total>0"
            :total="total"
            :page.sync="queryParams.pageNum"
            :limit.sync="queryParams.pageSize"
            @pagination="getList"
            style="background: #FEF7FC;"
          />
        </div>
      </el-dialog>
    </div>
    <pagination
      v-show="total>0"
      :total="total"
@@ -181,98 +194,40 @@
    <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
      <el-form ref="elForm" :model="formDat" :rules="rules" size="medium" label-width="100px">
        <el-form-item label="台账" prop="type">
          <el-input v-model="formDat.type" placeholder="请输入内容" clearable :style="{width: '100%'}" ></el-input>
        </el-form-item>
        <el-form-item label="时间" prop="happenTime">
          <el-input
            v-model='formDat.happenTime'
            type='date'
            placeholder='选择日期'
          ></el-input>
        <el-form-item label="标题" prop="title">
          <el-input v-model="formDat.title" placeholder="请输入标题" clearable :style="{width: '80%'}" >
          </el-input>
        </el-form-item>
        <el-form-item label="收入/支出" prop="price">
          <el-select v-model="formDat.price" placeholder="请选择收入/支出" clearable :style="{width: '100%'}"  >
            <el-option v-for="(item, index) in typeOptions" :key="index" :label="item.label" :value="item.value"
            ></el-option>
        <el-form-item label="起始时间" prop="startTime">
          <el-input type="date" v-model="formDat.startTime" placeholder="请选择起始时间" style="width: 80%;"></el-input>
        </el-form-item>
        <el-form-item label="结束时间" prop="endTime">
          <el-input type="date" v-model="formDat.endTime" placeholder="请选择结束时间" style="width: 80%;"></el-input>
        </el-form-item>
        <el-form-item label="去向" prop="destination">
          <el-select v-model="formDat.destination" placeholder="请选择去向" clearable :style="{width: '80%'}" >
            <el-option label="国内" value="国内"></el-option>
            <el-option label="国外" value="国外"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="金额" prop="balance">
          <el-input v-model="formDat.balance" placeholder="请输入余额" clearable :style="{width: '100%'}" >
        <el-form-item label="旅游名称" prop="tableName">
          <el-input v-model="formDat.tableName" placeholder="请输入旅游名称" clearable :style="{width: '80%'}" >
          </el-input>
        </el-form-item>
        <el-form-item label="用途" prop="useFor">
          <el-input v-model="formDat.useFor" placeholder="请输入用途" clearable :style="{width: '100%'}" >
          </el-input>
        <el-form-item label="旅游性质" prop="property">
          <el-select v-model="formDat.property" placeholder="请选择性质" clearable :style="{width: '80%'}" >
            <el-option label="自费" value="自费"></el-option>
            <el-option label="公费" value="公费"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="使用人" prop="usePeople">
          <el-input v-model="formDat.usePeople" placeholder="请输入使用人" clearable :style="{width: '100%'}" >
          </el-input>
        <el-form-item label="旅游方式" prop="type">
          <el-select v-model="formDat.type" placeholder="请选择旅游方式" clearable :style="{width: '80%'}" >
            <el-option label="自驾游" value="自驾游"></el-option>
            <el-option label="跟团游" value="跟团游"></el-option>
            <el-option label="自助游" value="自助游"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="支付方式" prop="kind">
          <el-input v-model="formDat.kind" placeholder="请输入支付方式" clearable :style="{width: '100%'}" >
          </el-input>
        </el-form-item>
        <el-form-item label="备注" prop="remark">
          <el-input v-model="formDat.remark" placeholder="请输入备注" clearable :style="{width: '100%'}" ></el-input>
        </el-form-item>
        <h4 class="form-header">相关图片 </h4>
        <el-upload
          action="#"
          list-type="picture-card"
          multiple
          :http-request="requestUpload"
          :file-list="fileList"
        >
          <i slot="default" class="el-icon-plus"></i>
          <div slot="file" slot-scope="{file}">
            <img
              class="el-upload-list__item-thumbnail"
              :src="file.url"
              alt=""
              style="width: 126px; height: 126px"
              fit="cover"
              :preview-src-list="[file.url]"
            >
            <span class="el-upload-list__item-actions">
          <span
            class="el-upload-list__item-preview"
            @click="handlePictureCardPreview(file)"
          >
            <i class="el-icon-zoom-in"></i>
          </span>
          <span
            v-if="!disabled"
            class="el-upload-list__item-delete"
            @click="handleRemove(file)"
          >
            <i class="el-icon-delete"></i>
          </span>
        </span>
          </div>
        </el-upload>
        <h4 class="form-header">其他附件 </h4>
        <el-upload
          action=""
          :file-list="fileListOther"
          class="upload-demo"
          multiple
          :on-remove="handleRemove"
          :http-request="requestUpload"
          :show-file-list="true"
        >
          <el-button type="primary">上传</el-button>
          <template #tip>
            <div class="el-upload__tip">
            </div>
          </template>
        </el-upload>
      </el-form>
      <h4 class="form-header"> </h4>
@@ -341,12 +296,12 @@
      btn:false,
      formDat: {
        type: undefined,
        createTime: undefined,
        useFor: undefined,
        usePeople: undefined,
        kind:undefined,
        remark: undefined,
        url: undefined,
        startTime: undefined,
        title: undefined,
        endTime: undefined,
        property:undefined,
        tableName: undefined,
        destination: undefined,
        detailList:undefined,
      },
      // 菜单列表
@@ -371,40 +326,39 @@
      },
      // 表单校验
      rules: {
        usePeople: [{
          required: true,
          message: '请输入使用人',
          trigger: 'blur'
        }],
        useFor: [{
          required: true,
          message: '请输入用途',
          trigger: 'blur'
        }],
        type: [{
          required: true,
          message: '请输入台账内容',
          message: '请输入旅游方式',
          trigger: 'blur'
        }],
        balance: [{
        property: [{
          required: true,
          message: '请输入金额',
          trigger: 'blur'
        }],
        kind: [{
          // required: true,
          message: '请输入支付方式',
          trigger: 'blur'
        }],
        createTime: [{
          required: true,
          message: '请选择日期选择',
          message: '请输入旅游性质',
          trigger: 'change'
        }],
        price: [{
        destination: [{
          required: true,
          message: '请选择事项内容',
          message: '请选择去向',
          trigger: 'change'
        }],
        tableName: [{
          required: true,
          message: '请输入旅游名称',
          trigger: 'blur'
        }],
        startTime: [{
          required: true,
          message: '请选择日期',
          trigger: 'change'
        }],
        endTime: [{
          required: true,
          message: '请选择日期',
          trigger: 'change'
        }],
        title: [{
          required: true,
          message: '请选择标题',
          trigger: 'blur'
        }],
      },
@@ -434,23 +388,6 @@
  },
  methods: {
    //基金/台账的选择
    getSrc1(type) {
      if (type === 0) {
        return '基金'
      }else {
        return '台账'
      }
    },
    getSrc2(kind) {
      if (kind == 0) {
        return '现金'
      }else  {
        return '自动扣划'
      }
    },
    // 取消按钮
    cancelData() {
@@ -556,7 +493,7 @@
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加家庭收支台账";
      this.title = "添加旅游内容";
    },
    //  弹窗
@@ -567,7 +504,7 @@
      //alert(123)
      this.detailList = row.detailList
      // alert(row.index)
      this.title = "展示详情";
      this.title = "每日费用详情";
    },
@@ -580,16 +517,11 @@
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      const id = row.id;
      // let jd = true
      // this.$router.push({
      //   path:"/self/travel/edit/" + id,
      //   query:{
      //     detail:jd
      //   }
      // });
      const id = row.id;
      console.log(id);
      this.$router.push("/self/travel/edit/" + id);
    },
@@ -600,18 +532,15 @@
    /** 提交按钮(数据权限) */
    submitDataScope: function() {
      let ul = this.fileList.map(function (elem){
        return elem.url.replace(process.env.VUE_APP_BASE_TRUE_API,"")
      }).join(",")
      let uls = this.fileListOther.map(function (elem){
        return elem.url.replace(process.env.VUE_APP_BASE_TRUE_API,"")
      }).join(",")
      this.formDat.url = ul+","+uls
      this.formDat.detailList = [];
      this.$refs["elForm"].validate(valid => {
        if (valid) {
          addEconomy(this.formDat).then(response => {
          addTravelPrice(this.formDat).then(response => {
            this.$modal.msgSuccess("新增成功");
            console.log("okk");
            console.log(this.formDat);
            this.open = false;
            this.getList();
          });