Browse Source

智能报表新增接口联调,删除接口联调,查看还需要再改改

luckysheet_xiaowang
mk 1 year ago
parent
commit
2348002b7b
  1. 1
      src/views/modules/base/smartExcel/cpts/excel-template-confirmation.vue
  2. 135
      src/views/modules/base/smartExcel/cpts/excel-upload-data.vue
  3. 102
      src/views/modules/base/smartExcel/cpts/export-view.vue
  4. 480
      src/views/modules/base/smartExcel/report.vue

1
src/views/modules/base/smartExcel/cpts/excel-template-confirmation.vue

@ -77,7 +77,6 @@ export default {
}, },
handleConfirm(){ handleConfirm(){
let boolean = this.exportJson.sheets[0].data[1].every(item => !item || !item.v); let boolean = this.exportJson.sheets[0].data[1].every(item => !item || !item.v);
console.log(boolean);
if(boolean){ if(boolean){
this.$emit('saveLuckysheetJson',this.exportJson) this.$emit('saveLuckysheetJson',this.exportJson)
}else{ }else{

135
src/views/modules/base/smartExcel/cpts/excel-upload-data.vue

@ -11,13 +11,12 @@
<div v-show="progress == 1" style="width: 80%; margin-top: 10px; font-size: 16px;"> <div v-show="progress == 1" style="width: 80%; margin-top: 10px; font-size: 16px;">
<el-form :model="formData" :rules="rules" ref="ref_form" :label-width="'120px'" v-if="pageType === 'report'"> <el-form :model="formData" :rules="rules" ref="ref_form" :label-width="'120px'" v-if="pageType === 'report'">
<el-form-item label="标题名称" prop="reportName"> <el-form-item label="标题名称" prop="reportName">
<el-input v-model.trim="formData.reportName" size="small" clearable style=" height: 40px;" <el-input v-model.trim="formData.reportName" size="small" clearable style=" height: 40px;" placeholder="请输入">
placeholder="请输入">
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div class="flex" style="margin: 60px 0;"> <div class="flex" style="margin: 60px 0;">
<div @click="onClickTab(item)" class="flex" <div @click="onClickTab(item)" class="flex"
style=" cursor: pointer; position: relative;display: flex; flex-direction: column; align-items: center; justify-content: center; width: 155px;height: 90px;background: #F1F4FA;border-radius: 4px; margin-left: 60px;" style=" cursor: pointer; position: relative;display: flex; flex-direction: column; align-items: center; justify-content: center; width: 155px;height: 90px;background: #F1F4FA;border-radius: 4px; margin-left: 60px;"
v-for="(item, index) in dataSourceList"> v-for="(item, index) in dataSourceList">
@ -30,7 +29,8 @@
</div> </div>
</div> </div>
</div> </div>
<div v-show="dataList.length > 0 && progress == 2 && pageType === 'excel'" style="height: 400px; overflow-y: scroll;margin: 60px 0;"> <div v-show="dataList.length > 0 && progress == 2 && pageType === 'excel'"
style="height: 400px; overflow-y: scroll;margin: 60px 0;">
<el-table ref="ref_table" :data="dataList" border class="m-table-item" style="width: 100%"> <el-table ref="ref_table" :data="dataList" border class="m-table-item" style="width: 100%">
<el-table-column label="序号" header-align="center" align="center" type="index" width="100"></el-table-column> <el-table-column label="序号" header-align="center" align="center" type="index" width="100"></el-table-column>
<el-table-column prop="userTableHeader" header-align="center" align="center" label="上传表格列" min-width="60"> <el-table-column prop="userTableHeader" header-align="center" align="center" label="上传表格列" min-width="60">
@ -65,22 +65,23 @@
</el-table> </el-table>
</div> </div>
<div v-show="progress == 2 && pageType === 'report'"> <div v-show="progress == 2 && pageType === 'report'">
<export-process-two ref="report_form"></export-process-two> <export-process-two ref="report_form"></export-process-two>
</div> </div>
<div v-show="progress == 3" style="height: 400px; overflow-y: scroll;margin: 60px 0;"> <div v-show="progress == 3" style="height: 400px; overflow-y: scroll;margin: 60px 0;">
<div v-if="formData1.importCategory === 'BASEINFO'"> <div v-if="formData1.importCategory === 'BASEINFO'">
<resi-search ref="resi_form"></resi-search> <resi-search ref="resi_form"></resi-search>
</div> </div>
<div v-else> <div v-else>
<HoseSearch ref="house_form"/> <HoseSearch ref="house_form" />
</div> </div>
</div> </div>
<p v-if="progress == 1">温馨提示:智能填表将使用平台内已有的基础数据,如果您所在的组织下尚无基础数据,请先通过<el-button type="text" @click="toSmartImport">[智能导入]</el-button>导入基础数据后再进行填表操作</p> <p v-if="progress == 1">温馨提示智能填表将使用平台内已有的基础数据如果您所在的组织下尚无基础数据请先通过<el-button type="text"
@click="toSmartImport">[智能导入]</el-button></p>
<div> <div>
<span slot="footer" style="margin-top: 30px; display: flex; justify-content: flex-end;"> <span slot="footer" style="margin-top: 30px; display: flex; justify-content: flex-end;">
<el-button v-if="progress != 1" @click="progress = progress - 1">上一步</el-button> <el-button v-if="progress != 1" @click="progress = progress - 1">上一步</el-button>
<el-button type="primary" @click="onClickNext()" >下一步</el-button> <el-button type="primary" @click="onClickNext()">下一步</el-button>
</span> </span>
</div> </div>
</div> </div>
@ -138,20 +139,20 @@ export default {
// status:0 // status:0
// }, // },
], ],
rules:{ rules: {
reportName:[{ required: true, message: this.$t('validate.required'), trigger: 'blur' }] reportName: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }]
}, },
formData: { formData: {
columnMateJson: '', columnMateJson: '',
searchForm: {}, searchForm: {},
formCode:'', formCode: '',
reportName:'' reportName: ''
}, },
resident_category_import_list: [], resident_category_import_list: [],
groupList: [], groupList: [],
fileCode: null, fileCode: null,
dataList: [], dataList: [],
dataListLoading:false, dataListLoading: false,
}; };
}, },
props: { props: {
@ -171,9 +172,13 @@ export default {
type: Array, type: Array,
default: () => [] default: () => []
}, },
pageType:{ pageType: {
type: String,
default: "excel"//excel report
},
workBookId:{
type:String, type:String,
default:"excel"//excel report default:()=>{}
} }
}, },
created() { created() {
@ -181,9 +186,9 @@ export default {
}, },
methods: { methods: {
toSmartImport(){ toSmartImport() {
this.$router.push({path:'/main/base-smartImport'}) this.$router.push({ path: '/main/base-smartImport' })
this.$emit('handleUploadDataHide',null) this.$emit('handleUploadDataHide', null)
}, },
onClickTab(value) { onClickTab(value) {
this.formData1 = {} this.formData1 = {}
@ -199,36 +204,21 @@ export default {
}, },
onClickNext() { onClickNext() {
if (this.progress === 1) { if (this.progress === 1) {
if(this.pageType == 'report'){ if (this.pageType == 'report') {
this.$refs['ref_form'].validate((valid)=>{ this.$refs['ref_form'].validate((valid) => {
if (!valid) { if (!valid) {
return false return false
}else{ } else {
this.progress = 2; this.progress = 2;
} }
}) })
}else{ } else {
this.progress = 2; this.progress = 2;
this.dataListLoading = true; this.dataListLoading = true;
this.checkExtractExcelHead() this.checkExtractExcelHead()
} }
} else if (this.progress === 2) { } else if (this.progress === 2) {
let obj = this.dataList.reduce((acc, item) => { if (this.pageType === 'report') {
if (item.userTableHeader) {
acc[item.userTableHeader] = item.itemId;
}
return acc;
}, {});
this.formData.columnMateJson = JSON.stringify(obj)
this.progress = 3;
} else {
this.dataListLoading = true;
if(this.formData1.importCategory === 'BASEINFO'){
this.formData.searchForm= this.$refs['resi_form'].form;
}else{
this.formData.searchForm= this.$refs['house_form'].form;
}
if(this.pageType === 'report'){
this.formData.columnsJson = this.$refs['report_form'].rightList.map(item => { this.formData.columnsJson = this.$refs['report_form'].rightList.map(item => {
return { return {
itemId: item.id, itemId: item.id,
@ -238,10 +228,32 @@ export default {
supportAdd: item.supportAdd supportAdd: item.supportAdd
} }
}) })
this.$emit('saveLuckysheetHead',this.formData.columnsJson)
}else{
let obj = this.dataList.reduce((acc, item) => {
if (item.userTableHeader) {
acc[item.userTableHeader] = item.itemId;
}
return acc;
}, {});
this.formData.columnMateJson = JSON.stringify(obj)
}
this.progress = 3;
} else {
this.dataListLoading = true;
if (this.formData1.importCategory === 'BASEINFO') {
this.formData.searchForm = this.$refs['resi_form'].form;
} else {
this.formData.searchForm = this.$refs['house_form'].form;
}
if (this.pageType === 'report') {
this.formData.reportType = 0; this.formData.reportType = 0;
this.formData.formCode = this.formData1.importCategory === 'BASEINFO'?'resident_base_info':'community_info' this.formData.workbookId = this.workBookId;
this.formData.formCode = this.formData1.importCategory === 'BASEINFO' ? 'resident_base_info' : 'community_info'
delete this.formData.columnMateJson delete this.formData.columnMateJson
}else{ } else {
this.formData.formCode = this.formData1.importCategory this.formData.formCode = this.formData1.importCategory
delete this.formData.reportName delete this.formData.reportName
} }
@ -249,11 +261,14 @@ export default {
} }
}, },
async saveUploadForm() { async saveUploadForm() {
const url = this.pageType === 'report'?'/actual/base/intellgentizeReport/create':'/actual/base/residentBaseInfo/exportOneSheet' const url = this.pageType === 'report' ? '/actual/base/intellgentizeReport/create' : '/actual/base/residentBaseInfo/exportOneSheet'
const { data, code, msg } = await requestPost(url, this.formData) let { data, code, msg } = await requestPost(url, this.formData)
if (code === 0) { if (code === 0) {
this.dataListLoading = false; this.dataListLoading = false;
this.$emit('handleUploadDataHide',data) if (this.pageType === 'report') {
data = { columnsJson: this.formData.columnsJson, id: data }
}
this.$emit('handleUploadDataHide', data)
} else { } else {
console.log(msg); console.log(msg);
} }
@ -291,22 +306,22 @@ export default {
let columnMateStr = ''; let columnMateStr = '';
let foundFirstValue = false; // let foundFirstValue = false; //
for (let item of this.currentTable[0].data[0]) { for (let item of this.currentTable[0].data[0]) {
if (!foundFirstValue) { if (!foundFirstValue) {
// //
if (!item || item.v === '') { if (!item || item.v === '') {
columnMateStr += '空;'; // "" columnMateStr += '空;'; // ""
} else {
columnMateStr += item.v + ';'; //
foundFirstValue = true; //
}
} else { } else {
// columnMateStr += item.v + ';'; //
if (!item || item.v === '') { foundFirstValue = true; //
break; //
} else {
columnMateStr += item.v + ';'; //
}
} }
} else {
//
if (!item || item.v === '') {
break; //
} else {
columnMateStr += item.v + ';'; //
}
}
} }
// //
columnMateStr = columnMateStr.slice(0, -1); columnMateStr = columnMateStr.slice(0, -1);
@ -353,7 +368,7 @@ export default {
this.createdTime = createdTime; this.createdTime = createdTime;
}, },
}, },
components: {resiSearch,HoseSearch,exportProcessTwo}, components: { resiSearch, HoseSearch, exportProcessTwo },
computed: {}, computed: {},
watch: {}, watch: {},
}; };

102
src/views/modules/base/smartExcel/cpts/export-view.vue

@ -3,15 +3,13 @@
<div :class="['flex', 'flex-y', 'flex1', 'luckysheet-wrap-all']"> <div :class="['flex', 'flex-y', 'flex1', 'luckysheet-wrap-all']">
<div class="top_btn flex flex-end"> <div class="top_btn flex flex-end">
<div> <div>
<el-button type="text" round @click="handelClickBack" <el-button type="text" round @click="handelClickBack" icon="el-icon-back">返回</el-button>
icon="el-icon-back">返回</el-button> <el-button type="warning" @click="handleClickInspect">上传统计模板
<el-button type="warning" @click="handleClickInspect">上传统计模板 </el-button>
</el-button>
<el-button type="success" @click="onClickUplond()"> 数据列表导出</el-button> <el-button type="success" @click="onClickUplond()"> 数据列表导出</el-button>
</div> </div>
<div> <div>
<el-button type="primary" <el-button type="primary" @click="handleClickCurrencyEvent('submit')"> 导出</el-button>
@click="handleClickCurrencyEvent('submit')"> 导出</el-button>
</div> </div>
</div> </div>
<div id="luckysheet"></div> <div id="luckysheet"></div>
@ -19,7 +17,7 @@
<el-dialog title="数据列表导出" v-if="showUploadData" :visible.sync="showUploadData" width="60%" <el-dialog title="数据列表导出" v-if="showUploadData" :visible.sync="showUploadData" width="60%"
:close-on-click-modal="false"> :close-on-click-modal="false">
<excelUploadData @handleUploadDataHide="handleUploadDataHide" :currentTable="currentTable" <excelUploadData @handleUploadDataHide="handleUploadDataHide" :currentTable="currentTable"
:btnLoading="btnLoading" :pageType='`report`'> :btnLoading="btnLoading" :pageType='`report`' :workBookId="workBookId" @saveLuckysheetHead="saveLuckysheet">
</excelUploadData> </excelUploadData>
</el-dialog> </el-dialog>
</div> </div>
@ -31,7 +29,7 @@ import options from "@/utils/luckysheetConfig.js";
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import { requestPost, requestGet } from "@/js/dai/request"; import { requestPost, requestGet } from "@/js/dai/request";
import nextTick from "dai-js/tools/nextTick"; import nextTick from "dai-js/tools/nextTick";
import { exportSheetExcel } from "@/utils/export";
export default { export default {
data() { data() {
@ -43,11 +41,18 @@ export default {
currentTable: null, currentTable: null,
currentId: '', currentId: '',
btnLoading: false, btnLoading: false,
sheetR:0 workBookId: ''
}; };
}, },
props: { props: {
pageType: {
type: String,
default: ''
},
infoIds: {
type: Object,
default: () => { }
}
}, },
computed: { computed: {
tableHeight() { tableHeight() {
@ -55,17 +60,27 @@ export default {
}, },
...mapGetters(['clientHeight', 'resolution']), ...mapGetters(['clientHeight', 'resolution']),
}, },
created() { created() {
}, },
watch: {}, watch: {},
async mounted() { async mounted() {
this.loadWorkBook() await this.loadWorkBook()
if (this.pageType === 'info') {
await this.getSheetList()
}
}, },
methods: { methods: {
handleClickCurrencyEvent(){ async getSheetList() {
exportSheetExcel(luckysheet.getAllSheets(),'导出文件') const { data, code } = await requestGet('/actual/base/intellgentizeReport/detail', { id: this.infoIds.id })
if (code === 0) {
console.log(data);
}
},
handleClickCurrencyEvent() {
exportSheetExcel(luckysheet.getAllSheets(), '导出文件')
}, },
//
async handleClickInspect() { async handleClickInspect() {
}, },
@ -74,34 +89,46 @@ export default {
this.showUploadData = true; this.showUploadData = true;
let list = luckysheet.getAllSheets() let list = luckysheet.getAllSheets()
this.currentTable = list.filter(item => item.status == '1') this.currentTable = list.filter(item => item.status == '1')
}, },
async handleUploadDataHide(val) { async handleUploadDataHide(val) {
this.showUploadData = false; let listData = await this.getListData(val.id)
luckysheet.insertRow(this.currentTable[0].data.length, 1) luckysheet.insertRow(this.currentTable[0].data.length, 1)
const findLastNonNullIndex = (arr) => { luckysheet.insertRow(this.currentTable[0].data.length, { number: listData.length });
for (let i = arr.length - 1; i >= 0; i--) { this.showUploadData = false;
const subArray = arr[i]; await nextTick(500)
// null let newArray = listData.map(obj => {
if (Array.isArray(subArray) && subArray.some(item => item !== null && item.v && item.v !== null && item.v !== '')) {
return i; //
}
}
return -1; // -1
};
this.sheetR = findLastNonNullIndex(this.currentTable[0].data)
console.log(this.currentTable[0].data.length, val.length);
luckysheet.insertRow(this.currentTable[0].data.length, { number: val.length });
await nextTick(2000)
let newArray = val.map(obj => {
return Object.keys(obj).map(key => { return Object.keys(obj).map(key => {
return { m: obj[key], "ct": { "fa": "General", "t": "g" }, v: obj[key] }; return { m: obj[key], "ct": { "fa": "General", "t": "g" }, v: obj[key] };
}); });
}); });
console.log(newArray, '处理后数据'); let bottomRightCorner = this.numberToLetter(Object.keys(listData[0]).length)//
let bottomRightCorner = this.numberToLetter(Object.keys(val[0]).length)//
luckysheet.setRangeValue(newArray, { luckysheet.setRangeValue(newArray, {
range: `A${this.sheetR + 2}:${bottomRightCorner}${this.sheetR + val.length}`, range: `A2:${bottomRightCorner}${2 + listData.length}`,
}) })
},
async saveLuckysheet(head) {
if (this.currentTable[0].data[0].every(item => !item) && head) {
let temp = head.map(item => item.children).flat();
for (let i in temp) {
luckysheet.setCellValue(0, i, temp[i].label)
}
}
let luckysheetJson = luckysheet.getAllSheets()
const { data, code, msg } = await requestPost(`/actual/base/luckySheet/workbook/createByJson?fileName=`, luckysheetJson)
if (code === 0) {
this.workBookId = data.workbookId;
} else {
console.log(msg);
}
},
async getListData(id) {
const { data, code } = await requestGet('/actual/base/intellgentizeReport/listDatasById', { id })
if (code === 0) {
console.log(data);
return data
}
}, },
// //
numberToLetter(num) { numberToLetter(num) {
@ -115,11 +142,14 @@ export default {
}, },
loadWorkBook() { loadWorkBook() {
window.luckysheet.destroy(); window.luckysheet.destroy();
const { id } = this.$store.state.user;
options.gridKey = this.currentId;
options.allowUpdate = true; options.allowUpdate = true;
options.container = 'luckysheet' options.container = 'luckysheet'
// options.loadUrl = `${process.env.VUE_APP_API_SERVER}/actual/base/luckySheet/workbook/load?workbookId=${this.currentId}` options.gridKey = this.pageType === 'info' ? this.infoIds.workbookId : null;
if (this.pageType === 'info') {
options.loadUrl = `${process.env.VUE_APP_API_SERVER}/actual/base/luckySheet/workbook/load?workbookId=${this.infoIds.workbookId}`
}else{
options.loadUrl = null
}
// options.updateUrl = `${process.env.VUE_APP_SOCKET_SERVER}/actual/base/ws/luckysheet/${this.currentId}/${id}` // options.updateUrl = `${process.env.VUE_APP_SOCKET_SERVER}/actual/base/ws/luckysheet/${this.currentId}/${id}`
window.luckysheet.create({ window.luckysheet.create({
...options, ...options,

480
src/views/modules/base/smartExcel/report.vue

@ -4,23 +4,11 @@
<div class="m-search"> <div class="m-search">
<el-form :inline="true" :model="formData" ref="ref_searchform" :label-width="'100px'"> <el-form :inline="true" :model="formData" ref="ref_searchform" :label-width="'100px'">
<div> <div>
<el-form-item label="所属组织" prop="orgId">
<el-cascader class="u-item-width-normal" size="small" ref="myCascader" v-model.trim="formData.orgId"
:options="orgOptions" :props="orgOptionProps" :show-all-levels="false" @change="handleChangeAgency"
clearable></el-cascader>
</el-form-item>
<el-form-item label="报表名称" prop="taskTitle"> <el-form-item label="报表名称" prop="taskTitle">
<el-input v-model.trim="formData.taskTitle" class="u-item-width-normal" size="small" clearable <el-input v-model.trim="formData.taskTitle" class="u-item-width-normal" size="small" clearable
placeholder="请输入"> placeholder="请输入">
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item label="创建人" prop="createdBy">
<el-select class="u-item-width-normal" v-model.trim="formData.createdBy" placeholder="请选择" size="small"
clearable :disabled="manager">
<el-option v-for="item in createdByArray" :key="item.staffId" :label="item.name" :value="item.staffId">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="创建时间" prop="startTime"> <el-form-item label="创建时间" prop="startTime">
<el-date-picker v-model.trim="formData.startTime" :picker-options="startPickerOptions" <el-date-picker v-model.trim="formData.startTime" :picker-options="startPickerOptions"
class="u-item-width-daterange" size="small" type="date" value-format="yyyy-MM-dd HH:mm:ss" class="u-item-width-daterange" size="small" type="date" value-format="yyyy-MM-dd HH:mm:ss"
@ -49,10 +37,12 @@
</div> </div>
<el-table :data="tableData" border class="m-table-item" style="width: 100%" :height="maxTableHeight"> <el-table :data="tableData" border class="m-table-item" style="width: 100%" :height="maxTableHeight">
<el-table-column label="序号" fixed="left" type="index" align="center" width="50" /> <el-table-column label="序号" fixed="left" type="index" align="center" width="50" />
<el-table-column prop="reportName" label="报表名称" min-width="140" align="center" :show-overflow-tooltip="true" /> <el-table-column prop="reportName" label="报表名称" min-width="140" align="center"
:show-overflow-tooltip="true" />
<el-table-column prop="exportCount" label="导出记录" align="center" :show-overflow-tooltip="true" width="100"> <el-table-column prop="exportCount" label="导出记录" align="center" :show-overflow-tooltip="true" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button @click=" handleRecord(scope.row)" type="text" size="small">{{scope.row.exportCount}}</el-button> <el-button @click=" handleRecord(scope.row)" type="text"
size="small">{{ scope.row.exportCount }}</el-button>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="orgName" align="center" label="所属组织" :show-overflow-tooltip="true"> <el-table-column prop="orgName" align="center" label="所属组织" :show-overflow-tooltip="true">
@ -65,6 +55,7 @@
<el-table-column fixed="right" label="操作" align="center" width="200px"> <el-table-column fixed="right" label="操作" align="center" width="200px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button @click=" handleInfo(scope.row)" type="text" size="small">查看</el-button> <el-button @click=" handleInfo(scope.row)" type="text" size="small">查看</el-button>
<el-button @click=" handleDelete(scope.row)" type="text" size="small">删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -77,8 +68,8 @@
</div> </div>
</div> </div>
</div> </div>
<div class="m-search" v-if="pageType=='add'"> <div class="m-search" v-if="pageType == 'add' || pageType == 'info'">
<exportlView @close="close" ></exportlView> <exportlView @close="close" :pageType="pageType" :infoIds="infoIds" v-if="pageType == 'add' || pageType == 'info'"></exportlView>
</div> </div>
<div v-if="showRecord"> <div v-if="showRecord">
<el-dialog title="导出记录" :visible.sync="showRecord" width="50%" :close-on-click-modal="false"> <el-dialog title="导出记录" :visible.sync="showRecord" width="50%" :close-on-click-modal="false">
@ -88,91 +79,243 @@
</div> </div>
</template> </template>
<script> <script>
import exportlView from "./cpts/export-view.vue"; import exportlView from "./cpts/export-view.vue";
import { requestPost, requestGet } from "@/js/dai/request"; import { requestPost, requestGet } from "@/js/dai/request";
import nextTick from "dai-js/tools/nextTick"; import nextTick from "dai-js/tools/nextTick";
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import excelInfo from "./cpts/excel-info"; import excelInfo from "./cpts/excel-info";
import excelAdd from "./cpts/excel-add"; import excelAdd from "./cpts/excel-add";
import exportRecord from "./cpts/export-record"; import exportRecord from "./cpts/export-record";
export default { export default {
components: { excelInfo, excelAdd,exportRecord,exportlView }, components: { excelInfo, excelAdd, exportRecord, exportlView },
data() { data() {
let endDisabledDate = (time) => { let endDisabledDate = (time) => {
//datareturn //datareturn
let nowData = Date.now(); let nowData = Date.now();
if (this.formData.startTime) { if (this.formData.startTime) {
let startTime = new Date(this.formData.startTime); let startTime = new Date(this.formData.startTime);
return ( return (
time.getTime() > nowData || time.getTime() > nowData ||
time.getTime() < startTime || time.getTime() < startTime ||
time.getTime() === startTime time.getTime() === startTime
); );
} else { } else {
return time.getTime() > nowData;
}
};
let startDisabledDate = (time) => {
//datareturn
let nowData = Date.now();
return time.getTime() > nowData; return time.getTime() > nowData;
}; }
return { };
showRecord:false, let startDisabledDate = (time) => {
task: "", //datareturn
pageType: "list", // list add info let nowData = Date.now();
tableData: [], return time.getTime() > nowData;
formData: { };
orgId: '',//Id return {
taskTitle: '',// showRecord: false,
taskType: '',// infoIds: {},
startTime: '',// pageType: "list", // list add info
endTime: '',// tableData: [],
createdBy: ''// formData: {
}, orgId: '',//Id
pageNo: 1, taskTitle: '',//
pageSize: window.localStorage.getItem("pageSize") || 20, taskType: '',//
total: 1, startTime: '',//
sarr: [], endTime: '',//
endPickerOptions: { createdBy: ''//
disabledDate: endDisabledDate, },
pageNo: 1,
pageSize: window.localStorage.getItem("pageSize") || 20,
total: 1,
sarr: [],
endPickerOptions: {
disabledDate: endDisabledDate,
},
startPickerOptions: {
disabledDate: startDisabledDate,
},
searchH: 180,
createdByArray: [],
statusArray: [
{
label: '已完成',
value: 'resolved'
}, },
startPickerOptions: { {
disabledDate: startDisabledDate, label: '已取消',
value: 'cancel',
}, },
searchH: 180, {
createdByArray: [], label: '进行中',
statusArray: [ value: 'deal',
{ }
label: '已完成', ],
value: 'resolved' manager: false
}, };
{ },
label: '已取消', computed: {
value: 'cancel', maxTableHeight() {
}, const h = this.clientHeight - this.searchH - 275;
{ const _h = this.clientHeight - 275 - this.searchH;
label: '进行中', return this.$store.state.inIframe ? h : _h;
value: 'deal', },
...mapGetters(["clientHeight"]),
},
watch: {
},
async mounted() {
const user = this.$store.state.user;
await this.getStafflist()
if (user) {
if (user.roleList.findIndex(item => item === "manager") !== -1) {
this.manager = false;
} else {
this.manager = true;
this.formData.createdBy = this.createdByArray.find(item => item.mobile === user.phone).staffId
}
}
this.getTableData()
},
methods: {
handleDelete(item) {
let parms = {
id: item.id,
};
this.$confirm("删除之后无法恢复,确认删除?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
requestPost('/actual/base/intellgentizeReport/delete', parms).then(res => {
if (res.code == 0) {
this.getTableData()
}
})
})
.catch((err) => {
if (err == "cancel") {
} }
], });
manager: false },
close() {
this.pageType = "list"
},
handleRecord() {
this.showRecord = "ture"
},
handleCancel(item) {
let parms = {
id: item.id,
}; };
this.$confirm("取消之后无法恢复,确认取消?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
requestPost('/actual/base/communityOneTablePublish/cancelTask', parms).then(res => {
if (res.code == 0) {
this.pageNo = 1
this.getTableData()
}
})
})
.catch((err) => {
if (err == "cancel") {
}
});
}, },
computed: { async getStafflist() {
maxTableHeight() { let parms = {
const h = this.clientHeight - this.searchH - 275; orgId: this.$store.state.user.agencyId,
const _h = this.clientHeight - 275 - this.searchH; orgType: 'agency',
return this.$store.state.inIframe ? h : _h; pageNo: 1,
}, pageSize: 100,
...mapGetters(["clientHeight"]), };
let { data, code } = await requestPost('/data/aggregator/org/stafflist', parms)
if (code === 0) {
this.createdByArray = data.staffList;
}
},
handleShowPage() {
this.pageType = 'list';
this.getTableData()
},
handleAdd() {
this.pageType = 'add';
},
handleInfo(item) {
this.infoIds = {id:item.id,workbookId:item.workbookId};
this.pageType = 'info'
},
getLastItem(list, vals, key) {
let LIST = list || [];
for (let item of LIST) {
for (let i of vals) {
if (item[key] === i) {
this.sarr.push(item);
} else {
this.getLastItem(item.subAgencyList, vals, key);
}
}
}
},
handleSizeChange(val) {
this.pageSize = val;
window.localStorage.setItem("pageSize", val);
this.getTableData();
},
handleCurrentChange(val) {
this.pageNo = val;
this.getTableData();
},
async getTableData() {
const url = "/actual/base/intellgentizeReport/list";
const { pageSize, pageNo, formData } = this;
const { data, code, msg } = await requestGet(url, {
pageSize,
pageNo,
...formData
});
if (code === 0) {
this.total = data.total || 0;
this.tableData = data.list
? data.list.map((item) => {
return item;
})
: [];
} else {
this.$message.error(msg);
}
},
handleSearch() {
this.pageNo = 1;
this.getTableData();
}, },
watch: { handleDel(item) {
let parms = {
id: item.id,
};
this.$confirm("删除之后无法恢复,确认删除?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
requestPost('/actual/base/communityOneTablePublish/delete', parms).then(res => {
if (res.code == 0) {
this.getTableData()
}
})
})
.catch((err) => {
if (err == "cancel") {
}
});
}, },
async mounted() { resetSearch() {
this.$refs.ref_searchform.resetFields();
this.pageNo = 1;
const user = this.$store.state.user; const user = this.$store.state.user;
await this.getStafflist()
if (user) { if (user) {
if (user.roleList.findIndex(item => item === "manager") !== -1) { if (user.roleList.findIndex(item => item === "manager") !== -1) {
this.manager = false; this.manager = false;
@ -181,149 +324,18 @@
this.formData.createdBy = this.createdByArray.find(item => item.mobile === user.phone).staffId this.formData.createdBy = this.createdByArray.find(item => item.mobile === user.phone).staffId
} }
} }
this.getTableData() this.getTableData();
},
methods: {
close() {
this.pageType = "list"
},
handleRecord() {
this.showRecord="ture"
},
handleCancel(item) {
let parms = {
id: item.id,
};
this.$confirm("取消之后无法恢复,确认取消?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
requestPost('/actual/base/communityOneTablePublish/cancelTask', parms).then(res => {
if (res.code == 0) {
this.pageNo = 1
this.getTableData()
}
})
})
.catch((err) => {
if (err == "cancel") {
}
});
},
async getStafflist() {
let parms = {
orgId: this.$store.state.user.agencyId,
orgType: 'agency',
pageNo: 1,
pageSize: 100,
};
let { data, code } = await requestPost('/data/aggregator/org/stafflist', parms)
if (code === 0) {
this.createdByArray = data.staffList;
}
},
handleShowPage() {
this.pageType = 'list';
this.getTableData()
},
handleAdd() {
this.pageType = 'add';
},
handleInfo(item) {
this.task = item.id
this.pageType = 'info'
},
getLastItem(list, vals, key) {
let LIST = list || [];
for (let item of LIST) {
for (let i of vals) {
if (item[key] === i) {
this.sarr.push(item);
} else {
this.getLastItem(item.subAgencyList, vals, key);
}
}
}
},
handleSizeChange(val) {
this.pageSize = val;
window.localStorage.setItem("pageSize", val);
this.getTableData();
},
handleCurrentChange(val) {
this.pageNo = val;
this.getTableData();
},
async getTableData() {
const url = "/actual/base/intellgentizeReport/list";
const { pageSize, pageNo, formData } = this;
const { data, code, msg } = await requestGet(url, {
pageSize,
pageNo,
...formData
});
if (code === 0) {
this.total = data.total || 0;
this.tableData = data.list
? data.list.map((item) => {
return item;
})
: [];
} else {
this.$message.error(msg);
}
},
handleSearch() {
this.pageNo = 1;
this.getTableData();
},
handleDel(item) {
let parms = {
id: item.id,
};
this.$confirm("删除之后无法恢复,确认删除?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
requestPost('/actual/base/communityOneTablePublish/delete', parms).then(res => {
if (res.code == 0) {
this.getTableData()
}
})
})
.catch((err) => {
if (err == "cancel") {
}
});
},
resetSearch() {
this.$refs.ref_searchform.resetFields();
this.pageNo = 1;
const user = this.$store.state.user;
if (user) {
if (user.roleList.findIndex(item => item === "manager") !== -1) {
this.manager = false;
} else {
this.manager = true;
this.formData.createdBy = this.createdByArray.find(item => item.mobile === user.phone).staffId
}
}
this.getTableData();
},
}, },
}; },
</script> };
</script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "@/assets/scss/modules/management/list-main.scss"; @import "@/assets/scss/modules/management/list-main.scss";
.m-search { .m-search {
.u-item-width-normal { .u-item-width-normal {
width: 200px; width: 200px;
}
} }
</style> }
</style>
Loading…
Cancel
Save