| | |
| | | @current-change="currentChange" |
| | | > |
| | | <template slot="menuLeft" slot-scope="scope"> |
| | | <el-button icon="el-icon-plus" size="small" type="primary" @click="rowSaveHandlerClick">创建</el-button> |
| | | <el-button icon="el-icon-plus" plain size="small" type="primary" @click="rowSaveHandlerClick">创建</el-button> |
| | | <el-button icon="el-icon-delete" plain size="small" type="danger" @click="allDelHandler">删除</el-button> |
| | | <el-button icon="el-icon-view" plain size="small" type="primary" @click="chekView">查看使用范围</el-button> |
| | | <el-button icon="el-icon-download" plain size="small" type="primary" @click="downloadTemplateHandler">下载导入模板 |
| | | </el-button> |
| | | <el-button icon="el-icon-download" plain size="small" type="primary" @click="downloadTemplateHandler">下载导入模板</el-button> |
| | | <el-button icon="el-icon-upload2" plain size="small" type="primary" @click="upLoadHandler">导入</el-button> |
| | | <el-button icon="el-icon-download" plain size="small" type="primary" @click="downLoadHandler">导出</el-button> |
| | | </template> |
| | |
| | | <el-row> |
| | | <div class="addDialog"> |
| | | <div> |
| | | |
| | | <h3>属性项</h3> |
| | | |
| | | <el-col :span="12"> |
| | | <el-form-item label="名称:" prop="id"> |
| | | <el-input v-model="form.id"></el-input> |
| | |
| | | </el-form-item> |
| | | |
| | | |
| | | <el-form-item :label="form.enumSwitch ? '枚举选择:' : '添加枚举值:'" prop="enumSwitch"> |
| | | <el-form-item :label="form.enumSwitch ? '枚举选择:' : '添加值域:'" prop="enumSwitch"> |
| | | <el-select v-if="form.enumSwitch" v-model="form.enumId" placeholder="请选择枚举类型" |
| | | @change="enumSelectChange"> |
| | | <el-option v-for="(item,index) in attributeDataTypePickList" :key="index" :label="item.key" |
| | |
| | | <el-button size="mini" @click="enumAddHandler"> = </el-button> |
| | | </div> |
| | | </el-form-item> |
| | | <el-form-item label="当前枚举值:" prop="rangeValue"> |
| | | <textarea v-model="form.rangeValue" |
| | | <el-form-item :label="form.enumSwitch ? '当前枚举值:' : '当前值域:'" prop="rangeValue"> |
| | | <textarea v-model="form.rangeValue" :readonly="form.enumSwitch" |
| | | style="width: 330px; height: 80px; border: 1px solid #DCDFE6; overflow: auto; text-align: left;resize: none;"> |
| | | </textarea> |
| | | </el-form-item> |
| | |
| | | </el-form-item> |
| | | |
| | | |
| | | <el-form-item :label="form.enumSwitch ? '枚举选择:' : '添加枚举值:'" prop="enumSwitch"> |
| | | <el-form-item :label="form.enumSwitch ? '枚举选择:' : '添加值域:'" prop="enumSwitch"> |
| | | <el-select v-if="form.enumSwitch" v-model="form.enumId" placeholder="请选择枚举类型" |
| | | @change="enumSelectChange"> |
| | | <el-option v-for="(item,index) in attributeDataTypePickList" :key="index" :label="item.key" |
| | |
| | | </el-form-item> |
| | | <el-form-item v-if="!form.enumSwitch" label="运算符:"> |
| | | <div> |
| | | <el-button size="mini" @click="operationHandler('>')"> > </el-button> |
| | | <el-button size="mini" @click="operationHandler('<')"> < </el-button> |
| | | <el-button size="mini" @click="operationHandler('>=')"> >= </el-button> |
| | | <el-button size="mini" @click="operationHandler('<=')"> <= </el-button> |
| | | <el-button size="mini" @click="operationHandler('=')"> = </el-button> |
| | | <el-button size="mini" @click="operationHandler('!=')"> != </el-button> |
| | | <el-button size="mini" @click="operationHandler('()')"> () </el-button> |
| | | <el-button size="mini" @click="operationHandler('>')"> ></el-button> |
| | | <el-button size="mini" @click="operationHandler('<')"> <</el-button> |
| | | <el-button size="mini" @click="operationHandler('>=')"> >=</el-button> |
| | | <el-button size="mini" @click="operationHandler('<=')"> <=</el-button> |
| | | <el-button size="mini" @click="operationHandler('=')"> =</el-button> |
| | | <el-button size="mini" @click="operationHandler('!=')"> !=</el-button> |
| | | <el-button size="mini" @click="operationHandler('()')"> ()</el-button> |
| | | </div> |
| | | </el-form-item> |
| | | <el-form-item label="当前枚举值:" prop="rangeValue"> |
| | | <textarea v-model="form.rangeValue" |
| | | <el-form-item :label="form.enumSwitch ? '当前枚举值:' : '当前值域:'" prop="rangeValue"> |
| | | <textarea v-model="form.rangeValue" :readonly="form.enumSwitch" |
| | | style="width: 330px; height: 80px; border: 1px solid #DCDFE6; overflow: auto; text-align: left;resize: none;"> |
| | | </textarea> |
| | | </el-form-item> |
| | |
| | | <!-- VTDouble --> |
| | | <div v-if="form.attributeDataType === 'VTDouble'" class="right"> |
| | | <h3>值域</h3> |
| | | <el-form-item label="添加枚举值:" prop="enumAddValue"> |
| | | <el-form-item :label="form.enumSwitch ? '枚举选择:' : '添加值域:'" prop="enumAddValue"> |
| | | <el-input v-model="form.enumAddValue"> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="运算符:"> |
| | | <div> |
| | | <el-button size="mini" @click="operationHandler('>')"> > </el-button> |
| | | <el-button size="mini" @click="operationHandler('<')"> < </el-button> |
| | | <el-button size="mini" @click="operationHandler('>=')"> >= </el-button> |
| | | <el-button size="mini" @click="operationHandler('<=')"> <= </el-button> |
| | | <el-button size="mini" @click="operationHandler('=')"> = </el-button> |
| | | <el-button size="mini" @click="operationHandler('!=')"> != </el-button> |
| | | <el-button size="mini" @click="operationHandler('()')"> () </el-button> |
| | | <el-button size="mini" @click="operationHandler('>')"> ></el-button> |
| | | <el-button size="mini" @click="operationHandler('<')"> <</el-button> |
| | | <el-button size="mini" @click="operationHandler('>=')"> >=</el-button> |
| | | <el-button size="mini" @click="operationHandler('<=')"> <=</el-button> |
| | | <el-button size="mini" @click="operationHandler('=')"> =</el-button> |
| | | <el-button size="mini" @click="operationHandler('!=')"> !=</el-button> |
| | | <el-button size="mini" @click="operationHandler('()')"> ()</el-button> |
| | | </div> |
| | | </el-form-item> |
| | | <el-form-item label="当前枚举值:" prop="rangeValue"> |
| | | <el-form-item :label="form.enumSwitch ? '当前枚举值:' : '当前值域:'" prop="rangeValue"> |
| | | <textarea v-model="form.rangeValue" |
| | | style="width: 330px; height: 80px; border: 1px solid #DCDFE6; overflow: auto; text-align: left;resize: none;"> |
| | | </textarea> |
| | |
| | | append-to-body="true" |
| | | class="avue-dialog" |
| | | title="查看使用范围" |
| | | width="70%" |
| | | width="60%" |
| | | > |
| | | <avue-crud |
| | | ref="checkViewCrud" |
| | |
| | | getUsedAttributeList, |
| | | getEnumMapByType, |
| | | deleteAttributes, |
| | | download, |
| | | exportAttributes, |
| | | downloadAttributeTemplate, |
| | | getBizTypes, |
| | | getAllLtName, |
| | |
| | | addBtn: false, |
| | | editBtn: false, |
| | | delBtn: false, |
| | | menuWidth:160, |
| | | column |
| | | }, |
| | | tableLoading: false, |
| | |
| | | ], |
| | | upFileType: ['xls', 'xlsx'], |
| | | fileUrl: 'api/attributeController/importAttributes', |
| | | lastIndex: null |
| | | } |
| | | }, |
| | | computed: { |
| | |
| | | this.form.attributeDataType === 'VTFilePath'; |
| | | }, |
| | | rangeOptionValue() { |
| | | return this.form.rangeValue.split('\n') |
| | | let values = this.form.rangeValue.split('\n'); |
| | | |
| | | // 处理每个值,去除等号前的部分,只保留等号后的部分 |
| | | return values.map(value => { |
| | | let parts = value.split('='); |
| | | return parts.length > 1 ? parts[1].trim() : value.trim(); |
| | | }); |
| | | } |
| | | }, |
| | | methods: { |
| | |
| | | |
| | | // 点击行 |
| | | rowClickHandler(row) { |
| | | this.$refs.userCrud.toggleRowSelection(row); |
| | | func.rowClickHandler( |
| | | row, |
| | | this.$refs.userCrud, |
| | | this.lastIndex, |
| | | (newIndex) => { |
| | | this.lastIndex = newIndex; |
| | | }, |
| | | () => { |
| | | this.selectList = []; |
| | | } |
| | | ); |
| | | }, |
| | | |
| | | // 条数 |
| | |
| | | enumSelectChange(val) { |
| | | const list = this.attributeDataTypePickList.find(item => item.key === val).values; |
| | | this.form.rangeValue = list.join('\n'); |
| | | this.form.defaultValue = list[0]; |
| | | this.form.defaultValue = this.rangeOptionValue[0]; |
| | | }, |
| | | |
| | | // 使用枚举switch滑块change事件 |
| | | switchEnumChange(status) { |
| | | if (status) { |
| | | this.form.enumId = this.attributeDataTypePickList[0].key; |
| | | this.form.defaultValue = this.attributeDataTypePickList[0].values[0]; |
| | | const list = this.attributeDataTypePickList[0].values; |
| | | this.form.rangeValue = list.join('\n'); |
| | | this.form.defaultValue = this.rangeOptionValue[0]; |
| | | } else { |
| | | this.form.defaultValue = ""; |
| | | this.form.rangeValue = ""; |
| | |
| | | linkTypeName: "", |
| | | rangeValue: "" |
| | | }; |
| | | if (this.dialogTitle === 'add') { |
| | | this.form.range = this.form.rangeValue.replace(/\n/g, ';'); |
| | | if (this.form.attributeSelectType === 'business') { |
| | | this.form.btmTypeId = this.form.referValue; |
| | | } else { |
| | | this.form.linkTypeName = this.form.referValue; |
| | | } |
| | | addAttribute(this.form).then(res => { |
| | | if (res.data.code === 200) { |
| | | this.$message.success(res.data.msg); |
| | | this.getTableList(); |
| | | this.form = form; |
| | | this.addVisible = false; |
| | | this.$refs.form.validate((valid) => { |
| | | if (valid) { |
| | | if (this.dialogTitle === 'add') { |
| | | this.form.range = this.form.rangeValue.replace(/\n/g, ';'); |
| | | if (this.form.attributeSelectType === 'business') { |
| | | this.form.btmTypeId = this.form.referValue; |
| | | } else { |
| | | this.form.linkTypeName = this.form.referValue; |
| | | } |
| | | addAttribute(this.form).then(res => { |
| | | if (res.data.code === 200) { |
| | | this.$message.success(res.data.obj); |
| | | this.getTableList(); |
| | | this.form = form; |
| | | this.addVisible = false; |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | if (this.dialogTitle === 'edit') { |
| | | this.form.range = this.form.rangeValue.replace(/\n/g, ';'); |
| | | if (this.form.attributeSelectType === 'business') { |
| | | this.form.btmTypeId = this.form.referValue; |
| | | } else { |
| | | this.form.linkTypeName = this.form.referValue; |
| | | } |
| | | updateAttribute(this.form).then(res => { |
| | | if (res.data.code === 200) { |
| | | this.$message.success(res.data.obj); |
| | | this.getTableList(); |
| | | this.form = form; |
| | | this.addVisible = false; |
| | | if (this.dialogTitle === 'edit') { |
| | | this.form.range = this.form.rangeValue.replace(/\n/g, ';'); |
| | | if (this.form.attributeSelectType === 'business') { |
| | | this.form.btmTypeId = this.form.referValue; |
| | | } else { |
| | | this.form.linkTypeName = this.form.referValue; |
| | | } |
| | | updateAttribute(this.form).then(res => { |
| | | if (res.data.code === 200) { |
| | | this.$message.success(res.data.obj); |
| | | this.getTableList(); |
| | | this.form = form; |
| | | this.addVisible = false; |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | } else { |
| | | return false; |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | // 导入 |
| | |
| | | } |
| | | |
| | | let attrNames = this.selectList.map(item => item.id).join(','); |
| | | download({attrNames: attrNames}).then(res => { |
| | | exportAttributes({attrNames: attrNames}).then(res => { |
| | | func.downloadFileByBlobHandler(res); |
| | | this.$message.success('导出成功'); |
| | | }).catch(err => { |