|
@@ -1,5 +1,6 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
+ <div v-if="pageType !== 'edit'" v-html="analyticFeedback" />
|
|
|
<el-table
|
|
|
:data="tableData"
|
|
|
border
|
|
@@ -11,33 +12,51 @@
|
|
|
'font-size': '14px',
|
|
|
'font-weight': '500'
|
|
|
}"
|
|
|
- :cell-style="{ 'font-size': '14px', color: 'rgba(102,102,102,1)' }"
|
|
|
+ :cell-style="{ 'font-size': '14px', color: 'rgb(102,102,102)' }"
|
|
|
size="small"
|
|
|
show-overflow-tooltip="true"
|
|
|
>
|
|
|
+ <!-- <el-table-column v-if="index === 0 && tabsActive.indexOf('本月重点问题') > -1
|
|
|
+ && pageType !== 'edit' ? 'expand' : ''" label="展开" type="expand"> -->
|
|
|
<el-table-column
|
|
|
- v-for="(item, index) in columns"
|
|
|
+ v-for="(item, index) in setColumns(columns)"
|
|
|
:key="item.headerKey"
|
|
|
:data-index="index"
|
|
|
:prop="item.headerKey"
|
|
|
- :align="index === 0 ? 'left' : 'center'"
|
|
|
+ :align="item.align"
|
|
|
:label="item.name"
|
|
|
+ :type="item.type"
|
|
|
:min-width="setMinWidth(item)"
|
|
|
:fixed="isFixed(item, index, columns)"
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
+ <!-- 展开 -->
|
|
|
+ <div v-if="item.type === 'expand'">
|
|
|
+ <TableExpandRow :analytic-feedback="scope.row.analyticFeedback" @upAnalyticFeedback="setAnalyticFeedback" />
|
|
|
+ </div>
|
|
|
<!-- 操作列 -->
|
|
|
- <div v-if="item.name === '操作'">
|
|
|
- <el-button
|
|
|
+ <div v-else-if="item.name === '操作'">
|
|
|
+ <span
|
|
|
v-for="(btnItem, btnIndex) in item.defaultValue"
|
|
|
:key="btnIndex"
|
|
|
- size="mini"
|
|
|
- type="text"
|
|
|
- @click="btnFun(btnItem, scope)"
|
|
|
- >{{ btnItem.value }}</el-button
|
|
|
>
|
|
|
+ <el-button
|
|
|
+ v-if="
|
|
|
+ scope.row.analyticFeedback &&
|
|
|
+ !scope.row.analyticFeedback.isCommitted
|
|
|
+ "
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ @click="btnFun(btnItem, scope)"
|
|
|
+ >{{ btnItem.value }}</el-button
|
|
|
+ >
|
|
|
+ </span>
|
|
|
</div>
|
|
|
- <div v-else class="edit-wrapper">
|
|
|
+ <div
|
|
|
+ v-else
|
|
|
+ class="edit-wrapper"
|
|
|
+ :style="{ cursor: pageType === 'edit' ? 'pointer' : 'auto' }"
|
|
|
+ >
|
|
|
<!-- <div v-if="editKeys.indexOf(`${scope.row.rowKey}_${index}`) > -1"> -->
|
|
|
<div v-if="editKeys.indexOf(domKey) > -1 && !item.defaultValue">
|
|
|
<div v-if="item.displayType === 'Select'">
|
|
@@ -52,14 +71,30 @@
|
|
|
placeholder="选择日期"
|
|
|
/>
|
|
|
</div>
|
|
|
- <div v-else-if="item.selectType && item.selectType === 'SinglePeople'">
|
|
|
+ <div
|
|
|
+ v-else-if="
|
|
|
+ item.selectType && item.selectType === 'SinglePeople'
|
|
|
+ "
|
|
|
+ >
|
|
|
<searchPeople :value.sync="scope.row[item.headerKey]" />
|
|
|
</div>
|
|
|
- <div v-else-if="item.selectType && item.selectType === 'MultiplePeople'">
|
|
|
- <searchPeople :value.sync="scope.row[item.headerKey]" :multiple="true" />
|
|
|
+ <div
|
|
|
+ v-else-if="
|
|
|
+ item.selectType && item.selectType === 'MultiplePeople'
|
|
|
+ "
|
|
|
+ >
|
|
|
+ <searchPeople
|
|
|
+ :value.sync="scope.row[item.headerKey]"
|
|
|
+ :multiple="true"
|
|
|
+ />
|
|
|
</div>
|
|
|
- <div v-else-if="item.selectType && item.selectType === 'people'">
|
|
|
- <searchPeople :value.sync="scope.row[item.headerKey]" :multiple="true" />
|
|
|
+ <div
|
|
|
+ v-else-if="item.selectType && item.selectType === 'people'"
|
|
|
+ >
|
|
|
+ <searchPeople
|
|
|
+ :value.sync="scope.row[item.headerKey]"
|
|
|
+ :multiple="true"
|
|
|
+ />
|
|
|
</div>
|
|
|
<el-select
|
|
|
v-else
|
|
@@ -74,7 +109,7 @@
|
|
|
:key="optionItem"
|
|
|
:label="optionItem"
|
|
|
:value="optionItem"
|
|
|
- >{{ optionItem }}</el-option
|
|
|
+ >{{ optionItem }}</el-option
|
|
|
>
|
|
|
</el-select>
|
|
|
</div>
|
|
@@ -97,7 +132,10 @@
|
|
|
collapse-tags
|
|
|
:props="{ multiple: true }"
|
|
|
clearable
|
|
|
- @change="(value)=>cascaderChange(value, item.headerKey,scope.row)" />
|
|
|
+ @change="
|
|
|
+ (value) => cascaderChange(value, item.headerKey, scope.row)
|
|
|
+ "
|
|
|
+ />
|
|
|
</div>
|
|
|
<div v-else-if="item.defaultValue === 'Select'" />
|
|
|
<el-input
|
|
@@ -110,9 +148,8 @@
|
|
|
placeholder="请输入"
|
|
|
/>
|
|
|
</div>
|
|
|
- <!-- <div v-else class="edit-cell" @click="editLine(scope.row, index)">-->
|
|
|
+ <!-- <div v-else class="edit-cell" @click="editLine(scope.row, index)"> -->
|
|
|
<div v-else class="edit-cell" @click="editLine(scope.row, index)">
|
|
|
-
|
|
|
<div v-if="item.displayType === 'Cascader'">
|
|
|
<CascaderInfo :team-data="scope.row[item.headerKey]" />
|
|
|
</div>
|
|
@@ -121,51 +158,71 @@
|
|
|
{{ item.defaultValue.value }}
|
|
|
</div>
|
|
|
<div v-else-if="item.displayType === 'Select'">
|
|
|
- <!-- 单个人员选择 -->
|
|
|
- <div v-if="item.selectType && item.selectType === 'SinglePeople'">
|
|
|
+ <!-- 单个人员选择 -->
|
|
|
+ <div
|
|
|
+ v-if="item.selectType && item.selectType === 'SinglePeople'"
|
|
|
+ >
|
|
|
<MultiplePeopleInfo :team-data="scope.row[item.headerKey]" />
|
|
|
</div>
|
|
|
<!-- 多个人员选择 -->
|
|
|
- <div v-else-if="item.selectType && item.selectType === 'MultiplePeople'">
|
|
|
- <!-- <searchPeople :value.sync="scope.row[item.headerKey]" :multiple="true" disabled />-->
|
|
|
+ <div
|
|
|
+ v-else-if="
|
|
|
+ item.selectType && item.selectType === 'MultiplePeople'
|
|
|
+ "
|
|
|
+ >
|
|
|
+ <!-- <searchPeople :value.sync="scope.row[item.headerKey]"
|
|
|
+ :multiple="true" disabled />-->
|
|
|
<MultiplePeopleInfo :team-data="scope.row[item.headerKey]" />
|
|
|
</div>
|
|
|
<!-- 多个人员选择 -->
|
|
|
- <div v-else-if="item.selectType && item.selectType === 'people'">
|
|
|
+ <div
|
|
|
+ v-else-if="item.selectType && item.selectType === 'people'"
|
|
|
+ >
|
|
|
<MultiplePeopleInfo :team-data="scope.row[item.headerKey]" />
|
|
|
</div>
|
|
|
<div v-else>
|
|
|
{{ scope.row[item.headerKey] }}
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div v-else>
|
|
|
- {{ scope.row[item.headerKey] }}
|
|
|
- </div>
|
|
|
+ <div v-else>
|
|
|
+ {{ scope.row[item.headerKey] }}
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
- <div class="plus-table-data" :style="{marginBottom: plusTableDataBottom}">
|
|
|
- <el-button
|
|
|
-type="text"
|
|
|
-@click="addTableData"
|
|
|
- ><svg-icon icon-class="data-plus" class="icon" /> 新增</el-button
|
|
|
- >
|
|
|
+ <div class="plus-table-data" :style="{ marginBottom: plusTableDataBottom }">
|
|
|
+ <el-button v-if="pageType === 'edit'" type="text" @click="addTableData">
|
|
|
+ <svg-icon icon-class="data-plus" class="icon" />
|
|
|
+ 新增
|
|
|
+ </el-button>
|
|
|
</div>
|
|
|
<slot name="fixedText" />
|
|
|
+ <Analysis ref="Analysis" @upData="upDataAnalysis" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import _ from 'lodash'
|
|
|
import { uuid10 } from '@/utils'
|
|
|
+import Analysis from './Analysis'
|
|
|
import CascaderInfo from './CascaderInfo'
|
|
|
import MultiplePeopleInfo from './MultiplePeopleInfo'
|
|
|
+import TableExpandRow from './TableExpandRow'
|
|
|
import searchPeople from '@/components/select/searchPeople' // 人员select
|
|
|
+import { updateAnalyticFeedback } from '@/api/qualityMonthlyReport/edit'
|
|
|
+import { reportDataBack } from '@/store/modules/monthlyReport/edit/utils.js'
|
|
|
|
|
|
export default {
|
|
|
name: 'MrTable',
|
|
|
- components: { CascaderInfo, searchPeople, MultiplePeopleInfo },
|
|
|
+ components: {
|
|
|
+ Analysis,
|
|
|
+ CascaderInfo,
|
|
|
+ searchPeople,
|
|
|
+ MultiplePeopleInfo,
|
|
|
+ TableExpandRow
|
|
|
+ },
|
|
|
props: {
|
|
|
plusTableDataBottom: {
|
|
|
type: String,
|
|
@@ -182,6 +239,12 @@ export default {
|
|
|
required: false,
|
|
|
default: () => []
|
|
|
},
|
|
|
+ // 分析反馈时使用的数据
|
|
|
+ title: {
|
|
|
+ type: String,
|
|
|
+ required: false,
|
|
|
+ default: () => ''
|
|
|
+ },
|
|
|
tableData: {
|
|
|
type: Array,
|
|
|
required: false,
|
|
@@ -189,25 +252,49 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
data() {
|
|
|
+ this.setAnalyticFeedback = _.debounce(this.setAnalyticFeedback, 3000)
|
|
|
return {
|
|
|
+ analyticFeedback: ''
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
selectEnum() {
|
|
|
return this.$store.state.monthlyReportEdit.selectEnum
|
|
|
},
|
|
|
+ tabPageData() {
|
|
|
+ return this.$store.state.monthlyReportEdit.tabPageData
|
|
|
+ },
|
|
|
+ pageType() {
|
|
|
+ return this.$store.state.monthlyReportEdit.pageType
|
|
|
+ },
|
|
|
+ tabsActive() {
|
|
|
+ return this.$store.state.monthlyReportEdit.tabsActive
|
|
|
+ },
|
|
|
editKeys() {
|
|
|
return this.$store.state.monthlyReportEdit.editKeys
|
|
|
}
|
|
|
},
|
|
|
+ mounted() {
|
|
|
+ setTimeout(() => {
|
|
|
+ if (!this.analyticFeedback) {
|
|
|
+ this.setAnalyticFeedback()
|
|
|
+ }
|
|
|
+ }, 3000)
|
|
|
+ },
|
|
|
methods: {
|
|
|
isEdit() {},
|
|
|
setMinWidth(item) {
|
|
|
- let width = 200
|
|
|
+ let width = 100
|
|
|
if (item.name === '操作') {
|
|
|
if (item.defaultValue.length) {
|
|
|
width = item.defaultValue.length * 50
|
|
|
}
|
|
|
+ if (
|
|
|
+ this.pageType !== 'edit' &&
|
|
|
+ this.tabsActive.indexOf('本月重点问题') > -1
|
|
|
+ ) {
|
|
|
+ width = 90
|
|
|
+ }
|
|
|
}
|
|
|
return `${width}px`
|
|
|
},
|
|
@@ -216,10 +303,9 @@ export default {
|
|
|
return false
|
|
|
},
|
|
|
editLine(row, index) {
|
|
|
- this.$store.commit(
|
|
|
- 'monthlyReportEdit/ADD_EDIT_KEYS',
|
|
|
- `${this.domKey}`
|
|
|
- )
|
|
|
+ if (this.pageType === 'edit') {
|
|
|
+ this.$store.commit('monthlyReportEdit/ADD_EDIT_KEYS', `${this.domKey}`)
|
|
|
+ }
|
|
|
},
|
|
|
btnFun(btnItem, scope) {
|
|
|
this.$store.commit('monthlyReportEdit/INIT_EDIT_KEYS')
|
|
@@ -229,12 +315,22 @@ export default {
|
|
|
if (btnItem.value === '标记') {
|
|
|
this.tableData.splice(scope.$index, 1)
|
|
|
}
|
|
|
+ if (btnItem.value === '分析反馈') {
|
|
|
+ console.log(293, btnItem, scope)
|
|
|
+ this.$refs.Analysis.open(scope.row.analyticFeedback, scope.$index)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 分析反馈问题更新
|
|
|
+ upDataAnalysis({ rowIndex, analyticFeedback }) {
|
|
|
+ console.log(rowIndex, analyticFeedback)
|
|
|
+ this.tableData[rowIndex].analyticFeedback = _.cloneDeep(analyticFeedback)
|
|
|
+ this.setAnalyticFeedback()
|
|
|
},
|
|
|
addTableData() {
|
|
|
const item = {
|
|
|
rowKey: uuid10()
|
|
|
}
|
|
|
- this.columns.forEach(elm => {
|
|
|
+ this.columns.forEach((elm) => {
|
|
|
item[elm.headerKey] = ''
|
|
|
})
|
|
|
this.tableData.push(item)
|
|
@@ -245,6 +341,86 @@ export default {
|
|
|
},
|
|
|
cascaderChange(value, headerKey, row) {
|
|
|
console.log(value, headerKey, row)
|
|
|
+ },
|
|
|
+ // 添加插入
|
|
|
+ setColumns(columns) {
|
|
|
+ let newColumns = _.cloneDeep(columns)
|
|
|
+ if (
|
|
|
+ this.pageType !== 'edit' &&
|
|
|
+ this.tabsActive.indexOf('本月重点问题') > -1
|
|
|
+ ) {
|
|
|
+ newColumns = [
|
|
|
+ {
|
|
|
+ dataType: 'Single',
|
|
|
+ defaultValue: null,
|
|
|
+ displayType: 'Cascader',
|
|
|
+ name: '',
|
|
|
+ align: 'left',
|
|
|
+ type: 'expand',
|
|
|
+ selectEnum: null,
|
|
|
+ selectType: null,
|
|
|
+ headerKey: uuid10(6)
|
|
|
+ },
|
|
|
+ ...newColumns
|
|
|
+ ]
|
|
|
+ newColumns[1].align = 'left'
|
|
|
+ }
|
|
|
+ newColumns.forEach((elm) => {
|
|
|
+ if (!elm.align) {
|
|
|
+ elm.align = 'center'
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if (
|
|
|
+ this.pageType !== 'edit' &&
|
|
|
+ this.tabsActive.indexOf('本月重点问题') < 0
|
|
|
+ ) {
|
|
|
+ newColumns.splice(newColumns.length - 1, 1)
|
|
|
+ }
|
|
|
+ return newColumns
|
|
|
+ },
|
|
|
+ arraySpanMethod({ row, column, rowIndex, columnIndex }) {
|
|
|
+ if (
|
|
|
+ columnIndex === 0 &&
|
|
|
+ this.tabsActive.indexOf('本月重点问题') > -1 &&
|
|
|
+ this.pageType !== 'edit'
|
|
|
+ ) {
|
|
|
+ return [1, 2]
|
|
|
+ } else if (columnIndex === 1) {
|
|
|
+ return [0, 0]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 查看页面数据分析
|
|
|
+ setAnalyticFeedback() {
|
|
|
+ // this.$refs.Analysis.open()
|
|
|
+ console.log(this.domKey)
|
|
|
+ const tabPageData = reportDataBack(_.cloneDeep(this.tabPageData))
|
|
|
+ let obj = null
|
|
|
+ const run = (arr) => {
|
|
|
+ arr.forEach((elm) => {
|
|
|
+ if (elm.content.length) {
|
|
|
+ elm.content.forEach((item) => {
|
|
|
+ if (item.domKey === this.domKey) {
|
|
|
+ console.log(elm)
|
|
|
+ obj = _.cloneDeep(elm)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ run(tabPageData.children)
|
|
|
+ console.log(obj)
|
|
|
+ // 提交数据
|
|
|
+ updateAnalyticFeedback({
|
|
|
+ reportId: this.$route.query.reportId,
|
|
|
+ reportCatalog: obj
|
|
|
+
|
|
|
+ }).then((res) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ console.log(res.data)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ // console.log(this.domKey)
|
|
|
+ // console.log(this.title)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -252,14 +428,45 @@ export default {
|
|
|
|
|
|
<style scoped lang="less">
|
|
|
.edit-wrapper {
|
|
|
- cursor: pointer;
|
|
|
-
|
|
|
.edit-cell {
|
|
|
min-height: 23px;
|
|
|
width: 100%;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
.plus-table-data {
|
|
|
margin-top: 2px;
|
|
|
}
|
|
|
+/deep/.el-table__expand-column {
|
|
|
+ border-right: 0;
|
|
|
+ .el-icon-arrow-right:before {
|
|
|
+ // 这是展开图标
|
|
|
+ border: 1px solid rgba(0, 0, 0, 0.14901960784313725);
|
|
|
+ }
|
|
|
+}
|
|
|
+/deep/.el-table__expand-column .cell {
|
|
|
+ .el-table__expand-icon {
|
|
|
+ .el-icon-arrow-right:before {
|
|
|
+ // 这是展开图标
|
|
|
+ content: '\e6d9';
|
|
|
+ //content: "\e6d8";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .el-table__expand-icon--expanded {
|
|
|
+ // 这是点击后的旋转角度
|
|
|
+ //transform: rotate(180deg);
|
|
|
+ transform: rotate(0deg);
|
|
|
+ .el-icon-arrow-right:before {
|
|
|
+ // 这是展开图标
|
|
|
+ //content: "\e6d9";
|
|
|
+ content: '\e6d8' !important;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+.red {
|
|
|
+ color: red;
|
|
|
+}
|
|
|
+.yellow {
|
|
|
+ color: yellow;
|
|
|
+}
|
|
|
</style>
|