ソースを参照

Prompt任务-列表和添加

liyanyan 1 ヶ月 前
コミット
f361a20f27

+ 0 - 1
src/api/config.js

@@ -41,7 +41,6 @@ export function addConfig(data) {
   })
   })
 }
 }
 
 
-
 // 修改
 // 修改
 export function updateBmyLevel(data) {
 export function updateBmyLevel(data) {
   return request({
   return request({

+ 17 - 2
src/api/helper.js

@@ -8,6 +8,21 @@ export function addHelper(data) {
   })
   })
 }
 }
 
 
+export function getModelParams(params) {
+  return request({
+    url: '/quality_rule/get_select_object',
+    method: 'get',
+    params
+  })
+}
+
+export function getTaskNameData() {
+  return request({
+    url: '/big_model/get_task_name',
+    method: 'get'
+  })
+}
+
 export function getRule() {
 export function getRule() {
   return request({
   return request({
     url: '/big_model/get_case_rule',
     url: '/big_model/get_case_rule',
@@ -25,8 +40,8 @@ export function getInputSelect() {
 export function helperPage(params) {
 export function helperPage(params) {
   return request({
   return request({
     url: '/big_model/get_template',
     url: '/big_model/get_template',
-    method: 'get',
-    params
+    method: 'post',
+    data: params
   })
   })
 }
 }
 
 

+ 192 - 0
src/views/helper/components/AddModal.vue

@@ -0,0 +1,192 @@
+<template>
+  <div>
+    <el-dialog
+      width="950px"
+      :title="`${actionType == 'ADD' ? '新增' : '编辑'} Prompt 任务`"
+      :visible.sync="dialogFormVisible"
+      @close="handleCancel"
+    >
+      <el-tabs v-model="formData.type" @tab-click="handleClickTab">
+        <el-tab-pane :disabled="actionType !== 'ADD' && formData.type !== '1'" label="病历质控" name="1" />
+        <el-tab-pane :disabled="actionType !== 'ADD' && formData.type !== '2'" label="病历生成" name="2" />
+      </el-tabs>
+      <el-form ref="formDataRef" :model="formData" :rules="rules" label-width="140px">
+        <el-form-item label="任务名称" prop="rule_id">
+          <el-cascader
+            v-if="formData.type == 2"
+            v-model="formData.rule_id"
+            style="width: 100%;"
+            :options="scTaskNameList"
+            :props="{
+              value: 'id',
+              label: 'name',
+              children: 'child'
+            }"
+            placeholder="请选择"
+          />
+          <el-select
+            v-else
+            v-model="formData.rule_id"
+            filterable
+            clearable
+            style="width: 100%;"
+            placeholder="请选择"
+          >
+            <el-option
+              v-for="item of zkTaskNameList"
+              :key="item.id"
+              :label="item.notice"
+              :value="item.id"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="模型入参" prop="data_type">
+          <el-input
+            v-model="formData.data_type"
+            :placeholder="'请选择'"
+            size="small"
+            readonly
+            style="width: 100%"
+            @focus="openModelParamsDialog()"
+          />
+        </el-form-item>
+        <el-form-item label="提示工程" prop="content">
+          <el-input
+            v-model="formData.content"
+            type="textarea"
+            :autosize="{ minRows: 8, maxRows: 12 }"
+            placeholder="请输入"
+          />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="handleSubmit">发布</el-button>
+        <!-- <el-button @click="handleCancel">取消</el-button> -->
+        <el-button type="default" @click="handleTest">测试</el-button>
+      </div>
+    </el-dialog>
+    <ModelParamsModal ref="ModelParamsModalRef" @onSelect="handleSelect" />
+  </div>
+</template>
+
+<script>
+import { addHelper, getRule, getTaskNameData } from '@/api/helper'
+import ModelParamsModal from './ModelParamsModal.vue'
+export default {
+  components: {
+    ModelParamsModal
+  },
+  emits: ['onSuccess'],
+  data() {
+    return {
+      dialogFormVisible: false,
+      scTaskNameList: [],
+      zkTaskNameList: [],
+      formData: {
+        id: '',
+        type: '1',
+        rule_id: [],
+        data_type: '',
+        content: ''
+      },
+      rules: {
+        rule_id: [
+          { required: true, message: '请选择', trigger: 'blur' }
+        ],
+        data_type: [
+          { required: true, message: '请选择', trigger: 'xx' }
+        ],
+        content: [
+          { required: true, message: '请输入', trigger: 'blur' }
+        ]
+      },
+      actionType: 'ADD',
+      selectModelDataList: []
+    }
+  },
+  created() {
+    this.getSCTaskNameList()
+    this.getZKTaskNameList()
+  },
+  methods: {
+    openModal(params, action) {
+      this.dialogFormVisible = true
+      this.$nextTick(() => {
+        for (const key in this.formData) {
+          this.formData[key] = params[key]
+        }
+        if (action !== 'ADD') {
+          this.formData.type = String(this.formData.type)
+          this.formData.rule_id = JSON.parse(this.formData.rule_id)
+          this.$refs.ModelParamsModalRef.getSelectList(this.formData.data_type)
+        }
+      })
+      this.actionType = action
+    },
+    getSCTaskNameList() {
+      getTaskNameData().then((res) => {
+        const { p } = res
+        this.scTaskNameList = p || []
+      })
+    },
+    getZKTaskNameList() {
+      getRule().then((res) => {
+        const { p } = res
+        this.zkTaskNameList = p || []
+      })
+    },
+    handleClickTab(tab) {
+      this.formData.type = tab.name
+      this.formData.rule_id = ''
+    },
+    handleTest() {
+      const url = 'http://172.16.9.43:8001'
+      window.open(url, '_blank')
+    },
+    openModelParamsDialog() {
+      this.$refs.ModelParamsModalRef.openModal(this.selectModelDataList)
+    },
+    handleSubmit() {
+      this.$refs['formDataRef'].validate((valid) => {
+        if (valid) {
+          const dataType = []
+          this.selectModelDataList.forEach(element => {
+            const obj = {}
+            obj.table = element.field
+            obj.field = element.child ? element.child.map(item => item.field) : []
+            dataType.push(obj)
+          })
+          const params = {
+            ...this.formData,
+            data_type: dataType
+          }
+          addHelper(params).then((res) => {
+            this.$message.success(res.m || '发布成功')
+            this.handleCancel()
+            this.$emit('onSuccess')
+          })
+        } else {
+          return false
+        }
+      })
+    },
+    handleCancel() {
+      this.dialogFormVisible = false
+      this.selectModelDataList = []
+      this.$refs['formDataRef'].resetFields()
+    },
+    handleSelect(val) {
+      this.selectModelDataList = val
+      const values = []
+      val.forEach(element => {
+        if (element.child) {
+          values.push(...element.child)
+        }
+      })
+      this.formData.data_type = values.map(element => element.field_name).join(',')
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped></style>

+ 237 - 0
src/views/helper/components/ModelParamsModal.vue

@@ -0,0 +1,237 @@
+<template>
+  <div>
+    <el-dialog :modal="false" width="700px" :title="`模型入参`" :visible.sync="dialogFormVisible" @close="handleCancel">
+      <el-row style="margin-bottom: 10px;" type="flex" justify="space-between">
+        <el-input v-model="filterParams.keyword" placeholder="请输入内容" @input="handleSearch" />
+        <el-button style="margin-left: 20px" type="primary" @click="handleSubmit">确认</el-button>
+      </el-row>
+      <el-tabs
+        v-model="currentTab"
+        type="border-card"
+        class="tab"
+        :tab-position="'left'"
+        style="height:max-content"
+        @tab-click="handleClickTab"
+      >
+        <el-tab-pane
+          v-for="(item) in (listData)"
+          :key="item.id"
+          :label="item.field_name"
+          :name="String(item.id)"
+        >
+          <el-row slot="label" type="flex" align="middle">{{ item.field_name }}<div
+            v-if="getSelectedNumber(item)"
+            class="tab-label-num"
+          >{{ getSelectedNumber(item) }}</div></el-row>
+          <div class="grid-container">
+            <el-tag
+              v-for="(tag) in item.child"
+              :key="tag.id"
+              size="large"
+              :closable="getIsSelected(item, tag) ? true : false"
+              :disable-transitions="false"
+              :type="getIsSelected(item, tag) ? 'primary' : 'info'"
+              @click="handleTabItemClick(item, tag)"
+              @close="handleTabItemClose(item, tag)"
+            >
+              {{ tag.field_name }}
+            </el-tag>
+          </div>
+        </el-tab-pane>
+      </el-tabs>
+      <!-- <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="handleSubmit">确认</el-button>
+      </div> -->
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { debounce } from 'lodash'
+import { getModelParams } from '@/api/helper'
+export default {
+  emits: ['onSelect'],
+  props: {
+    selectDataList: {
+      type: Array,
+      default() {
+        return []
+      }
+    }
+  },
+  data() {
+    return {
+      dialogFormVisible: false,
+      currentTab: '1',
+      filterParams: {
+        keyword: ''
+      },
+      listData: [],
+      selectList: []
+    }
+  },
+  created() {
+    this.getListData()
+  },
+  methods: {
+    openModal(params = []) {
+      this.dialogFormVisible = true
+      this.$nextTick(() => {
+        this.selectList = [...params]
+      })
+    },
+    handleClickTab(tab) {
+      this.currentTab = tab.name
+    },
+    handleTabItemClick(parent, current) {
+      const findIndexValue = this.selectList.findIndex(element => element.id === parent.id)
+      if (findIndexValue === -1) {
+        this.selectList.push({
+          ...parent,
+          child: [{
+            ...current
+          }]
+        })
+      } else {
+        const childArray = this.selectList[findIndexValue].child
+        const findChildIndexValue = childArray.findIndex(item => item.id === current.id)
+        if (findChildIndexValue === -1) {
+          this.selectList[findIndexValue].child.push({
+            ...current
+          })
+        } else {
+          this.selectList[findIndexValue].child.splice(findChildIndexValue, 1)
+        }
+      }
+    },
+    handleTabItemClose(parent, current) {
+      const findIndexValue = this.selectList.findIndex(element => element.id === parent.id)
+      const childArray = this.selectList[findIndexValue].child
+      const findChildIndexValue = childArray.findIndex(item => item.id === current.id)
+      this.selectList[findIndexValue].child.splice(findChildIndexValue, 1)
+    },
+    getIsSelected(parent, current) {
+      const findIndexValue = this.selectList.findIndex(element => element.id === parent.id)
+      if (findIndexValue === -1) {
+        return false
+      } else {
+        const childArray = this.selectList[findIndexValue].child
+        const findChildIndexValue = childArray.findIndex(item => item.id === current.id)
+        if (findChildIndexValue === -1) {
+          return false
+        } else {
+          return true
+        }
+      }
+    },
+    getSelectedNumber(parent) {
+      const findIndexValue = this.selectList.findIndex(element => element.id === parent.id)
+      if (findIndexValue === -1) {
+        return 0
+      } else {
+        return this.selectList[findIndexValue].child.length
+      }
+    },
+    getSelectList(params) {
+      this.selectList = []
+      if (Array.isArray(params) && !!params.length) {
+        params.forEach(item => {
+          const findIndexValue = this.listData.findIndex(element => element.field === item.table)
+          if (findIndexValue !== -1) {
+            const childData = []
+            if (Array.isArray(item.field) && !!item.field.length) {
+              const childArray = this.listData[findIndexValue].child
+              item.field.forEach(item => {
+                const findChildIndexValue = childArray.findIndex(element => element.field === item)
+                if (findChildIndexValue !== -1) {
+                  childData.push(childArray[findChildIndexValue])
+                }
+              })
+            }
+            this.selectList.push({
+              ...this.listData[findIndexValue],
+              child: childData
+            })
+          }
+        })
+        this.$emit('onSelect', this.selectList)
+      }
+    },
+    getListData() {
+      getModelParams(this.filterParams).then((res) => {
+        const { p } = res
+        this.listData = p || []
+        if (Array.isArray(this.listData) && !!this.listData.length) {
+          this.currentTab = String(this.listData[0].id)
+        }
+      })
+    },
+    handleSearch: debounce(function() {
+      this.getListData()
+    }, 2000),
+    handleSubmit() {
+      this.dialogFormVisible = false
+      this.$emit('onSelect', this.selectList)
+    },
+    handleCancel() {
+      this.dialogFormVisible = false
+      this.filterParams.keyword = ''
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.grid-container {
+    display: grid;
+    grid-template-columns: repeat(3, 1fr);
+    gap: 10px;
+    .el-tag {
+        text-align: center;
+    }
+}
+
+.tab-label-num {
+    width: 16px;
+    height: 16px;
+    line-height: 16px;
+    text-align: center;
+    border-radius: 50%;
+    background-color: red;
+    color: #fff;
+    font-size: 14px;
+    margin-left: 5px;
+}
+
+::v-deep.el-tabs__nav-prev {
+    display: none;
+    height: 0;
+}
+
+::v-deep.el-tabs__nav-next {
+    display: none;
+    height: 0;
+}
+
+.tab {
+    ::v-deep .el-tabs__nav-scroll {
+        overflow: hidden !important;
+        /* 隐藏滚动条 */
+    }
+}
+
+::v-deep .el-tabs--left .el-tabs__nav-wrap.is-left.is-scrollable {
+    padding: 0;
+
+    .el-tabs__nav-prev {
+        display: none;
+        height: 0px;
+    }
+
+    .el-tabs__nav-next {
+        display: none;
+        height: 0;
+    }
+}
+
+</style>

+ 57 - 21
src/views/helper/components/SearchBox.vue

@@ -1,36 +1,72 @@
 <template>
 <template>
-  <div>
-    <el-form :inline="true" :model="data" class="demo-form-inline">
-      <el-form-item label="">
-        <el-input v-model="data.user" placeholder="应用名称" />
-      </el-form-item>
-      <el-form-item>
-        <el-button type="primary" @click="onSubmit">查询</el-button>
-      </el-form-item>
-    </el-form>
-  </div>
+  <el-form
+    ref="filterListFormRef"
+    style="width: 100%"
+    :model="formData"
+    class="demo-form-inline"
+    label-suffix=":"
+    label-width="100px"
+  >
+    <el-row :gutter="24">
+      <el-col :span="6">
+        <el-form-item label="任务类型" prop="type">
+          <el-select v-model="formData.type" style="width: 100%;" filterable clearable placeholder="请选择">
+            <el-option label="病历质控" :value="1" />
+            <el-option label="病历生成" :value="2" />
+            <el-option label="评审指标" :value="3" />
+          </el-select>
+        </el-form-item>
+      </el-col>
+      <!-- <el-col :span="6">
+        <el-form-item label="病历类目" prop="bllm">
+          <el-select style="width: 100%;" v-model="formData.bllm" filterable clearable placeholder="审核状态">
+            <el-option label="未审核" :value="0" />
+            <el-option label="审核中" :value="1" />
+            <el-option label="已通过" :value="2" />
+            <el-option label="未通过" :value="3" />
+          </el-select>
+        </el-form-item>
+      </el-col> -->
+      <el-col :span="6">
+        <el-form-item label="任务名称" prop="title">
+          <el-input v-model="formData.title" style="width: 100%;" placeholder="请输入" />
+        </el-form-item>
+      </el-col>
+      <el-col :span="6" :offset="6">
+        <el-form-item label="" prop="" style="float: right;">
+          <el-button type="primary" @click="onSubmit">查询</el-button>
+          <el-button @click="onReset">重置</el-button>
+        </el-form-item>
+      </el-col>
+    </el-row>
+  </el-form>
 </template>
 </template>
 
 
 <script>
 <script>
 export default {
 export default {
-  props: {
-    data: {
-      type: Object,
-      default() {
-        return {
-          user: ''
-        }
+  emits: ['onSearch', 'onReset'],
+  props: {},
+  data() {
+    return {
+      formData: {
+        type: '',
+        title: ''
       }
       }
     }
     }
   },
   },
+  created() {
+    // 获取病历类目和任务名称
+  },
   methods: {
   methods: {
     onSubmit() {
     onSubmit() {
-      console.log('submit!')
+      this.$emit('onSearch')
+    },
+    onReset() {
+      this.$refs.filterListFormRef.resetFields()
+      this.$emit('onReset')
     }
     }
   }
   }
 }
 }
 </script>
 </script>
 
 
-<style lang="scss" scoped>
-
-</style>
+<style lang="scss" scoped></style>

+ 26 - 7
src/views/helper/components/TableBox.vue

@@ -16,11 +16,27 @@
         align="center"
         align="center"
       />
       />
       <el-table-column
       <el-table-column
-        prop="app_name"
-        label="应用名称"
+        prop="type"
+        label="任务类型"
+        width="240"
+        show-overflow-tooltip
+      >
+        <template slot-scope="scope">
+          <span>{{ scope.row.type == 1 ? '病历质控' : scope.row.type == 2 ? '病历生成' : scope.row.type == 3 ? '评审指标' : '' }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column
+        prop="title"
+        label="任务名称"
         width="240"
         width="240"
         show-overflow-tooltip
         show-overflow-tooltip
       />
       />
+      <!-- <el-table-column
+        prop="app_name"
+        label="病历类目"
+        width="240"
+        show-overflow-tooltip
+      /> -->
       <el-table-column
       <el-table-column
         prop="content"
         prop="content"
         label="任务描述"
         label="任务描述"
@@ -29,7 +45,7 @@
       <el-table-column
       <el-table-column
         prop=""
         prop=""
         label="操作"
         label="操作"
-        width="160"
+        width="180"
       >
       >
         <template slot-scope="scope">
         <template slot-scope="scope">
           <el-link :underline="false" type="primary" @click="onEdit(scope.row)">编辑</el-link>
           <el-link :underline="false" type="primary" @click="onEdit(scope.row)">编辑</el-link>
@@ -44,6 +60,7 @@
 <script>
 <script>
 import { deleteHelper } from '@/api/helper'
 import { deleteHelper } from '@/api/helper'
 export default {
 export default {
+  emits: ['onAdd', 'onEdit'],
   props: {
   props: {
     data: {
     data: {
       type: Array,
       type: Array,
@@ -60,12 +77,14 @@ export default {
   },
   },
   methods: {
   methods: {
     onCreate() {
     onCreate() {
-      localStorage.removeItem('helper')
-      this.$router.push({ path: '/helper/config' })
+      this.$emit('onAdd')
+      // localStorage.removeItem('helper')
+      // this.$router.push({ path: '/helper/config' })
     },
     },
     onEdit(row) {
     onEdit(row) {
-      localStorage.setItem('helper', JSON.stringify(row))
-      this.$router.push({ path: '/helper/config' })
+      this.$emit('onEdit', row)
+      // localStorage.setItem('helper', JSON.stringify(row))
+      // this.$router.push({ path: '/helper/config' })
     },
     },
     onDel(row) {
     onDel(row) {
       this.$confirm('是否确认删除该数据?', '提示', {
       this.$confirm('是否确认删除该数据?', '提示', {

+ 3 - 0
src/views/helper/components/index.js

@@ -0,0 +1,3 @@
+export { default as SearchBoxVue } from './SearchBox.vue'
+export { default as TableBoxVue } from './TableBox.vue'
+export { default as AddModalVue } from './AddModal.vue'

+ 21 - 12
src/views/helper/index.vue

@@ -1,14 +1,17 @@
 <template>
 <template>
   <div class="app-container">
   <div class="app-container">
     <SearchBoxVue
     <SearchBoxVue
-      :data="searchData"
-      @search="handleSearch"
+      ref="SearchBoxRef"
+      @onSearch="handleSearch"
+      @onReset="handleReset"
     />
     />
     <TableBoxVue
     <TableBoxVue
       :loading="loading"
       :loading="loading"
       :data="tableData"
       :data="tableData"
       style="margin-top: -40px"
       style="margin-top: -40px"
       @refresh="handleRefresh"
       @refresh="handleRefresh"
+      @onAdd="handleAdd"
+      @onEdit="handleEdit"
     />
     />
     <pagination
     <pagination
       :auto-scroll="false"
       :auto-scroll="false"
@@ -17,24 +20,22 @@
       :limit="paginationData.limit"
       :limit="paginationData.limit"
       @pagination="handlePagination"
       @pagination="handlePagination"
     />
     />
+    <AddModalVue ref="AddModalVueRef" @onSuccess="handleRefresh" />
   </div>
   </div>
 </template>
 </template>
 
 
 <script>
 <script>
-import SearchBoxVue from './components/SearchBox.vue'
-import TableBoxVue from './components/TableBox.vue'
+import { SearchBoxVue, TableBoxVue, AddModalVue } from './components/index'
 import { helperPage } from '@/api/helper'
 import { helperPage } from '@/api/helper'
 export default {
 export default {
   components: {
   components: {
     SearchBoxVue,
     SearchBoxVue,
-    TableBoxVue
+    TableBoxVue,
+    AddModalVue
   },
   },
   data() {
   data() {
     return {
     return {
       loading: false,
       loading: false,
-      searchData: {
-        rule_id: ''
-      },
       tableData: [],
       tableData: [],
       paginationData: {
       paginationData: {
         total: 0,
         total: 0,
@@ -43,19 +44,18 @@ export default {
       }
       }
     }
     }
   },
   },
-  created() {
-    console.log('created')
+  created() {},
+  mounted() {
     this.getList()
     this.getList()
   },
   },
   activated() {
   activated() {
-    console.log('activated')
     this.getList()
     this.getList()
   },
   },
   methods: {
   methods: {
     async getList() {
     async getList() {
       const { page, limit } = this.paginationData
       const { page, limit } = this.paginationData
       const params = {
       const params = {
-        ...this.searchData,
+        ...this.$refs.SearchBoxRef.formData,
         page,
         page,
         page_size: limit
         page_size: limit
       }
       }
@@ -78,6 +78,9 @@ export default {
       this.paginationData.limit = param.limit
       this.paginationData.limit = param.limit
       this.getList()
       this.getList()
     },
     },
+    handleReset() {
+      this.handleSearch()
+    },
     handleSearch() {
     handleSearch() {
       this.paginationData.page = 1
       this.paginationData.page = 1
       this.getList()
       this.getList()
@@ -85,6 +88,12 @@ export default {
     handleRefresh() {
     handleRefresh() {
       this.paginationData.page = 1
       this.paginationData.page = 1
       this.getList()
       this.getList()
+    },
+    handleAdd() {
+      this.$refs.AddModalVueRef.openModal({ type: '2' }, 'ADD')
+    },
+    handleEdit(row) {
+      this.$refs.AddModalVueRef.openModal(row, 'EDIT')
     }
     }
   }
   }
 }
 }