|
@@ -77,38 +77,6 @@
|
|
|
>
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
- <el-form-item v-if="modalForm.isBoolean" label="是否配置:">
|
|
|
- <el-select
|
|
|
- v-model="modalForm.booleanType"
|
|
|
- style="width: 125px"
|
|
|
- placeholder="请选择"
|
|
|
- @change="booleanTypeChange"
|
|
|
- >
|
|
|
- <el-option
|
|
|
- v-for="item in BOOLEAN_TYPE"
|
|
|
- :key="item"
|
|
|
- :label="item"
|
|
|
- :value="item"
|
|
|
- ></el-option>
|
|
|
- </el-select>
|
|
|
- <span>(备选是否配置)</span>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item v-if="modalForm.isBoolean" prop="booleanType">
|
|
|
- <span>是:</span>
|
|
|
- <el-input
|
|
|
- v-model.trim="booleanTypes.yes"
|
|
|
- :maxlength="1"
|
|
|
- placeholder="是"
|
|
|
- style="margin-right: 20px; width: 60px"
|
|
|
- ></el-input>
|
|
|
- <span>否:</span>
|
|
|
- <el-input
|
|
|
- v-model.trim="booleanTypes.no"
|
|
|
- :maxlength="1"
|
|
|
- placeholder="否"
|
|
|
- style="margin-right: 20px; width: 60px"
|
|
|
- ></el-input>
|
|
|
- </el-form-item>
|
|
|
</el-form>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -160,32 +128,11 @@ export default {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
- const booleanTypeValidater = (rule, value, callback) => {
|
|
|
- if (this.modalForm.isBoolean) {
|
|
|
- if (
|
|
|
- this.booleanTypes.yes &&
|
|
|
- this.booleanTypes.no &&
|
|
|
- this.booleanTypes.yes.length <= 2 &&
|
|
|
- this.booleanTypes.no.length <= 2
|
|
|
- ) {
|
|
|
- callback();
|
|
|
- } else {
|
|
|
- callback(new Error("请设置是否配置,单个设置最多两个字符。"));
|
|
|
- }
|
|
|
- } else {
|
|
|
- callback();
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
return {
|
|
|
modalForm: { ...initModalForm },
|
|
|
BOOLEAN_TYPE,
|
|
|
DIRECTION_TYPE,
|
|
|
topicType: null,
|
|
|
- booleanTypes: {
|
|
|
- yes: "",
|
|
|
- no: "",
|
|
|
- },
|
|
|
rules: {
|
|
|
topicType: [
|
|
|
{
|
|
@@ -228,13 +175,6 @@ export default {
|
|
|
trigger: "change",
|
|
|
},
|
|
|
],
|
|
|
- booleanType: [
|
|
|
- {
|
|
|
- required: true,
|
|
|
- validator: booleanTypeValidater,
|
|
|
- trigger: "change",
|
|
|
- },
|
|
|
- ],
|
|
|
},
|
|
|
};
|
|
|
},
|
|
@@ -248,12 +188,6 @@ export default {
|
|
|
this.modalForm = Object.assign({}, initModalForm, valInfo);
|
|
|
this.modalForm.endNumber =
|
|
|
this.modalForm.startNumber + this.modalForm.questionsCount - 1;
|
|
|
- this.booleanTypeChange();
|
|
|
- },
|
|
|
- booleanTypeChange() {
|
|
|
- const [yes, no] = this.modalForm.booleanType.split(",");
|
|
|
- this.booleanTypes.yes = yes;
|
|
|
- this.booleanTypes.no = no;
|
|
|
},
|
|
|
topicTypeChange() {
|
|
|
if (this.topicType === "single") {
|
|
@@ -268,8 +202,6 @@ export default {
|
|
|
this.modalForm.isMultiply = false;
|
|
|
this.modalForm.isBoolean = true;
|
|
|
this.modalForm.optionCount = 2;
|
|
|
- this.modalForm.booleanType = BOOLEAN_TYPE[0];
|
|
|
- this.booleanTypeChange();
|
|
|
}
|
|
|
},
|
|
|
getTopicType(info) {
|
|
@@ -283,10 +215,6 @@ export default {
|
|
|
|
|
|
this.modalForm.questionsCount =
|
|
|
this.modalForm.endNumber - this.modalForm.startNumber + 1;
|
|
|
- this.modalForm.booleanType = [
|
|
|
- this.booleanTypes.yes,
|
|
|
- this.booleanTypes.no,
|
|
|
- ].join();
|
|
|
this.modalForm.topicName = this.modalForm.topicName.trim();
|
|
|
this.$emit("modified", this.modalForm);
|
|
|
},
|