licp
2024-12-20 d975fc4756806f5b51f006c19c33571b9b8c0b3b
src/components/view/b1-expenses.vue
@@ -73,7 +73,7 @@
            <el-select @focus="getCompanyOptions" @change="refreshTable()" clearable
                       size="small" v-model="componentData.entity.company" style="width: 100%">
              <el-option v-for="item in companyOptions" :key="item.value"
                         :label="item.label" :value="item.value">
                         :label="item.label" :value="item.label">
              </el-option>
            </el-select>
          </div>
@@ -83,10 +83,14 @@
          <el-button size="small" type="primary" @click="refreshTable()">查 询</el-button>
        </div>
        <div class="search_thing" style="padding-left: 70px;">总价:{{total}}</div>
        <div class="search_thing" style="padding-left: 70px;">
          <el-button size="small" type="primary" @click="handleDown" :loading="outLoading" v-if="isExport">导出</el-button>
        </div>
      </div>
      <div class="table">
        <ValueTable ref="ValueTable" :url="$api.insOrder.costStatistics" :componentData="componentData" :key="upIndex"
          @handleWeave="handleWeave" />
        <ValueTable ref="ValueTable" :url="$api.insOrder.costStatistics"
                    :componentData="componentData" :key="upIndex"
          @handleWeave="handleWeave" :column-min-width="'140'"/>
      </div>
    </div>
    <el-dialog title="在线编制" :visible.sync="claimVisible" width="70%" :modal-append-to-body="false">
@@ -101,11 +105,9 @@
<script>
  import ValueTable from '../tool/value-table.vue'
  import Word from '../tool/word.vue'
  export default {
    components: {
      ValueTable,
      Word,
    },
    data() {
      return {
@@ -114,7 +116,7 @@
            company: null,
            dates: null,
            orderBy: {
              field: 'id,ins_sample_id',
              field: 'id',
              order: 'asc'
            }
          },
@@ -135,6 +137,14 @@
                name: 'entrustCode',
                index: 2
              },
              /* {
                name: 'sample',
                index: 3
              },
              {
                name: 'model',
                index: 4
              }, */
              {
                name: 'company',
                index: 8
@@ -145,8 +155,8 @@
              },
            ],
            // 特殊的合并行,根据main和rows的name来合并
            special: {
              main: 'insSampleId',
            /* special: {
              main: 'entrustCode',
              rows: [{
                  name: 'sample',
                  index: 3
@@ -164,7 +174,7 @@
                  index: 6
                },
              ]
            }
            } */
          },
          tagField: {
            type: {
@@ -188,7 +198,8 @@
          },
          selectField: {},
          requiredAdd: [],
          requiredUp: []
          requiredUp: [],
          needSort: ['createTime', 'sample'],
        },
        entityCopy: {},
        upIndex: 0,
@@ -207,6 +218,8 @@
          current: -1,
          size: -1,
        },
        outLoading:false,
        isExport:false
      }
    },
    mounted() {
@@ -216,6 +229,29 @@
      this.getPower()
    },
    methods: {
      handleDown(){
        let entity = {...this.componentData.entity}
        // entity.dates = JSON.stringify(entity.dates)
        delete entity.orderBy
        this.outLoading = true
        this.$axios.post(this.$api.insOrder.export,{
          entity:entity
        },{
            headers: {
              'Content-Type': 'application/json'
            }
          ,responseType: "blob"}).then(res => {
          this.outLoading = false
          this.$message.success('导出成功')
          const blob = new Blob([res],{ type: 'application/octet-stream' });
          const url = URL.createObjectURL(blob);
          const link = document.createElement('a');
          link.href = url;
          let date = JSON.parse(entity.dates)
          link.download = (entity.company?entity.company+' ':'')+date[0]+' - '+date[1]+'费用统计.xlsx';
          link.click();
        })
      },
      getTotal(){
        this.$axios.post(this.$api.insOrder.costStatistics2, {
          entity:this.componentData.entity
@@ -297,6 +333,10 @@
          if (power[i].menuMethod == 'addInsOrder') {
            add = true
          }
          //
          if (power[i].menuMethod == 'export') {
            this.isExport = true
          }
        }
        if (!up) {
          this.componentData.do.splice(4, 1)