| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024 |
- <template>
- <div class="app-container">
- <el-row :gutter="10">
- <!--机构数据-->
- <!-- <el-col :span="4" :xs="24">
- <org-tree v-model="queryParams.belongOrgId" @defaultKey="getDefaultKey" @checkChange="checkChange"
- @click="clickTreeNode" hangsheTree :defaultCheckSub="false"></org-tree>
- </el-col> -->
- <!--搜索栏-->
- <el-col :span="24" :xs="24">
- <div class="main-right-box">
- <div class="main-search-box">
- <el-form
- :model="queryParams"
- ref="queryForm"
- size="small"
- :inline="true"
- v-show="showSearch"
- >
- <el-form-item label="行社名称">
- <org-tree
- v-model="queryParams.belongOrgId"
- @defaultKey="getDefaultKey"
- @checkChange="checkChange"
- @click="clickTreeNode"
- hangsheTree
- :defaultCheckSub="false"
- ref="orgTree"
- ></org-tree>
- </el-form-item>
- <el-form-item label="任务名称" prop="planName">
- <el-input
- v-model="queryParams.planName"
- placeholder="请输入关键字"
- clearable
- @keyup.enter.native="handleQuery"
- />
- </el-form-item>
- <el-form-item label="机构类型" prop="execOrgType">
- <el-select
- v-model="queryParams.execOrgType"
- placeholder="请选择机构类型"
- clearable
- >
- <el-option
- v-for="dict in dict.type.sys_org_type"
- :key="dict.value"
- :label="dict.label"
- :value="dict.value"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="任务状态" prop="planStatus">
- <el-select
- v-model="queryParams.planStatus"
- placeholder="请选择任务状态"
- clearable
- >
- <el-option
- v-for="dict in dict.type.drill_plan_status"
- :key="dict.value"
- :label="dict.label"
- :value="dict.value"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="任务周期" prop="planCycle">
- <el-select
- v-model="queryParams.planCycle"
- placeholder="请选择任务周期"
- clearable
- >
- <el-option
- v-for="dict in dict.type.drill_plan_cycle"
- :key="dict.value"
- :label="dict.label"
- :value="dict.value"
- />
- </el-select>
- </el-form-item>
- <!-- <el-form-item label="演练角色" prop="planRoleId">
- <el-select v-model="queryParams.planRoleId" placeholder="请选择演练角色" clearable>
- <el-option v-for="item in planRoleList" :key="item.roleId" :label="item.roleName"
- :value="item.roleId"></el-option>
- </el-select>
- </el-form-item>-->
- <!-- <el-form-item>
- <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
- </el-form-item> -->
- </el-form>
- <el-row :gutter="10">
- <el-col :span="1.5">
- <el-button
- type="primary"
- icon="el-icon-search"
- size="mini"
- @click="handleQuery"
- >搜索
- </el-button
- >
- </el-col>
- <el-col :span="1.5">
- <el-button
- type="primary"
- icon="el-icon-refresh"
- size="mini"
- @click="resetQuery"
- >重置
- </el-button
- >
- </el-col>
- <el-col :span="1.5">
- <el-button
- type="primary"
- icon="el-icon-plus"
- size="mini"
- @click="handleAdd"
- v-hasPermi="['core:drillPlan:add']"
- >新增任务
- </el-button>
- </el-col>
- <right-toolbar
- :showSearch.sync="showSearch"
- @queryTable="getList"
- ></right-toolbar>
- </el-row>
- </div>
- <el-table
- height="646"
- border
- size="small"
- :data="planList"
- @selection-change="handleSelectionChange"
- row-key="id"
- :tree-props="{ children: 'children' }"
- >
- <el-table-column label="序号" align="center" width="60" prop="no"/>
- <el-table-column
- label="任务名称"
- align="center"
- prop="planName"
- :show-overflow-tooltip="true"
- />
- <el-table-column
- label="创建机构"
- align="center"
- width="220"
- prop="createOrgName"
- />
- <el-table-column
- label="行社名称"
- align="center"
- width="220"
- prop="belongOrgName"
- />
- <el-table-column
- label="机构类型"
- align="center"
- width="120"
- prop="execOrgType"
- >
- <template slot-scope="scope">
- <dict-tag
- :options="dict.type.sys_org_type"
- :value="scope.row.execOrgType"
- />
- </template>
- </el-table-column>
- <el-table-column
- label="任务周期"
- align="center"
- width="120"
- prop="planCycle"
- >
- <template slot-scope="scope">
- <dict-tag
- :options="dict.type.drill_plan_cycle"
- :value="scope.row.planCycle"
- />
- </template>
- </el-table-column>
- <el-table-column
- label="任务次数"
- align="center"
- width="120"
- prop="execTimes"
- />
- <el-table-column
- label="任务状态"
- align="center"
- width="120"
- prop="planStatus"
- >
- <template slot-scope="scope">
- <dict-tag
- :options="dict.type.drill_plan_status"
- :value="scope.row.planStatus"
- />
- </template>
- </el-table-column>
- <!-- <el-table-column label="备注" align="center" prop="remark"/> -->
- <!-- <el-table-column label="修改人" align="center" width="100" prop="updateBy"/> -->
- <el-table-column
- label="操作"
- align="center"
- fixed="right"
- width="200"
- class-name="small-padding fixed-width"
- >
- <template slot-scope="scope">
- <el-button
- v-if="checkCanPublish(scope.row)"
- size="mini"
- type="text"
- icon="el-icon-arrow-down"
- @click="handlePublish(scope.row)"
- v-hasPermi="['core:drillPlan:publish']"
- >下发
- </el-button>
- <el-button
- v-if="checkCanRevocation(scope.row)"
- size="mini"
- type="text"
- icon="el-icon-top-left"
- @click="handleRevocation(scope.row)"
- v-hasPermi="['core:plan:edit']"
- >撤回
- </el-button>
- <el-button
- v-if="checkCanEdit(scope.row)"
- size="mini"
- type="text"
- icon="el-icon-edit-outline"
- @click="handleUpdate(scope.row)"
- v-hasPermi="['core:drillPlan:edit']"
- >编辑
- </el-button>
- <el-button
- v-if="checkCanDel(scope.row)"
- size="mini"
- type="text"
- icon="el-icon-delete"
- @click="handleDelete(scope.row)"
- v-hasPermi="['core:drillPlan:remove']"
- >删除
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- <pagination
- :total="total"
- :page.sync="queryParams.pageNum"
- :limit.sync="queryParams.pageSize"
- @pagination="getList"
- />
- </div>
- </el-col>
- </el-row>
- <!-- 添加或修改教育培训计划对话框 -->
- <DialogCom
- :title="title"
- :visible.sync="open"
- :before-close="closeDialog"
- :close="cancel"
- width="850px"
- height="800px"
- append-to-body
- >
- <el-form ref="form" :model="form" :rules="rules" label-width="110px">
- <el-row>
- <el-col :span="24">
- <el-form-item label="任务名称" prop="planName">
- <el-input
- v-model="form.planName"
- placeholder="请输入任务名称"
- maxlength="50"
- />
- </el-form-item>
- </el-col>
- <!-- <el-col :span="12">
- <el-form-item label="演练类型" prop="category">
- <el-select style="width: 100%" v-model="form.category" placeholder="请选择演练类型" @change="drillTypeSelected()">
- <el-option v-for="dict in dict.type.core_drill_category" :key="dict.value" :label="dict.label"
- :value="parseInt(dict.value)"></el-option>
- </el-select>
- </el-form-item>
- </el-col>-->
- </el-row>
- <el-row>
- <el-col :span="12">
- <el-form-item label="任务周期" prop="planCycle">
- <el-select
- v-model="form.planCycle"
- placeholder="请选择任务周期"
- style="width: 100%"
- :disabled="tableDisable()"
- >
- <el-option
- v-for="dict in dict.type.drill_plan_cycle"
- :key="dict.value"
- :label="dict.label"
- :value="parseInt(dict.value)"
- ></el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="任务次数" prop="execTimes">
- <template>
- <el-input-number
- :disabled="tableDisable()"
- style="width: 100%"
- v-model="form.execTimes"
- :min="1"
- :max="10"
- ></el-input-number>
- </template>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="12" v-show="form.planCycle == 0">
- <el-form-item prop="startDate" label="开始日期">
- <el-date-picker
- :disabled="tableDisable()"
- style="width: 100%"
- v-model="form.startDate"
- @change="startDateChanged"
- :picker-options="startDatepickerOptions"
- align="right"
- type="date"
- placeholder="选择开始日期"
- >
- </el-date-picker>
- </el-form-item>
- </el-col>
- <el-col :span="12" v-show="form.planCycle == 0">
- <el-form-item prop="endDate" label="结束日期">
- <el-date-picker
- :disabled="tableDisable()"
- style="width: 100%"
- v-model="form.endDate"
- :picker-options="endDatepickerOptions"
- align="right"
- type="date"
- placeholder="选择结束日期"
- >
- </el-date-picker>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <!-- <el-col :span="12" v-show="showBuildTaskNow()">
- <el-form-item label="立即生效" prop="buildTaskNow">
- <el-checkbox v-model="form.buildTaskNow">
- 默认从下个周期...
- <el-popover placement="top-start" title="" width="200" trigger="hover"
- content="默认从下个周期生成任务,勾选后从当前周期立即生成任务">
- <i class="el-icon-warning-outline change-icon" slot="reference"></i>
- </el-popover>
- </el-checkbox>
- <el-checkbox v-model="form.buildTaskNow">
- 默认从下个周期生成任务,
- <br />
- 勾选后从当前周期立即生成任务
- </el-checkbox>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="机构类型" prop="execOrgType">
- <el-select
- v-model="form.execOrgType"
- placeholder="请选择执行机构类型"
- @change="execOrgTypeChanged()"
- style="width: 100%"
- >
- <el-option
- v-for="dict in dict.type.sys_org_type"
- :key="dict.value"
- :label="dict.label"
- :value="parseInt(dict.value)"
- ></el-option>
- </el-select>
- </el-form-item>
- </el-col>-->
- <el-col :span="12">
- <el-form-item label="机构类型" prop="execOrgType">
- <el-select
- :disabled="tableDisable()"
- style="width: 100%"
- v-model="form.execOrgType"
- placeholder="请选择机构类型"
- @change="execOrgTypeChanged()"
- >
- <el-option
- v-for="dict in getUserOrgType"
- :key="dict.value"
- :label="dict.label"
- :value="parseInt(dict.value)"
- ></el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <!-- <el-row>
- <el-col :span="12">
- <el-form-item label="演练角色" prop="planRoleId">
- <el-select v-model="form.planRoleId" placeholder="请选择" multiple style="width:100%">
- <el-option v-for="item in roleList" :key="item.id" :label="item.name" :value="item.id"></el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item v-if="this.form.id" label="计划状态" prop="planStatus">
- <el-select v-model="form.planStatus" placeholder="请选择计划状态" style="width: 100%;">
- <el-option v-for="dict in dict.type.drill_plan_status" :key="dict.value" :label="dict.label"
- :value="parseInt(dict.value)"></el-option>
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>-->
- <el-col :span="12">
- <el-form-item
- v-show="form.execOrgType"
- label="演练机构"
- prop="planExecOrgIdList"
- >
- <org-tree-select
- :disabled="tableDisable()"
- v-model="form.planExecOrgIdList"
- :queryData="form.execOrgType"
- ref="orgTreeSelect"
- :enabledCheckOrgTypes="form.execOrgType"
- :disable="true"
- >
- </org-tree-select>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="24">
- <el-form-item label="备注" prop="remark">
- <el-input v-model="form.remark" placeholder="请输入备注" :disabled="tableDisable()"/>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="12">
- <el-form-item label="上传文件" prop="fileList">
- <K-file-upload
- :disabled="tableDisable()"
- ref="upload"
- :defaultValue="formFileListDefualtValue"
- v-model="form.fileList"
- />
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="submitForm">确 定</el-button>
- <el-button @click="cancel">取 消</el-button>
- </div>
- </DialogCom>
- <DialogThreeState ref="DialogThreeState"></DialogThreeState>
- <!-- <DialogSelectFile
- ref="DialogSelectFile"
- :defaultSelect=defaultSelect
- @select="fileSelected"
- :orgId="orgId"
- ></DialogSelectFile> -->
- </div>
- </template>
- <script>
- import {
- addPlan,
- delPlan,
- getPlan,
- listPlan,
- listPlanRole,
- publishPlan,
- roleList,
- updatePlan,
- revocationPlan,
- } from "@/api/core/drill/drillPlan";
- import tableList from "@/mixins/tableList";
- import OrgTree from "@/components/orgTree/orgQuerySelector.vue";
- import {deptTreeSelect} from "@/api/system/public";
- import KFileUpload from "@/components/K-FileUpload/index.vue";
- // import DialogSelectFile from "./dialog.select.file.vue";
- import OrgTreeSelect from "@/components/orgTreeSelect";
- import dayjs from "dayjs";
- import {mapGetters} from "vuex";
- import DialogThreeState from "@/components/message/threeStateMessageBox.vue";
- export default {
- name: "Plan",
- dicts: [
- "sys_org_type",
- "drill_plan_status",
- "drill_plan_cycle",
- "core_drill_category",
- ],
- components: {OrgTree, KFileUpload, OrgTreeSelect, DialogThreeState},
- mixins: [tableList],
- data() {
- return {
- // 遮罩层
- loading: true,
- // 选中数组
- ids: [],
- // 非单个停用
- single: true,
- // 非多个停用
- multiple: true,
- // 显示搜索条件
- showSearch: true,
- // 总条数
- total: 0,
- // 教育培训计划表格数据
- planList: [],
- // 弹出层标题
- title: "",
- // 是否显示弹出层
- open: false,
- isUnfold: false,
- defaultSelect: [],
- orgId: null,
- // 查询参数
- queryParams: {
- execOrgType: null,
- planCycle: null,
- planStatus: null,
- planRoleId: null,
- planName: null,
- checkSub: false,
- pageNum: 1,
- pageSize: 10,
- belongOrgId: null,
- },
- formFileListDefualtValue: [],
- // 表单参数
- form: {},
- // 表单校验
- rules: {
- planName: [
- {required: true, message: "任务名称不能为空", trigger: "blur"},
- ],
- planCycle: [
- {required: true, message: "任务周期不能为空", trigger: "blur"},
- ],
- execTimes: [
- {required: true, message: "任务次数不能为空", trigger: "blur"},
- ],
- category: [
- {required: true, message: "演练类型不能为空", trigger: "blur"},
- ],
- execOrgType: [
- {required: true, message: "机构类型不能为空", trigger: "blur"},
- ],
- // planRoleId: [
- // {required: true, message: "演练角色不能为空", trigger: "blur"}
- // ],
- },
- planRoleList: [],
- roleList: [],
- //修改新增中的机构树
- deptOptions: [],
- startDatepickerOptions: {
- disabledDate(time) {
- const date = new Date();
- date.setTime(date.getTime() - 3600 * 1000 * 24);
- return time.getTime() < date;
- },
- },
- endDatepickerOptions: {
- disabledDate: this.disabledDate,
- },
- };
- },
- created() {
- this.getList();
- //this.initPlanRoleList();
- this.orgId = this.$store.getters.orgId;
- },
- computed: {
- getUserOrgType() {
- let tempArray = [];
- this.dict.type.sys_org_type.forEach((x) => {
- if (Number(x.value) >= this.$store.getters.orgType && (x.value != 7 && x.value != 8)) {
- tempArray.push(x);
- }
- });
- // console.log("computed getUserOrgType",tempArry);
- return tempArray;
- },
- },
- methods: {
- /** 查询预案演练计划列表 */
- getList() {
- this.loading = true;
- listPlan(this.queryParams).then((response) => {
- this.planList = response.rows;
- this.total = response.total;
- this.loading = false;
- });
- },
- delayFlush(time) {
- setTimeout(() => {
- this.getList()
- }, time)
- },
- //初始化与计划相关的角色信息
- initPlanRoleList() {
- listPlanRole({}).then((response) => {
- this.planRoleList = response.data;
- });
- },
- //初始化所有角色数据
- initRoleList(query) {
- this.form.planRoleId = [];
- roleList(query).then((response) => {
- this.roleList = response.data;
- });
- },
- startDateChanged(time) {
- if (this.form.startDate > this.form.endDate) {
- this.form.endDate = this.form.startDate;
- }
- },
- disabledDate(time) {
- //小于开始日期禁止选择
- let startDate = new Date();
- startDate.setTime(startDate.getTime() - 3600 * 1000 * 24);
- if (this.form.startDate) {
- startDate = new Date(
- this.formatTime(this.form.startDate, "YYYY-MM-DD")
- );
- startDate.setTime(startDate.getTime() - 3600 * 1000 * 24);
- }
- return time.getTime() < new Date(startDate).getTime();
- },
- //已完成下发的计划不显示下发按钮
- checkCanPublish(row) {
- if (
- row.issue == 0 &&
- row.standard == 1 &&
- (row.planStatus == 0 || row.planStatus == 2) &&
- this.checkCanEdit(row)
- ) {
- return true;
- }
- return false;
- },
- //撤回按钮
- checkCanRevocation(row) {
- return row.planStatus == 1 && row.standard == 1 && this.checkCanEdit(row);
- },
- //所属机构为当前用户登录机构时才显示 “编辑、删除”按钮
- checkCanEdit(row) {
- console.log("checkCanEdit", this.$store.getters.orgId, row.belongOrgId)
- return (
- row.belongOrgId == this.$store.getters.orgId && row.createOrgId == this.$store.getters.orgId
- );
- },
- checkCanDel(row) {
- // console.log("checkCanEdit",this.$store.getters.orgId,row)
- // 计划仅能够通过删除标准计划来删除
- /* return (row.belongOrgId == this.$store.getters.orgId || row.createOrgId == this.$store.getters.orgId)
- && (row.issue != 1 || (row.issue == 1 && row.done != 1))*/
- return (
- (row.standard == 1 || row.standard == 2) && /*row.done != 1 &&*/
- this.checkCanEdit(row)
- );
- },
- //省联社下发的计划不显示“删除”按钮
- checkCreateByTopOrg(row) {
- return row.createByTopOrg !== 1;
- },
- execOrgTypeChanged(row) {
- this.$refs["orgTreeSelect"].clear();
- // this.initRoleList(this.form.execOrgType);
- // this.form.planExecOrgIdList = [];
- },
- showBuildTaskNow() {
- //如果是新增的情况下
- if (!this.form.id) {
- return this.form.planCycle != 0;
- } else {
- //如果是编辑的情况下,判断是否是标准计划
- /*if (this.form.standard==1){
- return this.form.planCycle != 0&&this.form.issue == 0
- }*/
- return this.form.planStatus == 0 && this.form.planCycle != 0;
- }
- },
- /** 查询机构树数据 */
- getDeptTree() {
- deptTreeSelect().then((response) => {
- this.deptOptions = response.data;
- });
- },
- // 取消按钮
- cancel() {
- this.open = false;
- this.reset();
- this.$refs["orgTreeSelect"].clear();
- this.$refs["upload"].clearFiles();
- },
- closeDialog() {
- this.cancel();
- },
- // 表单重置
- reset() {
- this.form = {
- id: null,
- planName: null,
- planCycle: null,
- execTimes: null,
- planStatus: null,
- execOrgType: null,
- planExecOrgIdList: null,
- startDate: null,
- endDate: null,
- buildTaskNow: null,
- remark: null,
- planRoleId: null,
- fileList: null,
- standard: null,
- category: null,
- checkSub: true,
- done: null,
- };
- this.resetForm("form");
- },
- getDefaultKey(key) {
- this.queryParams.belongOrgId = key;
- this.getList();
- },
- //单选框状态改变
- checkChange(state) {
- this.queryParams.checkSub = state;
- this.handleQuery();
- },
- // 节点单击事件
- clickTreeNode(data) {
- //this.initPlanRoleList();
- this.queryParams.belongOrgId = data.id;
- this.handleQuery();
- },
- /** treeSelect组件自定义数据*/
- tenantIdnormalizer(node, instanceId) {
- if (node.children && !node.children.length) {
- delete node.children;
- }
- return {
- id: node.id,
- label: node.name,
- children: node.children,
- };
- },
- /** 搜索按钮操作 */
- handleQuery() {
- this.queryParams.pageNum = 1;
- this.getList();
- },
- /** 重置按钮操作 */
- resetQuery() {
- this.resetForm("queryForm");
- this.queryParams.belongOrgId = this.$store.getters.orgId;
- this.queryParams.checkSub = false;
- this.$refs["orgTree"].setCheckSub(this.queryParams.checkSub)
- this.handleQuery();
- },
- // 多选框选中数据
- handleSelectionChange(selection) {
- this.ids = selection.map((item) => item.id);
- this.single = selection.length !== 1;
- this.multiple = !selection.length;
- },
- /** 新增按钮操作 */
- handleAdd() {
- //this.initRoleList();
- this.getDeptTree();
- this.reset();
- this.open = true;
- this.title = "新增演练任务";
- },
- /** 修改按钮操作 */
- handleUpdate(row) {
- // this.initRoleList();
- this.getDeptTree();
- this.reset();
- const id = row.id || this.ids;
- getPlan(id).then((response) => {
- this.form = response.data;
- this.formFileListDefualtValue = this.form.fileList;
- this.open = true;
- this.title = "编辑演练任务";
- });
- },
- drillTypeSelected() {
- if (this.form.category == 0) {
- this.form.planCycle = 4;
- this.form.execTimes = 1;
- this.form.execOrgType = 4;
- }
- if (this.form.category == 1) {
- this.form.planCycle = 6;
- this.form.execTimes = 2;
- this.form.execOrgType = 4;
- }
- },
- /** 提交按钮 */
- submitForm() {
- if (dayjs(this.form.startDate).isAfter(dayjs(this.form.endDate))) {
- this.$message.error("开始时间不能大于结束时间!");
- return;
- }
- this.$refs["form"].validate((valid) => {
- if (valid) {
- let request = {...this.form};
- console.log("request", request);
- if (this.form.planExecOrgIdList) {
- const list = Array.isArray(this.form.planExecOrgIdList)
- ? this.form.planExecOrgIdList
- : [this.form.planExecOrgIdList];
- request.planExecOrgIdList = list;
- } else {
- request.planExecOrgIdList = [];
- }
- if (request.id != null) {
- let msg = "";
- if (this.form.planStatus == 1) {
- if (this.form.done == 1) {
- msg = "因存在已完成任务,本次修改内容将从下周期生效";
- } else {
- msg = "因不存在已完成任务,本次修改内容将立即生效";
- }
- } else {
- msg = "是否确认修改?";
- }
- this.$modal
- .confirm(msg)
- .then(function () {
- return updatePlan(request);
- })
- .then(() => {
- this.$modal.msgSuccess("编辑成功");
- this.open = false;
- this.getList();
- this.$refs["upload"].clearFiles();
- })
- .catch(() => {
- });
- } else {
- addPlan(request).then((response) => {
- this.$modal.msgSuccess("新增成功");
- this.open = false;
- this.getList();
- this.$refs["upload"].clearFiles();
- });
- }
- }
- });
- },
- /** 删除按钮操作 */
- handleDelete(row) {
- let msg = "";
- if (row.planStatus == 0) {
- msg = '是否确认删除名称为"' + row.planName + '"的任务?';
- } else if (row.planStatus == 1) {
- if (row.planCycle == 1) {
- msg = "本次删除将强制删除今日所有任务?";
- } else {
- msg = "本次删除将强制删除当前任务时间及以后所有任务";
- }
- } else if (row.planStatus == 2) {
- if (row.planCycle == 1) {
- msg = "本次删除将强制删除今日所有任务";
- } else {
- msg = "本次删除将强制删除当前任务时间及以后所有任务";
- }
- }
- const ids = row.id || this.ids;
- this.$modal
- .confirm(msg)
- .then(function () {
- return delPlan(ids);
- })
- .then(() => {
- this.getList();
- this.$modal.msgSuccess("删除成功");
- })
- .catch(() => {
- });
- },
- /** 下发计划 */
- handlePublish(row) {
- let msg = "";
- if (row.planCycle == 0) {
- this.$modal
- .confirm("无周期任务下发将会立即生成任务,是否确认下发?", {
- confirmButtonText: "确定",
- canelButtonText: "取消",
- })
- .then(() => {
- publishPlan(row.id, 1);
- this.delayFlush(200);
- });
- } else {
- if (row.planStatus == 0) {
- msg = "请选择下发后立即生成或下周期生成任务?";
- this.$refs["DialogThreeState"].show(
- msg,
- (state) => {
- if (state == 0 || state == 1) {
- publishPlan(row.id, state);
- this.delayFlush(200);
- }
- },
- {
- yesText: "立即生成",//1
- noText: "下周期",//0
- cancelText: "取消",
- }
- );
- } else if (row.planStatus == 2) {
- this.$modal
- .confirm("因存在已完成任务,是否确定从下周期生成任务", {
- confirmButtonText: "确定",
- canelButtonText: "取消",
- })
- .then(() => {
- publishPlan(row.id, 0);
- this.delayFlush(200);
- });
- }
- }
- },
- //撤回计划
- handleRevocation(row) {
- if (row.id != null) {
- let msg = "";
- //无周期
- if (row.planCycle == 0) {
- if (row.done == 1) {
- msg = '因存在已完成任务,无周期任务不允许撤回,如需删除下发任务请点击"删除"';
- this.$alert(msg, '系统提示', {
- confirmButtonText: "确认"
- })
- return
- } else {
- msg = "因不存在已完成任务,撤回后将删除所有生成任务";
- }
- } else {
- //有周期
- if (row.done == 1) {
- msg =
- "因存在已完成任务,撤回后下周期起将不再生成任务";
- } else {
- msg = "因不存在已完成任务,撤回后将删除所有生成任务";
- }
- }
- this.$modal
- .confirm(msg)
- .then(function () {
- return revocationPlan(row.id);
- })
- .then(() => {
- this.$modal.msgSuccess("撤回成功");
- this.getList();
- })
- .catch(() => {
- });
- }
- },
- /** 导出按钮操作 */
- handleExport() {
- this.download(
- "system/plan/export",
- {
- ...this.queryParams,
- },
- `plan_${new Date().getTime()}.xlsx`
- );
- },
- tableDisable() {
- return this.form.planStatus == 1;
- },
- // showSelectFile() {
- // this.$refs["DialogSelectFile"].show();
- // },
- getMsgStr(row, type) {
- let str = "是否确认" + type + "该任务?";
- if (row.standard == 1) {
- str = "此操作将会影响所有行社任务," + str;
- }
- return str;
- },
- fileSelected(list) {
- console.log("fileSelected", list);
- if (!list) return;
- list.forEach((x) => {
- this.form.fileList = this.form.fileList.concat(x.fileList);
- });
- },
- },
- };
- </script>
|