|
@@ -1,6 +1,10 @@
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
.scaleTable {
|
|
|
+ min-height: 100px;
|
|
|
+ .table_box {
|
|
|
+ padding: 0 10px;
|
|
|
+ }
|
|
|
.btn_box {
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
@@ -35,256 +39,296 @@
|
|
|
/deep/.el-table th {
|
|
|
padding: 2px 0;
|
|
|
}
|
|
|
+ .change_table_btns {
|
|
|
+ width: 100%;
|
|
|
+ margin-top: 20px;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: row-reverse;
|
|
|
+ padding: 10px;
|
|
|
+ box-sizing: border-box;
|
|
|
+ border-top: 10px solid #dee2ea;
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|
|
|
<template>
|
|
|
<div class="scaleTable" :id="`scaleTableRef[${tableIndex}]`">
|
|
|
- <el-table
|
|
|
- v-if="tableShow"
|
|
|
- :data="tableData"
|
|
|
- header-row-class-name="header_row_class_name"
|
|
|
- border
|
|
|
- style="width: 100%; margin: 20px 0"
|
|
|
- :span-method="objectSpanMethod"
|
|
|
- :ref="`scaleTableRef[${tableIndex}]`"
|
|
|
- >
|
|
|
- <el-table-column prop="issueId" label="组" width="70px">
|
|
|
- <template slot-scope="scope">
|
|
|
- <div class="btn_box">
|
|
|
- <div class="btn_div">
|
|
|
- <img
|
|
|
- @click="
|
|
|
- $emit('CHANGE_TABLE_ROW', {
|
|
|
- type: 1,
|
|
|
- tableIndex,
|
|
|
- rowIndex: scope.$index,
|
|
|
- groupId: scope.row.groupId
|
|
|
- })
|
|
|
- "
|
|
|
- src="../../../images/add-new-rule-sub.png"
|
|
|
- alt=""
|
|
|
- />
|
|
|
- </div>
|
|
|
- <div
|
|
|
- class="btn_div"
|
|
|
- v-if="imposeRestrictionsRemoveOnGroup(scope.row.groupId)"
|
|
|
- >
|
|
|
- <img
|
|
|
- @click="
|
|
|
- $emit('CHANGE_TABLE_ROW', {
|
|
|
- type: -1,
|
|
|
- tableIndex,
|
|
|
- groupId: scope.row.groupId
|
|
|
- })
|
|
|
- "
|
|
|
- src="../../../images/add-new-rule-del.png"
|
|
|
- alt=""
|
|
|
- />
|
|
|
+ <div class="table_box">
|
|
|
+ <el-table
|
|
|
+ v-if="tableShow"
|
|
|
+ :data="tableData"
|
|
|
+ header-row-class-name="header_row_class_name"
|
|
|
+ border
|
|
|
+ style="width: 100%; margin: 20px 0"
|
|
|
+ :span-method="objectSpanMethod"
|
|
|
+ :ref="`scaleTableRef[${tableIndex}]`"
|
|
|
+ >
|
|
|
+ <el-table-column prop="issueId" label="组" width="70px">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div class="btn_box">
|
|
|
+ <div class="btn_div">
|
|
|
+ <img
|
|
|
+ @click="
|
|
|
+ $emit('CHANGE_TABLE_ROW', {
|
|
|
+ type: 1,
|
|
|
+ tableIndex,
|
|
|
+ rowIndex: scope.$index,
|
|
|
+ groupId: scope.row.groupId
|
|
|
+ })
|
|
|
+ "
|
|
|
+ src="../../../images/add-new-rule-sub.png"
|
|
|
+ alt=""
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ class="btn_div"
|
|
|
+ v-if="imposeRestrictionsRemoveOnGroup(scope.row.groupId)"
|
|
|
+ >
|
|
|
+ <img
|
|
|
+ @click="
|
|
|
+ $emit('CHANGE_TABLE_ROW', {
|
|
|
+ type: -1,
|
|
|
+ tableIndex,
|
|
|
+ groupId: scope.row.groupId
|
|
|
+ })
|
|
|
+ "
|
|
|
+ src="../../../images/add-new-rule-del.png"
|
|
|
+ alt=""
|
|
|
+ />
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="groupId" label="问题" width="70px">
|
|
|
- <template slot-scope="scope">
|
|
|
- <div class="btn_box">
|
|
|
- <div class="btn_div">
|
|
|
- <img
|
|
|
- @click="
|
|
|
- $emit('CHANGE_TABLE_ROW', {
|
|
|
- type: 2,
|
|
|
- tableIndex,
|
|
|
- rowIndex: scope.$index,
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="groupId" label="问题" width="70px">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div class="btn_box">
|
|
|
+ <div class="btn_div">
|
|
|
+ <img
|
|
|
+ @click="
|
|
|
+ $emit('CHANGE_TABLE_ROW', {
|
|
|
+ type: 2,
|
|
|
+ tableIndex,
|
|
|
+ rowIndex: scope.$index,
|
|
|
+ groupId: scope.row.groupId,
|
|
|
+ issueId: scope.row.issueId
|
|
|
+ })
|
|
|
+ "
|
|
|
+ src="../../../images/add-new-rule-sub.png"
|
|
|
+ alt=""
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ class="btn_div"
|
|
|
+ v-if="
|
|
|
+ imposeRestrictionsRemoveOnIssue({
|
|
|
groupId: scope.row.groupId,
|
|
|
issueId: scope.row.issueId
|
|
|
})
|
|
|
"
|
|
|
- src="../../../images/add-new-rule-sub.png"
|
|
|
- alt=""
|
|
|
- />
|
|
|
+ >
|
|
|
+ <img
|
|
|
+ @click="
|
|
|
+ $emit('CHANGE_TABLE_ROW', {
|
|
|
+ type: -2,
|
|
|
+ tableIndex,
|
|
|
+ issueId: scope.row.issueId
|
|
|
+ })
|
|
|
+ "
|
|
|
+ src="../../../images/add-new-rule-del.png"
|
|
|
+ alt=""
|
|
|
+ />
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- <div
|
|
|
- class="btn_div"
|
|
|
- v-if="imposeRestrictionsRemoveOnIssue(scope.row.groupId)"
|
|
|
- >
|
|
|
- <img
|
|
|
- @click="
|
|
|
- $emit('CHANGE_TABLE_ROW', {
|
|
|
- type: -2,
|
|
|
- tableIndex,
|
|
|
- issueId: scope.row.issueId
|
|
|
- })
|
|
|
- "
|
|
|
- src="../../../images/add-new-rule-del.png"
|
|
|
- alt=""
|
|
|
- />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="two_selectType" label="选择" width="70px">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div class="table_select_btn">
|
|
|
+ <el-button
|
|
|
+ @click="handleSelectTypeBtn(scope.$index, 1)"
|
|
|
+ :style="scope.row.two_selectType != 1 ? { color: '#999' } : ''"
|
|
|
+ type="text"
|
|
|
+ >单选</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ :style="scope.row.two_selectType != 2 ? { color: '#999' } : ''"
|
|
|
+ @click="handleSelectTypeBtn(scope.$index, 2)"
|
|
|
+ type="text"
|
|
|
+ >多选</el-button
|
|
|
+ >
|
|
|
</div>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="two_selectType" label="选择" width="70px">
|
|
|
- <template slot-scope="scope">
|
|
|
- <div class="table_select_btn">
|
|
|
- <el-button
|
|
|
- @click="handleSelectTypeBtn(scope.$index, 1)"
|
|
|
- :style="scope.row.two_selectType != 1 ? { color: '#999' } : ''"
|
|
|
- type="text"
|
|
|
- >单选</el-button
|
|
|
- >
|
|
|
- <el-button
|
|
|
- :style="scope.row.two_selectType != 2 ? { color: '#999' } : ''"
|
|
|
- @click="handleSelectTypeBtn(scope.$index, 2)"
|
|
|
- type="text"
|
|
|
- >多选</el-button
|
|
|
- >
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- prop="two_content"
|
|
|
- label="问题内容"
|
|
|
- :width="tableResultType === 1 ? '140px' : ''"
|
|
|
- >
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-form-item>
|
|
|
- <el-input
|
|
|
- type="text"
|
|
|
- v-model="scope.row.two_content"
|
|
|
- clearable
|
|
|
- placeholder="请输入"
|
|
|
- ></el-input>
|
|
|
- </el-form-item>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- prop="two_factor"
|
|
|
- label="系数"
|
|
|
- width="70px"
|
|
|
- v-if="tableResultType === 2"
|
|
|
- >
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-form-item>
|
|
|
- <el-input
|
|
|
- type="text"
|
|
|
- v-model="scope.row.two_factor"
|
|
|
- clearable
|
|
|
- placeholder="请输入"
|
|
|
- ></el-input>
|
|
|
- </el-form-item>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- prop="two_constant"
|
|
|
- label="常数"
|
|
|
- width="70px"
|
|
|
- v-if="tableResultType === 2"
|
|
|
- >
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-form-item>
|
|
|
- <el-input
|
|
|
- type="text"
|
|
|
- v-model="scope.row.two_constant"
|
|
|
- clearable
|
|
|
- placeholder="请输入"
|
|
|
- ></el-input>
|
|
|
- </el-form-item>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="issueId" label="选项个数" width="80px">
|
|
|
- <template slot-scope="scope">
|
|
|
- <div>
|
|
|
- {{ optionLength(scope.row.issueId) }}
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="orderNo" label="选项" width="70px">
|
|
|
- <template slot-scope="scope">
|
|
|
- <div class="btn_box">
|
|
|
- <div class="btn_div">
|
|
|
- <img
|
|
|
- @click="
|
|
|
- $emit('CHANGE_TABLE_ROW', {
|
|
|
- type: 3,
|
|
|
- tableIndex,
|
|
|
- rowIndex: scope.$index,
|
|
|
- groupId: scope.row.groupId,
|
|
|
- issueId: scope.row.issueId
|
|
|
- })
|
|
|
- "
|
|
|
- src="../../../images/add-new-rule-sub.png"
|
|
|
- alt=""
|
|
|
- />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="two_content"
|
|
|
+ label="问题内容"
|
|
|
+ :width="tableResultType === 1 ? '140px' : ''"
|
|
|
+ >
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-form-item>
|
|
|
+ <el-input
|
|
|
+ type="text"
|
|
|
+ v-model="scope.row.two_content"
|
|
|
+ clearable
|
|
|
+ placeholder="请输入"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="two_factor"
|
|
|
+ label="系数"
|
|
|
+ width="70px"
|
|
|
+ v-if="tableResultType === 2"
|
|
|
+ >
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-form-item>
|
|
|
+ <el-input
|
|
|
+ type="text"
|
|
|
+ v-model="scope.row.two_factor"
|
|
|
+ clearable
|
|
|
+ placeholder="请输入"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="two_constant"
|
|
|
+ label="常数"
|
|
|
+ width="70px"
|
|
|
+ v-if="tableResultType === 2"
|
|
|
+ >
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-form-item>
|
|
|
+ <el-input
|
|
|
+ type="text"
|
|
|
+ v-model="scope.row.two_constant"
|
|
|
+ clearable
|
|
|
+ placeholder="请输入"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="issueId" label="选项个数" width="80px">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div>
|
|
|
+ {{ optionLength(scope.row.issueId) }}
|
|
|
</div>
|
|
|
- <div
|
|
|
- class="btn_div"
|
|
|
- v-if="imposeRestrictionsRemoveOnOption(scope.row.issueId)"
|
|
|
- >
|
|
|
- <img
|
|
|
- @click="
|
|
|
- $emit('CHANGE_TABLE_ROW', {
|
|
|
- type: -3,
|
|
|
- tableIndex,
|
|
|
- rowIndex: scope.$index
|
|
|
- })
|
|
|
- "
|
|
|
- src="../../../images/add-new-rule-del.png"
|
|
|
- alt=""
|
|
|
- />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="orderNo" label="选项" width="70px">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div class="btn_box">
|
|
|
+ <div class="btn_div">
|
|
|
+ <img
|
|
|
+ @click="
|
|
|
+ $emit('CHANGE_TABLE_ROW', {
|
|
|
+ type: 3,
|
|
|
+ tableIndex,
|
|
|
+ rowIndex: scope.$index,
|
|
|
+ groupId: scope.row.groupId,
|
|
|
+ issueId: scope.row.issueId
|
|
|
+ })
|
|
|
+ "
|
|
|
+ src="../../../images/add-new-rule-sub.png"
|
|
|
+ alt=""
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ class="btn_div"
|
|
|
+ v-if="imposeRestrictionsRemoveOnOption(scope.row.issueId)"
|
|
|
+ >
|
|
|
+ <img
|
|
|
+ @click="
|
|
|
+ $emit('CHANGE_TABLE_ROW', {
|
|
|
+ type: -3,
|
|
|
+ tableIndex,
|
|
|
+ rowIndex: scope.$index
|
|
|
+ })
|
|
|
+ "
|
|
|
+ src="../../../images/add-new-rule-del.png"
|
|
|
+ alt=""
|
|
|
+ />
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- prop="content"
|
|
|
- label="选项内容"
|
|
|
- :width="tableResultType === 1 ? '140px' : ''"
|
|
|
- >
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-form-item>
|
|
|
- <el-input
|
|
|
- type="text"
|
|
|
- v-model="scope.row.content"
|
|
|
- clearable
|
|
|
- placeholder="请输入"
|
|
|
- ></el-input>
|
|
|
- </el-form-item>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="content" label="分值" v-if="tableResultType === 2">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-form-item>
|
|
|
- <el-input
|
|
|
- type="text"
|
|
|
- v-model="scope.row.content"
|
|
|
- clearable
|
|
|
- placeholder="请输入"
|
|
|
- ></el-input>
|
|
|
- </el-form-item>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- prop="result"
|
|
|
- label="结果"
|
|
|
- width="100px"
|
|
|
- v-if="tableResultType === 1"
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="content"
|
|
|
+ label="选项内容"
|
|
|
+ :width="tableResultType === 1 ? '140px' : ''"
|
|
|
+ >
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-form-item>
|
|
|
+ <el-input
|
|
|
+ type="text"
|
|
|
+ v-model="scope.row.content"
|
|
|
+ clearable
|
|
|
+ placeholder="请输入"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="content"
|
|
|
+ label="分值"
|
|
|
+ v-if="tableResultType === 2"
|
|
|
+ >
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-form-item>
|
|
|
+ <el-input
|
|
|
+ type="text"
|
|
|
+ v-model="scope.row.content"
|
|
|
+ clearable
|
|
|
+ placeholder="请输入"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="result"
|
|
|
+ label="结果"
|
|
|
+ width="100px"
|
|
|
+ v-if="tableResultType === 1"
|
|
|
+ >
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-form-item>
|
|
|
+ <el-input
|
|
|
+ type="text"
|
|
|
+ v-model="scope.row.result"
|
|
|
+ clearable
|
|
|
+ placeholder="请输入"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="pushInfo"
|
|
|
+ label="建议"
|
|
|
+ v-if="tableResultType === 1"
|
|
|
+ >
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="change_table_btns">
|
|
|
+ <el-button
|
|
|
+ icon="el-icon-minus"
|
|
|
+ style="margin-left: 10px"
|
|
|
+ size="small"
|
|
|
+ type="danger"
|
|
|
+ plain
|
|
|
+ @click="$emit('CHANGE_TABLE', { tableIndex, type: -1 })"
|
|
|
+ >删除标题</el-button
|
|
|
>
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-form-item>
|
|
|
- <el-input
|
|
|
- type="text"
|
|
|
- v-model="scope.row.result"
|
|
|
- clearable
|
|
|
- placeholder="请输入"
|
|
|
- ></el-input>
|
|
|
- </el-form-item>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- prop="pushInfo"
|
|
|
- label="建议"
|
|
|
- v-if="tableResultType === 1"
|
|
|
+ <el-button
|
|
|
+ @click="$emit('CHANGE_TABLE', { tableIndex, type: 1 })"
|
|
|
+ icon="el-icon-plus"
|
|
|
+ size="small"
|
|
|
+ type="success"
|
|
|
+ plain
|
|
|
+ >新增标题</el-button
|
|
|
>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -392,12 +436,19 @@ export default {
|
|
|
return otherGroupLength;
|
|
|
},
|
|
|
// 删除问题限制:该组剩余一个问题时隐藏删除按钮
|
|
|
- imposeRestrictionsRemoveOnIssue(groupId) {
|
|
|
- // 查找同组的问题,如果只有一个问题则隐藏删除按钮
|
|
|
- const thisIssueBygroupLenth = this.tableData.filter(
|
|
|
+ imposeRestrictionsRemoveOnIssue(val) {
|
|
|
+ const { groupId, issueId } = val;
|
|
|
+ // 获取该组所有的issus
|
|
|
+ const thisGroups = this.tableData.filter(
|
|
|
(item) => item.groupId === groupId
|
|
|
+ );
|
|
|
+ // 查找该组有没有其他问题 otherIssueLength为0表示只有当前一个问题存在 所以隐藏删除按钮
|
|
|
+ const otherIssueLength = thisGroups.filter(
|
|
|
+ (item) => item.issueId !== issueId
|
|
|
).length;
|
|
|
- if (thisIssueBygroupLenth > 1) {
|
|
|
+
|
|
|
+ console.log(thisGroups, otherIssueLength);
|
|
|
+ if (otherIssueLength) {
|
|
|
return true;
|
|
|
}
|
|
|
return false;
|