| | |
| | | <div style="width: 100%;height: 100%;"> |
| | | <div> |
| | | <el-row class="title"> |
| | | <el-col :span="12" style="padding-left: 20px;">费用统计</el-col> |
| | | <el-col :span="12" style="padding-left: 20px;text-align: left;">费用统计</el-col> |
| | | <el-col :span="12" style="text-align: right;"> |
| | | <el-button size="small" type="primary">OA推送</el-button> |
| | | </el-col> |
| | |
| | | </el-date-picker> |
| | | </div> |
| | | </div> |
| | | <div class="search_thing"> |
| | | <div class="search_thing" style="width: 340px"> |
| | | <div class="search_label">委托单位:</div> |
| | | <div class="search_input"><el-input size="small" placeholder="请输入" clearable |
| | | v-model="componentData.entity.company" @keyup.enter.native="refreshTable()"></el-input></div> |
| | | <div class="search_input"> |
| | | <!-- <el-input size="small" placeholder="请输入" clearable--> |
| | | <!-- @keyup.enter.native="refreshTable()"></el-input>--> |
| | | <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.label"> |
| | | </el-option> |
| | | </el-select> |
| | | </div> |
| | | </div> |
| | | <div class="search_thing" style="padding-left: 30px;"> |
| | | <el-button size="small" @click="refresh()">重 置</el-button> |
| | | <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"> |
| | |
| | | |
| | | <script> |
| | | import ValueTable from '../tool/value-table.vue' |
| | | import Word from '../tool/word.vue' |
| | | export default { |
| | | components: { |
| | | ValueTable, |
| | | Word, |
| | | }, |
| | | data() { |
| | | return { |
| | |
| | | company: null, |
| | | dates: null, |
| | | orderBy: { |
| | | field: 'id,ins_sample_id', |
| | | field: 'id', |
| | | order: 'asc' |
| | | } |
| | | }, |
| | |
| | | name: 'entrustCode', |
| | | index: 2 |
| | | }, |
| | | /* { |
| | | name: 'sample', |
| | | index: 3 |
| | | }, |
| | | { |
| | | name: 'model', |
| | | index: 4 |
| | | }, */ |
| | | { |
| | | name: 'company', |
| | | index: 8 |
| | |
| | | }, |
| | | ], |
| | | // 特殊的合并行,根据main和rows的name来合并 |
| | | special: { |
| | | main: 'insSampleId', |
| | | /* special: { |
| | | main: 'entrustCode', |
| | | rows: [{ |
| | | name: 'sample', |
| | | index: 3 |
| | |
| | | index: 6 |
| | | }, |
| | | ] |
| | | } |
| | | } */ |
| | | }, |
| | | tagField: { |
| | | type: { |
| | |
| | | }, |
| | | selectField: {}, |
| | | requiredAdd: [], |
| | | requiredUp: [] |
| | | requiredUp: [], |
| | | needSort: ['createTime', 'sample'], |
| | | }, |
| | | entityCopy: {}, |
| | | upIndex: 0, |
| | | claimVisible: false, |
| | | dates: [], |
| | | index2: 0 |
| | | index2: 0, |
| | | total: 0, |
| | | companyOptions: [], // 委托单位枚举值 |
| | | entity: { |
| | | orderBy: { |
| | | field: 'id', |
| | | order: 'asc' |
| | | } |
| | | }, |
| | | page: { |
| | | current: -1, |
| | | size: -1, |
| | | }, |
| | | outLoading:false, |
| | | isExport:false |
| | | } |
| | | }, |
| | | mounted() { |
| | |
| | | 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 |
| | | const blob = new Blob([res],{ type: 'application/octet-stream' }); |
| | | //将Blob 对象转换成字符串 |
| | | let reader = new FileReader(); |
| | | reader.readAsText(blob, 'utf-8'); |
| | | reader.onload = () => { |
| | | try { |
| | | let result = JSON.parse(reader.result); |
| | | if (result.message) { |
| | | this.$message.error(result.message); |
| | | } else { |
| | | 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(); |
| | | this.$message.success('导出成功') |
| | | } |
| | | } catch (err) { |
| | | console.log(err); |
| | | 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(); |
| | | this.$message.success('导出成功') |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | getTotal(){ |
| | | this.$axios.post(this.$api.insOrder.costStatistics2, { |
| | | entity:this.componentData.entity |
| | | }, { |
| | | headers: { |
| | | 'Content-Type': 'application/json' |
| | | } |
| | | }).then(res => { |
| | | this.total = res.data.total |
| | | }) |
| | | }, |
| | | getDates(){ |
| | | //当前月第一天 |
| | | var y = new Date().getFullYear(); //获取年份 |
| | |
| | | this.index2++ |
| | | this.componentData.entity.dates = `["${startDate}","${endDate}"]` |
| | | }, |
| | | getCompanyOptions () { |
| | | this.$axios.post(this.$api.user.selectCustomPageList, { |
| | | page: this.page, |
| | | entity: this.entity |
| | | }, { |
| | | headers: { |
| | | 'Content-Type': 'application/json' |
| | | } |
| | | } |
| | | ).then(res => { |
| | | if (res.code === 200) { |
| | | const list = res.data.body.records |
| | | this.companyOptions = [] |
| | | list.map((item) => { |
| | | const obj = Object.assign({ |
| | | value: item.id, |
| | | label: item.company, |
| | | }) |
| | | this.companyOptions.push(obj) |
| | | }) |
| | | } |
| | | }).catch(e => { |
| | | this.$message.error('查询失败') |
| | | }) |
| | | }, |
| | | refreshTable() { |
| | | this.$refs['ValueTable'].selectList() |
| | | this.getTotal() |
| | | }, |
| | | refresh() { |
| | | this.componentData.entity = this.HaveJson(this.entityCopy) |
| | | this.componentData.init = true |
| | | this.getDates() |
| | | this.getTotal() |
| | | this.upIndex++ |
| | | }, |
| | | handleWeave() { |
| | |
| | | if (power[i].menuMethod == 'addInsOrder') { |
| | | add = true |
| | | } |
| | | // |
| | | if (power[i].menuMethod == 'export') { |
| | | this.isExport = true |
| | | } |
| | | } |
| | | if (!up) { |
| | | this.componentData.do.splice(4, 1) |
| | |
| | | } |
| | | this.componentData.entity.dates = JSON.stringify(val) |
| | | this.$refs['ValueTable'].selectList() |
| | | this.getTotal() |
| | | } |
| | | } |
| | | } |