refactor(matrix): 优化矩阵题添加行选项逻辑并调整问卷投放状态显示

- 移除 MatrixQuestion 中不必要的 ID 字段
- 调整 MatrixQuestion 中 option_index 的初始值
- 优化 Design/Index.vue 中 addMatrixRowOption 方法的实现
- 修改 Survey/Index.vue 中问卷投放状态的显示文本
This commit is contained in:
陈昱达
2025-03-22 13:40:52 +08:00
parent c29fdb3bca
commit 783efadb44
3 changed files with 4 additions and 7 deletions

View File

@@ -30,7 +30,6 @@ export default {
[ [
{ {
option: '<p>列标签1</p>', option: '<p>列标签1</p>',
id: '1049201',
type: 2, type: 2,
is_other: 0, is_other: 0,
is_fixed: 0, is_fixed: 0,
@@ -38,7 +37,7 @@ export default {
created_at: null, created_at: null,
created_user_id: null, created_user_id: null,
parent_id: null, parent_id: null,
option_index: 3, option_index: 1,
list_id: 74491, list_id: 74491,
option_code: '', option_code: '',
option_config: { option_config: {

View File

@@ -359,7 +359,7 @@ const actionFun = {
* @param element {import('./components/Questions/types/martrix.js').MatrixSurveyQuestion} * @param element {import('./components/Questions/types/martrix.js').MatrixSurveyQuestion}
*/ */
addMatrixRowOption: (element) => { addMatrixRowOption: (element) => {
const optionIndex = element.last_option_index; element.last_option_index = element.last_option_index + 1;
element.options[0].push({ element.options[0].push({
cascade: [], cascade: [],
config: [], config: [],
@@ -378,11 +378,9 @@ const actionFun = {
parent_id: 0, parent_id: 0,
type: 1, type: 1,
id: uuidv4(), id: uuidv4(),
option_index: optionIndex + 1 option_index: element.last_option_index
}); });
element.last_option_index = optionIndex + 1;
saveQueItem(questionInfo.value.logics, [element]); saveQueItem(questionInfo.value.logics, [element]);
}, },
/** /**

View File

@@ -79,7 +79,7 @@
</el-button> </el-button>
<el-button color="#6fb937" :disabled="item.source === 0" @click="toPublish(item)"> <el-button color="#6fb937" :disabled="item.source === 0" @click="toPublish(item)">
<el-text style="color: white"> <el-text style="color: white">
{{ item.status === 1 ? '取消投放' : '开启投放' }} {{ item.status === 1 ? '结束投放' : '开启投放' }}
</el-text> </el-text>
</el-button> </el-button>
</div> </div>