Browse Source

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

luckysheet_xiaowang
mk 1 year ago
parent
commit
2348002b7b
  1. 1
      src/views/modules/base/smartExcel/cpts/excel-template-confirmation.vue
  2. 137
      src/views/modules/base/smartExcel/cpts/excel-upload-data.vue
  3. 106
      src/views/modules/base/smartExcel/cpts/export-view.vue
  4. 486
      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(){
let boolean = this.exportJson.sheets[0].data[1].every(item => !item || !item.v);
console.log(boolean);
if(boolean){
this.$emit('saveLuckysheetJson',this.exportJson)
}else{

137
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;">
<el-form :model="formData" :rules="rules" ref="ref_form" :label-width="'120px'" v-if="pageType === 'report'">
<el-form-item label="标题名称" prop="reportName">
<el-input v-model.trim="formData.reportName" size="small" clearable style=" height: 40px;"
placeholder="请输入">
<el-input v-model.trim="formData.reportName" size="small" clearable style=" height: 40px;" placeholder="请输入">
</el-input>
</el-form-item>
</el-form>
<div class="flex" style="margin: 60px 0;">
<div class="flex" style="margin: 60px 0;">
<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;"
v-for="(item, index) in dataSourceList">
@ -30,7 +29,8 @@
</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-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">
@ -65,22 +65,23 @@
</el-table>
</div>
<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 v-show="progress == 3" style="height: 400px; overflow-y: scroll;margin: 60px 0;">
<div v-if="formData1.importCategory === 'BASEINFO'">
<resi-search ref="resi_form"></resi-search>
</div>
<div v-else>
<HoseSearch ref="house_form"/>
<HoseSearch ref="house_form" />
</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>
<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 type="primary" @click="onClickNext()" >下一步</el-button>
</span>
<el-button v-if="progress != 1" @click="progress = progress - 1">上一步</el-button>
<el-button type="primary" @click="onClickNext()">下一步</el-button>
</span>
</div>
</div>
@ -138,20 +139,20 @@ export default {
// status:0
// },
],
rules:{
reportName:[{ required: true, message: this.$t('validate.required'), trigger: 'blur' }]
rules: {
reportName: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }]
},
formData: {
columnMateJson: '',
searchForm: {},
formCode:'',
reportName:''
formCode: '',
reportName: ''
},
resident_category_import_list: [],
groupList: [],
fileCode: null,
dataList: [],
dataListLoading:false,
dataListLoading: false,
};
},
props: {
@ -171,9 +172,13 @@ export default {
type: Array,
default: () => []
},
pageType:{
pageType: {
type: String,
default: "excel"//excel report
},
workBookId:{
type:String,
default:"excel"//excel report
default:()=>{}
}
},
created() {
@ -181,9 +186,9 @@ export default {
},
methods: {
toSmartImport(){
this.$router.push({path:'/main/base-smartImport'})
this.$emit('handleUploadDataHide',null)
toSmartImport() {
this.$router.push({ path: '/main/base-smartImport' })
this.$emit('handleUploadDataHide', null)
},
onClickTab(value) {
this.formData1 = {}
@ -199,36 +204,21 @@ export default {
},
onClickNext() {
if (this.progress === 1) {
if(this.pageType == 'report'){
this.$refs['ref_form'].validate((valid)=>{
if (this.pageType == 'report') {
this.$refs['ref_form'].validate((valid) => {
if (!valid) {
return false
}else{
} else {
this.progress = 2;
}
})
}else{
} else {
this.progress = 2;
this.dataListLoading = true;
this.checkExtractExcelHead()
}
} else if (this.progress === 2) {
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'){
if (this.pageType === 'report') {
this.formData.columnsJson = this.$refs['report_form'].rightList.map(item => {
return {
itemId: item.id,
@ -238,10 +228,32 @@ export default {
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.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
}else{
} else {
this.formData.formCode = this.formData1.importCategory
delete this.formData.reportName
}
@ -249,11 +261,14 @@ export default {
}
},
async saveUploadForm() {
const url = this.pageType === 'report'?'/actual/base/intellgentizeReport/create':'/actual/base/residentBaseInfo/exportOneSheet'
const { data, code, msg } = await requestPost(url, this.formData)
const url = this.pageType === 'report' ? '/actual/base/intellgentizeReport/create' : '/actual/base/residentBaseInfo/exportOneSheet'
let { data, code, msg } = await requestPost(url, this.formData)
if (code === 0) {
this.dataListLoading = false;
this.$emit('handleUploadDataHide',data)
if (this.pageType === 'report') {
data = { columnsJson: this.formData.columnsJson, id: data }
}
this.$emit('handleUploadDataHide', data)
} else {
console.log(msg);
}
@ -291,22 +306,22 @@ export default {
let columnMateStr = '';
let foundFirstValue = false; //
for (let item of this.currentTable[0].data[0]) {
if (!foundFirstValue) {
//
if (!item || item.v === '') {
columnMateStr += '空;'; // ""
} else {
columnMateStr += item.v + ';'; //
foundFirstValue = true; //
}
if (!foundFirstValue) {
//
if (!item || item.v === '') {
columnMateStr += '空;'; // ""
} else {
//
if (!item || item.v === '') {
break; //
} else {
columnMateStr += item.v + ';'; //
}
columnMateStr += item.v + ';'; //
foundFirstValue = true; //
}
} else {
//
if (!item || item.v === '') {
break; //
} else {
columnMateStr += item.v + ';'; //
}
}
}
//
columnMateStr = columnMateStr.slice(0, -1);
@ -353,7 +368,7 @@ export default {
this.createdTime = createdTime;
},
},
components: {resiSearch,HoseSearch,exportProcessTwo},
components: { resiSearch, HoseSearch, exportProcessTwo },
computed: {},
watch: {},
};

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

@ -3,15 +3,13 @@
<div :class="['flex', 'flex-y', 'flex1', 'luckysheet-wrap-all']">
<div class="top_btn flex flex-end">
<div>
<el-button type="text" round @click="handelClickBack"
icon="el-icon-back">返回</el-button>
<el-button type="warning" @click="handleClickInspect">上传统计模板
</el-button>
<el-button type="text" round @click="handelClickBack" icon="el-icon-back">返回</el-button>
<el-button type="warning" @click="handleClickInspect">上传统计模板
</el-button>
<el-button type="success" @click="onClickUplond()"> 数据列表导出</el-button>
</div>
<div>
<el-button type="primary"
@click="handleClickCurrencyEvent('submit')"> 导出</el-button>
<el-button type="primary" @click="handleClickCurrencyEvent('submit')"> 导出</el-button>
</div>
</div>
<div id="luckysheet"></div>
@ -19,7 +17,7 @@
<el-dialog title="数据列表导出" v-if="showUploadData" :visible.sync="showUploadData" width="60%"
:close-on-click-modal="false">
<excelUploadData @handleUploadDataHide="handleUploadDataHide" :currentTable="currentTable"
:btnLoading="btnLoading" :pageType='`report`'>
:btnLoading="btnLoading" :pageType='`report`' :workBookId="workBookId" @saveLuckysheetHead="saveLuckysheet">
</excelUploadData>
</el-dialog>
</div>
@ -31,7 +29,7 @@ import options from "@/utils/luckysheetConfig.js";
import { mapGetters } from 'vuex'
import { requestPost, requestGet } from "@/js/dai/request";
import nextTick from "dai-js/tools/nextTick";
import { exportSheetExcel } from "@/utils/export";
export default {
data() {
@ -43,11 +41,18 @@ export default {
currentTable: null,
currentId: '',
btnLoading: false,
sheetR:0
workBookId: ''
};
},
props: {
pageType: {
type: String,
default: ''
},
infoIds: {
type: Object,
default: () => { }
}
},
computed: {
tableHeight() {
@ -55,53 +60,75 @@ export default {
},
...mapGetters(['clientHeight', 'resolution']),
},
created() {
created() {
},
watch: {},
async mounted() {
this.loadWorkBook()
await this.loadWorkBook()
if (this.pageType === 'info') {
await this.getSheetList()
}
},
methods: {
handleClickCurrencyEvent(){
exportSheetExcel(luckysheet.getAllSheets(),'导出文件')
async getSheetList() {
const { data, code } = await requestGet('/actual/base/intellgentizeReport/detail', { id: this.infoIds.id })
if (code === 0) {
console.log(data);
}
},
async handleClickInspect() {
handleClickCurrencyEvent() {
exportSheetExcel(luckysheet.getAllSheets(), '导出文件')
},
//
async handleClickInspect() {
},
onClickUplond() {
this.showUploadData = true;
let list = luckysheet.getAllSheets()
this.currentTable = list.filter(item => item.status == '1')
},
async handleUploadDataHide(val) {
this.showUploadData = false;
let listData = await this.getListData(val.id)
luckysheet.insertRow(this.currentTable[0].data.length, 1)
const findLastNonNullIndex = (arr) => {
for (let i = arr.length - 1; i >= 0; i--) {
const subArray = arr[i];
// null
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 => {
luckysheet.insertRow(this.currentTable[0].data.length, { number: listData.length });
this.showUploadData = false;
await nextTick(500)
let newArray = listData.map(obj => {
return Object.keys(obj).map(key => {
return { m: obj[key], "ct": { "fa": "General", "t": "g" }, v: obj[key] };
});
});
console.log(newArray, '处理后数据');
let bottomRightCorner = this.numberToLetter(Object.keys(val[0]).length)//
let bottomRightCorner = this.numberToLetter(Object.keys(listData[0]).length)//
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) {
@ -115,11 +142,14 @@ export default {
},
loadWorkBook() {
window.luckysheet.destroy();
const { id } = this.$store.state.user;
options.gridKey = this.currentId;
options.allowUpdate = true;
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}`
window.luckysheet.create({
...options,

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

@ -4,23 +4,11 @@
<div class="m-search">
<el-form :inline="true" :model="formData" ref="ref_searchform" :label-width="'100px'">
<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-input v-model.trim="formData.taskTitle" class="u-item-width-normal" size="small" clearable
placeholder="请输入">
</el-input>
</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-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"
@ -49,10 +37,12 @@
</div>
<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 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">
<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>
</el-table-column>
<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">
<template slot-scope="scope">
<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>
</el-table-column>
</el-table>
@ -77,8 +68,8 @@
</div>
</div>
</div>
<div class="m-search" v-if="pageType=='add'">
<exportlView @close="close" ></exportlView>
<div class="m-search" v-if="pageType == 'add' || pageType == 'info'">
<exportlView @close="close" :pageType="pageType" :infoIds="infoIds" v-if="pageType == 'add' || pageType == 'info'"></exportlView>
</div>
<div v-if="showRecord">
<el-dialog title="导出记录" :visible.sync="showRecord" width="50%" :close-on-click-modal="false">
@ -87,92 +78,244 @@
</div>
</div>
</template>
<script>
import exportlView from "./cpts/export-view.vue";
import { requestPost, requestGet } from "@/js/dai/request";
import nextTick from "dai-js/tools/nextTick";
import { mapGetters } from "vuex";
import excelInfo from "./cpts/excel-info";
import excelAdd from "./cpts/excel-add";
import exportRecord from "./cpts/export-record";
export default {
components: { excelInfo, excelAdd,exportRecord,exportlView },
data() {
let endDisabledDate = (time) => {
//datareturn
let nowData = Date.now();
if (this.formData.startTime) {
let startTime = new Date(this.formData.startTime);
return (
time.getTime() > nowData ||
time.getTime() < startTime ||
time.getTime() === startTime
);
} else {
return time.getTime() > nowData;
}
};
let startDisabledDate = (time) => {
//datareturn
let nowData = Date.now();
<script>
import exportlView from "./cpts/export-view.vue";
import { requestPost, requestGet } from "@/js/dai/request";
import nextTick from "dai-js/tools/nextTick";
import { mapGetters } from "vuex";
import excelInfo from "./cpts/excel-info";
import excelAdd from "./cpts/excel-add";
import exportRecord from "./cpts/export-record";
export default {
components: { excelInfo, excelAdd, exportRecord, exportlView },
data() {
let endDisabledDate = (time) => {
//datareturn
let nowData = Date.now();
if (this.formData.startTime) {
let startTime = new Date(this.formData.startTime);
return (
time.getTime() > nowData ||
time.getTime() < startTime ||
time.getTime() === startTime
);
} else {
return time.getTime() > nowData;
};
return {
showRecord:false,
task: "",
pageType: "list", // list add info
tableData: [],
formData: {
orgId: '',//Id
taskTitle: '',//
taskType: '',//
startTime: '',//
endTime: '',//
createdBy: ''//
},
pageNo: 1,
pageSize: window.localStorage.getItem("pageSize") || 20,
total: 1,
sarr: [],
endPickerOptions: {
disabledDate: endDisabledDate,
}
};
let startDisabledDate = (time) => {
//datareturn
let nowData = Date.now();
return time.getTime() > nowData;
};
return {
showRecord: false,
infoIds: {},
pageType: "list", // list add info
tableData: [],
formData: {
orgId: '',//Id
taskTitle: '',//
taskType: '',//
startTime: '',//
endTime: '',//
createdBy: ''//
},
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: [],
statusArray: [
{
label: '已完成',
value: 'resolved'
},
{
label: '已取消',
value: 'cancel',
},
{
label: '进行中',
value: 'deal',
{
label: '进行中',
value: 'deal',
}
],
manager: false
};
},
computed: {
maxTableHeight() {
const h = this.clientHeight - this.searchH - 275;
const _h = this.clientHeight - 275 - this.searchH;
return this.$store.state.inIframe ? h : _h;
},
...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: {
maxTableHeight() {
const h = this.clientHeight - this.searchH - 275;
const _h = this.clientHeight - 275 - this.searchH;
return this.$store.state.inIframe ? h : _h;
},
...mapGetters(["clientHeight"]),
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()
},
watch: {
handleAdd() {
this.pageType = 'add';
},
async mounted() {
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();
},
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;
await this.getStafflist()
if (user) {
if (user.roleList.findIndex(item => item === "manager") !== -1) {
this.manager = false;
@ -181,149 +324,18 @@
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>
<style lang="scss" scoped>
@import "@/assets/scss/modules/management/list-main.scss";
.m-search {
.u-item-width-normal {
width: 200px;
}
},
};
</script>
<style lang="scss" scoped>
@import "@/assets/scss/modules/management/list-main.scss";
.m-search {
.u-item-width-normal {
width: 200px;
}
</style>
}
</style>
Loading…
Cancel
Save