123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- <template>
- <div class="add">
- <i style="font-weight:bold" class="el-icon-plus" @click="dialogVisible=true" v-if="type=='add'"></i>
- <i class="el-icon-edit" @click="editBtn" v-else></i>
- <el-dialog
- :title="type == 'add' ? '新增营销类别' : '编辑营销类别'"
- :visible.sync="dialogVisible"
- width="30%"
- :before-close="handleClose">
- <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="130px" class="demo-ruleForm">
- <el-form-item label="营销类别名" prop="itemclassname">
- <el-input v-model="ruleForm.itemclassname" size="small" placeholder="请输入营销类别名"></el-input>
- </el-form-item>
- <el-form-item label="营销类别编号" prop="itemclassnum">
- <el-input v-model="ruleForm.itemclassnum" :disabled="type!='add'" size="small" placeholder="请输入营销类别编号"></el-input>
- </el-form-item>
- <!-- <el-form-item label="营销类别全称" prop="itemclassfullname">
- <el-input v-model="ruleForm.itemclassfullname" size="small" placeholder="请输入营销类别全称"></el-input>
- </el-form-item> -->
- </el-form>
- <span slot="footer" class="dialog-footer">
- <div>
- <el-button @click="dialogVisible = false" size="small">取 消</el-button>
- <el-button type="primary" @click="submit" size="small">确 定</el-button>
- </div>
- </span>
- </el-dialog>
- </div>
-
- </template>
- <script>
- export default {
- name: '',
- data() {
- return {
- currentData:'',
- dialogVisible:false,
- ruleForm: {
- "itemclassnum":'',
- "itemclassname":'',
- // "itemclassfullname":'',
- },
- rules:{
- itemclassname: [
- { required: true, message: '请输入营销类别名', trigger: 'blur' },
- ],
- itemclassnum: [
- { required: true, message: '请输入营销类别编号', trigger: 'blur' },
- ],
- // itemclassfullname: [
- // { required: true, message: '请输入营销类别全称', trigger: 'blur' },
- // ],
- }
- };
- },
- props:['type','rowData'],
- computed:{
- },
- watch:{
- currentData: {
- handler(val) {
- this.ruleForm.itemclassnum = val.itemclassnum
- this.ruleForm.itemclassname = val.itemclassname
- // this.ruleForm.itemclassfullname = val.itemclassfullname
- }
- }
- },
- methods: {
- editBtn() {
- this.dialogVisible=true
- this.currentData = this.rowData
- },
- handleClose() {
- this.dialogVisible = false
- },
- submit() {
- this.$refs.ruleForm.validate(async val => {
- if(val) {
- let res = await this.$api.requested({
- "accesstoken": "bed2f4500c0e799a29ddbbe47a2a04b6",
- "id": "20220922110303",
- "version":1,
- "content": {
- "itemclassid":this.type == 'add' ? 0 : this.rowData.itemclassid,
- "sa_brandid":this.rowData.sa_brandid,
- "parentid":this.rowData.itemclassid === undefined ? 0 : this.rowData.itemclassid,
- "itemclassnum":this.ruleForm.itemclassnum,
- "itemclassname":this.ruleForm.itemclassname,
- // "itemclassfullname":this.ruleForm.itemclassfullname,
- "classtype":"营销"
- }
- })
- this.tool.showMessage(res,() => {
- this.$emit('addSuccess')
- this.$refs.ruleForm.resetFields()
- this.dialogVisible = false
- })
- }
- })
- }
- },
- };
- </script>
- <style scoped>
- .dialog-footer {
- display: flex;
- justify-content: space-evenly;
- }
- /deep/.el-dialog__body {
- padding-top: 10px !important;
- padding-bottom: 0 !important;
- }
- /deep/.dialog-footer {
- margin-top: 10px !important;
- }
- /deep/.el-select {
- width: 100% !important;
- }
- </style>
|