fix: 指标规则,原子指标开发

ocr_2.0
xiangcongshuai 8 months ago
parent 94491696e0
commit 24ffa40e81

@ -30,3 +30,11 @@ export function addOrUpdIndex(data) {
data data
}) })
} }
export function listAtomicIndexAttributeScope(data) {
return request({
url: `/modelIndex/listAtomicIndexAttributeScope`,
method: 'post',
data
})
}

@ -0,0 +1,14 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_2992_20696)">
<path d="M14.6667 10.3333C14.6667 12.1743 13.1743 13.6667 11.3333 13.6667C10.7364 13.6667 10.176 13.5097 9.69137 13.2349C8.8381 12.751 8.2193 11.9015 8.04787 10.8994C8.0164 10.7154 8 10.5263 8 10.3333C8 9.47743 8.3226 8.69687 8.85283 8.1066C9.46307 7.42727 10.3483 7 11.3333 7C13.1743 7 14.6667 8.4924 14.6667 10.3333Z" stroke="#3763FF" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M11.334 4V6.66667V7C10.349 7 9.46372 7.42727 8.85348 8.1066C8.32325 8.69687 8.00065 9.47743 8.00065 10.3333C8.00065 10.5263 8.01705 10.7154 8.04852 10.8994C8.21995 11.9015 8.83875 12.751 9.69202 13.2349C8.80452 13.5032 7.62652 13.6667 6.33398 13.6667C3.57255 13.6667 1.33398 12.9205 1.33398 12V9.33333V6.66667V4" stroke="#3763FF" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M11.334 3.99967C11.334 4.92014 9.09542 5.66634 6.33398 5.66634C3.57255 5.66634 1.33398 4.92014 1.33398 3.99967C1.33398 3.0792 3.57255 2.33301 6.33398 2.33301C9.09542 2.33301 11.334 3.0792 11.334 3.99967Z" stroke="#3763FF" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M1.33398 7.7998C1.33398 8.72027 3.57255 9.46647 6.33398 9.46647C6.93632 9.46647 7.51375 9.43097 8.04852 9.3659" stroke="#3763FF" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M12.7483 10.333H11.3341M11.3341 10.333V8.91879M11.3341 10.333H9.91992M11.3341 10.333V11.7472" stroke="#3763FF" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</g>
<defs>
<clipPath id="clip0_2992_20696">
<rect width="16" height="16" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

@ -0,0 +1,15 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_2986_20349)">
<path d="M2.28613 4.19049C2.28613 4.19049 5.14328 -0.190488 10.0957 1.52381C15.048 3.23811 14.8576 8.19049 14.8576 8.19049" stroke="#3763FF" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M8 5.71387V11.4282" stroke="#3763FF" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M5.33301 5.71387H7.99967H10.6663" stroke="#3763FF" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M14.8574 1.90527V8.00051" stroke="#3763FF" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M13.714 11.8095C13.714 11.8095 11.4283 16 6.28543 14.6667C1.14258 13.3333 1.14258 8 1.14258 8" stroke="#3763FF" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M1.14258 8V14.0952" stroke="#3763FF" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</g>
<defs>
<clipPath id="clip0_2986_20349">
<rect width="16" height="16" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

@ -42,7 +42,7 @@
<el-input v-model="addInfo['type']" readonly placeholder="请输入" /> <el-input v-model="addInfo['type']" readonly placeholder="请输入" />
</el-form-item> </el-form-item>
<el-form-item label="文件夹名称" prop="directoryName"> <el-form-item label="文件夹名称" prop="directoryName">
<el-input v-model="addInfo['directoryName']" clearable placeholder="请输入" /> <el-input v-model="addInfo['directoryName']" maxlength="12" clearable placeholder="请输入" />
</el-form-item> </el-form-item>
</el-form> </el-form>
<!--新增用户--> <!--新增用户-->

@ -12,7 +12,8 @@
<img src="@/assets/record/error.png" alt=""> <img src="@/assets/record/error.png" alt="">
<span>确认删除当前项</span> <span>确认删除当前项</span>
</div> </div>
<div class="content-text">点击确认将把文件移至未分类目录或点击取消保留文件一键删除将永久移除文件无法恢复请谨慎操作</div> <div class="content-text">"确认"将文件移至未分类"一键删除永久移除文件
添加证据时不支持删除文件夹请谨慎操作</div>
<div class="footer-btns"> <div class="footer-btns">
<div class="btn" @click="delItem"></div> <div class="btn" @click="delItem"></div>
<div class="btn" @click="delAll"></div> <div class="btn" @click="delAll"></div>

