You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

138 lines
3.3 KiB

<template>
<lay-container fluid="true" class="content-box">
<lay-table v-if="dataList.length>0" height="300px" :columns="dataColumn" :data-source="dataList"
:row-style="rowStyle">
<template v-slot:toolbar v-if="dataObj&&dataObj.FState!=2">
<lay-button size="sm" @click="_getGroup" type="danger">获取组编号</lay-button>
</template>
</lay-table>
<OperateLog v-if="dataInfoObj.FTeamID" ref="OperateLog" :dataInfoObj="dataInfoObj"></OperateLog>
</lay-container>
</template>
<style scoped>
.content-box {
margin: 30px 10px;
display: block;
position: relative;
clear: both;
float: none;
height: 664px;
}
</style>
<script>
import {
ref
} from 'vue';
import {
getTeamworkView
} from "/src/api/api/teamwork";
import {
dockMaterialGroup
} from "/src/api/api/task";
import OperateLog from "./OperateLog.vue";
export default {
components: {
OperateLog
},
setup() {
const dataColumn = ref([]);
const dataList = ref([]);
const dataObj = ref({});
const dataColor = ref([]);
let colors = ["1E9FFF", "009688", "393D49", "5FB878"];
const rowStyle = function(row, rowIndex) {
let color = "";
for (let idx = 0; idx < dataColor.value.length; idx++) {
if (rowIndex > dataColor.value[idx]) color = "color:#" + colors[idx];
}
return color;
}
return {
dataColumn,
dataList,
dataColor,
rowStyle,
dataObj
}
},
props: {
dataInfoObj: {
type: Object,
default: () => [],
}
},
mounted() {
this.dataObj = JSON.parse(JSON.stringify(this.dataInfoObj));
console.log(this.dataObj)
this.getViewList();
},
methods: {
async getViewList() {
let postData = {
FTeamID: this.dataObj.FTeamID,
FViewType: 4,
FType: "1"
};
if (this.dataObj.FState == 2) postData.FFinish = 1;
let idx = layer.load(2);
let result = await getTeamworkView(postData);
let tempList = [];
for (let key in result) {
if (tempList.length == 0) tempList.push(result[key]);
};
let dataColumn = [];
let dataList = [];
let dataColor = []
tempList.forEach((item) => {
if (item.length > 0) {
if (dataColumn.length == 0) {
for (let key in item[0]) {
let width = (key.indexOf("描述") != -1 || key == "文本" || key == "物料") ? "280px" :
"130px";
width = key.indexOf("编码") != -1 ? "200px" : width;
dataColumn.push({
key: key,
title: key.split('.').pop(),
align: "center",
width: width
});
}
}
item.forEach((item2) => {
dataList.push(item2);
});
dataColor.push(dataList.length - 1);
}
});
this.dataColumn = dataColumn;
this.dataList = dataList;
this.dataColor = dataColor;
layer.close(idx);
},
async _getGroup() {
let idx = layer.load(2);
try {
let result = await dockMaterialGroup({
FTeamID: this.dataObj.FTeamID
});
if (result > 0) {
layer.msg('获取组编号成功');
this.getViewList();
this.dataObj.FState = 2;
} else {
layer.msg('获取组编号失败');
}
} catch (e) {}
layer.close(idx);
this.$refs.OperateLog._getPageList();
},
cancelClick(isRefresh) {
isRefresh = isRefresh == undefined ? false : isRefresh;
this.$emit('cancelClick', isRefresh);
}
}
}
</script>