| | |
| | | <template> |
| | | <win-sm :title="setting.title" @close="close" :width="'800px'"> |
| | | <win-sm :title="setting.title" @close="close" :width="'800px'" :loading="loading"> |
| | | <el-form ref="ruleForm" :model="formData" :rules="rules" class="demo-ruleForm" label-width="100px"> |
| | | <el-form-item label="上级分类" prop="code"> |
| | | <el-input v-model="formData.code" clearable maxlength="20" show-word-limit style="width: 100%"/> |
| | | <el-form-item v-if="setting.pid" 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="name"> |
| | | <el-input v-model="formData.name" clearable maxlength="20" show-word-limit style="width: 100%"/> |
| | | <el-form-item label="分类名称" prop="categoryName"> |
| | | <el-input v-model="formData.categoryName" placeholder="请输入分类名称" clearable maxlength="20" show-word-limit |
| | | style="width: 100%"/> |
| | | </el-form-item> |
| | | <el-form-item label="类别" prop="name"> |
| | | <!-- <el-input v-model="formData.name" clearable maxlength="20" show-word-limit style="width: 100%"/> --> |
| | | <el-select v-model="formData.planTypeCode" placeholder="" clearable style="width: 100%"> |
| | | <el-option |
| | | v-for="item in options" |
| | | :key="item.code" |
| | | :label="item.label" |
| | | :value="item.code"> |
| | | </el-option> |
| | | <!-- 只有第三级分类信息维护时需要选类别 --> |
| | | <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.value" :label="item.label" :value="item.value"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="顺序" prop="name"> |
| | | <el-input v-model="formData.name" clearable maxlength="20" show-word-limit style="width: 100%"/> |
| | | <el-form-item label="顺序" prop="orderNumber"> |
| | | <el-input |
| | | type="number" |
| | | v-model="formData.orderNumber" |
| | | placeholder="请填写顺序号" |
| | | clearable |
| | | maxlength="20" |
| | | show-word-limit |
| | | style="width: 100%" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="状态" prop="status"> |
| | | <el-switch |
| | | v-model="formData.status" |
| | | active-color="#0d997c" |
| | | inactive-color="#C0CCDA"> |
| | | </el-switch> |
| | | <el-form-item label="状态" prop="states"> |
| | | <el-radio-group v-model="formData.states"> |
| | | <el-radio :label="1" border>启用</el-radio> |
| | | <el-radio :label="0" border>禁用</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" align="center" class="dialog-footer"> |
| | |
| | | </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}, |
| | |
| | | setting: { |
| | | type: Object, |
| | | default: () => { |
| | | } |
| | | } |
| | | }, |
| | | }, |
| | | }, |
| | | data() { |
| | | return { |
| | | loading: false, |
| | | checkAll: false, |
| | | checkedList: [], |
| | | options:[ |
| | | { |
| | | code: 1, |
| | | label:'A' |
| | | }, |
| | | { |
| | | code: 2, |
| | | label:'B' |
| | | }, |
| | | { |
| | | code: 3, |
| | | label:'C' |
| | | } |
| | | ], |
| | | options: [], // 类别列表 |
| | | formData: { |
| | | code: '', |
| | | name: '', |
| | | status: true, |
| | | summary: '', |
| | | planTypeCode:'' |
| | | fatherCategoryId: '', // 上级分类 |
| | | fatherCategoryName: '', |
| | | categoryName: '', //分类名称 |
| | | classification: '', //类别 |
| | | orderNumber: '', // 顺序 |
| | | states: 1, // 状态 |
| | | }, |
| | | rules: { |
| | | code: [ |
| | | {required: true, message: '请输入机构编号', trigger: 'blur'} |
| | | ], |
| | | name: [ |
| | | {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() { |
| | | if (!this.formData.fatherCategoryId) return |
| | | 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.loading) return |
| | | this.loading = true |
| | | if (this.setting.id) { |
| | | // 编辑接口 |
| | | 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.loading = false |
| | | this.$message.success('保存成功!'); |
| | | this.close(); |
| | | this.$emit('search'); |
| | | }).catch((err) => { |
| | | this.loading = false |
| | | }); |
| | | } else { |
| | | params.orgId = this.setting.orgId; |
| | | finsystenant.add(params).then((res) => { |
| | | this.loading = false |
| | | this.$message.success('保存成功!'); |
| | | this.close(); |
| | | this.$emit('search'); |
| | | }) |
| | | } |
| | | } else { |
| | | this.$message.error('校验未通过,请检查。') |
| | | this.$message.error('校验未通过,请检查。'); |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |