|
@@ -24,11 +24,18 @@
|
|
|
</el-col>
|
|
|
<el-col :span="24">
|
|
|
<el-form-item label="部门名称" prop="deptName">
|
|
|
- <el-input v-model="deptForm.deptName" placeholder="请输入部门名称" maxlength="20" show-word-limit />
|
|
|
+ <el-input v-model.trim="deptForm.deptName" placeholder="请输入部门名称" maxlength="20" show-word-limit @input="setShortList" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="24">
|
|
|
- <el-form-item label="公司简称"> </el-form-item>
|
|
|
+ <el-form-item label="公司简称">
|
|
|
+ <ul class="short">
|
|
|
+ <li v-for="item in shortList" :key="item.title">
|
|
|
+ <span>{{ item.title }}</span>
|
|
|
+ <input type="checkbox" v-model="item.checked" />
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ </el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</el-form>
|
|
@@ -48,6 +55,7 @@ export default {
|
|
|
components: { DeptItem },
|
|
|
data() {
|
|
|
return {
|
|
|
+ checked: true,
|
|
|
//组织架构数据
|
|
|
dataList: [],
|
|
|
//弹窗显示
|
|
@@ -61,10 +69,18 @@ export default {
|
|
|
//上级部门名称
|
|
|
parentName: '',
|
|
|
//部门名称
|
|
|
- deptName: ''
|
|
|
+ deptName: '',
|
|
|
+ //部门简称
|
|
|
+ shortName: '',
|
|
|
+ //简称索引
|
|
|
+ shortNameIndex: ''
|
|
|
},
|
|
|
//表单验证
|
|
|
- deptFormRules: {}
|
|
|
+ deptFormRules: {
|
|
|
+ deptName: [{ required: true, message: '部门名称不能为空', trigger: 'submit' }]
|
|
|
+ },
|
|
|
+ //简写数据
|
|
|
+ shortList: []
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
@@ -93,9 +109,31 @@ export default {
|
|
|
this.resetForm()
|
|
|
},
|
|
|
//表单重置
|
|
|
- resetForm() {},
|
|
|
+ resetForm() {
|
|
|
+ this.deptForm = {
|
|
|
+ parentId: 0,
|
|
|
+ parentName: '',
|
|
|
+ deptName: '',
|
|
|
+ shortName: '',
|
|
|
+ shortNameIndex: ''
|
|
|
+ }
|
|
|
+ },
|
|
|
//弹窗提交
|
|
|
- sub() {},
|
|
|
+ sub() {
|
|
|
+ this.$refs['deptForm'].validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ if (this.deptForm.deptId != undefined) {
|
|
|
+ } else {
|
|
|
+ addDept(this.deptForm).then(res => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.$msg({ message: '添加成功' })
|
|
|
+ this.cancel()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
//编辑部门
|
|
|
updData(type, data) {
|
|
|
this.show = true
|
|
@@ -108,6 +146,16 @@ export default {
|
|
|
this.title = '部门修改'
|
|
|
}
|
|
|
},
|
|
|
+ //设置简写
|
|
|
+ setShortList() {
|
|
|
+ this.shortList = this.deptForm.deptName.split('').map((title, index) => {
|
|
|
+ return {
|
|
|
+ index,
|
|
|
+ title,
|
|
|
+ checked: true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
delData() {},
|
|
|
resetDel() {}
|
|
|
}
|
|
@@ -131,4 +179,13 @@ export default {
|
|
|
width: auto;
|
|
|
display: inline-block;
|
|
|
}
|
|
|
+.short {
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ li {
|
|
|
+ height: 36px;
|
|
|
+ line-height: 36px;
|
|
|
+ margin-right: 10px;
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|