|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
<div class="app-container">
|
|
|
<el-form :model="queryParams" ref="queryForm" :inline="true" size="small" v-show="showSearch" label-width="68px">
|
|
|
- <el-form-item label="年份" prop="planYear">
|
|
|
+ <el-form-item label="所属年份" prop="planYear">
|
|
|
<el-date-picker clearable size="small" style="width: 200px"
|
|
|
v-model="queryParams.planYear"
|
|
|
type="year"
|
|
@@ -28,75 +28,13 @@
|
|
|
v-hasPermi="['branch:plan:add']"
|
|
|
>新增标题</el-button>
|
|
|
</el-col>
|
|
|
- <el-col :span="1.5">
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- plain
|
|
|
- icon="el-icon-plus"
|
|
|
- size="mini"
|
|
|
- @click="handleAdd"
|
|
|
- v-hasPermi="['branch:planitem:add']"
|
|
|
- >新增条目</el-button>
|
|
|
- </el-col>
|
|
|
- <el-col :span="1.5">
|
|
|
- <el-button
|
|
|
- type="info"
|
|
|
- plain
|
|
|
- icon="el-icon-edit"
|
|
|
- size="mini"
|
|
|
- @click="handleListPlan"
|
|
|
- v-hasPermi="['branch:plan:edit']"
|
|
|
- >编辑标题</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="['branch:planitem: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="['branch:planitem:remove']"
|
|
|
- >删除</el-button>
|
|
|
- </el-col>
|
|
|
- <!--<el-col :span="1.5">-->
|
|
|
- <!--<el-button-->
|
|
|
- <!--type="info"-->
|
|
|
- <!--plain-->
|
|
|
- <!--icon="el-icon-upload2"-->
|
|
|
- <!--size="mini"-->
|
|
|
- <!--@click="handleImport"-->
|
|
|
- <!--v-hasPermi="['branch:planitem:edit']"-->
|
|
|
- <!-->导入</el-button>-->
|
|
|
- <!--</el-col>-->
|
|
|
- <!--<el-col :span="1.5">-->
|
|
|
- <!--<el-button-->
|
|
|
- <!--type="warning"-->
|
|
|
- <!--plain-->
|
|
|
- <!--icon="el-icon-download"-->
|
|
|
- <!--size="mini"-->
|
|
|
- <!--@click="handleExport"-->
|
|
|
- <!--v-hasPermi="['branch:planitem:export']"-->
|
|
|
- <!-->导出</el-button>-->
|
|
|
- <!--</el-col>-->
|
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
</el-row>
|
|
|
|
|
|
- <el-table v-loading="loading" :data="planitemList" @selection-change="handleSelectionChange" :height="clientHeight" border :span-method="objectSpanMethod">
|
|
|
+ <el-table v-loading="loading" :data="planList" @selection-change="handleSelectionChange" :height="clientHeight" border :span-method="objectSpanMethod">
|
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
|
- <el-table-column label="标题" align="center" prop="planId" :formatter="planListFormat" />
|
|
|
- <el-table-column label="内容" align="center" prop="itemContent" />
|
|
|
+ <el-table-column label="标题" align="center" prop="planTitle" width="200" />
|
|
|
+ <el-table-column label="内容" align="center" prop="itemContent"/>
|
|
|
<el-table-column label="计划实施时间" align="center" prop="planTime" width="100">
|
|
|
<template slot-scope="scope">
|
|
|
<span>{{ parseTime(scope.row.planTime, '{y}-{m}-{d}') }}</span>
|
|
@@ -117,6 +55,7 @@
|
|
|
icon="el-icon-edit"
|
|
|
@click="handleUpdate(scope.row)"
|
|
|
v-hasPermi="['branch:planitem:edit']"
|
|
|
+ v-if="scope.row.itemId != null"
|
|
|
>修改</el-button>
|
|
|
<el-button
|
|
|
size="mini"
|
|
@@ -124,6 +63,32 @@
|
|
|
icon="el-icon-delete"
|
|
|
@click="handleDelete(scope.row)"
|
|
|
v-hasPermi="['branch:planitem:remove']"
|
|
|
+ v-if="scope.row.itemId != null"
|
|
|
+ >删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作" align="center" fixed="right" width="240" class-name="small-padding fixed-width">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ size="mini"
|
|
|
+ icon="el-icon-plus"
|
|
|
+ @click="handleAdd(scope.row)"
|
|
|
+ v-hasPermi="['branch:planitem:add']"
|
|
|
+ >新增条目</el-button>
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ icon="el-icon-edit"
|
|
|
+ @click="handleUpdatePlan(scope.row)"
|
|
|
+ v-hasPermi="['branch:plan:edit']"
|
|
|
+ >修改</el-button>
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ icon="el-icon-delete"
|
|
|
+ @click="handleDeletePlan(scope.row)"
|
|
|
+ v-hasPermi="['branch:plan:remove']"
|
|
|
>删除</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
@@ -140,15 +105,8 @@
|
|
|
<!-- 添加或修改支部年度工作计划条目对话框 -->
|
|
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
|
- <el-form-item label="标题" prop="planId">
|
|
|
- <el-select v-model="form.planId" placeholder="请选择标题">
|
|
|
- <el-option
|
|
|
- v-for="dict in planList"
|
|
|
- :key="dict.dictValue"
|
|
|
- :label="dict.dictLabel"
|
|
|
- :value="dict.dictValue"
|
|
|
- ></el-option>
|
|
|
- </el-select>
|
|
|
+ <el-form-item label="标题" prop="planTitle">
|
|
|
+ <el-input v-model="form.planTitle" disabled />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="内容" prop="itemContent">
|
|
|
<el-input v-model="form.itemContent" placeholder="请输入内容" />
|
|
@@ -204,6 +162,13 @@
|
|
|
<el-form-item label="标题" prop="planTitle">
|
|
|
<el-input v-model="formPlan.planTitle" placeholder="请输入标题" />
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="所属年份" prop="planYear">
|
|
|
+ <el-date-picker clearable size="small" style="width: 200px"
|
|
|
+ v-model="formPlan.planYear"
|
|
|
+ type="year"
|
|
|
+ placeholder="选择年份">
|
|
|
+ </el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
<el-form-item label="归属部门" prop="deptId">
|
|
|
<treeselect v-model="formPlan.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门" />
|
|
|
</el-form-item>
|
|
@@ -213,46 +178,6 @@
|
|
|
<el-button @click="cancelPlan">取 消</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
- <!-- 编辑标题对话框 -->
|
|
|
- <el-dialog :title="titleListPlan" :visible.sync="openListPlan" width="500px" append-to-body>
|
|
|
- <el-table :data="planList" border>
|
|
|
- <el-table-column label="编号" align="center" prop="dictValue" width="80px"/>
|
|
|
- <el-table-column label="标题" align="center" prop="dictLabel">
|
|
|
- <template slot-scope="scope">
|
|
|
- <span v-if="!scope.row.isEdit">{{scope.row.dictLabel}}</span>
|
|
|
- <span v-if="scope.row.isEdit"><el-input v-model="scope.row.dictLabel" /></span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="操作" align="center" fixed="right" width="120" class-name="small-padding fixed-width">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-button
|
|
|
- size="mini"
|
|
|
- type="text"
|
|
|
- icon="el-icon-edit"
|
|
|
- @click="handleUpdatePlan(scope.row)"
|
|
|
- v-hasPermi="['branch:plan:edit']"
|
|
|
- v-if="!scope.row.isEdit"
|
|
|
- >编辑</el-button>
|
|
|
- <el-button
|
|
|
- size="mini"
|
|
|
- type="text"
|
|
|
- icon="el-icon-check"
|
|
|
- @click="handleConfirmPlan(scope.row)"
|
|
|
- v-hasPermi="['branch:plan:edit']"
|
|
|
- v-if="scope.row.isEdit"
|
|
|
- >确定</el-button>
|
|
|
- <el-button
|
|
|
- size="mini"
|
|
|
- type="text"
|
|
|
- icon="el-icon-delete"
|
|
|
- @click="handleDeletePlan(scope.row)"
|
|
|
- v-hasPermi="['branch:plan:remove']"
|
|
|
- >删除</el-button>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- </el-dialog>
|
|
|
-
|
|
|
<!-- 用户导入对话框 -->
|
|
|
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
|
|
|
<el-upload
|
|
@@ -312,8 +237,7 @@ export default {
|
|
|
showSearch: true,
|
|
|
// 总条数
|
|
|
total: 0,
|
|
|
- // 支部年度工作计划条目表格数据
|
|
|
- planitemList: [],
|
|
|
+ planList: [],
|
|
|
// 弹出层标题
|
|
|
title: "",
|
|
|
titlePlan: "",
|
|
@@ -327,8 +251,6 @@ export default {
|
|
|
openListPlan: false,
|
|
|
// 当前状态字典
|
|
|
itemStatusOptions: [],
|
|
|
- // 工作计划列表
|
|
|
- planList: [],
|
|
|
// 用户列表
|
|
|
userList: [],
|
|
|
// 用户导入参数
|
|
@@ -378,6 +300,9 @@ export default {
|
|
|
planTitle: [
|
|
|
{ required: true, message: "标题不能为空", trigger: "blur" }
|
|
|
],
|
|
|
+ planYear: [
|
|
|
+ { required: true, message: "所属年份不能为空", trigger: "blur" }
|
|
|
+ ],
|
|
|
deptId: [
|
|
|
{ required: true, message: "归属部门不能为空", trigger: "blur" }
|
|
|
],
|
|
@@ -398,7 +323,6 @@ export default {
|
|
|
// 设置搜索条件年份为当年
|
|
|
this.setYear();
|
|
|
this.getList();
|
|
|
- this.getPlanList();
|
|
|
this.getTreeselect();
|
|
|
this.getDicts("plan_item_status").then(response => {
|
|
|
this.itemStatusOptions = response.data;
|
|
@@ -423,18 +347,6 @@ export default {
|
|
|
this.userList = userList;
|
|
|
});
|
|
|
},
|
|
|
- /** 查询工作计划列表 */
|
|
|
- getPlanList() {
|
|
|
- listPlan().then(response => {
|
|
|
- let data = response.data;
|
|
|
- let planList = [];
|
|
|
- for(let i = 0; i < data.length; i++) {
|
|
|
- let plan = { "dictValue" : data[i].planId, "dictLabel" : data[i].planTitle, "isEdit": false};
|
|
|
- planList.push(plan);
|
|
|
- }
|
|
|
- this.planList = planList;
|
|
|
- });
|
|
|
- },
|
|
|
/** 计算单元格合并行数 */
|
|
|
getSpanArr(list) {
|
|
|
list.forEach(item => {
|
|
@@ -451,11 +363,11 @@ export default {
|
|
|
// 这里跳过已经重复的数据
|
|
|
i = i + list[i].rowspan - 1;
|
|
|
}
|
|
|
- this.planitemList = list;
|
|
|
+ this.planList = list;
|
|
|
},
|
|
|
/** 单元格合并 */
|
|
|
objectSpanMethod({ row, column, rowIndex, columnIndex }) {
|
|
|
- if (columnIndex === 1) {
|
|
|
+ if (columnIndex === 1 || columnIndex == 8) {
|
|
|
return {
|
|
|
rowspan: row.rowspan,
|
|
|
colspan: 1,
|
|
@@ -476,27 +388,39 @@ export default {
|
|
|
}
|
|
|
this.userList = userList;
|
|
|
}).then(() => {
|
|
|
- return listPlanitem({
|
|
|
+ return listPlan({
|
|
|
"planYear": this.queryParams.planYear.getFullYear(),
|
|
|
"deptId": this.queryParams.deptId
|
|
|
});
|
|
|
}).then(response => {
|
|
|
- this.planitemList = response.rows;
|
|
|
- for (let i = 0; i < this.planitemList.length; i++) {
|
|
|
- if (this.planitemList[i].personInCharge != null) {
|
|
|
- let personInCharge = this.planitemList[i].personInCharge.split(",");
|
|
|
- let personInChargeString = "";
|
|
|
- for (let j = 0; j < personInCharge.length; j++) {
|
|
|
- if (j > 0) {
|
|
|
- personInChargeString += "、" + this.selectDictLabel(this.userList, personInCharge[j]);
|
|
|
- } else {
|
|
|
- personInChargeString += this.selectDictLabel(this.userList, personInCharge[j]);
|
|
|
+ let rows = response.rows;
|
|
|
+ let planList = [];
|
|
|
+ for (let i = 0; i < rows.length; i ++) {
|
|
|
+ let itemList = rows[i].itemList;
|
|
|
+ if (itemList.length == 0) {
|
|
|
+ let row = {...rows[i]};
|
|
|
+ planList.push(row);
|
|
|
+ } else {
|
|
|
+ for (let j = 0; j < itemList.length; j++) {
|
|
|
+ if (itemList[j].personInCharge != null) {
|
|
|
+ let personInCharge = itemList[j].personInCharge.split(",");
|
|
|
+ let personInChargeString = "";
|
|
|
+ for (let k = 0; k < personInCharge.length; k++) {
|
|
|
+ if (k > 0) {
|
|
|
+ personInChargeString += "、" + this.selectDictLabel(this.userList, personInCharge[k]);
|
|
|
+ } else {
|
|
|
+ personInChargeString += this.selectDictLabel(this.userList, personInCharge[k]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ itemList[j].personInChargeString = personInChargeString;
|
|
|
+ }
|
|
|
+ let row = {...rows[i], ...itemList[j]};
|
|
|
+ planList.push(row);
|
|
|
}
|
|
|
}
|
|
|
- this.planitemList[i].personInChargeString = personInChargeString;
|
|
|
- }
|
|
|
}
|
|
|
- this.getSpanArr(this.planitemList);
|
|
|
+ this.planList = planList;
|
|
|
+ this.getSpanArr(this.planList);
|
|
|
this.total = response.total;
|
|
|
this.loading = false;
|
|
|
});
|
|
@@ -511,10 +435,6 @@ export default {
|
|
|
itemStatusFormat(row, column) {
|
|
|
return this.selectDictLabel(this.itemStatusOptions, row.itemStatus);
|
|
|
},
|
|
|
- // 工作计划字典翻译
|
|
|
- planListFormat(row, column) {
|
|
|
- return this.selectDictLabel(this.planList, row.planId);
|
|
|
- },
|
|
|
// 取消按钮
|
|
|
cancel() {
|
|
|
this.open = false;
|
|
@@ -573,8 +493,11 @@ export default {
|
|
|
this.multiple = !selection.length
|
|
|
},
|
|
|
/** 新增按钮操作 */
|
|
|
- handleAdd() {
|
|
|
+ handleAdd(row) {
|
|
|
this.reset();
|
|
|
+ this.form.planId = row.planId;
|
|
|
+ this.form.planTitle = row.planTitle;
|
|
|
+ this.form.deptId = row.deptId;
|
|
|
this.open = true;
|
|
|
this.title = "添加支部年度工作计划条目";
|
|
|
},
|
|
@@ -583,17 +506,14 @@ export default {
|
|
|
this.openPlan = true;
|
|
|
this.titlePlan = "添加支部年度工作计划标题";
|
|
|
},
|
|
|
- /** 编辑标题按钮操作 */
|
|
|
- handleListPlan() {
|
|
|
- this.openListPlan = true;
|
|
|
- this.titleListPlan = "编辑标题";
|
|
|
- },
|
|
|
/** 修改按钮操作 */
|
|
|
handleUpdate(row) {
|
|
|
+ console.log(row)
|
|
|
this.reset();
|
|
|
const itemId = row.itemId || this.ids
|
|
|
getPlanitem(itemId).then(response => {
|
|
|
this.form = response.data;
|
|
|
+ this.form.planTitle = row.planTitle;
|
|
|
if (this.form.personInCharge != null) {
|
|
|
this.form.personInCharge = this.form.personInCharge.split(",").map(Number);
|
|
|
}
|
|
@@ -602,17 +522,13 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
handleUpdatePlan(row) {
|
|
|
- row.isEdit = true;
|
|
|
- },
|
|
|
- handleConfirmPlan(row) {
|
|
|
- updatePlan({
|
|
|
- "planId": row.dictValue,
|
|
|
- "planTitle": row.dictLabel
|
|
|
- }).then(response => {
|
|
|
- this.$modal.msgSuccess("修改成功");
|
|
|
- row.isEdit = false;
|
|
|
- this.getPlanList();
|
|
|
- this.getList();
|
|
|
+ // row.isEdit = true;
|
|
|
+ this.resetPlan();
|
|
|
+ const planId = row.planId || this.ids
|
|
|
+ getPlan(planId).then(response => {
|
|
|
+ this.formPlan = response.data;
|
|
|
+ this.openPlan = true;
|
|
|
+ this.titlePlan = "修改支部年度工作计划标题";
|
|
|
});
|
|
|
},
|
|
|
/** 提交按钮 */
|
|
@@ -641,6 +557,9 @@ export default {
|
|
|
submitFormPlan() {
|
|
|
this.$refs["formPlan"].validate(valid => {
|
|
|
if (valid) {
|
|
|
+ if (typeof(this.formPlan.planYear) != 'string') {
|
|
|
+ this.formPlan.planYear = this.formPlan.planYear.getFullYear();
|
|
|
+ }
|
|
|
if (this.formPlan.planId != null) {
|
|
|
updatePlan(this.formPlan).then(response => {
|
|
|
this.$modal.msgSuccess("修改成功");
|
|
@@ -652,7 +571,6 @@ export default {
|
|
|
this.$modal.msgSuccess("新增成功");
|
|
|
this.openPlan = false;
|
|
|
this.getList();
|
|
|
- this.getPlanList();
|
|
|
});
|
|
|
}
|
|
|
}
|
|
@@ -678,9 +596,9 @@ export default {
|
|
|
cancelButtonText: "取消",
|
|
|
type: "warning"
|
|
|
}).then(function() {
|
|
|
- return delPlan(row.dictValue);
|
|
|
+ return delPlan(row.planId);
|
|
|
}).then(() => {
|
|
|
- this.getPlanList();
|
|
|
+ this.getList();
|
|
|
this.$modal.msgSuccess("删除成功");
|
|
|
})
|
|
|
},
|