morphone1995 4 年之前
父节点
当前提交
4fdc429b5f

+ 1 - 0
src/api/config.js

@@ -93,6 +93,7 @@ export default {
     'conditionBillmanIndex': '/billman/conditionIndex',   //条件明细检索
     'getRecordByRelationId': '/billman/getRecordByRelationId',   //查询单条规则 
     'saveBillmanRecord': '/billman/saveRecord',   //保存规则 
+    'updateBillmanStatus': '/billman/updateStatus',   //启用禁用
 
     'getAccessdMenu': '/sys/user/getUserOrgMenu',  //获取左侧菜单项
     'delConceptInfo':'/graph/conceptInfo/changeStatus',   //删除术语静态知识

+ 3 - 0
src/api/icss.js

@@ -285,5 +285,8 @@ export default {
   saveBillmanRecord(param) {
     return request({ method: 'post', url: urls.saveBillmanRecord, data: param });
   },
+  updateBillmanStatus(param) {
+    return request({ method: 'post', url: urls.updateBillmanStatus, data: param });
+  },
 
 };

+ 16 - 6
src/components/icss/bill/AddBill.vue

@@ -19,6 +19,7 @@
                 placeholder="请选择规则类型"
                 clearable
                 style="width: 100%"
+                @change="handleRuleType"
               >
                 <el-option label="文本类型" :value="1"></el-option>
                 <el-option label="数值类型" :value="2"></el-option>
@@ -78,6 +79,7 @@
               ref="subForm"
               @split="splitRuleName"
               @handleInput="handleInput"
+              v-if="showCom"
             ></ConditionForm>
             <Description :type="form.ruleType"></Description>
             <el-form-item>
@@ -94,7 +96,7 @@
 import api from '@api/icss.js';
 import config from '@api/config.js';
 import utils from '@api/utils.js';
-import ConditionForm from './ConditionForm';
+import ConditionForm from './ConditionForm1';
 import Description from './Description';
 export default {
   name: 'AddBill',
@@ -140,7 +142,7 @@ export default {
         },
         relationId: 1146770,
         relationName: '',
-        relationStatus: '',
+        relationStatus: ''
       },
       conceptList: [],
       rules: {
@@ -160,7 +162,8 @@ export default {
       },
       saveDisable: false, //保存按钮禁止点击
       isEdit: false, // 是否处于编辑页面 false--新增   true--编辑
-      showDrop: false //下拉框显示文字
+      showDrop: false, //下拉框显示文字
+      showCom: true
     };
   },
   created() {
@@ -199,7 +202,7 @@ export default {
       // console.log(this.form.concept, '===========this.form.concept');
     },
     handleInput(data) {
-      // console.log(data, '父组件接受的数据');
+      console.log(data, '父组件接受的数据');
       if (data.type === 'minValue') {
         this.form.condition.minValue = data.value;
       } else if (data.type === 'maxValue') {
@@ -222,6 +225,12 @@ export default {
       this.conceptList = [];
       this.form.conceptName = '';
     },
+    handleRuleType() {
+      this.showCom = false;
+      setTimeout(() => {
+        this.showCom = true;
+      }, 0);
+    },
     // 搜索列表
     searchTerms(query) {
       if (!query) {
@@ -254,8 +263,8 @@ export default {
         condition: {
           conditionLabel: condition.conditionLabel,
           id: condition.id,
-          maxValue: +condition.maxValue,
-          minValue: +condition.minValue,
+          maxValue: condition.maxValue,
+          minValue: condition.minValue,
           name: condition.name,
           range: condition.range,
           status: condition.status,
@@ -268,6 +277,7 @@ export default {
         // ruleName: 'string',
         // type: 0
       };
+      console.log(params,'params');
       return params;
     },
 

+ 11 - 8
src/components/icss/bill/Bill.vue

@@ -32,26 +32,27 @@
         </el-table-column>
         <el-table-column :resizable="false" prop="operate" label="操作">
           <template slot-scope="scope">
-            <el-button v-if="scope.row.status===0" type="text" size="small" class="is-disabled">修改</el-button>
+             <el-button v-if="scope.row.relationStatus===0" type="text" size="small" class="is-disabled">修改</el-button>
             <el-button
-              v-if="scope.row.relationStatus===1"
+              v-if="scope.row.relationStatus==1"
               type="text"
               size="small"
               @click="toEditProduct(scope.row)"
             >修改</el-button>
+            
             <span style="margin:0 3px;">|</span>
             <el-button
               v-if="scope.row.relationStatus===0"
               type="text"
               size="small"
-              @click="showReuseDialog(scope.row)"
+              @click="showReuseDialog(scope.row,'Reuse')"
             >启用</el-button>
             <el-button
               v-if="scope.row.relationStatus===1"
               type="text"
               size="small"
               class="delete"
-              @click="showDelDialog(scope.row)"
+              @click="showReuseDialog(scope.row,'Del')"
             >禁用</el-button>
           </template>
         </el-table-column>
@@ -127,12 +128,14 @@ export default {
       });
     },
 
-    showReuseDialog(row) {
+    showReuseDialog(row, type) {
+      let showInfo = type !== 'Del' ? '启用' : '禁用';
+      let status = type === 'Del' ? 0 : 1;
       this.showConfirmDialog(
-        '确定启用该静态知识?',
+        `确定要${showInfo}该规则吗?`,
         () => {
           api
-            .delConceptInfo({ id: row.id, status: 1 })
+            .updateBillmanStatus({ relationId: row.relationId, status })
             .then(res => {
               if (res.data.code == '0') {
                 this.currentPage = 1; //恢复数据跳转到筛选条件下首页
@@ -149,7 +152,7 @@ export default {
               this.warning(error);
             });
         },
-        'Reuse'
+        type
       );
     },
     showConfirmDialog(msg, resolve, type) {

+ 27 - 21
src/components/icss/bill/ConditionForm.vue

@@ -79,10 +79,10 @@
                 @clear="handleClear"
                 v-if="top"
               >
-                <el-option label="大于" :value="4" :disabled="compareBottom==3 || compareBottom==4"></el-option>
-                <el-option label="大于等于" :value="3" :disabled="compareBottom==3 || compareBottom==4"></el-option>
-                <el-option label="小于" :value="2" :disabled="compareBottom==1 || compareBottom==2"></el-option>
-                <el-option label="小于等于" :value="1" :disabled="compareBottom==1 || compareBottom==2"></el-option>
+                <el-option label="大于" value="大于等于" :disabled="compareBottom=='大于等于' || compareBottom=='大于'"></el-option>
+                <el-option label="大于等于" value="大于" :disabled="compareBottom=='大于等于' || compareBottom=='大于'"></el-option>
+                <el-option label="小于" value="小于等于" :disabled="compareBottom=='小于' || compareBottom=='小于等于'"></el-option>
+                <el-option label="小于等于" value="小于" :disabled="compareBottom=='小于' || compareBottom=='小于等于'"></el-option>
               </el-select>
             </el-form-item>
             <el-form-item label-width="0px">
@@ -96,10 +96,10 @@
                 @clear="handleClear"
                 v-if="bottom"
               >
-                <el-option label="大于" :value="4" :disabled="compareTop==3 ||compareTop==4 "></el-option>
-                <el-option label="大于等于" :value="3" :disabled="compareTop==3 ||compareTop==4 "></el-option>
-                <el-option label="小于" :value="2" :disabled="compareTop==1 ||compareTop==2 "></el-option>
-                <el-option label="小于等于" :value="1" :disabled="compareTop==1 ||compareTop==2 "></el-option>
+                <el-option label="大于" value="大于等于" :disabled="compareTop=='小于' || compareTop=='小于等于'"></el-option>
+                <el-option label="大于等于" value="大于" :disabled="compareTop=='小于' || compareTop=='小于等于'"></el-option>
+                <el-option label="小于" value="小于等于" :disabled="compareTop=='大于等于' || compareTop=='大于'"></el-option>
+                <el-option label="小于等于" value="小于" :disabled="compareTop=='大于等于' || compareTop=='大于'"></el-option>
               </el-select>
             </el-form-item>
           </el-col>
@@ -110,14 +110,14 @@
                   v-model="form.minValue"
                   ref="minValue"
                   placeholder="minValue Top"
-                  v-if="compareTop>=3"
+                  v-if="compareTop=='大于等于' || compareTop=='大于' || compareTop==''"
                   @blur="handleChange('minValue')"
                 ></el-input>
                 <el-input
                   v-model="form.maxValue"
                   ref="maxValue"
                   placeholder="maxValue Top"
-                  v-if="compareTop<=2"
+                  v-if="compareTop=='小于' || compareTop=='小于等于' "
                   @blur="handleChange('maxValue')"
                 ></el-input>
               </el-form-item>
@@ -128,14 +128,14 @@
                   v-model="form.minValue"
                   ref="minValue"
                   placeholder="minValue Bottom"
-                  v-if="compareBottom>=3"
+                  v-if="compareBottom=='大于等于' || compareBottom=='大于'"
                   @blur="handleChange('minValue')"
                 ></el-input>
                 <el-input
                   v-model="form.maxValue"
                   ref="maxValue"
                   placeholder="maxValue Bottom"
-                  v-if="compareBottom<=2"
+                  v-if="compareBottom=='小于' || compareBottom=='小于等于' || compareBottom==''"
                   @blur="handleChange('maxValue')"
                 ></el-input>
               </el-form-item>
@@ -381,19 +381,27 @@ export default {
   },
   created() {
     this.form = { ...this.data };
-    const { maxValue, minValue } = this.data;
-    if ((maxValue || maxValue == 0) && (minValue || minValue == 0)) {
+    const { maxValue, minValue } = this.form;
+    if (minValue === '' && maxValue === '') {
+      this.top = true;
+      this.bottom = false;
+    } else if (minValue === '' && maxValue !== '') {
+      this.top = true;
+      this.bottom = false;
+
+    } else if (!minValue === '' && maxValue === '') {
+      this.top = true;
+      this.bottom = false;
+    } else {
       this.top = true;
       this.bottom = true;
-      this.compareTop = 3;
-      this.compareBottom = 1;
-      console.log(this.bottom, 'this.bottom');
+      // this.compareTop = 3;
+      // this.compareBottom = 1;
     }
   },
   methods: {
     //
     handleChange(val) {
-      // console.log(val, 'val');
       if (val === 'minValue') {
         this.$emit('handleInput', {
           type: 'minValue',
@@ -420,15 +428,13 @@ export default {
       } else if (form === 'firstCut') {
         this.top = false;
         this.bottom = true;
-        this.compareTop = '';
+        // this.compareTop = '';
       } else if (form === 'secCut') {
         this.top = true;
         this.bottom = false;
-        this.compareBottom = '';
       }
     },
     changeWord(val) {
-      // console.log(val);
       let condition = this.conditionList.find(item => item.name == val);
       this.$emit('split', condition);
     },

+ 315 - 0
src/components/icss/bill/ConditionForm1.vue

@@ -0,0 +1,315 @@
+<template>
+  <el-form :model="form" ref="form" class="sub-form" :validate-on-rule-change="false">
+    <!-- 文本类型 -->
+    <el-form-item label="条件明细" label-width="80px" v-if="ruleType==1">
+      <el-select
+        style="width:100%;minWidth: 240px"
+        v-model="form.name"
+        filterable
+        remote
+        clearable
+        :loading="showDrop"
+        loading-text="加载中..."
+        @change="changeWord"
+        @visible-change="handleVisible"
+        placeholder="搜索开单项目"
+        :remote-method="searchCondition"
+        reserve-keyword
+        ref="conditionListName"
+      >
+        <el-option
+          v-for="item in conditionList"
+          :key="item.id + item.name"
+          :label="item.name"
+          :value="item.name"
+          :title="item.name"
+        ></el-option>
+      </el-select>
+    </el-form-item>
+
+    <el-row v-if="ruleType==2">
+      <el-col :span="8">
+        <el-form-item label="条件明细" label-width="80px" v-if="ruleType==2">
+          <el-select
+            style="width:100%"
+            v-model="form.name"
+            filterable
+            remote
+            clearable
+            :loading="showDrop"
+            loading-text="加载中..."
+            @change="changeWord"
+            @visible-change="handleVisible"
+            placeholder="搜索开单项目"
+            :remote-method="searchCondition"
+            reserve-keyword
+            ref="conditionListName"
+          >
+            <el-option
+              v-for="item in conditionList"
+              :key="item.id + item.name"
+              :label="item.name"
+              :value="item.name"
+              :title="item.name"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label label-width="0px" v-if="ruleType==2&&isOpen">
+          <span class="font">1</span>
+        </el-form-item>
+      </el-col>
+
+      <el-col :span="16" v-for="(item,index) in ruleForm" :key="index">
+        <el-row>
+          <el-col :span="8">
+            <el-select v-model="item.compare" placeholder="请输入比较" style="width: 100%">
+              <el-option label="大于" value=">"></el-option>
+              <el-option label="大于等于" value=">="></el-option>
+              <el-option label="小于" value="<"></el-option>
+              <el-option label="小于等于" value="<="></el-option>
+            </el-select>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label-width="0px">
+              <el-input
+                v-model="item.value"
+                placeholder="填写数值"
+                @blur="handleValue('value',index)"
+                :disabled="item.compare ==''"
+              ></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label-width="0px">
+              <el-input v-model="item.unit" placeholder="填写单位" @blur="handleValue('unit',index)"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="1" class="operation">
+            <div class="icon">
+              <img src="../../../images/plus.png" v-if="!isOpen" @click="addForm()" />
+              <img src="../../../images/cut.png" v-if="isOpen" @click="cutForm(index)" />
+            </div>
+          </el-col>
+        </el-row>
+      </el-col>
+    </el-row>
+  </el-form>
+</template>
+
+<script>
+import api from '@api/icss.js';
+export default {
+  name: 'ConditionForm',
+  props: ['data', 'type', 'conceptName', 'ruleType'],
+  data() {
+    return {
+      showDrop: false,
+      conditionList: [],
+      form: {
+        conditionLabel: '',
+        id: '',
+        maxValue: '',
+        minValue: '',
+        name: '',
+        range: '',
+        status: '',
+        unit: ''
+      },
+      ruleForm: [
+        {
+          compare: '',
+          value: '',
+          unit: ''
+        }
+      ]
+    };
+  },
+  computed: {
+    isOpen() {
+      if (this.ruleForm.length === 2) {
+        return true;
+      } else {
+        return false;
+      }
+    }
+  },
+  created() {
+    this.form = { ...this.data };
+    const { maxValue, minValue, unit } = this.form;
+    if (minValue !== null && maxValue !== null) {
+      this.ruleForm = [
+        {
+          compare: '>=',
+          value: minValue,
+          unit: unit
+        },
+        {
+          compare: '<=',
+          value: maxValue,
+          unit: unit
+        }
+      ];
+    } else if (minValue === null && maxValue !== null) {
+      this.ruleForm = [
+        {
+          compare: '<=',
+          value: maxValue,
+          unit: unit
+        }
+      ];
+    } else if (minValue !== null && maxValue === null) {
+      this.ruleForm = [
+        {
+          compare: '>=',
+          value: minValue,
+          unit: unit
+        }
+      ];
+    } else {
+      this.ruleForm = [
+        {
+          compare: '',
+          value: '',
+          unit: ''
+        }
+      ];
+    }
+  },
+  methods: {
+    changeWord(val) {
+      let condition = this.conditionList.find(item => item.name == val);
+      this.$emit('split', condition);
+    },
+    handleVisible(flag) {
+      if (!flag) {
+        this.conceptList = [];
+      }
+    },
+    // 搜索列表
+    searchCondition(query) {
+      const { data, type, conceptName, ruleType } = this;
+      if (!query) {
+        this.conditionList = [];
+        return;
+      }
+      this.showDrop = true;
+      let params = {
+        type,
+        conceptName,
+        ruleType,
+        conditionName: query
+      };
+      api.conditionBillmanIndex(params).then(res => {
+        this.showDrop = false;
+        if (res.data.code == '0') {
+          this.conditionList = res.data.data;
+        }
+      });
+    },
+    // 编辑规则
+    handleValue(from, idx) {
+      let item = this.ruleForm.find((item, index) => index == idx);
+      if ((item.compare == '>' || item.compare == '>=') && from == 'value') {
+        this.form.minValue = item.value;
+        this.$emit('handleInput', {
+          type: 'minValue',
+          value: this.form.minValue
+        });
+      } else if (
+        (item.compare == '<' || item.compare == '<=') &&
+        from == 'value'
+      ) {
+        this.form.maxValue = item.value;
+        this.$emit('handleInput', {
+          type: 'maxValue',
+          value: this.form.maxValue
+        });
+      } else if (from === 'unit') {
+        this.form.unit = item.unit;
+        this.$emit('handleInput', {
+          type: 'unit',
+          value: this.form.unit
+        });
+      }
+    },
+
+    // 新增表单
+    addForm() {
+      this.ruleForm.push({
+        compare: '',
+        value: '',
+        unit: ''
+      });
+    },
+    // 减少表单
+    cutForm(i) {
+      let item = this.ruleForm.find((item, index) => index == i);
+      console.log(item,'==========');
+      if (item.compare == '>' || item.compare == '>=') {
+        this.form.minValue = '';
+        this.$emit('handleInput', {
+          type: 'minValue',
+          value: this.form.minValue
+        });
+      } else if (item.compare == '<' || item.compare == '<=') {
+        this.form.maxValue = '';
+        this.$emit('handleInput', {
+          type: 'maxValue',
+          value: this.form.maxValue
+        });
+      }
+      this.ruleForm.splice(i, 1);
+    }
+  }
+};
+</script>
+
+<style lang="less">
+.condition {
+  /deep/ .el-form-item__label {
+    margin-left: 12px !important;
+  }
+  /deep/ .el-col {
+    padding-left: 0px !important;
+    padding-right: 4px !important;
+  }
+  /deep/ .el-form-item__error {
+    float: left;
+    top: 40px;
+    left: 12px;
+  }
+}
+
+.conditionName {
+  /deep/ .el-col {
+    padding-left: 0px !important;
+    padding-right: 0px !important;
+  }
+}
+.operation {
+  width: 0;
+  height: 30px;
+  position: relative;
+  .icon:before {
+    box-sizing: border-box;
+    position: absolute;
+    top: 20px;
+    left: 20px;
+    transform: translate(-50%, -50%);
+    -webkit-transform: translate(-50%, -50%);
+    width: 30px;
+    content: '';
+    height: 30px;
+  }
+  img {
+    position: relative;
+    width: 30px;
+    height: 30px;
+    top: 5px;
+    left: 10px;
+  }
+}
+.font {
+  color: #fff;
+}
+</style>