@ -146,8 +146,8 @@
</div> </div>
</div> </div>
<div class="footer-btns"> <div class="footer-btns">
<div class="btn" @click="save"></div> <div class="btn" @click="save">退</div>
<div class="btn" @click="save"></div> <div class="btn" @click="closed">退</div>
<div class="reset_btn" @click="reset"></div> <div class="reset_btn" @click="reset"></div>
</div> </div>
</div> </div>
@ -186,7 +186,7 @@ export default {
evidenceInfo: { evidenceInfo: {
property: [], property: [],
title: '', title: '',
evidenceName:'' evidenceName: ''
}, },
ocrText: '' ocrText: ''
} }
@ -280,6 +280,13 @@ export default {
this.navList.push(data.directoryName) this.navList.push(data.directoryName)
this.$refs.tree.setCurrentKey(this.selectId) this.$refs.tree.setCurrentKey(this.selectId)
}, },
closed() {
this.$store.dispatch(
'tabsBar/delRoute',
this.$route
)
this.$router.push({ path: `/case-details/${this.$route.params.id}/${this.$route.query.caseName}`, query: { isEdit: 1, currentKey: '1-2', caseNo: this.$route.query.caseNo }})
},
checkEvidence(nodes) { checkEvidence(nodes) {
for (const item of nodes) { for (const item of nodes) {
if (item.fileInfoList.length > 0) { if (item.fileInfoList.length > 0) {
@ -311,7 +318,7 @@ export default {
'tabsBar/delRoute', 'tabsBar/delRoute',
this.$route this.$route
) )
this.$router.push({ path: `/case-details/${this.$route.params.id}/${this.$route.query.caseName}`, query: { isEdit: 1,currentKey: '1-2', caseNo: this.$route.query.caseNo }}) this.$router.push({ path: `/case-details/${this.$route.params.id}/${this.$route.query.caseName}`, query: { isEdit: 1, currentKey: '1-2', caseNo: this.$route.query.caseNo }})
} }
}) })
}, },
@ -417,7 +424,8 @@ export default {
align-items: center; align-items: center;
justify-content: center; justify-content: center;
img { img {
height: 100%; max-width: 500px;
max-height: calc(100vh - 420px);
} }
} }
.actived { .actived {

@ -50,10 +50,12 @@
import * as vuedraggable from 'vuedraggable' import * as vuedraggable from 'vuedraggable'
import { baseURL } from '@/config' import { baseURL } from '@/config'
import { commonDownloadFile } from '@/api/config/uploadApi' import { commonDownloadFile } from '@/api/config/uploadApi'
import { saveRecord, deleteFile } from '@/api/caseDetails/ocr' import { deleteFile } from '@/api/caseDetails/ocr'
import { ocrAndExtractList } from '@/api/caseDetails/evidence' import { ocrAndExtractList } from '@/api/caseDetails/evidence'
import mixin from '@/views/mixin'
export default { export default {
name: 'EvidenceExtract', name: 'EvidenceExtract',
mixins: [mixin],
components: { vuedraggable }, components: { vuedraggable },
data() { data() {
return { return {
@ -67,7 +69,9 @@ export default {
} }
}, },
gridOptions: { gridOptions: {
...mixin.data().gridOptions,
resizable: true,
showOverflow: true,
columns: [ columns: [
{ title: '序号', type: 'seq', width: '80px' }, { title: '序号', type: 'seq', width: '80px' },
{ title: '证据名称', field: 'evidenceName' }, { title: '证据名称', field: 'evidenceName' },
@ -85,6 +89,7 @@ export default {
} }
}, },
mounted() { mounted() {
this.tableHeight(400)
this.getDataList() this.getDataList()
this.caseNo = this.$route.query.caseNo this.caseNo = this.$route.query.caseNo
this.caseName = this.$route.query.caseName this.caseName = this.$route.query.caseName
@ -164,6 +169,8 @@ export default {
.record_table { .record_table {
flex: 1; flex: 1;
margin-left: 18px; margin-left: 18px;
height: calc(100vh - 200px);
overflow-y: auto;
} }
.status { .status {
display: flex; display: flex;

@ -45,6 +45,13 @@
<div class="plain-btn" @click="move"></div> <div class="plain-btn" @click="move"></div>
<!-- <div class="plain-btn">删除文件夹</div> --> <!-- <div class="plain-btn">删除文件夹</div> -->
<div class="plain-btn" @click="del"></div> <div class="plain-btn" @click="del"></div>
<div class="select-all" @click="selectAll">
<div v-if="!checkAll" class="no-select" />
<img v-else src="@/assets/file/check.png" class="selected" alt="">
<span>全选</span>
<span>{{ `已选 ${selectLength}` }}</span>
</div>
<div class="case-content"> <div class="case-content">
<span>{{ `案件名称:${caseName}` }}</span> <span>{{ `案件名称:${caseName}` }}</span>
<span>{{ `案件编号:${caseNo}` }}</span> <span>{{ `案件编号:${caseNo}` }}</span>
@ -108,6 +115,7 @@ export default {
children: 'child', children: 'child',
label: 'directoryName' label: 'directoryName'
}, },
isUploadFlag: false,
navList: ['未分类'], navList: ['未分类'],
caseNo: '', caseNo: '',
caseName: '', caseName: '',
@ -117,6 +125,24 @@ export default {
loading: false loading: false
} }
}, },
computed: {
checkAll() {
if (this.selectLength === this.selectList.length && this.selectList.length !== 0) {
return true
}
return false
},
selectLength() {
let i = 0
for (const item of this.selectList) {
if (item.check === true) {
i++
}
}
return i
}
},
watch: { watch: {
filterText(val) { filterText(val) {
this.$refs.tree.filter(val) this.$refs.tree.filter(val)
@ -124,6 +150,7 @@ export default {
}, },
mounted() { mounted() {
this.getTreeList() this.getTreeList()
this.isUploadFlag = false
this.caseNo = this.$route.query.caseNo this.caseNo = this.$route.query.caseNo
this.caseName = this.$route.query.caseName this.caseName = this.$route.query.caseName
}, },
@ -154,18 +181,27 @@ export default {
renderContent(h, { node, data }) { renderContent(h, { node, data }) {
if (data.fileInfoList.length > 0) { if (data.fileInfoList.length > 0) {
return ( return (
<span> <span title={data.directoryName}>
{data.directoryName} <span style=''>({data.fileInfoList.length})</span> {data.directoryName} <span style=''>({data.fileInfoList.length})</span>
</span> </span>
) )
} else { } else {
return ( return (
<span> <span title={data.directoryName}>
{data.directoryName} {data.directoryName}
</span> </span>
) )
} }
}, },
selectAll() {
if (this.selectList.length === 0) return
this.changeAllCheck(!this.checkAll)
},
changeAllCheck(flag) {
for (const item of this.selectList) {
item.check = flag
}
},
handleSuccess(res, file) { handleSuccess(res, file) {
const filename = file.name const filename = file.name
const postfix = filename.substring(filename.lastIndexOf('.')) const postfix = filename.substring(filename.lastIndexOf('.'))
@ -374,11 +410,28 @@ export default {
) )
this.$router.push({ path: `/case-details/${this.$route.params.id}/${this.$route.query.caseName}`, query: { isEdit: 1, caseNo: this.$route.query.caseNo }}) this.$router.push({ path: `/case-details/${this.$route.params.id}/${this.$route.query.caseName}`, query: { isEdit: 1, caseNo: this.$route.query.caseNo }})
}, },
//
checkUpload(nodes) {
for (const item of nodes) {
if (item.fileInfoList.length > 0) {
this.isUploadFlag = true
break
} else if (item.child) {
this.checkUpload(item.child)
}
}
},
save() { save() {
if (this.treeData[0].fileInfoList && this.treeData[0].fileInfoList.length > 0) { if (this.treeData[0].fileInfoList && this.treeData[0].fileInfoList.length > 0) {
this.$baseMessage.error('请分类!') this.$baseMessage.error('请分类!')
return return
} }
this.checkUpload(this.treeData)
if (!this.isUploadFlag) {
this.$baseMessage.error('请上传文件')
return
}
this.loading = true this.loading = true
const list = JSON.parse(JSON.stringify(this.treeData)) const list = JSON.parse(JSON.stringify(this.treeData))
list.splice(0, 1) list.splice(0, 1)
@ -489,6 +542,29 @@ export default {
margin-left: 32px; margin-left: 32px;
} }
} }
.select-all {
display: flex;
align-items: center;
cursor: pointer;
span {
margin-left: 12px;
font-size: 16px;
}
img {
width: 22px;
height: 22px;
margin-left: 24px;
}
}
.no-select {
width: 22px;
height: 22px;
background: #FFFFFF;
border-radius: 4px 4px 4px 4px;
border: 1px solid #D9D9D9;
cursor: pointer;
margin-left: 24px;
}
} }
.file-content { .file-content {
flex: 1; flex: 1;
@ -498,6 +574,8 @@ export default {
.file-list { .file-list {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
overflow-y: auto;
max-height: calc(100vh - 500px)
} }
::v-deep { ::v-deep {
.el-input__inner { .el-input__inner {

@ -59,8 +59,9 @@
</div> </div>
</template> </template>
<template #opera="{row}"> <template #opera="{row}">
<el-button v-if="row.fileList.length > 0" type="text" icon="el-icon-edit" title="编辑" @click="handelEdit(row)" /> <el-button v-if="row.fileList && row.fileList.length > 0" type="text" icon="el-icon-edit" title="编辑" @click="handelEdit(row)" />
<el-button icon="el-icon-collection" title="重新提取" type="text" @click="handelExtract(row)" /> <!-- <el-button icon="el-icon-collection" title="重新提取" type="text" @click="handelExtract(row)" /> -->
<svg-icon class="svg-img" icon-class="reset" title="重新提取" @click="handelExtract(row)" />
<el-button type="text" icon="el-icon-delete" style="color: red" title="删除" @click="handleDel(row)" /> <el-button type="text" icon="el-icon-delete" style="color: red" title="删除" @click="handleDel(row)" />
</template> </template>
@ -253,11 +254,13 @@ export default {
val === '1' ? this.$refs.edit.show() : this.$router.push({ path: `/add-evidence/${this.caseId}`, query: { caseName: this.$route.params.caseName, caseNo: this.$route.query.caseNo }}) val === '1' ? this.$refs.edit.show() : this.$router.push({ path: `/add-evidence/${this.caseId}`, query: { caseName: this.$route.params.caseName, caseNo: this.$route.query.caseNo }})
}, },
async handelExtract(row) { async handelExtract(row) {
const { code, msg } = await caseEvidenceAnalysis({ this.$baseConfirm('你确定要重新提取当前证据信息吗?这将替换掉之前已核实或提取的内容。', null, async() => {
evidenceId: row.id const { code, msg } = await caseEvidenceAnalysis({
evidenceId: row.id
})
code === 200 ? this.$baseMessage.success(msg || '提取成功!') : this.$baseMessage.error(msg || '提取失败!')
this.fetchData()
}) })
code === 200 ? this.$baseMessage.success(msg || '提取成功!') : this.$baseMessage.error(msg || '提取失败!')
this.fetchData()
}, },
// //
delAll() { delAll() {
@ -300,6 +303,10 @@ export default {
<style scoped lang="scss"> <style scoped lang="scss">
.evidence-content { .evidence-content {
display: flex; display: flex;
.svg-img {
margin: 0 8px;
cursor: pointer;
}
.evidence-tree { .evidence-tree {
width: 210px; width: 210px;
margin-right: 16px; margin-right: 16px;

@ -24,10 +24,13 @@
</div> </div>
<vxe-grid v-bind="gridOptions" style="margin-top: 10px"> <vxe-grid v-bind="gridOptions" style="margin-top: 10px">
<template #opera="{row}"> <template #opera="{row}">
<el-button v-if="row.children.length === 0" type="text" icon="el-icon-video-play" :disabled="!isEdit" title="笔录分析" @click="handleCreateAtlas(row)" />
<!-- <el-button v-if="row.children.length === 0" type="text" icon="el-icon-video-play" :disabled="!isEdit" title="笔录分析" @click="handleCreateAtlas(row)" /> -->
<el-button type="text" icon="el-icon-edit" title="编辑" :disabled="!isEdit" @click="handelEdit(row)" /> <el-button type="text" icon="el-icon-edit" title="编辑" :disabled="!isEdit" @click="handelEdit(row)" />
<svg-icon v-if="row.children.length === 0 && isEdit" style="margin-left: 8px;cursor: pointer;" icon-class="recordAnalysis" title="笔录分析" @click="handleCreateAtlas(row)" />
<svg-icon v-if="row.children.length === 0 && isEdit" style="margin-left: 8px;margin-right: 8px; cursor: pointer;" icon-class="reset" title="笔录提取" @click="handleExtract(row)" />
<el-button v-if="row.children.length === 0" type="text" icon="el-icon-delete" :disabled="!isEdit" style="color: red" title="删除" @click="handleDel(row)" /> <el-button v-if="row.children.length === 0" type="text" icon="el-icon-delete" :disabled="!isEdit" style="color: red" title="删除" @click="handleDel(row)" />
<el-button v-if="row.children.length === 0" type="text" icon="el-icon-collection" :disabled="!isEdit" title="笔录提取" @click="handleExtract(row)" /> <!-- <el-button v-if="row.children.length === 0" type="text" icon="el-icon-collection" :disabled="!isEdit" title="笔录提取" @click="handleExtract(row)" /> -->
</template> </template>
<template #percentage="{row}"> <template #percentage="{row}">
@ -48,7 +51,7 @@
/> />
</div> </div>
<!--新增用户--> <!--新增用户-->
<add-case-user ref="addUser" :case-id="caseId" @reloadData="fetchData" /> <add-case-user ref="addUser" @reloadData="fetchData" />
<!--选择三元组信息入库--> <!--选择三元组信息入库-->
<triplet-info ref="triplet" /> <triplet-info ref="triplet" />
<!--选择上传方式--> <!--选择上传方式-->

@ -167,7 +167,7 @@ export default {
} }
} }
}, },
mounted() { activated() {
this.getTreeList() this.getTreeList()
this.caseNo = this.$route.query.caseNo this.caseNo = this.$route.query.caseNo
this.caseName = this.$route.query.caseName this.caseName = this.$route.query.caseName
@ -354,7 +354,8 @@ export default {
align-items: center; align-items: center;
justify-content: center; justify-content: center;
img { img {
height: 100%; max-width: 500px;
max-height: calc(100vh - 420px);
} }
} }
.svg-img { .svg-img {

@ -4,11 +4,22 @@
:drawer-option="drawerOption" :drawer-option="drawerOption"
> >
<div slot="content" class="RecordDetails"> <div slot="content" class="RecordDetails">
<div v-for="(item, index) in dataList" :key="index" class="record-item"> <div class="top">
<div>{{ item.question }}</div> <span>以明显低于市场价格变卖取得的货物导致不能归还货款</span>
<div>{{ item.answer }}</div> <span>是否有行为人抓获经过书证</span>
<div>{{ item.noteName }}</div>
</div> </div>
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="笔录详情" name="1">
<div v-for="(item, index) in dataList" :key="index" class="record-item">
<div>{{ item.question }}</div>
<div>{{ item.answer }}</div>
<div>{{ item.noteName }}</div>
</div>
</el-tab-pane>
<el-tab-pane label="证据详情" name="2">证据详情</el-tab-pane>
</el-tabs>
</div> </div>
</cs-drawer> </cs-drawer>
</template> </template>
@ -21,9 +32,10 @@ export default {
return { return {
drawerOption: { drawerOption: {
show: false, show: false,
title: '笔录详情', title: '详情',
hiddenFooter: true hiddenFooter: true
}, },
activeName: '1',
dataList: [] dataList: []
} }
}, },

@ -40,13 +40,6 @@ import { addUser, updatePerson, queryUserList } from '@/api/caseDetails'
export default { export default {
name: 'AddCaseUser', name: 'AddCaseUser',
props: {
// Id
caseId: {
type: String,
defaultValue: ''
}
},
data() { data() {
return { return {
// //

@ -117,7 +117,7 @@
</el-col> </el-col>
</el-row> </el-row>
<!--新增用户--> <!--新增用户-->
<add-case-user ref="add" :case-id="caseId" @reloadData="getUserList" /> <add-case-user ref="add" @reloadData="getUserList" />
<!--图片文件预览--> <!--图片文件预览-->
<file-viewer <file-viewer
v-if="showFileViewer" v-if="showFileViewer"
@ -140,13 +140,6 @@ import { getAccessToken } from '@/utils/accessToken'
export default { export default {
name: 'EditRecord', name: 'EditRecord',
components: { FileViewer, AddCaseUser }, components: { FileViewer, AddCaseUser },
props: {
// Id
caseId: {
type: String,
defaultValue: ''
}
},
data() { data() {
return { return {
// //

@ -33,33 +33,36 @@
/> />
</el-form-item> </el-form-item>
<el-form-item label="指标算法" prop="indexSource"> <el-form-item label="指标算法" prop="indexSource">
<el-radio-group v-model="ruleForm['indexSource']" :disabled="isView" @change="changeType"> <el-radio-group v-model="ruleForm['indexSource']" :disabled="isEdit" @change="changeType">
<el-radio <!-- <el-radio
v-for="item in sourceOptions" v-for="item in sourceOptions"
:key="item.value" :key="item.value"
:label="item.value" :label="item.value"
> >
{{ item.label }} {{ item.label }}
</el-radio> </el-radio> -->
<!-- <el-radio label="1">人工指定</el-radio>--> <el-radio label="1">人工指定</el-radio>
<!-- <el-radio label="2">数据库查询</el-radio>--> <el-radio label="2">数据库查询</el-radio>
<!-- <el-radio label="3">图谱生成</el-radio>--> <el-radio label="3">图谱生成</el-radio>
<!-- <el-radio label="4">大模型</el-radio>--> <el-radio label="4">大模型推理</el-radio>
<el-radio label="5">结构化查询</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="查询语句" prop="indexSource"> <el-form-item v-if="['3','5'].includes(ruleForm['indexSource'])" label="查询语句" prop="indexSource">
<div class="select-btn" @click="selectSql"></div> <div class="select-btn" @click="selectSql"></div>
<div v-if="ruleForm['indexSource'] === '3'" class="sel-name">{{ `` }}</div> <div v-if="selectInfo.promptName" class="sel-name">{{ `${selectInfo.promptName}` }}</div>
<div v-if="ruleForm['indexSource'] === '4'" class="sel-name">{{ `` }}</div> <!-- <div v-if="ruleForm['indexSource'] === '4'" class="sel-name">{{ `` }}</div>
<span v-if="ruleForm['indexSource'] === '3'" class="sel-desc">{{ `--` }}</span> <span v-if="ruleForm['indexSource'] === '3'" class="sel-desc">{{ `--` }}</span> -->
<div v-if="ruleForm['indexSource'] === '4'" class="select-model-list"> <div v-if="ruleForm['indexSource'] === '5' && selectInfo.extractAttributes.length > 0" class="select-model-list">
<div v-for="(item,index) in modelList" :key="index" class="model-list-item"> <div v-for="(item,index) in selectInfo.extractAttributes" :key="index" class="model-list-item">
<span>{{ item.name }}</span> <span>{{ item }}</span>
<i class="el-icon-circle-close" />
</div> </div>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item v-if="ruleForm['indexSource'] === '4'" label="prompt标签" prop="recordType"> <el-form-item v-if="ruleForm.indexSource ==='2'" label="关联分类" prop="categoryIdPath">
<el-cascader v-model="ruleForm.categoryIdPath" style="width: 100%;" :props="defaultProps" :options="treeData" />
</el-form-item>
<!-- <el-form-item v-if="ruleForm['indexSource'] === '4'" label="prompt标签" prop="recordType">
<el-select v-model="ruleForm['recordType']" :disabled="isView" placeholder="请选择prompt标签" style="width: 100%"> <el-select v-model="ruleForm['recordType']" :disabled="isView" placeholder="请选择prompt标签" style="width: 100%">
<el-option <el-option
v-for="item in promptTagOptions" v-for="item in promptTagOptions"
@ -77,8 +80,8 @@
:rows="5" :rows="5"
placeholder="请输入prompt内容" placeholder="请输入prompt内容"
/> />
</el-form-item> </el-form-item> -->
<el-form-item v-if="ruleForm['indexSource'] === '2' || ruleForm['indexSource'] === '3'" label="查询语句" prop="queryLang"> <el-form-item v-if="['2'].includes(ruleForm['indexSource'])" label="查询语句" prop="queryLang">
<el-input <el-input
v-model="ruleForm['queryLang']" v-model="ruleForm['queryLang']"
:disabled="isView" :disabled="isView"
@ -109,7 +112,7 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
<SelectSql ref="SelectSqlRef" /> <SelectSql ref="SelectSqlRef" @submit="selectOk" />
</template> </template>
</cs-drawer> </cs-drawer>
@ -118,6 +121,7 @@
<script> <script>
import { addOrUpdAtomicIndex } from '@/api/atomicIndex' import { addOrUpdAtomicIndex } from '@/api/atomicIndex'
import SelectSql from './SelectSql.vue' import SelectSql from './SelectSql.vue'
import { getCaseEvidenceTree } from '@/api/caseDetails/evidence'
export default { export default {
name: 'EditAtomic', name: 'EditAtomic',
components: { components: {
@ -130,17 +134,12 @@ export default {
title: '指标配置', title: '指标配置',
width: '40%' width: '40%'
}, },
modelList: [ selectInfo: {
{ promptName: '',
name: '属性1' promptId: '',
}, { extractAttributes: []
name: '属性2' }, //
}, {
name: '属性3'
}, {
name: '属性4'
}
],
// //
caseTypeOptions: JSON.parse(sessionStorage.getItem('case_type')), caseTypeOptions: JSON.parse(sessionStorage.getItem('case_type')),
// prompt // prompt
@ -160,6 +159,12 @@ export default {
remark: '' remark: ''
}, },
id: '', id: '',
defaultProps: {
children: 'child',
label: 'categoryName',
value: 'id',
checkStrictly: true
},
rules: { rules: {
indexSource: [{ required: true, message: '指标算法不能为空!', trigger: 'blur' }], indexSource: [{ required: true, message: '指标算法不能为空!', trigger: 'blur' }],
caseType: [{ required: true, message: '案件类型不能为空!', trigger: 'blur' }], caseType: [{ required: true, message: '案件类型不能为空!', trigger: 'blur' }],
@ -167,8 +172,10 @@ export default {
prompt: [{ required: true, message: 'prompt内容不能为空!', trigger: 'blur' }], prompt: [{ required: true, message: 'prompt内容不能为空!', trigger: 'blur' }],
queryLang: [{ required: true, message: '查询语句不能为空!', trigger: 'blur' }], queryLang: [{ required: true, message: '查询语句不能为空!', trigger: 'blur' }],
name: [{ required: true, message: '原子指标名称不能为空!', trigger: 'blur' }], name: [{ required: true, message: '原子指标名称不能为空!', trigger: 'blur' }],
categoryIdPath: [{ required: true, message: '分类不能为空!', trigger: 'change' }],
judgeResult: [{ required: true, message: '判断结果不能为空!', trigger: 'blur' }] judgeResult: [{ required: true, message: '判断结果不能为空!', trigger: 'blur' }]
}, },
treeData: [],
// //
isEdit: false, isEdit: false,
// //
@ -181,12 +188,16 @@ export default {
this.isEdit = isEdit this.isEdit = isEdit
this.drawerOption.show = true this.drawerOption.show = true
this.id = isEdit ? data.id : '' this.id = isEdit ? data.id : ''
this.getTreeList()
this.$nextTick(() => { this.$nextTick(() => {
const _this = this const _this = this
const formData = data ? JSON.parse(JSON.stringify(data)) : { indexSource: '1' } const formData = data ? JSON.parse(JSON.stringify(data)) : { indexSource: '1' }
_this.isView = data && !isEdit _this.isView = data && !isEdit
_this.ruleForm = data ? formData : (isEdit ? formData : { indexSource: '1' }) _this.ruleForm = data ? formData : (isEdit ? formData : { indexSource: '1' })
_this.drawerOption.hiddenFooter = _this.isView _this.drawerOption.hiddenFooter = _this.isView
this.selectInfo.extractAttributes = data.properties.split(',')
this.selectInfo.promptName = data.promptName
this.selectInfo.promptId = data.promptId
}) })
}, },
// //
@ -195,7 +206,12 @@ export default {
// this.$refs.form.clearValidate() // this.$refs.form.clearValidate()
}, },
selectSql() { selectSql() {
this.$refs.SelectSqlRef.show() this.$refs.SelectSqlRef.show(this.ruleForm.indexSource, this.selectInfo)
},
selectOk(data, list) {
this.selectInfo = data
this.ruleForm.promptId = data.promptId
this.selectInfo.extractAttributes = list
}, },
// //
handleSubmit() { handleSubmit() {
@ -204,6 +220,12 @@ export default {
if (this.isEdit) { if (this.isEdit) {
this.ruleForm.id = this.id this.ruleForm.id = this.id
} }
if (this.ruleForm.indexSource === '2') {
this.ruleForm.categoryId = this.ruleForm.categoryIdPath[this.ruleForm.categoryIdPath.length - 1 ]
} else if (this.ruleForm.indexSource === '5') {
this.ruleForm.properties = this.selectInfo.extractAttributes.join(',')
}
const { code, msg } = await addOrUpdAtomicIndex(this.ruleForm) const { code, msg } = await addOrUpdAtomicIndex(this.ruleForm)
code === 200 ? (this.isEdit ? this.$baseMessage.success(msg || '编辑成功!') : this.$baseMessage.success(msg || '新增成功!')) : (this.isEdit ? this.$baseMessage.error(msg || '新增失败!') : this.$baseMessage.error(msg || '新增失败!')) code === 200 ? (this.isEdit ? this.$baseMessage.success(msg || '编辑成功!') : this.$baseMessage.success(msg || '新增成功!')) : (this.isEdit ? this.$baseMessage.error(msg || '新增失败!') : this.$baseMessage.error(msg || '新增失败!'))
this.drawerOption.show = false this.drawerOption.show = false
@ -211,6 +233,14 @@ export default {
} }
}) })
}, },
//
getTreeList() {
getCaseEvidenceTree({ caseType: 1 }).then(res => {
if (res.code === 200) {
this.treeData = res.data
}
})
},
// //
changeType(val) { changeType(val) {
this.ruleForm = { indexSource: val } this.ruleForm = { indexSource: val }
@ -243,6 +273,8 @@ export default {
} }
.select-model-list { .select-model-list {
display: flex; display: flex;
margin-top: 16px;
flex-wrap: wrap;
.model-list-item { .model-list-item {
padding: 0 12px; padding: 0 12px;
height: 32px; height: 32px;
@ -252,8 +284,9 @@ export default {
color: #333333; color: #333333;
display: flex; display: flex;
align-items: center; align-items: center;
cursor: pointer;
span { span {
margin-right: 16px; // margin-right: 16px;
} }
} }
} }

@ -10,8 +10,8 @@
<el-form v-model="searchForm" label-width="120px"> <el-form v-model="searchForm" label-width="120px">
<el-row :gutter="10"> <el-row :gutter="10">
<el-col :span="10"> <el-col :span="10">
<el-form-item label="指令名称" prop="name"> <el-form-item label="提示词名称" prop="name">
<el-input v-model="searchForm['name']" clearable placeholder="请选择原子指标名称" /> <el-input v-model="searchForm['name']" clearable placeholder="请输入提示词名称" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="4"> <el-col :span="4">
@ -28,22 +28,37 @@
style="margin-top: 10px;width: 850px;" style="margin-top: 10px;width: 850px;"
:radio-config-config="{ labelField: '', highlight: true, trigger: 'row', reserve: true , range: true}" :radio-config-config="{ labelField: '', highlight: true, trigger: 'row', reserve: true , range: true}"
@radioConfig-change="selectChangeEvent" @radio-change="radioChangeEvent"
/> >
<template #type="{row}">
<span>{{ getTypeName(row.type) }}</span>
</template>
</vxe-grid>
<div class="main-right"> <div class="main-right">
<!-- <div class="chart-content"> <div v-if="!selectInfo.promptId" class="empty-content">
<span class="title">提示词配置内容</span> <img src="@/assets/caseManagement/empty.png" alt="">
</div> --> <span>选择左侧线索可预览提示词</span>
<div class="model-content"> </div>
<div v-if="modelGridOptions.data.length > 0" class="model-content">
<vxe-grid <vxe-grid
ref="modelTable" ref="modelTable"
row-id="id" row-id="attrName"
v-bind="modelGridOptions" v-bind="modelGridOptions"
:checkbox-config-config="{ labelField: '', highlight: true, trigger: 'row', reserve: true , range: true}" :checkbox-config-config="{ labelField: '', highlight: true, trigger: 'row', reserve: true , range: true}"
@checkbox-all="handleChangeAll"
@checkbox-change="selectChangeEvent" @checkbox-change="selectChangeEvent"
/> >
<!-- <template #type="{row}">
<span>{{ getAttrValueTypeName(row.attrValueType) }}</span>
</template> -->
</vxe-grid>
<div class="title">提示词配置内容</div> <div class="title">提示词配置内容</div>
<div class="promptText" v-html="selectInfo.promptText" />
</div>
<div v-if="selectInfo.promptId && modelGridOptions.data.length ===0" class="chart-content">
<span class="title">提示词配置内容</span>
<div class="promptText" v-html="selectInfo.promptText" />
</div> </div>
</div> </div>
</div> </div>
@ -62,8 +77,7 @@
<script> <script>
import mixin from '@/views/mixin' import mixin from '@/views/mixin'
import { queryAtomicIndex } from '@/api/atomicIndex' import { queryPromptList } from '@/api/promptManagement'
export default { export default {
name: 'SelectSql', name: 'SelectSql',
mixins: [mixin], mixins: [mixin],
@ -73,7 +87,7 @@ export default {
show: false, show: false,
appendToBody: true, appendToBody: true,
width: '1400px', width: '1400px',
height: '800px', // height: '800px',
title: { title: {
title: '选择原子指标查询语句' title: '选择原子指标查询语句'
} }
@ -81,19 +95,20 @@ export default {
// //
searchForm: { searchForm: {
name: '', name: '',
indexSource: '' type: ''
}, },
promptType: JSON.parse(sessionStorage.getItem('prompt_type')),
// //
indexAlgorithmOptions: JSON.parse(sessionStorage.getItem('index_source')), indexAlgorithmOptions: JSON.parse(sessionStorage.getItem('index_source')),
attrValueTypeList: JSON.parse(sessionStorage.getItem('prompt_attribute_valuetype')),
// //
gridOptions: { gridOptions: {
...mixin.data().gridOptions, ...mixin.data().gridOptions,
columns: [ columns: [
{ type: 'radio', width: '80px' }, { type: 'radio', width: '80px' },
{ title: '指令名称', field: 'name', align: 'left' }, { title: '提示词名称', field: 'name', align: 'left' },
{ title: '指令类型', field: 'indexSourceName' }, { title: '提示词类型', slots: { default: 'type' }, field: 'type' },
{ title: '三元组', field: 'remark' }, { title: '提取内容', field: 'prompt' }
{ title: '属性', field: 'remark' }
], ],
data: [{}] data: [{}]
}, },
@ -101,10 +116,18 @@ export default {
height: '240px', height: '240px',
columns: [ columns: [
{ type: 'checkbox', width: '80px' }, { type: 'checkbox', width: '80px' },
{ title: '属性名称', field: 'remark' }, { title: '属性名称', field: 'attrName' },
{ title: '属性类型', field: 'remark' } { title: '属性类型', field: 'attrValueType' }
], ],
data: [{}] data: []
},
//
promptTextList: JSON.parse(sessionStorage.getItem('prompt_prototype_default_text')),
selectInfo: {
promptId: '',
promptName: '',
promptText: '',
properties: undefined
}, },
// //
selectionRows: [] selectionRows: []
@ -112,79 +135,101 @@ export default {
}, },
methods: { methods: {
// //
show() { show(type, info) {
this.dialogOption.show = true this.dialogOption.show = true
if (info) {
this.selectInfo = info
}
// this.selectionRows = data // this.selectionRows = data
// this.searchForm['name'] = '' this.searchForm['name'] = ''
// this.fetchData() if (type === '3') {
this.searchForm.type = '2'
} else if (type === '5') {
this.searchForm.type = '1'
}
// this.searchForm.type = type
this.fetchData()
this.tableHeight(750)
},
getTypeName(val) {
for (const item of this.promptType) {
if (item.value === val) {
return item.label
}
}
},
getAttrValueTypeName(val) {
for (const item of this.attrValueTypeList) {
if (item.value === val) {
return item.label
}
}
},
getPromptText(val) {
for (const item of this.promptTextList) {
if (item.value === val) {
return item.label
}
}
}, },
//
fetchData() { fetchData() {
queryAtomicIndex(this.searchForm, 1, 99999).then(res => { queryPromptList({ ...this.searchForm,
this.gridOptions.data = res.data.result page: 1, size: 99999
}).then(res => {
this.gridOptions.data = res.data.records
this.queryForm.total = res.data.total this.queryForm.total = res.data.total
// this.$refs.xTable.clearCheckboxRow() // this.$refs.xTable.clearCheckboxRow()
if (this.selectionRows && this.selectionRows.length > 0) { if (this.selectInfo.promptId) {
// //
const _this = this const _this = this
_this.$nextTick(() => { _this.$nextTick(() => {
_this.gridOptions.data.map(column => { _this.gridOptions.data.map(item => {
_this.selectionRows.map(item => { if (item.id === this.selectInfo.promptId) {
if (item.id === column.id) { _this.$refs.xTable.setRadioRow(item)
_this.$refs.xTable.setCheckboxRow(column, true) _this.$set(this.modelGridOptions, 'data', item.extractAttributes)
} _this.$set(this.selectInfo, 'promptText', this.getPromptText(item.type))
}
_this.$nextTick(() => {
_this.modelGridOptions.data.map(column => {
_this.selectInfo.extractAttributes.map(e => {
if (e === column.attrName) {
_this.$refs.modelTable.setCheckboxRow(column, true)
}
})
})
}) })
}) })
}) })
} }
}) })
}, },
radioChangeEvent({ newValue, rowIndex }) {
this.selectInfo.promptId = newValue.id
this.selectInfo.promptName = newValue.name
this.$set(this.modelGridOptions, 'data', newValue.extractAttributes || [])
this.$set(this.selectInfo, 'promptText', this.getPromptText(newValue.type))
},
// () // ()
selectChangeEvent({ checked, records, reserves, row }) { selectChangeEvent() {
// this.selectionRows = this.$refs.modelTable.getCheckboxRecords().map(item => item.attrName)
if (checked) { console.log('111222', this.selectionRows)
// },
if (reserves.length == 0) { handleChangeAll() {
this.selectedRowKeys = records.map(v => v.id) this.selectionRows = this.$refs.modelTable.getCheckboxRecords().map(item => item.attrName)
this.selectionRows = records console.log('111222', this.selectionRows)
} else {
// id,
this.selectedRowKeys = [...reserves.map(v => v.id), ...records.map(v => v.id)]
// ,
this.selectionRows = [...reserves, ...records]
}
} else {
//
const idIndex = this.selectedRowKeys.indexOf(row.id)
if (idIndex > -1) {
// id
this.$delete(this.selectedRowKeys, idIndex)
}
let dataIndex = null
for (let i = 0; i < this.selectionRows.length; i++) {
if (this.selectionRows[i].id === row.id) {
dataIndex = i
break
}
}
//
this.$delete(this.selectionRows, dataIndex)
}
}, },
// //
handleSearch() { handleSearch() {
this.fetchData() this.fetchData()
}, },
// //
handleSubmit() { handleSubmit() {
const list = this.selectionRows if (!this.selectInfo.promptId) {
if (list.length === 0) {
this.$baseMessage.error('请至少选择一项!') this.$baseMessage.error('请至少选择一项!')
return return
} }
this.$emit('submit', list) this.$emit('submit', this.selectInfo, this.selectionRows)
this.dialogOption.show = false this.dialogOption.show = false
} }
} }
@ -199,14 +244,30 @@ export default {
margin-bottom: 20px; margin-bottom: 20px;
height: 550px; height: 550px;
.main-right { .main-right {
flex: 1; width: 500px;
margin-left: 24px; margin-left: 24px;
.empty-content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: 16px;
height: 100%;
color: #333333;
border: 1px solid #D9D9D9;
img {
width: 200px;
height: 200px;
}
}
.chart-content { .chart-content {
background: #FFFFFF; background: #FFFFFF;
border-radius: 6px 6px 6px 6px; border-radius: 6px 6px 6px 6px;
border: 1px solid #D9D9D9; border: 1px solid #D9D9D9;
padding: 16px; padding: 16px;
height: 100%; height: 100%;
display: flex;
flex-direction: column;
.title { .title {
font-weight: bold; font-weight: bold;
font-size: 18px; font-size: 18px;
@ -220,6 +281,8 @@ export default {
border: 1px solid #D9D9D9; border: 1px solid #D9D9D9;
padding: 16px; padding: 16px;
height: 100%; height: 100%;
display: flex;
flex-direction: column;
.title { .title {
font-weight: bold; font-weight: bold;
font-size: 18px; font-size: 18px;
@ -228,6 +291,14 @@ export default {
margin-top: 16px; margin-top: 16px;
} }
} }
.promptText {
font-size: 14px;
color: #333333;
line-height: 24px;
overflow-y: auto;
margin-top: 16px;
white-space:pre-wrap
}
} }
} }

@ -8,10 +8,10 @@
<template> <template>
<div ref="logic" class="logic-content"> <div ref="logic" class="logic-content">
<div v-for="(item, index) in logicData" :key="index"> <div v-for="(item, index) in ruleConditionGroupList" :key="index">
<div v-if="index !== 0" class="flex-row group-logic-content"> <div v-if="index !== 0" class="flex-row group-logic-content">
<i class="active-point" /> <i class="active-point" />
<el-radio-group v-model="item.groupLogic" class="group-logic"> <el-radio-group v-model="groupLogic" class="group-logic">
<el-radio-button <el-radio-button
v-for="logic in logicSymbolOptions" v-for="logic in logicSymbolOptions"
:key="logic.value" :key="logic.value"
@ -31,7 +31,7 @@
</div> </div>
<div class="group"> <div class="group">
<span class="group-title">影响案件指标的原子指标项目</span> <span class="group-title">影响案件指标的原子指标项目</span>
<el-radio-group v-model="item.rowLogic" :disabled="item.atomicData.length === 1" class="row-logic"> <el-radio-group v-model="item.rowLogic" :disabled="item.ruleConditionList.length === 1" class="row-logic">
<el-radio-button <el-radio-button
v-for="logic in logicSymbolOptions" v-for="logic in logicSymbolOptions"
:key="logic.value" :key="logic.value"
@ -40,21 +40,22 @@
{{ logic.label }} {{ logic.label }}
</el-radio-button> </el-radio-button>
</el-radio-group> </el-radio-group>
<div v-for="(subItem, subIndex) in item.atomicData" :key="subIndex"> <div v-for="(subItem, subIndex) in item.ruleConditionList" :key="subIndex">
<div class="flex-row row-content"> <div class="flex-row row-content">
<span class="row-line" /> <span class="row-line" />
<el-button <el-button
icon="el-icon-remove-outline" icon="el-icon-remove-outline"
type="text" type="text"
style="color: red" style="color: red"
:disabled="item.atomicData.length === 1" :disabled="item.ruleConditionList.length === 1"
@click="handleRowClick(item, subItem)" @click="handleRowClick(item, subItem)"
/> />
<el-select <el-select
v-model="subItem.atomicIndex" v-model="subItem.atomicIndexId"
placeholder="请选择" placeholder="请选择"
clearable clearable
style="width: 300px" style="width: 300px"
@change="((val)=>{selectAtomic(val, subItem)})"
> >
<el-option <el-option
v-for="option in atomicIndexData" v-for="option in atomicIndexData"
@ -76,12 +77,29 @@
:value="option.value" :value="option.value"
/> />
</el-select> </el-select>
<div v-if="subItem.relationalSymbol==='3' && subItem.indexSource ==='3'">
<el-input v-model="modelText" style="width: 80px;margin-left: 20px" readonly />
<el-select
v-model="subItem.operator"
placeholder="请选择"
clearable
style="width: 100px;margin-left: 20px"
>
<el-option
v-for="option in operatorList"
:key="option"
:label="option"
:value="option"
/>
</el-select>
<el-input v-model="subItem.value" style="width: 150px;margin-left: 20px" />
</div>
</div> </div>
<div class="row-sku"> <div v-if="subItem.indexSource === '5'" class="row-sku">
<div class="row-sku-top"> <div class="row-sku-top">
<i class="el-icon-circle-plus-outline" style="color: #3763FF;font-size: 14px;" /> <i class="el-icon-circle-plus-outline" style="color: #3763FF;font-size: 14px;" />
<span>添加单个条件</span> <span @click="addOperandUnitList(index,subIndex)"></span>
<el-radio-group v-model="subItem.groupLogic" class="group-logic"> <el-radio-group v-model="subItem.logic" class="group-logic">
<el-radio-button <el-radio-button
v-for="logic in logicSymbolOptions" v-for="logic in logicSymbolOptions"
:key="logic.value" :key="logic.value"
@ -90,7 +108,121 @@
{{ logic.label }} {{ logic.label }}
</el-radio-button> </el-radio-button>
</el-radio-group></div> </el-radio-group></div>
<div v-for="(items,i) in "></div> <div v-for="(items,i) in subItem.operandUnitList" :key="i">
<div class="flex-row row-content">
<!-- <span class="row-line" /> -->
<el-button
icon="el-icon-remove-outline"
type="text"
style="color: red"
:disabled="subItem.operandUnitList.length === 1"
@click="delItem(subItem, items)"
/>
<el-select
v-model="items.leftOperand.propertyKey"
placeholder="请选择"
clearable
style="width: 200px"
@change="((val)=>{selectPropertyKey(val, items,subItem.atomicIndexId)})"
>
<el-option
v-for="option in atomicIndexAttributeScope[subItem.atomicIndexId]"
:key="option.value"
:label="option.value"
:value="option.value"
/>
</el-select>
<el-select
v-if="items.leftOperand.propertyKey"
v-model="items.leftOperand.aggregateType"
placeholder="请选择"
clearable
style="width: 100px;margin-left: 20px;"
>
<el-option
v-for="option in getOptionList(items.leftOperand.propertyKey,subItem.atomicIndexId,'aggregateList')"
:key="option.key"
:label="option.value"
:value="option.key"
/>
</el-select>
<el-select
v-if="items.leftOperand.propertyKey"
v-model="items.operator"
placeholder="请选择"
clearable
style="width: 100px;margin-left: 20px;"
>
<el-option
v-for="option in getOptionList(items.leftOperand.propertyKey,subItem.atomicIndexId,'operatorList')"
:key="option"
:label="option"
:value="option"
/>
</el-select>
<el-select
v-if="items.leftOperand.propertyKey"
v-model="items.rightOperand.operandType"
placeholder="请选择"
clearable
style="width: 100px;margin-left: 20px;"
>
<el-option
key="6"
label="值"
value="6"
/> <el-option
key="5"
label="原子指标"
value="5"
/>
</el-select>
<div v-if="items.rightOperand.operandType ==='6'" style="margin-left: 20px;">
<el-input v-if="getAttrValueType(items.leftOperand.propertyKey,subItem.atomicIndexId) ==='1'" v-model="items.rightOperand.value" placeholder="请输入" />
<el-input v-if="getAttrValueType(items.leftOperand.propertyKey,subItem.atomicIndexId) ==='2'" v-model="items.rightOperand.value" type="number" placeholder="请输入" />
<el-date-picker
v-if="getAttrValueType(items.leftOperand.propertyKey,subItem.atomicIndexId) ==='3'"
v-model="items.rightOperand.value"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
type="date"
placeholder="选择日期"
/>
</div>
<el-select
v-if="items.rightOperand.operandType ==='5'"
v-model="items.rightOperand.atomicIndexId"
style="margin-left: 20px;width: 200px;"
placeholder="请选择"
clearable
@change="(()=>{items.rightOperand.propertyKey = ''})"
>
<el-option
v-for="option in atomicIndexData"
:key="option.id"
:label="option.name"
:value="option.id"
/>
</el-select>
<el-select
v-if="items.rightOperand.operandType ==='5'"
v-model="items.rightOperand.propertyKey"
placeholder="请选择"
clearable
style="width: 150px;margin-left: 20px;"
>
<el-option
v-for="option in atomicIndexAttributeScope[items.rightOperand.atomicIndexId]"
:key="option.value"
:label="option.value"
:value="option.value"
/>
</el-select>
</div>
</div>
</div> </div>
</div> </div>
<el-button <el-button
@ -126,6 +258,7 @@
<script> <script>
import mixin from '@/views/mixin' import mixin from '@/views/mixin'
// import { CirclePlus } from "@element-plus/icons-vue"; // import { CirclePlus } from "@element-plus/icons-vue";
import { listAtomicIndexAttributeScope } from '@/api/indexRule'
export default { export default {
name: 'CustomLogic', name: 'CustomLogic',
mixins: [mixin], mixins: [mixin],
@ -135,20 +268,24 @@ export default {
required: true, required: true,
defaultValue: [] defaultValue: []
}, },
judgeLogic: { indexRule: {
type: String, type: Object,
required: true, required: true,
defaultValue: '' default: () => {
return {}
}
} }
}, },
data() { data() {
return { return {
// //
logicData: [ ruleConditionGroupList: [
{ groupLogic: '1', rowLogic: '1', atomicData: [{ atomicIndex: '', relationalSymbol: '', attributeList:[{ { rowLogic: '2', ruleConditionList: [{ atomicIndexId: '', indexSource: '', logic: '2', relationalSymbol: '', operator: '', value: '', operandUnitList: [] }] }
}] }] }
], ],
groupLogic: '2',
modelText: '数量',
atomicIndexAttributeScope: {},
operatorList: ['>', '>=', '<', '<=', '=', '!='],
// //
logicSymbolOptions: JSON.parse(sessionStorage.getItem('logic_symbol')) logicSymbolOptions: JSON.parse(sessionStorage.getItem('logic_symbol'))
// //
@ -170,24 +307,104 @@ export default {
// watch: { // watch: {
// isChange(val) { // isChange(val) {
// if (val === true) { // if (val === true) {
// this.logicData = [ // this.ruleConditionGroupList = [
// { groupLogic: '1', rowLogic: '1', atomicData: [{ atomicIndex: '', relationalSymbol: '' }] } // { groupLogic: '1', rowLogic: '1', ruleConditionList: [{ atomicIndexId: '', relationalSymbol: '' }] }
// ] // ]
// } // }
// } // }
// }, // },
mounted() { mounted() {
if (!this.judgeLogic) return this.getAtomicIndexAttributeScope()
this.logicData = JSON.parse(this.judgeLogic) if (!this.indexRule.ruleConditionGroupList || this.indexRule.ruleConditionGroupList.length === 0) return
this.logicData.map((item) => { this.groupLogic = this.indexRule.groupLogic
item.atomicData.map((subItem) => { this.ruleConditionGroupList = this.indexRule.ruleConditionGroupList
if (!this.getListValueFlag(subItem.atomicIndex)) { this.ruleConditionGroupList.map((item) => {
subItem.atomicIndex = '' item.ruleConditionList.map((subItem) => {
if (!this.getListValueFlag(subItem.atomicIndexId)) {
subItem.atomicIndexId = ''
subItem.indexSource = ''
subItem.operandUnitList = []
} }
}) })
}) })
}, },
methods: { methods: {
//
getIndexSource(val) {
for (const item of this.atomicIndexData) {
if (val === item.id) {
return item.indexSource
}
}
},
//
async getAtomicIndexAttributeScope() {
const list = []
for (const item of this.atomicIndexData) {
list.push(item.id)
}
const res = await listAtomicIndexAttributeScope(list)
if (res.code === 200) {
this.atomicIndexAttributeScope = res.data
}
},
getAttrValueType(value, atomicIndexId) {
if (value && atomicIndexId) {
const list = this.atomicIndexAttributeScope[atomicIndexId]
for (const item of list) {
if (item.value === value) {
return item.valueType
}
}
}
},
//
getOptionList(value, atomicIndexId, type) {
if (value && atomicIndexId) {
const list = this.atomicIndexAttributeScope[atomicIndexId]
for (const item of list) {
if (item.value === value) {
return item[type]
}
}
}
},
selectAtomic(val, subItem) {
this.getAtomicIndexAttributeScope(val)
subItem.indexSource = this.getIndexSource(val)
this.$set(subItem, 'relationalSymbol', '')
this.$set(subItem, 'operator', '')
this.$set(subItem, 'value', '')
},
//
selectPropertyKey(val, items, id) {
items.leftOperand.valueType = this.getAttrValueType(val, id)
this.$set(items.leftOperand, 'aggregateType', '')
this.$set(items, 'rightOperand', {
atomicIndexId: '',
value: '',
valueType: '',
operandType: '',
propertyKey: ''
})
this.$set(items, 'operator', '')
},
//
addOperandUnitList(index, subIndex) {
this.ruleConditionGroupList[index].ruleConditionList[subIndex].operandUnitList.push({
leftOperand: {
atomicIndexId: '',
operandType: '5'
},
rightOperand: {
atomicIndexId: '',
value: '',
valueType: '',
operandType: '',
propertyKey: ''
}
})
},
// //
handleAdd() { handleAdd() {
this.gridOptions.data.push({ this.gridOptions.data.push({
@ -208,41 +425,43 @@ export default {
}, },
// //
handleAddRow(val) { handleAddRow(val) {
val.atomicData.push({ val.ruleConditionList.push({
atomicIndex: '', atomicIndexId: '', indexSource: '', rowLogic: '', relationalSymbol: '', operator: '', value: '', operandUnitList: []
relationalSymbol: ''
}) })
}, },
// //
handleAddGroup(index) { handleAddGroup(index) {
this.logicData.splice(index, 0, { if (this.ruleConditionGroupList.length > 1) return
groupLogic: '1', this.ruleConditionGroupList.splice(index, 0, {
rowLogic: '&', rowLogic: '2', ruleConditionList: [{ atomicIndexId: '', indexSource: '', rowLogic: '', relationalSymbol: '', operator: '', value: '', operandUnitList: [] }]
atomicData: [
{ atomicIndex: '', relationalSymbol: '' }
]
}) })
}, },
// //
handleDelGroup(item) { handleDelGroup(item) {
this.logicData.splice(this.logicData.indexOf(item), 1) this.ruleConditionGroupList.splice(this.ruleConditionGroupList.indexOf(item), 1)
}, },
// //
handleRowClick(item, subItem) { handleRowClick(item, subItem) {
item.atomicData.splice(item.atomicData.indexOf(subItem), 1) item.ruleConditionList.splice(item.ruleConditionList.indexOf(subItem), 1)
},
delItem(item, subItem) {
item.operandUnitList.splice(item.operandUnitList.indexOf(subItem), 1)
}, },
// //
validate() { validate() {
let valid = true let valid = true
this.logicData.map((item) => { this.ruleConditionGroupList.map((item) => {
item.atomicData.map((subItem) => { item.ruleConditionList.map((subItem) => {
if (!subItem.atomicIndex || !subItem.relationalSymbol) { if (!subItem.atomicIndexId || !subItem.relationalSymbol) {
valid = false valid = false
} }
}) })
}) })
if (valid) { if (valid) {
return this.logicData return {
groupLogic: this.groupLogic,
ruleConditionGroupList: this.ruleConditionGroupList
}
} else { } else {
this.$baseMessage.error('请选择原子指标和关系符号') this.$baseMessage.error('请选择原子指标和关系符号')
} }
@ -298,8 +517,11 @@ export default {
left: 310px; left: 310px;
} }
.row-sku { .row-sku {
padding-left: 50px; background: rgba(55,99,255,0.05);
margin: 0 42px;
padding: 18px;
.row-sku-top { .row-sku-top {
// padding-left: 50px;
span { span {
font-size: 14px; font-size: 14px;
color: #3763FF; color: #3763FF;

@ -79,10 +79,10 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<!-- <el-form-item label="判断逻辑" prop="judgeLogic">--> <!-- <el-form-item label="判断逻辑" prop="indexRule">-->
<!-- <template>--> <!-- <template>-->
<!-- <div class="flex-row">--> <!-- <div class="flex-row">-->
<!-- <el-select v-model="ruleForm['judgeLogic']" placeholder="请选择判断逻辑">--> <!-- <el-select v-model="ruleForm['indexRule']" placeholder="请选择判断逻辑">-->
<!-- <el-option--> <!-- <el-option-->
<!-- v-for="item in judgmentLogicOptions"--> <!-- v-for="item in judgmentLogicOptions"-->
<!-- :key="item.value"--> <!-- :key="item.value"-->
@ -114,13 +114,14 @@
</el-form> </el-form>
<div v-if="activeStep === 1"> <div v-if="activeStep === 1">
<p>{{ `[${indexTypeName}] ${ruleForm['name']}` }}</p> <p>{{ `[${indexTypeName}] ${ruleForm['name']}` }}</p>
<custom-logic ref="custom" :atomic-index-data="ruleForm['atomicIndexList']" :judge-logic="ruleForm['judgeLogic']" /> <custom-logic ref="custom" :atomic-index-data="ruleForm['atomicIndexList']" :index-rule="ruleForm['indexRule']" />
</div> </div>
<!--原子指标选择--> <!--原子指标选择-->
<select-atomic ref="select" @submit="handleAtomicSubmit" /> <select-atomic ref="select" @submit="handleAtomicSubmit" />
</div> </div>
<div slot="footer"> <div slot="footer">
<el-button type="primary" plain style="width: 150px" @click="handleReset"> </el-button> <el-button v-if="!isEdit" type="primary" plain style="width: 150px" @click="handleReset"> </el-button>
<el-button v-if="isEdit" type="primary" plain style="width: 150px" @click="closed"> </el-button>
<el-button v-if="activeStep === 0" type="primary" style="width: 150px" @click="nextStep"></el-button> <el-button v-if="activeStep === 0" type="primary" style="width: 150px" @click="nextStep"></el-button>
<el-button v-if="activeStep === 1" type="primary" plain style="width: 150px" @click="lastStep"></el-button> <el-button v-if="activeStep === 1" type="primary" plain style="width: 150px" @click="lastStep"></el-button>
<el-button v-if="activeStep === 1" type="primary" style="width: 150px" @click="handleSubmit"> </el-button> <el-button v-if="activeStep === 1" type="primary" style="width: 150px" @click="handleSubmit"> </el-button>
@ -174,10 +175,10 @@ export default {
}], }],
// indexRules: [{ required: true, message: '!', trigger: 'blur' }], // indexRules: [{ required: true, message: '!', trigger: 'blur' }],
atomicIndex: [{ required: true, message: '原子指标不能为空!', trigger: 'blur' }], atomicIndex: [{ required: true, message: '原子指标不能为空!', trigger: 'blur' }],
judgeLogic: [{ required: true, message: '指标说明不能为空!', trigger: 'blur' }] indexRule: [{ required: true, message: '指标说明不能为空!', trigger: 'blur' }]
}, },
// //
isEdit: false, isEdit: false
// //
} }
}, },
@ -216,8 +217,11 @@ export default {
}, },
// //
handleReset() { handleReset() {
this.$refs.form.resetFields() this.activeStep = 0
this.$refs.form.clearValidate() this.$nextTick(() => {
this.$refs.form.resetFields()
this.$refs.form.clearValidate()
})
}, },
// //
nextStep() { nextStep() {
@ -231,12 +235,27 @@ export default {
lastStep() { lastStep() {
this.activeStep = 0 this.activeStep = 0
}, },
closed() {
this.drawerOption.show = false
},
// //
async handleSubmit() { async handleSubmit() {
// //
const logicData = this.$refs.custom.validate() const params = this.$refs.custom.validate()
if (logicData) { for (const item of params.ruleConditionGroupList) {
this.$set(this.ruleForm, 'judgeLogic', JSON.stringify(logicData)) for (const items of item.ruleConditionList) {
for (const data of items.operandUnitList) {
data.leftOperand.atomicIndexId = items.atomicIndexId
}
}
}
// const params = {
// ruleConditionGroupList,
// groupLogic: ruleConditionGroupList[0].groupLogic
// }
console.log(params)
if (params.ruleConditionGroupList) {
this.$set(this.ruleForm, 'indexRule', params)
} }
if (this.$baseLodash.isArray(this.ruleForm['caseType'])) { if (this.$baseLodash.isArray(this.ruleForm['caseType'])) {
this.ruleForm['caseType'] = this.ruleForm['caseType'].join(',') this.ruleForm['caseType'] = this.ruleForm['caseType'].join(',')

Loading…
Cancel
Save