| | |
| | | <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 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 |
| | | 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" placeholder="请输入分类名称" clearable maxlength="20" show-word-limit |
| | | style="width: 100%"/> |
| | | </el-form-item> |
| | | <!-- 只有第三级分类信息维护时需要选类别 --> |
| | | <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-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="orderNumber"> |
| | | <el-input |
| | | type="number" |
| | | v-model="formData.orderNumber" |
| | | clearable |
| | | maxlength="20" |
| | | show-word-limit |
| | | style="width: 100%" |
| | | type="number" |
| | | v-model="formData.orderNumber" |
| | | placeholder="请填写顺序号" |
| | | clearable |
| | | maxlength="20" |
| | | show-word-limit |
| | | style="width: 100%" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="状态" prop="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> |
| | |
| | | import {getCategoryDetail} from '@/api/foudation/classification'; |
| | | |
| | | export default { |
| | | components: { winSm, myButton }, |
| | | components: {winSm, myButton}, |
| | | props: { |
| | | setting: { |
| | | type: Object, |
| | | default: () => {}, |
| | | default: () => { |
| | | }, |
| | | }, |
| | | }, |
| | | data() { |
| | | return { |
| | | loading: false, |
| | | checkAll: false, |
| | | checkedList: [], |
| | | options: [], // 类别列表 |
| | |
| | | states: 1, // 状态 |
| | | }, |
| | | rules: { |
| | | fatherCategoryName: [{ required: true, message: '请输入', trigger: 'blur' }], |
| | | categoryName: [{ required: true, message: '请输入', trigger: 'blur' }], |
| | | classification: [{ required: true, message: '请选择', trigger: 'change' }], |
| | | orderNumber: [{ 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 |
| | | plevels: 1 |
| | | }; |
| | | }, |
| | | created() { |
| | |
| | | }); |
| | | }, |
| | | methods: { |
| | | getEditInfo(id) {}, |
| | | getEditInfo(id) { |
| | | }, |
| | | // 分类名称获取 |
| | | getCategoryName() { |
| | | if(!this.formData.fatherCategoryId) return |
| | | getCategoryDetail({ id: this.formData.fatherCategoryId }).then((res) => { |
| | | 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 |
| | |
| | | this.$refs.ruleForm.validate((valid) => { |
| | | if (valid) { |
| | | const params = Object.assign({}, this.formData); |
| | | if (this.loading) return |
| | | this.loading = true |
| | | if (this.setting.id) { |
| | | debugger; |
| | | // 编辑接口 |
| | | 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; |
| | | console.log(params); |
| | | finsystenant |
| | | .add(params) |
| | | .then((res) => { |
| | | this.$message.success('保存成功!'); |
| | | this.close(); |
| | | this.$emit('search'); |
| | | }) |
| | | .catch((err) => { |
| | | console.log('err', err); |
| | | }); |
| | | finsystenant.add(params).then((res) => { |
| | | this.loading = false |
| | | this.$message.success('保存成功!'); |
| | | this.close(); |
| | | this.$emit('search'); |
| | | }) |
| | | } |
| | | } else { |
| | | this.$message.error('校验未通过,请检查。'); |