|
@@ -1,40 +1,54 @@
|
|
|
<template>
|
|
|
- <el-dialog
|
|
|
- :title="titleStr"
|
|
|
- :visible.sync="data.bSwitch"
|
|
|
- width="40%"
|
|
|
- >
|
|
|
- <el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="140px" class="demo-ruleForm">
|
|
|
- <el-form-item label="手术操作编码" prop="ssbm">
|
|
|
- <el-input v-model="ruleForm.ssbm" placeholder="请输入" />
|
|
|
+ <el-dialog :title="titleStr" :visible.sync="data.bSwitch" width="40%">
|
|
|
+ <el-form
|
|
|
+ ref="ruleForm"
|
|
|
+ :model="ruleForm"
|
|
|
+ :rules="rules"
|
|
|
+ label-width="140px"
|
|
|
+ class="demo-ruleForm"
|
|
|
+ >
|
|
|
+ <el-form-item label="字典名称" prop="name">
|
|
|
+ <el-input v-model="ruleForm.name" placeholder="请输入" />
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="手术操作名称" prop="ssmc">
|
|
|
- <el-input v-model="ruleForm.ssmc" placeholder="请输入" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="操作类型" prop="sslb">
|
|
|
- <el-select v-model="ruleForm.sslb" filterable clearable placeholder="请选择">
|
|
|
- <el-option label="介入治疗" value="介入治疗" />
|
|
|
- <el-option label="手术" value="手术" />
|
|
|
- <el-option label="治疗性操作" value="治疗性操作" />
|
|
|
- <el-option label="诊断性操作" value="诊断性操作" />
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="录入选项" prop="lrxx">
|
|
|
- <el-select v-model="ruleForm.lrxx" filterable clearable placeholder="请选择">
|
|
|
- <el-option label="选择性" value="选择性" />
|
|
|
- <el-option label="必选" value="必选" />
|
|
|
- </el-select>
|
|
|
+ <el-form-item label="映射名称" prop="keywords">
|
|
|
+ <el-tag
|
|
|
+ v-for="tag in ruleForm.keywords"
|
|
|
+ :key="tag"
|
|
|
+ size="-"
|
|
|
+ closable
|
|
|
+ effect="plain"
|
|
|
+ :disable-transitions="false"
|
|
|
+ @close="handleClose(tag)"
|
|
|
+ >
|
|
|
+ {{ tag }}
|
|
|
+ </el-tag>
|
|
|
+ <el-input
|
|
|
+ v-if="inputVisible"
|
|
|
+ ref="saveTagInput"
|
|
|
+ v-model="inputValue"
|
|
|
+ class="input-new-tag"
|
|
|
+ @keyup.enter.native="handleInputConfirm"
|
|
|
+ @blur="handleInputConfirm"
|
|
|
+ />
|
|
|
+ <el-button
|
|
|
+ v-else
|
|
|
+ class="button-new-tag"
|
|
|
+ @click="showInput"
|
|
|
+ >+ 添加</el-button>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
<el-button @click="data.bSwitch = false">取 消</el-button>
|
|
|
- <el-button type="primary" @click="submitForm('ruleForm')">确 定</el-button>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ @click="submitForm('ruleForm')"
|
|
|
+ >确 定</el-button>
|
|
|
</span>
|
|
|
</el-dialog>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { ssczAdd, ssczSave } from '@/api/dict'
|
|
|
+import { add_word_map, edit_word_map } from '@/api/dict'
|
|
|
export default {
|
|
|
props: {
|
|
|
data: {
|
|
@@ -49,25 +63,15 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ inputVisible: false,
|
|
|
+ inputValue: '',
|
|
|
ruleForm: {
|
|
|
- ssbm: '',
|
|
|
- ssmc: '',
|
|
|
- sslb: '',
|
|
|
- lrxx: ''
|
|
|
+ name: '',
|
|
|
+ keywords: []
|
|
|
},
|
|
|
rules: {
|
|
|
- ssbm: [
|
|
|
- { required: true, message: '请输入', trigger: 'blur' }
|
|
|
- ],
|
|
|
- ssmc: [
|
|
|
- { required: true, message: '请输入', trigger: 'blur' }
|
|
|
- ],
|
|
|
- sslb: [
|
|
|
- { required: true, message: '请选择', trigger: 'blur' }
|
|
|
- ],
|
|
|
- lrxx: [
|
|
|
- { required: true, message: '请选择', trigger: 'blur' }
|
|
|
- ]
|
|
|
+ name: [{ required: true, message: '请输入', trigger: 'blur' }],
|
|
|
+ keywords: [{ required: true, message: '请输入', trigger: 'blur' }]
|
|
|
}
|
|
|
}
|
|
|
},
|
|
@@ -78,31 +82,43 @@ export default {
|
|
|
},
|
|
|
created() {
|
|
|
if (this.data.row.id) {
|
|
|
- const {
|
|
|
- SSBM,
|
|
|
- SSMC,
|
|
|
- SSLB,
|
|
|
- LRXX,
|
|
|
- id } = this.data.row
|
|
|
- this.ruleForm.ssbm = SSBM
|
|
|
- this.ruleForm.ssmc = SSMC
|
|
|
+ const { name, keyword, id } = this.data.row
|
|
|
+ this.ruleForm.name = name
|
|
|
+ this.ruleForm.keywords = keyword.split('、')
|
|
|
this.ruleForm.id = id
|
|
|
- this.ruleForm.sslb = SSLB
|
|
|
- this.ruleForm.lrxx = LRXX
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ handleClose(tag) {
|
|
|
+ this.ruleForm.keywords.splice(this.ruleForm.keywords.indexOf(tag), 1)
|
|
|
+ },
|
|
|
+
|
|
|
+ showInput() {
|
|
|
+ this.inputVisible = true
|
|
|
+ this.$nextTick((_) => {
|
|
|
+ this.$refs.saveTagInput.$refs.input.focus()
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ handleInputConfirm() {
|
|
|
+ const inputValue = this.inputValue
|
|
|
+ if (inputValue) {
|
|
|
+ this.ruleForm.keywords.push(inputValue)
|
|
|
+ }
|
|
|
+ this.inputVisible = false
|
|
|
+ this.inputValue = ''
|
|
|
+ },
|
|
|
submitForm(formName) {
|
|
|
this.$refs[formName].validate(async(valid) => {
|
|
|
if (valid) {
|
|
|
if (this.ruleForm.id) {
|
|
|
- ssczSave(this.ruleForm).then(res => {
|
|
|
+ edit_word_map(this.ruleForm).then((res) => {
|
|
|
this.data.bSwitch = false
|
|
|
this.$emit('refresh')
|
|
|
this.$message.success(res.m || '操作成功')
|
|
|
})
|
|
|
} else {
|
|
|
- ssczAdd(this.ruleForm).then(res => {
|
|
|
+ add_word_map(this.ruleForm).then((res) => {
|
|
|
this.data.bSwitch = false
|
|
|
this.$emit('refresh')
|
|
|
this.$message.success(res.m || '操作成功')
|
|
@@ -120,5 +136,24 @@ export default {
|
|
|
<style lang="scss" scoped>
|
|
|
.demo-ruleForm {
|
|
|
width: 80%;
|
|
|
+ .el-tag {
|
|
|
+ margin-right: 10px;
|
|
|
+ margin-bottom: 10px;
|
|
|
+ }
|
|
|
+ // .el-tag + .el-tag {
|
|
|
+ // margin-right: 10px;
|
|
|
+ // }
|
|
|
+ .button-new-tag {
|
|
|
+ margin-right: 10px;
|
|
|
+ height: 32px;
|
|
|
+ line-height: 30px;
|
|
|
+ padding-top: 0;
|
|
|
+ padding-bottom: 0;
|
|
|
+ }
|
|
|
+ .input-new-tag {
|
|
|
+ width: 90px;
|
|
|
+ margin-right: 10px;
|
|
|
+ vertical-align: top;
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|