|
@@ -85,7 +85,24 @@
|
|
|
</el-col>
|
|
|
<el-col :span="24">
|
|
|
<el-form-item :label="$t('分类')" prop="classmx">
|
|
|
- <el-cascader ref="selectdep" size="small" style="width: 100%" :placeholder='$t("分类")' v-model="form.classmx" :options="classData" filterable :props="{emitPath:false,expandTrigger:'hover',checkStrictly:false,label:'remarks',value:'value',children:'subvalues'}" clearable></el-cascader>
|
|
|
+ <el-cascader
|
|
|
+ ref="selectdep"
|
|
|
+ size="small"
|
|
|
+ style="width: 100%"
|
|
|
+ :placeholder="$t('分类')"
|
|
|
+ v-model="form.classmx"
|
|
|
+ :options="classData"
|
|
|
+ filterable
|
|
|
+ :props="{
|
|
|
+ emitPath: false,
|
|
|
+ expandTrigger: 'hover',
|
|
|
+ checkStrictly: false,
|
|
|
+ label: 'remarks',
|
|
|
+ value: 'value',
|
|
|
+ children: 'subvalues',
|
|
|
+ }"
|
|
|
+ clearable
|
|
|
+ ></el-cascader>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="24">
|
|
@@ -170,21 +187,25 @@ export default {
|
|
|
technicalparam: "",
|
|
|
contentstr: "",
|
|
|
isonsale: "1",
|
|
|
- classmx:''
|
|
|
+ classmx: "",
|
|
|
},
|
|
|
rules: {
|
|
|
itemname: [
|
|
|
{ required: true, message: this.$t("请选择商品"), trigger: "change" },
|
|
|
],
|
|
|
- classmx: [{ required: true, message: this.$t( "请选择分类"), trigger: "change" }],
|
|
|
+ classmx: [
|
|
|
+ { required: true, message: this.$t("请选择分类"), trigger: "change" },
|
|
|
+ ],
|
|
|
},
|
|
|
};
|
|
|
},
|
|
|
- mounted() {
|
|
|
- },
|
|
|
+ mounted() {},
|
|
|
methods: {
|
|
|
+ oploadIng(e) {
|
|
|
+ this.disabled = e;
|
|
|
+ },
|
|
|
addBtn() {
|
|
|
- this.queryClass()
|
|
|
+ this.queryClass();
|
|
|
},
|
|
|
onSubmit() {
|
|
|
this.$refs.form.validate(async (valid) => {
|
|
@@ -193,6 +214,9 @@ export default {
|
|
|
this.form.technicalparam = this.$refs.technicalparam.html;
|
|
|
this.form.materialdescription = this.$refs.materialdescription.html;
|
|
|
this.form.contentstr = this.$refs.contentstr.html;
|
|
|
+ const selectdep = this.$refs.selectdep._data.inputValue.split(" / ");
|
|
|
+ this.form.class = selectdep[0] || "";
|
|
|
+ this.form.classmx = selectdep[1] || "";
|
|
|
const res = await this.$api.requested({
|
|
|
id: "20240920101303",
|
|
|
content: this.form,
|
|
@@ -220,25 +244,29 @@ export default {
|
|
|
},
|
|
|
async queryClass() {
|
|
|
const res = await this.$store.dispatch(
|
|
|
- "optiontypeselect",
|
|
|
- "marketproductclass"
|
|
|
+ "optiontypeselect",
|
|
|
+ "marketproductclass"
|
|
|
);
|
|
|
- this.classData = []
|
|
|
- this.classData = res.data.map(item => {
|
|
|
- return {
|
|
|
- value:item.value,
|
|
|
- remarks:item.remarks,
|
|
|
- subvalues:[]
|
|
|
- }
|
|
|
- })
|
|
|
- res.data.forEach((item,index)=>{
|
|
|
- this.classData[index].subvalues = item.subvalues.map(k=>{
|
|
|
- return {
|
|
|
- value:k,
|
|
|
- remarks:k,
|
|
|
- }
|
|
|
- })
|
|
|
- })
|
|
|
+ res.data.push({
|
|
|
+ remarks: "测试",
|
|
|
+ value: "测试",
|
|
|
+ subvalues: [],
|
|
|
+ });
|
|
|
+ this.classData = [];
|
|
|
+ this.classData = res.data.map((item) => {
|
|
|
+ let data = {
|
|
|
+ value: item.value,
|
|
|
+ remarks: item.remarks,
|
|
|
+ };
|
|
|
+ if (item.subvalues.length)
|
|
|
+ data.subvalues = item.subvalues.map((k) => {
|
|
|
+ return {
|
|
|
+ value: k,
|
|
|
+ remarks: k,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ return data;
|
|
|
+ });
|
|
|
},
|
|
|
onClose() {
|
|
|
this.dialogFormVisible = false;
|