Commit c0b6424e authored by 周远喜's avatar 周远喜

批量设置

parent cb7db6a0
<template>
<div>
<Select
:placeholder="placeholder"
v-model="name"
......@@ -7,7 +6,6 @@
:multiple="multiple"
clearable
filterable
transfer
>
<Option
v-for="item in users"
......@@ -30,7 +28,6 @@
</div>
</Option>
</Select>
</div>
</template>
<script>
......
......@@ -142,7 +142,7 @@ export default {
}).then((r) => {
if (r.success) {
this.$Message.success("导入成功");
this.$emit("on-load");
this.$emit("on-ok");
}
});
},
......
<template>
<div>
<div>
<Card>
<EditGrid :columns="columns" ref="grid" :batch="true" :items="list" :level="8" :drag="true" :exportTitle="exportTl" @on-selection-change="batchChange">
<EditGrid
:columns="columns"
ref="grid"
:batch="true"
:items="list"
:level="8"
:drag="true"
:exportTitle="exportTl"
@on-selection-change="batchChange"
>
<template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys"><Input placeholder="请输入关键字标题" v-model="easySearch.keys.value" />
<FormItem prop="keys"
><Input
placeholder="请输入关键字标题"
v-model="easySearch.keys.value"
/>
</FormItem>
<FormItem><Button type="primary" @click="search">查询</Button>
<FormItem
><Button type="primary" @click="search">查询</Button>
</FormItem>
</Form>
</template>
......@@ -15,7 +29,12 @@
</template> -->
<template slot="buttons">
<Button type="primary" @click="add(null)">新增</Button>
<Button @mouseenter.native="showBm" ref="showBtn" shape="circle" icon="md-settings"></Button>
<Button
@mouseenter.native="showBm"
ref="showBtn"
shape="circle"
icon="md-settings"
></Button>
<Dropdown @on-click="show" v-if="false">
<Button shape="circle" icon="md-settings"></Button>
<DropdownMenu slot="list">
......@@ -31,16 +50,43 @@
</Dropdown>
</template>
<template slot="batch">
<span v-width="300" style="color:#333">
<DateRange v-model="dateEntity" edit v-width="260"></DateRange>
<Button type="primary">设置2计划日期</Button>
</span>
<span>
<UserGroup
v-model="executors"
multiple
:projectId="eid"
v-width="300"
></UserGroup>
<Button type="primary">设置执行人</Button>
</span>
<Button type="primary" @click="bacthRemove()">批量删除</Button>
</template>
</EditGrid>
</Card>
<Submenus :show="showStatu" :data="tempItems" :params="params"></Submenus>
<Modal v-model="modal" :title="title" width="1200" footer-hide>
<component :is="detail" :eid="curId" :v="row" @on-close="cancel" @on-ok="ok" />
<component
:is="detail"
:eid="curId"
:v="row"
@on-close="cancel"
@on-ok="ok"
/>
</Modal>
<ImportExcel ref="importExcel" @on-get-data="getData" :modalTitle="temTitle" :columns="columns" :open="ModalIm" @on-cancel="ModalImCancel" @on-ok="ok" />
</div>
<ImportExcel
ref="importExcel"
@on-get-data="getData"
:modalTitle="temTitle"
:columns="columns"
:open="ModalIm"
@on-cancel="ModalImCancel"
@on-ok="ok"
/>
</div>
</template>
<script>
......@@ -73,13 +119,18 @@ export default {
data() {
return {
entity: {},
batchItems:[],
executors: [],
dateEntity: {
startDate: null,
endDate: null,
},
batchItems: [],
row: {},
action: Api.index,
easySearch: {
keys: {
op: "title",
value: null
value: null,
},
},
modal: false,
......@@ -88,19 +139,20 @@ export default {
curId: null,
list: [],
rootList: [],
columns: [{
columns: [
{
key: "drag",
type: "drag",
width: 50,
align: 'center',
title: '移动',
align: "center",
title: "移动",
},
{
key: "upId",
width: 50,
type: "selection",
align: 'center',
title: '选择',
align: "center",
title: "选择",
},
{
key: "upTitle",
......@@ -197,9 +249,12 @@ export default {
width: 150,
align: "center",
render: (h, params) => {
return h("div", {
class: "action"
}, [
return h(
"div",
{
class: "action",
},
[
h("op", {
attrs: {
icon: "md-arrow-dropright-circle",
......@@ -209,7 +264,7 @@ export default {
disable: params.row.status != 0,
},
on: {
click: () => this.send(params.row)
click: () => this.send(params.row),
},
}),
h("op", {
......@@ -221,7 +276,7 @@ export default {
oprate: "edit",
},
on: {
click: () => this.add(params.row)
click: () => this.add(params.row),
},
}),
h("op", {
......@@ -233,7 +288,7 @@ export default {
disable: params.row.status !== 0,
},
on: {
click: () => this.edit(params.row)
click: () => this.edit(params.row),
},
}),
h("op", {
......@@ -246,10 +301,11 @@ export default {
msg: "确认要删除吗?",
},
on: {
click: () => this.remove(params.row.id)
click: () => this.remove(params.row.id),
},
}),
]);
]
);
},
},
],
......@@ -258,7 +314,7 @@ export default {
tempItems: [], //控件数据
params: {}, //控件坐标位置
//导出导入
exportTl: '项目目录',
exportTl: "项目目录",
ModalIm: false,
temTitle: "项目目录",
};
......@@ -266,10 +322,7 @@ export default {
mounted() {
this.search();
},
async fetch({
store,
params
}) {
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
methods: {
......@@ -281,16 +334,18 @@ export default {
search() {
// this.$refs.grid.reload(this.easySearch);
var params = {
conditions: [{
conditions: [
{
fieldName: "projectId",
conditionalType: "Equal",
fieldValue: this.eid,
}, ],
},
],
// conditions: []
};
Api.list(params).then((r) => {
let res = r.result;
this.rootList = this.$u.clone(r.result)
this.rootList = this.$u.clone(r.result);
var data = this.$u.toTree(
res,
null,
......@@ -398,18 +453,17 @@ export default {
that.detail = () => import("./importTemplate");
that.modal = true;
},
}
};
//导出excel
if (name == 'down') {
this.exportTl = '项目目录-' + this.data.title;
if (name == "down") {
this.exportTl = "项目目录-" + this.data.title;
// this.$refs.grid.export2Excel()
this.$u.export2excel(this.exportTl, this.columns, this.list)
this.$u.export2excel(this.exportTl, this.columns, this.list);
}
if (name == 'importExcel') {
this.openModalIm()
if (name == "importExcel") {
this.openModalIm();
}
m[name] && m[name](name);
},
saveTemplate() {
var that = this;
......@@ -428,76 +482,96 @@ export default {
that.modal = true;
},
down() {
this.exportTl = '项目目录-' + this.data.title;
this.$u.export2excel(this.exportTl, this.columns, this.rootList, this.$store)
this.exportTl = "项目目录-" + this.data.title;
this.$u.export2excel(
this.exportTl,
this.columns,
this.rootList,
this.$store
);
//this.$refs.grid.export2Excel()
},
importExcel() {
this.openModalIm()
this.openModalIm();
},
showBm(event) {
let obj = event.target
let objSet = obj.getBoundingClientRect()
let obj = event.target;
let objSet = obj.getBoundingClientRect();
this.showStatu = true;
this.params = {
x: objSet.x,
y: objSet.bottom
y: objSet.bottom,
};
console.log(event)
this.tempItems = [{
console.log(event);
this.tempItems = [
{
label: "存为模版",
onClick: () => {
this.saveTemplate()
this.saveTemplate();
},
},
}, {
{
label: "导入模版",
divided: true,
onClick: () => {
this.useTemplate()
this.useTemplate();
},
},
{
label: "导出Excel",
icon: "md-cloud-download",
onClick: () => {
this.down()
this.down();
},
},
{
label: "导入Excel",
icon: "md-cloud-upload",
onClick: () => {
this.importExcel()
this.importExcel();
},
},
}
];
},
batchChange(items,list){
this.batchItems=items;
batchChange(items, list) {
this.batchItems = items;
},
bacthRemove(){
var ids=this.batchItems.map(u=>{
bacthRemove() {
var ids = this.batchItems.map((u) => {
return u.id;
})
if(ids.length>0){
Api.batch(ids).then(r=>{
if(r.success){
});
if (ids.length > 0) {
this.$Modal.confirm({
title: "确认",
content: "确认删除?",
onOk: () => {
Api.batch(ids).then((r) => {
if (r.success) {
this.search();
this.$Message.success("删除成功!");
} else {
this.$Message.error("出现异常");
}
})
});
},
});
}
},
//批量导入start
//导入功能
openModalIm() {
this.ModalIm = true
this.ModalIm = true;
},
ModalImCancel() {
this.ModalIm = false
this.ModalIm = false;
},
getData(val) {
let url = `${material}/projectplan/importplans`;
this.$refs.importExcel.deelData(url, this.columns, this.formatMethod(val))
this.$refs.importExcel.deelData(
url,
this.columns,
this.formatMethod(val)
);
},
//根据页面二次处理数据
formatMethod(val) {
......@@ -507,25 +581,23 @@ export default {
let obj = {
projectId: this.eid,
upTitle: ele.upTitle ? ele.upTitle : null,
title: ele.title ? ele.title : '',
title: ele.title ? ele.title : "",
status: 0,
type: ele.type ? ele.type : 0, //?
startDate: ele.startDate ? ele.startDate : "", //?
endDate: ele.endDate ? ele.endDate : "", //?
direction: ele.direction ? ele.direction : 0,
executor: ele.executor ? ele.executor : [], //?
deliverable: ele.deliverable ? ele.deliverable : 0
deliverable: ele.deliverable ? ele.deliverable : 0,
};
if (ele.title && ele.title != '') {
obj.ico = false
if (ele.title && ele.title != "") {
obj.ico = false;
} else {
obj.ico = true
obj.ico = true;
}
tempList.push(obj);
});
return tempList
return tempList;
},
//批量导入end
l(key) {
......
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