|
|
@@ -0,0 +1,107 @@
|
|
|
+<template>
|
|
|
+ <div class="add">
|
|
|
+ <el-button size="mini" type="text" @click="dialogVisible=true" v-if="type === 'add'" icon="el-icon-plus">{{$t(`新增下级`)}}</el-button>
|
|
|
+ <el-button size="mini" type="text" @click="editBtn" icon="el-icon-edit" v-else>{{$t('编 辑')}}</el-button>
|
|
|
+ <el-dialog
|
|
|
+ :title="type == 'add' ? $t('新增类别') : $t('编辑类别')"
|
|
|
+ :visible.sync="dialogVisible"
|
|
|
+ width="500px"
|
|
|
+ append-to-body
|
|
|
+ :before-close="handleClose">
|
|
|
+ <el-form :model="ruleForm" :rules="rules" ref="ruleForm" :label-width="tool.onlyZh('130px')" class="demo-ruleForm">
|
|
|
+ <el-form-item :label="$t(`类别名称`)" prop="itemclassname">
|
|
|
+ <div class="flex-align-center">
|
|
|
+ <el-input v-model="ruleForm.itemclassname" size="small" class="inline-16" :placeholder="$t(`请输入类别名称`)">
|
|
|
+ </el-input>
|
|
|
+ <el-input v-model="ruleForm.num" size="small" style="width:90px" :placeholder="$t(`排序`)">
|
|
|
+ </el-input>
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item :label="$t(`类别编号`)" prop="itemclassnum">
|
|
|
+ <el-input v-model="ruleForm.itemclassnum" :disabled="type!='add'" size="small" :placeholder="$t(`请输入类别编号`)"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-checkbox :disabled="type == 'add'" v-model="ruleForm.istool" :true-label="1" :false-label="0">{{$t(`是否工具`)}}</el-checkbox>
|
|
|
+ <el-checkbox v-model="ruleForm.ishide" :true-label="1" :false-label="0">{{$t(`是否隐藏`)}}</el-checkbox>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <div>
|
|
|
+ <el-button @click="dialogVisible = false" size="small">{{$t('取 消')}}</el-button>
|
|
|
+ <el-button type="primary" @click="submit" size="small">{{$t('确 定')}}</el-button>
|
|
|
+ </div>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+export default {
|
|
|
+ name: 'edit',
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ currentData:'',
|
|
|
+ dialogVisible:false,
|
|
|
+ ruleForm: {
|
|
|
+ "itemclassnum":'',
|
|
|
+ "itemclassname":'',
|
|
|
+ "istool":0,
|
|
|
+ "ishide":0,
|
|
|
+ "num":''
|
|
|
+ },
|
|
|
+ rules:{
|
|
|
+ itemclassname: [
|
|
|
+ { required: true, message: this.$t('请输入类别名称'), trigger: 'blur' },
|
|
|
+ ],
|
|
|
+ itemclassnum: [
|
|
|
+ { required: true, message: this.$t('请输入类别编号'), trigger: 'blur' },
|
|
|
+ ],
|
|
|
+ }
|
|
|
+ };
|
|
|
+ },
|
|
|
+ props:['type','rowData'],
|
|
|
+ computed:{
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ editBtn() {
|
|
|
+ this.dialogVisible = true
|
|
|
+ this.ruleForm = Object.assign({},this.ruleForm,this.rowData)
|
|
|
+ },
|
|
|
+ handleClose() {
|
|
|
+ this.dialogVisible = false
|
|
|
+ },
|
|
|
+ submit() {
|
|
|
+ this.$refs.ruleForm.validate(async val => {
|
|
|
+ if(val) {
|
|
|
+ let res = await this.$api.requested({
|
|
|
+ "id": "20220922110306",
|
|
|
+ "version":1,
|
|
|
+ "content": {
|
|
|
+ "itemclassid":this.type == 'add' ? 0 : this.rowData.itemclassid,
|
|
|
+ "sc_brandid":this.rowData.sa_brandid,
|
|
|
+ "parentid":this.type == 'add' ? this.rowData.itemclassid : 0,
|
|
|
+ "itemclassnum":this.ruleForm.itemclassnum,
|
|
|
+ "itemclassname":this.ruleForm.itemclassname,
|
|
|
+ "classtype":"营销",
|
|
|
+ "num":this.ruleForm.num || "1",
|
|
|
+ "ishide":this.ruleForm.ishide,
|
|
|
+ "istool":this.ruleForm.istool
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.tool.showMessage(res,() => {
|
|
|
+ this.$emit('addSuccess')
|
|
|
+ this.$refs.ruleForm.resetFields()
|
|
|
+ this.ruleForm.istool = 0
|
|
|
+ this.ruleForm.ishide = 0
|
|
|
+ this.dialogVisible = false
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+</style>
|