Browse Source

发布任务

luckysheet_xiaowang
是小王呀\24601 6 months ago
parent
commit
2a7e473494
  1. 71
      src/views/modules/base/smartExcel/cpts/picture-Info.vue
  2. 329
      src/views/modules/base/smartExcel/cpts/share-excel.vue
  3. 14
      src/views/modules/base/smartExcel/sharedSpace.vue

71
src/views/modules/base/smartExcel/cpts/picture-Info.vue

@ -1,42 +1,23 @@
<template> <template>
<div> <div style="margin: 50px; text-align: center; ">
<div class="dialog-h-content scroll-h"> <div class="dialog-h-content scroll-h">
<el-form ref="ref_form" :inline="true" :model="formData" :rules="dataRule" class="form"> <div class="flex" style="display: flex; flex-direction: column;height: 400px;">
<el-row> <img :src="formData.src" style="height: 200px; width: 250px;margin-bottom: 20px;">
<span style="text-align: left;margin-bottom: 20px;">{{ formData.title }}</span>
<span style="text-align: left; color: #94a1b7;margin-bottom: 20px;">{{ formData.title }}</span>
<span style="text-align: left; color: #94a1b7;margin-bottom: 20px;">图片尺寸{{ formData.title }} 文件大小{{ formData.title }}
文件格式:{{ formData.title }}</span>
<el-button type="primary" style=" text-align: left;width: 70px;" @click="handleComfirm"> </el-button>
</div>
<el-col :span="24">
<el-form-item label="图片集名称" prop="title" label-width="150px">
<el-input v-model.trim="formData.title" size="small" clearable placeholder="请输入图片集名称(30字以内)"
class="u-item-width-normal"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="图片集封面" label-width="150px" prop="fileList">
<template>
<upload-image :defaultFileList="fileList" :limit="1" @change="onChangeFileList"
@file-removed="removedImg"></upload-image>
</template>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label-width="150px" label="共享范围" prop="columnId">
<el-select v-model="formData.columnId" placeholder="仅本组织内共享" clearable>
<el-option v-for="item in sharingScopeList" :key="item.value" :label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div> </div>
<div class="div_btn"> <!-- <div class="div_btn">
<el-button size="small" @click="handleCancle"> </el-button> <el-button size="small" @click="handleCancle"> </el-button>
<el-button size="small" v-if="formType != 'detail'" type="primary" :disabled="btnDisable" <el-button size="small" v-if="formType != 'detail'" type="primary" :disabled="btnDisable"
@click="handleComfirm"> </el-button> @click="handleComfirm"> </el-button>
</div> </div> -->
</div> </div>
</template> </template>
@ -62,26 +43,11 @@
data() { data() {
return { return {
fileList:[], fileList:[],
sharingScopeList:[
{
value:"0",
label:"仅本部门内共享"
},
{
value:"1",
label:"本级和直接下级组织共享"
},
{
value:"2",
label:"本级和直接上级组织共享"
},
{
value:"3",
label:"本级和直接上下级组织共享"
},
],
formData: formData:
{ {
id:"1001",
src:"https://elink-esua-epdc.oss-cn-qingdao.aliyuncs.com/epmet-saas/dev/20250224/8b8a174ea85e48e684267ce1a3f10dd1.jpg",
title:"嘉定山社区网格巡查"
}, },
corganizerList: [], corganizerList: [],
uploadUrl: window.SITE_CONFIG['apiURL'] + '/oss/file/uploadqrcodeV2', uploadUrl: window.SITE_CONFIG['apiURL'] + '/oss/file/uploadqrcodeV2',
@ -211,7 +177,12 @@
async handleComfirm() { async handleComfirm() {
this.addActivity() const link = document.createElement('a');
link.href = this.formData.src;
link.download = this.formData.title;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}, },
async addActivity() { async addActivity() {
let url = '/voluntary/newsTrends/saveOrUpdate' let url = '/voluntary/newsTrends/saveOrUpdate'

329
src/views/modules/base/smartExcel/cpts/share-excel.vue

@ -0,0 +1,329 @@
<template>
<div class='flex'>
<div :class="['flex', 'flex-y', 'flex1', sheetTotal ? 'luckysheet-wrap' : '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="success" @click="onClickUplond()"> 数据列表导出</el-button>
</div>
<div>
<el-button type="danger"
@click="handleClickCurrencyEvent('rejected')"> 取消</el-button>
<el-button type="primary"
@click="handleClickCurrencyEvent('submit')"> 提交</el-button>
</div>
</div>
<div id="luckysheet"></div>
</div>
<el-dialog title="数据列表导出" v-if="showUploadData" :visible.sync="showUploadData" width="60%"
:close-on-click-modal="false">
<excelUploadData @handleUploadDataHide="handleUploadDataHide" :currentTable="currentTable"
:btnLoading="btnLoading">
</excelUploadData>
</el-dialog>
</div>
</template>
<script>
import excelUploadData from './excel-upload-data.vue';
import LuckyExcel from 'luckyexcel';
import options from "@/utils/luckysheetConfig.js";
import { mapGetters } from 'vuex'
import { requestPost, requestGet } from "@/js/dai/request";
import nextTick from "dai-js/tools/nextTick";
export default {
data() {
return {
showUploadData: false,
menuList: [],
menuActive: 0,
socket: null,
currentTable: null,
currentId: '',
btnLoading: false,
};
},
props: {
workbookId: {
type: String,
default: ''
},
pageType: {
type: String,
default: ''
},
sheetTotal: {
type: Boolean,
default: false
},
infoObj: {
type: Object,
default: () => { }
},
mergeObj: {
type: Object,
default: () => { }
},
userId: {
type: String,
default: ''
},
taskStateName: {
type: String,
default: ""
},
},
computed: {
tableHeight() {
return (this.clientHeight - 140) + 'px'
},
...mapGetters(['clientHeight', 'resolution']),
},
async created() {
},
watch: {},
async mounted() {
console.log( "dskjlfsdklf");
// if (this.sheetTotal) {
// this.currentId = this.workbookId;
// this.loadWorkBook()
// } else {
// this.getTaskList()
// }
this.loadWorkBook()
},
methods: {
handleClickCurrencyEvent(){
var objsheet = luckysheet.getAllSheets()[0] //
console.log(objsheet,"打算离开房间四点零分");
// this.options = objsheet //
// this.postsheet()
},
// async postsheet() {
// var strsheet = await JSON.stringify(this.options)//
// const sheetinfo = { id: 1, filename: strsheet }//
// // await updata(sheetinfo)//
// },
async handleClickInspect() {
// celldatalist
const list = luckysheet.getAllSheets()[0].celldata.map(item => ({
r: item.r,
c: item.c,
v: item.v.v || ''
}));
//
let { data, code, msg } = await requestPost('/actual/base/intelligentImportData/checkData', list);
if (code === 0) {
if (data && data.length > 0) {
for (const { r, c } of data) {
luckysheet.setCellFormat(r, c, 'bg', '#f5504a');
}
const findArr = this.findUniqueElements(luckysheet.getAllSheets()[0].celldata, data);
findArr.forEach(({ r, c, v }) => {
if (v.bg === "#f5504a") {
luckysheet.setCellFormat(r, c, 'bg', '#ffffff');
}
});
} else {
this.$message.success('没有找到异常');
}
}
},
findUniqueElements(A, B) {
// Brc
const bCombinations = new Set(B.map(item => `${item.r},${item.c}`));
// AB
return A.filter(item => !bCombinations.has(`${item.r},${item.c}`));
},
onClickUplond() {
this.showUploadData = true;
let list = luckysheet.getAllSheets()
this.currentTable = list.filter(item => item.status == '1')
},
async handleUploadDataHide(val) {
this.showUploadData = false;
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 => {
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)//
luckysheet.setRangeValue(newArray, {
range: `A${this.sheetR + 2}:${bottomRightCorner}${this.sheetR + val.length}`,
})
},
//
numberToLetter(num) {
let letter = '';
while (num > 0) {
num -= 1; // 0 1 -> 'A'2 -> 'B'...
letter = String.fromCharCode(num % 26 + 65) + letter; // 65 'A' Unicode
num = Math.floor(num / 26);
}
return letter;
},
handleCellEditBefore(){
console.log("sdfk;s.dkf");
},
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.updateUrl = `${process.env.VUE_APP_SOCKET_SERVER}/actual/base/ws/luckysheet/${this.currentId}/${id}`
// options.loadSheetUrl = `${process.env.VUE_APP_API_SERVER}/actual/base/luckySheet/workbook/loadSheets`
window.luckysheet.create({
...options,
hook: {
cellEditBefore: this.handleCellEditBefore,
sheetCreateAfter: this.handleSheetCreateAfter,
},
});
},
handleSheetCreateAfter(e) {
console.log('setsheet', e);
},
handelClickBack() {
this.$emit('close')
},
},
components: {
excelUploadData
},
components: {
excelUploadData
},
beforeDestroy() {
this.$store.state.sidebarFold = false;
if (this.socket) {
this.socket.close();
}
},
};
</script>
<style lang="scss" scoped>
.el-card {
margin: 10px auto;
padding: 0 16px;
box-sizing: border-box;
width: calc(100% - 40px);
border: none;
}
.luckysheet-wrap {
margin: 10px;
padding: 0px;
z-index: 2;
width: calc(100vw - 400px);
height: calc(100vh - 250px);
}
.luckysheet-wrap-all {
margin: 10px;
padding: 0px;
z-index: 2;
width: calc(100vw - 100px);
height: calc(100vh - 250px);
}
#luckysheet {
width: 100%;
padding: 0px;
z-index: 2;
height: calc(100% - 80px);
margin: 10px;
}
.top_btn {
height: 60px;
width: 100%;
}
.upload-demo {
position: absolute;
z-index: 999999;
margin: 20px 0 0 22px;
}
.right-slider {
position: absolute;
z-index: 999999;
border: 1px solid #eeeeee;
box-shadow: -5px 0px 5px 0px rgba(0, 0, 0, 0.2);
background: #ffffff;
margin: 10px 0 0 22px;
right: 10px;
width: 36%;
height: calc(100% - 20px);
}
.el-header,
.el-footer {
text-align: left;
line-height: 40px;
padding-top: 0;
padding-bottom: 0;
}
.el-main {
text-align: left;
line-height: 40px;
padding-top: 0;
padding-bottom: 0;
}
.el-container {
display: flex;
height: 100%;
flex-direction: column;
}
.left_menu {
width: 240px;
.menu_item {
cursor: pointer;
padding: 10px 16px;
box-sizing: border-box;
margin-bottom: 5px;
background-color: #f2f8fd;
border-radius: 5px;
font-size: 14px;
}
.active {
color: #3989eb;
}
}
</style>

14
src/views/modules/base/smartExcel/sharedSpace.vue

@ -30,7 +30,7 @@
</el-table-column> </el-table-column>
<el-table-column prop="taskStateName" align="center" width="100" label="状态" :show-overflow-tooltip="true"> <el-table-column prop="taskStateName" align="center" width="100" label="状态" :show-overflow-tooltip="true">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.taskStateName <span :class="scope.row.taskStateName=='(已保存)未提交'?'yellow':scope.row.taskStateName=='已提交'?'blue':scope.row.taskStateName=='(已驳回)未提交'?'red':'green'">{{ scope.row.taskStateName
}}</span> }}</span>
</template> </template>
</el-table-column> </el-table-column>
@ -338,6 +338,18 @@
} }
}
.yellow{
color: #ddaa5d;
}
.blue{
color: #4e89ec;
}
.red{
color: #fc2b3b;
}
.green{
color: #2fcbbd;
} }
.f-align_item { .f-align_item {
width: 100px; width: 100px;

Loading…
Cancel
Save