|
@@ -9,6 +9,12 @@
|
|
|
</el-input>
|
|
|
<el-button style="margin-left: 5px;" @click="searchRuleEvent">查询</el-button>
|
|
|
</div>
|
|
|
+ <el-button type="danger"
|
|
|
+ class="cy-nav-btn"
|
|
|
+ icon="el-icon-delete"
|
|
|
+ size="mini"
|
|
|
+ @click="multipleDelModel"
|
|
|
+ style="float: right;">批量删除</el-button>
|
|
|
<el-button type="primary" class="cy-nav-btn" icon="el-icon-circle-plus-outline" size="mini" @click="handleAdd">新增四则运算</el-button>
|
|
|
<el-button type="primary" class="cy-nav-btn" icon="el-icon-circle-plus-outline" size="mini" @click="handleReplace">新增值替换</el-button>
|
|
|
<el-divider></el-divider>
|
|
@@ -16,8 +22,11 @@
|
|
|
<el-table
|
|
|
:data="tableData" border :stripe="true"
|
|
|
:header-cell-style="{background: '#E8E8E8'}"
|
|
|
+ @selection-change="selectionLineChangeHandle"
|
|
|
@sort-change="sortChange"
|
|
|
style="width: 100%;">
|
|
|
+ <el-table-column type="selection" width="55" align="center"/>
|
|
|
+ <el-table-column type="index" label="序号" width="60" fixed align="center"/>
|
|
|
<el-table-column
|
|
|
align="center"
|
|
|
sortable="custom"
|
|
@@ -168,7 +177,7 @@
|
|
|
placeholder="请输入值" style="width: 110px; margin: 0 10px;"></el-input>
|
|
|
<span>时,则替换成</span>
|
|
|
<el-input-number v-model="dataModelForm.replacingValue" size="mini" placeholder="请输入替换值"
|
|
|
- :min="0" :max="99" :controls="false" :precision="0" style="width: 110px; margin-left: 10px;"></el-input-number>
|
|
|
+ :controls="false" :precision="0" style="width: 110px; margin-left: 10px;"></el-input-number>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="替换规则②" prop="operationRuleTwo">
|
|
|
<span>当数据项值为</span>
|
|
@@ -176,7 +185,7 @@
|
|
|
placeholder="请输入值" style="width: 110px; margin: 0 10px;"></el-input>
|
|
|
<span>时,则替换成</span>
|
|
|
<el-input-number v-model="dataModelForm.replacingValueTwo" size="mini" placeholder="请输入替换值"
|
|
|
- :min="0" :max="99" :controls="false" :precision="0" style="width: 110px; margin-left: 10px;"></el-input-number>
|
|
|
+ :controls="false" :precision="0" style="width: 110px; margin-left: 10px;"></el-input-number>
|
|
|
</el-form-item>
|
|
|
<el-form-item style="text-align: center;">
|
|
|
<el-button type="primary" @click="saveDataModelEvent">确定</el-button>
|
|
@@ -230,7 +239,7 @@ import {
|
|
|
delDataModelById,
|
|
|
getAllDataModel, getDataModelById,
|
|
|
testDataModelById, testDataModelByModel,
|
|
|
- updateDataModel
|
|
|
+ updateDataModel, delDataModelByIdList
|
|
|
} from "@/api/datasource";
|
|
|
|
|
|
export default {
|
|
@@ -240,6 +249,7 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ selectionItems: [],
|
|
|
breadcrumbList: ['数据模型'],
|
|
|
dialogDataModelVisible: false,
|
|
|
dialogDataModelTestVisible: false,
|
|
@@ -491,6 +501,16 @@ export default {
|
|
|
saveDataModelEvent() {
|
|
|
this.$refs['dataModelForm'].validate((valid) => {
|
|
|
if (valid) {
|
|
|
+ const val1 = parseInt(this.dataModelForm.replacingValue);
|
|
|
+ if (val1 < 0 || val1 > 99) {
|
|
|
+ showAlertMsgWin(this, null, '替换规则①的替换值只能为0到99的整数,请重新输入!')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const val2 = parseInt(this.dataModelForm.replacingValueTwo);
|
|
|
+ if (val2 < 0 || val2 > 99) {
|
|
|
+ showAlertMsgWin(this, null, '替换规则②的替换值只能为0到99的整数,请重新输入!')
|
|
|
+ return
|
|
|
+ }
|
|
|
if (this.dataModelForm.operationRule == this.dataModelForm.operationRuleTwo) {
|
|
|
showAlertMsgWin(this, null, '值替换时两个规则不能一致!')
|
|
|
return
|
|
@@ -584,7 +604,35 @@ export default {
|
|
|
if (this.$refs['dataModelForm']) this.$refs['dataModelForm'].resetFields()
|
|
|
if (this.$refs['dataModelTestForm']) this.$refs['dataModelTestForm'].resetFields()
|
|
|
}
|
|
|
- }
|
|
|
+ },
|
|
|
+ /** 多选事件 */
|
|
|
+ selectionLineChangeHandle(val) {
|
|
|
+ this.selectionItems = val
|
|
|
+ },
|
|
|
+ /** 批量删除组数据中数据项 */
|
|
|
+ multipleDelModel() {
|
|
|
+ if (!this.selectionItems || this.selectionItems.length == 0) {
|
|
|
+ showAlertMsgWin(this, null, '请至少选择一条表达式!')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ showConfirmWin(this, null, '您确定要删除已选择的表达式吗?', () => {
|
|
|
+ let ids = Array.from(this.selectionItems, ({ id }) => id)
|
|
|
+ this.delItems(ids)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /** 删除数据项 */
|
|
|
+ delItems(ids) {
|
|
|
+ const loading = showLoading(this, '删除中,请稍候···')
|
|
|
+ delDataModelByIdList(ids).then(res => {
|
|
|
+ loading.close()
|
|
|
+ showAlertMsgWin(this, null, '删除成功!')
|
|
|
+ this.tablePage = 1
|
|
|
+ this.getAllDataModel()
|
|
|
+ }).catch((e) => {
|
|
|
+ loading.close()
|
|
|
+ showAlertWin(this, null, e)
|
|
|
+ })
|
|
|
+ },
|
|
|
}
|
|
|
}
|
|
|
</script>
|