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

批量设置

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