字段信息管理修改

This commit is contained in:
shidongli 2024-06-21 13:51:11 +08:00
parent 9661ae223f
commit bd3724fcb5

View File

@ -1,13 +1,34 @@
<template>
<div class="app-container" ref="layout">
<div ref="topform" class="form">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="字段名称" prop="fieldName">
<el-input v-model="queryParams.fieldName" placeholder="请输入字段名称" clearable @keyup.enter.native="handleQuery" />
<el-input
v-model="queryParams.fieldName"
placeholder="请输入字段名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="字段类型" label-width="100px" prop="fieldType">
<el-select v-model="queryParams.fieldType" placeholder="请选择字段类型" clearable>
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
<el-select
v-model="queryParams.fieldType"
placeholder="请选择字段类型"
clearable
>
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
@ -36,84 +57,236 @@
/>
</el-form-item> -->
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item>
</el-form>
</div>
<div ref="mb8" class="mb8">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
v-hasPermi="['manage:labelfieldinfo:add']">新增</el-button>
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['manage:labelfieldinfo:add']"
>新增</el-button
>
</el-col>
<el-col :span="1.5">
<el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
v-hasPermi="['manage:labelfieldinfo:edit']">修改</el-button>
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['manage:labelfieldinfo:edit']"
>修改</el-button
>
</el-col>
<el-col :span="1.5">
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
v-hasPermi="['manage:labelfieldinfo:remove']">删除</el-button>
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['manage:labelfieldinfo:remove']"
>删除</el-button
>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
</div>
<div ref="table">
<el-table :max-height="maxTableHeight" v-loading="loading" :data="labelfieldinfodata"
@selection-change="handleSelectionChange">
<el-table
:max-height="maxTableHeight"
v-loading="loading"
:data="labelfieldinfodata"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="字段名称" align="center" prop="fieldName" />
<el-table-column label="字段编码" align="center" prop="fieldCode" />
<el-table-column label="字段类型" align="center" prop="fieldType">
<template slot-scope="scope">
{{ scope.row.fieldType == "PORTRAIT_LABEL_FIELD" ? '画像标签' : '' }}
{{ scope.row.fieldType == "KNOWLEDGE_FIELD" ? '知识库字段' : '' }}
{{
scope.row.fieldType == "PORTRAIT_LABEL_FIELD" ? "画像标签" : ""
}}
{{ scope.row.fieldType == "KNOWLEDGE_FIELD" ? "知识库字段" : "" }}
</template>
</el-table-column>
<el-table-column label="字段排序" align="center" prop="fieldSort" />
<el-table-column label="字段备注信息" align="center" prop="fieldRemark" :show-overflow-tooltip="true" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<el-table-column
label="字段备注信息"
align="center"
prop="fieldRemark"
:show-overflow-tooltip="true"
/>
<el-table-column
label="任务细分"
align="center"
prop="taskPartitionDictName"
:show-overflow-tooltip="true"
/>
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['manage:labelfieldinfo:edit']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['manage:labelfieldinfo:remove']">删除</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['manage:labelfieldinfo:edit']"
>修改</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['manage:labelfieldinfo:remove']"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
</div>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
@pagination="getList" />
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加标签字段信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="750px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px" :inline="true">
<el-form
ref="form"
:model="form"
:rules="rules"
label-width="100px"
:inline="true"
>
<div v-for="(aitem, index) in form.labelFieldInfoList" :key="index">
<el-form-item label="字段名称" :rules="rules.labelFieldInfoList.fieldName"
:prop="`labelFieldInfoList.${index}.fieldName`">
<el-input v-model="aitem.fieldName" placeholder="请输入字段名称" style="width: 210px" />
<el-form-item
label="字段名称"
:rules="rules.labelFieldInfoList.fieldName"
:prop="`labelFieldInfoList.${index}.fieldName`"
>
<el-input
v-model="aitem.fieldName"
placeholder="请输入字段名称"
style="width: 210px"
/>
</el-form-item>
<el-form-item label="字段类型" :rules="rules.labelFieldInfoList.fieldType"
:prop="`labelFieldInfoList.${index}.fieldType`">
<el-select v-model="aitem.fieldType" placeholder="请选择字段类型" clearable style="width: 210px">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
<el-form-item
label="字段类型"
:rules="rules.labelFieldInfoList.fieldType"
:prop="`labelFieldInfoList.${index}.fieldType`"
>
<el-select
v-model="aitem.fieldType"
placeholder="请选择字段类型"
clearable
style="width: 210px"
>
<el-option
v-for="item in options"
:key="item.dictValue"
:label="item.dictLabel"
:value="item.dictValue"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="字段排序" :rules="rules.labelFieldInfoList.fieldSort"
:prop="`labelFieldInfoList.${index}.fieldSort`">
<el-input-number v-model="aitem.fieldSort" controls-position="right" :min="0" placeholder="请输入字段排序"
style="width: 210px" />
<el-form-item
label="字段排序"
:rules="rules.labelFieldInfoList.fieldSort"
:prop="`labelFieldInfoList.${index}.fieldSort`"
>
<el-input-number
v-model="aitem.fieldSort"
controls-position="right"
:min="0"
placeholder="请输入字段排序"
style="width: 210px"
/>
<!-- <el-input v-model="aitem.fieldSort" placeholder="请输入字段排序" oninput="value=value.replace(/[^\d]/g,'')"
maxlength="5"/> -->
</el-form-item>
<el-form-item label="字段备注信息" prop="fieldRemark">
<el-input style="width: 210px" v-model="aitem.fieldRemark" placeholder="请输入字段备注信息" type="textarea" />
<el-input
style="width: 210px"
v-model="aitem.fieldRemark"
placeholder="请输入字段备注信息"
type="textarea"
/>
</el-form-item>
<el-button type="primary" plain icon="el-icon-circle-plus-outline" style="margin-top: 9px; margin-left: 6px"
v-if="index == 0" @click="addnurseClassifyitem"></el-button>
<el-button type="danger" icon="el-icon-delete" plain style="margin-top: 9px; margin-left: 6px"
v-if="index != 0" @click="delnurseClassifyitem(index)"></el-button>
<el-form-item label="任务细分" prop="taskPartitionDictId">
<el-button
type=""
v-if="aitem.taskPartitionDictName == '请选择任务细分'"
@click="clickinnerVisible(aitem, index)"
style="
width: 210px;
text-align: left;
height: 36px;
color: #c0c4cc;
overflow: hidden;
"
>{{ aitem.taskPartitionDictName }}</el-button
>
<el-button
@click="clickinnerVisible(aitem, index)"
type=""
v-else
style="
width: 210px;
text-align: left;
height: 36px;
padding-left: -10px;
overflow: hidden;
"
>{{ aitem.taskPartitionDictName }}</el-button
>
</el-form-item>
<el-button
type="primary"
plain
icon="el-icon-circle-plus-outline"
style="margin-left: 6px"
v-if="index == 0"
@click="addnurseClassifyitem"
></el-button>
<el-button
type="danger"
icon="el-icon-delete"
plain
style="margin-left: 6px"
v-if="index != 0"
@click="delnurseClassifyitem(index)"
></el-button>
</div>
</el-form>
<div slot="footer" class="dialog-footer">
@ -122,43 +295,240 @@
</div>
</el-dialog>
<!-- 修改标签字段信息对话框 -->
<el-dialog :title="titleup" :visible.sync="openup" width="750px" append-to-body>
<el-form ref="form" :model="form" :rules="rulesup" label-width="100px" :inline="true">
<el-dialog
:title="titleup"
:visible.sync="openup"
width="750px"
append-to-body
>
<el-form
ref="form"
:model="form"
:rules="rulesup"
label-width="100px"
:inline="true"
>
<el-form-item label="字段名称" prop="fieldName">
<el-input v-model="form.fieldName" placeholder="请输入字段名称" style="width: 210px" />
<el-input
v-model="form.fieldName"
placeholder="请输入字段名称"
style="width: 210px"
/>
</el-form-item>
<el-form-item label="字段类型" prop="fieldType">
<el-select v-model="form.fieldType" placeholder="请选择字段类型" clearable style="width: 210px">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
<el-select
v-model="form.fieldType"
placeholder="请选择字段类型"
clearable
style="width: 210px"
>
<el-option
v-for="item in options"
:key="item.dictValue"
:label="item.dictLabel"
:value="item.dictValue"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="字段排序" prop="fieldSort">
<el-input-number v-model="form.fieldSort" controls-position="right" :min="0" placeholder="请输入字段排序"
style="width: 210px" />
<el-input-number
v-model="form.fieldSort"
controls-position="right"
:min="0"
placeholder="请输入字段排序"
style="width: 210px"
/>
</el-form-item>
<el-form-item label="字段备注信息" prop="fieldRemark">
<el-input style="width: 210px" v-model="form.fieldRemark" placeholder="请输入字段备注信息" type="textarea" />
<el-input
style="width: 210px"
v-model="form.fieldRemark"
placeholder="请输入字段备注信息"
type="textarea"
/>
</el-form-item>
<el-form-item label="任务细分" prop="taskPartitionDictId">
<el-button
type=""
v-if="form.taskPartitionDictName == '请选择任务细分'"
@click="clickinnerVisiblexg()"
style="
width: 210px;
text-align: left;
height: 36px;
color: #c0c4cc;
overflow: hidden;
"
>{{ form.taskPartitionDictName }}</el-button
>
<el-button
@click="clickinnerVisiblexg()"
type=""
v-else
style="
width: 210px;
text-align: left;
height: 36px;
padding-left: -10px;
overflow: hidden;
"
>{{ form.taskPartitionDictName }}</el-button
>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancelup"> </el-button>
</div>
</el-dialog>
<!-- 任务细分弹框 -->
<el-dialog
title="选择任务细分"
:visible.sync="innerVisible"
width="1000px"
append-to-body
:before-close="innerVisiblecancel"
>
<el-form
:model="queryParamstask"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="100px"
>
<el-form-item label="任务细分名称" prop="taskPartitionName">
<el-input
v-model="queryParamstask.taskPartitionName"
placeholder="请输入任务细分名称"
clearable
/>
</el-form-item>
<el-form-item label="任务细分编码" prop="taskPartitionCode">
<el-input
v-model="queryParamstask.taskPartitionCode"
placeholder="请输入任务细分编码"
clearable
/>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuerytask"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuerytask"
>重置</el-button
>
</el-form-item>
</el-form>
<el-table
:max-height="maxTableHeight"
v-loading="loading"
:data="partitionList"
@selection-change="handleSelectionChange"
>
<el-table-column label="请选择" width="100" align="center">
<template slot-scope="scope">
<el-button
type="primary"
style="width: 15px; height: 15px"
v-if="taskPartitionDictId == scope.row.taskTypeId"
circle
@click="nurseclickzx(scope.row)"
></el-button>
<el-button
v-else
style="width: 15px; height: 15px"
circle
@click="nurseclickzx(scope.row)"
></el-button>
</template>
</el-table-column>
<el-table-column
label="任务类型名称"
align="center"
prop="taskTypeName"
/>
<el-table-column
label="任务细分名称"
align="center"
prop="taskPartitionName"
/>
<el-table-column
label="任务细分编码"
align="center"
prop="taskPartitionCode"
/>
<el-table-column
label="二级分类描述"
align="center"
prop="secondClassifyDescribe"
:show-overflow-tooltip="true"
/>
<el-table-column
label="执行时间"
align="center"
prop="executionTime"
width="180"
>
</el-table-column>
<el-table-column
label="任务细分排序"
align="center"
prop="taskPartitionSort"
/>
<el-table-column
label="任务细分备注"
align="center"
prop="taskPartitionRemark"
:show-overflow-tooltip="true"
/>
</el-table>
<pagination
class="pag"
v-show="totaltask > 0"
:total="totaltask"
:page.sync="queryParamstask.pageNum"
:limit.sync="queryParamstask.pageSize"
@pagination="getListpartit"
/>
</el-dialog>
</div>
</template>
<script>
import { listLabelfieldinfo, getLabelfieldinfo, delLabelfieldinfo, addLabelfieldinfo, updateLabelfieldinfo } from "@/api/manage/labelfieldinfo";
import { listPartition } from "@/api/system/partition";
import { getAgencytype } from "@/api/system/agency";
export default {
name: "Labelfieldinfo",
data() {
return {
innerVisible: false,//
//
partitionList: [],
//
queryParamstask: {
pageNum: 1,
pageSize: 10,
taskTypeId: null,
taskTypeName: null,
taskPartitionName: null,
taskPartitionCode: null,
secondClassifyDescribe: null,
executionTime: null,
taskPartitionSort: null,
taskPartitionRemark: null,
},
nnerVisibleindex: '',
taskPartitionDictId: '',
maxTableHeight: undefined,
totaltask: 0,
//
loading: true,
//
@ -189,13 +559,7 @@ export default {
fieldSort: null,
fieldRemark: null,
},
options: [{
value: 'PORTRAIT_LABEL_FIELD',
label: '画像标签'
}, {
value: 'KNOWLEDGE_FIELD',
label: '知识库'
},],
options: [],
//
form: {},
//
@ -267,12 +631,66 @@ export default {
},
created() {
this.getList();
this.infolistword();
},
mounted() {
this.getMaxTableHeight()
this.screenChange()
},
methods: {
infolistword() {
var dictType = "field_type";
getAgencytype(dictType).then((res) => {
this.options = res.data;
});
},
//
getListpartit() {
this.loading = true;
listPartition(this.queryParamstask).then(response => {
this.partitionList = response.rows;
this.totaltask = response.total;
this.loading = false;
});
},
//
clickinnerVisible(aitem, index) {
this.getListpartit();
this.taskPartitionDictId = aitem.taskPartitionDictId ? aitem.taskPartitionDictId : '';
this.nnerVisibleindex = index;
this.innerVisible = true;
},
//
clickinnerVisiblexg() {
if (this.form.taskPartitionDictId) {
this.taskPartitionDictId = this.form.taskPartitionDictId
}
this.getListpartit();
this.innerVisible = true;
},
//
innerVisiblecancel() {
this.innerVisible = false;
},
nurseclickzx(row) {
console.log(row)
if (this.title == '添加标签字段信息') {
this.form.labelFieldInfoList[this.nnerVisibleindex].taskPartitionDictName =
row.taskTypeName;
this.form.labelFieldInfoList[this.nnerVisibleindex].taskPartitionDictId =
row.taskTypeId;
} else if (this.titleup == '修改标签字段信息') {
this.form.taskPartitionDictName =
row.taskTypeName;
this.form.taskPartitionDictId =
row.taskTypeId;
}
this.innerVisible = false;
},
/** 查询标签字段信息列表 */
getList() {
this.loading = true;
@ -289,7 +707,8 @@ export default {
fieldName: null,
fieldRemark: null,
fieldSort: undefined,
taskPartitionDictName: '请选择任务细分',
taskPartitionDictId: '',
};
if (this.form.labelFieldInfoList.length == 5) {
this.$message.error("最多批量添加5条");
@ -325,7 +744,11 @@ export default {
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
updateTime: null,
taskPartitionDictName: null,
taskPartitionDictId: null,
};
this.resetForm("form");
},
@ -339,6 +762,16 @@ export default {
this.resetForm("queryForm");
this.handleQuery();
},
handleQuerytask(){
this.queryParamstask.pageNum = 1;
this.getListpartit();
},
resetQuerytask() {
this.resetForm("queryForm");
this.handleQuerytask();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
@ -355,6 +788,9 @@ export default {
fieldName: null,
fieldRemark: null,
fieldSort: undefined,
taskPartitionDictName: '请选择任务细分',
taskPartitionDictId: '',
},
],
};
@ -363,29 +799,46 @@ export default {
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
this.infolistword();
const id = row.id || this.ids
getLabelfieldinfo(id).then(response => {
this.form = response.data;
if(!this.form.taskPartitionDictName||this.form.taskPartitionDictName==""){
this.form.taskPartitionDictName='请选择任务细分'
}
this.openup = true;
// this.title = "";
this.titleup = "修改标签字段信息";
});
},
/** 提交按钮 */
submitForm() {
console.log(this.form)
// return
this.$refs["form"].validate(valid => {
var obj = JSON.parse(JSON.stringify(this.form))
if (valid) {
if (this.form.id != null) {
updateLabelfieldinfo(this.form).then(response => {
if(obj.taskPartitionDictName=='请选择任务细分'){
obj.taskPartitionDictName=""
}
console.log(obj,'obj')
// return
updateLabelfieldinfo(obj).then(response => {
this.$modal.msgSuccess("修改成功");
this.openup = false;
this.getList();
});
} else {
addLabelfieldinfo(this.form).then(response => {
obj.labelFieldInfoList.forEach(e => {
if (e.taskPartitionDictName == '请选择任务细分') {
e.taskPartitionDictName = ""
}
});
addLabelfieldinfo(obj).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
@ -437,6 +890,12 @@ export default {
};
</script>
<style lang="scss" scoped>
.pag{
top: 13px;
position: relative;
left: 61%;
}
::v-deep .el-input-number .el-input__inner {
text-align: left;
}