| | |
| | | <template> |
| | | <win-sm :title="setting.title" @close="close" :width="'800px'"> |
| | | <el-form ref="ruleForm" :model="formData" :rules="rules" class="demo-ruleForm" label-width="100px"> |
| | | <el-form-item label="上级分类" prop="fatherCategoryId"> |
| | | <el-input v-model="formData.fatherCategoryId" clearable maxlength="20" show-word-limit style="width: 100%"/> |
| | | <el-form-item label="上级分类" prop="fatherCategoryName" :key="key"> |
| | | <el-input |
| | | v-model="formData.fatherCategoryName" |
| | | clearable |
| | | maxlength="20" |
| | | show-word-limit |
| | | style="width: 100%" |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="分类名称" prop="categoryName"> |
| | | <el-input v-model="formData.categoryName" clearable maxlength="20" show-word-limit style="width: 100%"/> |
| | | <el-input v-model="formData.categoryName" clearable maxlength="20" show-word-limit style="width: 100%" /> |
| | | </el-form-item> |
| | | <el-form-item label="类别" prop="classification"> |
| | | <!-- <el-input v-model="formData.name" clearable maxlength="20" show-word-limit style="width: 100%"/> --> |
| | | <!-- 只有第三级分类信息维护时需要选类别 --> |
| | | <el-form-item label="类别" prop="classification" v-if="plevels==2"> |
| | | <el-select v-model="formData.classification" placeholder="" clearable style="width: 100%"> |
| | | <el-option |
| | | v-for="item in options" |
| | | :key="item.code" |
| | | :label="item.label" |
| | | :value="item.code"> |
| | | </el-option> |
| | | <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"> </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="顺序" prop="orderNumber"> |
| | | <el-input v-model="formData.orderNumber" clearable maxlength="20" show-word-limit style="width: 100%"/> |
| | | <el-input |
| | | type="number" |
| | | v-model="formData.orderNumber" |
| | | clearable |
| | | maxlength="20" |
| | | show-word-limit |
| | | style="width: 100%" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="状态" prop="states"> |
| | | <el-radio-group v-model="formData.states"> |
| | |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" align="center" class="dialog-footer"> |
| | | <my-button name="取消" site="form" @click="close"/> |
| | | <my-button name="保存" site="form" @click="save"/> |
| | | <my-button name="取消" site="form" @click="close" /> |
| | | <my-button name="保存" site="form" @click="save" /> |
| | | </div> |
| | | </win-sm> |
| | | </template> |
| | | |
| | | <script> |
| | | import winSm from '@/components/win/win-sm' |
| | | import myButton from '@/components/myButton/myButton' |
| | | import * as finsystenant from '@/api/baseSetting/finsystenant' |
| | | |
| | | import winSm from '@/components/win/win-sm'; |
| | | import myButton from '@/components/myButton/myButton'; |
| | | import * as finsystenant from '@/api/baseSetting/finsystenant'; |
| | | import { getDicts } from '@/api/system/dict/data'; |
| | | import { getCategoryDetail } from '@/api/foudation/classification'; |
| | | export default { |
| | | components: {winSm, myButton}, |
| | | components: { winSm, myButton }, |
| | | props: { |
| | | setting: { |
| | | type: Object, |
| | | default: () => { |
| | | } |
| | | } |
| | | default: () => {}, |
| | | }, |
| | | }, |
| | | data() { |
| | | return { |
| | | checkAll: false, |
| | | checkedList: [], |
| | | options:[ |
| | | { |
| | | code: 'A', |
| | | label:'A' |
| | | }, |
| | | { |
| | | code: "B", |
| | | label:'B' |
| | | }, |
| | | { |
| | | code: 'c', |
| | | label:'C' |
| | | } |
| | | ], |
| | | options: [], // 类别列表 |
| | | formData: { |
| | | code: '', |
| | | name: '', |
| | | states: '', |
| | | summary: '', |
| | | planTypeCode:'' |
| | | fatherCategoryId: '', // 上级分类 |
| | | fatherCategoryName: '', |
| | | categoryName: '', //分类名称 |
| | | classification: '', //类别 |
| | | orderNumber: '', // 顺序 |
| | | states: 1, // 状态 |
| | | }, |
| | | rules: { |
| | | fatherCategoryId: [ |
| | | {required: true, message: '请输入', trigger: 'blur'} |
| | | ], |
| | | categoryName: [ |
| | | {required: true, message: '请输入', trigger: 'blur'} |
| | | ] |
| | | } |
| | | } |
| | | fatherCategoryName: [{ required: true, message: '请输入', trigger: 'blur' }], |
| | | categoryName: [{ required: true, message: '请输入', trigger: 'blur' }], |
| | | classification: [{ required: true, message: '请选择', trigger: 'change' }], |
| | | orderNumber: [{ required: true, message: '请输入', trigger: 'blur' }], |
| | | }, |
| | | key: Math.random(), |
| | | plevels:1 |
| | | }; |
| | | }, |
| | | created() { |
| | | if(this.setting.info){ |
| | | this.formData = Object.assign({},JSON.parse(this.setting.info)) |
| | | if (this.setting.title == '编辑') { |
| | | this.formData = Object.assign({}, JSON.parse(this.setting.info)); |
| | | } else { |
| | | this.formData.fatherCategoryId = this.setting.pid; |
| | | } |
| | | this.getCategoryName(); |
| | | getDicts('GOODS_PRICE').then((res) => { |
| | | this.options = res.map((v) => { |
| | | v.label = v.dict_label; |
| | | v.value = v.dict_value; |
| | | return v; |
| | | }); |
| | | }); |
| | | }, |
| | | methods: { |
| | | getEditInfo(id){ |
| | | |
| | | getEditInfo(id) {}, |
| | | // 分类名称获取 |
| | | getCategoryName() { |
| | | getCategoryDetail({ id: this.formData.fatherCategoryId }).then((res) => { |
| | | this.formData.fatherCategoryName = res.categoryName; |
| | | this.key = Math.random(); |
| | | this.plevels = res.levels |
| | | }); |
| | | }, |
| | | close() { |
| | | this.$emit('close') |
| | | this.$emit('close'); |
| | | }, |
| | | save() { |
| | | this.$refs.ruleForm.validate((valid) => { |
| | | if (valid) { |
| | | const params = Object.assign({}, this.formData) |
| | | if(this.setting.id){ |
| | | const params = Object.assign({}, this.formData); |
| | | if (this.setting.id) { |
| | | debugger; |
| | | // 编辑接口 |
| | | finsystenant.edit(params).then(res => { |
| | | if (res) { |
| | | this.$message.success('保存成功!') |
| | | this.close() |
| | | this.$emit('search') |
| | | } else { |
| | | this.$message.error('保存失败') |
| | | } |
| | | }) |
| | | }else{ |
| | | params.orgId = this.setting.orgId |
| | | finsystenant.add(params).then(res => { |
| | | if (res) { |
| | | this.$message.success('保存成功!') |
| | | this.close() |
| | | this.$emit('search') |
| | | } else { |
| | | this.$message.error('保存失败') |
| | | } |
| | | }) |
| | | finsystenant.edit(params).then((res) => { |
| | | this.$message.success('保存成功!'); |
| | | this.close(); |
| | | this.$emit('search'); |
| | | }); |
| | | } else { |
| | | params.orgId = this.setting.orgId; |
| | | console.log(params); |
| | | finsystenant |
| | | .add(params) |
| | | .then((res) => { |
| | | this.$message.success('保存成功!'); |
| | | this.close(); |
| | | this.$emit('search'); |
| | | }) |
| | | .catch((err) => { |
| | | console.log('err', err); |
| | | }); |
| | | } |
| | | } else { |
| | | this.$message.error('校验未通过,请检查。') |
| | | this.$message.error('校验未通过,请检查。'); |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |