| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023 |
- <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
- :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
- );
- },
- 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>
|