校验
This commit is contained in:
parent
29212683a8
commit
58d66e41dc
@ -229,7 +229,6 @@
|
|||||||
label="画像字段标识"
|
label="画像字段标识"
|
||||||
:rules="rules.fieldContentList.fieldMark"
|
:rules="rules.fieldContentList.fieldMark"
|
||||||
:prop="`fieldContentList.${index}.fieldMark`"
|
:prop="`fieldContentList.${index}.fieldMark`"
|
||||||
|
|
||||||
>
|
>
|
||||||
<el-input
|
<el-input
|
||||||
style="width: 260px"
|
style="width: 260px"
|
||||||
@ -329,7 +328,6 @@
|
|||||||
style="width: 260px"
|
style="width: 260px"
|
||||||
v-model="form.fieldMark"
|
v-model="form.fieldMark"
|
||||||
placeholder="请输入画像字段标识,例如:${content}"
|
placeholder="请输入画像字段标识,例如:${content}"
|
||||||
|
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="内容备注信息" prop="contentRemark">
|
<el-form-item label="内容备注信息" prop="contentRemark">
|
||||||
@ -357,93 +355,66 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
|
|
||||||
var validateInput = (rule, value, callback) => {
|
var validateInput = (rule, value, callback) => {
|
||||||
const regex =/^\$/;
|
if (!value) {
|
||||||
if (!value) {
|
callback(new Error("画像字段标识不能为空"));
|
||||||
callback(new Error("画像字段标识不能为空"));
|
}
|
||||||
}else if (!regex.test(value)){
|
else if (!value.startsWith('$') || /[\u4e00-\u9fa50-9]/.test(value)) {
|
||||||
callback(new Error('画像字段标识格式有误,请以$开头'));
|
callback(new Error('画像字段标识格式有误,请以$开头,例如${content}'));
|
||||||
}else{
|
} else {
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
};
|
// const regex =/^\$/;
|
||||||
return {
|
// // const regex =/^\$[^u4e00-u9fa50-9]/
|
||||||
// 遮罩层
|
// if (!value) {
|
||||||
loading: true,
|
// callback(new Error("画像字段标识不能为空"));
|
||||||
// 选中数组
|
// }else if (!regex.test(value)){
|
||||||
ids: [],
|
// callback(new Error('画像字段标识格式有误,请以$开头'));
|
||||||
// 非单个禁用
|
// }else{
|
||||||
single: true,
|
// callback();
|
||||||
// 非多个禁用
|
// }
|
||||||
multiple: true,
|
};
|
||||||
// 显示搜索条件
|
return {
|
||||||
showSearch: true,
|
// 遮罩层
|
||||||
// 总条数
|
loading: true,
|
||||||
total: 0,
|
// 选中数组
|
||||||
// 标签字段内容信息表格数据
|
ids: [],
|
||||||
labelfieldcontentList: [],
|
// 非单个禁用
|
||||||
labelfieldList: [],
|
single: true,
|
||||||
// 弹出层标题
|
// 非多个禁用
|
||||||
title: "",
|
multiple: true,
|
||||||
// 是否显示弹出层
|
// 显示搜索条件
|
||||||
open: false,
|
showSearch: true,
|
||||||
openup: false,
|
// 总条数
|
||||||
// 查询参数
|
total: 0,
|
||||||
queryParams: {
|
// 标签字段内容信息表格数据
|
||||||
pageNum: 1,
|
labelfieldcontentList: [],
|
||||||
pageSize: 10,
|
labelfieldList: [],
|
||||||
fieldId: null,
|
// 弹出层标题
|
||||||
fieldName: null,
|
title: "",
|
||||||
contentName: null,
|
// 是否显示弹出层
|
||||||
contentCode: null,
|
open: false,
|
||||||
resultPreview: null,
|
openup: false,
|
||||||
contentSort: null,
|
// 查询参数
|
||||||
contentRemark: null,
|
queryParams: {
|
||||||
fieldMark: null,
|
pageNum: 1,
|
||||||
},
|
pageSize: 10,
|
||||||
// 表单参数
|
fieldId: null,
|
||||||
form: {},
|
fieldName: null,
|
||||||
// 表单校验
|
contentName: null,
|
||||||
rules: {
|
contentCode: null,
|
||||||
fieldId: [
|
resultPreview: null,
|
||||||
{ required: true, message: "请选择字段信息", trigger: "blur" }
|
contentSort: null,
|
||||||
],
|
contentRemark: null,
|
||||||
fieldContentList: {
|
fieldMark: null,
|
||||||
contentName: [
|
},
|
||||||
{
|
// 表单参数
|
||||||
required: true,
|
form: {},
|
||||||
message: "请输入内容名称",
|
// 表单校验
|
||||||
trigger: "blur",
|
rules: {
|
||||||
},
|
fieldId: [
|
||||||
],
|
{ required: true, message: "请选择字段信息", trigger: "blur" }
|
||||||
resultPreview: [
|
],
|
||||||
{
|
fieldContentList: {
|
||||||
required: true,
|
|
||||||
message: "请输入结果预览",
|
|
||||||
trigger: "blur",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
contentSort: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: "请输入内容排序",
|
|
||||||
trigger: "blur",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
fieldMark: [
|
|
||||||
{
|
|
||||||
|
|
||||||
required: true,
|
|
||||||
trigger: "blur",
|
|
||||||
validator: validateInput
|
|
||||||
},
|
|
||||||
],
|
|
||||||
|
|
||||||
},
|
|
||||||
},
|
|
||||||
rulesup: {
|
|
||||||
fieldId: [
|
|
||||||
{ required: true, message: "画像标签和知识库字段表id不能为空", trigger: "blur" }
|
|
||||||
],
|
|
||||||
contentName: [
|
contentName: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
@ -467,177 +438,214 @@ export default {
|
|||||||
],
|
],
|
||||||
fieldMark: [
|
fieldMark: [
|
||||||
{
|
{
|
||||||
|
|
||||||
required: true,
|
required: true,
|
||||||
// message: "请输入画像字段表示",
|
|
||||||
trigger: "blur",
|
trigger: "blur",
|
||||||
validator: validateInput
|
validator: validateInput
|
||||||
},
|
},
|
||||||
|
// { pattern:/^$W*$/, message: '以$开头且不能输入汉字和数字的字符串', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
|
|
||||||
},
|
},
|
||||||
};
|
},
|
||||||
|
rulesup: {
|
||||||
|
fieldId: [
|
||||||
|
{ required: true, message: "画像标签和知识库字段表id不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
contentName: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: "请输入内容名称",
|
||||||
|
trigger: "blur",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
resultPreview: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: "请输入结果预览",
|
||||||
|
trigger: "blur",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
contentSort: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: "请输入内容排序",
|
||||||
|
trigger: "blur",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
fieldMark: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
// message: "请输入画像字段表示",
|
||||||
|
trigger: "blur",
|
||||||
|
validator: validateInput
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 查询标签字段内容信息列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
listLabelfieldcontent(this.queryParams).then(response => {
|
||||||
|
this.labelfieldcontentList = response.rows;
|
||||||
|
this.total = response.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
created() {
|
// 字段信息
|
||||||
this.getList();
|
getlabel() {
|
||||||
},
|
this.loading = true;
|
||||||
methods: {
|
labelFieldInfoList().then(response => {
|
||||||
/** 查询标签字段内容信息列表 */
|
this.labelfieldList = response.data;
|
||||||
getList() {
|
// this.total = response.total;
|
||||||
this.loading = true;
|
this.loading = false;
|
||||||
listLabelfieldcontent(this.queryParams).then(response => {
|
});
|
||||||
this.labelfieldcontentList = response.rows;
|
|
||||||
this.total = response.total;
|
|
||||||
this.loading = false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
// 字段信息
|
|
||||||
getlabel() {
|
|
||||||
this.loading = true;
|
|
||||||
labelFieldInfoList().then(response => {
|
|
||||||
this.labelfieldList = response.data;
|
|
||||||
// this.total = response.total;
|
|
||||||
this.loading = false;
|
|
||||||
});
|
|
||||||
|
|
||||||
},
|
},
|
||||||
change(e) {
|
change(e) {
|
||||||
this.form.fieldName = this.labelfieldList.find(f => f.id == e).fieldName
|
this.form.fieldName = this.labelfieldList.find(f => f.id == e).fieldName
|
||||||
console.log(e)
|
console.log(e)
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
addnurseClassifyitem() {
|
addnurseClassifyitem() {
|
||||||
var obj = {
|
var obj = {
|
||||||
contentName: null,
|
contentName: null,
|
||||||
resultPreview: null,
|
resultPreview: null,
|
||||||
contentSort: undefined,
|
contentSort: undefined,
|
||||||
fieldMark: null,
|
fieldMark: null,
|
||||||
contentRemark: null,
|
contentRemark: null,
|
||||||
};
|
};
|
||||||
if (this.form.fieldContentList.length == 5) {
|
if (this.form.fieldContentList.length == 5) {
|
||||||
this.$message.error("最多批量添加5条");
|
this.$message.error("最多批量添加5条");
|
||||||
} else {
|
} else {
|
||||||
this.form.fieldContentList.push(obj);
|
this.form.fieldContentList.push(obj);
|
||||||
console.log(this.form)
|
console.log(this.form)
|
||||||
}
|
|
||||||
},
|
|
||||||
//添加时删除item
|
|
||||||
delnurseClassifyitem(index) {
|
|
||||||
this.form.fieldContentList.splice(index, 1);
|
|
||||||
},
|
|
||||||
// 取消按钮
|
|
||||||
cancel() {
|
|
||||||
this.open = false;
|
|
||||||
this.reset();
|
|
||||||
},
|
|
||||||
// 修改取消
|
|
||||||
cancelup() {
|
|
||||||
this.openup = false,
|
|
||||||
this.reset();
|
|
||||||
|
|
||||||
},
|
|
||||||
// 表单重置
|
|
||||||
reset() {
|
|
||||||
this.form = {
|
|
||||||
id: null,
|
|
||||||
fieldId: null,
|
|
||||||
fieldName: null,
|
|
||||||
contentName: null,
|
|
||||||
contentCode: null,
|
|
||||||
resultPreview: null,
|
|
||||||
contentSort: undefined,
|
|
||||||
contentRemark: null,
|
|
||||||
fieldMark: null,
|
|
||||||
createBy: null,
|
|
||||||
createTime: null,
|
|
||||||
updateBy: null,
|
|
||||||
updateTime: null
|
|
||||||
};
|
|
||||||
this.resetForm("form");
|
|
||||||
},
|
|
||||||
/** 搜索按钮操作 */
|
|
||||||
handleQuery() {
|
|
||||||
this.queryParams.pageNum = 1;
|
|
||||||
this.getList();
|
|
||||||
},
|
|
||||||
/** 重置按钮操作 */
|
|
||||||
resetQuery() {
|
|
||||||
this.resetForm("queryForm");
|
|
||||||
this.handleQuery();
|
|
||||||
},
|
|
||||||
// 多选框选中数据
|
|
||||||
handleSelectionChange(selection) {
|
|
||||||
this.ids = selection.map(item => item.id)
|
|
||||||
this.single = selection.length !== 1
|
|
||||||
this.multiple = !selection.length
|
|
||||||
},
|
|
||||||
/** 新增按钮操作 */
|
|
||||||
handleAdd() {
|
|
||||||
this.reset();
|
|
||||||
this.open = true;
|
|
||||||
this.form = {
|
|
||||||
fieldContentList: [
|
|
||||||
{
|
|
||||||
contentName: null,
|
|
||||||
resultPreview: null,
|
|
||||||
contentSort: undefined,
|
|
||||||
fieldMark: null,
|
|
||||||
contentRemark: null,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
this.getlabel();
|
|
||||||
this.title = "添加标签字段内容信息";
|
|
||||||
},
|
|
||||||
/** 修改按钮操作 */
|
|
||||||
handleUpdate(row) {
|
|
||||||
this.reset();
|
|
||||||
const id = row.id || this.ids
|
|
||||||
this.getlabel();
|
|
||||||
getLabelfieldcontent(id).then(response => {
|
|
||||||
this.form = response.data;
|
|
||||||
this.openup = true;
|
|
||||||
this.title = "修改标签字段内容信息";
|
|
||||||
});
|
|
||||||
},
|
|
||||||
/** 提交按钮 */
|
|
||||||
submitForm() {
|
|
||||||
this.$refs["form"].validate(valid => {
|
|
||||||
if (valid) {
|
|
||||||
if (this.form.id != null) {
|
|
||||||
updateLabelfieldcontent(this.form).then(response => {
|
|
||||||
this.$modal.msgSuccess("修改成功");
|
|
||||||
this.openup = false;
|
|
||||||
this.getList();
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
addLabelfieldcontent(this.form).then(response => {
|
|
||||||
this.$modal.msgSuccess("新增成功");
|
|
||||||
this.open = false;
|
|
||||||
this.getList();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
/** 删除按钮操作 */
|
|
||||||
handleDelete(row) {
|
|
||||||
const ids = row.id || this.ids;
|
|
||||||
this.$modal.confirm('是否确认删除标签字段内容信息编号为"' + ids + '"的数据项?').then(function () {
|
|
||||||
return delLabelfieldcontent(ids);
|
|
||||||
}).then(() => {
|
|
||||||
this.getList();
|
|
||||||
this.$modal.msgSuccess("删除成功");
|
|
||||||
}).catch(() => { });
|
|
||||||
},
|
|
||||||
/** 导出按钮操作 */
|
|
||||||
handleExport() {
|
|
||||||
this.download('manage/labelfieldcontent/export', {
|
|
||||||
...this.queryParams
|
|
||||||
}, `labelfieldcontent_${new Date().getTime()}.xlsx`)
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
//添加时删除item
|
||||||
|
delnurseClassifyitem(index) {
|
||||||
|
this.form.fieldContentList.splice(index, 1);
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
// 修改取消
|
||||||
|
cancelup() {
|
||||||
|
this.openup = false,
|
||||||
|
this.reset();
|
||||||
|
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
id: null,
|
||||||
|
fieldId: null,
|
||||||
|
fieldName: null,
|
||||||
|
contentName: null,
|
||||||
|
contentCode: null,
|
||||||
|
resultPreview: null,
|
||||||
|
contentSort: undefined,
|
||||||
|
contentRemark: null,
|
||||||
|
fieldMark: null,
|
||||||
|
createBy: null,
|
||||||
|
createTime: null,
|
||||||
|
updateBy: null,
|
||||||
|
updateTime: null
|
||||||
|
};
|
||||||
|
this.resetForm("form");
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
// 多选框选中数据
|
||||||
|
handleSelectionChange(selection) {
|
||||||
|
this.ids = selection.map(item => item.id)
|
||||||
|
this.single = selection.length !== 1
|
||||||
|
this.multiple = !selection.length
|
||||||
|
},
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
handleAdd() {
|
||||||
|
this.reset();
|
||||||
|
this.open = true;
|
||||||
|
this.form = {
|
||||||
|
fieldContentList: [
|
||||||
|
{
|
||||||
|
contentName: null,
|
||||||
|
resultPreview: null,
|
||||||
|
contentSort: undefined,
|
||||||
|
fieldMark: null,
|
||||||
|
contentRemark: null,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
this.getlabel();
|
||||||
|
this.title = "添加标签字段内容信息";
|
||||||
|
},
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
handleUpdate(row) {
|
||||||
|
this.reset();
|
||||||
|
const id = row.id || this.ids
|
||||||
|
this.getlabel();
|
||||||
|
getLabelfieldcontent(id).then(response => {
|
||||||
|
this.form = response.data;
|
||||||
|
this.openup = true;
|
||||||
|
this.title = "修改标签字段内容信息";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm() {
|
||||||
|
this.$refs["form"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (this.form.id != null) {
|
||||||
|
updateLabelfieldcontent(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("修改成功");
|
||||||
|
this.openup = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
addLabelfieldcontent(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("新增成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
const ids = row.id || this.ids;
|
||||||
|
this.$modal.confirm('是否确认删除标签字段内容信息编号为"' + ids + '"的数据项?').then(function () {
|
||||||
|
return delLabelfieldcontent(ids);
|
||||||
|
}).then(() => {
|
||||||
|
this.getList();
|
||||||
|
this.$modal.msgSuccess("删除成功");
|
||||||
|
}).catch(() => { });
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
this.download('manage/labelfieldcontent/export', {
|
||||||
|
...this.queryParams
|
||||||
|
}, `labelfieldcontent_${new Date().getTime()}.xlsx`)
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.el-input-number .el-input__inner {
|
.el-input-number .el-input__inner {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user