Commit fc10faa5 authored by 骆瑛's avatar 骆瑛

对象管理

parents 1980d95c 0ea63655
This diff is collapsed.
This diff is collapsed.
<template>
<div>
<Row>
<Table :columns="inputColumns" :data="data">
<template slot-scope="{ row, index }" slot="columnDescription">
<div v-if="row.columnDescription != ''">
{{ row.columnDescription }}
</div>
<Input
v-else
@on-change="setRow(row, index)"
v-model="row.columnDescription"
placeholder="请输入"
/>
</template>
<template slot-scope="{ row, index }" slot="propertyName">
<div v-if="row.propertyName != ''">
{{ row.propertyName }}
</div>
<Input
v-else
@on-change="setRow(row, index)"
v-model="row.propertyName"
placeholder="请输入"
/>
</template>
<template slot-scope="{ row, index }" slot="type">
<Dictionary
@on-change="setRow(row, index)"
v-model="row.type"
code="base.project_atom.inputDtos"
:value="row.type"
:key="row.type"
></Dictionary>
</template>
<template slot-scope="{ row, index }" slot="children">
<Checkbox
v-model="row.children"
@on-change="setRow(row, index)"
></Checkbox>
</template>
<template slot-scope="{ row, index }" slot="action">
<a
@click="remove(index, row)"
style="color: #ff7a8b"
v-if="row.action == 0"
>删除</a
>
</template>
</Table>
<Button type="dashed" long @click="addNew(0, '{}')" class="mt10"
>新增属性</Button
>
</Row>
</div>
</template>
<script>
export default {
// name: '',
data() {
return {
data: [],
inputColumns: [
{
title: "名称",
align: "center",
key: "columnDescription",
slot: "columnDescription",
},
{
title: "列类型",
key: "type",
align: "center",
slot: "type",
high: true,
},
{
title: "属性",
key: "propertyName",
align: "center",
slot: "propertyName",
high: true,
},
{
title: "表头分组",
align: "center",
key: "children",
slot: "children",
high: false,
},
{
width: 80,
title: "操作",
slot: "action",
align: "center",
},
],
};
},
props: {
changeTabs: String,
dtosList: Array,
default: () => {
return [];
},
},
mounted() {
this.data = [];
console.log("进入页面", this.dtosList);
let arr = this.dtosList.filter((v) => v.code == this.changeTabs);
console.log(arr);
if (arr[0].list.length > 0) {
arr[0].list.map((e) => {
let obj = {
columnDescription: e.columnDescription,
type: e.type,
propertyName: e.propertyName,
children: e.children,
action: 1, //不可删除项
};
this.data.push(obj);
});
} else {
arr[0].list.map((e) => {
let obj = {
columnDescription: e.columnDescription,
type: "",
propertyName: e.propertyName,
children: "",
action: 1, //不可删除项
};
this.data.push(obj);
});
}
},
methods: {
setRow(row, index) {
this.$set(this.data, index, row);
this.dtosList.forEach((v) => {
if (v.code == this.changeTabs) {
v.list = this.data;
}
});
console.log("提交", this.dtosList);
this.$emit("dtos", this.dtosList);
},
remove(index, row) {
if (row.action == 0) {
//新增的删除,直接删
this.data.splice(index, 1);
}
},
addNew(index, e) {
let name = "",
flag = false;
if (index == 0 && e == "{}") {
this.checkList.forEach((s, index) => {
if (s.columnDescription == "") {
this.$Message.warning("请填写表格名称!");
return (flag = true);
}
if (s.propertyName == "") {
this.$Message.warning("请填写表格属性!");
return (flag = true);
}
});
if (flag == true) {
return;
}
let obj = {
columnDescription: "",
type: "",
propertyName: "",
children: "",
action: 1, //不可删除项
};
this.checkList.push(obj);
}
// else if (index == 1 && JSON.stringify(e) != "{}") {
// JSON.parse(e.content).map((item) => {
// this.checkList.push(item);
// });
// } else {
// this.$Message.warning("请选择导入字段!");
// return;
// }
},
},
watch: {
dtosList(v) {
this.data = v;
},
},
};
</script>
\ No newline at end of file
<template>
<div>
<h1>输出页面</h1>
<Row>
<Table :columns="columns" :data="data1">
<template slot-scope="{ row, index }" slot="columnDescription">
<div v-if="row.action != 0">
{{ row.columnDescription }}
</div>
<Input
v-else
v-model="row.columnDescription"
@on-change="setRow(row, index)"
placeholder="请输入"
/>
</template>
<template slot-scope="{ row, index }" slot="propertyName">
<div v-if="row.action != 0">
{{ row.propertyName }}
</div>
<Input
v-else
v-model="row.propertyName"
@on-change="setRow(row, index)"
placeholder="请输入"
/>
</template>
<template slot-scope="{ row, index }" slot="type">
<Dictionary
@on-change="setRow(row, index)"
v-model="row.type"
code="base.project_atom.inputDtos"
:value="row.type"
:key="row.type"
></Dictionary>
</template>
<template slot-scope="{ row, index }" slot="width">
<Input
v-model="row.width"
@on-change="setRow(row, index)"
placeholder="请输入"
/>
</template>
<template slot-scope="{ row, index }" slot="align">
<Dictionary
@on-change="setRow(row, index)"
v-model="row.align"
code="base.project_atom.align"
:value="row.align"
:key="row.align"
></Dictionary>
</template>
<template slot-scope="{ row, index }" slot="fixed">
<Dictionary
@on-change="setRow(row, index)"
v-model="row.fixed"
code="base.project_atom.fixed"
:value="row.fixed"
:key="row.fixed"
></Dictionary>
</template>
<template slot-scope="{ row, index }" slot="ellipsis">
<Checkbox
@on-change="setRow(row, index)"
v-model="row.ellipsis"
></Checkbox>
</template>
<template slot-scope="{ row, index }" slot="tooltip">
<Checkbox
@on-change="setRow(row, index)"
v-model="row.tooltip"
></Checkbox>
</template>
<template slot-scope="{ row, index }" slot="render">
<Checkbox
@on-change="setRow(row, index)"
v-model="row.render"
></Checkbox>
</template>
<template slot-scope="{ row, index }" slot="sortable">
<Checkbox
@on-change="setRow(row, index)"
v-model="row.sortable"
></Checkbox>
</template>
<template slot-scope="{ row, index }" slot="resizable">
<Input
@on-change="setRow(row, index)"
v-model="row.resizable"
placeholder="请输入"
/>
</template>
<template slot-scope="{ row, index }" slot="action">
<a
@click="remove(index, row)"
style="color: #ff7a8b"
v-if="row.action == 0"
>删除</a
>
</template>
</Table>
<Button type="dashed" long @click="addNew(0, '{}')" class="mt10"
>新增属性</Button
>
</Row>
</div>
</template>
<script>
import { values } from "lodash";
export default {
data() {
return {
data1: [],
columns: [
{
title: "名称",
align: "center",
key: "columnDescription",
slot: "columnDescription",
},
{
title: "列类型",
key: "type",
align: "center",
slot: "type",
high: true,
},
{
title: "属性",
key: "propertyName",
align: "center",
slot: "propertyName",
high: true,
},
{
title: "列宽",
align: "center",
key: "width",
slot: "width",
high: false,
},
{
title: "对齐方式",
align: "center",
key: "align",
slot: "align",
high: false,
},
{
title: "列固定方位",
align: "center",
key: "fixed",
slot: "fixed",
high: false,
},
{
title: "是否为省略号",
align: "center",
key: "ellipsis",
slot: "ellipsis",
high: false,
},
{
title: "Tooltip 组件使用",
align: "center",
key: "tooltip",
slot: "tooltip",
high: false,
},
{
title: "渲染render",
align: "center",
key: "render",
slot: "render",
high: false,
},
{
title: "排序",
align: "center",
key: "sortable",
slot: "sortable",
high: false,
},
{
title: "列宽度调整",
align: "center",
key: "resizable",
slot: "resizable",
high: false,
},
{
width: 80,
title: "操作",
slot: "action",
align: "center",
},
],
};
},
props: {
changeTabs: String,
dtosList: Array,
default: () => {
return [];
},
},
mounted() {
this.data1 = [];
console.log("进入页面",this.dtosList)
let arr = this.dtosList.filter((v) => v.code == this.changeTabs);
if (arr[0].list.length > 0) {
arr[0].list.map((e) => {
let obj = {
columnDescription: e.columnDescription,
type: e.type,
propertyName: e.propertyName,
width: e.width,
align: e.align,
fixed: e.fixed,
ellipsis: e.ellipsis,
tooltip: e.tooltip,
render: e.render,
sortable: e.sortable,
resizable: e.resizable,
action: 1, //不可删除项
};
this.data1.push(obj);
});
}else{
arr[0].list.map((e) => {
let obj = {
columnDescription: e.columnDescription,
type: "",
propertyName: e.propertyName,
width: "",
align:"",
fixed:"",
ellipsis: "",
tooltip:"",
render: "",
sortable: "",
resizable: "",
action: 1, //不可删除项
};
this.data1.push(obj);
});
}
},
methods: {
setRow(row, index) {
this.$set(this.data1, index, row);
this.dtosList.forEach((v) => {
if(v.code == this.changeTabs){
v.list=this.data1;
}
});
console.log("提交",this.dtosList)
this.$emit("dtos",this.dtosList );
},
addNew(index, e) {
let name = "",
flag = false;
if (index == 0 && e == "{}") {
this.data1.forEach((s, index) => {
if (s.columnDescription == "") {
this.$Message.warning("请填写表格名称!");
return (flag = true);
}
if (s.propertyName == "") {
this.$Message.warning("请填写表格属性!");
return (flag = true);
}
});
if (flag == true) {
return;
}
let obj = {
columnDescription: "",
type: "",
propertyName: "",
width: null,
align: null,
fixed: null,
ellipsis: null,
tooltip: null,
render: null,
sortable: null,
resizable: null,
action: 0, //可删除项
};
this.data1.push(obj);
}
},
remove(index, row) {
if (row.action == 0) {
//新增的删除,直接删
this.data1.splice(index, 1);
}
// else {
// // row.action = 2; //返回的默认删除,删除后保存在arr数组中,添加标识action = 2,然后点击保存的时候,一起传给后台
// this.$set(this.data1, index, row);
// // this.arr.push(row);
// this.data1.splice(index, 1);
// }
},
},
watch: {
dtosList(v) {
this.data1 = v;
},
},
};
</script>
\ No newline at end of file
This diff is collapsed.
<template>
<div>
<DataGrid :columns="columns" ref="grid" :action="action"
><template slot="easySearch"
><Form ref="formInline" :model="easySearch" inline
><FormItem prop="keys"
><Input
placeholder="请输入关键字名称/英文全称/英文简称/编码"
v-model="easySearch.keys.value"
/>
</FormItem>
<FormItem
><Button type="primary" @click="search">查询</Button></FormItem
>
</Form></template
>
<template slot="searchForm">
<Search />
</template>
<template slot="buttons">
<Button type="primary" @click="add">新增</Button>
</template>
</DataGrid>
<!-- fullscreen -->
<Modal v-model="modal" :title="title" width="1200" footer-hide fullscreen>
<component :is="detail" :eid="curId" @on-close="cancel" @on-ok="ok" />
</Modal>
</div>
</template>
<script>
import Api from "./api";
import Search from "./search";
export default {
name: "list",
components: {
Search,
},
head: {
title: "项目对象",
author: "henq",
description: "project_atom 10/14/2020 11:41:27 AM",
},
data() {
return {
action: Api.index,
easySearch: {
keys: { op: "name,englishFullName,englishName,code", value: null },
},
modal: false,
title: "新增",
detail: null,
curId: 0,
columns: [
{
key: "id",
title: this.$t("id"),
hide: true,
align: "left",
high: true,
},
{
key: "name",
title: this.l("name"),
align: "left",
easy: true,
high: true,
},
{
key: "code",
title: this.l("code"),
align: "left",
easy: true,
high: true,
},
{
key: "status",
title: this.l("status"),
align: "left",
high: true,
code: "base.project_atom.status",
},
{
key: "type",
title: this.l("type"),
align: "left",
high: true,
code: "base.project_atom.type",
},
{
key: "englishFullName",
title: this.l("englishFullName"),
align: "left",
easy: true,
high: true,
},
{
key: "englishName",
title: this.l("englishName"),
align: "left",
easy: true,
high: true,
},
{ key: "module", title: this.l("module"), align: "left", high: true },
{ key: "version", title: this.l("version"), align: "left", high: true },
{
title: "操作",
key: "action",
width: 140,
align: "center",
render: (h, params) => {
return h("div", { class: "action" }, [
h(
"op",
{
attrs: { oprate: "detail" },
on: { click: () => this.view(params.row.id) },
},
"查看"
),
h(
"op",
{
attrs: { oprate: "edit" },
on: { click: () => this.edit(params.row.id) },
},
"编辑"
),
h(
"op",
{
attrs: { oprate: "delete" },
on: { click: () => this.remove(params.row.id) },
},
"删除"
),
]);
},
},
],
};
},
mounted() {},
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
methods: {
ok() {
this.$refs.grid.load();
this.modal = false;
this.curId = 0;
},
search() {
this.$refs.grid.reload(this.easySearch);
},
add() {
this.curId = 0;
this.title = "新增";
this.detail = () => import("./add");
this.modal = true;
},
// copy(id) {
// this.curId = id;
// this.title = "克隆";
// this.detail = () => import("./add");
// this.modal = true;
// },
view(id) {
this.curId = id;
this.title = "详情";
this.detail = () => import("./detail");
this.modal = true;
},
edit(id) {
this.curId = id;
this.title = "编辑";
this.detail = () => import("./edit");
this.modal = true;
},
remove(id) {
Api.delete(id).then((r) => {
if (r.success) {
this.$refs.grid.load();
this.$Message.success("删除成功");
}
});
},
cancel() {
this.curId = 0;
this.modal = false;
},
l(key) {
/*
project_atom:{
creationTime:'创建时间',
creatorUserId:'创建人',
lastModificationTime:'更新时间',
lastModifierUserId:'更新人',
isDeleted:'删除人',
deletionTime:'删除时间',
deleterUserId:'删除人',
name:'名称',
upId:'上级id',
level:'层级',
tenantId:'租户id',
type:'类别',
englishFullName:'英文全称',
englishName:'英文简称',
status:'状态',
description:'描述',
content:'内容',
inheritCategoryId:'继承分类id',
code:'编码',
module:'模块',
version:'版本',
projectId:'项目',
}
*/
let vkey = "project_atom" + "." + key;
return this.$t(vkey) || key;
},
},
};
</script>
<template>
<Form ref="form" :model="condition" :label-width="90">
<Row>
<!-- <Col :span="12" :v-if="condition.id.show"
>
<FormItem :label="$t('id')" prop="id">
<Input v-model="condition.id.value" number> </Input>
</FormItem
>
</Col>
<Col :span="12" :v-if="condition.creationTime.show"
><FormItem :label="l('creationTime')" prop="creationTime">
<DatePicker
type="daterange"
v-model="condition.creationTime.value"
></DatePicker> </FormItem
></Col>
<Col :span="12" :v-if="condition.creatorUserId.show"
><FormItem :label="l('creatorUserId')" prop="creatorUserId">
<Input v-model="condition.creatorUserId.value"> </Input> </FormItem
></Col>
<Col :span="12" :v-if="condition.lastModificationTime.show"
><FormItem
:label="l('lastModificationTime')"
prop="lastModificationTime"
>
<DatePicker
type="daterange"
v-model="condition.lastModificationTime.value"
></DatePicker> </FormItem
></Col>
<Col :span="12" :v-if="condition.lastModifierUserId.show"
><FormItem :label="l('lastModifierUserId')" prop="lastModifierUserId">
<Input v-model="condition.lastModifierUserId.value">
</Input> </FormItem
></Col>
<Col :span="12" :v-if="condition.deletionTime.show"
><FormItem :label="l('deletionTime')" prop="deletionTime">
<DatePicker
type="daterange"
v-model="condition.deletionTime.value"
></DatePicker> </FormItem
></Col>
<Col :span="12" :v-if="condition.name.show"
><FormItem :label="l('name')" prop="name">
<Input v-model="condition.name.value"> </Input> </FormItem
></Col>
<Col :span="12" :v-if="condition.upId.show"
><FormItem :label="l('upId')" prop="upId">
<Input v-model="condition.upId.value"> </Input> </FormItem
></Col>
<Col :span="12" :v-if="condition.level.show"
><FormItem :label="l('level')" prop="level">
<Input v-model="condition.level.value"> </Input> </FormItem
></Col>
<Col :span="12" :v-if="condition.tenantId.show"
><FormItem :label="l('tenantId')" prop="tenantId">
<Input v-model="condition.tenantId.value"> </Input> </FormItem
></Col>
<Col :span="12" :v-if="condition.type.show"
><FormItem :label="l('type')" prop="type">
<Input v-model="condition.type.value"> </Input> </FormItem
></Col>
<Col :span="12" :v-if="condition.englishFullName.show"
><FormItem :label="l('englishFullName')" prop="englishFullName">
<Input v-model="condition.englishFullName.value"> </Input> </FormItem
></Col>
<Col :span="12" :v-if="condition.englishName.show"
><FormItem :label="l('englishName')" prop="englishName">
<Input v-model="condition.englishName.value"> </Input> </FormItem
></Col>
<Col :span="12" :v-if="condition.status.show"
><FormItem :label="l('status')" prop="status">
<Input v-model="condition.status.value"> </Input> </FormItem
></Col>
<Col :span="24" :v-if="condition.description.show"
><FormItem :label="l('description')" prop="description">
<Input v-model="condition.description.value"> </Input> </FormItem
></Col>
<Col :span="12" :v-if="condition.inheritCategoryId.show"
><FormItem :label="l('inheritCategoryId')" prop="inheritCategoryId">
<Input v-model="condition.inheritCategoryId.value">
</Input> </FormItem
></Col>
<Col :span="12" :v-if="condition.code.show"
><FormItem :label="l('code')" prop="code">
<Input v-model="condition.code.value"> </Input> </FormItem
></Col>
<Col :span="12" :v-if="condition.module.show"
><FormItem :label="l('module')" prop="module">
<Input v-model="condition.module.value"> </Input> </FormItem
></Col>
<Col :span="12" :v-if="condition.version.show"
><FormItem :label="l('version')" prop="version">
<Input v-model="condition.version.value"> </Input> </FormItem
></Col>
<Col :span="12" :v-if="condition.projectId.show"
><FormItem :label="l('projectId')" prop="projectId">
<Input v-model="condition.projectId.value"> </Input> </FormItem
></Col> -->
</Row>
</Form>
</template>
<script>
import Api from "./api";
export default {
name: "Add",
data() {
return {
condition: {
id: { op: "Equal", value: null, show: true },
creationTime: { op: "Range", value: null, show: true },
creatorUserId: { op: "Equal", value: null, show: true },
lastModificationTime: { op: "Range", value: null, show: true },
lastModifierUserId: { op: "Equal", value: null, show: true },
deletionTime: { op: "Range", value: null, show: true },
name: { op: "Equal", value: null, show: true },
upId: { op: "Equal", value: null, show: true },
level: { op: "Equal", value: null, show: true },
tenantId: { op: "Equal", value: null, show: true },
type: { op: "Equal", value: null, show: true },
englishFullName: { op: "Equal", value: null, show: true },
englishName: { op: "Equal", value: null, show: true },
status: { op: "Equal", value: null, show: true },
description: { op: "Equal", value: null, show: true },
inheritCategoryId: { op: "Equal", value: null, show: true },
code: { op: "Equal", value: null, show: true },
module: { op: "Equal", value: null, show: true },
version: { op: "Equal", value: null, show: true },
projectId: { op: "Equal", value: null, show: true },
},
};
},
methods: {
handleClose() {
this.$emit("on-close");
},
l(key) {
key = "project_atom" + "." + key;
return this.$t(key);
},
},
};
</script>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment